Lines 225-274
unless( defined $invoice->{closedate} ) {
Link Here
|
225 |
for (my $i = 0 ; $i < $countpendings ; $i++) { |
225 |
for (my $i = 0 ; $i < $countpendings ; $i++) { |
226 |
my $order = $pendingorders->[$i]; |
226 |
my $order = $pendingorders->[$i]; |
227 |
|
227 |
|
228 |
if ( $bookseller->invoiceincgst ) { |
228 |
unless( !defined $order->{biblionumber} ){ # if this biblio has been deleted and the orderline hasn't been cancelled |
229 |
$order->{ecost} = $order->{ecost_tax_included}; |
229 |
if ( $bookseller->invoiceincgst ) { |
230 |
} else { |
230 |
$order->{ecost} = $order->{ecost_tax_included}; |
231 |
$order->{ecost} = $order->{ecost_tax_excluded}; |
231 |
} else { |
|
|
232 |
$order->{ecost} = $order->{ecost_tax_excluded}; |
233 |
} |
234 |
$order->{total} = $order->{ecost} * $order->{quantity}; |
235 |
|
236 |
my %line = %$order; |
237 |
|
238 |
$line{invoice} = $invoice; |
239 |
$line{booksellerid} = $booksellerid; |
240 |
|
241 |
my $biblionumber = $line{'biblionumber'}; |
242 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
243 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
244 |
my $ordernumber = $line{'ordernumber'}; |
245 |
my $cnt_subscriptions = $biblio->subscriptions->count; |
246 |
my $itemcount = $biblio->items->count; |
247 |
my $holds_count = $biblio->holds->count; |
248 |
my @items = GetItemnumbersFromOrder( $ordernumber ); |
249 |
my $itemholds = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@items } })->count : 0; |
250 |
|
251 |
my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); |
252 |
$line{suggestionid} = $suggestion->{suggestionid}; |
253 |
$line{surnamesuggestedby} = $suggestion->{surnamesuggestedby}; |
254 |
$line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; |
255 |
|
256 |
# 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 |
257 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !($cnt_subscriptions) && !($holds_count); |
258 |
$line{items} = ($itemcount) - (scalar @items); |
259 |
$line{left_item} = 1 if $line{items} >= 1; |
260 |
$line{left_biblio} = 1 if $countbiblio > 1; |
261 |
$line{biblios} = $countbiblio - 1; |
262 |
$line{left_subscription} = 1 if $cnt_subscriptions; |
263 |
$line{subscriptions} = $cnt_subscriptions; |
264 |
$line{left_holds} = ($holds_count >= 1) ? 1 : 0; |
265 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
266 |
$line{holds} = $holds_count; |
267 |
$line{holds_on_order} = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order}; |
268 |
|
269 |
my $budget_name = GetBudgetName( $line{budget_id} ); |
270 |
$line{budget_name} = $budget_name; |
271 |
|
272 |
push @loop_orders, \%line; |
232 |
} |
273 |
} |
233 |
$order->{total} = $order->{ecost} * $order->{quantity}; |
|
|
234 |
|
235 |
my %line = %$order; |
236 |
|
237 |
$line{invoice} = $invoice; |
238 |
$line{booksellerid} = $booksellerid; |
239 |
|
240 |
my $biblionumber = $line{'biblionumber'}; |
241 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
242 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
243 |
my $ordernumber = $line{'ordernumber'}; |
244 |
my $cnt_subscriptions = $biblio->subscriptions->count; |
245 |
my $itemcount = $biblio->items->count; |
246 |
my $holds_count = $biblio->holds->count; |
247 |
my @items = GetItemnumbersFromOrder( $ordernumber ); |
248 |
my $itemholds = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@items } })->count : 0; |
249 |
|
250 |
my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); |
251 |
$line{suggestionid} = $suggestion->{suggestionid}; |
252 |
$line{surnamesuggestedby} = $suggestion->{surnamesuggestedby}; |
253 |
$line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; |
254 |
|
255 |
# 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 |
256 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !($cnt_subscriptions) && !($holds_count); |
257 |
$line{items} = ($itemcount) - (scalar @items); |
258 |
$line{left_item} = 1 if $line{items} >= 1; |
259 |
$line{left_biblio} = 1 if $countbiblio > 1; |
260 |
$line{biblios} = $countbiblio - 1; |
261 |
$line{left_subscription} = 1 if $cnt_subscriptions; |
262 |
$line{subscriptions} = $cnt_subscriptions; |
263 |
$line{left_holds} = ($holds_count >= 1) ? 1 : 0; |
264 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
265 |
$line{holds} = $holds_count; |
266 |
$line{holds_on_order} = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order}; |
267 |
|
268 |
my $budget_name = GetBudgetName( $line{budget_id} ); |
269 |
$line{budget_name} = $budget_name; |
270 |
|
271 |
push @loop_orders, \%line; |
272 |
} |
274 |
} |
273 |
|
275 |
|
274 |
$template->param( |
276 |
$template->param( |
275 |
- |
|
|