Lines 58-69
my ($template, $loggedinuser, $cookie, $userflags) = get_template_and_user({
Link Here
|
58 |
my $cgiparams = $input->Vars; |
58 |
my $cgiparams = $input->Vars; |
59 |
my $op = $cgiparams->{'op'} || ''; |
59 |
my $op = $cgiparams->{'op'} || ''; |
60 |
my $booksellerid = $input->param('booksellerid'); |
60 |
my $booksellerid = $input->param('booksellerid'); |
|
|
61 |
my $is_order = $input->param('is_order'); |
61 |
my $bookseller = GetBookSellerFromId($booksellerid); |
62 |
my $bookseller = GetBookSellerFromId($booksellerid); |
62 |
my $data; |
63 |
my $data; |
63 |
|
64 |
|
64 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
65 |
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl", |
65 |
booksellerid => $booksellerid, |
66 |
booksellerid => $booksellerid, |
66 |
booksellername => $bookseller->{name}, |
67 |
booksellername => $bookseller->{name}, |
|
|
68 |
is_order => $is_order, |
67 |
); |
69 |
); |
68 |
|
70 |
|
69 |
if ($cgiparams->{'import_batch_id'} && $op eq ""){ |
71 |
if ($cgiparams->{'import_batch_id'} && $op eq ""){ |
Lines 81-87
if (! $cgiparams->{'basketno'}){
Link Here
|
81 |
if ($op eq ""){ |
83 |
if ($op eq ""){ |
82 |
$template->param("basketno" => $cgiparams->{'basketno'}); |
84 |
$template->param("basketno" => $cgiparams->{'basketno'}); |
83 |
#display batches |
85 |
#display batches |
84 |
import_batches_list($template); |
86 |
import_batches_list( $template, $is_order ); |
85 |
# |
87 |
# |
86 |
# 2nd step = display the content of the choosen file |
88 |
# 2nd step = display the content of the choosen file |
87 |
# |
89 |
# |
Lines 268-273
if ($op eq ""){
Link Here
|
268 |
my @serials = $input->param('serial'); |
270 |
my @serials = $input->param('serial'); |
269 |
my @ind_tag = $input->param('ind_tag'); |
271 |
my @ind_tag = $input->param('ind_tag'); |
270 |
my @indicator = $input->param('indicator'); |
272 |
my @indicator = $input->param('indicator'); |
|
|
273 |
|
274 |
if ($is_order) { |
275 |
my ( $notforloan_field, $notforloan_subfield ) = |
276 |
GetMarcFromKohaField('items.notforloan'); |
277 |
push( @tags, $notforloan_field ); |
278 |
push( @subfields, $notforloan_subfield ); |
279 |
push( @field_values, '-1' ); |
280 |
|
281 |
my ( $homebranch_field, $homebranch_subfield ) = |
282 |
GetMarcFromKohaField('items.homebranch'); |
283 |
push( @tags, $homebranch_field ); |
284 |
push( @subfields, $homebranch_subfield ); |
285 |
push( @field_values, C4::Context->userenv->{'branch'} ); |
286 |
|
287 |
my ( $holdingbranch_field, $holdingbranch_subfield ) = |
288 |
GetMarcFromKohaField('items.holdingbranch'); |
289 |
push( @tags, $holdingbranch_field ); |
290 |
push( @subfields, $holdingbranch_subfield ); |
291 |
push( @field_values, C4::Context->userenv->{'branch'} ); |
292 |
|
293 |
my $infos = get_infos_syspref($marcrecord, ['itype']); |
294 |
my ( $itype_field, $itype_subfield ) = |
295 |
GetMarcFromKohaField('items.itype'); |
296 |
push( @tags, $itype_field ); |
297 |
push( @subfields, $itype_subfield ); |
298 |
push( @field_values, $infos->{itype} ); |
299 |
warn "ITYPE: " . $infos->{itype}; |
300 |
} |
301 |
|
271 |
my $item; |
302 |
my $item; |
272 |
push @{ $item->{tags} }, $tags[0]; |
303 |
push @{ $item->{tags} }, $tags[0]; |
273 |
push @{ $item->{subfields} }, $subfields[0]; |
304 |
push @{ $item->{subfields} }, $subfields[0]; |
Lines 347-354
output_html_with_http_headers $input, $cookie, $template->output;
Link Here
|
347 |
|
378 |
|
348 |
|
379 |
|
349 |
sub import_batches_list { |
380 |
sub import_batches_list { |
350 |
my ($template) = @_; |
381 |
my ($template, $is_order) = @_; |
351 |
my $batches = GetImportBatchRangeDesc(); |
382 |
my $batches = GetImportBatchRangeDesc(undef,undef,$is_order); |
352 |
|
383 |
|
353 |
my @list = (); |
384 |
my @list = (); |
354 |
foreach my $batch (@$batches) { |
385 |
foreach my $batch (@$batches) { |
Lines 446-451
sub import_biblios_list {
Link Here
|
446 |
item_action => $item_action |
477 |
item_action => $item_action |
447 |
); |
478 |
); |
448 |
batch_info($template, $batch); |
479 |
batch_info($template, $batch); |
|
|
480 |
|
481 |
return \@list; |
449 |
} |
482 |
} |
450 |
|
483 |
|
451 |
sub batch_info { |
484 |
sub batch_info { |
Lines 489-496
sub add_matcher_list {
Link Here
|
489 |
$template->param(available_matchers => \@matchers); |
522 |
$template->param(available_matchers => \@matchers); |
490 |
} |
523 |
} |
491 |
|
524 |
|
492 |
sub get_infos_syspref { |
525 |
sub GetMarcFieldsToOrderAsYAML { |
493 |
my ($record, $field_list) = @_; |
|
|
494 |
my $syspref = C4::Context->preference('MarcFieldsToOrder'); |
526 |
my $syspref = C4::Context->preference('MarcFieldsToOrder'); |
495 |
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
527 |
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
496 |
my $yaml = eval { |
528 |
my $yaml = eval { |
Lines 498-505
sub get_infos_syspref {
Link Here
|
498 |
}; |
530 |
}; |
499 |
if ( $@ ) { |
531 |
if ( $@ ) { |
500 |
warn "Unable to parse MarcFieldsToOrder syspref : $@"; |
532 |
warn "Unable to parse MarcFieldsToOrder syspref : $@"; |
501 |
return (); |
533 |
return; |
|
|
534 |
} else { |
535 |
return $yaml; |
502 |
} |
536 |
} |
|
|
537 |
} |
538 |
|
539 |
sub get_infos_syspref { |
540 |
my ($record, $field_list) = @_; |
541 |
|
542 |
my $yaml = GetMarcFieldsToOrderAsYAML; |
543 |
return unless $yaml; |
544 |
|
503 |
my $r; |
545 |
my $r; |
504 |
for my $field_name ( @$field_list ) { |
546 |
for my $field_name ( @$field_list ) { |
505 |
my @fields = split /\|/, $yaml->{$field_name}; |
547 |
my @fields = split /\|/, $yaml->{$field_name}; |
Lines 514-516
sub get_infos_syspref {
Link Here
|
514 |
} |
556 |
} |
515 |
return $r; |
557 |
return $r; |
516 |
} |
558 |
} |
|
|
559 |
|