Lines 128-147
sub generate_subfield_form {
Link Here
|
128 |
$subfield_data{repeatable} = $subfieldlib->{repeatable}; |
128 |
$subfield_data{repeatable} = $subfieldlib->{repeatable}; |
129 |
$subfield_data{maxlength} = $subfieldlib->{maxlength}; |
129 |
$subfield_data{maxlength} = $subfieldlib->{maxlength}; |
130 |
|
130 |
|
131 |
$value =~ s/"/"/g; |
|
|
132 |
if ( ! defined( $value ) || $value eq '') { |
131 |
if ( ! defined( $value ) || $value eq '') { |
133 |
$value = $subfieldlib->{defaultvalue}; |
132 |
$value = $subfieldlib->{defaultvalue}; |
134 |
# get today date & replace <<YYYY>>, <<MM>>, <<DD>> if provided in the default value |
133 |
if ( $value ) { |
135 |
my $today_dt = dt_from_string; |
134 |
# get today date & replace <<YYYY>>, <<MM>>, <<DD>> if provided in the default value |
136 |
my $year = $today_dt->strftime('%Y'); |
135 |
my $today_dt = dt_from_string; |
137 |
my $month = $today_dt->strftime('%m'); |
136 |
my $year = $today_dt->strftime('%Y'); |
138 |
my $day = $today_dt->strftime('%d'); |
137 |
my $month = $today_dt->strftime('%m'); |
139 |
$value =~ s/<<YYYY>>/$year/g; |
138 |
my $day = $today_dt->strftime('%d'); |
140 |
$value =~ s/<<MM>>/$month/g; |
139 |
$value =~ s/<<YYYY>>/$year/g; |
141 |
$value =~ s/<<DD>>/$day/g; |
140 |
$value =~ s/<<MM>>/$month/g; |
142 |
# And <<USER>> with surname (?) |
141 |
$value =~ s/<<DD>>/$day/g; |
143 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
142 |
# And <<USER>> with surname (?) |
144 |
$value=~s/<<USER>>/$username/g; |
143 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
|
|
144 |
$value=~s/<<USER>>/$username/g; |
145 |
} |
146 |
} else { |
147 |
$value =~ s/"/"/g; |
145 |
} |
148 |
} |
146 |
|
149 |
|
147 |
$subfield_data{visibility} = "display:none;" if (($subfieldlib->{hidden} > 4) || ($subfieldlib->{hidden} <= -4)); |
150 |
$subfield_data{visibility} = "display:none;" if (($subfieldlib->{hidden} > 4) || ($subfieldlib->{hidden} <= -4)); |
Lines 153-159
sub generate_subfield_form {
Link Here
|
153 |
my $CNsubfield2 = substr($pref_itemcallnumber, 4, 1); |
156 |
my $CNsubfield2 = substr($pref_itemcallnumber, 4, 1); |
154 |
my $temp2 = $temp->field($CNtag); |
157 |
my $temp2 = $temp->field($CNtag); |
155 |
if ($temp2) { |
158 |
if ($temp2) { |
156 |
$value = ($temp2->subfield($CNsubfield)).' '.($temp2->subfield($CNsubfield2)); |
159 |
my $value = q{}; |
|
|
160 |
$value .= $temp2->subfield($CNsubfield) if $temp2->subfield($CNsubfield); |
161 |
$value .= $temp2->subfield($CNsubfield2) if $temp2->subfield($CNsubfield2); |
157 |
#remove any trailing space incase one subfield is used |
162 |
#remove any trailing space incase one subfield is used |
158 |
$value =~ s/^\s+|\s+$//g; |
163 |
$value =~ s/^\s+|\s+$//g; |
159 |
} |
164 |
} |
Lines 293-299
sub generate_subfield_form {
Link Here
|
293 |
}; |
298 |
}; |
294 |
} |
299 |
} |
295 |
elsif ( |
300 |
elsif ( |
296 |
length($value) > 100 |
301 |
( |
|
|
302 |
$value and length($value) > 100 |
303 |
) |
297 |
or ( |
304 |
or ( |
298 |
C4::Context->preference("marcflavour") eq "UNIMARC" |
305 |
C4::Context->preference("marcflavour") eq "UNIMARC" |
299 |
and 300 <= $tag && $tag < 400 && $subfieldtag eq 'a' |
306 |
and 300 <= $tag && $tag < 400 && $subfieldtag eq 'a' |
Lines 323-329
sub generate_subfield_form {
Link Here
|
323 |
my $subfieldsToAllowForRestrictedEditing = C4::Context->preference('SubfieldsToAllowForRestrictedEditing'); |
330 |
my $subfieldsToAllowForRestrictedEditing = C4::Context->preference('SubfieldsToAllowForRestrictedEditing'); |
324 |
my $allowAllSubfields = ( |
331 |
my $allowAllSubfields = ( |
325 |
not defined $subfieldsToAllowForRestrictedEditing |
332 |
not defined $subfieldsToAllowForRestrictedEditing |
326 |
or $subfieldsToAllowForRestrictedEditing == q|| |
333 |
or $subfieldsToAllowForRestrictedEditing ne q|| |
327 |
) ? 1 : 0; |
334 |
) ? 1 : 0; |
328 |
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEditing); |
335 |
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEditing); |
329 |
|
336 |
|
Lines 370-376
my $input = new CGI;
Link Here
|
370 |
my $error = $input->param('error'); |
377 |
my $error = $input->param('error'); |
371 |
my $biblionumber = $input->param('biblionumber'); |
378 |
my $biblionumber = $input->param('biblionumber'); |
372 |
my $itemnumber = $input->param('itemnumber'); |
379 |
my $itemnumber = $input->param('itemnumber'); |
373 |
my $op = $input->param('op'); |
380 |
my $op = $input->param('op') || q{}; |
374 |
my $hostitemnumber = $input->param('hostitemnumber'); |
381 |
my $hostitemnumber = $input->param('hostitemnumber'); |
375 |
my $marcflavour = C4::Context->preference("marcflavour"); |
382 |
my $marcflavour = C4::Context->preference("marcflavour"); |
376 |
my $searchid = $input->param('searchid'); |
383 |
my $searchid = $input->param('searchid'); |