[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3279] trunk



Revision: 3279
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3279&view=rev
Author:   einhverfr
Date:     2011-06-18 06:33:31 +0000 (Sat, 18 Jun 2011)

Log Message:
-----------
Can now save basic employee record

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Employee.pm
    trunk/UI/Contact/contact.html
    trunk/scripts/employee.pl

Modified: trunk/LedgerSMB/DBObject/Employee.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Employee.pm	2011-06-18 00:40:24 UTC (rev 3278)
+++ trunk/LedgerSMB/DBObject/Employee.pm	2011-06-18 06:33:31 UTC (rev 3279)
@@ -20,15 +20,71 @@
 }
 
 sub save_location {
+    my $self = shift @_;
+
+    $self->{country_id} = $self->{country_code};
+
+    my ($ref) = $self->exec_method(funcname => 'person__location_save');
+    my @vals = values %$ref;
+    $self->{location_id} = $vals[0];
+
+    $self->{dbh}->commit;
 }
 
 sub save_contact {
+    my ($self) = @_;
+    $self->exec_method(funcname => 'person__save_contact');
+    $self->{dbh}->commit;
 }
 
 sub save_bank_account {
+    my $self = shift @_;
+    $self->exec_method(funcname => 'entity__save_bank_account');
+    $self->{dbh}->commit;
 }
 
 sub save_note {
+    my $self = shift @_;
+    if ($self->{credit_id} && $self->{note_class} eq '3'){
+        $self->exec_method(funcname => 'eca__save_notes');
+    } else {
+        $self->exec_method(funcname => 'entity__save_notes');
+    }
+    $self->{dbh}->commit;
 }
     
+
+=over
+
+=item get_metadata()
+
+This retrieves various information vor building the user interface.  Among other
+things, it sets the following properties:
+$self->{ar_ap_acc_list} = qw(list of ar or ap accounts)
+$self->{cash_acc_list} = qw(list of cash accounts)
+
+=back
+
+=cut
+
+sub get_metadata {
+    my $self = shift @_;
+
+    @{$self->{entity_classes}} = 
+		$self->exec_method(funcname => 'entity__list_classes');
+
+    @{$self->{location_class_list}} = 
+         $self->exec_method(funcname => 'location_list_class');
+
+    @{$self->{country_list}} = 
+         $self->exec_method(funcname => 'location_list_country');
+
+    @{$self->{contact_class_list}} = 
+         $self->exec_method(funcname => 'entity_list_contact_class');
+    my $country_setting = LedgerSMB::Setting->new({base => $self, copy => 'base'});
+    $country_setting->{key} = 'default_country';
+    $country_setting->get;
+    $self->{default_country} = $country_setting->{value};
+}
+
 1;

Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html	2011-06-18 00:40:24 UTC (rev 3278)
+++ trunk/UI/Contact/contact.html	2011-06-18 06:33:31 UTC (rev 3279)
@@ -135,7 +135,19 @@
 	name = "sales"
 } ?>
 </div>
+<div class="input_group">
+       <?lsmb IF !country_id; country_id = default_country; END -?>
+       <?lsmb country_list.unshift({}) ?>
+		<?lsmb INCLUDE select element_data = {
+			text_attr = "name"
+			value_attr = "id"
+			default_values = [country_id_t]
+			options = country_list
+			name = "country_id"
+			label = text('Country:') 
+	} ?> 
 </div>
+</div>
 <div id="employee_div">
 <div class="input_group">
 <?lsmb PROCESS input element_data = {

Modified: trunk/scripts/employee.pl
===================================================================
--- trunk/scripts/employee.pl	2011-06-18 00:40:24 UTC (rev 3278)
+++ trunk/scripts/employee.pl	2011-06-18 06:33:31 UTC (rev 3279)
@@ -47,6 +47,7 @@
     my ($request) = @_;
     my $employee = LedgerSMB::DBObject::Employee->new(base => $request, copy => 'all');
     
+    $employee->get_metadata();
     $employee->set( entity_class=> '3' );
     $employee->{target_div} = 'hr_div'; 
     my $result = $employee->get();
@@ -68,7 +69,6 @@
     $employee->get();
 
     
-    #$employee->get_metadata();
 
     _render_main_screen($employee);
 	
@@ -172,7 +172,7 @@
 
 sub _render_main_screen{
     my $employee = shift @_;
-    #$employee->get_metadata();
+    $employee->get_metadata();
 
     $employee->{creditlimit} = "$employee->{creditlimit}"; 
     $employee->{discount} = "$employee->{discount}"; 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.