Lines 291-304
sub start_cashup {
Link Here
|
291 |
|
291 |
|
292 |
my $expected_amount = abs( $self->outstanding_accountlines->total( { payment_type => [ 'CASH', 'SIP00' ] } ) ); |
292 |
my $expected_amount = abs( $self->outstanding_accountlines->total( { payment_type => [ 'CASH', 'SIP00' ] } ) ); |
293 |
|
293 |
|
294 |
# Create the CASHUP_START action |
294 |
# Create the CASHUP_START action using centralized exception handling |
295 |
my $rs = $self->_result->add_to_cash_register_actions( |
295 |
my $schema = $self->_result->result_source->schema; |
296 |
{ |
296 |
my $rs = $schema->safe_do( |
297 |
code => 'CASHUP_START', |
297 |
sub { |
298 |
manager_id => $manager_id, |
298 |
return $self->_result->add_to_cash_register_actions( |
299 |
amount => $expected_amount |
299 |
{ |
|
|
300 |
code => 'CASHUP_START', |
301 |
manager_id => $manager_id, |
302 |
amount => $expected_amount |
303 |
} |
304 |
)->discard_changes; |
300 |
} |
305 |
} |
301 |
)->discard_changes; |
306 |
); |
302 |
|
307 |
|
303 |
return Koha::Cash::Register::Cashup->_new_from_dbic($rs); |
308 |
return Koha::Cash::Register::Cashup->_new_from_dbic($rs); |
304 |
} |
309 |
} |
Lines 387-400
sub add_cashup {
Link Here
|
387 |
|
392 |
|
388 |
$schema->txn_do( |
393 |
$schema->txn_do( |
389 |
sub { |
394 |
sub { |
390 |
# Create the cashup action with actual amount |
395 |
# Create the cashup action with actual amount using centralized exception handling |
391 |
my $rs = $self->_result->add_to_cash_register_actions( |
396 |
my $rs = $schema->safe_do( |
392 |
{ |
397 |
sub { |
393 |
code => 'CASHUP', |
398 |
return $self->_result->add_to_cash_register_actions( |
394 |
manager_id => $manager_id, |
399 |
{ |
395 |
amount => $amount |
400 |
code => 'CASHUP', |
|
|
401 |
manager_id => $manager_id, |
402 |
amount => $amount |
403 |
} |
404 |
)->discard_changes; |
396 |
} |
405 |
} |
397 |
)->discard_changes; |
406 |
); |
398 |
|
407 |
|
399 |
$cashup = Koha::Cash::Register::Cashup->_new_from_dbic($rs); |
408 |
$cashup = Koha::Cash::Register::Cashup->_new_from_dbic($rs); |
400 |
|
409 |
|