|
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 = join ' ', $temp2->subfield($CNsubfield) || q{}, $temp2->subfield($CNsubfield2) || q{}; |
| 157 |
#remove any trailing space incase one subfield is used |
160 |
#remove any trailing space incase one subfield is used |
| 158 |
$value =~ s/^\s+|\s+$//g; |
161 |
$value =~ s/^\s+|\s+$//g; |
| 159 |
} |
162 |
} |
|
Lines 293-299
sub generate_subfield_form {
Link Here
|
| 293 |
}; |
296 |
}; |
| 294 |
} |
297 |
} |
| 295 |
elsif ( |
298 |
elsif ( |
| 296 |
length($value) > 100 |
299 |
( |
|
|
300 |
$value and length($value) > 100 |
| 301 |
) |
| 297 |
or ( |
302 |
or ( |
| 298 |
C4::Context->preference("marcflavour") eq "UNIMARC" |
303 |
C4::Context->preference("marcflavour") eq "UNIMARC" |
| 299 |
and 300 <= $tag && $tag < 400 && $subfieldtag eq 'a' |
304 |
and 300 <= $tag && $tag < 400 && $subfieldtag eq 'a' |
|
Lines 323-329
sub generate_subfield_form {
Link Here
|
| 323 |
my $subfieldsToAllowForRestrictedEditing = C4::Context->preference('SubfieldsToAllowForRestrictedEditing'); |
328 |
my $subfieldsToAllowForRestrictedEditing = C4::Context->preference('SubfieldsToAllowForRestrictedEditing'); |
| 324 |
my $allowAllSubfields = ( |
329 |
my $allowAllSubfields = ( |
| 325 |
not defined $subfieldsToAllowForRestrictedEditing |
330 |
not defined $subfieldsToAllowForRestrictedEditing |
| 326 |
or $subfieldsToAllowForRestrictedEditing == q|| |
331 |
or $subfieldsToAllowForRestrictedEditing eq q|| |
| 327 |
) ? 1 : 0; |
332 |
) ? 1 : 0; |
| 328 |
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEditing); |
333 |
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEditing); |
| 329 |
|
334 |
|
|
Lines 370-376
my $input = new CGI;
Link Here
|
| 370 |
my $error = $input->param('error'); |
375 |
my $error = $input->param('error'); |
| 371 |
my $biblionumber = $input->param('biblionumber'); |
376 |
my $biblionumber = $input->param('biblionumber'); |
| 372 |
my $itemnumber = $input->param('itemnumber'); |
377 |
my $itemnumber = $input->param('itemnumber'); |
| 373 |
my $op = $input->param('op'); |
378 |
my $op = $input->param('op') || q{}; |
| 374 |
my $hostitemnumber = $input->param('hostitemnumber'); |
379 |
my $hostitemnumber = $input->param('hostitemnumber'); |
| 375 |
my $marcflavour = C4::Context->preference("marcflavour"); |
380 |
my $marcflavour = C4::Context->preference("marcflavour"); |
| 376 |
my $searchid = $input->param('searchid'); |
381 |
my $searchid = $input->param('searchid'); |
| 377 |
- |
|
|