Bugzilla – Attachment 125541 Details for
Bug 29146
Default values from the framework should only be applied at biblio/item creation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29146: Apply framework defaultvalue only to new records
Bug-29146-Apply-framework-defaultvalue-only-to-new.patch (text/plain), 1.84 KB, created by
Marcel de Rooy
on 2021-09-30 13:54:25 UTC
(
hide
)
Description:
Bug 29146: Apply framework defaultvalue only to new records
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-09-30 13:54:25 UTC
Size:
1.84 KB
patch
obsolete
>From 442af6177fd4575a78daabbc9bcd0344f498f7ee Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 30 Sep 2021 13:39:59 +0000 >Subject: [PATCH] Bug 29146: Apply framework defaultvalue only to new records >Content-Type: text/plain; charset=utf-8 > >This applies only to the 'regular' cataloguing editor. >Another report could be opened for the advanced one, >if needed. > >Test plan: >[1] Add a default value to some field X in framework Y. >[2] Open an existing biblio record in that fw. Clear field X. Save. >[3] Reopen the record. The default should not be in field X. >[4] Add a new record in that fw. You should see default value in X. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > cataloguing/addbiblio.pl | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index f1a13bed7b..38d0af78e9 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -287,8 +287,9 @@ sub create_input { > > my $index_subfield = CreateKey(); # create a specifique key for each subfield > >- # if there is no value provided but a default value in parameters, get it >- if ( $value eq '' ) { >+ # Apply optional framework default value when it is a new record >+ # Substitute date parts, user name >+ if ( $value eq '' && !$cgi->param('biblionumber') ) { > $value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; > > # get today date & replace <<YYYY>>, <<YY>>, <<MM>>, <<DD>> if provided in the default value >@@ -304,8 +305,8 @@ sub create_input { > # And <<USER>> with surname (?) > my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); > $value=~s/<<USER>>/$username/g; >- > } >+ > my $dbh = C4::Context->dbh; > > # map '@' as "subfield" label for fixed fields >-- >2.20.1
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 29146
:
125541
|
126981
|
126985
|
126988
|
127041
|
127042
|
127043
|
127578
|
127579
|
127580