Bug 24001: Fix patron card template edition
authorBlou <blou@inlibro.com>
Tue, 30 Jun 2020 16:50:09 +0000 (12:50 -0400)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 28 Apr 2022 20:49:20 +0000 (10:49 -1000)
Error when saving Patron card Template:
Can't bless non-reference value at
/home/vagrant/kohaclone/C4/Creators/Profile.pm line 89

This is caused by the profile dropdown offering invalid choices and is
fixed by adding a filter to limit options to creator = 'Patroncards'.
The UI already handles the case where no valid profile is avaiable.

Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
patroncards/edit-template.pl

index 0238701..1c7a2cd 100755 (executable)
@@ -47,10 +47,10 @@ my $units = get_unit_values();
 
 if ($op eq 'edit') {
     $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, '' ]} } );
+    $profile_list = get_all_profiles({ fields => [ qw( profile_id printer_name paper_bin ) ], filters => {template_id => [ $template_id, 0 ], creator => 'Patroncards'} } );
 }
 elsif ($op eq 'save') {
-    my @params = (      profile_id      => scalar $cgi->param('profile_id') || '',
+    my @params = (      profile_id      => scalar $cgi->param('profile_id') || 0,
                         template_code   => scalar $cgi->param('template_code'),
                         template_desc   => scalar $cgi->param('template_desc'),
                         page_width      => scalar $cgi->param('page_width'),