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

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



Revision: 6429
          http://sourceforge.net/p/ledger-smb/code/6429
Author:   einhverfr
Date:     2014-01-10 08:45:07 +0000 (Fri, 10 Jan 2014)
Log Message:
-----------
Fixes for timecards

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/timecard.pm
    trunk/LedgerSMB/Timecard.pm
    trunk/sql/modules/Timecards.sql

Modified: trunk/LedgerSMB/Scripts/timecard.pm
===================================================================
--- trunk/LedgerSMB/Scripts/timecard.pm	2014-01-09 13:15:45 UTC (rev 6428)
+++ trunk/LedgerSMB/Scripts/timecard.pm	2014-01-10 08:45:07 UTC (rev 6429)
@@ -139,6 +139,7 @@
     my $timecard = LedgerSMB::Timecard->new(%$request);
     $timecard->save;
     $request->{id} = $timecard->id;
+    $request->merge($timecard->get($request->{id}));
     display($request);
 }
 

Modified: trunk/LedgerSMB/Timecard.pm
===================================================================
--- trunk/LedgerSMB/Timecard.pm	2014-01-09 13:15:45 UTC (rev 6428)
+++ trunk/LedgerSMB/Timecard.pm	2014-01-10 08:45:07 UTC (rev 6429)
@@ -54,6 +54,14 @@
 
 has business_unit_id => (isa => 'Int', is => 'ro', required => '1');
 
+=item bu_class_id int
+
+The business unit class id.
+
+=cut
+
+has bu_class_id => (isa => 'Int', is => 'ro', required => 0);
+
 =item parts_id int
 
 This is the id of the part utilized (labor/overhead or service for time)
@@ -196,7 +204,10 @@
     my ($self, $id) = @_;
     my ($retval) = __PACKAGE__->call_procedure(
          procname => 'timecard__get', args => [$id]);
-    return $retval;
+    my ($buclass) = __PACKAGE__->call_procedure(
+         procname => 'timecard__bu_class', args => [$id]);
+    $retval->{bu_class_id} = $buclass->{id};
+    return __PACKAGE__->new(%$retval);
 }
 
 =item get_part_id($partnumber)

Modified: trunk/sql/modules/Timecards.sql
===================================================================
--- trunk/sql/modules/Timecards.sql	2014-01-09 13:15:45 UTC (rev 6428)
+++ trunk/sql/modules/Timecards.sql	2014-01-10 08:45:07 UTC (rev 6429)
@@ -64,6 +64,15 @@
 END;
 $$;
 
+CREATE OR REPLACE FUNCTION timecard__bu_class(in_id int) 
+returns business_unit_class LANGUAGE SQL AS
+$$
+SELECT * from business_unit_class 
+ where id in (select class_id from business_unit
+               WHERE id in (select business_unit_id from jcitems
+                             WHERE id = $1));
+$$;
+
 CREATE OR REPLACE FUNCTION timecard__parts
 (in_timecard bool, in_service bool, in_partnumber text)
 RETURNS SETOF parts LANGUAGE SQL AS

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


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits