use C4::Koha; # GetItemTypes
use C4::Output;
use C4::Record;
+use Koha::DateUtils;
my $query = new CGI;
my $itemtype = $query->param("itemtype");
my $start_callnumber = $query->param("start_callnumber");
my $end_callnumber = $query->param("end_callnumber");
- $timestamp = ($timestamp) ? C4::Dates->new($timestamp) : ''
- if ($commandline);
+ if ( $commandline ) {
+ $timestamp = eval { output_pref( { dt => dt_from_string( $timestamp ), dateonly => 1 }); };
+ $timestamp = '' unless ( $timestamp );
+ }
+
my $start_accession =
( $query->param("start_accession") )
- ? C4::Dates->new( $query->param("start_accession") )
+ ? eval { output_pref( { dt => dt_from_string( $query->param("start_accession") ), dateonly => 1, dateformat => 'iso' } ); }
: '';
my $end_accession =
( $query->param("end_accession") )
- ? C4::Dates->new( $query->param("end_accession") )
+ ? eval { output_pref( { dt => dt_from_string( $query->param("end_accession") ), dateonly => 1, dateformat => 'iso' } ); }
: '';
$dont_export_items = $query->param("dont_export_item")
unless ($commandline);
WHERE $biblioitemstable.timestamp >= ?
OR deleteditems.timestamp >= ?
) ";
- my $ts = $timestamp->output('iso');
+ my $ts = eval { output_pref( { dt => dt_from_string( $timestamp ), dateonly => 1, dateformat => 'iso' }); };
@sql_params = ( $ts, $ts, $ts, $ts );
}
else {
}
if ($start_accession) {
$sql_query .= " AND dateaccessioned >= ? ";
- push @sql_params, $start_accession->output('iso');
+ push @sql_params, $start_accession;
}
if ($end_accession) {
$sql_query .= " AND dateaccessioned <= ? ";
- push @sql_params, $end_accession->output('iso');
+ push @sql_params, $end_accession;
}
if ($itemtype) {
use C4::Auth;
use C4::Output;
-use C4::Dates qw(format_date_in_iso);
use C4::Context;
use C4::Branch qw/GetBranchesLoop GetBranchName/;
use C4::Members;
use C4::Reports::Guided;
use C4::Templates;
use Koha::Borrower::Debarments;
+use Koha::DateUtils;
use Text::CSV;
# Text::CSV::Unicode, even in binary mode, fails to parse lines with these diacriticals:
}
push @feedback, {feedback=>1, name=>'headerrow', value=>join(', ', @csvcolumns)};
- my $today_iso = C4::Dates->new()->output('iso');
+ my $today_iso = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
my @criticals = qw(surname branchcode categorycode); # there probably should be others
my @bad_dates; # I've had a few.
- my $date_re = C4::Dates->new->regexp('syspref');
- my $iso_re = C4::Dates->new->regexp('iso');
LINE: while ( my $borrowerline = <$handle> ) {
my %borrower;
my @missing_criticals;
# Popular spreadsheet applications make it difficult to force date outputs to be zero-padded, but we require it.
foreach (qw(dateofbirth dateenrolled dateexpiry)) {
my $tempdate = $borrower{$_} or next;
- if ($tempdate =~ /$date_re/) {
- $borrower{$_} = format_date_in_iso($tempdate);
- } elsif ($tempdate =~ /$iso_re/) {
+ $tempdate = eval { output_pref( { dt => dt_from_string( $tempdate ), dateonly => 1, dateformat => 'iso' } ); };
+ if ($tempdate) {
$borrower{$_} = $tempdate;
} else {
$borrower{$_} = '';