X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=acqui%2Fparcel.pl;h=ee96e3f33372be87dc16d467b6eee3d74361d838;hb=475a9d19d1e023aac12bc8dd7d11405467f869f7;hp=0e0f41bce384819a98aeab4310bba375435b0e22;hpb=d7faf087a3331bfee0348860a31518cc6f0c0075;p=koha.git diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 0e0f41bce3..ee96e3f333 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -118,6 +118,18 @@ my ($template, $loggedinuser, $cookie) }); my $invoiceid = $input->param('invoiceid'); +my $invoice; +$invoice = GetInvoiceDetails($invoiceid) if $invoiceid; + +unless( $invoiceid and $invoice->{invoiceid} ) { + $template->param( + error_invoice_not_known => 1, + no_orders_to_display => 1 + ); + output_html_with_http_headers $input, $cookie, $template->output; + exit; +} + my $op = $input->param('op') // ''; if ($op eq 'cancelreceipt') { @@ -128,33 +140,10 @@ if ($op eq 'cancelreceipt') { } } -my $invoice = GetInvoiceDetails($invoiceid); my $booksellerid = $invoice->{booksellerid}; my $bookseller = GetBookSellerFromId($booksellerid); my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; my $datereceived = C4::Dates->new(); -my $code = $input->param('code'); -my @rcv_err = $input->param('error'); -my @rcv_err_barcode = $input->param('error_bc'); -my $startfrom=$input->param('startfrom'); -my $resultsperpage = $input->param('resultsperpage'); -$resultsperpage = 20 unless ($resultsperpage); -$startfrom=0 unless ($startfrom); - - - -# If receiving error, report the error (coming from finishrecieve.pl(sic)). -if( scalar(@rcv_err) ) { - my $cnt=0; - my $error_loop; - for my $err (@rcv_err) { - push @$error_loop, { "error_$err" => 1 , barcode => $rcv_err_barcode[$cnt] }; - $cnt++; - } - $template->param( receive_error => 1 , - error_loop => $error_loop, - ); -} my $cfstr = "%.2f"; # currency format string -- could get this from currency table. my @parcelitems = @{ $invoice->{orders} }; @@ -281,40 +270,7 @@ if(!defined $invoice->{closedate}) { my $budget = GetBudget( $line{budget_id} ); $line{budget_name} = $budget->{'budget_name'}; - push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); - } - - my $count = $countpendings; - - if ($count>$resultsperpage){ - my $displaynext=0; - my $displayprev=$startfrom; - if(($count - ($startfrom+$resultsperpage)) > 0 ) { - $displaynext = 1; - } - - my @numbers = (); - for (my $i=1; $i<$count/$resultsperpage+1; $i++) { - my $highlight=0; - ($startfrom/$resultsperpage==($i-1)) && ($highlight=1); - push @numbers, { number => $i, - highlight => $highlight , - startfrom => ($i-1)*$resultsperpage}; - } - - my $from = $startfrom*$resultsperpage+1; - my $to; - if($count < (($startfrom+1)*$resultsperpage)){ - $to = $count; - } else { - $to = (($startfrom+1)*$resultsperpage); - } - $template->param(numbers=>\@numbers, - displaynext=>$displaynext, - displayprev=>$displayprev, - nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count), - prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0) - ); + push @loop_orders, \%line; } $template->param( @@ -333,12 +289,10 @@ $template->param( booksellerid => $bookseller->{id}, countreceived => $countlines, loop_received => \@loop_received, - booksellerid => $booksellerid, loop_orders => \@loop_orders, book_foot_loop => \@book_foot_loop, totalprice => sprintf($cfstr, $totalprice), totalquantity => $totalquantity, - resultsperpage => $resultsperpage, (uc(C4::Context->preference("marcflavour"))) => 1, total_quantity => $total_quantity, total_gste => sprintf( "%.2f", $total_gste ),