Bugzilla – Attachment 39744 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 adult patrons to have a guarantor
bug-12446---Enable-adult-patrons-to-have-a-guarant.patch (text/plain), 28.14 KB, created by
Maxime Beaulieu
on 2015-06-01 13:44:36 UTC
(
hide
)
Description:
bug 12446 - Enable adult patrons to have a guarantor
Filename:
MIME Type:
Creator:
Maxime Beaulieu
Created:
2015-06-01 13:44:36 UTC
Size:
28.14 KB
patch
obsolete
>From 8f96f545338a3d3b2fc8ab5a59b3731da027fb98 Mon Sep 17 00:00:00 2001 >From: mxbeaulieu <maxime.beaulieu@inlibro.com> >Date: Mon, 1 Jun 2015 09:10:38 -0400 >Subject: [PATCH] bug 12446 - Enable adult patrons to have a guarantor > >I have rebased Simith's patch. >This includes all the features from the previous patch. > >On the patron category page, there is a new field to specify whether patrons can be guarantee or not. >The atomic update SQL script adds this new field and sets it to true for categories of type "C" and "P". > >I Apply the patch >II Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories. > >- Enable an adult to have a guarantor: >0.0) Create or edit a patron category of type 'A'. >0.1) Set the "Can be guarantee" field to "Yes" and save. >1) Select an adult patron -> details tab; >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; >--- > C4/Category.pm | 34 ++++++++++++++++++++ > C4/Members/Attributes.pm | 17 +++++++++- > C4/Utils/DataTables/Members.pm | 16 +++++---- > admin/categorie.pl | 14 ++++---- > .../atomicupdate/bug_12446-EnableAdultGarantee.sql | 13 ++++++++ > installer/data/mysql/kohastructure.sql | 3 +- > installer/data/mysql/sysprefs.sql | 4 ++- > .../prog/en/includes/members-toolbar.inc | 2 +- > .../prog/en/modules/admin/categorie.tt | 19 +++++++++++ > .../prog/en/modules/admin/preferences/patrons.pref | 5 +++ > .../prog/en/modules/members/memberentrygen.tt | 18 ++++------- > .../prog/en/modules/members/moremember.tt | 17 ++++++++-- > members/memberentry.pl | 16 ++++++--- > members/moremember.pl | 22 ++++++++----- > 14 files changed, 155 insertions(+), 45 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql > >diff --git a/C4/Category.pm b/C4/Category.pm >index 72ed424..903a7b0 100644 >--- a/C4/Category.pm >+++ b/C4/Category.pm >@@ -94,6 +94,36 @@ sub all { > }; > } > >+=head3 C4::Category->get >+ >+ $cat = get( $category_code ); >+ This returns the category as an object. >+ >+=cut >+ >+sub get { >+ my ( $class, $code ) = @_; >+ my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; >+ my $dbh = C4::Context->dbh; >+ >+ my ( $query , @params ); >+ if( $branch_limit ){ >+ $query = qq| SELECT categories.* FROM categories >+ LEFT JOIN categories_branches ON categories_branches.categorycode = categories.categorycode >+ WHERE categories.categorycode = ? AND (categories_branches.branchcode = ? OR categories_branches.branchcode IS NULL) >+ |; >+ @params = ( $code, $branch_limit ); >+ } >+ else{ >+ $query = "SELECT categories.* FROM categories WHERE categorycode = ?"; >+ @params = ( $code ); >+ } >+ >+ my $data = $dbh->selectrow_hashref( $query, undef, @params ); >+ >+ return $class->new($data); >+} >+ > > > >@@ -149,6 +179,10 @@ These are read-only accessors for attributes of a C4::Category object. > > =cut > >+=head3 $category->canbeguarantee >+ >+=cut >+ > sub AUTOLOAD { > my $self = shift; > my $attr = $AUTOLOAD; >diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm >index a56a627..6439312 100644 >--- a/C4/Members/Attributes.pm >+++ b/C4/Members/Attributes.pm >@@ -34,7 +34,7 @@ BEGIN { > @EXPORT_OK = qw(GetBorrowerAttributes GetBorrowerAttributeValue CheckUniqueness SetBorrowerAttributes > DeleteBorrowerAttribute UpdateBorrowerAttribute > extended_attributes_code_value_arrayref extended_attributes_merge >- SearchIdMatchingAttribute); >+ SearchIdMatchingAttribute get_guarantor_shared_attributes); > %EXPORT_TAGS = ( all => \@EXPORT_OK ); > } > >@@ -357,6 +357,21 @@ sub _sort_by_code { > return $x->{code} cmp $y->{code} || $x->{value} cmp $y->{value}; > } > >+=head2 get_guarantor_shared_attributes >+ >+ $guarantor_attributes = get_guarantor_attributes(); >+ >+ returns an array reference containing attributes to be shared between guarantor and guarantee. >+=cut >+sub get_guarantor_shared_attributes{ >+ my @attributes = qw( streetnumber address address2 city state zipcode country branchcode phone phonepro mobile email emailpro fax ); >+ if( my @additional = split(/\|/, C4::Context->preference("AdditionalGuarantorField")) ){ >+ $_ =~ s/(?:^\s+)|(?:\s+$)//g for (@additional); # Trim whitespaces >+ @attributes = ( @attributes, @additional); >+ } >+ return \@attributes; >+} >+ > =head1 AUTHOR > > Koha Development Team <http://koha-community.org/> >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index a63a582..dfa0f5e 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -3,6 +3,7 @@ package C4::Utils::DataTables::Members; > use C4::Branch qw/onlymine/; > use C4::Context; > use C4::Members qw/GetMemberIssuesAndFines/; >+use C4::Members::Attributes qw/get_guarantor_shared_attributes/; > use C4::Utils::DataTables; > use Modern::Perl; > >@@ -31,13 +32,14 @@ sub search { > } > > my $dbh = C4::Context->dbh; >- my $select = "SELECT >- borrowers.borrowernumber, borrowers.surname, borrowers.firstname, >- borrowers.streetnumber, borrowers.streettype, borrowers.address, >- borrowers.address2, borrowers.city, borrowers.state, borrowers.zipcode, >- borrowers.country, cardnumber, borrowers.dateexpiry, >- borrowers.borrowernotes, borrowers.branchcode, borrowers.email, >- borrowers.userid, borrowers.dateofbirth, borrowers.categorycode, >+ my @columns = qw( borrowernumber surname firstname streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode ); >+ if( my @guarantor_attributes = @{ get_guarantor_shared_attributes() }){ >+ my %seen = (); >+ @columns = grep { ! $seen{ $_ }++ } ( @columns, @guarantor_attributes ); >+ }; >+ $_ = "borrowers.".$dbh->quote_identifier($_) for (@columns); >+ >+ my $select = "SELECT ${ \join(',', @columns) }, > categories.description AS category_description, categories.category_type, > branches.branchname"; > my $from = "FROM borrowers >diff --git a/admin/categorie.pl b/admin/categorie.pl >index 27e95cb..249d776 100755 >--- a/admin/categorie.pl >+++ b/admin/categorie.pl >@@ -154,6 +154,7 @@ if ( $op eq 'add_form' ) { > $data->{'BlockExpiredPatronOpacActions'}, > TalkingTechItivaPhone => > C4::Context->preference("TalkingTechItivaPhoneNotification"), >+ canbeguarantee => $data->{'canbeguarantee'}, > ); > > if ( C4::Context->preference('EnhancedMessagingPreferences') ) { >@@ -178,7 +179,6 @@ elsif ( $op eq 'add_validate' ) { > ) > ); > } >- > if ($is_a_modif) { > my $sth = $dbh->prepare( " > UPDATE categories >@@ -193,7 +193,8 @@ elsif ( $op eq 'add_validate' ) { > overduenoticerequired=?, > category_type=?, > BlockExpiredPatronOpacActions=?, >- default_privacy=? >+ default_privacy=?, >+ canbeguarantee=? > WHERE categorycode=?" > ); > $sth->execute( >@@ -204,7 +205,7 @@ elsif ( $op eq 'add_validate' ) { > 'reservefee', 'hidelostitems', > 'overduenoticerequired', 'category_type', > 'block_expired', 'default_privacy', >- 'categorycode' >+ 'canbeguarantee', 'categorycode' > ) > ); > $sth->finish; >@@ -224,7 +225,8 @@ elsif ( $op eq 'add_validate' ) { > overduenoticerequired, > category_type, > BlockExpiredPatronOpacActions, >- default_privacy >+ default_privacy, >+ canbeguarantee > ) > VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)" ); > my $inserted = $sth->execute( >@@ -235,7 +237,7 @@ elsif ( $op eq 'add_validate' ) { > 'enrolmentfee', 'reservefee', > 'hidelostitems', 'overduenoticerequired', > 'category_type', 'block_expired', >- 'default_privacy', >+ 'default_privacy', 'canbeguarantee' > ) > ); > if ( $inserted ) { >@@ -340,7 +342,6 @@ if ( $op eq 'list' ) { > } > > $results->[$i]{'category_type'} //= ''; >- > my %row = ( > branches => \@selected_branches, > categorycode => $results->[$i]{'categorycode'}, >@@ -354,6 +355,7 @@ if ( $op eq 'list' ) { > hidelostitems => $results->[$i]{'hidelostitems'}, > category_type => $results->[$i]{'category_type'}, > default_privacy => $results->[$i]{'default_privacy'}, >+ canbeguarantee => $results->[$i]{'canbeguarantee'}, > reservefee => sprintf( "%.2f", $results->[$i]{'reservefee'} || 0 ), > enrolmentfee => > sprintf( "%.2f", $results->[$i]{'enrolmentfee'} || 0 ), >diff --git a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql b/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql >new file mode 100644 >index 0000000..cbec908 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql >@@ -0,0 +1,13 @@ >+-- ******** -- >+-- SYSPREFS -- >+-- ******** -- >+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) >+VALUES ('AdditionalGuarantorField','',NULL,'Additional fields name to be transfer from guarantor to guarantee.','free'); >+ >+-- ********* -- >+-- STRUCTURE -- >+-- ********* -- >+ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0'; >+ >+-- Set defaults for new column >+UPDATE categories set canbeguarantee = 1 WHERE category_type IN ('C', 'P'); >\ No newline at end of file >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index c41710c..3d9a1d2 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -488,7 +488,8 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr > `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no) > `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff) > `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions >- `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category >+ `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category, >+ `canbeguarantee` tinyint(1) NOT NULL default '0' > PRIMARY KEY (`categorycode`), > UNIQUE KEY `categorycode` (`categorycode`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 9620d67..a7456dd 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -6,6 +6,8 @@ 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'), > ('AddressFormat','us','','Choose format to display postal addresses', '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'), >@@ -479,5 +481,5 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'), > ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'), > ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), >-('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') >+('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), > ; >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 828c564..ceea919 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -148,7 +148,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/categorie.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >index 769a0bc..c9d754f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >@@ -24,6 +24,10 @@ > if ( $("#branches option:selected").length < 1 ) { > $("#branches option:first").attr("selected", "selected"); > } >+ $("#category_type").change(function(){ >+ var selected = $(this).val(); >+ $("#canbeguarantee").val( (selected == 'C' || selected == 'P') ? "1" : "0" ); >+ }); > }); > function isNotNull(f,noalert) { > if (f.value.length ==0) { >@@ -197,6 +201,18 @@ > </select> > <span class="required">Required</span> > </li> >+ <li> >+ <label for="canbeguarantee">Can be guarantee</label> >+ <select name="canbeguarantee" id="canbeguarantee"> >+ [% IF canbeguarantee %] >+ <option value="1" selected>Yes</option> >+ <option value="0">No</option> >+ [% ELSE %] >+ <option value="1">Yes</option> >+ <option value="0" selected>No</option> >+ [% END %] >+ <select> >+ </li> > <li><label for="branches">Branches limitation: </label> > <select id="branches" name="branches" multiple size="10"> > <option value="">All branches</option> >@@ -299,6 +315,7 @@ > <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr> > <tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr> > <tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr> >+ <tr><th scope="row">Can be guarantee</th><td>[% IF ( canbeguarantee ) %]Yes[% ELSE %]No[% END %]</td></tr> > <tr> > <th scope="row">Default privacy: </th> > <td> >@@ -351,6 +368,7 @@ > <th scope="col">Messaging</th> > [% END %] > <th scope="col">Branches limitations</th> >+ <th scope="col">Can be guarantee</th> > <th scope="col">Default privacy</th> > <th scope="col"> </th> > <th scope="col"> </th> >@@ -425,6 +443,7 @@ > No limitation > [% END %] > </td> >+ <td>[% IF loo.canbeguarantee %]Yes[% ELSE %]No[% END %]</td> > <td> > [% SWITCH loo.default_privacy %] > [% CASE 'default' %] >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 ee908d2..e5c724a 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,6 +138,11 @@ Patrons: > yes: Allow > no: "Don't allow" > - librarians to discharge borrowers and borrowers to request a discharge. >+ - >+ - "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 |) > "Norwegian patron database": > - > - pref: NorwegianPatronDBEnable >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 330058f..cd3d8f7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -120,14 +120,9 @@ > .val(borrower.firstname) > .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden'; > >- form.streetnumber.value = borrower.streetnumber; >- form.address.value = borrower.address; >- form.address2.value = borrower.address2; >- form.city.value = borrower.city; >- form.state.value = borrower.state; >- form.zipcode.value = borrower.zipcode; >- form.country.value = borrower.country; >- form.branchcode.value = borrower.branchcode; >+ [% FOREACH field IN guarantor_attributes %] >+ $(form.[% field %]).val(borrower.[% field %]); >+ [% END %] > > form.guarantorsearch.value = 'Change'; > >@@ -410,7 +405,6 @@ > [% END %] > </li> > [% ELSE %] >- [% IF ( C ) %] > [% IF ( guarantorid ) %] > <li id="contact-details"> > [% ELSE %] >@@ -428,9 +422,8 @@ > <input name="contactname" id="contactname" type="text" size="20" value="[% contactname %]" /> > [% END %] > </li> >- [% END %] >- [% UNLESS nocontactfirstname %] >- <li> >+ [% UNLESS nocontactfirstname %] >+<li> > <label for="contactfirstname">First name: </label> > [% IF ( guarantorid ) %] > <span>[% contactfirstname %]</span> >@@ -982,6 +975,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 8ddb526..a5beffa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -235,13 +235,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 %][%IF ( guarantorfirstname ) %], [% guarantorfirstname %] [% END %]</a></li> > [% END %] >- [% END %] >+ > </ol> > </div> > <div class="action"> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 967ebd1..01a4571 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -41,6 +41,7 @@ use C4::Log; > use C4::Letters; > use C4::Branch; # GetBranches > use C4::Form::MessagingPreferences; >+use C4::Category; > use Koha::Borrower::Debarments; > use Koha::DateUtils; > use Module::Load; >@@ -250,7 +251,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'}; >@@ -258,11 +259,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->{$_}; >+ } > } > } > } >@@ -689,7 +694,8 @@ 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" => $categorycode ? C4::Category->get($categorycode)->{'canbeguarantee'} : 1); # associate with step to know where you are >+$template->param( "guarantor_attributes" => C4::Members::Attributes::get_guarantor_shared_attributes() ); > $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 d448b91..7949c16 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -180,32 +180,38 @@ if ( $count ) { > # the array, which is probably better done as a foreach loop. > # > 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.7.9.5
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