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

(-)a/Koha/Account/Line.pm (-2 / +3 lines)
Lines 27-32 use Koha::Account::CreditType; Link Here
27
use Koha::Account::DebitType;
27
use Koha::Account::DebitType;
28
use Koha::Account::Offsets;
28
use Koha::Account::Offsets;
29
use Koha::Database;
29
use Koha::Database;
30
use Koha::DateUtils;
30
use Koha::Exceptions::Account;
31
use Koha::Exceptions::Account;
31
use Koha::Items;
32
use Koha::Items;
32
33
Lines 905-911 sub store { Link Here
905
            $max //= 0;
906
            $max //= 0;
906
            $self->credit_number($max + 1);
907
            $self->credit_number($max + 1);
907
        } elsif ($AutoCreditNumber eq 'annual') {
908
        } elsif ($AutoCreditNumber eq 'annual') {
908
            my $now = DateTime->now;
909
            my $now = dt_from_string;
909
            my $prefix = sprintf('%d-', $now->year);
910
            my $prefix = sprintf('%d-', $now->year);
910
            my $max = $rs->search({
911
            my $max = $rs->search({
911
                -and => [
912
                -and => [
Lines 920-926 sub store { Link Here
920
            my $userenv = C4::Context->userenv;
921
            my $userenv = C4::Context->userenv;
921
            if ($userenv) {
922
            if ($userenv) {
922
                my $branch = $userenv->{branch};
923
                my $branch = $userenv->{branch};
923
                my $now = DateTime->now;
924
                my $now = dt_from_string;
924
                my $prefix = sprintf('%s%d%02d', $branch, $now->year, $now->month);
925
                my $prefix = sprintf('%s%d%02d', $branch, $now->year, $now->month);
925
                my $pattern = $prefix;
926
                my $pattern = $prefix;
926
                $pattern =~ s/([\?%_])/\\$1/g;
927
                $pattern =~ s/([\?%_])/\\$1/g;
(-)a/t/db_dependent/Koha/Account.t (-2 / +1 lines)
Lines 1065-1071 subtest 'Koha::Account::pay() generates credit number' => sub { Link Here
1065
    my $context = Test::MockModule->new('C4::Context');
1065
    my $context = Test::MockModule->new('C4::Context');
1066
    $context->mock( 'userenv', { branch => $library->id } );
1066
    $context->mock( 'userenv', { branch => $library->id } );
1067
1067
1068
    my $now = DateTime->now;
1068
    my $now = dt_from_string;
1069
    my $year = $now->year;
1069
    my $year = $now->year;
1070
    my $month = $now->month;
1070
    my $month = $now->month;
1071
    my ($accountlines_id, $accountline);
1071
    my ($accountlines_id, $accountline);
1072
- 

Return to bug 19036