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 |
} |
300 |
|
271 |
my $item; |
301 |
my $item; |
272 |
push @{ $item->{tags} }, $tags[0]; |
302 |
push @{ $item->{tags} }, $tags[0]; |
273 |
push @{ $item->{subfields} }, $subfields[0]; |
303 |
push @{ $item->{subfields} }, $subfields[0]; |
Lines 323-330
output_html_with_http_headers $input, $cookie, $template->output;
Link Here
|
323 |
|
353 |
|
324 |
|
354 |
|
325 |
sub import_batches_list { |
355 |
sub import_batches_list { |
326 |
my ($template) = @_; |
356 |
my ($template, $is_order) = @_; |
327 |
my $batches = GetImportBatchRangeDesc(); |
357 |
my $batches = GetImportBatchRangeDesc(undef,undef,$is_order); |
328 |
|
358 |
|
329 |
my @list = (); |
359 |
my @list = (); |
330 |
foreach my $batch (@$batches) { |
360 |
foreach my $batch (@$batches) { |
Lines 419-424
sub import_biblios_list {
Link Here
|
419 |
item_action => $item_action |
449 |
item_action => $item_action |
420 |
); |
450 |
); |
421 |
batch_info($template, $batch); |
451 |
batch_info($template, $batch); |
|
|
452 |
|
453 |
return \@list; |
422 |
} |
454 |
} |
423 |
|
455 |
|
424 |
sub batch_info { |
456 |
sub batch_info { |
Lines 462-469
sub add_matcher_list {
Link Here
|
462 |
$template->param(available_matchers => \@matchers); |
494 |
$template->param(available_matchers => \@matchers); |
463 |
} |
495 |
} |
464 |
|
496 |
|
465 |
sub get_infos_syspref { |
497 |
sub GetMarcFieldsToOrderAsYAML { |
466 |
my ($record, $field_list) = @_; |
|
|
467 |
my $syspref = C4::Context->preference('MarcFieldsToOrder'); |
498 |
my $syspref = C4::Context->preference('MarcFieldsToOrder'); |
468 |
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
499 |
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
469 |
my $yaml = eval { |
500 |
my $yaml = eval { |
Lines 471-478
sub get_infos_syspref {
Link Here
|
471 |
}; |
502 |
}; |
472 |
if ( $@ ) { |
503 |
if ( $@ ) { |
473 |
warn "Unable to parse MarcFieldsToOrder syspref : $@"; |
504 |
warn "Unable to parse MarcFieldsToOrder syspref : $@"; |
474 |
return (); |
505 |
return; |
|
|
506 |
} else { |
507 |
return $yaml; |
475 |
} |
508 |
} |
|
|
509 |
} |
510 |
|
511 |
sub get_infos_syspref { |
512 |
my ($record, $field_list) = @_; |
513 |
|
514 |
my $yaml = GetMarcFieldsToOrderAsYAML; |
515 |
return unless $yaml; |
516 |
|
476 |
my $r; |
517 |
my $r; |
477 |
for my $field_name ( @$field_list ) { |
518 |
for my $field_name ( @$field_list ) { |
478 |
next unless exists $yaml->{$field_name}; |
519 |
next unless exists $yaml->{$field_name}; |