Lines 2632-2683
sub PrepareItemrecordDisplay {
Link Here
|
2632 |
$defaultvalue = $tagslib->{$tag}->{$subfield}->{defaultvalue} unless $defaultvalue; |
2632 |
$defaultvalue = $tagslib->{$tag}->{$subfield}->{defaultvalue} unless $defaultvalue; |
2633 |
if ( !defined $defaultvalue ) { |
2633 |
if ( !defined $defaultvalue ) { |
2634 |
$defaultvalue = q||; |
2634 |
$defaultvalue = q||; |
|
|
2635 |
} else { |
2636 |
$defaultvalue =~ s/"/"/g; |
2635 |
} |
2637 |
} |
2636 |
$defaultvalue =~ s/"/"/g; |
|
|
2637 |
|
2638 |
|
2638 |
# search for itemcallnumber if applicable |
2639 |
# search for itemcallnumber if applicable |
2639 |
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' |
2640 |
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' |
2640 |
&& C4::Context->preference('itemcallnumber') ) { |
2641 |
&& C4::Context->preference('itemcallnumber') ) { |
2641 |
my $CNtag = substr( C4::Context->preference('itemcallnumber'), 0, 3 ); |
2642 |
my $CNtag = substr( C4::Context->preference('itemcallnumber'), 0, 3 ); |
2642 |
my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 ); |
2643 |
my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 ); |
2643 |
if ($itemrecord) { |
2644 |
if ( $itemrecord and my $field = $itemrecord->field($CNtag) ) { |
2644 |
my $temp = $itemrecord->field($CNtag); |
2645 |
$defaultvalue = $field->subfield($CNsubfield); |
2645 |
if ($temp) { |
|
|
2646 |
$defaultvalue = $temp->subfield($CNsubfield); |
2647 |
} |
2648 |
} |
2646 |
} |
2649 |
} |
2647 |
} |
2650 |
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' |
2648 |
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' |
2651 |
&& $defaultvalues |
2649 |
&& $defaultvalues |
2652 |
&& $defaultvalues->{'callnumber'} ) { |
2650 |
&& $defaultvalues->{'callnumber'} ) { |
2653 |
my $temp; |
2651 |
if( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ){ |
2654 |
if ($itemrecord) { |
2652 |
$defaultvalue = $defaultvalues->{callnumber}; |
2655 |
$temp = $itemrecord->field($subfield); |
|
|
2656 |
} |
2657 |
unless ($temp) { |
2658 |
$defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues; |
2659 |
} |
2653 |
} |
2660 |
} |
2654 |
} |
2661 |
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' ) |
2655 |
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' ) |
2662 |
&& $defaultvalues |
2656 |
&& $defaultvalues |
2663 |
&& $defaultvalues->{'branchcode'} ) { |
2657 |
&& $defaultvalues->{'branchcode'} ) { |
2664 |
my $temp; |
2658 |
if ( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ) { |
2665 |
if ($itemrecord) { |
2659 |
$defaultvalue = $defaultvalues->{branchcode}; |
2666 |
$temp = $itemrecord->field($subfield); |
|
|
2667 |
} |
2668 |
unless ($temp) { |
2669 |
$defaultvalue = $defaultvalues->{branchcode} if $defaultvalues; |
2670 |
} |
2660 |
} |
2671 |
} |
2661 |
} |
2672 |
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.location' ) |
2662 |
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.location' ) |
2673 |
&& $defaultvalues |
2663 |
&& $defaultvalues |
2674 |
&& $defaultvalues->{'location'} ) { |
2664 |
&& $defaultvalues->{'location'} ) { |
2675 |
|
2665 |
|
2676 |
my $temp; # make perlcritic happy :) |
2666 |
if ( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ) { |
2677 |
$temp = $itemrecord->field($subfield) if ($itemrecord); |
2667 |
$defaultvalue = $defaultvalues->{location}; |
2678 |
|
|
|
2679 |
unless ($temp) { |
2680 |
$defaultvalue = $defaultvalues->{location} if $defaultvalues; |
2681 |
} |
2668 |
} |
2682 |
} |
2669 |
} |
2683 |
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { |
2670 |
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { |
Lines 2756-2764
sub PrepareItemrecordDisplay {
Link Here
|
2756 |
# opening plugin |
2743 |
# opening plugin |
2757 |
my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; |
2744 |
my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; |
2758 |
if (do $plugin) { |
2745 |
if (do $plugin) { |
2759 |
my $temp; |
2746 |
my $extended_param = plugin_parameters( $dbh, undef, $tagslib, $subfield_data{id}, undef ); |
2760 |
my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); |
2747 |
my ( $function_name, $javascript ) = plugin_javascript( $dbh, undef, $tagslib, $subfield_data{id}, undef ); |
2761 |
my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); |
|
|
2762 |
$subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? |
2748 |
$subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? |
2763 |
$subfield_data{marc_value} = qq[<input tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" |
2749 |
$subfield_data{marc_value} = qq[<input tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" |
2764 |
onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" |
2750 |
onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" |
2765 |
- |
|
|