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

(-)a/Koha/DateUtils.pm (-5 / +17 lines)
Lines 101-111 or C<undef> if C<undef> was provided. Link Here
101
A second parameter allows overriding of the syspref value. This is for testing only
101
A second parameter allows overriding of the syspref value. This is for testing only
102
In usage use the DateTime objects own methods for non standard formatting
102
In usage use the DateTime objects own methods for non standard formatting
103
103
104
A third parameter allows to specify if the output format contains the hours and minutes.
105
If it is not defined, the default value is 0;
106
104
=cut
107
=cut
105
108
106
sub output_pref {
109
sub output_pref {
107
    my $dt         = shift;
110
    my $dt         = shift;
108
    my $force_pref = shift;    # if testing we want to override Context
111
    my $force_pref = shift;         # if testing we want to override Context
112
    my $dateonly   = shift || 0;    # if you don't want the hours and minutes
109
113
110
    return unless defined $dt;
114
    return unless defined $dt;
111
115
Lines 113-128 sub output_pref { Link Here
113
      defined $force_pref ? $force_pref : C4::Context->preference('dateformat');
117
      defined $force_pref ? $force_pref : C4::Context->preference('dateformat');
114
    given ($pref) {
118
    given ($pref) {
115
        when (/^iso/) {
119
        when (/^iso/) {
116
            return $dt->strftime('%Y-%m-%d %H:%M');
120
            return $dateonly
121
                ? $dt->strftime('%Y-%m-%d')
122
                : $dt->strftime('%Y-%m-%d %H:%M');
117
        }
123
        }
118
        when (/^metric/) {
124
        when (/^metric/) {
119
            return $dt->strftime('%d/%m/%Y %H:%M');
125
            return $dateonly
126
                ? $dt->strftime('%d/%m/%Y')
127
                : $dt->strftime('%d/%m/%Y %H:%M');
120
        }
128
        }
121
        when (/^us/) {
129
        when (/^us/) {
122
            return $dt->strftime('%m/%d/%Y %H:%M');
130
            return $dateonly
131
                ? $dt->strftime('%m/%d/%Y')
132
                : $dt->strftime('%m/%d/%Y %H:%M');
123
        }
133
        }
124
        default {
134
        default {
125
            return $dt->strftime('%Y-%m-%d %H:%M');
135
            return $dateonly
136
                ? $dt->strftime('%Y-%m-%d')
137
                : $dt->strftime('%Y-%m-%d %H:%M');
126
        }
138
        }
127
139
128
    }
140
    }
(-)a/acqui/lateorders.pl (-17 / +17 lines)
Lines 78-93 my $estimateddeliverydatefrom_dt = Link Here
78
  : undef;
78
  : undef;
79
79
80
# Get the "date to" param. If it is not defined and $delay is not defined too, it is the today's date.
80
# Get the "date to" param. If it is not defined and $delay is not defined too, it is the today's date.
81
my $estimateddeliverydateto_dt = dt_from_string($estimateddeliverydateto);
81
my $estimateddeliverydateto_dt = $estimateddeliverydateto
82
    ? dt_from_string($estimateddeliverydateto)
83
    : ( not defined $delay and not defined $estimateddeliverydatefrom)
84
        ? dt_from_string()
85
        : undef;
82
86
83
# Format the output of "date from" and "date to"
87
# Format the output of "date from" and "date to"
84
if ($estimateddeliverydatefrom) {
88
if ($estimateddeliverydatefrom_dt) {
85
    $estimateddeliverydatefrom = output_pref($estimateddeliverydatefrom_dt);
89
    $estimateddeliverydatefrom = output_pref($estimateddeliverydatefrom_dt, undef, 1);
86
    $estimateddeliverydatefrom =~ s/ \d\d:\d\d$//;
87
}
90
}
88
if ($estimateddeliverydateto) {
91
if ($estimateddeliverydateto_dt) {
89
    $estimateddeliverydateto = output_pref($estimateddeliverydateto_dt);
92
    $estimateddeliverydateto = output_pref($estimateddeliverydateto_dt, undef, 1);
90
    $estimateddeliverydateto =~ s/ \d\d:\d\d$//;
91
}
93
}
92
94
93
my $branch     = $input->param('branch');
95
my $branch     = $input->param('branch');
Lines 117-131 if ($op and $op eq "send_alert"){ Link Here
117
}
119
}
118
120
119
my @parameters = ( $delay, $branch );
121
my @parameters = ( $delay, $branch );
120
if ($estimateddeliverydatefrom_dt) {
122
push @parameters, $estimateddeliverydatefrom_dt
121
    push @parameters, $estimateddeliverydatefrom_dt->ymd();
123
    ? $estimateddeliverydatefrom_dt->ymd()
122
}
124
    : undef;
123
else {
125
124
    push @parameters, undef;
126
push @parameters, $estimateddeliverydateto_dt
125
}
127
    ? $estimateddeliverydateto_dt->ymd()
126
if ($estimateddeliverydateto_dt) {
128
    : undef;
127
    push @parameters, $estimateddeliverydateto_dt->ymd();
129
128
}
129
my %supplierlist = GetBooksellersWithLateOrders(@parameters);
130
my %supplierlist = GetBooksellersWithLateOrders(@parameters);
130
131
131
my (@sloopy);	# supplier loop
132
my (@sloopy);	# supplier loop
132
- 

Return to bug 8652