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

SF.net SVN: ledger-smb:[5861] trunk/bin



Revision: 5861
          http://sourceforge.net/p/ledger-smb/code/5861
Author:   einhverfr
Date:     2013-05-23 08:53:32 +0000 (Thu, 23 May 2013)
Log Message:
-----------
Post as saved now works on invoice screens

Modified Paths:
--------------
    trunk/bin/io.pl
    trunk/bin/ir.pl
    trunk/bin/is.pl

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2013-05-23 03:51:58 UTC (rev 5860)
+++ trunk/bin/io.pl	2013-05-23 08:53:32 UTC (rev 5861)
@@ -127,6 +127,29 @@
     }
 }
 
+sub approve {
+    use LedgerSMB::DBObject::Draft;
+    use LedgerSMB;
+    my $lsmb = LedgerSMB->new();
+    $lsmb->merge($form);
+
+    my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb});
+
+    $draft->approve();
+
+    if ($form->{callback}){
+        print "Location: $form->{callback}\n";
+        print "Status: 302 Found\n\n";
+        print "<html><body>";
+        my $url = $form->{callback};
+        print qq|If you are not redirected automatically, click <a href="$url">|
+                . qq|here</a>.</body></html>|;
+
+    } else {
+        $form->info($locale->text('Draft Posted'));
+    }
+}
+
 sub display_row {
     my $numrows = shift;
     my $lsmb_module;

Modified: trunk/bin/ir.pl
===================================================================
--- trunk/bin/ir.pl	2013-05-23 03:51:58 UTC (rev 5860)
+++ trunk/bin/ir.pl	2013-05-23 08:53:32 UTC (rev 5861)
@@ -65,8 +65,8 @@
     my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb});
     $draft->delete();
     delete $form->{id};
-    $form->{approved} = 1;
-    &post;
+    IR->post_invoice( \%myconfig, \%$form );
+    approve();
 }
 
 sub approve {

Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl	2013-05-23 03:51:58 UTC (rev 5860)
+++ trunk/bin/is.pl	2013-05-23 08:53:32 UTC (rev 5861)
@@ -64,6 +64,18 @@
     update();
 }
 
+sub edit_and_approve {
+    use LedgerSMB::DBObject::Draft;
+    use LedgerSMB;
+    my $lsmb = LedgerSMB->new();
+    $lsmb->merge($form);
+    my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb});
+    $draft->delete();
+    delete $form->{id};
+    IS->post_invoice( \%myconfig, \%$form );
+    approve();
+}
+
 sub new_screen {
     use LedgerSMB::Form;
     my @reqprops = qw(ARAP vc dbh stylesheet type);

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