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