From dd0d2fa1c99126de9942ca7802baf18a42c2680e Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 23 Mar 2020 04:14:39 +0000 Subject: [PATCH] Bug 22534: Added syspref for defining what guarantee fields are pre filled Librarians should be able to define what sections in member entryfields in 'Main address', 'Contact' and 'Alternate contact' in member entry form for guarantee's are pre-filled from guarantor's record The 'Guarantor surname, 'Guarantor first name' and 'relationship' fields in the 'Contact' section should not be filled from guarantor patron record as those fields are intended for guarantor's without patron records in Koha. Test plan: 1. On an adult patron's record (which has all fields filled out in the 'Main address', 'Contact' (Except for 'Guarantor surname', 'Guarantor first name', and 'relationship'), 'Alternate address', and 'Alternate contact') select 'Add guarantee' 2. Observe: * Fields in 'Main address' are all automatically pre-filled from guarantor record * Fields in 'Contact' (except 'Guarantor surname', 'Guarantor firstname' and 'relationship') are all automatically pre-filled from guarantor record * Fields in 'Alternate address' (except for Contact note) are pre-filled from guarantor record * None of the fields in 'Alternate contact' are pre-filled from guarantor 4. Apply patch 5. Run database updates cd installer/data/mysql sudo koha-shell ./updatedatabase.pl 6. Restart plack: sudo koha-plack --restart 7. Go to Administration > Global system preferences and search for the new PrefillGuaranteeField system preference 8. Observe this syspref contains checkboxes and the following are selected by default: Contact - Primary email Contact - Primary phone Main address - Address Main address - City Main address - Country Main address - State Main address - ZIP/Postal code Main address - street number Please note: 'Contact - Guarantor surname', 'Contact - Guarantor first name', Contact - relationship' are not in PrefillGuaranteeField syspref as they are for non Koha patrons and so should not be pre-filled from a Koha patron. 9. Repeat step 1 and observe the following fields are prefilled from guarantor: In Main address section - streetnumber address city state zipcode/postal code country In Contact section - Primary phone Primary email 10. In the PrefillGuaranteeField syspref click '[Select all]' checkboxes 11. Repeat step 1 and observe all fields in 'Main address', 'Contact' (except Guarantor surname, Guarantor first name, and relationship), Alternate address and Alterate contact are filled from guarantor record. i.e. The values in guarantor's 'Alternate address' fields fill the guarantee's 'Alternate address' fields 12. Change a few of the prefilled field values and 'Save' and observe your changes have been saved in addition to the unaltered pre-filled values in other fields 13. Amend PrefillGuarantee field syspref to have no checkboxes selected 14. Repeat step 1 and observe none of the fields in Main address, Contact, Alternate address and Alternate contact are pre-filled 15. Run tests: sudo koha-shell prove xt prove t Sponsored-by: Waitaki Distict Council, NZ Signed-off-by: Sally Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- ...534-add_PreFillGuaranteeField_syspref.perl | 7 ++++ installer/data/mysql/sysprefs.sql | 1 + .../en/modules/admin/preferences/patrons.pref | 36 ++++++++++++++++++ members/.nfs0000000000721f7f00000014 | Bin 0 -> 16384 bytes members/memberentry.pl | 15 +++----- 5 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.perl create mode 100644 members/.nfs0000000000721f7f00000014 diff --git a/installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.perl b/installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.perl new file mode 100644 index 0000000000..da4ece4ef5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.perl @@ -0,0 +1,7 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('PrefillGuaranteeField', 'phone,email,streetnumber,address,city,state,zipcode,country', NULL, 'Prefill these fields in guarantee member entry form from guarantor patron record', 'Multiple') }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index dfa58b1809..f21e1fd3f1 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -499,6 +499,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PayPalSandboxMode', '1', NULL , 'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.', 'YesNo'), ('PayPalSignature', '', NULL , 'Your PayPal API signature', 'Free'), ('PayPalUser', '', NULL , 'Your PayPal API username ( email address )', 'Free'), +('PrefillGuaranteeField', 'phone,email,streetnumber,address,city,state,zipcode,country', NULL, 'Prefill these fields in guarantee member entry form from guarantor patron record', 'Multiple'), ('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'), ('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'), ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), 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 13c2e70352..6990dfa62d 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 @@ -139,6 +139,42 @@ Patrons: yes: Allow no: "Don't allow" - images to be uploaded and shown for patrons on the staff client. + - + - "When adding a guarantee to a guarantor patron fill the following fields in the guarantee's member entry form from the guarantors record:" + - pref: PrefillGuaranteeField + multiple: + B_address: "Alternate address - Address" + B_address2: "Alternate address - Address 2" + B_city: "Alternate address - City" + contactnote: "Alternate address - Contact note" + B_country: "Alternate address - Country" + B_email: "Alternate address - Email" + B_phone: "Alternate address - Phone" + B_state: "Alternate address - State" + B_streetnumber: "Alternate address - Street number" + B_zipcode: "Alternate address - ZIP/Postal code" + altcontactaddress1: "Alternate contact: Address" + altcontactaddress2: "Alternate contact: Address 2" + altcontactaddress3: "Alternate contact: City" + altcontactcountry: "Alternate contact: Country" + altcontactfirstname: "Alternate contact: First name" + altcontactphone: "Alternate contact: Phone" + altcontactstate: "Alternate contact: State" + altcontactsurname: "Alternate contact: Surname" + altcontactzipcode: "Alternate contact: ZIP/Postal code" + fax: "Contact - Fax" + mobile: "Contact - Other phone" + email: "Contact - Primary email" + phone: "Contact - Primary phone" + emailpro: "Contact - Secondary email" + phonepro: "Contact - Secondary phone" + address: "Main address - Address" + address2: "Main address - Address 2" + city: "Main address - City" + country: "Main address - Country" + state: "Main address - State" + zipcode: "Main address - ZIP/Postal code" + streetnumber: "Main address - street number" - - By default, show - pref: PatronsPerPage diff --git a/members/.nfs0000000000721f7f00000014 b/members/.nfs0000000000721f7f00000014 new file mode 100644 index 0000000000000000000000000000000000000000..adef40db269d55554721f73d5638f9c8216c5416 GIT binary patch literal 16384 zcmeHOYm6jS6)q6a1wkV}2x8*doo2fy%xl5m+QSUfJ3BKwaUPv{?7A-6R(IX*u1t4T zPd%n*XhzT&V~ipG5{)ssF2tyR@P}xk{xSxGnrKi%;y?T$L=$|)2MYL|Ten`_Gs_Aj z#-u9wwyW>C=iGC@d+y`h>8(zjU0kM|dd{nIr%(Q}l3!5eKk1Xdq~zyR`Ek`i*v`L|d|Ao&`{e&p@--!Ys!#r+l9!eI zU8+N&{eLRCq2#ST`9GArq2xdBlmA`G>q`FKHw7=Def3p4rQ~1gldIzFBV!=8|S1n2?x0h7SXZ_%`8fS&Ud#_}#Ve6Zj->7Wl(8n)U@?7I+DF2u}l-fJcB& z0NcPaump?)zs9)z3b+J(1~>!U2Jm>^3cQXd=ZSWwrF&v@x}!UKyFd*epO$AkG&N1R z_}lQLmiRVB@5k>uip8?-Ikx4FPS;J#C?x7vOoN8Wtfz}6wf0`3gr>;13{meZX5A^u znO4X5Lcj8nCy?ghj5g@HBhV8Q?ljGg%kH~1y`?*p>qsw0r(+xGs)3_Htx0WYh)xT= zMP1WtCg^ZIzh2j52YgpJ!rFn8v+pSuXKl+9yYN&M2fbObH#-K1U9uad6%m_hW}%!1f+Ig_ z@R0hEJXDB!bBIDH59`;OqPA5DesOh>LrHn0qdSJ>^KZ0dBLkhNMejd@(Y{&9orseZk zX!bQWKe*huZMV{K>>bmxcPOVvh4hL*{ zQ9%UOd9|sDLLPeS!ZJ=f=8kaSA&2!`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FwZ-_pWbOGnhOo_vdi9p7!z zOxlSNbb}k?hl7F}1#$Y$=yVMyVh@)c@(Ty#=rl`<%5FNCbiT6YLuawrpCLw*Lum<{GZMhP2R5MDp2g`}7L^i@Kh3&VZOU4K)^o+^f8cMM$9 zaZ4xCe#%Sk1Ra-aC=p293I|ij7!3F5_MBvo_R~%9QW2NzlW5^?rl+xq@EK(54H-E$ zAG!G7j2KQ5)zW#H}ye-}tl#G<&j|309x!Q_+XB$N!&z>;JS-pIf~ zz;iD~r}Xz=>(jo>oFCEt1MHdu%>V!Z literal 0 HcmV?d00001 diff --git a/members/memberentry.pl b/members/memberentry.pl index ba47e1d3fa..66c32660a0 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -594,17 +594,14 @@ if (C4::Context->preference("IndependentBranches")) { } } } + +# Define the fields to be pre-filled in guarantee records +my $prefillguarantorfields=C4::Context->preference("PrefillGuaranteeField"); +my @prefill_fields=split(/\,/,$prefillguarantorfields); + if ($op eq 'add'){ if ($guarantor_id) { - foreach ( - qw( - streetnumber address streettype address2 zipcode country city state phone phonepro mobile - fax email emailpro branchcode - B_streetnumber B_streettype B_address B_address2 - B_city B_state B_zipcode B_country B_email B_phone - ) - ) - { + foreach (@prefill_fields) { $newdata{$_} = $guarantor->$_; } } -- 2.39.5