Bug 36877: Fix Patron card creator errors on editing layout, profile or template

This patch fixes the unexpected behaviour when clicking on edit layout,
edit profile or edit template in Patron card creator tool.

Test plans:

1.  edit layout:

  a) go to http://localhost:8081/cgi-bin/koha/patroncards/manage.pl?card_element=layout
  b) click on edit 'Test Layout'
  c) WARNING: An unsupported operation was attempted on layout 20.
     Please have your system administrator check the error log for
     details.

apply patch
  a) go to http://localhost:8081/cgi-bin/koha/patroncards/manage.pl?card_element=layout
  b) click on edit 'Test Layout'
  c) Edit patron card layout form 20 shows up

2. edit template and profile:

  a) go to http://localhost:8081/cgi-bin/koha/patroncards/manage.pl?card_element=template or
     http://localhost:8081/cgi-bin/koha/patroncards/manage.pl?card_element=profile
  b) click edit on an item in the table
  c) notice that the forms are empty

apply patch and redo steps a) and b) to load the edit form

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jan Kissig 2024-05-16 11:23:31 +02:00 committed by Katrin Fischer
parent b52c32e13e
commit 9a33f6fcb2
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
4 changed files with 4 additions and 4 deletions

View file

@ -96,7 +96,7 @@
[% FOREACH text_field IN table_loo.text_fields %]
[% IF ( text_field.select_field ) %]
<td>
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/patroncards/edit-[% card_element | html %].pl?op=edit&element_id=[% text_field.field_value | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/patroncards/edit-[% card_element | html %].pl?op=edit_form&element_id=[% text_field.field_value | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
[% IF ( print ) %]
<a class="btn btn-default btn-xs export" data-batch-id="[% text_field.field_value |url %]" href="/cgi-bin/koha/patroncards/print.pl?batch_id=[% text_field.field_value |url %]"><i class="fa-solid fa-share-from-square"></i> Export</a>
[% END %]

View file

@ -80,7 +80,7 @@ sub _set_selected {
return \@select_list;
}
if ($op eq 'cud-edit') {
if ($op eq 'edit_form') {
warn sprintf("Error performing '%s': No 'layout_id' passed in.", $op) unless ($layout_id);
$layout = C4::Patroncards::Layout->retrieve(layout_id => $layout_id);
$layout_xml = XMLin($layout->get_attr('layout_xml'), ForceArray => 1);

View file

@ -45,7 +45,7 @@ my @label_template = ();
my $units = get_unit_values();
if ($op eq 'cud-edit') { # FIXME This looks like edit_form ?
if ($op eq 'edit_form') { # FIXME This looks like edit_form ?
$profile = C4::Patroncards::Profile->retrieve(profile_id => $profile_id);
$template_list = get_all_templates({ fields => [ qw( template_id template_code profile_id ) ] });
}

View file

@ -45,7 +45,7 @@ my $profile_list = undef;
my $units = get_unit_values();
if ($op eq 'cud-edit') { # FIXME This looks like edit_form
if ($op eq 'edit_form') { # FIXME This looks like edit_form
$card_template = C4::Patroncards::Template->retrieve(template_id => $template_id);
$profile_list = get_all_profiles({ fields => [ qw( profile_id printer_name paper_bin ) ], filters => {template_id => [ $template_id, 0 ], creator => 'Patroncards'} } );
}