Skip to content

Commit c757ffd

Browse files
committed
Fix GL transactions 'reference' field
After centralizing transaction fields in the 'transactions' table, the 'transactions.reference' field was not correctly set.
1 parent a4ed693 commit c757ffd

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

old/lib/LedgerSMB/GL.pm

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,28 +125,20 @@ sub post_transaction {
125125
UPDATE transactions
126126
SET workflow_id = ?,
127127
reversing = ?,
128-
description = ?
128+
description = ?,
129+
reference = ?
129130
WHERE id = ?
130131
AND workflow_id IS NULL|;
131132
$sth = $dbh->prepare($query);
132133
$form->{reversing} ||= undef; # convert empty string to NULL
133-
$sth->execute( $form->{workflow_id}, $form->{reversing}, $form->{description}, $form->{id} )
134+
$sth->execute( $form->{workflow_id}, $form->{reversing}, $form->{description}, $form->{id}, $form->{reference} )
134135
|| $form->dberror($query);
135136
}
136137

137138
( $null, $department_id ) =
138139
split( /--/, $form->{department}) if $form->{department};
139140
($department_id //= 0) *= 1;
140141

141-
if (! $form->{reference} ) {
142-
$form->{reference} = $form->{id};
143-
$dbh->do(qq|
144-
UPDATE gl
145-
SET reference = ?
146-
WHERE id = ?|, {}, $form->{reference}, $form->{id})
147-
or $form->dberror($dbh->errstr);
148-
}
149-
150142
if (defined $form->{approved}) {
151143
my $query = qq| UPDATE transactions SET approved = ? WHERE id = ?|;
152144
$dbh->prepare($query)->execute($form->{approved}, $form->{id})

0 commit comments

Comments
 (0)