|
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 266-271
if ($op eq ""){
Link Here
|
| 266 |
my @serials = $input->param('serial'); |
268 |
my @serials = $input->param('serial'); |
| 267 |
my @ind_tag = $input->param('ind_tag'); |
269 |
my @ind_tag = $input->param('ind_tag'); |
| 268 |
my @indicator = $input->param('indicator'); |
270 |
my @indicator = $input->param('indicator'); |
|
|
271 |
|
| 272 |
if ($is_order) { |
| 273 |
my ( $notforloan_field, $notforloan_subfield ) = |
| 274 |
GetMarcFromKohaField('items.notforloan'); |
| 275 |
push( @tags, $notforloan_field ); |
| 276 |
push( @subfields, $notforloan_subfield ); |
| 277 |
push( @field_values, '-1' ); |
| 278 |
|
| 279 |
my ( $homebranch_field, $homebranch_subfield ) = |
| 280 |
GetMarcFromKohaField('items.homebranch'); |
| 281 |
push( @tags, $homebranch_field ); |
| 282 |
push( @subfields, $homebranch_subfield ); |
| 283 |
push( @field_values, C4::Context->userenv->{'branch'} ); |
| 284 |
|
| 285 |
my ( $holdingbranch_field, $holdingbranch_subfield ) = |
| 286 |
GetMarcFromKohaField('items.holdingbranch'); |
| 287 |
push( @tags, $holdingbranch_field ); |
| 288 |
push( @subfields, $holdingbranch_subfield ); |
| 289 |
push( @field_values, C4::Context->userenv->{'branch'} ); |
| 290 |
|
| 291 |
my $infos = get_infos_syspref($marcrecord, ['itype']); |
| 292 |
my ( $itype_field, $itype_subfield ) = |
| 293 |
GetMarcFromKohaField('items.itype'); |
| 294 |
push( @tags, $itype_field ); |
| 295 |
push( @subfields, $itype_subfield ); |
| 296 |
push( @field_values, $infos->{itype} ); |
| 297 |
warn "ITYPE: " . $infos->{itype}; |
| 298 |
} |
| 299 |
|
| 269 |
my $item; |
300 |
my $item; |
| 270 |
push @{ $item->{tags} }, $tags[0]; |
301 |
push @{ $item->{tags} }, $tags[0]; |
| 271 |
push @{ $item->{subfields} }, $subfields[0]; |
302 |
push @{ $item->{subfields} }, $subfields[0]; |
|
Lines 345-352
output_html_with_http_headers $input, $cookie, $template->output;
Link Here
|
| 345 |
|
376 |
|
| 346 |
|
377 |
|
| 347 |
sub import_batches_list { |
378 |
sub import_batches_list { |
| 348 |
my ($template) = @_; |
379 |
my ($template, $is_order) = @_; |
| 349 |
my $batches = GetImportBatchRangeDesc(); |
380 |
my $batches = GetImportBatchRangeDesc(undef,undef,$is_order); |
| 350 |
|
381 |
|
| 351 |
my @list = (); |
382 |
my @list = (); |
| 352 |
foreach my $batch (@$batches) { |
383 |
foreach my $batch (@$batches) { |
|
Lines 442-447
sub import_biblios_list {
Link Here
|
| 442 |
item_action => $item_action |
473 |
item_action => $item_action |
| 443 |
); |
474 |
); |
| 444 |
batch_info($template, $batch); |
475 |
batch_info($template, $batch); |
|
|
476 |
|
| 477 |
return \@list; |
| 445 |
} |
478 |
} |
| 446 |
|
479 |
|
| 447 |
sub batch_info { |
480 |
sub batch_info { |
|
Lines 485-492
sub add_matcher_list {
Link Here
|
| 485 |
$template->param(available_matchers => \@matchers); |
518 |
$template->param(available_matchers => \@matchers); |
| 486 |
} |
519 |
} |
| 487 |
|
520 |
|
| 488 |
sub get_infos_syspref { |
521 |
sub GetMarcFieldsToOrderAsYAML { |
| 489 |
my ($record, $field_list) = @_; |
|
|
| 490 |
my $syspref = C4::Context->preference('MarcFieldsToOrder'); |
522 |
my $syspref = C4::Context->preference('MarcFieldsToOrder'); |
| 491 |
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
523 |
$syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt |
| 492 |
my $yaml = eval { |
524 |
my $yaml = eval { |
|
Lines 494-501
sub get_infos_syspref {
Link Here
|
| 494 |
}; |
526 |
}; |
| 495 |
if ( $@ ) { |
527 |
if ( $@ ) { |
| 496 |
warn "Unable to parse MarcFieldsToOrder syspref : $@"; |
528 |
warn "Unable to parse MarcFieldsToOrder syspref : $@"; |
| 497 |
return (); |
529 |
return; |
|
|
530 |
} else { |
| 531 |
return $yaml; |
| 498 |
} |
532 |
} |
|
|
533 |
} |
| 534 |
|
| 535 |
sub get_infos_syspref { |
| 536 |
my ($record, $field_list) = @_; |
| 537 |
|
| 538 |
my $yaml = GetMarcFieldsToOrderAsYAML; |
| 539 |
return unless $yaml; |
| 540 |
|
| 499 |
my $r; |
541 |
my $r; |
| 500 |
for my $field_name ( @$field_list ) { |
542 |
for my $field_name ( @$field_list ) { |
| 501 |
next unless exists $yaml->{$field_name}; |
543 |
next unless exists $yaml->{$field_name}; |