From 7896f4cdc04c813d5028acca801a4e1064ce1f31 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Thu, 17 Oct 2019 11:18:13 +0300 Subject: [PATCH] Bug 12133: (QA Follow up) Guarantor requirements when registering a patron Add three requirements when registering a new patron: - A child patron must have a guarantor. This is controlled by a new syspref ChildNeedsGuarantor. - A guarantor has to be a patron. This is controlled by a new syspref GuarantorHasToBePatron. - A guarantor cannot be a guarantee. Test plan: -Add child patron without guarantor or child patron with guarantee as guarantor succesfully. - Apply this patch. - Add a child patron with a guaranteer as guarantor. Error is raised. - Turn syspref "ChildNeedsGuarantor" ON. - Add a child patron without a guarantor and error "Child needs a guarantor" is raised. - Add guarantor. Guarantor can either be existing patron or added with "Contact" section. Save without errors. - Turn syspref "GuarantorNeedsToBePatron" ON. - Form fields for "Contact" section aren't displayed and only existing patron can be added as guarantor. --- .../data/mysql/atomicupdate/bug_12133.perl | 16 +++++++++++++++ .../en/modules/admin/preferences/patrons.pref | 15 +++++++++++++- .../prog/en/modules/members/memberentrygen.tt | 8 +++++++- members/memberentry.pl | 20 +++++++++++++++++-- 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_12133.perl diff --git a/installer/data/mysql/atomicupdate/bug_12133.perl b/installer/data/mysql/atomicupdate/bug_12133.perl new file mode 100644 index 0000000000..111c3fbfe8 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_12133.perl @@ -0,0 +1,16 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + # you can use $dbh here like: + $dbh->do( q{ + INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) + VALUES('ChildNeedsGuarantor', 0, 'If ON, a child patron must have a guarantor when adding the patron.', '', 'YesNo')} ); + + # or perform some test and warn + # if( !column_exists( 'biblio', 'biblionumber' ) ) { + # warn "There is something wrong"; + # } + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 12133 - Guarantor requirements when registering a patron)\n"; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 14f1ef910c..a2ea52faac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -66,6 +66,13 @@ Patrons: softno: "Unless overridden by patron category, do not" hardno: "Do not" - " check borrower checkout history to see if the current item has been checked out before." + - + - "A child patron" + - pref: "ChildNeedsGuarantor" + choices: + yes: "must have" + no: "doesn't need" + - a guarantor when adding the patron. - - pref: EnhancedMessagingPreferences choices: @@ -233,7 +240,13 @@ Patrons: no: Allow all permitted users - "to access/change superlibrarian privileges." - "
NOTE: A permitted user needs to have the 'permissions' flag (if no superlibrarian)." - + - + - "The guarantor" + - pref: "GuarantorHasToBePatron" + choices: + yes: "has to be" + no: "doesn't have to be" + - a patron. Privacy: - - Use the following URL diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index f36d98314b..4276e19294 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -79,6 +79,12 @@

The following fields are wrong. Please fix them.