Bug 30250

Summary: Configure when to apply framework defaults when cataloguing
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: CatalogingAssignee: Aleisha Amohia <aleisha>
Status: CLOSED FIXED QA Contact: Kyle M Hall (khall) <kyle>
Severity: normal    
Priority: P5 - low CC: andrew, arthur.suzuki, caroline.cyr-la-rose, cbrannon, david, dch, gveranis, janet.mcgowan, koha, kyle, lauren_denny, lucas, m.de.rooy, magnus, maura.stephens, patrick.robitaille, pierre.genty, pm, sbrown, thibaud.guillot, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32915
Change sponsored?: Sponsored Patch complexity: Medium patch
Documentation contact: Caroline Cyr La Rose Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/669
Text to go in the release notes:
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, or when importing a record. This applies to both bibliographic records and authority records.
Version(s) released in:
22.11.00,22.05.10,21.11.18
Circulation function:
Bug Depends on: 29146    
Bug Blocks: 33670, 31298, 34993    
Attachments: Bug 30250: Use ApplyFrameworkDefaults when cataloguing
Bug 30250: Add ApplyFrameworkDefaults system preference
Bug 30250: Use ApplyFrameworkDefaults when importing a record
Bug 30250: Use ApplyFrameworkDefaults when importing a record
Bug 30250: Use ApplyFrameworkDefaults when cataloguing
Bug 30250: Add ApplyFrameworkDefaults system preference
Bug 30250: Use ApplyFrameworkDefaults when importing a record
Bug 30250: (follow-up) Clarify syspref wording around importing
Bug 30250: Use ApplyFrameworkDefaults when cataloguing
Bug 30250: Use ApplyFrameworkDefaults when cataloguing
Bug 30250: Add ApplyFrameworkDefaults system preference
Bug 30250: Use ApplyFrameworkDefaults when importing a record
Bug 30250: (follow-up) Clarify syspref wording around importing
Bug 30250: Use ApplyFrameworkDefaults when cataloguing
Bug 30250: Add ApplyFrameworkDefaults system preference
Bug 30250: Use ApplyFrameworkDefaults when importing a record
Bug 30250: (follow-up) Clarify syspref wording around importing
Bug 30250: Use ApplyFrameworkDefaults when cataloguing
Bug 30250: Add ApplyFrameworkDefaults system preference
Bug 30250: Use ApplyFrameworkDefaults when importing a record
Bug 30250: (follow-up) Clarify syspref wording around importing

Description Aleisha Amohia 2022-03-08 21:27:32 UTC
Bug 29146 has created a problem for one of our Koha libraries. When they duplicate a record (i.e 'Edit as new') they want empty fields to be filled with framework defaults. Although, due to this fix, they no longer get them. Duplicating records is like creating new records (just with some pre-filled fields), so this must be considered.
Comment 1 Katrin Fischer 2022-03-08 22:46:18 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?
Comment 2 Aleisha Amohia 2022-03-08 22:50:00 UTC
Sounds like worth sysprefing then :) as this feature is a key process for our cataloguers. I can syspref the bit I'm working on.
Comment 3 Aleisha Amohia 2022-03-09 01:39:17 UTC
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
Comment 4 Aleisha Amohia 2022-03-09 01:44:05 UTC
Created attachment 131506 [details] [review]
Bug 30250: Add ApplyFrameworkDefaults system preference

(cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230)
Comment 5 Marcel de Rooy 2022-03-09 12:18:23 UTC
(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 ?
Comment 6 Aleisha Amohia 2022-03-09 19:28:18 UTC
(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.
Comment 7 Aleisha Amohia 2022-03-09 19:28:30 UTC
Sorry, the same behaviour as *before
Comment 8 Aleisha Amohia 2022-03-22 21:45:41 UTC
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
Comment 9 Aleisha Amohia 2022-03-22 21:47:06 UTC
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
Comment 10 Magnus Enger 2022-06-22 13:00:41 UTC
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
Comment 11 Caroline Cyr La Rose 2022-06-30 20:14:40 UTC
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
Comment 12 Caroline Cyr La Rose 2022-06-30 20:29:10 UTC
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...)
Comment 13 Caroline Cyr La Rose 2022-06-30 20:33:06 UTC
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.
Comment 14 Caroline Cyr La Rose 2022-06-30 20:38:42 UTC
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... :) )
Comment 15 Sara Brown 2022-08-18 15:07:02 UTC
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.
Comment 16 Aleisha Amohia 2022-09-07 01:50:18 UTC
(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.
Comment 17 Aleisha Amohia 2022-09-07 02:18:16 UTC
(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.
Comment 18 Aleisha Amohia 2022-09-07 02:34:47 UTC
(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.
Comment 19 Aleisha Amohia 2022-09-07 02:40:26 UTC
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
Comment 20 Aleisha Amohia 2022-09-07 02:40:31 UTC
Created attachment 140239 [details] [review]
Bug 30250: Add ApplyFrameworkDefaults system preference

(cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230)
Comment 21 Aleisha Amohia 2022-09-07 02:40:35 UTC
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
Comment 22 Aleisha Amohia 2022-09-07 02:40:39 UTC
Created attachment 140241 [details] [review]
Bug 30250: (follow-up) Clarify syspref wording around importing
Comment 23 David Nind 2022-09-13 20:21:51 UTC
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
Comment 24 Thibaud Guillot (thibaud_g) 2022-10-17 11:58:21 UTC Comment hidden (obsolete)
Comment 25 Thibaud Guillot (thibaud_g) 2022-10-17 12:00:19 UTC Comment hidden (obsolete)
Comment 26 Thibaud Guillot (thibaud_g) 2022-10-17 12:00:52 UTC Comment hidden (obsolete)
Comment 27 Thibaud Guillot (thibaud_g) 2022-10-17 12:21:17 UTC
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
Comment 28 Thibaud Guillot (thibaud_g) 2022-10-17 12:21:23 UTC
Created attachment 141963 [details] [review]
Bug 30250: Add ApplyFrameworkDefaults system preference

(cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230)
Comment 29 Thibaud Guillot (thibaud_g) 2022-10-17 12:21:30 UTC
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
Comment 30 Thibaud Guillot (thibaud_g) 2022-10-17 12:21:36 UTC
Created attachment 141965 [details] [review]
Bug 30250: (follow-up) Clarify syspref wording around importing
Comment 31 Thibaud Guillot (thibaud_g) 2022-10-17 12:22:58 UTC
Rebased sorry for the first try, I missed the first git bz attach command
Comment 32 David Nind 2022-10-17 20:03:51 UTC
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>
Comment 33 David Nind 2022-10-17 20:03:58 UTC
Created attachment 142025 [details] [review]
Bug 30250: Add ApplyFrameworkDefaults system preference

(cherry picked from commit 684a04deb6ec7e94ca60f5cb38811176fbb9c230)

Signed-off-by: David Nind <david@davidnind.com>
Comment 34 David Nind 2022-10-17 20:04:05 UTC
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>
Comment 35 David Nind 2022-10-17 20:04:12 UTC
Created attachment 142027 [details] [review]
Bug 30250: (follow-up) Clarify syspref wording around importing

Signed-off-by: David Nind <david@davidnind.com>
Comment 36 Kyle M Hall (khall) 2022-10-28 15:19:10 UTC
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>
Comment 37 Kyle M Hall (khall) 2022-10-28 15:20:27 UTC
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>
Comment 38 Kyle M Hall (khall) 2022-10-28 15:20:32 UTC
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>
Comment 39 Kyle M Hall (khall) 2022-10-28 15:20:36 UTC
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>
Comment 40 Tomás Cohen Arazi (tcohen) 2022-11-09 17:39:40 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 41 Andrew Fuerste-Henry 2023-02-14 17:16:54 UTC
Please backport this to 22.05. Bug 29146 changed behaviors in 21.11 and 22.05, this syspref is required to maintain established workflows.
Comment 42 Lauren Denny 2023-02-14 23:36:57 UTC
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.
Comment 43 Lucas Gass (lukeg) 2023-02-15 14:08:35 UTC
Backported to 22.05.x for upcoming 22.05.10
Comment 44 Arthur Suzuki 2023-02-17 12:57:00 UTC
applied to 21.11.x for 21.11.18
Comment 45 Christopher Brannon 2023-02-27 18:05:16 UTC
*** Bug 32915 has been marked as a duplicate of this bug. ***
Comment 46 Wainui Witika-Park 2023-03-15 02:16:28 UTC
Not backported to 21.05.x
Comment 47 Katrin Fischer 2023-04-16 11:02:04 UTC
*** Bug 31298 has been marked as a duplicate of this bug. ***
Comment 48 Patrick Robitaille 2023-05-04 18:10:01 UTC
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.
Comment 49 Aleisha Amohia 2023-05-04 21:02:58 UTC
(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.
Comment 50 Lauren Denny 2023-09-27 18:58:51 UTC
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.
Comment 51 Maura Stephens 2023-09-28 07:22:54 UTC
@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
Comment 52 Lauren Denny 2023-10-05 17:55:40 UTC
I created a new bug, Bug 34993 - Framework don't load in existing records or duplicate as new, and linked it to this one.
Comment 53 Mark Hofstetter 2023-11-09 15:02:38 UTC
please have a look at 

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35288

maybe this helps