Bug 20625 - Cannot add new patron category without currency
Summary: Cannot add new patron category without currency
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 4078
Blocks:
  Show dependency treegraph
 
Reported: 2018-04-20 07:07 UTC by Marcel de Rooy
Modified: 2018-10-24 09:13 UTC (History)
6 users (show)

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


Attachments
Bug 20625: Add tests (974 bytes, patch)
2018-04-23 15:11 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20625: Handle non existing of active currency (1.58 KB, patch)
2018-04-23 15:11 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20625: Add tests (1019 bytes, patch)
2018-04-23 15:43 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20625: Handle non existing of active currency (1.62 KB, patch)
2018-04-23 15:43 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20625: Add tests (1.00 KB, patch)
2018-04-24 06:07 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 20625: Handle non existing of active currency (1.69 KB, patch)
2018-04-24 06:09 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2018-04-20 07:07:22 UTC
Internal server errror on clicking New category in Admin/Patron categories

Template process failed: undef error - Can't call method "p_sep_by_space" on an undefined value at /usr/share/koha/devclone/Koha/Number/Price.pm line 126.

Sub _format_params assumes that there is an active currency. (Which was not there yet in a new installed system.) 
Since we are showing an empty page here, I do not see the need of a currency for just formatting a zero or null value ??
Comment 1 Liz Rea 2018-04-22 23:31:18 UTC
Maybe add the currency selection into the onboarder, before you add a patron category (if the "currency" sample data isn't selected)
Comment 2 Jonathan Druart 2018-04-23 15:06:10 UTC
Caused by
  commit 18e72e31957a51206875ac27d92929909a90ef34
  Bug 4078: Add the ability to display and configure the symbol for prices
Comment 3 Jonathan Druart 2018-04-23 15:11:29 UTC
Created attachment 74737 [details] [review]
Bug 20625: Add tests
Comment 4 Jonathan Druart 2018-04-23 15:11:32 UTC
Created attachment 74738 [details] [review]
Bug 20625: Handle non existing of active currency

This patch avoid the explosion in the air when creating a new patron
category and no active currency is defined.

Test plan:
Remove the currencies, create a new patron category
Without this patch applied you will get
  Can't call method "p_sep_by_space" on an undefined value

With this patch the form will be displayed correctly and you will be
able to create the patron category
Comment 5 M. Tompsett 2018-04-23 15:43:26 UTC
Created attachment 74740 [details] [review]
Bug 20625: Add tests

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 6 M. Tompsett 2018-04-23 15:43:29 UTC
Created attachment 74741 [details] [review]
Bug 20625: Handle non existing of active currency

This patch avoid the explosion in the air when creating a new patron
category and no active currency is defined.

Test plan:
Remove the currencies, create a new patron category
Without this patch applied you will get
  Can't call method "p_sep_by_space" on an undefined value

With this patch the form will be displayed correctly and you will be
able to create the patron category

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 7 M. Tompsett 2018-04-23 15:44:18 UTC
Test only applied, kaboom. With patch, no kaboom. And code change eyeballs well.
Comment 8 Katrin Fischer 2018-04-24 06:07:41 UTC
Created attachment 74774 [details] [review]
Bug 20625: Add tests

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 9 Katrin Fischer 2018-04-24 06:09:02 UTC
Created attachment 74775 [details] [review]
Bug 20625: Handle non existing of active currency

This patch avoid the explosion in the air when creating a new patron
category and no active currency is defined.

Test plan:
Remove the currencies, create a new patron category
Without this patch applied you will get
  Can't call method "p_sep_by_space" on an undefined value

With this patch the form will be displayed correctly and you will be
able to create the patron category

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Jonathan Druart 2018-04-24 15:36:59 UTC
Pushed to master for 18.05, thanks to everybody involved!