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

(-)a/C4/Acquisition.pm (-2 / +7 lines)
Lines 3258-3273 sub NotifyOrderUsers { Link Here
3258
3258
3259
=head3 FillWithDefaultValues
3259
=head3 FillWithDefaultValues
3260
3260
3261
FillWithDefaultValues( $marc_record );
3261
FillWithDefaultValues( $marc_record, $params );
3262
3262
3263
This will update the record with default value defined in the ACQ framework.
3263
This will update the record with default value defined in the ACQ framework.
3264
For all existing fields, if a default value exists and there are no subfield, it will be created.
3264
For all existing fields, if a default value exists and there are no subfield, it will be created.
3265
If the field does not exist, it will be created too.
3265
If the field does not exist, it will be created too.
3266
3266
3267
If the parameter only_mandatory => 1 is passed via $params, only the mandatory
3268
defaults are being applied to the record.
3269
3267
=cut
3270
=cut
3268
3271
3269
sub FillWithDefaultValues {
3272
sub FillWithDefaultValues {
3270
    my ($record) = @_;
3273
    my ( $record, $params ) = @_;
3274
    my $mandatory = $params->{only_mandatory};
3271
    my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
3275
    my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
3272
    if ($tagslib) {
3276
    if ($tagslib) {
3273
        my ($itemfield) =
3277
        my ($itemfield) =
Lines 3277-3282 sub FillWithDefaultValues { Link Here
3277
            next if $tag == $itemfield;
3281
            next if $tag == $itemfield;
3278
            for my $subfield ( sort keys %{ $tagslib->{$tag} } ) {
3282
            for my $subfield ( sort keys %{ $tagslib->{$tag} } ) {
3279
                next if IsMarcStructureInternal($tagslib->{$tag}{$subfield});
3283
                next if IsMarcStructureInternal($tagslib->{$tag}{$subfield});
3284
                next if $mandatory && !$tagslib->{$tag}{$subfield}{mandatory};
3280
                my $defaultvalue = $tagslib->{$tag}{$subfield}{defaultvalue};
3285
                my $defaultvalue = $tagslib->{$tag}{$subfield}{defaultvalue};
3281
                if ( defined $defaultvalue and $defaultvalue ne '' ) {
3286
                if ( defined $defaultvalue and $defaultvalue ne '' ) {
3282
                    my @fields = $record->field($tag);
3287
                    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