From 82bf4bf65463edb13c85e36bf7eb00ccb136cc42 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Tue, 17 Mar 2020 03:04:10 +0000 Subject: [PATCH] Bug 23808: Pre-fill guarantor fields when adding guarantee to guarantor Bug 14570 removed the guarantor pre-fill functionality when selecting 'Add guarantee' to an Adult patron. This is because guarantor information would now only display if (1) the patron record exists (which it won't when first adding guarantee to guarantor record) and (2) if there is already a guarantor added to a guarantee This patchfix will pre-fill guarantor fields if no relationship (existing guarantor data exists) and a guarantorid is handed to memberenty.pl in URL when clicking 'Add guarantee' button on Adults patron record. Test plan: 1. Add adult patron 2. Select 'Add guarantee' 3. Observe no details of the adult patron are displaying in the 'Guarantor information' section of the memberentry.pl page 4. Select 'Search to add', search for your adult patron and choose 'Select' to add them as guarantor 5. Fill out rest of memberentry.pl and 'Save' 6. Observe adult is showing as the guarantor 7. Apply patch 8. Run tests: sudo koha-shell prove xt prove t 9. Confirm tests pass 10. Return to your adult patron 11. Select 'Add guarantee' 12. Observe in 'Guarantor information' section of memberentry.pl pre-filled is the 'patron #' (borrowernumber), surname, firstname 13. Fill out the rest of memberenty.pl and save and confirm your adult patron is showing as the guarantor 14. Repeat steps 10,11 and 12 and in the 'Guarantor information' select 'Searcg to add' and add another adult as guarantor 15. Fill out the rest of memberentry.pl and 'Save' and notice with this patch applied you can still add multiple guarantors successfully Sponsored-By: South Taranaki Distict Libraries, NZ --- .../prog/en/modules/members/memberentrygen.tt | 2 +- members/memberentry.pl | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) 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 2957ae1a1f..de721d2447 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -325,7 +325,7 @@ Guarantor information - [% IF Koha.Preference('RevertToAutoPopulatingGuarantorInfo') && (!relationships) %] + [% IF (!relationships) %]
  • Patron #: [% IF guarantorid %] diff --git a/members/memberentry.pl b/members/memberentry.pl index ab8ba335c7..add7e75e29 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -238,7 +238,15 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) # Use default 19.11 behaviour (Introduced by bug 14570) if RevertAutoPopulatingGuarantorInfo local use syspref is disabled, otherwise pre-populate guarantor info # when creating a guarantee/child from a guarantor/adult -if (C4::Context->preference('RevertToAutoPopulatingGuarantorInfo')) { + +## Deal with guarantor stuff +$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron; +my $guarantor_id = $input->param('guarantor_id'); +my $guarantor = undef; +$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id; +$template->param( guarantor => $guarantor ); + +if (!$patron) { #recover all data from guarantor address phone ,fax... if ( $guarantorid ) { if (my $guarantor = Koha::Patrons->find( $guarantorid )) { @@ -260,13 +268,6 @@ if (C4::Context->preference('RevertToAutoPopulatingGuarantorInfo')) { } } -## Deal with guarantor stuff -$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron; -my $guarantor_id = $input->param('guarantor_id'); -my $guarantor = undef; -$guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id; -$template->param( guarantor => $guarantor ); - my @delete_guarantor = $input->multi_param('delete_guarantor'); foreach my $id ( @delete_guarantor ) { my $r = Koha::Patron::Relationships->find( $id ); -- 2.11.0