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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt (-1 / +1 lines)
Lines 134-140 Link Here
134
                                                <td>[% checkout.issuedate | $KohaDates %]</td>
134
                                                <td>[% checkout.issuedate | $KohaDates %]</td>
135
                                                <td>[% Branches.GetName( checkout.branchcode ) | html %]</td>
135
                                                <td>[% Branches.GetName( checkout.branchcode ) | html %]</td>
136
                                                <td>
136
                                                <td>
137
                                                    [% new_due_dates.shift | $KohaDates as_due_date => 1 %]
137
                                                    [% new_due_dates.shift %]
138
                                                </td>
138
                                                </td>
139
                                            </tr>
139
                                            </tr>
140
                                        [% END %]
140
                                        [% END %]
(-)a/tools/batch_extend_due_dates.pl (-8 / +9 lines)
Lines 53-58 elsif ( $op eq 'list' ) { Link Here
53
    my $due_date_days     = $input->param('due_date_days');
53
    my $due_date_days     = $input->param('due_date_days');
54
54
55
    $new_hard_due_date &&= dt_from_string($new_hard_due_date);
55
    $new_hard_due_date &&= dt_from_string($new_hard_due_date);
56
    $from_due_date     &&= dt_from_string($from_due_date);
57
    $to_due_date       &&= dt_from_string($to_due_date);
56
58
57
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
59
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
58
    my $search_params;
60
    my $search_params;
Lines 63-69 elsif ( $op eq 'list' ) { Link Here
63
        $search_params->{'me.branchcode'} = { -in => \@branchcodes };
65
        $search_params->{'me.branchcode'} = { -in => \@branchcodes };
64
    }
66
    }
65
    if ( $from_due_date and $to_due_date ) {
67
    if ( $from_due_date and $to_due_date ) {
66
        my $to_due_date_endday = dt_from_string($to_due_date);
68
        my $to_due_date_endday = $to_due_date;
67
        $to_due_date_endday
69
        $to_due_date_endday
68
          ->set(  # We set last second of day to see all checkouts from that day
70
          ->set(  # We set last second of day to see all checkouts from that day
69
            hour   => 23,
71
            hour   => 23,
Lines 72-88 elsif ( $op eq 'list' ) { Link Here
72
          );
74
          );
73
        $search_params->{'me.date_due'} = {
75
        $search_params->{'me.date_due'} = {
74
            -between => [
76
            -between => [
75
                $dtf->format_datetime( dt_from_string($from_due_date) ),
77
                $dtf->format_datetime($from_due_date),
76
                $dtf->format_datetime($to_due_date_endday),
78
                $dtf->format_datetime($to_due_date_endday),
77
            ]
79
            ]
78
        };
80
        };
79
    }
81
    }
80
    elsif ($from_due_date) {
82
    elsif ($from_due_date) {
81
        $search_params->{'me.date_due'} =
83
        $search_params->{'me.date_due'} =
82
          { '>=' => $dtf->format_datetime( dt_from_string($from_due_date) ) };
84
          { '>=' => $dtf->format_datetime($from_due_date) };
83
    }
85
    }
84
    elsif ($to_due_date) {
86
    elsif ($to_due_date) {
85
        my $to_due_date_endday = dt_from_string($to_due_date);
87
        my $to_due_date_endday = $to_due_date;
86
        $to_due_date_endday
88
        $to_due_date_endday
87
          ->set(  # We set last second of day to see all checkouts from that day
89
          ->set(  # We set last second of day to see all checkouts from that day
88
            hour   => 23,
90
            hour   => 23,
Lines 109-115 elsif ( $op eq 'list' ) { Link Here
109
                new_hard_due_date => $new_hard_due_date,
111
                new_hard_due_date => $new_hard_due_date,
110
                add_days          => $due_date_days
112
                add_days          => $due_date_days
111
            }
113
            }
112
          ), dateformat => 'iso' });
114
          ), as_due_date => 1 });
113
    }
115
    }
114
116
115
    $template->param(
117
    $template->param(
Lines 162-174 sub calc_new_due_date { Link Here
162
164
163
    my $new;
165
    my $new;
164
    if ( $new_hard_due_date ) {
166
    if ( $new_hard_due_date ) {
165
      $new = $new_hard_due_date->clone->set(
167
      $new = $new_hard_due_date->set(
166
        hour   => $due_date->hour,
168
        hour   => $due_date->hour,
167
        minute => $due_date->minute,
169
        minute => $due_date->minute,
168
        second => $due_date->second,
170
        second => $due_date->second,
169
      )
171
      )
170
  } else {
172
  } else {
171
      $new = $due_date->clone->add( days => $add_days );
173
      $new = $due_date->add( days => $add_days );
172
  }
174
  }
173
  return $new;
175
  return $new;
174
}
176
}
175
- 

Return to bug 25088