View | Details | Raw Unified | Return to bug 23049
Collapse All | Expand All

(-)a/Koha/Account.pm (-10 / +10 lines)
Lines 465-473 sub add_debit { Link Here
465
465
466
    my ( $self, $params ) = @_;
466
    my ( $self, $params ) = @_;
467
467
468
    # check for mandatory params
469
    my @mandatory = ( 'interface', 'type', 'amount' );
470
    for my $param (@mandatory) {
471
        unless ( defined( $params->{$param} ) ) {
472
            Koha::Exceptions::MissingParameter->throw(
473
                error => "The $param parameter is mandatory" );
474
        }
475
    }
476
468
    # amount should always be a positive value
477
    # amount should always be a positive value
469
    my $amount = $params->{amount};
478
    my $amount = $params->{amount};
470
471
    unless ( $amount > 0 ) {
479
    unless ( $amount > 0 ) {
472
        Koha::Exceptions::Account::AmountNotPositive->throw(
480
        Koha::Exceptions::Account::AmountNotPositive->throw(
473
            error => 'Debit amount passed is not positive' );
481
            error => 'Debit amount passed is not positive' );
Lines 481-497 sub add_debit { Link Here
481
    my $debit_type  = $params->{type};
489
    my $debit_type  = $params->{type};
482
    my $item_id     = $params->{item_id};
490
    my $item_id     = $params->{item_id};
483
    my $issue_id    = $params->{issue_id};
491
    my $issue_id    = $params->{issue_id};
484
485
    unless ($interface) {
486
        Koha::Exceptions::MissingParameter->throw(
487
            error => 'The interface parameter is mandatory' );
488
    }
489
490
    my $schema = Koha::Database->new->schema;
491
492
    my $offset_type = $Koha::Account::offset_type->{$debit_type} // 'Manual Debit';
492
    my $offset_type = $Koha::Account::offset_type->{$debit_type} // 'Manual Debit';
493
493
494
    my $line;
494
    my $line;
495
    my $schema = Koha::Database->new->schema;
495
    try {
496
    try {
496
        $schema->txn_do(
497
        $schema->txn_do(
497
            sub {
498
            sub {
498
- 

Return to bug 23049