use Koha::Account::DebitType;
use Koha::Account::Offsets;
use Koha::Database;
+use Koha::DateUtils;
use Koha::Exceptions::Account;
use Koha::Items;
$max //= 0;
$self->credit_number($max + 1);
} elsif ($AutoCreditNumber eq 'annual') {
- my $now = DateTime->now;
+ my $now = dt_from_string;
my $prefix = sprintf('%d-', $now->year);
my $max = $rs->search({
-and => [
my $userenv = C4::Context->userenv;
if ($userenv) {
my $branch = $userenv->{branch};
- my $now = DateTime->now;
+ my $now = dt_from_string;
my $prefix = sprintf('%s%d%02d', $branch, $now->year, $now->month);
my $pattern = $prefix;
$pattern =~ s/([\?%_])/\\$1/g;
my $context = Test::MockModule->new('C4::Context');
$context->mock( 'userenv', { branch => $library->id } );
- my $now = DateTime->now;
+ my $now = dt_from_string;
my $year = $now->year;
my $month = $now->month;
my ($accountlines_id, $accountline);