Lines 100-106
builds the <input ...> entry for a subfield.
Link Here
|
100 |
=cut |
100 |
=cut |
101 |
|
101 |
|
102 |
sub create_input { |
102 |
sub create_input { |
103 |
my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth, $cgi ) = @_; |
103 |
my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth, $cgi, $heading_tag ) = @_; |
104 |
|
104 |
|
105 |
my $index_subfield = CreateKey(); # create a specific key for each subfield |
105 |
my $index_subfield = CreateKey(); # create a specific key for each subfield |
106 |
|
106 |
|
Lines 162-168
sub create_input {
Link Here
|
162 |
|
162 |
|
163 |
$subfield_data{visibility} = "display:none;" |
163 |
$subfield_data{visibility} = "display:none;" |
164 |
if( $tagslib->{$tag}->{$subfield}->{hidden} and $value ne '' |
164 |
if( $tagslib->{$tag}->{$subfield}->{hidden} and $value ne '' |
165 |
or ($value eq '' and !$tagslib->{$tag}->{$subfield}->{mandatory}) |
165 |
or ( $value eq '' and !$tagslib->{$tag}->{$subfield}->{mandatory} and $tag ne $heading_tag ) |
166 |
); |
166 |
); |
167 |
|
167 |
|
168 |
# it's an authorised field |
168 |
# it's an authorised field |
Lines 322-328
sub GetMandatoryFieldZ3950 {
Link Here
|
322 |
} |
322 |
} |
323 |
|
323 |
|
324 |
sub build_tabs { |
324 |
sub build_tabs { |
325 |
my ( $template, $record, $dbh, $input ) = @_; |
325 |
my ( $template, $record, $dbh, $input, $heading_tag ) = @_; |
326 |
|
326 |
|
327 |
# fill arrays |
327 |
# fill arrays |
328 |
my @loop_data = (); |
328 |
my @loop_data = (); |
Lines 386-392
sub build_tabs {
Link Here
|
386 |
@subfields_data, |
386 |
@subfields_data, |
387 |
&create_input( |
387 |
&create_input( |
388 |
$tag, $subfield, $value, $index_tag, $record, |
388 |
$tag, $subfield, $value, $index_tag, $record, |
389 |
$authorised_values_sth,$input |
389 |
$authorised_values_sth, $input, $heading_tag |
390 |
) |
390 |
) |
391 |
); |
391 |
); |
392 |
} |
392 |
} |
Lines 402-408
sub build_tabs {
Link Here
|
402 |
@subfields_data, |
402 |
@subfields_data, |
403 |
&create_input( |
403 |
&create_input( |
404 |
$tag, $subfield, $value, $index_tag, |
404 |
$tag, $subfield, $value, $index_tag, |
405 |
$record, $authorised_values_sth,$input |
405 |
$record, $authorised_values_sth, $input, $heading_tag |
406 |
) |
406 |
) |
407 |
); |
407 |
); |
408 |
} |
408 |
} |
Lines 420-426
sub build_tabs {
Link Here
|
420 |
@subfields_data, |
420 |
@subfields_data, |
421 |
&create_input( |
421 |
&create_input( |
422 |
$tag, $subfield, '', $index_tag, $record, |
422 |
$tag, $subfield, '', $index_tag, $record, |
423 |
$authorised_values_sth,$input |
423 |
$authorised_values_sth, $input, $heading_tag |
424 |
) |
424 |
) |
425 |
); |
425 |
); |
426 |
} |
426 |
} |
Lines 462-468
sub build_tabs {
Link Here
|
462 |
@subfields_data, |
462 |
@subfields_data, |
463 |
&create_input( |
463 |
&create_input( |
464 |
$tag, $subfield->{subfield}, '', $index_tag, $record, |
464 |
$tag, $subfield->{subfield}, '', $index_tag, $record, |
465 |
$authorised_values_sth,$input |
465 |
$authorised_values_sth, $input, $heading_tag |
466 |
) |
466 |
) |
467 |
); |
467 |
); |
468 |
} |
468 |
} |
Lines 554-559
if(!$authtypecode) {
Link Here
|
554 |
my $authobj = Koha::Authorities->find($authid); |
554 |
my $authobj = Koha::Authorities->find($authid); |
555 |
my $count = $authobj ? $authobj->get_usage_count : 0; |
555 |
my $count = $authobj ? $authobj->get_usage_count : 0; |
556 |
|
556 |
|
|
|
557 |
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } ); |
558 |
my $authtype = $authority_types->find($authtypecode); |
559 |
my $authtypetext = $authtype ? $authtype->authtypetext : q{}; |
560 |
my $heading_tag = $authtype ? $authtype->auth_tag_to_report : q{}; |
561 |
|
557 |
my ($template, $loggedinuser, $cookie) |
562 |
my ($template, $loggedinuser, $cookie) |
558 |
= get_template_and_user({template_name => "authorities/authorities.tt", |
563 |
= get_template_and_user({template_name => "authorities/authorities.tt", |
559 |
query => $input, |
564 |
query => $input, |
Lines 614-620
if ($op eq "add") {
Link Here
|
614 |
exit; |
619 |
exit; |
615 |
} else { |
620 |
} else { |
616 |
# it may be a duplicate, warn the user and do nothing |
621 |
# it may be a duplicate, warn the user and do nothing |
617 |
build_tabs($template, $record, $dbh, $input); |
622 |
build_tabs($template, $record, $dbh, $input, $heading_tag); |
618 |
build_hidden_data; |
623 |
build_hidden_data; |
619 |
$template->param(authid =>$authid, |
624 |
$template->param(authid =>$authid, |
620 |
duplicateauthid => $duplicateauthid, |
625 |
duplicateauthid => $duplicateauthid, |
Lines 639-645
if ($op eq "add") {
Link Here
|
639 |
$record = TransformHtmlToMarc( $input, 0 ); |
644 |
$record = TransformHtmlToMarc( $input, 0 ); |
640 |
} |
645 |
} |
641 |
|
646 |
|
642 |
build_tabs( $template, $record, $dbh, $input ); |
647 |
build_tabs( $template, $record, $dbh, $input, $heading_tag ); |
643 |
build_hidden_data; |
648 |
build_hidden_data; |
644 |
$template->param( |
649 |
$template->param( |
645 |
oldauthtypetagfield => $oldauthtypetagfield, |
650 |
oldauthtypetagfield => $oldauthtypetagfield, |
Lines 651-665
if ($op eq "add") {
Link Here
|
651 |
); |
656 |
); |
652 |
} |
657 |
} |
653 |
|
658 |
|
654 |
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } ); |
|
|
655 |
|
656 |
my $type = $authority_types->find($authtypecode); |
657 |
$template->param( |
659 |
$template->param( |
658 |
authority_types => $authority_types, |
660 |
authority_types => $authority_types, |
659 |
authtypecode => $authtypecode, |
661 |
authtypecode => $authtypecode, |
660 |
authid => $authid, |
662 |
authid => $authid, |
661 |
linkid => $linkid, |
663 |
linkid => $linkid, |
662 |
authtypetext => $type ? $type->authtypetext : "", |
664 |
authtypetext => $authtypetext, |
663 |
hide_marc => C4::Context->preference('hide_marc'), |
665 |
hide_marc => C4::Context->preference('hide_marc'), |
664 |
); |
666 |
); |
665 |
output_html_with_http_headers $input, $cookie, $template->output; |
667 |
output_html_with_http_headers $input, $cookie, $template->output; |
666 |
- |
|
|