Bugzilla – Attachment 77075 Details for
Bug 14570
Make it possible to add multiple guarantors to a record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14570 [QA Followup]: Remove ability to add multiple non-koha patrons as guarantors, bring back contact fields
Bug-14570-QA-Followup-Remove-ability-to-add-multip.patch (text/plain), 39.81 KB, created by
Kyle M Hall (khall)
on 2018-07-18 13:29:40 UTC
(
hide
)
Description:
Bug 14570 [QA Followup]: Remove ability to add multiple non-koha patrons as guarantors, bring back contact fields
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-07-18 13:29:40 UTC
Size:
39.81 KB
patch
obsolete
>From f0c8bdadb73be3aad44e7bd234cdf9ab1a15ea23 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 17 Jul 2018 10:07:35 -0400 >Subject: [PATCH] Bug 14570 [QA Followup]: Remove ability to add multiple > non-koha patrons as guarantors, bring back contact fields > >--- > Koha/Patron.pm | 32 +-- > Koha/Patrons/Import.pm | 9 +- > Koha/Schema/Result/BorrowerRelationship.pm | 18 +- > installer/data/mysql/atomicupdate/bug_14570.sql | 10 +- > installer/data/mysql/kohastructure.sql | 10 +- > .../prog/en/modules/members/memberentrygen.tt | 253 ++++++++++----------- > .../prog/en/modules/members/moremember-brief.tt | 41 ++-- > .../prog/en/modules/members/moremember.tt | 10 +- > koha-tmpl/intranet-tmpl/prog/js/members.js | 67 +++--- > .../bootstrap/en/modules/opac-memberentry.tt | 4 +- > .../opac-tmpl/bootstrap/en/modules/opac-privacy.tt | 2 +- > members/memberentry.pl | 10 +- > t/db_dependent/Patron/Relationships.t | 18 +- > 13 files changed, 204 insertions(+), 280 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 366be8684c..825fae0c88 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1059,13 +1059,11 @@ sub generate_userid { > my @relationships = $patron->add_guarantor( > { > borrowernumber => $borrowernumber, >- surname => $surname, >- firstname => $firstname, > relationships => $relationship, > } > ); > >- Adds a new guarantor to a patron, requires either an id ( borrowernumber ) or surname. >+ Adds a new guarantor to a patron. > > =cut > >@@ -1073,29 +1071,15 @@ sub add_guarantor { > my ( $self, $params ) = @_; > > my $guarantor_id = $params->{guarantor_id}; >- my $surname = $params->{surname}; >- my $firstname = $params->{firstname}; > my $relationship = $params->{relationship}; > >- if ($guarantor_id) { >- return Koha::Patron::Relationship->new( >- { >- guarantee_id => $self->id, >- guarantor_id => $guarantor_id, >- relationship => $relationship >- } >- )->store(); >- } >- elsif ($surname) { >- return Koha::Patron::Relationship->new( >- { >- guarantee_id => $self->id, >- surname => $surname, >- firstname => $firstname, >- relationship => $relationship >- } >- )->store(); >- } >+ return Koha::Patron::Relationship->new( >+ { >+ guarantee_id => $self->id, >+ guarantor_id => $guarantor_id, >+ relationship => $relationship >+ } >+ )->store(); > } > > =head2 Internal methods >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index 007b427e58..4d17bde3bf 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -215,12 +215,8 @@ sub import_patrons { > > my $relationship = $borrower{relationship}; > my $guarantor_id = $borrower{guarantor_id}; >- my $guarantor_firstname = $borrower{guarantor_firstname}; >- my $guarantor_surname = $borrower{guarantor_surname}; > delete $borrower{relationship}; > delete $borrower{guarantor_id}; >- delete $borrower{guarantor_firstname}; >- delete $borrower{guarantor_surname}; > > if ($borrowernumber) { > >@@ -359,15 +355,12 @@ sub import_patrons { > } > > # Add a guarantor if we are given a relationship >- if ( $relationship ) { >- $guarantor_id ||= undef; >+ if ( $guarantor_id ) { > Koha::Patron::Relationship->new( > { > guarantee_id => $borrowernumber, > relationship => $relationship, > guarantor_id => $guarantor_id, >- firstname => $guarantor_firstname, >- surname => $guarantor_surname, > } > )->store(); > } >diff --git a/Koha/Schema/Result/BorrowerRelationship.pm b/Koha/Schema/Result/BorrowerRelationship.pm >index 5445d44f10..88cef4f294 100644 >--- a/Koha/Schema/Result/BorrowerRelationship.pm >+++ b/Koha/Schema/Result/BorrowerRelationship.pm >@@ -47,16 +47,6 @@ __PACKAGE__->table("borrower_relationships"); > is_nullable: 0 > size: 100 > >-=head2 surname >- >- data_type: 'mediumtext' >- is_nullable: 1 >- >-=head2 firstname >- >- data_type: 'mediumtext' >- is_nullable: 1 >- > =cut > > __PACKAGE__->add_columns( >@@ -68,10 +58,6 @@ __PACKAGE__->add_columns( > { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, > "relationship", > { data_type => "varchar", is_nullable => 0, size => 100 }, >- "surname", >- { data_type => "mediumtext", is_nullable => 1 }, >- "firstname", >- { data_type => "mediumtext", is_nullable => 1 }, > ); > > =head1 PRIMARY KEY >@@ -124,8 +110,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-07-17 11:22:45 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YKFiZSR3WRi1nvtLOdGV9A >+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-07-18 10:52:59 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:R8RThgcrct40Zq0UMW3TWQ > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/installer/data/mysql/atomicupdate/bug_14570.sql b/installer/data/mysql/atomicupdate/bug_14570.sql >index 9c8e987a96..b0bb359d43 100644 >--- a/installer/data/mysql/atomicupdate/bug_14570.sql >+++ b/installer/data/mysql/atomicupdate/bug_14570.sql >@@ -3,8 +3,6 @@ CREATE TABLE `borrower_relationships` ( > guarantor_id INT(11) NULL DEFAULT NULL, > guarantee_id INT(11) NOT NULL, > relationship VARCHAR(100) COLLATE utf8_unicode_ci NOT NULL, >- surname MEDIUMTEXT COLLATE utf8_unicode_ci NULL DEFAULT NULL, >- firstname MEDIUMTEXT COLLATE utf8_unicode_ci NULL DEFAULT NULL, > PRIMARY KEY (id), > CONSTRAINT r_guarantor FOREIGN KEY ( guarantor_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE, > CONSTRAINT r_guarantee FOREIGN KEY ( guarantee_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE >@@ -12,8 +10,8 @@ CREATE TABLE `borrower_relationships` ( > > UPDATE borrowers LEFT JOIN borrowers guarantor ON ( borrowers.guarantorid = guarantor.borrowernumber ) SET borrowers.guarantorid = NULL WHERE guarantor.borrowernumber IS NULL; > >-INSERT INTO borrower_relationships ( guarantor_id, guarantee_id, relationship, surname, firstname ) SELECT guarantorid, borrowernumber, relationship, contactname, contactfirstname FROM borrowers WHERE guarantorid IS NOT NULL OR contactname != ""; >+INSERT INTO borrower_relationships ( guarantor_id, guarantee_id, relationship ) SELECT guarantorid, borrowernumber, relationship FROM borrowers WHERE guarantorid IS NOT NULL; > >-ALTER TABLE borrowers DROP guarantorid, DROP relationship, DROP contactname, DROP contactfirstname, DROP contacttitle; >-ALTER TABLE deletedborrowers DROP guarantorid, DROP relationship, DROP contactname, DROP contactfirstname, DROP contacttitle; >-ALTER TABLE borrowermodification DROP guarantorid, DROP relationship, DROP contactname, DROP contactfirstname, DROP contacttitle; >+ALTER TABLE borrowers DROP guarantorid; >+ALTER TABLE deletedborrowers DROP guarantorid; >+ALTER TABLE borrowermodification DROP guarantorid; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 3d04f5b68e..f590ed4d77 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -579,7 +579,11 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower > `lost` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card > `debarred` date default NULL, -- until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYYY-MM-DD) > `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of patron >+ `contactname` LONGTEXT, -- used for children and profesionals to include surname or last name of guarantor or organization name >+ `contactfirstname` MEDIUMTEXT, -- used for children to include first name of guarantor >+ `contacttitle` MEDIUMTEXT, -- used for children to include title (Mr., Mrs., etc) of guarantor > `borrowernotes` LONGTEXT, -- a note on the patron/borrower's account that is only visible in the staff client >+ `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarantor > `sex` varchar(1) default NULL, -- patron/borrower's gender > `password` varchar(60) default NULL, -- patron/borrower's encrypted password > `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions >@@ -1604,7 +1608,11 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons > `lost` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card > `debarred` date default NULL, -- until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYYY-MM-DD) > `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of the patron >+ `contactname` LONGTEXT, -- used for children and profesionals to include surname or last name of guarantor or organization name >+ `contactfirstname` MEDIUMTEXT, -- used for children to include first name of guarantor >+ `contacttitle` MEDIUMTEXT, -- used for children to include title (Mr., Mrs., etc) of guarantor > `borrowernotes` LONGTEXT, -- a note on the patron/borrower's account that is only visible in the staff client >+ `relationship` varchar(100) default NULL, -- used for children to include the relationship to their guarantor > `sex` varchar(1) default NULL, -- patron/borrower's gender > `password` varchar(60) default NULL, -- patron/borrower's Bcrypt encrypted password > `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions >@@ -4106,8 +4114,6 @@ CREATE TABLE `borrower_relationships` ( > guarantor_id INT(11) NULL DEFAULT NULL, > guarantee_id INT(11) NOT NULL, > relationship VARCHAR(100) COLLATE utf8_unicode_ci NOT NULL, >- surname MEDIUMTEXT COLLATE utf8_unicode_ci NULL DEFAULT NULL, >- firstname MEDIUMTEXT COLLATE utf8_unicode_ci NULL DEFAULT NULL, > PRIMARY KEY (id), > CONSTRAINT r_guarantor FOREIGN KEY ( guarantor_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE, > CONSTRAINT r_guarantee FOREIGN KEY ( guarantee_id ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE >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 21cb5b7bad..e57a1deac3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -308,45 +308,31 @@ > <fieldset class="rows"> > <ol> > [% IF category_type == 'P' %] >- [% IF ( r.guarantor_id ) %] >- <li id="contact-details"> >- [% ELSE %] >- <li id="contact-details" style="display: none"> >- [% END %] >+ <li id="contact-details"> > <span class="label">Organization #:</span> [% IF ( r.guarantor_id ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id %]" target="blank">[% r.guarantor_id %]</a>[% END %] > </li> > > <li> > <label for="guarantor_surname">Organization name: </label> >- [% IF ( r.guarantor_id ) %] >- <span>[% r.guarantor.surname %]</span> >- [% END %] >+ <span>[% r.guarantor.surname %]</span> > </li> > [% ELSE %] >- [% IF ( r.guarantor_id ) %] >- <li id="contact-details"> >- [% ELSE %] >- <li id="contact-details" style="display: none"> >- [% END %] >- >+ <li id="contact-details"> > <span class="label">Patron #:</span> >- [% IF ( r.guarantor_id ) %] >- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id %]" target="blank">[% r.guarantor_id %]</a> >- [% END %] >- >+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id %]" target="blank">[% r.guarantor_id %]</a> > </li> > >- [% IF r.surname || r.guarantor.surname %] >+ [% IF r.guarantor.surname %] > <li> > <label for="guarantor_surname">Surname: </label> >- <span>[% r.surname || r.guarantor.surname %]</span> >+ <span>[% r.guarantor.surname %]</span> > </li> > [% END %] > >- [% IF r.firstname || r.guarantor.firstname %] >+ [% IF r.guarantor.firstname %] > <li> > <label for="guarantor_firstname">First name: </label> >- <span>[% r.firstname || r.guarantor.firstname %]</span> >+ <span>[% r.guarantor.firstname %]</span> > </li> > [% END %] > >@@ -401,44 +387,13 @@ > </ol> > </fieldset> > >- <fieldset class="rows"> >- <legend>Add new guarantor</legend> > <ol> >- <input type="hidden" id="guarantor_id" value=""/> >- >- [% IF catetory_type == 'P' %] >- <li> >- <label for="guarantor_surname">Organization name: </label> >- <input name="guarantor_surname" id="guarantor_surname" type="hidden" size="20"/> >- </li> >- [% ELSE %] >- <li> >- <label for="guarantor_surname">Surname: </label> >- <input name="guarantor_surname" id="guarantor_surname" type="text" size="20" /> >- </li> >- >- <li> >- <label for="guarantor_firstname">First name: </label> >- <input name="guarantor_firstname" id="guarantor_firstname" type="text" size="20" /> >- </li> >- >- [% IF ( possible_relationships ) %] >- <li> >- <label for="relationship">Relationship: </label> >- <select name="relationship" id="relationship" > >- [% FOREACH pr IN possible_relationships.split('\|') %] >- <option value="[% pr %]">[% pr %]</option> >- [% END %] >- </select> >- </li> >- [% END %] >- [% END %] >+ <input type="hidden" id="guarantor_id" value="" /> >+ <input name="guarantor_surname" id="guarantor_surname" type="hidden" /> >+ <input name="guarantor_firstname" id="guarantor_firstname" type="hidden" /> > > <li> >- <span class="label"> </span> >- <a href="#" id="guarantor_add" class="btn btn-sm"><i class="fa fa-plus"></i> Add guarantor</a> >- <a href="#" id="guarantor_search" class="btn btn-sm"><i class="fa fa-search"></i> Set to patron</a> >- <a href="#" id="guarantor_clear">Clear</a> >+ <a href="#" id="guarantor_search" class="btn btn-sm"><i class="fa fa-search"></i> Search</a> > </li> > > [% IF relationships && Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %] >@@ -457,7 +412,6 @@ > </li> > [% END %] > </ol> >- </fieldset> > </fieldset> > [% END %] > >@@ -471,84 +425,132 @@ > [% END # nostreet && nocity etc group%] > > [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %] >- <fieldset class="rows" id="memberentry_contact"> >- <legend id="contact_lgd">Contact</legend><ol> >- [% UNLESS nophone %] >- <li> >- [% IF ( mandatoryphone ) %] >- <label for="phone" class="required"> >- [% ELSE %] >- <label for="phone"> >- [% END %] >- Primary phone: </label> >- <input type="text" id="phone" name="phone" value="[% phone | html %]" /> >- [% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div> >+ <fieldset class="rows" id="memberentry_contact"> >+ <legend id="contact_lgd">Contact</legend><ol> > >- </li> >+ [% UNLESS nocontactname %] >+ <li> >+ [% IF ( mandatorycontactname ) %] >+ <label for="contactname" class="required"> >+ [% ELSE %] >+ <label for="contactname"> >+ [% END %] >+ Guarantor surname: </label> >+ <input type="text" id="contactname" name="contactname" value="[% contactname | html %]" /> >+ [% IF ( mandatorycontactname ) %]<span class="required">Required</span>[% END %]<div class="hint">Non-patron guarantor surname</div> >+ </li> >+ [% END %] >+ >+ [% UNLESS nocontactfirstname %] >+ <li> >+ [% IF ( mandatorycontactfirstname ) %] >+ <label for="contactfirstname" class="required"> >+ [% ELSE %] >+ <label for="contactfirstname"> >+ [% END %] >+ Guarantor first name: </label> >+ <input type="text" id="contactfirstname" name="contactfirstname" value="[% contactfirstname | html %]" /> >+ [% IF ( mandatorycontactfirstname ) %]<span class="required">Required</span>[% END %]<div class="hint">Non-patron guarantor first name</div> >+ </li> >+ [% END %] >+ >+ [% UNLESS norelationship %] >+ [% IF possible_relationships %] >+ <li> >+ <label for="relationship">Relationship: </label> >+ <select class="relationship" name="relationship"> >+ <option value=""></option> >+ [% FOREACH pr IN possible_relationships.split('\|') %] >+ [% IF pr == relationship %] >+ <option value="[% pr %]" selected="selected">[% pr %]</option> >+ [% ELSE %] >+ <option value="[% pr %]">[% pr %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ [% END %] >+ [% END %] >+ >+ [% UNLESS nophone %] >+ <li> >+ [% IF ( mandatoryphone ) %] >+ <label for="phone" class="required"> >+ [% ELSE %] >+ <label for="phone"> >+ [% END %] >+ Primary phone: </label> >+ <input type="text" id="phone" name="phone" value="[% phone | html %]" /> >+ [% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div> >+ </li> > [% END %] >+ > [% UNLESS nophonepro %] >- <li> >- [% IF ( mandatoryphonepro ) %] >- <label for="phonepro" class="required"> >- [% ELSE %] >- <label for="phonepro"> >- [% END %] >- Secondary phone: </label> >- <input type="text" id="phonepro" name="phonepro" value="[% phonepro | html %]" /> >- [% IF ( mandatoryphonepro ) %]<span class="required">Required</span>[% END %] >- </li> >+ <li> >+ [% IF ( mandatoryphonepro ) %] >+ <label for="phonepro" class="required"> >+ [% ELSE %] >+ <label for="phonepro"> >+ [% END %] >+ Secondary phone: </label> >+ <input type="text" id="phonepro" name="phonepro" value="[% phonepro | html %]" /> >+ [% IF ( mandatoryphonepro ) %]<span class="required">Required</span>[% END %] >+ </li> > [% END %] >+ > [% UNLESS nomobile %] >- <li> >- [% IF ( mandatorymobile ) %] >- <label for="mobile" class="required"> >- [% ELSE %] >- <label for="mobile"> >- [% END %] >- Other phone: </label> >- <input type="text" id="mobile" name="mobile" value="[% mobile | html %]" /> >- [% IF ( mandatorymobile ) %]<span class="required">Required</span>[% END %] >- </li> >+ <li> >+ [% IF ( mandatorymobile ) %] >+ <label for="mobile" class="required"> >+ [% ELSE %] >+ <label for="mobile"> >+ [% END %] >+ Other phone: </label> >+ <input type="text" id="mobile" name="mobile" value="[% mobile | html %]" /> >+ [% IF ( mandatorymobile ) %]<span class="required">Required</span>[% END %] >+ </li> > [% END %] >- [% UNLESS noemail %] >- <li> >- [% IF ( mandatoryemail ) %] >- <label for="email" class="required"> >- [% ELSE %] >- <label for="email"> >- [% END %] >- Primary email: </label> >- <input type="text" id="email" name="email" size="45" value="[% email | html %]" /> >- [% IF ( mandatoryemail ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div> > >- </li> >+ [% UNLESS noemail %] >+ <li> >+ [% IF ( mandatoryemail ) %] >+ <label for="email" class="required"> >+ [% ELSE %] >+ <label for="email"> >+ [% END %] >+ Primary email: </label> >+ <input type="text" id="email" name="email" size="45" value="[% email | html %]" /> >+ [% IF ( mandatoryemail ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div> >+ </li> > [% END %] >+ > [% UNLESS noemailpro %] >- <li> >- [% IF ( mandatoryemailpro ) %] >- <label for="emailpro" class="required"> >- [% ELSE %] >- <label for="emailpro"> >- [% END %] >- Secondary email: </label> >- <input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro | html %]" /> >- [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %] >- </li> >+ <li> >+ [% IF ( mandatoryemailpro ) %] >+ <label for="emailpro" class="required"> >+ [% ELSE %] >+ <label for="emailpro"> >+ [% END %] >+ Secondary email: </label> >+ <input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro | html %]" /> >+ [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %] >+ </li> > [% END %] >+ > [% UNLESS nofax %] >- <li> >- [% IF ( mandatoryfax ) %] >- <label for="fax" class="required"> >- [% ELSE %] >- <label for="fax"> >- [% END %] >- Fax: </label> >- <input type="text" id="fax" name="fax" value="[% fax | html %]" /> >- [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %] >- </li> >+ <li> >+ [% IF ( mandatoryfax ) %] >+ <label for="fax" class="required"> >+ [% ELSE %] >+ <label for="fax"> >+ [% END %] >+ Fax: </label> >+ <input type="text" id="fax" name="fax" value="[% fax | html %]" /> >+ [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %] >+ </li> > [% END %] >- </ol> >- </fieldset> >+ </ol> >+</fieldset> > [%END # hide fieldset %] > > <!-- ************************ STEP_1 *********************** --> >@@ -1254,9 +1256,6 @@ > > [% IF guarantor %] > select_user( '[% guarantor.borrowernumber %]', [% To.json( guarantor.unblessed ) %] ); >- $('#guarantor_add').ready(function() { >- $('#guarantor_add').click(); >- }); > [% END %] > > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >index 398756638a..e15f0e3c31 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt >@@ -42,35 +42,26 @@ > [% IF ( dateofbirth ) %]<li><span class="label">Date of birth:</span>[% dateofbirth | $KohaDates %]</li>[% END %] > [% IF ( sex ) %]<li><span class="label">Gender:</span>[% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]</li>[% END %][% END %] > [% END %] >- [% IF ( isguarantee ) %] >- [% IF ( guaranteeloop ) %] >- <li><span class="label">Guarantees:</span><ul>[% FOREACH guaranteeloo IN guaranteeloop %]<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %] </a></li>[% END %]</ul></li> >- [% END %] >- [% ELSE %] >- [% IF guarantees %] >- <li> >- <span class="label">Guarantees:</span> >- <ul> >- [% FOREACH guarantee IN guarantees %] >- <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname %] [% guarantee.surname %]</a></li> >- [% END %] >- </ul> >- </li> >- [% ELSIF guarantor_relationships %] >- [% FOREACH gr IN guarantor_relationships %] >+ >+ [% IF guarantees %] > <li> >- <span class="label">Guarantor:</span> >- [% IF gr.guarantor_id %] >+ <span class="label">Guarantees:</span> >+ <ul> >+ [% FOREACH guarantee IN guarantees %] >+ <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber %]">[% guarantee.firstname %] [% guarantee.surname %]</a></li> >+ [% END %] >+ </ul> >+ </li> >+ [% ELSIF guarantor_relationships %] >+ [% FOREACH gr IN guarantor_relationships %] >+ <li> >+ <span class="label">Guarantor:</span> > [% SET guarantor = gr.guarantor %] > <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.id %]">[% guarantor.firstname %] [% guarantor.surname %]</a> >- [% ELSE %] >- [% gr.firstname %] [% gr.surname %] >- [% END %] >- </li> >+ </li> >+ [% END %] > [% END %] >- [% END %] >- [% END %] >- </ol> >+ </ol> > </div> > </div> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index cffd512ef6..86da08482c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -222,13 +222,9 @@ > [% FOREACH gr IN guarantor_relationships %] > <li> > <span class="label">Guarantor:</span> >- [% IF gr.guarantor_id %] >- [% SET guarantor = gr.guarantor %] >- [% IF logged_in_user.can_see_patron_infos( guarantor ) %] >- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.id %]">[% guarantor.firstname | html %] [% guarantor.surname | html %]</a> >- [% END %] >- [% ELSE %] >- [% gr.firstname | html %] [% gr.surname | html %] >+ [% SET guarantor = gr.guarantor %] >+ [% IF logged_in_user.can_see_patron_infos( guarantor ) %] >+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.id %]">[% guarantor.firstname | html %] [% guarantor.surname | html %]</a> > [% END %] > </li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index 8ef5707474..7f1774e7df 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -170,7 +170,34 @@ function select_user(borrowernumber, borrower) { > $('#guarantor_surname').val(borrower.surname); > $('#guarantor_firstname').val(borrower.firstname); > >- $('#guarantor_add').click(); >+ var fieldset = $('#guarantor_template').clone(); >+ fieldset.removeAttr('id'); >+ >+ var guarantor_id = $('#guarantor_id').val(); >+ if ( guarantor_id ) { >+ fieldset.find('.new_guarantor_id').first().val( guarantor_id ); >+ fieldset.find('.new_guarantor_id_text').first().text( guarantor_id ); >+ } else { >+ fieldset.find('.guarantor_id').first().hide(); >+ } >+ $('#guarantor_id').val(""); >+ >+ var guarantor_surname = $('#guarantor_surname').val(); >+ fieldset.find('.new_guarantor_surname').first().val( guarantor_surname ); >+ fieldset.find('.new_guarantor_surname_text').first().text( guarantor_surname ); >+ $('#guarantor_surname').val(""); >+ >+ var guarantor_firstname = $('#guarantor_firstname').val(); >+ fieldset.find('.new_guarantor_firstname').first().val( guarantor_firstname ); >+ fieldset.find('.new_guarantor_firstname_text').first().text( guarantor_firstname ); >+ $('#guarantor_firstname').val(""); >+ >+ var guarantor_relationship = $('#relationship').val(); >+ fieldset.find('.new_guarantor_relationship').first().val( guarantor_relationship ); >+ $('#relationship').find('option:eq(0)').prop('selected', true);; >+ >+ $('#guarantor_relationships').append( fieldset ); >+ fieldset.show(); > > return 0; > } >@@ -256,44 +283,6 @@ $(document).ready(function(){ > $(this).parents('fieldset').first().remove(); > }); > >- $('#guarantor_add').on('click', function(e) { >- e.preventDefault(); >- var fieldset = $('#guarantor_template').clone(); >- fieldset.removeAttr('id'); >- >- var guarantor_id = $('#guarantor_id').val(); >- if ( guarantor_id ) { >- fieldset.find('.new_guarantor_id').first().val( guarantor_id ); >- fieldset.find('.new_guarantor_id_text').first().text( guarantor_id ); >- } else { >- fieldset.find('.guarantor_id').first().hide(); >- } >- $('#guarantor_id').val(""); >- >- var guarantor_surname = $('#guarantor_surname').val(); >- fieldset.find('.new_guarantor_surname').first().val( guarantor_surname ); >- fieldset.find('.new_guarantor_surname_text').first().text( guarantor_surname ); >- $('#guarantor_surname').val(""); >- >- var guarantor_firstname = $('#guarantor_firstname').val(); >- fieldset.find('.new_guarantor_firstname').first().val( guarantor_firstname ); >- fieldset.find('.new_guarantor_firstname_text').first().text( guarantor_firstname ); >- $('#guarantor_firstname').val(""); >- >- var guarantor_relationship = $('#relationship').val(); >- fieldset.find('.new_guarantor_relationship').first().val( guarantor_relationship ); >- $('#relationship').find('option:eq(0)').prop('selected', true);; >- >- $('#guarantor_relationships').append( fieldset ); >- fieldset.show(); >- }); >- >- $("#guarantor_clear").click(function(e) { >- e.preventDefault(); >- $("#contact-details").hide().find('a').remove(); >- $("#guarantor_id, #guarantor_surname, #guarantor_firstname").val(""); >- }); >- > $(document.body).on('change','select[name="select_city"]',function(){ > $('select[name="select_city"]').val( $(this).val() ); > var myRegEx=new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >index 28221dc944..3c83be47f7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -121,7 +121,7 @@ > Guaranteed by > [% FOREACH gr IN patron.guarantor_relationships %] > [% SET g = gr.guarantor %] >- [% g.firstname || gr.firstname %] [% g.surname || gr.surname %] >+ [% g.firstname %] [% g.surname %] > [%- IF ! loop.last %], [% END %] > [% END %] > </span> >@@ -1002,7 +1002,7 @@ > } > }); > >- [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %] >+ [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %] > $('#update_privacy_guarantor_checkouts').click( function() { > $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json') > .done(function( data ) { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >index 99314bd261..71a4724d54 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt >@@ -87,7 +87,7 @@ > Guaranteed by > [% FOREACH gr IN borrower.guarantor_relationships %] > [% SET g = gr.guarantor %] >- [% g.firstname || gr.firstname %] [% g.surname || gr.surname %] >+ [% g.firstname %] [% g.surname %] > [%- IF ! loop.last %], [% END %] > [% END %] > </span> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 00b79b1909..a954779548 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -896,23 +896,19 @@ sub add_guarantors { > my ( $patron, $input ) = @_; > > my @new_guarantor_id = $input->multi_param('new_guarantor_id'); >- my @new_guarantor_surname = $input->multi_param('new_guarantor_surname'); >- my @new_guarantor_firstname = $input->multi_param('new_guarantor_firstname'); > my @new_guarantor_relationship = $input->multi_param('new_guarantor_relationship'); > > for ( my $i = 0 ; $i < scalar @new_guarantor_id; $i++ ) { > my $guarantor_id = $new_guarantor_id[$i]; >- my $surname = $new_guarantor_surname[$i]; >- my $firstname = $new_guarantor_firstname[$i]; > my $relationship = $new_guarantor_relationship[$i]; > >+ next unless $guarantor_id; >+ > $patron->add_guarantor( > { > guarantee_id => $patron->id, > guarantor_id => $guarantor_id, >- surname => $surname, >- firstname => $firstname, >- relationship => $relationship >+ relationship => $relationship, > } > ); > } >diff --git a/t/db_dependent/Patron/Relationships.t b/t/db_dependent/Patron/Relationships.t >index 4aec07af88..5bc5b2308b 100755 >--- a/t/db_dependent/Patron/Relationships.t >+++ b/t/db_dependent/Patron/Relationships.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 67; >+use Test::More tests => 59; > > use C4::Context; > >@@ -92,10 +92,6 @@ Koha::Patron::Relationship->new({ guarantor_id => $kyle->id, guarantee_id => $da > Koha::Patron::Relationship->new({ guarantor_id => $kyle->id, guarantee_id => $kylie->id, relationship => 'father' })->store(); > Koha::Patron::Relationship->new({ guarantor_id => $chelsea->id, guarantee_id => $daria->id, relationship => 'mother' })->store(); > Koha::Patron::Relationship->new({ guarantor_id => $chelsea->id, guarantee_id => $kylie->id, relationship => 'mother' })->store(); >-Koha::Patron::Relationship->new({ firstname => 'John', surname => 'Hall', guarantee_id => $daria->id, relationship => 'grandfather' })->store(); >-Koha::Patron::Relationship->new({ firstname => 'Debra', surname => 'Hall', guarantee_id => $daria->id, relationship => 'grandmother' })->store(); >-Koha::Patron::Relationship->new({ firstname => 'John', surname => 'Hall', guarantee_id => $kylie->id, relationship => 'grandfather' })->store(); >-Koha::Patron::Relationship->new({ firstname => 'Debra', surname => 'Hall', guarantee_id => $kylie->id, relationship => 'grandmother' })->store(); > > my @gr; > >@@ -136,7 +132,7 @@ is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Pa > is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' ); > > @gr = $daria->guarantor_relationships(); >-is( @gr, 4, 'Found 4 guarantor relationships for child' ); >+is( @gr, 2, 'Found 4 guarantor relationships for child' ); > is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' ); > is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' ); > is( $gr[0]->relationship, 'father', 'Relationship is father' ); >@@ -153,16 +149,6 @@ is( $gr[1]->guarantee->id, $daria->id, 'Koha::Patron returned is the correct gua > is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' ); > is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' ); > >-is( $gr[2]->guarantor_id, undef, 'Grandfather has no id, not a Koha patron' ); >-is( $gr[2]->firstname, 'John', 'Grandfather has first name of John' ); >-is( $gr[2]->surname, 'Hall', 'Grandfather has surname of Hall' ); >-is( $gr[2]->guarantor, undef, 'Calling guarantor method for Grandfather returns undef' ); >- >-is( $gr[3]->guarantor_id, undef, 'Grandmother has no id, not a Koha patron' ); >-is( $gr[3]->firstname, 'Debra', 'Grandmother has first name of John' ); >-is( $gr[3]->surname, 'Hall', 'Grandmother has surname of Hall' ); >-is( $gr[3]->guarantor, undef, 'Calling guarantor method for Grandmother returns undef' ); >- > my @siblings = $daria->siblings; > is( @siblings, 1, 'Method siblings called in list context returns list' ); > is( ref($siblings[0]), 'Koha::Patron', 'List contains a Koha::Patron' ); >-- >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 14570
:
52400
|
52401
|
52402
|
52403
|
52406
|
52407
|
58146
|
58147
|
58159
|
58202
|
58391
|
58399
|
58412
|
58688
|
58689
|
58739
|
58762
|
58763
|
58764
|
58834
|
58835
|
58836
|
58837
|
58838
|
58839
|
58949
|
58950
|
58951
|
58952
|
58953
|
58954
|
58972
|
58973
|
58974
|
58975
|
58976
|
58977
|
58978
|
58979
|
58980
|
62450
|
62451
|
62452
|
64124
|
64125
|
64126
|
71160
|
71161
|
71162
|
71163
|
73283
|
73284
|
73583
|
73584
|
74950
|
74951
|
74952
|
74953
|
74954
|
74976
|
74977
|
74978
|
74979
|
77029
|
77030
|
77031
|
77032
|
77033
|
77034
|
77040
|
77041
|
77042
|
77043
|
77044
|
77045
|
77046
|
77047
|
77048
|
77049
|
77067
|
77068
|
77069
|
77070
|
77071
|
77072
|
77073
|
77074
|
77075
|
77076
|
77077
|
77078
|
77290
|
77291
|
77346
|
77347
|
77348
|
80842
|
80849
|
81932
|
81933
|
85411
|
85412
|
85431
|
89889
|
89890
|
89891
|
89892
|
89909
|
89910
|
89911
|
89912
|
89921
|
89922
|
89929
|
90048
|
91231
|
91439
|
91440
|
91441
|
91442
|
91443
|
91444
|
91445
|
91694
|
91695
|
91696
|
91697
|
91698
|
91699
|
91700
|
92157
|
92158
|
92161
|
92162
|
92163
|
92180
|
92181
|
92182
|
92183
|
92232
|
92233
|
92234
|
92235
|
92277
|
92278
|
92279
|
92280
|
92281
|
92282
|
92283
|
92284
|
92285
|
92286
|
92287
|
92288
|
92289
|
92290
|
92291
|
92292
|
92298
|
92299
|
92300
|
92301
|
92302
|
92303
|
92304
|
92305
|
92306
|
92307
|
92308
|
92309
|
92310
|
92311
|
92312
|
92313
|
92314
|
92315
|
92316
|
92317
|
92318
|
92319
|
92320
|
92321
|
92322
|
92323
|
92324
|
92325
|
92346
|
92347
|
92348
|
92349
|
92350