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

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



Revision: 4407
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4407&view=rev
Author:   einhverfr
Date:     2012-03-08 06:45:53 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
No more errors when trying to retrieve a business unit.  However it does not properly display in the UI.

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/DBObject/Business_Unit.pm
    trunk/LedgerSMB/Scripts/business_unit.pm
    trunk/sql/modules/Business_Unit.sql

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-03-07 14:58:30 UTC (rev 4406)
+++ trunk/Changelog	2012-03-08 06:45:53 UTC (rev 4407)
@@ -13,6 +13,7 @@
 * Added "dynatable.html" template that can be included in templates (Chris T)
 * Dynatable forms obtained through GET now show link back to form (Chris T)
 * LedgerSMB->error and Form->error now show db version and company (Chris T)
+* Simpler use of Log::Log4perl instead of LedgerSMB::Log (Chris T)
 
 Customer/Vendor Handling 
 * Added sales tax id and license number fields for companies (Chris T)

Modified: trunk/LedgerSMB/DBObject/Business_Unit.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit.pm	2012-03-07 14:58:30 UTC (rev 4406)
+++ trunk/LedgerSMB/DBObject/Business_Unit.pm	2012-03-08 06:45:53 UTC (rev 4407)
@@ -121,10 +121,11 @@
 
 sub get {
     my ($self, $id) = @_;
-    my @units = $self->call_procedure(procname => 'business_unit__get',
+    my ($unit) = $self->call_procedure(procname => 'business_unit__get',
                                             args => [$id]
     );
-    return $self->new(shift @units);
+    $self->prepare_dbhash($unit);
+    return $self->new(%$unit);
 } 
 
 =item save

Modified: trunk/LedgerSMB/Scripts/business_unit.pm
===================================================================
--- trunk/LedgerSMB/Scripts/business_unit.pm	2012-03-07 14:58:30 UTC (rev 4406)
+++ trunk/LedgerSMB/Scripts/business_unit.pm	2012-03-08 06:45:53 UTC (rev 4407)
@@ -69,7 +69,7 @@
     $request->{control_code} = '';
     $request->{class_id} = 0 unless $request->{class_id} = 0;
     my $b_unit = LedgerSMB::DBObject::Business_Unit->new(%$request);
-    $b_unit->get;
+    $b_unit->get($request->{id});
     _display($b_unit);
 }
 

Modified: trunk/sql/modules/Business_Unit.sql
===================================================================
--- trunk/sql/modules/Business_Unit.sql	2012-03-07 14:58:30 UTC (rev 4406)
+++ trunk/sql/modules/Business_Unit.sql	2012-03-08 06:45:53 UTC (rev 4407)
@@ -95,7 +95,7 @@
 SELECT true;
 $$ LANGUAGE SQL;
 
-CREATE FUNCTION business_unit_class__get_modules(in_id int)
+CREATE OR REPLACE FUNCTION business_unit_class__get_modules(in_id int)
 RETURNS SETOF lsmb_module AS
 $$ SELECT * FROM lsmb_module 
     WHERE id IN (select module_id from bu_class_to_module where bu_class_id = $1)
@@ -176,4 +176,8 @@
 END;
 $$ LANGUAGE PLPGSQL;
 
+CREATE OR REPLACE FUNCTION business_unit__get(in_id int)
+RETURNS business_unit AS
+$$ SELECT * FROM business_unit where id = $1; $$ LANGUAGE SQL;
+
 COMMIT;

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