Bugzilla – Attachment 96511 Details for
Bug 24276
Add functionality to apply defaults from the ACQ framework for mandatory fields when adding records from external sources
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24276: Add FillWithDefaultValues call in neworderempty
Bug-24276-Add-FillWithDefaultValues-call-in-neword.patch (text/plain), 2.69 KB, created by
Marcel de Rooy
on 2019-12-20 08:44:19 UTC
(
hide
)
Description:
Bug 24276: Add FillWithDefaultValues call in neworderempty
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-12-20 08:44:19 UTC
Size:
2.69 KB
patch
obsolete
>From a72fde2d5849a8ca6b7d3594f6f2d45e4745a4d3 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 19 Dec 2019 14:17:39 +0000 >Subject: [PATCH] Bug 24276: Add FillWithDefaultValues call in neworderempty >Content-Type: text/plain; charset=utf-8 > >Apply mandatory defaults from the ACQ framework to records from external >source in Acquisition. > >Test plan: >[1] Add 'BK' as mandatory default in ACQ framework for 942$c. >[2] Add order to basket via external source. >[3] Check 942$c on detail page of new record, MARC tab. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Acquisition.pm | 9 +++++++-- > acqui/neworderempty.pl | 1 + > 2 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index fcd590df79..f851ec098e 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -3245,16 +3245,20 @@ sub NotifyOrderUsers { > > =head3 FillWithDefaultValues > >-FillWithDefaultValues( $marc_record ); >+FillWithDefaultValues( $marc_record, $params ); > > This will update the record with default value defined in the ACQ framework. > For all existing fields, if a default value exists and there are no subfield, it will be created. > If the field does not exist, it will be created too. > >+If the parameter only_mandatory => 1 is passed via $params, only the mandatory >+defaults are being applied to the record. >+ > =cut > > sub FillWithDefaultValues { >- my ($record) = @_; >+ my ( $record, $params ) = @_; >+ my $mandatory = $params->{only_mandatory}; > my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } ); > if ($tagslib) { > my ($itemfield) = >@@ -3264,6 +3268,7 @@ sub FillWithDefaultValues { > next if $tag == $itemfield; > for my $subfield ( sort keys %{ $tagslib->{$tag} } ) { > next if IsMarcStructureInternal($tagslib->{$tag}{$subfield}); >+ next if $mandatory && !$tagslib->{$tag}{$subfield}{mandatory}; > my $defaultvalue = $tagslib->{$tag}{$subfield}{defaultvalue}; > if ( defined $defaultvalue and $defaultvalue ne '' ) { > my @fields = $record->field($tag); >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 3af89ecc5e..984d724f9b 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -163,6 +163,7 @@ if ( $ordernumber eq '' and defined $params->{'breedingid'}){ > exit; > } > #from this point: add a new record >+ C4::Acquisition::FillWithDefaultValues($marcrecord, {only_mandatory => 1}); > my $bibitemnum; > $params->{'frameworkcode'} or $params->{'frameworkcode'} = ""; > ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $params->{'frameworkcode'} ); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24276
:
96507
|
96508
|
96509
|
96510
|
96511
|
96512
|
96513
|
100376
|
100377
|
100378
|
101437
|
101438
|
101439
|
101505
|
101506
|
101507