View | Details | Raw Unified | Return to bug 24276
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-2 / +7 lines)
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);
(-)a/acqui/neworderempty.pl (-1 / +1 lines)
Lines 163-168 if ( $ordernumber eq '' and defined $params->{'breedingid'}){ Link Here
163
        exit;
163
        exit;
164
    }
164
    }
165
    #from this point: add a new record
165
    #from this point: add a new record
166
    C4::Acquisition::FillWithDefaultValues($marcrecord, {only_mandatory => 1});
166
    my $bibitemnum;
167
    my $bibitemnum;
167
    $params->{'frameworkcode'} or $params->{'frameworkcode'} = "";
168
    $params->{'frameworkcode'} or $params->{'frameworkcode'} = "";
168
    ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $params->{'frameworkcode'} );
169
    ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $params->{'frameworkcode'} );
169
- 

Return to bug 24276