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 892-898
sub store {
Link Here
|
892 |
$max //= 0; |
893 |
$max //= 0; |
893 |
$self->credit_number($max + 1); |
894 |
$self->credit_number($max + 1); |
894 |
} elsif ($AutoCreditNumber eq 'annual') { |
895 |
} elsif ($AutoCreditNumber eq 'annual') { |
895 |
my $now = DateTime->now; |
896 |
my $now = dt_from_string; |
896 |
my $prefix = sprintf('%d-', $now->year); |
897 |
my $prefix = sprintf('%d-', $now->year); |
897 |
my $max = $rs->search({ |
898 |
my $max = $rs->search({ |
898 |
-and => [ |
899 |
-and => [ |
Lines 907-913
sub store {
Link Here
|
907 |
my $userenv = C4::Context->userenv; |
908 |
my $userenv = C4::Context->userenv; |
908 |
if ($userenv) { |
909 |
if ($userenv) { |
909 |
my $branch = $userenv->{branch}; |
910 |
my $branch = $userenv->{branch}; |
910 |
my $now = DateTime->now; |
911 |
my $now = dt_from_string; |
911 |
my $prefix = sprintf('%s%d%02d', $branch, $now->year, $now->month); |
912 |
my $prefix = sprintf('%s%d%02d', $branch, $now->year, $now->month); |
912 |
my $pattern = $prefix; |
913 |
my $pattern = $prefix; |
913 |
$pattern =~ s/([\?%_])/\\$1/g; |
914 |
$pattern =~ s/([\?%_])/\\$1/g; |