| Summary: | Warn when creating new printer profile for patron card creator | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Aleisha Amohia <aleisha> | 
| Component: | Tools | Assignee: | Aleisha Amohia <aleisha> | 
| Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> | 
| Severity: | trivial | ||
| Priority: | P5 - low | CC: | jonathan.druart, julian.maurice, kyle, mtj, veron | 
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Crowdfunding goal: | 0 | 
| Patch complexity: | Trivial patch | Documentation contact: | |
| Documentation submission: | Text to go in the release notes: | ||
| Version(s) released in: | Circulation function: | ||
| Attachments: | 
              Bug 15415: Warn when creating a new print profile
               [SIGNED-OFF]Bug 15415: Warn when creating a new print profile Bug 15415: Warn when creating a new print profile Bug 15415: Warn when creating a new print profile Bug 15415: Warn when creating a new print profile  | 
      ||
| 
 
        
          Description
        
        
          Aleisha Amohia
        
        
        
        
          2015-12-22 23:36:05 UTC
        
       
    Created attachment 46760 [details] [review] Bug 15415: Warn when creating a new print profile This warn is hard-coded in Profile.pm sub get_attr { my $self = shift; if (_check_params(@_) eq 1) { return -1; } my ($attr) = @_; if (exists($self->{$attr})) { return $self->{$attr}; } else { warn sprintf('%s is currently undefined.', $attr); <-- THIS LINE return -1; } } So I have removed this line because I don't think it's really necessary. 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 Created attachment 47567 [details] [review] [SIGNED-OFF]Bug 15415: Warn when creating a new print profile This warn is hard-coded in Profile.pm sub get_attr { my $self = shift; if (_check_params(@_) eq 1) { return -1; } my ($attr) = @_; if (exists($self->{$attr})) { return $self->{$attr}; } else { warn sprintf('%s is currently undefined.', $attr); <-- THIS LINE return -1; } } So I have removed this line because I don't think it's really necessary. 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 Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Warn is gone and working correctly Aleisha,
I am not sure to understand the point of this warning, but I would prefer to keep it.
I think the problem comes from the script patroncards/edit-profile.pl:
 93 $template->param(profile_id => $profile->get_attr('profile_id')) if $profile->get_attr('profile_id') > 0;
The get_attr method should not be called if we are adding a new profile.
    Created attachment 57876 [details] [review] Bug 15415: Warn when creating a new print profile 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 Created attachment 58241 [details] [review] Bug 15415: Warn when creating a new print profile 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 <veron@veron.ch> Created attachment 58316 [details] [review] Bug 15415: Warn when creating a new print profile 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 <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Pushed to master for 17.05, thanks Aleisha! This patch has been pushed to 16.11.x, will be in 16.11.02. Pushed to 3.22.x for 3.22.14 Pushed to 16.05.x, for 16.05.07 release  |