From 47e80e899aca7c79aaeb58350401a1963fbe709d Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 2 Dec 2016 03:04:07 +0000 Subject: [PATCH] Bug 15415: Warn when creating a new print profile MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As per Jonathan's comment in Comment 3, I've put that line of code in an if statement that will only call the get_attr method if we are editing an existing profile (therefore the profile id will exist). To test: 1) Go to Tools -> Patron Card Creator -> New printer profile 2) Notice warn 3) Apply patch 4) Refresh page 5) Confirm warn is gone and page still works as expected Sponsored-by: Catalyst IT Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- patroncards/edit-profile.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/patroncards/edit-profile.pl b/patroncards/edit-profile.pl index 55e903cedb..0dc312fd96 100755 --- a/patroncards/edit-profile.pl +++ b/patroncards/edit-profile.pl @@ -88,7 +88,9 @@ foreach my $unit (@$units) { } } -$template->param(profile_id => $profile->get_attr('profile_id')) if $profile->get_attr('profile_id') > 0; +if ($profile_id) { # if new layout, there will be no profile id, so shouldn't look for it + $template->param(profile_id => $profile->get_attr('profile_id')) if $profile->get_attr('profile_id') > 0; +} $template->param( label_template => $label_template[0]->{'template_code'} || '', -- 2.39.5