Bug 12451 - circulation rule cant be edited if itemtype contains a space character
Summary: circulation rule cant be edited if itemtype contains a space character
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Target Milestone: ---
Assignee: Bugs List
QA Contact: Testopia
URL: cgi-bin/koha/admin/smart-rules.pl
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-19 08:17 UTC by Fridolin SOMERS
Modified: 2016-06-21 21:37 UTC (History)
3 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:
Version(s) released in:


Attachments
Bug 12451 - circulation rule cant be edited if itemtype contains a space character (2.38 KB, patch)
2014-06-19 08:27 UTC, Fridolin SOMERS
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 12451 - circulation rule cant be edited if itemtype contains a space character (2.51 KB, patch)
2014-06-19 15:42 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 12451 - circulation rule cant be edited if itemtype contains a space character (2.46 KB, patch)
2014-06-19 15:56 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 Fridolin SOMERS 2014-06-19 08:17:01 UTC
When an itemtype description contains a space character like " Book" (often used to set this itemtype as first in sorted lists), the edition of an existing circulation rule does not work, it selects the default itemtype.
Same for patron category.

It's because the JavaScript code performs a trim on value existing in table 
itm = itm.replace(/^\s*|\s*$/g,'');
The same trim must be performed on combobox in editing line.
Comment 1 Fridolin SOMERS 2014-06-19 08:27:38 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2014-06-19 15:42:23 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2014-06-19 15:56:47 UTC
Created attachment 29054 [details] [review]
Bug 12451 - circulation rule cant be edited if itemtype contains a space character

When an itemtype description contains a space character like " Book"
(often used to set this itemtype as first in sorted lists), the edition
of an existing circulation rule does not work, it selects the default
itemtype. Same for patron category.

It's because the JavaScript code performs a trim on value existing in
table itm = itm.replace(/^\s*|\s*$/g,''); This patch adds trim on select
options in editing line.

Test plan :
- Create an itemtype with a leading or trailling space in description :
  ie " Book"
- Go to cgi-bin/koha/admin/smart-rules.pl
- Create a rule with this itemtype, Unit=hours and Hard due date=Exactly
  on 31/12/2015 (any date)
- Click on Edit on this rule line
  => Without this patch, the default itemtype is selected in edition
     line
  => With this patch, the correct itemtype is selected in edition line

Check others selects are ok :
  - Create a rule with Unit=hours and Hard due date=Exactly on
    31/12/2015 (any date)
  - Click on Edit on this rule line
    => The correct options are selected
Same tests with a patron category containing a leading or trailling space in description

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Tomás Cohen Arazi 2014-07-03 13:51:14 UTC
Patch pushed to master.

Thanks Fridolin!
Comment 5 Galen Charlton 2014-07-23 21:34:38 UTC
Pushed to 3.16.x for inclusion in 3.16.2.
Comment 6 Fridolin SOMERS 2014-12-12 08:12:27 UTC
Pushed to 3.14.x, will be in 3.14.12.