Bugzilla – Attachment 95834 Details for
Bug 24113
guarantor info lost when a duplicate is found
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24113: guarantor info lost when a duplicate is found
Bug-24113-guarantor-info-lost-when-a-duplicate-is-.patch (text/plain), 3.70 KB, created by
Kyle M Hall (khall)
on 2019-11-26 15:28:12 UTC
(
hide
)
Description:
Bug 24113: guarantor info lost when a duplicate is found
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-11-26 15:28:12 UTC
Size:
3.70 KB
patch
obsolete
>From 2c8b3504394ca7ed73bdfb7da3344c8e3dc3ec0f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 26 Nov 2019 10:23:36 -0500 >Subject: [PATCH] Bug 24113: guarantor info lost when a duplicate is found > >When a patron is created with a guarantor but a duplicate is found (or any other warnings I guess) the guarantor's info are lost. > >This patch improves on previous functionality by retaining the select guarantor relationship as well. > >Test Plan: >1) Create a new child with a name already used, add a guarantor >2) Attempt to save, no the guarantor is not shown when the editor is redisplayed >3) Apply this patch >4) Restart all the things! >5) Repeat 1 >6) Note the guarantor is retained and the relationship is as well! >--- > .../prog/en/modules/members/memberentrygen.tt | 6 ++++-- > koha-tmpl/intranet-tmpl/prog/js/members.js | 6 +++++- > members/memberentry.pl | 13 +++++++++++++ > 3 files changed, 22 insertions(+), 3 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 4bbd2640ea..a2c491c98b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1247,8 +1247,10 @@ > } > [% END %] > >- [% IF guarantor %] >- select_user( '[% guarantor.borrowernumber | html %]', [% To.json( guarantor.unblessed ) | $raw %] ); >+ [% IF new_guarantors %] >+ [% FOREACH g IN new_guarantors %] >+ select_user( '[% g.patron.borrowernumber | html %]', [% To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]' ); >+ [% END %] > [% END %] > > $("#cn_max").hide(); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index ec2d58d8a2..2fbdbb0563 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -165,7 +165,7 @@ function update_category_code(category_code) { > $(mytables).find(" li[data-category_code='']").show(); > } > >-function select_user(borrowernumber, borrower) { >+function select_user(borrowernumber, borrower, relationship) { > let is_guarantor = $(`.guarantor-details[data-borrowernumber=${borrower.borrowernumber}]`).length; > console.log("LEN: " + is_guarantor ); > >@@ -207,6 +207,10 @@ function select_user(borrowernumber, borrower) { > > $('#guarantor_relationships').append( fieldset ); > fieldset.show(); >+ >+ if ( relationship ) { >+ fieldset.find('.new_guarantor_relationship').val(relationship); >+ } > } > > return 0; >diff --git a/members/memberentry.pl b/members/memberentry.pl >index fa5cbe427e..2471457a45 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -261,6 +261,19 @@ if ( ( $op eq 'insert' ) and !$nodouble ) { > if ( $patrons->count > 0) { > $nodouble = 0; > $check_member = $patrons->next->borrowernumber; >+ >+ >+ my @new_guarantors; >+ my @new_guarantor_id = $input->multi_param('new_guarantor_id'); >+ my @new_guarantor_relationship = $input->multi_param('new_guarantor_relationship'); >+ foreach my $gid ( @new_guarantor_id ) { >+ my $patron = Koha::Patrons->find( $gid ); >+ my $relationship = shift( @new_guarantor_relationship ); >+ next unless $patron; >+ my $g = { patron => $patron, relationship => $relationship }; >+ push( @new_guarantors, $g ); >+ } >+ $template->param( new_guarantors => \@new_guarantors ); > } > } > >-- >2.21.0 (Apple Git-122.2)
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 24113
:
95834
|
95835
|
95843