Lines 181-285
for my $order ( @orders ) {
Link Here
|
181 |
} |
181 |
} |
182 |
push @book_foot_loop, map { $_ } values %foot; |
182 |
push @book_foot_loop, map { $_ } values %foot; |
183 |
|
183 |
|
184 |
my @loop_orders = (); |
|
|
185 |
unless( defined $invoice->{closedate} ) { |
186 |
my $pendingorders; |
187 |
if ( $op eq "search" or $sticky_filters ) { |
188 |
my ( $search, $ean, $basketname, $orderno, $basketgroupname ); |
189 |
if ( $sticky_filters ) { |
190 |
$search = $input->cookie("filter_parcel_summary"); |
191 |
$ean = $input->cookie("filter_parcel_ean"); |
192 |
$basketname = $input->cookie("filter_parcel_basketname"); |
193 |
$orderno = $input->cookie("filter_parcel_orderno"); |
194 |
$basketgroupname = $input->cookie("filter_parcel_basketgroupname"); |
195 |
} else { |
196 |
$search = $input->param('summaryfilter') || ''; |
197 |
$ean = $input->param('eanfilter') || ''; |
198 |
$basketname = $input->param('basketfilter') || ''; |
199 |
$orderno = $input->param('orderfilter') || ''; |
200 |
$basketgroupname = $input->param('basketgroupnamefilter') || ''; |
201 |
} |
202 |
$pendingorders = SearchOrders({ |
203 |
booksellerid => $booksellerid, |
204 |
basketname => $basketname, |
205 |
ordernumber => $orderno, |
206 |
search => $search, |
207 |
ean => $ean, |
208 |
basketgroupname => $basketgroupname, |
209 |
pending => 1, |
210 |
ordered => 1, |
211 |
}); |
212 |
$template->param( |
213 |
summaryfilter => $search, |
214 |
eanfilter => $ean, |
215 |
basketfilter => $basketname, |
216 |
orderfilter => $orderno, |
217 |
basketgroupnamefilter => $basketgroupname, |
218 |
); |
219 |
}else{ |
220 |
$pendingorders = SearchOrders({ |
221 |
booksellerid => $booksellerid, |
222 |
ordered => 1 |
223 |
}); |
224 |
} |
225 |
my $countpendings = scalar @$pendingorders; |
226 |
|
227 |
for (my $i = 0 ; $i < $countpendings ; $i++) { |
228 |
my $order = $pendingorders->[$i]; |
229 |
|
230 |
if ( $bookseller->invoiceincgst ) { |
231 |
$order->{ecost} = $order->{ecost_tax_included}; |
232 |
} else { |
233 |
$order->{ecost} = $order->{ecost_tax_excluded}; |
234 |
} |
235 |
$order->{total} = get_rounded_price($order->{ecost}) * $order->{quantity}; |
236 |
|
237 |
my %line = %$order; |
238 |
|
239 |
$line{invoice} = $invoice; |
240 |
$line{booksellerid} = $booksellerid; |
241 |
|
242 |
my $biblionumber = $line{'biblionumber'}; |
243 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
244 |
my $countbiblio = $biblio->active_orders->count; |
245 |
my $ordernumber = $line{'ordernumber'}; |
246 |
my $order_object = Koha::Acquisition::Orders->find($ordernumber); |
247 |
my $cnt_subscriptions = $biblio ? $biblio->subscriptions->count: 0; |
248 |
my $itemcount = $biblio ? $biblio->items->count : 0; |
249 |
my $holds_count = $biblio ? $biblio->holds->count : 0; |
250 |
my @itemnumbers = $order_object->items->get_column('itemnumber'); |
251 |
my $itemholds = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@itemnumbers } })->count : 0; |
252 |
|
253 |
my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); |
254 |
$line{suggestionid} = $suggestion->{suggestionid}; |
255 |
$line{surnamesuggestedby} = $suggestion->{surnamesuggestedby}; |
256 |
$line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; |
257 |
|
258 |
# if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680 |
259 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @itemnumbers && !($cnt_subscriptions) && !($holds_count); |
260 |
$line{items} = ($itemcount) - (scalar @itemnumbers); |
261 |
$line{left_item} = 1 if $line{items} >= 1; |
262 |
$line{left_biblio} = 1 if $countbiblio > 1; |
263 |
$line{biblios} = $countbiblio - 1; |
264 |
$line{left_subscription} = 1 if $cnt_subscriptions; |
265 |
$line{subscriptions} = $cnt_subscriptions; |
266 |
$line{left_holds} = ($holds_count >= 1) ? 1 : 0; |
267 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
268 |
$line{holds} = $holds_count; |
269 |
$line{holds_on_order} = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order}; |
270 |
$line{basket} = Koha::Acquisition::Baskets->find( $line{basketno} ); |
271 |
|
272 |
my $budget_name = GetBudgetName( $line{budget_id} ); |
273 |
$line{budget_name} = $budget_name; |
274 |
|
275 |
push @loop_orders, \%line; |
276 |
} |
277 |
|
278 |
$template->param( |
279 |
loop_orders => \@loop_orders, |
280 |
); |
281 |
} |
282 |
|
283 |
$template->param( |
184 |
$template->param( |
284 |
invoiceid => $invoice->{invoiceid}, |
185 |
invoiceid => $invoice->{invoiceid}, |
285 |
invoice => $invoice->{invoicenumber}, |
186 |
invoice => $invoice->{invoicenumber}, |
Lines 288-294
$template->param(
Link Here
|
288 |
name => $bookseller->name, |
189 |
name => $bookseller->name, |
289 |
booksellerid => $bookseller->id, |
190 |
booksellerid => $bookseller->id, |
290 |
loop_received => \@loop_received, |
191 |
loop_received => \@loop_received, |
291 |
loop_orders => \@loop_orders, |
|
|
292 |
book_foot_loop => \@book_foot_loop, |
192 |
book_foot_loop => \@book_foot_loop, |
293 |
(uc(C4::Context->preference("marcflavour"))) => 1, |
193 |
(uc(C4::Context->preference("marcflavour"))) => 1, |
294 |
total_tax_excluded => $total_tax_excluded, |
194 |
total_tax_excluded => $total_tax_excluded, |
295 |
- |
|
|