X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=acqui%2Fparcels.pl;h=37a0023b18843baa6d1334a8d90de05bae644033;hb=782e3251c043d3f3671e1eeff7b195939afd5db2;hp=4f2849d43f8862ef8e8873dd459584686775a513;hpb=a8c5497b8da7de25b7c4787ee5540e4e1b48704d;p=koha_fer diff --git a/acqui/parcels.pl b/acqui/parcels.pl index 4f2849d43f..37a0023b18 100755 --- a/acqui/parcels.pl +++ b/acqui/parcels.pl @@ -79,7 +79,7 @@ use C4::Budgets; my $input = CGI->new; my $booksellerid = $input->param('booksellerid'); -my $order = $input->param('orderby') || 'datereceived desc'; +my $order = $input->param('orderby') || 'shipmentdate desc'; my $startfrom = $input->param('startfrom'); my $code = $input->param('filter'); my $datefrom = $input->param('datefrom'); @@ -98,14 +98,32 @@ our ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( } ); -if($op and $op eq 'new') { - my $invoicenumber = $input->param('invoice'); - my $shipmentdate = $input->param('shipmentdate'); - my $shipmentcost = $input->param('shipmentcost'); - my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid'); - if($shipmentdate) { - $shipmentdate = C4::Dates->new($shipmentdate)->output('iso'); +my $invoicenumber = $input->param('invoice'); +my $shipmentdate = $input->param('shipmentdate'); +my $shipmentcost = $input->param('shipmentcost'); +my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid'); +if($shipmentdate) { + $shipmentdate = C4::Dates->new($shipmentdate)->output('iso'); +} + +if ( $op and $op eq 'new' ) { + if ( C4::Context->preference('AcqWarnOnDuplicateInvoice') ) { + my @invoices = GetInvoices( + supplierid => $booksellerid, + invoicenumber => $invoicenumber, + ); + if ( $#invoices > 0 ) { + $template->{'VARS'}->{'duplicate_invoices'} = \@invoices; + $template->{'VARS'}->{'invoicenumber'} = $invoicenumber; + $template->{'VARS'}->{'shipmentdate'} = $shipmentdate; + $template->{'VARS'}->{'shipmentcost'} = $shipmentcost; + $template->{'VARS'}->{'shipmentcost_budgetid'} = + $shipmentcost_budgetid; + } } + $op = 'confirm' unless $template->{'VARS'}->{'duplicate_invoices'}; +} +if ($op and $op eq 'confirm') { my $invoiceid = AddInvoice( invoicenumber => $invoicenumber, booksellerid => $booksellerid, @@ -175,7 +193,6 @@ $template->param( dateto => $dateto, resultsperpage => $resultsperpage, name => $bookseller->{'name'}, - DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), shipmentdate_today => C4::Dates->new()->output(), booksellerid => $booksellerid, GST => C4::Context->preference('gist'),