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

SF.net SVN: ledger-smb:[4839] addons/1.3/colombia_general/trunk/LedgerSMB



Revision: 4839
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4839&view=rev
Author:   einhverfr
Date:     2012-06-05 07:33:11 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
committing rewritten customer/vendor override class for Colombia

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

Added: addons/1.3/colombia_general/trunk/LedgerSMB/ScriptLib/Company_Co.pm
===================================================================
--- addons/1.3/colombia_general/trunk/LedgerSMB/ScriptLib/Company_Co.pm	                        (rev 0)
+++ addons/1.3/colombia_general/trunk/LedgerSMB/ScriptLib/Company_Co.pm	2012-06-05 07:33:11 UTC (rev 4839)
@@ -0,0 +1,77 @@
+
+package LedgerSMB::ScriptLib::Company_Co;
+use base qw(LedgerSMB::ScriptLib::Company);
+my $logger = Log::Log4perl->get_logger("LedgerSMB::ScriptLib::Company");
+
+
+=pod
+
+=head1 NAME
+
+LedgerSMB::ScriptLib::Company_Co - LedgerSMB class defining the Controller
+function modifications for the Colombian market.
+
+=head1 SYOPSIS
+
+This is implemented as a brief shim between the standard ScriptLib::Company 
+module and the input.  The idea is that this allows us to override or transform
+the existing functionality using the magic of inheritance.
+
+=head Overridden methods
+
+=over
+
+=item get
+
+This routine also grabs natural person info, and lists departments and 
+municipalities, then delegates to the existing Company script.
+
+=cut
+
+sub get {
+    my ($request) = @_;
+    my $dbhandle = LedgerSMB::DBObject->new({base => $request});
+    @{$request->{province_list}} = $request->call_procedure(
+            procname => 'entity__get_provinces'
+    );
+    @{$request->{city_list}} = $request->call_procedure(
+            procname => 'entity__get_municipalities'
+    );
+    my @persons = $dbhahdle->exec_method({funcname => 'entity__get_persons'});
+    $request->merge(shift @persons);
+    LedgerSMB::ScriptLib::Company::get($request);
+}
+
+=item save
+
+This routine replaces the save in the parent class and saves everything on the 
+company screen.
+
+This routine
+
+=cut
+
+sub save {
+    my ($request) = @_;
+    my $dbhandle = LedgerSMB::DBObject->new({base => $request});
+    my $company = new_company($request);
+    if (_close_form($company)){
+        #$logger->debug("\$company = " . Data::Dumper::Dumper($company));
+        $company->save();
+        $company->exec_method({funcname => 'person__save'});
+        $company->exec_method({funcname => 'entity__set_muni_province'});
+    }
+    get($request);
+}
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright (c) 2012, the LedgerSMB Core Team.  This is licensed under the GNU 
+General Public License, version 2, or at your option any later version.  Please 
+see the accompanying License.txt for more information.
+
+=cut
+
+1;

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