Bugzilla – Attachment 141962 Details for
Bug 30250
Configure when to apply framework defaults when cataloguing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30250: Use ApplyFrameworkDefaults when cataloguing
Bug-30250-Use-ApplyFrameworkDefaults-when-catalogu.patch (text/plain), 5.12 KB, created by
Thibaud Guillot (thibaud_g)
on 2022-10-17 12:21:17 UTC
(
hide
)
Description:
Bug 30250: Use ApplyFrameworkDefaults when cataloguing
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2022-10-17 12:21:17 UTC
Size:
5.12 KB
patch
obsolete
>From ef6bf524a16a4f1f4f22e3ed0208611937a73796 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 9 Mar 2022 01:13:32 +0000 >Subject: [PATCH] Bug 30250: Use ApplyFrameworkDefaults when cataloguing > >This patch adds a system preference ApplyFrameworkDefaults to configure >when to apply framework defaults - when cataloguing a new record, when >editing a record as new (duplicating), or when changing the framework >while editing an existing record. This applies to both bibliographic >records and authority records. > >To test: >1. Update database >2. Go to Administration -> system preferences. Find the >ApplyFrameworkDefaults system preference. Confirm "when cataloguing new >records" is selected by default. >3. Keep the system preference open in one tab, and open the staff client >in another tab. >4. Go to Administration -> bibliographic frameworks. Choose a framework, >edit the subfields for a tag, and give a subfield a default value. For >example, set 500$a for the BOOKS framework to have a default value of >"TEST". This will be Framework A. >5. Ensure you have another framework that does not have the same default >value for a subfield as Framework A. This will be Framework B. >6. Go to Cataloguing. Add a new record using Framework A. Confirm your >subfield has the default value filled. Cancel and do not save the >record. >7. In your System preferences tab, uncheck the option "when cataloguing >new records" and save. No options should now be selected. >8. In our other tab, go to cataloguing, add a new record using Framework >A. Confirm your subfield does NOT have the default value filled. Fill >the required fields, including the subfield that should have a default >value, and Save the record. >9. In your system preferences tab, select all options and save. >10. In your other tab, click Edit, then "Edit as new (duplicate)". >Confirm your subfield has maintained the value from the source record. >Cancel and do not save the record. >11. Edit your original record and delete the value in your subfield that >could be filled with a default value by the framework. Save the record >with no value in the subfield. >12. Click Edit, then "Edit as new (duplicate)". Confirm your subfield >has the default value filled. Framework defaults will only apply to >emplty fields. Save the record. >13. Do a catalogue search and find a record that uses Framework B. >14. If you need to, edit the record to make sure there is nothing in your >subfield that should have a default value if this record were to use >Framework A, and Save. >15. Edit the record. Using the settings dropdown, change the framework >to Framework A. Confirm your subfield has the default value filled. >16. Repeat steps 4 to 12 with authority types and authority records. > >Sponsored-by: Education Services Australia SCIS >--- > authorities/authorities.pl | 13 ++++++++++--- > cataloguing/addbiblio.pl | 12 ++++++++++-- > 2 files changed, 20 insertions(+), 5 deletions(-) > >diff --git a/authorities/authorities.pl b/authorities/authorities.pl >index b465d4bcc0..5531e708a1 100755 >--- a/authorities/authorities.pl >+++ b/authorities/authorities.pl >@@ -112,9 +112,16 @@ sub create_input { > $max_length = 40; > } > >- # if there is no value provided but a default value in parameters, get it >- if ($value eq '') { >- $value = $tagslib->{$tag}->{$subfield}->{defaultvalue} if !$cgi->param('authid'); # only for new records >+ # Apply optional framework default value when it is a new record, >+ # or when editing as new (duplicating a record), >+ # based on the ApplyFrameworkDefaults setting. >+ # Substitute date parts, user name >+ my $applydefaults = C4::Context->preference('ApplyFrameworkDefaults'); >+ if ( $value eq '' && ( >+ ( $applydefaults =~ /new/ && !$cgi->param('authid') ) || >+ ( $applydefaults =~ /duplicate/ && $cgi->param('op') eq 'duplicate' ) >+ ) ) { >+ $value = $tagslib->{$tag}->{$subfield}->{defaultvalue}; > if (!defined $value) { > $value = q{}; > } >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 5896de18f4..4ee4c85596 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -292,9 +292,17 @@ sub create_input { > > my $index_subfield = CreateKey(); # create a specifique key for each subfield > >- # Apply optional framework default value when it is a new record >+ # Apply optional framework default value when it is a new record, >+ # or when editing as new (duplicating a record), >+ # or when changing a record's framework, >+ # based on the ApplyFrameworkDefaults setting. > # Substitute date parts, user name >- if ( $value eq '' && !$cgi->param('biblionumber') ) { >+ my $applydefaults = C4::Context->preference('ApplyFrameworkDefaults'); >+ if ( $value eq '' && ( >+ ( $applydefaults =~ /new/ && !$cgi->param('biblionumber') ) || >+ ( $applydefaults =~ /duplicate/ && $cgi->param('op') eq 'duplicate' ) || >+ ( $applydefaults =~ /changed/ && $cgi->param('changed_framework') ) >+ ) ) { > $value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; > > # get today date & replace <<YYYY>>, <<YY>>, <<MM>>, <<DD>> if provided in the default value >-- >2.25.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 30250
:
131505
|
131506
|
132039
|
132040
|
140238
|
140239
|
140240
|
140241
|
141961
|
141962
|
141963
|
141964
|
141965
|
142024
|
142025
|
142026
|
142027
|
142777
|
142778
|
142779
|
142780