Bug 34993

Summary: Framework doesn't load defaults in existing records or duplicate as new
Product: Koha Reporter: Lauren Denny <lauren_denny>
Component: CatalogingAssignee: Emily Lamancusa <emily.lamancusa>
Status: Pushed to oldstable --- QA Contact: Katrin Fischer <katrin.fischer>
Severity: major    
Priority: P5 - low CC: andrewfh, bugzilla, david, emily.lamancusa, fridolin.somers, koha, lisette.scheer, lucas, m.de.rooy, patrick.robitaille
Version: MainKeywords: regression
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.06,22.11.12
Bug Depends on: 30250, 32484    
Bug Blocks:    
Attachments: Bug 34993: Pass context parameters to generate_subfield_form
Bug 34993: Pass context parameters to generate_subfield_form
Bug 34993: Pass context parameters to generate_subfield_form
Bug 34993: (QA follow-up) Perltidy

Description Lauren Denny 2023-10-05 17:51:33 UTC
The system preference, ApplyFrameworkDefaults no longer works as expected on versions of 22.11 after 22.11.09.  When 'Select All' is checked the ability to load the framework in 'existing records' and 'editing as new (duplicate)' no longer loads the text from the framework into the record.

Koha still works as expected with creating new records and importing with Z39.50. 

The system preference connected with Frameworks still works on 22.05.15 but doesn't work on 22.11.09 or 22.11.10.  Something happened in between 22.11.07 or 22.11.08 and 22.11.09.  

This issue was connected to Bug 30250 - Configure when to apply framework defaults when cataloguing which provided this feature in earlier updates of 22.05 & 22.11.
Comment 1 Andrew Fuerste-Henry 2023-10-10 16:20:04 UTC
I can confirm that when I set ApplyFrameworkDefaults to apply defaults in all situations, I do not get default values applied either when duplicating an existing record in that framework or when creating a new record in that framework via z39.50.
Comment 2 Andrew Fuerste-Henry 2023-10-10 16:21:01 UTC
(In reply to Andrew Fuerste-Henry from comment #1)
> I can confirm that when I set ApplyFrameworkDefaults to apply defaults in
> all situations, I do not get default values applied either when duplicating
> an existing record in that framework or when creating a new record in that
> framework via z39.50.

This was on 22.11.09.000.
Comment 3 Emily Lamancusa 2023-10-12 15:43:03 UTC
Confirmed in master as well.

A git bisect indicates this is likely a side effect of bug 32484 - Enable framework plugins when UseACQFrameworkForBiblioRecords is set. I don't have time to drill down further into debugging this at the moment, but if someone else does, hopefully this will be helpful.
Comment 4 David Nind 2023-10-18 05:33:47 UTC
I've increased the importance to major - mainly as it is a regression, as well as the discussion at the koha-US conference and koha-US cataloguing SIG.
Comment 5 Katrin Fischer 2023-10-29 09:40:28 UTC
*** Bug 33688 has been marked as a duplicate of this bug. ***
Comment 6 Katrin Fischer 2023-10-29 09:40:56 UTC
*** Bug 34499 has been marked as a duplicate of this bug. ***
Comment 7 Katrin Fischer 2023-10-29 11:35:19 UTC
*** Bug 34606 has been marked as a duplicate of this bug. ***
Comment 8 Emily Lamancusa 2023-11-02 17:22:49 UTC
Created attachment 158277 [details] [review]
Bug 34993: Pass context parameters to generate_subfield_form

Pass necessary parameters from the UI to ensure that the basic
MARC editor can correctly identify when a framework is changed,
a bib is being duplicated, or a bib is being imported with Z39.50 -
for purposes of filling in default values according to the settings
of ApplyFrameworkDefaults.

To test:
1. Set the system preference ApplyFrameworkDefaults - Select All
2. Create or edit a MARC bibliographic framework with a default value in
   one of the fields (such as 500$a)
3. Go to the Cataloguing module and create a new record using the
   framework from step 2
   --> Confirm that the default value is filled in
4. Search for an existing bib record
5. Click Edit > Edit record to open the basic editor
6. If the field from step 2 already has data, clear it
7. Switch the framework to the framework from step 2
   --> Confirm that the default value is filled in
8. Clear the field again, and save the edit
9. Click Edit > Edit as new (duplicate)
   --> Confirm that the default value is filled in
10. Go to the cataloguing module and do a Z39.50 search
11. Find a record that does not have a value for the subfield from step 2
12. Import the record using the framework from step 2
    --> Confirm that the default value is filled in
Comment 9 Lucas Gass 2023-11-02 21:06:55 UTC
Created attachment 158287 [details] [review]
Bug 34993: Pass context parameters to generate_subfield_form

Pass necessary parameters from the UI to ensure that the basic
MARC editor can correctly identify when a framework is changed,
a bib is being duplicated, or a bib is being imported with Z39.50 -
for purposes of filling in default values according to the settings
of ApplyFrameworkDefaults.

To test:
1. Set the system preference ApplyFrameworkDefaults - Select All
2. Create or edit a MARC bibliographic framework with a default value in
   one of the fields (such as 500$a)
3. Go to the Cataloguing module and create a new record using the
   framework from step 2
   --> Confirm that the default value is filled in
4. Search for an existing bib record
5. Click Edit > Edit record to open the basic editor
6. If the field from step 2 already has data, clear it
7. Switch the framework to the framework from step 2
   --> Confirm that the default value is filled in
8. Clear the field again, and save the edit
9. Click Edit > Edit as new (duplicate)
   --> Confirm that the default value is filled in
10. Go to the cataloguing module and do a Z39.50 search
11. Find a record that does not have a value for the subfield from step 2
12. Import the record using the framework from step 2
    --> Confirm that the default value is filled in

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 10 Katrin Fischer 2023-11-05 11:46:38 UTC
Please remember to run QA tests and perltidy :)
Comment 11 Katrin Fischer 2023-11-05 11:58:27 UTC
Created attachment 158460 [details] [review]
Bug 34993: Pass context parameters to generate_subfield_form

Pass necessary parameters from the UI to ensure that the basic
MARC editor can correctly identify when a framework is changed,
a bib is being duplicated, or a bib is being imported with Z39.50 -
for purposes of filling in default values according to the settings
of ApplyFrameworkDefaults.

To test:
1. Set the system preference ApplyFrameworkDefaults - Select All
2. Create or edit a MARC bibliographic framework with a default value in
   one of the fields (such as 500$a)
3. Go to the Cataloguing module and create a new record using the
   framework from step 2
   --> Confirm that the default value is filled in
4. Search for an existing bib record
5. Click Edit > Edit record to open the basic editor
6. If the field from step 2 already has data, clear it
7. Switch the framework to the framework from step 2
   --> Confirm that the default value is filled in
8. Clear the field again, and save the edit
9. Click Edit > Edit as new (duplicate)
   --> Confirm that the default value is filled in
10. Go to the cataloguing module and do a Z39.50 search
11. Find a record that does not have a value for the subfield from step 2
12. Import the record using the framework from step 2
    --> Confirm that the default value is filled in

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2023-11-05 11:58:31 UTC
Created attachment 158461 [details] [review]
Bug 34993: (QA follow-up) Perltidy

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2023-11-05 11:58:44 UTC
Thanks a lot Emily for fixing this one!
Comment 14 Tomás Cohen Arazi 2023-11-06 11:39:33 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 15 Phil Ringnalda 2023-11-08 16:36:19 UTC
*** Bug 35289 has been marked as a duplicate of this bug. ***
Comment 16 Lauren Denny 2023-11-08 16:49:26 UTC
Will it be backported to 22.11 or 23.05?
Comment 17 Katrin Fischer 2023-11-08 21:01:32 UTC
(In reply to Lauren Denny from comment #16)
> Will it be backported to 22.11 or 23.05?

Bugs marked major that are in lower versions usually are backported. But the RMaint always makes the last decision.
Comment 18 Fridolin Somers 2023-11-10 07:31:11 UTC
Pushed to 23.05.x for 23.05.06
Comment 19 Pedro Amorim 2023-11-14 14:50:12 UTC
Nice work everyone!

Pushed to 22.11.x for next release