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