Bugzilla – Attachment 127578 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.91 KB, created by
Martin Renvoize (ashimema)
on 2021-11-12 11:18:54 UTC
(
hide
)
Description:
Bug 29146: Apply framework defaultvalue only to new records
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-11-12 11:18:54 UTC
Size:
1.91 KB
patch
obsolete
>From b3f7c261d2647ad4c22970e22a8c6a7d3f40542b 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 > >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> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > cataloguing/addbiblio.pl | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 89a68e06f8..090849da4d 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -288,8 +288,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 >@@ -305,8 +306,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