[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2470] trunk
- Subject: SF.net SVN: ledger-smb:[2470] trunk
- From: ..hidden..
- Date: Fri, 27 Feb 2009 19:05:46 +0000
Revision: 2470
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2470&view=rev
Author: einhverfr
Date: 2009-02-27 19:05:45 +0000 (Fri, 27 Feb 2009)
Log Message:
-----------
Adding save fuctionality for recon set. Current tests continue to hit full db stored proc set.
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Reconciliation.pm
trunk/UI/reconciliation/report.html
trunk/scripts/recon.pl
trunk/sql/modules/Reconciliaton.sql
Modified: trunk/LedgerSMB/DBObject/Reconciliation.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Reconciliation.pm 2009-02-27 01:29:44 UTC (rev 2469)
+++ trunk/LedgerSMB/DBObject/Reconciliation.pm 2009-02-27 19:05:45 UTC (rev 2470)
@@ -99,7 +99,7 @@
$self->exec_method(funcname=>'reconciliation__pending_transactions');
}
-sub submit {
+sub _pre_save {
my $self = shift @_;
$i = 1;
my $ids = ();
@@ -112,10 +112,22 @@
++ $i;
}
$self->{line_ids} =~ s/,$/}/;
+}
+
+sub submit {
+ my $self = shift @_;
+ $self->_pre_save;
$self->exec_method(funcname=>'reconciliation__submit_set');
$self->{dbh}->commit;
}
+sub save {
+ my $self = shift @_;
+ $self->_pre_save;
+ $self->exec_method(funcname=>'reconciliation__save_set');
+ $self->{dbh}->commit;
+}
+
sub import_file {
my $self = shift @_;
Modified: trunk/UI/reconciliation/report.html
===================================================================
--- trunk/UI/reconciliation/report.html 2009-02-27 01:29:44 UTC (rev 2469)
+++ trunk/UI/reconciliation/report.html 2009-02-27 19:05:45 UTC (rev 2470)
@@ -154,6 +154,12 @@
} ?>
<?lsmb INCLUDE button element_data = {
name = "action",
+ text = text('Save'),
+ value = 'save_recon_set',
+ class = "submit"
+} ?>
+<?lsmb INCLUDE button element_data = {
+ name = "action",
text = text('Submit'),
value = 'submit_recon_set',
class = "submit"
Modified: trunk/scripts/recon.pl
===================================================================
--- trunk/scripts/recon.pl 2009-02-27 01:29:44 UTC (rev 2469)
+++ trunk/scripts/recon.pl 2009-02-27 19:05:45 UTC (rev 2470)
@@ -100,6 +100,20 @@
return $template->render($recon);
}
+sub save_recon_set {
+ my ($request) = shift;
+ my $recon = LedgerSMB::DBObject::Reconciliation->new(base => $request);
+ $recon->save();
+ my $template = LedgerSMB::Template->new(
+ user => $user,
+ template => 'reconciliation/search',
+ language => $user->{language},
+ format => 'HTML',
+ path=>"UI");
+ return $template->render($recon);
+
+}
+
sub get_results {
my ($request) = @_;
if ($request->{approved} ne '1' and $request->{approved} ne '0'){
Modified: trunk/sql/modules/Reconciliaton.sql
===================================================================
--- trunk/sql/modules/Reconciliaton.sql 2009-02-27 01:29:44 UTC (rev 2469)
+++ trunk/sql/modules/Reconciliaton.sql 2009-02-27 19:05:45 UTC (rev 2470)
@@ -41,11 +41,19 @@
$$
BEGIN
UPDATE cr_report set submitted = true where id = in_report_id;
+ PERFORM reconciliation__save_set(in_report_id, in_line_ids);
+ RETURN FOUND;
+END;
+$$ LANGUAGE PLPGSQL;
+
+CREATE OR REPLACE FUNCTION reconciliation__save_set(
+ in_report_id int, in_line_ids int[]) RETURNS bool AS
+$$
+BEGIN
UPDATE cr_report_line SET cleared = true
WHERE report_id = in_report_id AND id = ANY(in_line_ids);
-
- RETURN FOUND;
+ RETURN found;
END;
$$ LANGUAGE PLPGSQL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.