summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-11-25 06:53:38 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-11-25 06:53:38 +0000
commit57d4a99298f9ba1c761915db4f0922d99a3c9509 (patch)
tree36562d7321e235d527cf279fac53b6114fa5d97e /LedgerSMB
parentca652e04320debad4a1a5a98dec07e46a51344c6 (diff)
Changes to UI when invoices locked, changes to source numbering behavior in bulk payments, test cases added, minor code cleanup for readability
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2420 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/DBObject/Payment.pm30
1 files changed, 19 insertions, 11 deletions
diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm
index 65526609..b37eac62 100644
--- a/LedgerSMB/DBObject/Payment.pm
+++ b/LedgerSMB/DBObject/Payment.pm
@@ -439,24 +439,27 @@ This method sets appropriate project, department, etc. fields.
sub get_payment_detail_data {
my ($self) = @_;
$self->get_metadata();
+ if (!defined $self->{source_start}){
+ $self->error('No source start defined!');
+ }
my $source_inc;
my $source_src;
- if (defined ($self->{source_start})) {
- $self->{source_start} =~ /(\d*)\D*$/;
- $source_src = $1;
- if ($source_src) {
- $source_inc = $source_src;
- } else {
- $source_inc = 0;
- }
+ $self->{source_start} =~ /(\d*)\D*$/;
+ $source_src = $1;
+ if ($source_src) {
+ $source_inc = $source_src;
+ } else {
+ $source_inc = 0;
}
my $source_length = length($source_inc);
@{$self->{contact_invoices}} = $self->exec_method(
funcname => 'payment_get_all_contact_invoices');
for my $inv (@{$self->{contact_invoices}}) {
- if (defined $self->{source_start}) {
+ if (($self->{action} ne 'update_payments') or
+ (defined $self->{"id_$inv->{contact_id}"})
+ ) {
my $source = $self->{source_start};
if (length($source_inc) < $source_length) {
$source_inc = sprintf('%0*s', $source_length, $source_inc);
@@ -464,8 +467,13 @@ sub get_payment_detail_data {
$source =~ s/$source_src(\D*)$/$source_inc$1/;
++ $source_inc;
$inv->{source} = $source;
- }
- my $tmp_invoices = $inv->{invoices};
+ $self->{"source_$inv->{contact_id}"} = $source;
+ } else {
+ # Clear source numbers every time.
+ $inv->{source} = "";
+ $self->{"source_$inv->{contact_id}"} = "";
+ }
+ my $tmp_invoices = $inv->{invoices};
$inv->{invoices} = [];
@{$inv->{invoices}} = $self->_parse_array($tmp_invoices);
@{$inv->{invoices}} = sort { $a->[2] cmp $b->[2] } @{ $inv->{invoices} };