Lines 63-73
my ($template, $loggedinuser, $cookie, $userflags) = get_template_and_user({
Link Here
|
63 |
flagsrequired => { acquisition => 'order_manage' }, |
63 |
flagsrequired => { acquisition => 'order_manage' }, |
64 |
}); |
64 |
}); |
65 |
|
65 |
|
66 |
my $cgiparams = $input->Vars; |
66 |
my $cgiparams = $input->Vars; |
67 |
my $op = $cgiparams->{'op'} || ''; |
67 |
my $op = $cgiparams->{'op'} || ''; |
68 |
my $booksellerid = $input->param('booksellerid'); |
68 |
my $booksellerid = $input->param('booksellerid'); |
69 |
my $allmatch = $input->param('allmatch'); |
69 |
my $allmatch = $input->param('allmatch'); |
70 |
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); |
70 |
my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid); |
|
|
71 |
my $clear_fund = $input->param('clear_fund'); |
71 |
|
72 |
|
72 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
73 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
73 |
booksellerid => $booksellerid, |
74 |
booksellerid => $booksellerid, |
Lines 104-110
if ($op eq ""){
Link Here
|
104 |
bookseller => $bookseller, |
105 |
bookseller => $bookseller, |
105 |
"allmatch" => $allmatch, |
106 |
"allmatch" => $allmatch, |
106 |
); |
107 |
); |
107 |
import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
108 |
import_biblios_list( $template, $cgiparams->{'import_batch_id'}, $clear_fund ); |
108 |
if ( $basket->effective_create_items eq 'ordering' && !$basket->is_standing ) { |
109 |
if ( $basket->effective_create_items eq 'ordering' && !$basket->is_standing ) { |
109 |
# prepare empty item form |
110 |
# prepare empty item form |
110 |
my $cell = PrepareItemrecordDisplay( '', '', undef, 'ACQ' ); |
111 |
my $cell = PrepareItemrecordDisplay( '', '', undef, 'ACQ' ); |
Lines 393-403
if ($op eq ""){
Link Here
|
393 |
exit; |
394 |
exit; |
394 |
} |
395 |
} |
395 |
|
396 |
|
396 |
my $budgets = GetBudgets(); |
397 |
my $budgets = GetBudgets(); |
397 |
my $budget_id = @$budgets[0]->{'budget_id'}; |
398 |
my $budget_id = $clear_fund ? "" : @$budgets[0]->{'budget_id'}; |
|
|
399 |
|
398 |
# build bookfund list |
400 |
# build bookfund list |
399 |
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; |
401 |
my $patron = Koha::Patrons->find($loggedinuser)->unblessed; |
400 |
my $budget = GetBudget($budget_id); |
|
|
401 |
|
402 |
|
402 |
# build budget list |
403 |
# build budget list |
403 |
my %budget_loops; |
404 |
my %budget_loops; |
Lines 461-467
sub import_batches_list {
Link Here
|
461 |
} |
462 |
} |
462 |
|
463 |
|
463 |
sub import_biblios_list { |
464 |
sub import_biblios_list { |
464 |
my ($template, $import_batch_id) = @_; |
465 |
my ( $template, $import_batch_id, $clear_fund ) = @_; |
465 |
my $batch = GetImportBatch($import_batch_id,'staged'); |
466 |
my $batch = GetImportBatch($import_batch_id,'staged'); |
466 |
return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/; |
467 |
return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/; |
467 |
my $import_records = Koha::Import::Records->search({ |
468 |
my $import_records = Koha::Import::Records->search({ |
Lines 508-530
sub import_biblios_list {
Link Here
|
508 |
); |
509 |
); |
509 |
my $marcrecord = $import_record->get_marc_record || die "couldn't translate marc information"; |
510 |
my $marcrecord = $import_record->get_marc_record || die "couldn't translate marc information"; |
510 |
|
511 |
|
511 |
my $infos = get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2','replacementprice']); |
512 |
my $infos = get_infos_syspref( |
512 |
my $price = looks_like_number($infos->{price}) ? $infos->{price} : GetMarcPrice( $marcrecord, C4::Context->preference('marcflavour') ); |
513 |
'MarcFieldsToOrder', $marcrecord, |
|
|
514 |
[ 'price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2', 'replacementprice' ] |
515 |
); |
516 |
my $price = |
517 |
looks_like_number( $infos->{price} ) |
518 |
? $infos->{price} |
519 |
: GetMarcPrice( $marcrecord, C4::Context->preference('marcflavour') ); |
513 |
my $replacementprice = $infos->{replacementprice}; |
520 |
my $replacementprice = $infos->{replacementprice}; |
514 |
my $quantity = $infos->{quantity}; |
521 |
my $quantity = $infos->{quantity}; |
515 |
my $budget_code = $infos->{budget_code}; |
522 |
my $budget_code = $infos->{budget_code}; |
516 |
my $discount = $infos->{discount}; |
523 |
my $discount = $infos->{discount}; |
517 |
my $sort1 = $infos->{sort1}; |
524 |
my $sort1 = $infos->{sort1}; |
518 |
my $sort2 = $infos->{sort2}; |
525 |
my $sort2 = $infos->{sort2}; |
519 |
my $budget_id; |
526 |
my $budget_id = ""; |
520 |
|
527 |
|
521 |
if ($budget_code) { |
528 |
if ( $budget_code and not $clear_fund ) { |
522 |
my $biblio_budget = GetBudgetByCode($budget_code); |
529 |
my $biblio_budget = GetBudgetByCode($budget_code); |
523 |
if ($biblio_budget) { |
530 |
if ($biblio_budget) { |
524 |
$budget_id = $biblio_budget->{budget_id}; |
531 |
$budget_id = $biblio_budget->{budget_id}; |
525 |
} |
532 |
} |
526 |
} |
533 |
} |
527 |
|
534 |
|
|
|
535 |
my %budget_loops; |
536 |
my $budgets_hierarchy = GetBudgetHierarchy; |
537 |
foreach my $r ( @{$budgets_hierarchy} ) { |
538 |
unless ( defined $budget_loops{ $r->{budget_period_id} } ) { |
539 |
$budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description}; |
540 |
$budget_loops{ $r->{budget_period_id} }->{active} = $r->{budget_period_active}; |
541 |
$budget_loops{ $r->{budget_period_id} }->{funds} = []; |
542 |
} |
543 |
push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, { |
544 |
b_id => $r->{budget_id}, |
545 |
b_txt => $r->{budget_name}, |
546 |
b_code => $r->{budget_code}, |
547 |
b_sort1_authcat => $r->{'sort1_authcat'}, |
548 |
b_sort2_authcat => $r->{'sort2_authcat'}, |
549 |
b_active => $r->{budget_period_active}, |
550 |
b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, |
551 |
b_level => $r->{budget_level}, |
552 |
}; |
553 |
} |
554 |
$cellrecord{budget_loop} = \%budget_loops; |
555 |
|
528 |
# Items |
556 |
# Items |
529 |
my @itemlist = (); |
557 |
my @itemlist = (); |
530 |
my $all_items_quantity = 0; |
558 |
my $all_items_quantity = 0; |