create_superlibrarian.pl should not create a koha/koha (42) patron but accept parameters instead.
Created attachment 74244 [details] [review] Bug 20580: Make create_superlibrarian.pl accept parameters So far this script does not accept parameters and create a koha/koha superlibrarian This patch makes it accept parameters to create a customized superlibrarian patrons. Test plan: Use the script with valid and invalid paramters and confirm that it works as expected. Note: A cryptic "Invalid parameter passed" error is raised when the categorycode is not valid. Better error handling must be provided but Koha::Exceptions seems to be enhancement (see related bug reports).
reset_all kshell ./misc/devel/create_superlibrarian.pl --user admin --password admin --branchcode CPL --categorycode S --cardnumber SEE_THIS_BREAKS A new user is added, but the userid isn't admin. In my test case it was 4. Ran it 2 more times: 5 and 6. This case needs to be reported and/or prevented. If the userid exists, perhaps a nice warning and either die, or spit out the new userid. Otherwise, it works great in "normal" circumstances.
(In reply to M. Tompsett from comment #2) > reset_all > kshell > ./misc/devel/create_superlibrarian.pl --user admin --password admin > --branchcode CPL --categorycode S --cardnumber SEE_THIS_BREAKS > > A new user is added, but the userid isn't admin. In my test case it was 4. > Ran it 2 more times: 5 and 6. This case needs to be reported and/or > prevented. If the userid exists, perhaps a nice warning and either die, or > spit out the new userid. > > Otherwise, it works great in "normal" circumstances. --userid you mean?
Created attachment 74597 [details] [review] Bug 20580: Make create_superlibrarian.pl accept parameters So far this script does not accept parameters and create a koha/koha superlibrarian This patch makes it accept parameters to create a customized superlibrarian patrons. Test plan: Use the script with valid and invalid paramters and confirm that it works as expected. Note: A cryptic "Invalid parameter passed" error is raised when the categorycode is not valid. Better error handling must be provided but Koha::Exceptions seems to be enhancement (see related bug reports). Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Combined SO+QA I agree that error checking could be improved ;) But what we have now is better than koha/koha/42. Still a bit ugly: DBD::mysql::st execute failed: Duplicate entry '4' for key 'cardnumber' DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails Use of uninitialized value in sprintf at /usr/share/koha/devclone/Koha/Exceptions/Exception.pm line 19. Invalid parameter passed, branchcode= does not exist Also note that it is possible to add superlibrarians that are not staff members. This is also possible via the interface. So no blocker. But maybe we should not allow staff permissions for non-staff categories on a new report??
Pushed to master for 18.05, thanks to everybody involved!