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