Lines 3245-3260
sub NotifyOrderUsers {
Link Here
|
3245 |
|
3245 |
|
3246 |
=head3 FillWithDefaultValues |
3246 |
=head3 FillWithDefaultValues |
3247 |
|
3247 |
|
3248 |
FillWithDefaultValues( $marc_record ); |
3248 |
FillWithDefaultValues( $marc_record, $params ); |
3249 |
|
3249 |
|
3250 |
This will update the record with default value defined in the ACQ framework. |
3250 |
This will update the record with default value defined in the ACQ framework. |
3251 |
For all existing fields, if a default value exists and there are no subfield, it will be created. |
3251 |
For all existing fields, if a default value exists and there are no subfield, it will be created. |
3252 |
If the field does not exist, it will be created too. |
3252 |
If the field does not exist, it will be created too. |
3253 |
|
3253 |
|
|
|
3254 |
If the parameter only_mandatory => 1 is passed via $params, only the mandatory |
3255 |
defaults are being applied to the record. |
3256 |
|
3254 |
=cut |
3257 |
=cut |
3255 |
|
3258 |
|
3256 |
sub FillWithDefaultValues { |
3259 |
sub FillWithDefaultValues { |
3257 |
my ($record) = @_; |
3260 |
my ( $record, $params ) = @_; |
|
|
3261 |
my $mandatory = $params->{only_mandatory}; |
3258 |
my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } ); |
3262 |
my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } ); |
3259 |
if ($tagslib) { |
3263 |
if ($tagslib) { |
3260 |
my ($itemfield) = |
3264 |
my ($itemfield) = |
Lines 3264-3269
sub FillWithDefaultValues {
Link Here
|
3264 |
next if $tag == $itemfield; |
3268 |
next if $tag == $itemfield; |
3265 |
for my $subfield ( sort keys %{ $tagslib->{$tag} } ) { |
3269 |
for my $subfield ( sort keys %{ $tagslib->{$tag} } ) { |
3266 |
next if IsMarcStructureInternal($tagslib->{$tag}{$subfield}); |
3270 |
next if IsMarcStructureInternal($tagslib->{$tag}{$subfield}); |
|
|
3271 |
next if $mandatory && !$tagslib->{$tag}{$subfield}{mandatory}; |
3267 |
my $defaultvalue = $tagslib->{$tag}{$subfield}{defaultvalue}; |
3272 |
my $defaultvalue = $tagslib->{$tag}{$subfield}{defaultvalue}; |
3268 |
if ( defined $defaultvalue and $defaultvalue ne '' ) { |
3273 |
if ( defined $defaultvalue and $defaultvalue ne '' ) { |
3269 |
my @fields = $record->field($tag); |
3274 |
my @fields = $record->field($tag); |