Lines 29-34
use Koha::DateUtils qw( dt_from_string output_pref );
Link Here
|
29 |
|
29 |
|
30 |
my $input = new CGI; |
30 |
my $input = new CGI; |
31 |
my $op = $input->param('op') // q|form|; |
31 |
my $op = $input->param('op') // q|form|; |
|
|
32 |
my $preview_results = $input->param('preview_results'); |
32 |
|
33 |
|
33 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
34 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
34 |
{ |
35 |
{ |
Lines 40-45
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
40 |
} |
41 |
} |
41 |
); |
42 |
); |
42 |
|
43 |
|
|
|
44 |
my @issue_ids; |
45 |
|
43 |
if ( $op eq 'form' ) { |
46 |
if ( $op eq 'form' ) { |
44 |
$template->param( view => 'form', ); |
47 |
$template->param( view => 'form', ); |
45 |
} |
48 |
} |
Lines 102-134
elsif ( $op eq 'list' ) {
Link Here
|
102 |
|
105 |
|
103 |
my @new_due_dates; |
106 |
my @new_due_dates; |
104 |
while ( my $checkout = $checkouts->next ) { |
107 |
while ( my $checkout = $checkouts->next ) { |
105 |
push @new_due_dates, |
108 |
if ($preview_results) { |
106 |
output_pref({ dt => calc_new_due_date( |
109 |
push( |
107 |
{ |
110 |
@new_due_dates, |
108 |
due_date => dt_from_string($checkout->date_due), |
111 |
output_pref( |
109 |
new_hard_due_date => $new_hard_due_date, |
112 |
{ |
110 |
add_days => $due_date_days |
113 |
dt => calc_new_due_date( |
111 |
} |
114 |
{ |
112 |
), dateformat => 'iso' }); |
115 |
due_date => |
|
|
116 |
dt_from_string( $checkout->date_due ), |
117 |
new_hard_due_date => $new_hard_due_date, |
118 |
add_days => $due_date_days |
119 |
} |
120 |
), |
121 |
dateformat => 'iso' |
122 |
} |
123 |
) |
124 |
); |
125 |
} else { |
126 |
push( @issue_ids, $checkout->id ); |
127 |
} |
113 |
} |
128 |
} |
114 |
|
129 |
|
115 |
$template->param( |
130 |
if ( $preview_results ) { |
116 |
checkouts => $checkouts, |
131 |
$template->param( |
117 |
new_hard_due_date => $new_hard_due_date |
132 |
checkouts => $checkouts, |
118 |
? dt_from_string($new_hard_due_date) |
133 |
new_hard_due_date => $new_hard_due_date |
119 |
: undef, |
134 |
? dt_from_string($new_hard_due_date) |
120 |
due_date_days => $due_date_days, |
135 |
: undef, |
121 |
new_due_dates => \@new_due_dates, |
136 |
due_date_days => $due_date_days, |
122 |
view => 'list', |
137 |
new_due_dates => \@new_due_dates, |
123 |
); |
138 |
view => 'list', |
|
|
139 |
); |
140 |
} else { |
141 |
$op = 'modify'; |
142 |
} |
124 |
} |
143 |
} |
125 |
elsif ( $op eq 'modify' ) { |
144 |
|
|
|
145 |
if ( $op eq 'modify' ) { |
126 |
|
146 |
|
127 |
# We want to modify selected checkouts! |
147 |
# We want to modify selected checkouts! |
128 |
my @issue_ids = $input->multi_param('issue_id'); |
|
|
129 |
my $new_hard_due_date = $input->param('new_hard_due_date'); |
148 |
my $new_hard_due_date = $input->param('new_hard_due_date'); |
130 |
my $due_date_days = $input->param('due_date_days'); |
149 |
my $due_date_days = $input->param('due_date_days'); |
131 |
|
150 |
|
|
|
151 |
# @issue_ids will already be populated if we are skipping the results display |
152 |
@issue_ids = $input->multi_param('issue_id') unless @issue_ids; |
153 |
|
132 |
$new_hard_due_date &&= dt_from_string($new_hard_due_date); |
154 |
$new_hard_due_date &&= dt_from_string($new_hard_due_date); |
133 |
my $checkouts = |
155 |
my $checkouts = |
134 |
Koha::Checkouts->search( { issue_id => { -in => \@issue_ids } } ); |
156 |
Koha::Checkouts->search( { issue_id => { -in => \@issue_ids } } ); |
135 |
- |
|
|