Bug 20227

Summary: admin/smart-rules.pl should pass categorycode instead of branchcode
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Staff interfaceAssignee: Marcel de Rooy <m.de.rooy>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, gmcharlt, jonathan.druart, nick
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 2000    
Bug Blocks: 15524    
Attachments: Bug 20227: Check for categorycode in default_borrower_circ_rules

Description Marcel de Rooy 2018-02-16 10:59:36 UTC
Found while testing bug 15524.
Trivial error. Field mixed up (copy-paste).

DBD::mysql::st execute failed: Duplicate entry 'ST' for key 'PRIMARY' [for Statement "
                INSERT INTO default_borrower_circ_rules
                    (categorycode, maxissueqty, maxonsiteissueqty, max_holds)
                    VALUES (?, ?, ?, ?)
            " with ParamValues: 0="ST", 1=undef, 2=undef, 3="3"] at /usr/share/koha/devclone/admin/smart-rules.pl line 309.
Comment 1 Marcel de Rooy 2018-02-16 11:05:56 UTC
Created attachment 71712 [details] [review]
Bug 20227: Check for categorycode in default_borrower_circ_rules

Fixes silent crash when adding the same category twice.
DBD::mysql::st execute failed: Duplicate entry 'ST' for key 'PRIMARY' [for Statement "
                INSERT INTO default_borrower_circ_rules
                    (categorycode, maxissueqty, maxonsiteissueqty, max_holds)
                    VALUES (?, ?, ?, ?)
            " with ParamValues: 0="ST", 1=undef, 2=undef, 3="3"] at /usr/share/koha/devclone/admin/smart-rules.pl line 309.

(Line number affected by bug 15524.)

Very trivial solution.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2018-02-16 11:16:36 UTC
Passing QA on this trivial patch in conjunction with 15524.
It is submitted separately in order to allow easy backporting.
Comment 3 Jonathan Druart 2018-02-16 16:27:53 UTC
Caused by bug 2000, outch!
Comment 4 Jonathan Druart 2018-02-16 17:07:25 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 5 Nick Clemens 2018-02-26 11:40:32 UTC
Awesome work all! Pushed to stable for 17.11.03
Comment 6 Fridolin Somers 2018-05-09 14:46:42 UTC
Pushed to 17.05.x for 17.05.12