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

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