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

SF.net SVN: ledger-smb:[4849] addons/1.3/colombia_general/trunk/LedgerSMB/ ScriptLib/Company_Co.pm



Revision: 4849
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4849&view=rev
Author:   einhverfr
Date:     2012-06-06 08:34:56 +0000 (Wed, 06 Jun 2012)
Log Message:
-----------
fixed errors saving customer

Modified Paths:
--------------
    addons/1.3/colombia_general/trunk/LedgerSMB/ScriptLib/Company_Co.pm

Modified: addons/1.3/colombia_general/trunk/LedgerSMB/ScriptLib/Company_Co.pm
===================================================================
--- addons/1.3/colombia_general/trunk/LedgerSMB/ScriptLib/Company_Co.pm	2012-06-06 07:27:21 UTC (rev 4848)
+++ addons/1.3/colombia_general/trunk/LedgerSMB/ScriptLib/Company_Co.pm	2012-06-06 08:34:56 UTC (rev 4849)
@@ -2,8 +2,8 @@
 package LedgerSMB::ScriptLib::Company_Co;
 use base qw(LedgerSMB::ScriptLib::Company);
 my $logger = Log::Log4perl->get_logger("LedgerSMB::ScriptLib::Company");
+use strict;
 
-
 =pod
 
 =head1 NAME
@@ -21,6 +21,23 @@
 
 =over
 
+=item add
+
+Populates drop-down boxes and delegates the rest to the super.
+
+=cut
+
+sub add {
+    my ($request) = @_;
+    @{$request->{province_list}} = $request->call_procedure(
+            procname => 'entity__get_provinces'
+    );
+    @{$request->{city_list}} = $request->call_procedure(
+            procname => 'entity__get_municipalities'
+    );
+    LedgerSMB::ScriptLib::Company::add($request);
+}
+
 =item get
 
 This routine also grabs natural person info, and lists departments and 
@@ -37,7 +54,7 @@
     @{$request->{city_list}} = $request->call_procedure(
             procname => 'entity__get_municipalities'
     );
-    my @persons = $dbhahdle->exec_method({funcname => 'entity__get_persons'});
+    my @persons = $dbhandle->exec_method({funcname => 'entity__get_persons'});
     $request->merge(shift @persons);
     LedgerSMB::ScriptLib::Company::get($request);
 }
@@ -54,11 +71,11 @@
 sub save {
     my ($request) = @_;
     my $dbhandle = LedgerSMB::DBObject->new({base => $request});
-    my $company = new_company($request);
-    if (_close_form($company)){
+    my $company = LedgerSMB::ScriptLib::Company::new_company($request);
+    if (LedgerSMB::ScriptLib::Company::_close_form($company)){
         #$logger->debug("\$company = " . Data::Dumper::Dumper($company));
         $company->save();
-        $company->exec_method({funcname => 'person__save'});
+        $company->exec_method({funcname => 'person__save'}) if $request->{first_name} and $request->{last_name};
         $company->exec_method({funcname => 'entity__set_muni_province'});
     }
     get($request);

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