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

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



Revision: 4734
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4734&view=rev
Author:   einhverfr
Date:     2012-05-20 07:08:06 +0000 (Sun, 20 May 2012)
Log Message:
-----------
Some fixes for move to stored proc COGS handling

Modified Paths:
--------------
    trunk/LedgerSMB/IS.pm
    trunk/bin/is.pl
    trunk/sql/modules/COGS.sql

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2012-05-19 15:26:42 UTC (rev 4733)
+++ trunk/LedgerSMB/IS.pm	2012-05-20 07:08:06 UTC (rev 4734)
@@ -1728,7 +1728,7 @@
     # Parts info
     my $part_sth = $dbh->prepare('SELECT * FROM parts WHERE id = ?');
     $part_sth->execute($id);
-    my ($part_ref) = $part_sth->fetchrow_hashref('NAME_lc')
+    my ($part_ref) = $part_sth->fetchrow_hashref('NAME_lc');
 
 
     # Setting up for the main transaction.

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2012-05-19 15:26:42 UTC (rev 4733)
+++ trunk/bin/is.pl	2012-05-20 07:08:06 UTC (rev 4734)
@@ -1337,7 +1337,8 @@
       if ( $form->{currency} ne $form->{defaultcurrency} );
 
     for $i ( 1 .. $form->{paidaccounts} ) {
-        if ( $form->{"paid_$i"} ) {
+        delete $form->{"paid_$i"} if $form->{"paid_$i"} == 0;
+        if ( $form->{"paid_$i"}) {
             $datepaid = $form->datetonum( \%myconfig, $form->{"datepaid_$i"} );
 
             $form->isblank( "datepaid_$i",

Modified: trunk/sql/modules/COGS.sql
===================================================================
--- trunk/sql/modules/COGS.sql	2012-05-19 15:26:42 UTC (rev 4733)
+++ trunk/sql/modules/COGS.sql	2012-05-20 07:08:06 UTC (rev 4734)
@@ -17,7 +17,7 @@
 RETURNS NUMERIC AS
 $$
 DECLARE t_alloc numeric := 0;
-        t_cogs := 0;
+        t_cogs numeric := 0;
         t_inv invoice;
 BEGIN
 
@@ -87,6 +87,8 @@
    END IF;
 END LOOP;
 
+RETURN 0;
+
 END;
 $$ LANGUAGE PLPGSQL;
 
@@ -96,7 +98,7 @@
 application to attach to the current transaction.$$;
 
 CREATE OR REPLACE FUNCTION cogs__reverse_ap
-(in_parts_id int, in_qty numeric) AS
+(in_parts_id int, in_qty numeric) RETURNS numeric AS
 $$
 DECLARE t_alloc numeric;
         t_inv inventory;
@@ -123,6 +125,8 @@
    END IF;
 END LOOP;
 
+RETURN 0;
+
 RAISE EXCEPTION 'TOO FEW TO ALLOCATE';
 END;
 $$ LANGUAGE PLPGSQL;

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