[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6006] trunk
- Subject: SF.net SVN: ledger-smb:[6006] trunk
- From: ..hidden..
- Date: Fri, 13 Sep 2013 05:16:29 +0000
Revision: 6006
http://sourceforge.net/p/ledger-smb/code/6006
Author: einhverfr
Date: 2013-09-13 05:16:27 +0000 (Fri, 13 Sep 2013)
Log Message:
-----------
On hold fixes:
1: Simplified the logic a bit, so the toggle is done in the SQL statement rather than Perl processing and two round trips, should help for performance a little.
2: On hold now available for ar/ap transactions
3: On hold not available before posting (threw errors before)
Modified Paths:
--------------
trunk/Changelog
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB/IR.pm
trunk/LedgerSMB/IS.pm
trunk/bin/aa.pl
trunk/bin/ir.pl
trunk/bin/is.pl
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2013-09-12 14:48:30 UTC (rev 6005)
+++ trunk/Changelog 2013-09-13 05:16:27 UTC (rev 6006)
@@ -95,6 +95,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: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2013-09-12 14:48:30 UTC (rev 6005)
+++ trunk/LedgerSMB/Form.pm 2013-09-13 05:16:27 UTC (rev 6006)
@@ -2390,7 +2390,7 @@
a.person_id, e.name AS employee,
c.language_code, a.ponumber, a.reverse,
a.approved, ctf.default_reportable,
- a.description
+ a.description, a.on_hold
FROM $arap a
JOIN entity_credit_account c
ON (a.entity_credit_account = c.id)
Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm 2013-09-12 14:48:30 UTC (rev 6005)
+++ trunk/LedgerSMB/IR.pm 2013-09-13 05:16:27 UTC (rev 6006)
@@ -1455,21 +1455,9 @@
if ($form->{id}) { # it's an existing (.. probably) invoice.
my $dbh = $form->{dbh};
- my $sth = $dbh->prepare("SELECT on_hold from ap where ap.id = ?");#tshvr4
- $sth->execute($form->{id});
- my $state = $sth->fetchrow_array;
- my $n_s; # new state
- if ($state) {#tshvr4
-
- # Turn it off
- $n_s = 'f';
-
- } else {
- $n_s = 't';
- }
- $sth = $dbh->prepare("update ap set on_hold = ?::boolean where ap.id = ?");
- my $code = $dbh->execute($n_s, $form->{id});#tshvr4
+ $sth = $dbh->prepare("update ap set on_hold = not on_hold where ap.id = ?");
+ my $code = $sth->execute($form->{id});#tshvr4
return 1;
Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm 2013-09-12 14:48:30 UTC (rev 6005)
+++ trunk/LedgerSMB/IS.pm 2013-09-13 05:16:27 UTC (rev 6006)
@@ -2263,21 +2263,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: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2013-09-12 14:48:30 UTC (rev 6005)
+++ trunk/bin/aa.pl 2013-09-13 05:16:27 UTC (rev 6006)
@@ -953,7 +953,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') },
@@ -968,13 +976,14 @@
{ 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') },
'save_temp' =>
- { ndx => 10, key => 'T', value => $locale->text('Save Template')},
+ { ndx => 11, key => 'T', value => $locale->text('Save Template')},
'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}){
@@ -1006,7 +1015,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{$_};
}
@@ -1101,6 +1110,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 save_temp {
use LedgerSMB;
use LedgerSMB::DBObject::TransTemplate;
Modified: trunk/bin/ir.pl
===================================================================
--- trunk/bin/ir.pl 2013-09-12 14:48:30 UTC (rev 6005)
+++ trunk/bin/ir.pl 2013-09-13 05:16:27 UTC (rev 6006)
@@ -935,7 +935,7 @@
if ( $form->{id} ) {
- 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: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl 2013-09-12 14:48:30 UTC (rev 6005)
+++ trunk/bin/is.pl 2013-09-13 05:16:27 UTC (rev 6006)
@@ -1054,7 +1054,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