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; |