Lines 120-129
if ( $op eq 'cud-move' ) {
Link Here
|
120 |
my @success_messages; |
120 |
my @success_messages; |
121 |
my @error_messages; |
121 |
my @error_messages; |
122 |
|
122 |
|
123 |
foreach my $hold_id (@hold_ids) { |
123 |
#Get a list of all the holds to move, ordered by current priority |
124 |
my $hold = Koha::Holds->find($hold_id); |
124 |
my @moving_holds = Koha::Holds->search( |
|
|
125 |
{ reserve_id => \@hold_ids }, |
126 |
{ order_by => { -asc => 'priority' } } |
127 |
)->as_list; |
128 |
|
129 |
#need to get the biblionumber of the original hold |
130 |
my $original_biblionumber = $moving_holds[0]->biblionumber; |
131 |
|
132 |
my $offset = 0; |
133 |
foreach my $hold (@moving_holds) { |
125 |
my $original_biblio = Koha::Biblios->find( $hold->biblionumber ); |
134 |
my $original_biblio = Koha::Biblios->find( $hold->biblionumber ); |
126 |
my $result = $hold->move_hold_item( |
135 |
|
|
|
136 |
my $result = $hold->move_hold_item( |
127 |
{ |
137 |
{ |
128 |
new_itemnumber => $new_itemnumber, |
138 |
new_itemnumber => $new_itemnumber, |
129 |
new_biblionumber => $new_biblionumber, |
139 |
new_biblionumber => $new_biblionumber, |
Lines 133-146
if ( $op eq 'cud-move' ) {
Link Here
|
133 |
#push info about successes and errors to the template |
143 |
#push info about successes and errors to the template |
134 |
if ( $result->{success} ) { |
144 |
if ( $result->{success} ) { |
135 |
push @success_messages, { |
145 |
push @success_messages, { |
136 |
hold_id => $hold_id, |
146 |
hold_id => $hold->id, |
137 |
success => 1, |
147 |
success => 1, |
138 |
original_biblio => $original_biblio, |
148 |
original_biblio => $original_biblio, |
139 |
target_biblio => $target_biblio, |
149 |
target_biblio => $target_biblio, |
140 |
}; |
150 |
}; |
141 |
} else { |
151 |
} else { |
142 |
push @error_messages, { |
152 |
push @error_messages, { |
143 |
hold_id => $hold_id, |
153 |
hold_id => $hold->id, |
144 |
success => 0, |
154 |
success => 0, |
145 |
original_biblio => $original_biblio, |
155 |
original_biblio => $original_biblio, |
146 |
target_biblio => $target_biblio, |
156 |
target_biblio => $target_biblio, |
Lines 149-155
if ( $op eq 'cud-move' ) {
Link Here
|
149 |
} |
159 |
} |
150 |
} |
160 |
} |
151 |
|
161 |
|
152 |
push @biblionumbers, $new_biblionumber; |
162 |
C4::Reserves::_FixPriority( { biblionumber => $original_biblionumber } ); |
|
|
163 |
push @biblionumbers, $original_biblionumber; |
153 |
|
164 |
|
154 |
$template->param( |
165 |
$template->param( |
155 |
hold_move_successes => \@success_messages, |
166 |
hold_move_successes => \@success_messages, |
156 |
- |
|
|