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

(-)a/tools/export.pl (-7 / +11 lines)
Lines 29-34 use C4::Csv; Link Here
29
use C4::Koha;               # GetItemTypes
29
use C4::Koha;               # GetItemTypes
30
use C4::Output;
30
use C4::Output;
31
use C4::Record;
31
use C4::Record;
32
use Koha::DateUtils;
32
33
33
my $query = new CGI;
34
my $query = new CGI;
34
35
Lines 198-212 if ( $op eq "export" ) { Link Here
198
        my $itemtype             = $query->param("itemtype");
199
        my $itemtype             = $query->param("itemtype");
199
        my $start_callnumber     = $query->param("start_callnumber");
200
        my $start_callnumber     = $query->param("start_callnumber");
200
        my $end_callnumber       = $query->param("end_callnumber");
201
        my $end_callnumber       = $query->param("end_callnumber");
201
        $timestamp = ($timestamp) ? C4::Dates->new($timestamp) : ''
202
        if ( $commandline ) {
202
          if ($commandline);
203
            $timestamp = eval { output_pref( { dt => dt_from_string( $timestamp ), dateonly => 1 }); };
204
            $timestamp = '' unless ( $timestamp );
205
        }
206
203
        my $start_accession =
207
        my $start_accession =
204
          ( $query->param("start_accession") )
208
          ( $query->param("start_accession") )
205
          ? C4::Dates->new( $query->param("start_accession") )
209
          ? eval { output_pref( { dt => dt_from_string( $query->param("start_accession") ), dateonly => 1, dateformat => 'iso' } ); }
206
          : '';
210
          : '';
207
        my $end_accession =
211
        my $end_accession =
208
          ( $query->param("end_accession") )
212
          ( $query->param("end_accession") )
209
          ? C4::Dates->new( $query->param("end_accession") )
213
          ? eval { output_pref( { dt => dt_from_string( $query->param("end_accession") ), dateonly => 1, dateformat => 'iso' } ); }
210
          : '';
214
          : '';
211
        $dont_export_items = $query->param("dont_export_item")
215
        $dont_export_items = $query->param("dont_export_item")
212
          unless ($commandline);
216
          unless ($commandline);
Lines 565-571 sub construct_query { Link Here
565
                WHERE $biblioitemstable.timestamp >= ?
569
                WHERE $biblioitemstable.timestamp >= ?
566
                  OR deleteditems.timestamp >= ?
570
                  OR deleteditems.timestamp >= ?
567
            ) ";
571
            ) ";
568
            my $ts = $timestamp->output('iso');
572
            my $ts = eval { output_pref( { dt => dt_from_string( $timestamp ), dateonly => 1, dateformat => 'iso' }); };
569
            @sql_params = ( $ts, $ts, $ts, $ts );
573
            @sql_params = ( $ts, $ts, $ts, $ts );
570
        }
574
        }
571
        else {
575
        else {
Lines 618-629 sub construct_query { Link Here
618
            }
622
            }
619
            if ($start_accession) {
623
            if ($start_accession) {
620
                $sql_query .= " AND dateaccessioned >= ? ";
624
                $sql_query .= " AND dateaccessioned >= ? ";
621
                push @sql_params, $start_accession->output('iso');
625
                push @sql_params, $start_accession;
622
            }
626
            }
623
627
624
            if ($end_accession) {
628
            if ($end_accession) {
625
                $sql_query .= " AND dateaccessioned <= ? ";
629
                $sql_query .= " AND dateaccessioned <= ? ";
626
                push @sql_params, $end_accession->output('iso');
630
                push @sql_params, $end_accession;
627
            }
631
            }
628
632
629
            if ($itemtype) {
633
            if ($itemtype) {
(-)a/tools/import_borrowers.pl (-8 / +4 lines)
Lines 39-45 use warnings; Link Here
39
39
40
use C4::Auth;
40
use C4::Auth;
41
use C4::Output;
41
use C4::Output;
42
use C4::Dates qw(format_date_in_iso);
43
use C4::Context;
42
use C4::Context;
44
use C4::Branch qw/GetBranchesLoop GetBranchName/;
43
use C4::Branch qw/GetBranchesLoop GetBranchName/;
45
use C4::Members;
44
use C4::Members;
Lines 49-54 use C4::Members::Messaging; Link Here
49
use C4::Reports::Guided;
48
use C4::Reports::Guided;
50
use C4::Templates;
49
use C4::Templates;
51
use Koha::Borrower::Debarments;
50
use Koha::Borrower::Debarments;
51
use Koha::DateUtils;
52
52
53
use Text::CSV;
53
use Text::CSV;
54
# Text::CSV::Unicode, even in binary mode, fails to parse lines with these diacriticals:
54
# Text::CSV::Unicode, even in binary mode, fails to parse lines with these diacriticals:
Lines 141-151 if ( $uploadborrowers && length($uploadborrowers) > 0 ) { Link Here
141
    }
141
    }
142
142
143
    push @feedback, {feedback=>1, name=>'headerrow', value=>join(', ', @csvcolumns)};
143
    push @feedback, {feedback=>1, name=>'headerrow', value=>join(', ', @csvcolumns)};
144
    my $today_iso = C4::Dates->new()->output('iso');
144
    my $today_iso = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
145
    my @criticals = qw(surname branchcode categorycode);    # there probably should be others
145
    my @criticals = qw(surname branchcode categorycode);    # there probably should be others
146
    my @bad_dates;  # I've had a few.
146
    my @bad_dates;  # I've had a few.
147
    my $date_re = C4::Dates->new->regexp('syspref');
148
    my  $iso_re = C4::Dates->new->regexp('iso');
149
    LINE: while ( my $borrowerline = <$handle> ) {
147
    LINE: while ( my $borrowerline = <$handle> ) {
150
        my %borrower;
148
        my %borrower;
151
        my @missing_criticals;
149
        my @missing_criticals;
Lines 211-219 if ( $uploadborrowers && length($uploadborrowers) > 0 ) { Link Here
211
	# Popular spreadsheet applications make it difficult to force date outputs to be zero-padded, but we require it.
209
	# Popular spreadsheet applications make it difficult to force date outputs to be zero-padded, but we require it.
212
        foreach (qw(dateofbirth dateenrolled dateexpiry)) {
210
        foreach (qw(dateofbirth dateenrolled dateexpiry)) {
213
            my $tempdate = $borrower{$_} or next;
211
            my $tempdate = $borrower{$_} or next;
214
            if ($tempdate =~ /$date_re/) {
212
            $tempdate = eval { output_pref( { dt => dt_from_string( $tempdate ), dateonly => 1, dateformat => 'iso' } ); };
215
                $borrower{$_} = format_date_in_iso($tempdate);
213
            if ($tempdate) {
216
            } elsif ($tempdate =~ /$iso_re/) {
217
                $borrower{$_} = $tempdate;
214
                $borrower{$_} = $tempdate;
218
            } else {
215
            } else {
219
                $borrower{$_} = '';
216
                $borrower{$_} = '';
220
- 

Return to bug 14997