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 122-128
if ($op eq ""){
Link Here
|
122 |
"basketno" => $cgiparams->{'basketno'}, |
124 |
"basketno" => $cgiparams->{'basketno'}, |
123 |
loop_currencies => \@loop_currency, |
125 |
loop_currencies => \@loop_currency, |
124 |
); |
126 |
); |
125 |
import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
127 |
my $cells = import_biblios_list($template, $cgiparams->{'import_batch_id'}); |
|
|
128 |
warn Data::Dumper::Dumper( $cells ); |
126 |
if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { |
129 |
if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { |
127 |
# prepare empty item form |
130 |
# prepare empty item form |
128 |
my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' ); |
131 |
my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' ); |
Lines 268-273
if ($op eq ""){
Link Here
|
268 |
my @serials = $input->param('serial'); |
271 |
my @serials = $input->param('serial'); |
269 |
my @ind_tag = $input->param('ind_tag'); |
272 |
my @ind_tag = $input->param('ind_tag'); |
270 |
my @indicator = $input->param('indicator'); |
273 |
my @indicator = $input->param('indicator'); |
|
|
274 |
|
275 |
if ($is_order) { |
276 |
my ( $notforloan_field, $notforloan_subfield ) = |
277 |
GetMarcFromKohaField('items.notforloan'); |
278 |
push( @tags, $notforloan_field ); |
279 |
push( @subfields, $notforloan_subfield ); |
280 |
push( @field_values, '-1' ); |
281 |
|
282 |
my ( $homebranch_field, $homebranch_subfield ) = |
283 |
GetMarcFromKohaField('items.homebranch'); |
284 |
push( @tags, $homebranch_field ); |
285 |
push( @subfields, $homebranch_subfield ); |
286 |
push( @field_values, C4::Context->userenv->{'branch'} ); |
287 |
|
288 |
my ( $holdingbranch_field, $holdingbranch_subfield ) = |
289 |
GetMarcFromKohaField('items.holdingbranch'); |
290 |
push( @tags, $holdingbranch_field ); |
291 |
push( @subfields, $holdingbranch_subfield ); |
292 |
push( @field_values, C4::Context->userenv->{'branch'} ); |
293 |
|
294 |
my $infos = get_infos_syspref($marcrecord, ['itype']); |
295 |
my ( $itype_field, $itype_subfield ) = |
296 |
GetMarcFromKohaField('items.itype'); |
297 |
push( @tags, $itype_field ); |
298 |
push( @subfields, $itype_subfield ); |
299 |
push( @field_values, $infos->{itype} ); |
300 |
warn "ITYPE: " . $infos->{itype}; |
301 |
} |
302 |
|
271 |
my $item; |
303 |
my $item; |
272 |
push @{ $item->{tags} }, $tags[0]; |
304 |
push @{ $item->{tags} }, $tags[0]; |
273 |
push @{ $item->{subfields} }, $subfields[0]; |
305 |
push @{ $item->{subfields} }, $subfields[0]; |
Lines 347-354
output_html_with_http_headers $input, $cookie, $template->output;
Link Here
|
347 |
|
379 |
|
348 |
|
380 |
|
349 |
sub import_batches_list { |
381 |
sub import_batches_list { |
350 |
my ($template) = @_; |
382 |
my ($template, $is_order) = @_; |
351 |
my $batches = GetImportBatchRangeDesc(); |
383 |
my $batches = GetImportBatchRangeDesc(undef,undef,$is_order); |
352 |
|
384 |
|
353 |
my @list = (); |
385 |
my @list = (); |
354 |
foreach my $batch (@$batches) { |
386 |
foreach my $batch (@$batches) { |
Lines 446-451
sub import_biblios_list {
Link Here
|
446 |
item_action => $item_action |
478 |
item_action => $item_action |
447 |
); |
479 |
); |
448 |
batch_info($template, $batch); |
480 |
batch_info($template, $batch); |
|
|
481 |
|
482 |
return \@list; |
449 |
} |
483 |
} |
450 |
|
484 |
|
451 |
sub batch_info { |
485 |
sub batch_info { |
Lines 489-496
sub add_matcher_list {
Link Here
|
489 |
$template->param(available_matchers => \@matchers); |
523 |
$template->param(available_matchers => \@matchers); |
490 |
} |
524 |
} |
491 |
|
525 |
|
492 |
sub get_infos_syspref { |
526 |
sub GetMarcFieldsToOrderAsYAML { |
493 |
my ($record, $field_list) = @_; |
|
|
494 |
my $syspref = C4::Context->preference('MarcFieldsToOrder'); |
527 |
my $syspref = C4::Context->preference('MarcFieldsToOrder'); |
495 |
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
528 |
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
496 |
my $yaml = eval { |
529 |
my $yaml = eval { |
Lines 498-505
sub get_infos_syspref {
Link Here
|
498 |
}; |
531 |
}; |
499 |
if ( $@ ) { |
532 |
if ( $@ ) { |
500 |
warn "Unable to parse MarcFieldsToOrder syspref : $@"; |
533 |
warn "Unable to parse MarcFieldsToOrder syspref : $@"; |
501 |
return (); |
534 |
return; |
|
|
535 |
} else { |
536 |
return $yaml; |
502 |
} |
537 |
} |
|
|
538 |
} |
539 |
|
540 |
sub get_infos_syspref { |
541 |
my ($record, $field_list) = @_; |
542 |
|
543 |
my $yaml = GetMarcFieldsToOrderAsYAML; |
544 |
return unless $yaml; |
545 |
|
503 |
my $r; |
546 |
my $r; |
504 |
for my $field_name ( @$field_list ) { |
547 |
for my $field_name ( @$field_list ) { |
505 |
my @fields = split /\|/, $yaml->{$field_name}; |
548 |
my @fields = split /\|/, $yaml->{$field_name}; |
Lines 514-516
sub get_infos_syspref {
Link Here
|
514 |
} |
557 |
} |
515 |
return $r; |
558 |
return $r; |
516 |
} |
559 |
} |
|
|
560 |
|