Description
Aleisha Amohia
2022-03-08 21:27:32 UTC
I feel like it gets complicated with the defaults :( If the person cataloging the original record decided on not using the defaults (empty or set to a different value), I feel like we would not want to add them back in. I'd expect an exact copy of the existing record using the feature, but this would mean that there are changes I can't control and might have to undo again. It probably all depends on the use cases (what kind of defaults, why you are copying the record etc.) and both views are valid. Maybe we could get some more cataloguers to weigh in? Sounds like worth sysprefing then :) as this feature is a key process for our cataloguers. I can syspref the bit I'm working on. Created attachment 131505 [details] [review] 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 15 with authority types and authority records. Sponsored-by: Education Services Australia SCIS Created attachment 131506 [details] [review] Bug 30250: Add ApplyFrameworkDefaults system preference (cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230) (In reply to Aleisha Amohia from comment #2) > Sounds like worth sysprefing then :) as this feature is a key process for > our cataloguers. I can syspref the bit I'm working on. Sounds like a good compromise. The default should be new, I guess. The third option sounds interesting: changed. Would you clear the fields that contain the framework default of fw A when switching to fw B ? (In reply to Marcel de Rooy from comment #5) > (In reply to Aleisha Amohia from comment #2) > > Sounds like worth sysprefing then :) as this feature is a key process for > > our cataloguers. I can syspref the bit I'm working on. > > Sounds like a good compromise. The default should be new, I guess. > The third option sounds interesting: changed. Would you clear the fields > that contain the framework default of fw A when switching to fw B ? Yes, the patch I wrote has 'new' selected by default. No, the feature only fills framework defaults when if the fields are empty. This should be the same behaviour as behaviour. I'm essentially adding configuration for behaviour that used to exist. Sorry, the same behaviour as *before Created attachment 132039 [details] [review] Bug 30250: Use ApplyFrameworkDefaults when importing a record This patch adds the case of importing a record to the ApplyFrameworkDefaults options. To test: 1. Update database 2. Confirm the ApplyFrameworkDefaults system preference now has the 'when importing a record' option. Do not select it. 3. Go to Cataloguing. Import a record from z39.50, or import to an existing record. 4. Confirm framework defaults are not applied. 5. Go back to the system preference and check the 'when importing a record' option. 6. Repeat step 3. This time framework defaults should be applied. Only fields that are empty in the imported record will be replaced by framework defaults. Sponsored-by: Catalyst IT Created attachment 132040 [details] [review] Bug 30250: Use ApplyFrameworkDefaults when importing a record This patch adds the case of importing a record to the ApplyFrameworkDefaults options. To test: 1. Update database 2. Confirm the ApplyFrameworkDefaults system preference now has the 'when importing a record' option. Do not select it. 3. Go to Cataloguing. Import a record from z39.50, or import to an existing record. 4. Confirm framework defaults are not applied. 5. Go back to the system preference and check the 'when importing a record' option. 6. Repeat step 3. This time framework defaults should be applied. Only fields that are empty in the imported record will be replaced by framework defaults. 7. Repeat for authorities. Sponsored-by: Catalyst IT Will this development affect this scenario? I have an existing record in Koha, and a framework that says 942$c should have a default value of "BK". Then I choose to "Replace record via Z39.50/SRU". - On 20.11.09 the incoming record gets the default 942$c = BK - On 21.11.06 and master it does not get 942$c = BK Hi Aleisha! I'm trying to test this using a sandbox. I was able to get the original behaviour (behaviour without the patch) and now I'm playing with the different options of the system preference. I'm at step 7 of the first test plan. When I uncheck the option so that no options are selected and save, I have a message saying 'Nothing to save'. I do have the message '(modified)' next to the pref name, but I am unable to change the pref to no options. I can save without problem when I check at least one option. I will continue the other steps, but I will not be able to sign off because I can't test without options... Thanks! Caroline Still in the first test plan, I'm at step 16 (Repeat steps 4 to 15 with authority types and authority records). I think that should be Repeat steps 4-12 as steps 13-15 deal with changing the framework, but this is not a possibility in authority records (unless I don't see it? But it wouldn't be logical...) I'm in the second test plan, step 4, I unchecked "when importing a record", but my Z39.50 record had the framework default in it. I was wondering if "when importing a record" also works with the record file staging/importing tool or if it only works with Z39.50? Since I was unable to test that patch with Z39.50, I didn't try with the staging/importing tool. If it's only Z39.50, it should say so in the syspref, and add an option for when importing a file. If it's both, I will try to test that too when I am able. Thanks! Caroline (Sorry for spamming, I'm done now... :) ) Would automatic imports such as from OCLC or GOBI be configurable as well, either as part of 'imports' generally or as a separate option? (Asked with apologies for not knowing the code behind each process.) Currently, it appears that framework defaults are behaving differently for them than they are with z39.50 imports, and I'm hearing from libraries who would still want the option to apply those defaults for OCLC (etc.) records they bring in. (In reply to Caroline Cyr La Rose from comment #11) > Hi Aleisha! > > I'm trying to test this using a sandbox. I was able to get the original > behaviour (behaviour without the patch) and now I'm playing with the > different options of the system preference. > > I'm at step 7 of the first test plan. When I uncheck the option so that no > options are selected and save, I have a message saying 'Nothing to save'. I > do have the message '(modified)' next to the pref name, but I am unable to > change the pref to no options. I can save without problem when I check at > least one option. > > I will continue the other steps, but I will not be able to sign off because > I can't test without options... > > Thanks! > > Caroline I don't think that this should be a blocker as the behaviour exists prior to this patch. I've reported it here https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31524 but please test around it. (In reply to Magnus Enger from comment #10) > Will this development affect this scenario? > > I have an existing record in Koha, and a framework that says 942$c should > have a default value of "BK". Then I choose to "Replace record via > Z39.50/SRU". > > - On 20.11.09 the incoming record gets the default 942$c = BK > - On 21.11.06 and master it does not get 942$c = BK Yes, with this enhancement if ApplyFrameworkDefaults is set to 'when importing a record', the incoming record will have the default value of "BK" in 942$c, UNLESS there is already a value in the incoming record. (In reply to Caroline Cyr La Rose from comment #14) > I was wondering if "when importing a record" also works with the record file > staging/importing tool or if it only works with Z39.50? Since I was unable > to test that patch with Z39.50, I didn't try with the staging/importing tool. > > If it's only Z39.50, it should say so in the syspref, and add an option for > when importing a file. > > If it's both, I will try to test that too when I am able. > > Thanks! > > Caroline > > (Sorry for spamming, I'm done now... :) ) (In reply to Sara Brown from comment #15) > Would automatic imports such as from OCLC or GOBI be configurable as well, > either as part of 'imports' generally or as a separate option? (Asked with > apologies for not knowing the code behind each process.) Currently, it > appears that framework defaults are behaving differently for them than they > are with z39.50 imports, and I'm hearing from libraries who would still want > the option to apply those defaults for OCLC (etc.) records they bring in. I think this only works at the moment for z39.50. We could look at adding an option for importing a file once it's staged at a later date, but I would really like to get this through as it is so we can work on it later. It has already been scope creeped a bit. I will amend the syspref to be clearer. Created attachment 140238 [details] [review] 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 Created attachment 140239 [details] [review] Bug 30250: Add ApplyFrameworkDefaults system preference (cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230) Created attachment 140240 [details] [review] Bug 30250: Use ApplyFrameworkDefaults when importing a record This patch adds the case of importing a record to the ApplyFrameworkDefaults options. To test: 1. Update database 2. Confirm the ApplyFrameworkDefaults system preference now has the 'when importing a record via z39.50' option. Do not select it. 3. Go to Cataloguing. Import a record from z39.50, or replace an existing record. 4. Confirm framework defaults are not applied. 5. Go back to the system preference and check the 'when importing a record via z39.50' option. 6. Repeat step 3. This time framework defaults should be applied. Only fields that are empty in the imported record will be replaced by framework defaults. 7. Repeat for authorities. Sponsored-by: Catalyst IT Created attachment 140241 [details] [review] Bug 30250: (follow-up) Clarify syspref wording around importing Patch no longer applies 8-(... Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 30250: Use ApplyFrameworkDefaults when cataloguing Applying: Bug 30250: Add ApplyFrameworkDefaults system preference Using index info to reconstruct a base tree... M installer/data/mysql/mandatory/sysprefs.sql M koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref Falling back to patching base and 3-way merge... Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref Auto-merging installer/data/mysql/mandatory/sysprefs.sql error: Failed to merge in the changes. Patch failed at 0001 Bug 30250: Add ApplyFrameworkDefaults system preference Created attachment 141961 [details] [review] 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 Rebased by <thibaud.guillot@biblibre.com> Comment on attachment 140238 [details] [review] Bug 30250: Use ApplyFrameworkDefaults when cataloguing >From e40573b3a3ae02f146906b33ded9494f722f0de5 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 92abe81082..cc7bc62637 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -288,9 +288,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.11.0 Comment on attachment 141961 [details] [review] Bug 30250: Use ApplyFrameworkDefaults when cataloguing >From b8312db900a4a9e7f5a3d25d08d834738d4b75ab 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 Created attachment 141962 [details] [review] 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 Created attachment 141963 [details] [review] Bug 30250: Add ApplyFrameworkDefaults system preference (cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230) Created attachment 141964 [details] [review] Bug 30250: Use ApplyFrameworkDefaults when importing a record This patch adds the case of importing a record to the ApplyFrameworkDefaults options. To test: 1. Update database 2. Confirm the ApplyFrameworkDefaults system preference now has the 'when importing a record via z39.50' option. Do not select it. 3. Go to Cataloguing. Import a record from z39.50, or replace an existing record. 4. Confirm framework defaults are not applied. 5. Go back to the system preference and check the 'when importing a record via z39.50' option. 6. Repeat step 3. This time framework defaults should be applied. Only fields that are empty in the imported record will be replaced by framework defaults. 7. Repeat for authorities. Sponsored-by: Catalyst IT Created attachment 141965 [details] [review] Bug 30250: (follow-up) Clarify syspref wording around importing Rebased sorry for the first try, I missed the first git bz attach command Created attachment 142024 [details] [review] 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 Signed-off-by: David Nind <david@davidnind.com> Created attachment 142025 [details] [review] Bug 30250: Add ApplyFrameworkDefaults system preference (cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230) Signed-off-by: David Nind <david@davidnind.com> Created attachment 142026 [details] [review] Bug 30250: Use ApplyFrameworkDefaults when importing a record This patch adds the case of importing a record to the ApplyFrameworkDefaults options. To test: 1. Update database 2. Confirm the ApplyFrameworkDefaults system preference now has the 'when importing a record via z39.50' option. Do not select it. 3. Go to Cataloguing. Import a record from z39.50, or replace an existing record. 4. Confirm framework defaults are not applied. 5. Go back to the system preference and check the 'when importing a record via z39.50' option. 6. Repeat step 3. This time framework defaults should be applied. Only fields that are empty in the imported record will be replaced by framework defaults. 7. Repeat for authorities. Sponsored-by: Catalyst IT Signed-off-by: David Nind <david@davidnind.com> Created attachment 142027 [details] [review] Bug 30250: (follow-up) Clarify syspref wording around importing Signed-off-by: David Nind <david@davidnind.com> Created attachment 142777 [details] [review] 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 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 142778 [details] [review] Bug 30250: Add ApplyFrameworkDefaults system preference (cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230) Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 142779 [details] [review] Bug 30250: Use ApplyFrameworkDefaults when importing a record This patch adds the case of importing a record to the ApplyFrameworkDefaults options. To test: 1. Update database 2. Confirm the ApplyFrameworkDefaults system preference now has the 'when importing a record via z39.50' option. Do not select it. 3. Go to Cataloguing. Import a record from z39.50, or replace an existing record. 4. Confirm framework defaults are not applied. 5. Go back to the system preference and check the 'when importing a record via z39.50' option. 6. Repeat step 3. This time framework defaults should be applied. Only fields that are empty in the imported record will be replaced by framework defaults. 7. Repeat for authorities. Sponsored-by: Catalyst IT Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 142780 [details] [review] Bug 30250: (follow-up) Clarify syspref wording around importing Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Pushed to master for 22.11. Nice work everyone, thanks! Please backport this to 22.05. Bug 29146 changed behaviors in 21.11 and 22.05, this syspref is required to maintain established workflows. Hi, I work in a consortium with a wide range of cataloging skills; ranging from very, very basic volunteer catalogers to very skilled degreed catalogers. We were using frameworks as a way to allow our basic catalogers to auto-populate information concerning RDA fields related to an item type to help standardize our records. Is there a way to put this in 22.05? We are wanting to upgrade but this 'enhancement' completely changes our workflow. It takes some of the 'power' from the local cataloger and puts it back in an administrator's hand to put in the data. The record modification tool and macro tool in the advanced editor are options that are too complicated for a basic user who doesn't spend much time in koha which describes about half of our users. Is there a way to put this in a release of 22.05 or at least add the system preference to turn it on? I saw that the function is in 22.11 but we are not ready to move to this version due to the interface change. Backported to 22.05.x for upcoming 22.05.10 applied to 21.11.x for 21.11.18 *** Bug 32915 has been marked as a duplicate of this bug. *** Not backported to 21.05.x *** Bug 31298 has been marked as a duplicate of this bug. *** Hi, It seems there is a problem with the default values in the acquisition module as well. When adding a record to a basket with the "from a new (empty) record" option, the default values are not added to the record according to the default grid. Was there work for this problem? currently the ApplyFrameworkDefaults system preference does not fix the problem for the acquisition module. Thanks, Patrick. (In reply to Patrick Robitaille from comment #48) > Hi, > > It seems there is a problem with the default values in the acquisition > module as well. When adding a record to a basket with the "from a new > (empty) record" option, the default values are not added to the record > according to the default grid. > > Was there work for this problem? currently the ApplyFrameworkDefaults system > preference does not fix the problem for the acquisition module. > > Thanks, Patrick. Hi Patrick, can you please open a new bug report for this enhancement so someone can add to ApplyFrameworkDefaults to make it work. Did something happen with the latest release on 22.11.09? The frameworks are no longer populating for existing records even when the option,"when changing the framework while editing the existing record", is selected in the system preference "ApplyFrameworkDefaults". They work as expected with creating new records and importing with Z39.50 but not when editing as new (duplicate) or when changing the framework while editing the existing record. Is there a way to get the system preference "ApplyFrameworkDefaults" to work as expected again? It still works on 22.05.15 but doesn't work on 22.11.09. Something happened in a recent update that caused the problem. I'm not sure if it was on 22.11.08 or 22.11.09. @lauren I'm wondering that too, we were told to test this on release 22.11 and I reported back that it wasn't working. I've had no update on this since and we really need this function here at ATU I created a new bug, Bug 34993 - Framework don't load in existing records or duplicate as new, and linked it to this one. please have a look at https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35288 maybe this helps |