Bug 15415 - Warn when creating new printer profile for patron card creator
Summary: Warn when creating new printer profile for patron card creator
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low trivial (vote)
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-22 23:36 UTC by Aleisha Amohia
Modified: 2017-01-29 11:46 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 15415: Warn when creating a new print profile (1.18 KB, patch)
2016-01-18 03:27 UTC, Aleisha Amohia
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 15415: Warn when creating a new print profile (1.29 KB, patch)
2016-02-02 20:59 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 15415: Warn when creating a new print profile (1.33 KB, patch)
2016-12-02 03:06 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 15415: Warn when creating a new print profile (1.46 KB, patch)
2016-12-16 10:09 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 15415: Warn when creating a new print profile (1.54 KB, patch)
2016-12-20 17:41 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2015-12-22 23:36:05 UTC
edit-profile.pl: profile_id is currently undefined. at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 187

To reproduce, go to Tools -> Patron Card Creator -> New profile
Comment 1 Aleisha Amohia 2016-01-18 03:27:15 UTC Comment hidden (obsolete)
Comment 2 Héctor Eduardo Castro Avalos 2016-02-02 20:59:36 UTC
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
Comment 3 Jonathan Druart 2016-02-03 12:40:04 UTC
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.
Comment 4 Aleisha Amohia 2016-12-02 03:06:26 UTC
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
Comment 5 Marc Véron 2016-12-16 10:09:58 UTC
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>
Comment 6 Jonathan Druart 2016-12-20 17:41:03 UTC
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>
Comment 7 Kyle M Hall 2016-12-23 11:31:22 UTC
Pushed to master for 17.05, thanks Aleisha!
Comment 8 Katrin Fischer 2016-12-27 22:04:32 UTC
This patch has been pushed to 16.11.x, will be in 16.11.02.
Comment 9 Julian Maurice 2017-01-02 12:38:32 UTC
Pushed to 3.22.x for 3.22.14
Comment 10 Mason James 2017-01-29 11:46:55 UTC
Pushed to 16.05.x, for 16.05.07 release