Bugzilla – Attachment 101563 Details for
Bug 22534
Add ability to choose which fields are copied from guarantor to guarantee
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22534: Added syspref for defining what guarantee fields are pre filled
Bug-22534-Added-syspref-for-defining-what-guarante.patch (text/plain), 9.03 KB, created by
PTFS Europe Sandboxes
on 2020-03-24 13:21:41 UTC
(
hide
)
Description:
Bug 22534: Added syspref for defining what guarantee fields are pre filled
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2020-03-24 13:21:41 UTC
Size:
9.03 KB
patch
obsolete
>From 059e2384f00c8974c75726c79bc1d1cd8236a5d2 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >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 fields 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')) 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 > >* 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 <instancename> >./updatedatabase.pl > >6. Go to Administration > Global system preferences and search for the >new PrefillGuaranteeField system preference > >7. Observe this syspref containing the following: >phone|email|streetnumber|address|city|state|zipcode|country > >8. Repeat step 1 and observe the following fields are prefilled from guarantor: >streetnumber >address >city >state >zipcode/postal code >country >Primary phone >Primary email > >9. Add the following content into PrefillGuaranteeField syspref and save: >phone|phonepro|mobile|email|emailpro|fax|streetnumber|address|address2|city|state|zipcode|country|altcontactfirstname|altcontactsurname|altcontactaddress1|altcontactaddress2|altcontactaddress3|altcontactstate|altcontactzipcode|altcontactcountry|altcontactphone > >10. Repeat step 1 and observe all fields in 'Main address', >'Alternate contact', and (except 'Guarantor surname', 'Guarantor >first name', and 'relationship') in 'Contact' are pre-filled from >guarantor > >11. Change a few of the prefilled field values and 'Save' and observe your changes >have been saved as have the values you haven't altered > >12. Amend PrefillGuaranteeField syspref to be: >phone|phonepro|mobile|email|emailpro|fax|streetnumber|address|address2|city|state|zipcode|country|altcontactfirstname|altcontactsurname|drfregfre|altcontactaddress1|altcontactaddress2|altcontactaddress3|altcontactstate|altcontactzipcode|altcontactcountry|altcontactphone > >(Note: Have added a invalid column field 'drfregfre') > >13. Repeat step 1 and observe no internal server errors and all fields >listed in step 10 are still pre-filled > >14. Amend PrefillGuarantee field syspref to be: >phone|phonepro|mobile|email|contactfirstname|emailpro|fax|streetnumber|address|address2|city|state|zipcode|country|altcontactfirstname|altcontactsurname|altcontactaddress1|altcontactaddress2|altcontactaddress3|altcontactstate|altcontactzipcode|altcontactcountry|altcontactphone > >(Note: Have added contactfirstname which is what the 'Guarantor first > name' field in 'Contact' section of member entry form is) > >15. Repeat step 1 and observe all fields defined in step 10 are filled >and 'Guarantor first name' is not filled even though it was listed in >PrefillGuarantorField because contactfirstname (along with >contactsurname and relationship are meant for non Koha patrons and so >should not pre-fill from a Koha patron) > >16. Run tests: >sudo koha-shell <instancename> >prove xt >prove t > >Sponsored-by: Waitaki Distict Council, NZ > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> >--- > ...bug_22534-add_PreFillGuaranteeField_syspref.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/patrons.pref | 5 +++ > members/memberentry.pl | 40 ++++++++++++++++------ > 4 files changed, 37 insertions(+), 10 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.sql b/installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.sql >new file mode 100644 >index 0000000000..946b14a112 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_22534-add_PreFillGuaranteeField_syspref.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('PrefillGuaranteeField', 'phone|email|streetnumber|address|city|state|zipcode|country', NULL, 'Choose which guarantee fields are pre-filled from guarantor record', 'free'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 6eeff845d1..9a13284ba7 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -498,6 +498,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, 'Choose which guarantee fields are pre-filled from guarantor record', 'free'), > ('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..774904b52b 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 >@@ -140,6 +140,11 @@ Patrons: > no: "Don't allow" > - images to be uploaded and shown for patrons on the staff client. > - >+ - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> will be pre-filled in guarantee entry screen from guarantor redord:" >+ - pref: PrefillGuaranteeField >+ class: multi >+ - (seperate columns with |) >+ - > - By default, show > - pref: PatronsPerPage > class: integer >diff --git a/members/memberentry.pl b/members/memberentry.pl >index ba47e1d3fa..9e6936146f 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -594,18 +594,38 @@ 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 >- ) >- ) >- { >- $newdata{$_} = $guarantor->$_; >+ foreach (@prefill_fields) { >+ if ($_ eq 'altcontactfirstname') { >+ $newdata{altcontactfirstname} = $guarantor->firstname; >+ } elsif ($_ eq 'altcontactsurname') { >+ $newdata{altcontactsurname} = $guarantor->surname; >+ } elsif ($_ eq 'altcontactaddress1') { >+ $newdata{altcontactaddress1} = $guarantor->address; >+ } elsif ($_ eq 'altcontactaddress2') { >+ $newdata{altcontactaddress2} = $guarantor->address2; >+ } elsif ($_ eq 'altcontactaddress3') { >+ $newdata{altcontactaddress3} = $guarantor->city; >+ } elsif ($_ eq 'altcontactstate') { >+ $newdata{altcontactstate} = $guarantor->state; >+ } elsif ($_ eq 'altcontactzipcode') { >+ $newdata{altcontactzipcode} = $guarantor->zipcode; >+ } elsif ($_ eq 'altcontactcountry') { >+ $newdata{altcontactcountry} = $guarantor->country; >+ } elsif ($_ eq 'altcontactphone') { >+ $newdata{altcontactphone} = $guarantor->phone; >+ } else { >+ eval { $newdata{$_} = $guarantor->$_; }; >+ if ($@) { >+ push @errors, $@; >+ } >+ } > } > } > $template->param( updtype => 'I', step_1=>1, step_2=>1, step_3=>1, step_4=>1, step_5 => 1, step_6 => 1, step_7 => 1); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22534
:
101499
|
101501
|
101563
|
102097
|
102124
|
102126
|
102919