Revision aec14b51
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/AR.pm | ||
---|---|---|
71 | 71 |
|
72 | 72 |
my $dbh = $provided_dbh || SL::DB->client->dbh; |
73 | 73 |
|
74 |
# if we have an id delete old records else make one |
|
75 |
if (!$payments_only) { |
|
76 |
if ($form->{id}) { |
|
77 |
# delete detail records |
|
78 |
$query = qq|DELETE FROM acc_trans WHERE trans_id = ?|; |
|
79 |
do_query($form, $dbh, $query, $form->{id}); |
|
80 |
|
|
81 |
} else { |
|
82 |
$query = qq|SELECT nextval('glid')|; |
|
83 |
($form->{id}) = selectrow_query($form, $dbh, $query); |
|
84 |
$query = qq|INSERT INTO ar (id, invnumber, employee_id, currency_id, taxzone_id) VALUES (?, 'dummy', ?, (SELECT id FROM currencies WHERE name=?), (SELECT taxzone_id FROM customer WHERE id = ?))|; |
|
85 |
do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}, $form->{currency}, $form->{customer_id}); |
|
86 |
if (!$form->{invnumber}) { |
|
87 |
my $trans_number = SL::TransNumber->new(type => 'invoice', dbh => $dbh, number => $form->{partnumber}, id => $form->{id}); |
|
88 |
$form->{invnumber} = $trans_number->create_unique; |
|
89 |
} |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
74 | 93 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
75 | 94 |
# check default or record exchangerate |
76 | 95 |
if ($form->{currency} eq $form->{defaultcurrency}) { |
Auch abrufbar als: Unified diff
ARAP _post_transaction Anlegen der id am Anfang wie bei den Rechnungsmasken
Nicht ganz sauber getrennt, ein bisschen Refactor ist im Vor-Commit