Bug 35289 - addbiblio.pl calls generate_subfield_form with inconsistent parameters
Summary: addbiblio.pl calls generate_subfield_form with inconsistent parameters
Status: RESOLVED DUPLICATE of bug 34993
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Mark Hofstetter
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 35288
  Show dependency treegraph
 
Reported: 2023-11-08 13:58 UTC by Mark Hofstetter
Modified: 2023-11-08 16:36 UTC (History)
3 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 35289: addbiblio.pl calls generate_subfield_form with inconsistent parameters (3.70 KB, patch)
2023-11-08 14:17 UTC, Mark Hofstetter
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hofstetter 2023-11-08 13:58:45 UTC
in addbiblio.pl
 $biblio_form_builder->generate_subfield_form

is called 4 times(!) three of them are missing (at least) the following 3 paramters

op => scalar $input->param('op'),
changed_framework => scalar $input->param('changed_framework'),
breedingid => scalar $input->param('breedingid'),

this means that "ApplyFrameworkDefaults" (see
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35288
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33669)

only works for tags smaller then 10.

If this is intentionel its done rather weirdly

fix follows
Comment 1 Mark Hofstetter 2023-11-08 14:17:18 UTC
Created attachment 158663 [details] [review]
Bug 35289: addbiblio.pl calls generate_subfield_form with inconsistent parameters

ApplyFrameworkDefaults works only for tags smaller than 10
this seems to be because addbiblio.pl
calls
 $biblio_form_builder->generate_subfield_form
4 times(!) three of them are missing (at least) the following 3 paramters

op => scalar $input->param('op'),
changed_framework => scalar $input->param('changed_framework'),
breedingid => scalar $input->param('breedingid'),

so Koha::UI::Form::Builder::Biblio checks for
      ( $applydefaults =~ /new/ && !$self->{biblionumber} ) ||
      ( $applydefaults =~ /duplicate/ && $op eq 'duplicate' ) ||
      ( $applydefaults =~ /changed/ && $changed_framework ) ||
      ( $applydefaults =~ /imported/ && $breedingid )

and this works only for the "new" case, this patch fixes this error

To test:
1) you need: one record, two frameworks including both of them including a marc field X (tag > 10)
2) record should be in framework A, marcfield X should be empty
3) define a defaultvalue for marcfield X in framework B
4) "edit record", change framework (setting) to framework B
5) marcfield X remains emtpy, which is an error imho
6) Apply patch
7) repeat step 4
8) marcfield X should now have the default value
9) please Sign off

Sponsored-by: Styrian State Library
Co-authored-by: Thomas Klausner <domm@plix.at>
Comment 2 Mark Hofstetter 2023-11-08 14:21:09 UTC
similar testing should be done for the duplicate and import case
Comment 3 Phil Ringnalda 2023-11-08 16:36:19 UTC
Somebody beat you to it.

*** This bug has been marked as a duplicate of bug 34993 ***