Fixed Transfer note handling in debit and credit upsert forms.
Plus, explanation in the case that debit is settled / credit is spent so that checking further items is pointless.
This commit is contained in:
@@ -71,6 +71,14 @@ sub upsert {
|
||||
$db->make_transfers( $self->param("billId") => $to_spend_for);
|
||||
}
|
||||
|
||||
for my $param ( grep { /^note\[/ } @{ $self->req->params->names } ) {
|
||||
my $note = $self->param($param) || next;
|
||||
s{^note\[}{} && s{\]$}{} for $param;
|
||||
$credit->search_related(
|
||||
outgoings => { billId => $param }
|
||||
)->update({ note => $note });
|
||||
}
|
||||
|
||||
$self->redirect_to('home');
|
||||
|
||||
|
||||
|
||||
@@ -105,15 +105,16 @@ sub upsert {
|
||||
if ( @$to_pay_with ) {
|
||||
my $billId = $self->param("billId");
|
||||
$db->make_transfers( $to_pay_with => $billId );
|
||||
for my $param ( grep { /^note\[/ } @{ $self->req->params->names } ) {
|
||||
my $note = $self->param($param) || next;
|
||||
s{^note\[}{} && s{\]$}{} for $param;
|
||||
$db->resultset("Transfer")->find({
|
||||
billId => $self->param("billId"), credId => $param
|
||||
})->update({ note => $note });
|
||||
}
|
||||
}
|
||||
|
||||
for my $param ( grep { /^note\[/ } @{ $self->req->params->names } ) {
|
||||
my $note = $self->param($param) || next;
|
||||
s{^note\[}{} && s{\]$}{} for $param;
|
||||
$debit->search_related(
|
||||
incomings => { credId => $param }
|
||||
)->update({ note => $note });
|
||||
}
|
||||
|
||||
$self->redirect_to('home');
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user