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

SF.net SVN: ledger-smb:[6007] branches/1.3



Revision: 6007
          http://sourceforge.net/p/ledger-smb/code/6007
Author:   einhverfr
Date:     2013-09-13 05:21:40 +0000 (Fri, 13 Sep 2013)
Log Message:
-----------
Merging in on hold fixes from trunk 6006

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/Form.pm
    branches/1.3/LedgerSMB/IR.pm
    branches/1.3/LedgerSMB/IS.pm
    branches/1.3/bin/aa.pl
    branches/1.3/bin/ir.pl
    branches/1.3/bin/is.pl

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2013-09-13 05:16:27 UTC (rev 6006)
+++ branches/1.3/Changelog	2013-09-13 05:21:40 UTC (rev 6007)
@@ -10,6 +10,8 @@
 * Fixed is_zero error on inventory activity report (Chris T)
 * Fixed bug 861, receipts saying "pay from" cash account (Chris T)
 * Dropped not null requirement on zip/mail codes (Chris T, 863)
+* Fixed on hold throwing http 500 errors (Chris T and Nick P, 872)
+* Fixed on hold not available for ar/ap transactions (Chris T)
 
 
 Changelog for 1.3.34

Modified: branches/1.3/LedgerSMB/Form.pm
===================================================================
--- branches/1.3/LedgerSMB/Form.pm	2013-09-13 05:16:27 UTC (rev 6006)
+++ branches/1.3/LedgerSMB/Form.pm	2013-09-13 05:21:40 UTC (rev 6007)
@@ -2573,7 +2573,8 @@
 				a.amount AS oldinvtotal, a.paid AS oldtotalpaid,
 				a.person_id, e.name AS employee, 
 				c.language_code, a.ponumber, a.reverse,
-                                a.approved, ctf.default_reportable
+                                a.approved, ctf.default_reportable, 
+                                a.on_hold
 			FROM $arap a
 			JOIN entity_credit_account c 
 				ON (a.entity_credit_account = c.id)

Modified: branches/1.3/LedgerSMB/IR.pm
===================================================================
--- branches/1.3/LedgerSMB/IR.pm	2013-09-13 05:16:27 UTC (rev 6006)
+++ branches/1.3/LedgerSMB/IR.pm	2013-09-13 05:21:40 UTC (rev 6007)
@@ -1584,25 +1584,9 @@
     if ($form->{id}) { # it's an existing (.. probably) invoice.
         
         my $dbh = $form->{dbh};
-        #my $sth = $dbh->prepare("SELECT on_hold from ar where ar.id = ?");#tshvr4
-        my $sth = $dbh->prepare("SELECT on_hold from ap where ap.id = ?");
-        $sth->execute($form->{id});
-        my $state = $sth->fetchrow_array;
-        my $n_s; # new state
-        #if ($state[0] == 't') {
-        if ($state) {#tshvr4            
-            # Turn it off
-            $n_s = 'f';
-            
-        } else {
-            $n_s = 't';
-        }
+        $sth = $dbh->prepare("update ap set on_hold = not on_hold where ap.id = ?");
+        my $code = $sth->execute($form->{id});#tshvr4
         
-        #$sth = $dbh->prepare("update ar set on_hold = ?::boolean where ar.id = ?");#tshvr4
-        $sth = $dbh->prepare("update ap set on_hold = ?::boolean where ap.id = ?");
-        #my $code = $dbh->execute($ns, $form->{id});#tshvr4
-        my $code = $sth->execute($n_s, $form->{id});#tshvr4
-        
         return 1;
         
     } else { # This shouldn't even be possible, but check for it anyway.

Modified: branches/1.3/LedgerSMB/IS.pm
===================================================================
--- branches/1.3/LedgerSMB/IS.pm	2013-09-13 05:16:27 UTC (rev 6006)
+++ branches/1.3/LedgerSMB/IS.pm	2013-09-13 05:21:40 UTC (rev 6007)
@@ -2408,21 +2408,9 @@
     if ($form->{id}) { # it's an existing (.. probably) invoice.
         
         my $dbh = $form->{dbh};
-        my $sth = $dbh->prepare("SELECT on_hold from ar where ar.id = ?");
-        $sth->execute($form->{id});
-        my ($state) = $sth->fetchrow_array;
-        my $n_s; # new state
-        if ($state) {
-            
-            # Turn it off
-            $n_s = 'f';
-            
-        } else {
-            $n_s = 't';
-        }
         
-        $sth = $dbh->prepare("update ar set on_hold = ?::boolean where ar.id = ?");
-        my $code = $sth->execute($n_s, $form->{id});
+        $sth = $dbh->prepare("update ar set on_hold = not on_hold where ar.id = ?");
+        my $code = $sth->execute($form->{id});
         
         return 1;
         

Modified: branches/1.3/bin/aa.pl
===================================================================
--- branches/1.3/bin/aa.pl	2013-09-13 05:16:27 UTC (rev 6006)
+++ branches/1.3/bin/aa.pl	2013-09-13 05:21:40 UTC (rev 6007)
@@ -945,7 +945,15 @@
         &print_options;
 
         print "<br>";
+        my $hold_text;
 
+        if ($form->{on_hold}) {
+            $hold_text = $locale->text('Off Hold');
+        } else {
+            $hold_text = $locale->text('On Hold');
+        }
+            
+
         %button = (
             'update' =>
               { ndx => 1, key => 'U', value => $locale->text('Update') },
@@ -960,11 +968,17 @@
               { ndx => 7, key => 'H', value => $locale->text('Schedule') },
             'delete' =>
               { ndx => 8, key => 'D', value => $locale->text('Delete') },
-
+            'on_hold' => 
+              { ndx => 9, key => 'O', value => $hold_text },
             'save_info' => 
-              { ndx => 9, key => 'I', value => $locale->text('Save Info') },
+              { ndx => 10, key => 'I', value => $locale->text('Save Info') },
+<<<<<<< .working
+=======
+            'save_temp' =>
+              { ndx => 11, key => 'T', value => $locale->text('Save Template')},
+>>>>>>> .merge-right.r6006
             'new_screen' => # Create a blank ar/ap invoice.
-             { ndx => 10, key=> 'N', value => $locale->text('New') }
+             { ndx => 12, key=> 'N', value => $locale->text('New') }
         );
         my $is_draft = 0;
         if (!$form->{approved} && !$form->{batch_id}){
@@ -999,7 +1013,7 @@
         elsif (!$form->{id}) {
 
             for ( "post_as_new","delete","save_info",
-                  "print", 'copy_to_new', 'new_screen') {
+                  "print", 'copy_to_new', 'new_screen', 'on_hold') {
                 delete $button{$_};
             }
 
@@ -1093,6 +1107,21 @@
 |;
 }
 
+sub on_hold {
+    use LedgerSMB::IS;
+    use LedgerSMB::IR; # TODO: refactor this over time
+    
+    if ($form->{id}) {
+        if ($form->{ARAP} eq 'AR'){
+            my $toggled = IS->toggle_on_hold($form);
+        } else {
+            my $toggled = IR->toggle_on_hold($form);
+        }
+        &edit(); 
+    }    
+}
+
+
 sub edit_and_approve {
     use LedgerSMB::DBObject::Draft;
     use LedgerSMB;

Modified: branches/1.3/bin/ir.pl
===================================================================
--- branches/1.3/bin/ir.pl	2013-09-13 05:16:27 UTC (rev 6006)
+++ branches/1.3/bin/ir.pl	2013-09-13 05:21:40 UTC (rev 6007)
@@ -901,9 +901,7 @@
 
         if ( $form->{id} ) {
 
-            if ( $form->{locked} ) {
-                for ( "post", "delete", 'on_hold' ) { delete $button{$_} }
-            }
+            for ( "post", "delete") { delete $button{$_} }
             for ( 'post_as_new', 'print_and_post_as_new', "update") {
                 delete $button{$_};
             }

Modified: branches/1.3/bin/is.pl
===================================================================
--- branches/1.3/bin/is.pl	2013-09-13 05:16:27 UTC (rev 6006)
+++ branches/1.3/bin/is.pl	2013-09-13 05:21:40 UTC (rev 6007)
@@ -1028,7 +1028,7 @@
             if ( $transdate > $closedto ) {
                 # Added on_hold, by Aurynn.
                 for ( "update", "ship_to", "post",
-                    "schedule", "on_hold" )
+                    "schedule")
                 {
                     $allowed{$_} = 1;
                 }

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


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits