Bug 25852: Improve C4::Creators::Lib reliability under plack
This is certainly a major issue that leads to many side-effects. Under plack, the structure of the default values are not handled correctly. Package variables are used to store stuff like the "layout type". They are complex structures (arrays of hashes) and returned without being copied. When the caller (the controller script) retrieve them then modify the returned structures, it actually modifies the package's variables. One of the issue is: Create a new layout The script retrieve a structure with all "selected" flags are set to 0 It select the first one as default (BAR as selected => 1) The user creates the new layout and will selected BIBBAR (for instance) If you then edit this new layout, the script will retrieve the "label_types" and set "selected" for BIBBAR. However BAR is still selected! The UI receives 2 selected and display the first selected one that has the selected option. Test plan: 1. Create a layout type for Barcode/Biblio 2. Choose fields to print and size of font 3. Save 4. Edit existing Layout => Withtout this patch "Barcode" is the preselected option => With this patch applied, the correct "Barcode/Biblio" option is selected Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> (cherry picked from commit0a9d3f17d9) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commite2c9fdb5bd) Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> (cherry picked from commit0471bd6843) Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
parent
cab5e5fd5a
commit
bad82e2a3c
|
|
@ -17,8 +17,8 @@ package C4::Creators::Lib;
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Modern::Perl;
|
||||
use Storable qw(dclone);
|
||||
|
||||
use autouse 'Data::Dumper' => qw(Dumper);
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ This function returns a reference to an array of hashes containing all barcode t
|
|||
=cut
|
||||
|
||||
sub get_barcode_types {
|
||||
return $barcode_types;
|
||||
return dclone $barcode_types;
|
||||
}
|
||||
|
||||
=head2 C4::Creators::Lib::get_label_types()
|
||||
|
|
@ -417,7 +417,7 @@ This function returns a reference to an array of hashes containing all label typ
|
|||
=cut
|
||||
|
||||
sub get_label_types {
|
||||
return $label_types;
|
||||
return dclone $label_types;
|
||||
}
|
||||
|
||||
=head2 C4::Creators::Lib::get_font_types()
|
||||
|
|
@ -429,7 +429,7 @@ This function returns a reference to an array of hashes containing all font type
|
|||
=cut
|
||||
|
||||
sub get_font_types {
|
||||
return $font_types;
|
||||
return dclone $font_types;
|
||||
}
|
||||
|
||||
=head2 C4::Creators::Lib::get_text_justification_types()
|
||||
|
|
@ -441,7 +441,7 @@ This function returns a reference to an array of hashes containing all text just
|
|||
=cut
|
||||
|
||||
sub get_text_justification_types {
|
||||
return $text_justification_types;
|
||||
return dclone $text_justification_types;
|
||||
}
|
||||
|
||||
=head2 C4::Creators::Lib::get_unit_values()
|
||||
|
|
@ -455,7 +455,7 @@ There are 72 PS points to the inch.
|
|||
=cut
|
||||
|
||||
sub get_unit_values {
|
||||
return $unit_values;
|
||||
return dclone $unit_values;
|
||||
}
|
||||
|
||||
=head2 C4::Creators::Lib::get_output_formats()
|
||||
|
|
@ -467,7 +467,7 @@ This function returns a reference to an array of hashes containing all label out
|
|||
=cut
|
||||
|
||||
sub get_output_formats {
|
||||
return $output_formats;
|
||||
return dclone $output_formats;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue