X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=acqui%2Fbasket.pl;h=80c633cf56a29316c0fb5668cb6f64ef99051ad7;hb=17de3a6feeed8237108c76ac2bf8e1cfddffc127;hp=09545ee3cc4d1376ec2d4904296b19b55c519f84;hpb=3fe837bc74d110b9b3f378ee0565464d8529e827;p=koha-ffzg.git diff --git a/acqui/basket.pl b/acqui/basket.pl index 09545ee3cc..80c633cf56 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -21,25 +21,22 @@ # along with Koha; if not, see . use Modern::Perl; -use C4::Auth; -use C4::Koha; -use C4::Output; +use C4::Auth qw( get_template_and_user haspermission ); +use C4::Output qw( output_html_with_http_headers output_and_exit ); use CGI qw ( -utf8 ); -use C4::Acquisition; -use C4::Budgets; -use C4::Contract; -use C4::Biblio; -use C4::Items; -use C4::Suggestions; +use C4::Acquisition qw( GetBasket CanUserManageBasket GetBasketAsCSV NewBasket NewBasketgroup ModBasket ReopenBasket ModBasketUsers GetBasketgroup GetBasketgroups GetBasketUsers GetOrders GetOrder get_rounded_price ); +use C4::Budgets qw( GetBudgetHierarchy GetBudget CanUserUseBudget ); +use C4::Contract qw( GetContract ); +use C4::Suggestions qw( GetSuggestion GetSuggestionInfoFromBiblionumber GetSuggestionInfo ); use Koha::Biblios; use Koha::Acquisition::Baskets; use Koha::Acquisition::Booksellers; use Koha::Acquisition::Orders; use Koha::Libraries; -use C4::Letters qw/SendAlerts/; -use Date::Calc qw/Add_Delta_Days/; +use C4::Letters qw( SendAlerts ); +use Date::Calc qw( Add_Delta_Days ); use Koha::Database; -use Koha::EDI qw( create_edi_order get_edifact_ean ); +use Koha::EDI qw( create_edi_order ); use Koha::CsvProfiles; use Koha::Patrons; @@ -130,14 +127,14 @@ if ( $op eq 'delete_confirm' ) { my $delbiblio = $query->param('delbiblio'); my $basket_obj = Koha::Acquisition::Baskets->find($basketno); - my $orders = $basket_obj->orders; + my $orders = $basket_obj->orders->filter_by_current; my @cannotdelbiblios; while ( my $order = $orders->next ) { # cancel the order $order->cancel({ delete_biblio => $delbiblio }); - my @messages = @{ $order->messages }; + my @messages = @{ $order->object_messages }; if ( scalar @messages > 0 ) { @@ -175,7 +172,7 @@ if ( $op eq 'delete_confirm' ) { exit; } elsif ($op eq 'email') { my $err = eval { - SendAlerts( 'orderacquisition', $query->param('basketno'), 'ACQORDER' ); + SendAlerts( 'orderacquisition', scalar $query->param('basketno'), 'ACQORDER' ); }; if ( $@ ) { push @messages, { type => 'error', code => $@ }; @@ -380,6 +377,9 @@ if ( $op eq 'list' ) { last; } + my $basket_obj = Koha::Acquisition::Baskets->find($basketno); + my $edi_order = $basket_obj->edi_order; + $template->param( basketno => $basketno, basket => $basket, @@ -391,6 +391,7 @@ if ( $op eq 'list' ) { basketcontractname => $contract->{contractname}, branches_loop => \@branches_loop, creationdate => $basket->{creationdate}, + edi_order => $edi_order, authorisedby => $basket->{authorisedby}, authorisedbyname => $basket->{authorisedbyname}, users_ids => join(':', @basketusers_ids), @@ -423,8 +424,8 @@ if ( $op eq 'list' ) { unclosable => @orders || @cancelledorders ? $basket->{is_standing} : 1, has_budgets => $has_budgets, duplinbatch => $duplinbatch, - csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }) ], - available_additional_fields => [ Koha::AdditionalFields->search( { tablename => 'aqbasket' } ) ], + csv_profiles => Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }), + available_additional_fields => Koha::AdditionalFields->search( { tablename => 'aqbasket' } ), additional_field_values => { map { $_->field->name => $_->value } Koha::Acquisition::Baskets->find($basketno)->additional_field_values->as_list }, @@ -495,12 +496,13 @@ sub get_order_infos { $line{order_object} = $order; } - my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); $line{suggestionid} = $$suggestion{suggestionid}; $line{surnamesuggestedby} = $$suggestion{surnamesuggestedby}; $line{firstnamesuggestedby} = $$suggestion{firstnamesuggestedby}; + $line{estimated_delivery_date} = $order->{estimated_delivery_date}; + foreach my $key (qw(transferred_from transferred_to)) { if ($line{$key}) { my $order = GetOrder($line{$key});