Bugzilla – Attachment 29278 Details for
Bug 12446
Enable an adult to have a guarantor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12446 - Enable an adult to have a guarantor
Bug-12446---Enable-an-adult-to-have-a-guarantor.patch (text/plain), 19.91 KB, created by
simith.doliveira
on 2014-06-26 13:38:58 UTC
(
hide
)
Description:
Bug 12446 - Enable an adult to have a guarantor
Filename:
MIME Type:
Creator:
simith.doliveira
Created:
2014-06-26 13:38:58 UTC
Size:
19.91 KB
patch
obsolete
>From bb4fda0053c6d28f4c86bf5a868e1c389e90dc8a Mon Sep 17 00:00:00 2001 >From: simith <simith@inlibro.com> >Date: Thu, 26 Jun 2014 09:36:00 -0400 >Subject: [PATCH] Bug 12446 - Enable an adult to have a guarantor > >This fix fulfil all needs : > >- Enable an adult to have a guarantor; >- Shows guarantees' fines in the guarantor's page; >- Transfer some guarantor's information to the guarantee while creating a new patron or adding a guarantiee; >- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron or adding a guarantiee. > >Modified: > >installer/data/mysql/sysprefs.sql - AdditionalGuarantorField preference >koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc - Change button label "Add child" to "Add guarantiee" >koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref - AdditionalGuarantorField preference >koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tt - Add guarantor information in add/modify Adultes page >koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt - Add guarantor information in add/modify Adultes page >koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt - Add guarantees' fines in the guarantor's page. >members/guarantor_search.pl >members/memberentry.pl >members/moremember.pl - fine calculation > > > >Testing: > >I Apply the patch >II Run updatedatabase.pl to add AdditionalGuarantorField to preference. > >- Enable an adult to have a guarantor: >0) Select an adult patron -> details tab; >1) Validade "Add guarantiee" button; >2) Click edit button; >3) validate "guarantor information" fieldset; > >- Shows guarantees' fines in the guarantor's page: >4) Click Set to patron button and select a guarantor; >5) Generate a fine; >6) Select guarantor patron -> details tab; >7) Validate guarantee's fine information. > >- Transfer some guarantor's information to the guarantee while adding a guarantiee: >0) Select an adult patron; >1) Insert all information; >2) Click Add guarantiee bouton; >3) Validade Garantor information/Main address/Contact fieldsets filled; > >- Transfer some guarantor's information to the guarantee while creating a new patron >0) Select an adult patron; >1) Insert all information; >2) Add a new adult patron; >3) Click "Set to patron" button; >4) Select the adult patron from 0); >5) Validade Garantor information/Main address/Contact fieldsets filled; > >- Transfer some guarantor's information to the guarantee while adding a guarantiee: >0) Select an adult patron; >1) Insert all information; >2) Click Add guarantiee bouton; >3) Validade Garantor information/Main address/Contact fieldsets filled; > >- Transfer guarantor's alternate address/contact to the guarantee while creating a new patron: >0) Search AdditionalGuarantorField preference; >1) Insert some additional database columns from alternate address/contact to be transferred from guarantor; >2) Select an adult patron; >3) Insert all information; >4) Add a new adult patron; >5) Click "Set to patron" button; >6) Select the adult patron from 0); >7) Validade Garantor information/Main address/Contact fieldsets filled; >8) Validade Garantor additional alternate address/contact filled; > >- Transfer guarantor's alternate address/contact to the guarantee while adding a guarantiee: >0) Search AdditionalGuarantorField preference; >1) Insert some additional database columns from alternate address/contact to be transferred from guarantor; >3) Select an adult patron; >4) Insert all information; >5) Click Add guarantiee bouton; >6) Validade Garantor information/Main address/Contact fieldsets filled; >7) Validade Garantor additional alternate address/contact filled; >--- > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/includes/members-toolbar.inc | 2 +- > .../prog/en/modules/admin/preferences/patrons.pref | 5 ++++ > .../prog/en/modules/members/guarantor_search.tt | 33 +++++++++++++++++++++- > .../prog/en/modules/members/memberentrygen.tt | 7 ++--- > .../prog/en/modules/members/moremember.tt | 17 +++++++++-- > members/guarantor_search.pl | 23 +++++++++++++-- > members/memberentry.pl | 14 +++++---- > members/moremember.pl | 22 +++++++++------ > 9 files changed, 100 insertions(+), 24 deletions(-) > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 5e4ce7c..e246328 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -5,6 +5,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'), > ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'), > ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'), >+('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free'), > ('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'), > ('advancedMARCeditor','0','','If ON, the MARC editor won\'t display field/subfield descriptions','YesNo'), > ('AdvancedSearchLanguages','','','ISO 639-2 codes of languages you wish to see appear as an Advanced search option. Example: eng|fre|ita','Textarea'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >index caa2fbf..a290ac6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -110,7 +110,7 @@ function searchToHold(){ > > [% IF ( CAN_user_borrowers ) %] > [% IF ( adultborrower AND activeBorrowerRelationship ) %] >- <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&guarantorid=[% borrowernumber %]&category_type=C"><i class="icon-plus"></i> Add child</a> >+ <a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&guarantorid=[% borrowernumber %]&category_type=C"><i class="icon-plus"></i> Add guarantiee</a> > [% END %] > [% IF ( CAN_user_borrowers ) %] > <a id="changepassword" class="btn btn-small" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]"><i class="icon-lock"></i> Change password</a> >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 2469431..addb76e 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 >@@ -138,3 +138,8 @@ Patrons: > - pref: CardnumberLength > - "characters long. The length can be a single number to specify an exact length, a range separated by a comma (i.e., 'Min,Max'), or a maximum with no minimum (i.e., ',Max')." > - "If 'cardnumber' is included in the BorrowerMandatoryField list, the minimum length, if not specified here, defaults to one." >+ - >+ - "These additional following <a href='http://schema.koha-community.org/tables/borrowers.html' target='blank'>database columns</a> will be transferred from guarantor to guarantee:" >+ - pref: AdditionalGuarantorField >+ class: multi >+ - (separate columns with |) >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tt >index 1e43405..2381101 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tt >@@ -18,6 +18,20 @@ > var zipcode = $('#' + id + 'zipcode').text(); > var country = $('#' + id + 'country').text(); > var branchcode = $('#' + id + 'branchcode').text(); >+ var phone = $('#' + id + 'phone').text(); >+ var phonepro = $('#' + id + 'phonepro').text(); >+ var mobile = $('#' + id + 'mobile').text(); >+ var email = $('#' + id + 'email').text(); >+ var emailpro = $('#' + id + 'emailpro').text(); >+ var fax = $('#' + id + 'fax').text(); >+ >+ $('.' + id + 'extra_field').each(function() { >+ var spanId = $(this).attr('id'); >+ spanId = spanId.replace(id,''); >+ var spanElement = window.opener.document.getElementById(spanId); >+ if (spanElement) >+ window.opener.document.getElementById(spanId).value = $(this).text(); >+ }); > > var $ = window.opener.$; > var form = $('#entryform').get(0); >@@ -48,6 +62,12 @@ > form.zipcode.value = zipcode; > form.country.value = country; > form.branchcode.value = branchcode; >+ form.phone.value = phone; >+ form.phonepro.value = phonepro; >+ form.mobile.value = mobile; >+ form.email.value = email; >+ form.emailpro.value = emailpro; >+ form.fax.value = fax; > > form.guarantorsearch.value = 'Change'; > self.close(); >@@ -103,7 +123,18 @@ > <span id="[% borrowernumber %]zipcode">[% zipcode %]</span> > <span id="[% borrowernumber %]country">[% country %]</span> > <span id="[% borrowernumber %]branchcode">[% branchcode %]</span> >- </span> >+ <span id="[% borrowernumber %]phone">[% phone %]</span> >+ <span id="[% borrowernumber %]phonepro">[% phonepro %]</span> >+ <span id="[% borrowernumber %]mobile">[% mobile %]</span> >+ <span id="[% borrowernumber %]email">[% email %]</span> >+ <span id="[% borrowernumber %]emailpro">[% emailpro %]</span> >+ <span id="[% borrowernumber %]fax">[% fax %]</span> >+ >+ [% FOREACH extrafield IN extrafields %] >+ <span class="[% borrowernumber %]extra_field" id="[% borrowernumber %][% extrafield.field %]">[% extrafield.value %]</span> >+ [% END %] >+ >+ </span> > > <form action=""> > <input type="button" onclick="fillguarantor('[% borrowernumber %]'); return false;" value="Select"/> >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 430543e..39991df 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -383,7 +383,6 @@ > [% END %] > </li> > [% ELSE %] >- [% IF ( C ) %] > [% IF ( guarantorid ) %] > <li id="contact-details"> > [% ELSE %] >@@ -401,9 +400,8 @@ > <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" class="[% focusAction %]" /> > [% END %] > </li> >- [% END %] >- [% UNLESS nocontactfirstname %] >- <li> >+ [% UNLESS nocontactfirstname %] >+<li> > <label for="contactfirstname">First name: </label> > [% IF ( guarantorid ) %] > <span>[% contactfirstname %]</span> >@@ -1275,6 +1273,7 @@ > <li data-category_code="[% patron_attribute.category_code %]"> > <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label> > <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" /> >+ <input type="hidden" id="[% patron_attribute.form_id %]_desc" name="[% patron_attribute.form_id %]_desc" value="[% patron_attribute.description |html %]" /> > [% IF ( patron_attribute.use_dropdown ) %] > <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]"> > <option value=""></option> >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 345c728..1705063 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -249,13 +249,24 @@ function validate1(date) { > [% 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> >+ <li><span class="label">Guarantees:</span> >+ <table>[% FOREACH guaranteeloo IN guaranteeloop %] >+ <tr> >+ <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %]</a></td> >+ <td style='text-align:right'>[% guaranteeloo.finesguarantee %] $</td> >+ </tr>[% END %] >+ <tr> >+ <td>Total</td> >+ <td style='text-align:right'>[% amounttot %] $</td> >+ </tr> >+ </table> >+ </li> > [% END %] >- [% ELSE %] >+ [% END %] > [% IF ( guarantorborrowernumber ) %] > <li><span class="label">Guarantor:</span><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorborrowernumber %]">[% guarantorsurname %], [% guarantorfirstname %]</a></li> > [% END %] >- [% END %] >+ > </ol> > </div> > <div class="action"> >diff --git a/members/guarantor_search.pl b/members/guarantor_search.pl >index e71374e..a72cc82 100755 >--- a/members/guarantor_search.pl >+++ b/members/guarantor_search.pl >@@ -67,6 +67,7 @@ if ( $member ne '' ) { > $count = $results ? @$results : 0; > > for ( my $i = 0 ; $i < $count ; $i++ ) { >+ my @rowextrafields = (); > my %row = ( > count => $i + 1, > borrowernumber => $results->[$i]{'borrowernumber'}, >@@ -83,9 +84,27 @@ if ( $member ne '' ) { > country => $results->[$i]{'country'}, > branchcode => $results->[$i]{'branchcode'}, > dateofbirth => format_date( $results->[$i]{'dateofbirth'} ), >- borrowernotes => $results->[$i]{'borrowernotes'} >+ borrowernotes => $results->[$i]{'borrowernotes'}, >+ phone => $results->[$i]{'phone'}, >+ phonepro => $results->[$i]{'phonepro'}, >+ mobile => $results->[$i]{'mobile'}, >+ email => $results->[$i]{'email'}, >+ emailpro => $results->[$i]{'emailpro'}, >+ fax => $results->[$i]{'fax'} > ); > >+ >+ my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField"); >+ my @field_add=split(/\|/,$additionalGuarantorField); >+ foreach (@field_add) { >+ my $fieldrow_ref = {}; >+ $fieldrow_ref -> {'field'} = $_; >+ $fieldrow_ref -> {'value'} = $results->[$i]{$_}; >+ push( @rowextrafields, $fieldrow_ref ); >+ } >+ >+ $row{extrafields} = \@rowextrafields; >+ > push( @resultsdata, \%row ); > } > } >@@ -94,7 +113,7 @@ $template->param( > member => $member, > numresults => $count, > category_type => $category_type, >- resultsloop => \@resultsdata >+ resultsloop => \@resultsdata, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/members/memberentry.pl b/members/memberentry.pl >index dee53c5..7054333 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -248,7 +248,7 @@ if ( ( $op eq 'insert' ) and !$nodouble ) { > } > > #recover all data from guarantor address phone ,fax... >-if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P' )) { >+if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) { > if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) { > $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'}; > $newdata{'contactfirstname'}= $guarantordata->{'firstname'}; >@@ -256,11 +256,15 @@ if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P' )) { > $newdata{'contacttitle'} = $guarantordata->{'title'}; > if ( $op eq 'add' ) { > 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)) { >+ zipcode country city state phone phonepro mobile fax email emailpro branchcode)) { > $newdata{$_} = $guarantordata->{$_}; > } >+ my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField"); >+ my @field_add=split(/\|/,$additionalGuarantorField); >+ my $guarantordata=GetMember(borrowernumber => $guarantorid); >+ foreach (@field_add) { >+ $newdata{$_} = $guarantordata->{$_}; >+ } > } > } > } >@@ -666,7 +670,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { > $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification")); > } > >-$template->param( "showguarantor" => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are >+$template->param( "showguarantor" => ($category_type=~/I|S|X/) ? 0 : 1); # associate with step to know where you are > $debug and warn "memberentry step: $step"; > $template->param(%data); > $template->param( "step_$step" => 1) if $step; # associate with step to know where u are >diff --git a/members/moremember.pl b/members/moremember.pl >index 4f77854..9c21fba 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -180,32 +180,38 @@ if ( $category_type eq 'A' || $category_type eq 'I') { > # > my ( $count, $guarantees ) = GetGuarantees( $data->{'borrowernumber'} ); > my @guaranteedata; >+ my $amount; >+ my $totalmount = 0; >+ > for ( my $i = 0 ; $i < $count ; $i++ ) { >+ my ($amount,$accts,undef) = GetMemberAccountRecords($guarantees->[$i]->{'borrowernumber'}); > push(@guaranteedata, > { > borrowernumber => $guarantees->[$i]->{'borrowernumber'}, > cardnumber => $guarantees->[$i]->{'cardnumber'}, >+ finesguarantee => sprintf("%.2f",$amount), > name => $guarantees->[$i]->{'firstname'} . " " > . $guarantees->[$i]->{'surname'} > } > ); >+ $totalmount += $amount; > } > $template->param( guaranteeloop => \@guaranteedata ); >+ $template->param( amounttot => sprintf("%.2f",$totalmount)); > ( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' ); > } > else { >- if ($data->{'guarantorid'}){ >- my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'}); >- $template->param(guarantor => 1); >- foreach (qw(borrowernumber cardnumber firstname surname)) { >- $template->param("guarantor$_" => $guarantor->{$_}); >- } >- } > if ($category_type eq 'C'){ > $template->param('C' => 1); > } > } >- >+if ($data->{'guarantorid'}){ >+ my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'}); >+ $template->param(guarantor => 1); >+ foreach (qw(borrowernumber cardnumber firstname surname)) { >+ $template->param("guarantor$_" => $guarantor->{$_}); >+ } >+} > my %bor; > $bor{'borrowernumber'} = $borrowernumber; > >-- >1.9.1
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 12446
:
29278
|
36176
|
39744
|
42469
|
42470
|
42535
|
46277
|
46278
|
46327
|
46328
|
46345
|
46486
|
49793
|
50953
|
53534
|
53535
|
53536
|
53913
|
60929
|
60930
|
60934
|
63148
|
63149
|
63214
|
64793
|
64794
|
64828
|
72295
|
72883
|
77766
|
77767
|
77768
|
79343
|
79344
|
79345
|
79347
|
79348
|
85069
|
88364
|
88365
|
88366
|
88367
|
90389
|
90390
|
90391
|
90392
|
90470
|
90471
|
90472
|
90473
|
93388
|
93389
|
93390
|
93391
|
93392
|
93393
|
93394
|
95411
|
95853
|
95854
|
95855
|
95856
|
95857
|
95858
|
95859
|
95860
|
106753
|
106754
|
106755
|
106756
|
106757
|
107611
|
111052
|
111053
|
111317
|
111318
|
112102
|
112160
|
112161
|
112162
|
112163
|
113583
|
121925
|
121926
|
121927
|
121928
|
121929
|
122084
|
122085
|
122086
|
122087
|
122088
|
122089
|
122090
|
122091
|
122184
|
122185
|
122186
|
122187
|
130398
|
130399
|
130400
|
130401
|
130402
|
131965
|
131966
|
131967
|
131968
|
131969
|
133691
|
133952
|
133953
|
133954
|
133955
|
133956
|
133957
|
134930
|
134931
|
134932
|
134933
|
134934
|
134935
|
134936
|
135506
|
135507
|
135508
|
135509
|
135510
|
135511
|
135512
|
135519
|
135520
|
135521
|
135522
|
135523
|
135544
|
135545
|
142401
|
142408
|
142431
|
142432
|
142433
|
142434
|
142435
|
142436
|
142437
|
142438
|
142439