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

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



Revision: 2860
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2860&view=rev
Author:   einhverfr
Date:     2010-02-07 23:28:52 +0000 (Sun, 07 Feb 2010)

Log Message:
-----------
Reconciliation has form validation

Modified Paths:
--------------
    trunk/UI/reconciliation/report.html
    trunk/scripts/recon.pl

Modified: trunk/UI/reconciliation/report.html
===================================================================
--- trunk/UI/reconciliation/report.html	2010-02-07 23:22:20 UTC (rev 2859)
+++ trunk/UI/reconciliation/report.html	2010-02-07 23:28:52 UTC (rev 2860)
@@ -203,6 +203,11 @@
 	</tr>
 </table>
 <?lsmb INCLUDE input element_data = {
+	name = "form_id",
+	type = "hidden",
+	value = form_id,
+} ?>
+<?lsmb INCLUDE input element_data = {
 	name = "report_id",
 	type = "hidden",
 	value = report_id,

Modified: trunk/scripts/recon.pl
===================================================================
--- trunk/scripts/recon.pl	2010-02-07 23:22:20 UTC (rev 2859)
+++ trunk/scripts/recon.pl	2010-02-07 23:28:52 UTC (rev 2860)
@@ -96,7 +96,10 @@
 sub save_recon_set {
     my ($request) = shift;
     my $recon = LedgerSMB::DBObject::Reconciliation->new(base => $request);
-    $recon->save();
+    if ($recon->close_form){
+        $recon->save();
+    } else {
+        $recon->{notice} = $recon->{_locale}->text('Data not saved.  Please update again.');
     my $template = LedgerSMB::Template->new( 
             user => $user, 
     	    template => 'reconciliation/search', 
@@ -109,6 +112,8 @@
 
 sub get_results {
     my ($request) = @_;
+    $request->close_form;
+    $request->open_form;
         if ($request->{approved} ne '1' and $request->{approved} ne '0'){
 		$request->{approved} = undef;
         }
@@ -340,6 +345,8 @@
 sub _display_report {
         my $recon = shift;
         $recon->get();
+        $recon->close_form;
+        $recon->open_form;
         $recon->add_entries($recon->import_file('csv_file')) if !$recon->{submitted};
         $recon->{can_approve} = $recon->is_allowed_role({allowed_roles => ['recon_supervisor']});
         $recon->get();
@@ -564,6 +571,10 @@
 
 sub approve {
     my ($request) = @_;
+    if (!$request->close_form){
+        get_results($request);
+        exit;
+    }
     
     # Approve will also display the report in a blurred/opaqued out version,
     # with the controls removed/disabled, so that we know that it has in fact


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