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

(-)a/tools/batch_extend_due_dates.pl (-9 / +10 lines)
Lines 24-29 use CGI; Link Here
24
24
25
use C4::Auth qw( get_template_and_user );
25
use C4::Auth qw( get_template_and_user );
26
use C4::Output qw( output_html_with_http_headers );
26
use C4::Output qw( output_html_with_http_headers );
27
use C4::Items qw( ModItem );
27
use Koha::Checkouts;
28
use Koha::Checkouts;
28
use Koha::DateUtils qw( dt_from_string );
29
use Koha::DateUtils qw( dt_from_string );
29
30
Lines 126-139 elsif ( $op eq 'modify' ) { Link Here
126
    my $checkouts =
127
    my $checkouts =
127
      Koha::Checkouts->search( { issue_id => { -in => \@issue_ids } } );
128
      Koha::Checkouts->search( { issue_id => { -in => \@issue_ids } } );
128
    while ( my $checkout = $checkouts->next ) {
129
    while ( my $checkout = $checkouts->next ) {
129
        if ($new_hard_due_date) {
130
        my $new_due_date = $new_hard_due_date
130
            $checkout->date_due($new_hard_due_date)->store;
131
          || dt_from_string( $checkout->date_due )->add( days => $due_date_days );
131
        }
132
132
        else {
133
        # Update checkout's due date
133
            my $dt = dt_from_string( $checkout->date_due )
134
        $checkout->date_due($new_due_date)->store;
134
              ->add( days => $due_date_days );
135
135
            $checkout->date_due($dt)->store;
136
        # Update items.onloan
136
        }
137
        ModItem( { onloan => $new_due_date->strftime('%Y-%m-%d %H:%M') },
138
            undef, $checkout->itemnumber );
137
    }
139
    }
138
140
139
    $template->param(
141
    $template->param(
140
- 

Return to bug 24846