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 <instancename>
./updatedatabase.pl

6. Restart plack:
sudo koha-plack --restart <instancename>

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 <instancename>
prove xt
prove t

Sponsored-by: Waitaki Distict Council, NZ
Signed-off-by: Sally <sally.healey@cheshiresharedservices.go.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Alex Buckley 2020-03-23 04:14:39 +00:00 committed by Martin Renvoize
parent 8a56f176c0
commit dd0d2fa1c9
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
5 changed files with 50 additions and 9 deletions

View file

@ -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";
}

View file

@ -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'), ('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'), ('PayPalSignature', '', NULL , 'Your PayPal API signature', 'Free'),
('PayPalUser', '', NULL , 'Your PayPal API username ( email address )', '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'), ('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'), ('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'), ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),

View file

@ -139,6 +139,42 @@ Patrons:
yes: Allow yes: Allow
no: "Don't allow" no: "Don't allow"
- images to be uploaded and shown for patrons on the staff client. - 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 - By default, show
- pref: PatronsPerPage - pref: PatronsPerPage

Binary file not shown.

View file

@ -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 ($op eq 'add'){
if ($guarantor_id) { if ($guarantor_id) {
foreach ( foreach (@prefill_fields) {
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->$_; $newdata{$_} = $guarantor->$_;
} }
} }