Bug 18636 - Can not save new patron on fresh install (Conflict between autoMemberNum and BorrowerMandatoryField)
Summary: Can not save new patron on fresh install (Conflict between autoMemberNum and ...
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Marc Véron
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
: 19224 (view as bug list)
Depends on:
Blocks: 19225
  Show dependency treegraph
 
Reported: 2017-05-19 05:04 UTC by Marc Véron
Modified: 2017-10-06 06:09 UTC (History)
8 users (show)

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


Attachments
Bug 18636: Sysprefs: Add explanation for conflict autonumbernum / BorrowerMandatoryFields (2.15 KB, patch)
2017-08-09 07:54 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 18636: Sysprefs: Add explanation for conflict autonumbernum / BorrowerMandatoryFields (2.25 KB, patch)
2017-08-27 21:52 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 18636: Sysprefs: Add explanation for conflict autonumbernum / BorrowerMandatoryFields (2.30 KB, patch)
2017-09-01 12:56 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Véron 2017-05-19 05:04:49 UTC
Tested on a fresh install on current master

To reproduce:
- Go to Koha > Patrons > Add patron (full form)
- Verify that label for card number reads: "Card number(leave blank for auto calc during registration):"
- Do not enter anything in field card number
- Enter surname, try to save
- Form does not save because field card number is required

Reason:
- autoMemberNum is on by default 
 (sysprefs.sql line 65)
- BorrowerMandatoryField contains surname|cardnumber by default
 (sysprefs.sql line 86)
- Full form does not save because card number is mandatory and empty

Note: With quick add form and settings above, cardnumber is not displayed, form saves properly.

What to do?
- Better explanation for autoMemberNum and BorrowerMandatoryField
- Set defaults for autoMemberNum and BorrowerMandatoryField in a way that they do not conflict?
- Ignore cardnumber being a mandatory field if autoMemberNum is on?
- Ask for settings in onboarding tool?
Comment 1 Krishna K 2017-08-09 05:02:25 UTC
Hi,

We are using Koha 17.05.01 with MySQL. When we try to add a patron, the card number field is not getting autogenerated and save is failing.

Automembernum is enabled and BorrowerMandatoryField contains cardnumber. I see no contradiction in these parameters.

This was working perfectly fine in 16.05. What could be going wrong ?
Comment 2 Katrin Fischer 2017-08-09 06:58:34 UTC
Hi Krishna, this is more of a support question I think and would be better on the mailing list or in IRC. Please state which version of MySQL you are using. If it's 5.7 or later it's strongly recommended you switch to MariaDB as there are a lot of known problems with 5.7 being more strict.
Comment 3 Marc Véron 2017-08-09 07:54:07 UTC
Created attachment 65699 [details] [review]
Bug 18636: Sysprefs: Add explanation for conflict autonumbernum / BorrowerMandatoryFields

This patch adds a note to the system preferences autonembernum and
BorrowerMandatoryFields regarding a conflict if automembernum is on
and BorrowerMandatoryFields contains cardnumber.

To reproduce issue: See initial comment.

To test:
- Apply patch
- Verify that in system preferences note appears with both prefs
  automembernum and BorrowerMandatoryFields
Comment 4 Krishna K 2017-08-09 13:04:05 UTC
Hi,

The documentation as part of the patch says if AutoMemberNum is ON, then BorrowerMandatoryField should not contain cardnumber. If I remove cardnumber from the BorrowerMandatoryField, then on adding a patron a long number gets generated as the card number.This is happening after upgrading to 17.05. Earlier, we were using 16.05 and there the card number was getting auto generated by adding one to the last added patron's card number. So we had numbers like say 125, 126 etc(we are a small library) whereas the settings suggested in 17.05 leaves us with an unwieldy 14 digit card number.

Katrin, I will reconfirm on the MySQL version. Am not sure about that. Do you think this is related to the autoincrement issue at the database level ?
Comment 5 Katrin Fischer 2017-08-09 18:49:37 UTC
Hm, this might not be an update issue. The cardnumber is generated by looking for the biggest used number in your database and adding 1. If you do something like: select max(cardnumber) from borrowers; what does it give you? If you want to get back to low numbers, you might just have to clean up a few records.
Comment 6 Alex Buckley 2017-08-27 21:52:46 UTC
Created attachment 66516 [details] [review]
Bug 18636: Sysprefs: Add explanation for conflict autonumbernum / BorrowerMandatoryFields

This patch adds a note to the system preferences autonembernum and
BorrowerMandatoryFields regarding a conflict if automembernum is on
and BorrowerMandatoryFields contains cardnumber.

To reproduce issue: See initial comment.

To test:
- Apply patch
- Verify that in system preferences note appears with both prefs
  automembernum and BorrowerMandatoryFields

Followed test plan, works as described
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Comment 7 Jonathan Druart 2017-08-31 14:23:25 UTC
*** Bug 19224 has been marked as a duplicate of this bug. ***
Comment 8 Jonathan Druart 2017-08-31 14:24:15 UTC
What about a warning on the about page?
Comment 9 Marc Véron 2017-08-31 14:39:48 UTC
(In reply to Jonathan Druart from comment #8)
> What about a warning on the about page?

See Bug 19225
Comment 10 Kyle M Hall 2017-09-01 12:56:15 UTC
Created attachment 66730 [details] [review]
Bug 18636: Sysprefs: Add explanation for conflict autonumbernum / BorrowerMandatoryFields

This patch adds a note to the system preferences autonembernum and
BorrowerMandatoryFields regarding a conflict if automembernum is on
and BorrowerMandatoryFields contains cardnumber.

To reproduce issue: See initial comment.

To test:
- Apply patch
- Verify that in system preferences note appears with both prefs
  automembernum and BorrowerMandatoryFields

Followed test plan, works as described
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Jonathan Druart 2017-09-01 16:05:34 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 12 Fridolin SOMERS 2017-10-03 09:28:24 UTC
Pushed to 17.05.x, will be in 17.05.05.
Comment 13 Katrin Fischer 2017-10-06 06:09:39 UTC
This patch has been pushed to 16.11.x and will be in 16.11.13.