Lines 2645-2696
sub PrepareItemrecordDisplay {
Link Here
|
2645 |
$defaultvalue = $tagslib->{$tag}->{$subfield}->{defaultvalue} unless $defaultvalue; |
2645 |
$defaultvalue = $tagslib->{$tag}->{$subfield}->{defaultvalue} unless $defaultvalue; |
2646 |
if ( !defined $defaultvalue ) { |
2646 |
if ( !defined $defaultvalue ) { |
2647 |
$defaultvalue = q||; |
2647 |
$defaultvalue = q||; |
|
|
2648 |
} else { |
2649 |
$defaultvalue =~ s/"/"/g; |
2648 |
} |
2650 |
} |
2649 |
$defaultvalue =~ s/"/"/g; |
|
|
2650 |
|
2651 |
|
2651 |
# search for itemcallnumber if applicable |
2652 |
# search for itemcallnumber if applicable |
2652 |
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' |
2653 |
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' |
2653 |
&& C4::Context->preference('itemcallnumber') ) { |
2654 |
&& C4::Context->preference('itemcallnumber') ) { |
2654 |
my $CNtag = substr( C4::Context->preference('itemcallnumber'), 0, 3 ); |
2655 |
my $CNtag = substr( C4::Context->preference('itemcallnumber'), 0, 3 ); |
2655 |
my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 ); |
2656 |
my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 ); |
2656 |
if ($itemrecord) { |
2657 |
if ( $itemrecord and my $field = $itemrecord->field($CNtag) ) { |
2657 |
my $temp = $itemrecord->field($CNtag); |
2658 |
$defaultvalue = $field->subfield($CNsubfield); |
2658 |
if ($temp) { |
|
|
2659 |
$defaultvalue = $temp->subfield($CNsubfield); |
2660 |
} |
2661 |
} |
2659 |
} |
2662 |
} |
2660 |
} |
2663 |
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' |
2661 |
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' |
2664 |
&& $defaultvalues |
2662 |
&& $defaultvalues |
2665 |
&& $defaultvalues->{'callnumber'} ) { |
2663 |
&& $defaultvalues->{'callnumber'} ) { |
2666 |
my $temp; |
2664 |
if( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ){ |
2667 |
if ($itemrecord) { |
2665 |
$defaultvalue = $defaultvalues->{callnumber}; |
2668 |
$temp = $itemrecord->field($subfield); |
|
|
2669 |
} |
2670 |
unless ($temp) { |
2671 |
$defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues; |
2672 |
} |
2666 |
} |
2673 |
} |
2667 |
} |
2674 |
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' ) |
2668 |
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' ) |
2675 |
&& $defaultvalues |
2669 |
&& $defaultvalues |
2676 |
&& $defaultvalues->{'branchcode'} ) { |
2670 |
&& $defaultvalues->{'branchcode'} ) { |
2677 |
my $temp; |
2671 |
if ( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ) { |
2678 |
if ($itemrecord) { |
2672 |
$defaultvalue = $defaultvalues->{branchcode}; |
2679 |
$temp = $itemrecord->field($subfield); |
|
|
2680 |
} |
2681 |
unless ($temp) { |
2682 |
$defaultvalue = $defaultvalues->{branchcode} if $defaultvalues; |
2683 |
} |
2673 |
} |
2684 |
} |
2674 |
} |
2685 |
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.location' ) |
2675 |
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.location' ) |
2686 |
&& $defaultvalues |
2676 |
&& $defaultvalues |
2687 |
&& $defaultvalues->{'location'} ) { |
2677 |
&& $defaultvalues->{'location'} ) { |
2688 |
|
2678 |
|
2689 |
my $temp; # make perlcritic happy :) |
2679 |
if ( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ) { |
2690 |
$temp = $itemrecord->field($subfield) if ($itemrecord); |
2680 |
$defaultvalue = $defaultvalues->{location}; |
2691 |
|
|
|
2692 |
unless ($temp) { |
2693 |
$defaultvalue = $defaultvalues->{location} if $defaultvalues; |
2694 |
} |
2681 |
} |
2695 |
} |
2682 |
} |
2696 |
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { |
2683 |
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { |
Lines 2771-2779
sub PrepareItemrecordDisplay {
Link Here
|
2771 |
# opening plugin |
2758 |
# opening plugin |
2772 |
my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; |
2759 |
my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; |
2773 |
if (do $plugin) { |
2760 |
if (do $plugin) { |
2774 |
my $temp; |
2761 |
my $extended_param = plugin_parameters( $dbh, undef, $tagslib, $subfield_data{id}, undef ); |
2775 |
my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); |
2762 |
my ( $function_name, $javascript ) = plugin_javascript( $dbh, undef, $tagslib, $subfield_data{id}, undef ); |
2776 |
my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); |
|
|
2777 |
$subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? |
2763 |
$subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? |
2778 |
$subfield_data{marc_value} = qq[<input tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" |
2764 |
$subfield_data{marc_value} = qq[<input tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" |
2779 |
onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" |
2765 |
onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" |
2780 |
- |
|
|