Bugzilla – Attachment 46277 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), 65.78 KB, created by
Rémi Mayrand-Provencher
on 2016-01-05 20:12:03 UTC
(
hide
)
Description:
bug 12446 - Enable adult patrons to have a guarantor
Filename:
MIME Type:
Creator:
Rémi Mayrand-Provencher
Created:
2016-01-05 20:12:03 UTC
Size:
65.78 KB
patch
obsolete
>From 88eee80a6adbe1ee12141a33e209c6323275c282 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 every patch. >This includes all the features from the previous patches. > >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". > >1) Apply the patch >2) Run updatedatabase.pl to add AdditionalGuarantorField to preferences and canbeguarantee to categories. >3) Go to patron category administration, edit a category and change the value of Can Be Guarantee to yes (for Child and Professional mostly to set it by default) >4) See below to test various scenarios > >- 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; > >Please enter the commit message for your changes. Lines starting >--- > C4/Category.pm | 34 ++ > C4/Members/Attributes.pm | 17 +- > C4/Utils/DataTables/Members.pm | 22 +- > Koha/Schema/Result/Category.pm | 8 + > admin/categorie.pl | 423 ++++++++++++++++++ > admin/categories.pl | 3 + > .../atomicupdate/bug_12446-EnableAdultGarantee.sql | 11 + > 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 | 475 +++++++++++++++++++++ > .../prog/en/modules/admin/categories.tt | 15 + > .../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 | 17 +- > members/moremember.pl | 27 +- > 17 files changed, 1058 insertions(+), 43 deletions(-) > create mode 100755 admin/categorie.pl > create mode 100644 installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt > >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 b25a813..b2b0762 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 1ebecd7..49fd1fc 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -4,6 +4,7 @@ use Modern::Perl; > 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 Koha::DateUtils; > >@@ -32,13 +33,20 @@ 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() }){ >+ foreach my $item (@guarantor_attributes) { >+ if (! grep {$_ eq $item} @columns) { >+ push @columns, $item; >+ } >+ } >+ }; >+ my $borrowers_columns = ""; >+ foreach my $item (@columns) { >+ $borrowers_columns .= "borrowers." . $item . ", "; >+ } >+ >+ my $select = "SELECT " . $borrowers_columns . " > categories.description AS category_description, categories.category_type, > branches.branchname"; > my $from = "FROM borrowers >diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm >index 4926587..e5a40a9 100644 >--- a/Koha/Schema/Result/Category.pm >+++ b/Koha/Schema/Result/Category.pm >@@ -109,6 +109,12 @@ __PACKAGE__->table("categories"); > default_value: -1 > is_nullable: 0 > >+=head2 canbeguarantee >+ >+ data_type: 'tinyint' >+ default_value: 0 >+ is_nullable: 0 >+ > =head2 default_privacy > > data_type: 'enum' >@@ -154,6 +160,8 @@ __PACKAGE__->add_columns( > default_value => -1, > is_nullable => 0, > }, >+ "canbeguarantee", >+ { data_type => "tinyint", default_value => 0, is_nullable => 0}, > "default_privacy", > { > data_type => "enum", >diff --git a/admin/categorie.pl b/admin/categorie.pl >new file mode 100755 >index 0000000..249d776 >--- /dev/null >+++ b/admin/categorie.pl >@@ -0,0 +1,423 @@ >+#!/usr/bin/perl >+ >+#script to administer the categories table >+#written 20/02/2002 by paul.poulain@free.fr >+ >+# ALGO : >+# this script use an $op to know what to do. >+# if $op is empty or none of the above values, >+# - the default screen is build (with all records, or filtered datas). >+# - the user can clic on add, modify or delete record. >+# if $op=add_form >+# - if primkey exists, this is a modification,so we read the $primkey record >+# - builds the add/modify form >+# if $op=add_validate >+# - the user has just send datas, so we create/modify the record >+# if $op=delete_form >+# - we show the record having primkey=$primkey and ask for deletion validation form >+# if $op=delete_confirm >+# - we delete the record having primkey=$primkey >+ >+# Copyright 2000-2002 Katipo Communications >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use CGI qw ( -utf8 ); >+use C4::Context; >+use C4::Auth; >+use C4::Branch; >+use C4::Output; >+use C4::Dates; >+use C4::Form::MessagingPreferences; >+use Koha::Database; >+ >+sub StringSearch { >+ my ( $searchstring, $type ) = @_; >+ my $dbh = C4::Context->dbh; >+ $searchstring //= ''; >+ $searchstring =~ s/\'/\\\'/g; >+ my @data = split( ' ', $searchstring ); >+ push @data, q{} if $#data == -1; >+ my $count = @data; >+ my $sth = $dbh->prepare("Select * from categories where (description like ?) order by category_type,description,categorycode"); >+ $sth->execute("$data[0]%"); >+ my @results; >+ >+ while ( my $data = $sth->fetchrow_hashref ) { >+ push( @results, $data ); >+ } >+ >+ # $sth->execute; >+ $sth->finish; >+ return ( scalar(@results), \@results ); >+} >+ >+my $input = new CGI; >+my $searchfield = $input->param('description'); >+my $script_name = "/cgi-bin/koha/admin/categorie.pl"; >+my $categorycode = $input->param('categorycode'); >+my $op = $input->param('op') // 'list'; >+my $block_expired = $input->param("block_expired"); >+my @messages; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "admin/categorie.tt", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { parameters => 'parameters_remaining_permissions' }, >+ debug => 1, >+ } >+); >+ >+################## ADD_FORM ################################## >+# called by default. Used to create form to add or modify a record >+if ( $op eq 'add_form' ) { >+ $template->param( add_form => 1 ); >+ >+ #---- if primkey exists, it's a modify action, so read values to modify... >+ my $data; >+ my @selected_branches; >+ if ($categorycode) { >+ my $dbh = C4::Context->dbh; >+ my $sth = >+ $dbh->prepare("SELECT * FROM categories WHERE categorycode=?"); >+ $sth->execute($categorycode); >+ $data = $sth->fetchrow_hashref; >+ >+ $sth = $dbh->prepare( >+ "SELECT b.branchcode, b.branchname >+ FROM categories_branches AS cb, branches AS b >+ WHERE cb.branchcode = b.branchcode AND cb.categorycode = ? >+ "); >+ $sth->execute($categorycode); >+ while ( my $branch = $sth->fetchrow_hashref ) { >+ push @selected_branches, $branch; >+ } >+ $sth->finish; >+ } >+ >+ if ( $data->{'enrolmentperioddate'} >+ && $data->{'enrolmentperioddate'} eq '0000-00-00' ) >+ { >+ $data->{'enrolmentperioddate'} = undef; >+ } >+ >+ $data->{'category_type'} //= ''; >+ >+ my $branches = GetBranches(); >+ my @branches_loop; >+ foreach my $branch ( sort keys %$branches ) { >+ my $selected = >+ ( grep { $$_{branchcode} eq $branch } @selected_branches ) ? 1 : 0; >+ push @branches_loop, >+ { >+ branchcode => $$branches{$branch}{branchcode}, >+ branchname => $$branches{$branch}{branchname}, >+ selected => $selected, >+ }; >+ } >+ >+ $template->param( >+ branches_loop => \@branches_loop, >+ description => $data->{'description'}, >+ enrolmentperiod => $data->{'enrolmentperiod'}, >+ enrolmentperioddate => $data->{'enrolmentperioddate'}, >+ upperagelimit => $data->{'upperagelimit'}, >+ dateofbirthrequired => $data->{'dateofbirthrequired'}, >+ enrolmentfee => sprintf( "%.2f", $data->{'enrolmentfee'} || 0 ), >+ overduenoticerequired => $data->{'overduenoticerequired'}, >+ issuelimit => $data->{'issuelimit'}, >+ reservefee => sprintf( "%.2f", $data->{'reservefee'} || 0 ), >+ hidelostitems => $data->{'hidelostitems'}, >+ category_type => $data->{'category_type'}, >+ default_privacy => $data->{'default_privacy'}, >+ SMSSendDriver => C4::Context->preference("SMSSendDriver"), >+ "type_" . $data->{'category_type'} => 1, >+ BlockExpiredPatronOpacActions => >+ $data->{'BlockExpiredPatronOpacActions'}, >+ TalkingTechItivaPhone => >+ C4::Context->preference("TalkingTechItivaPhoneNotification"), >+ canbeguarantee => $data->{'canbeguarantee'}, >+ ); >+ >+ if ( C4::Context->preference('EnhancedMessagingPreferences') ) { >+ C4::Form::MessagingPreferences::set_form_values( >+ { categorycode => $categorycode }, $template ); >+ } >+ >+ # END $OP eq ADD_FORM >+################## ADD_VALIDATE ################################## >+ # called by add_form, used to insert/modify data in DB >+} >+elsif ( $op eq 'add_validate' ) { >+ >+ my $is_a_modif = $input->param("is_a_modif"); >+ >+ my $dbh = C4::Context->dbh; >+ >+ if ( $input->param('enrolmentperioddate') ) { >+ $input->param( >+ 'enrolmentperioddate' => C4::Dates::format_date_in_iso( >+ $input->param('enrolmentperioddate') >+ ) >+ ); >+ } >+ if ($is_a_modif) { >+ my $sth = $dbh->prepare( " >+ UPDATE categories >+ SET description=?, >+ enrolmentperiod=?, >+ enrolmentperioddate=?, >+ upperagelimit=?, >+ dateofbirthrequired=?, >+ enrolmentfee=?, >+ reservefee=?, >+ hidelostitems=?, >+ overduenoticerequired=?, >+ category_type=?, >+ BlockExpiredPatronOpacActions=?, >+ default_privacy=?, >+ canbeguarantee=? >+ WHERE categorycode=?" >+ ); >+ $sth->execute( >+ map { $input->param($_) } ( >+ 'description', 'enrolmentperiod', >+ 'enrolmentperioddate', 'upperagelimit', >+ 'dateofbirthrequired', 'enrolmentfee', >+ 'reservefee', 'hidelostitems', >+ 'overduenoticerequired', 'category_type', >+ 'block_expired', 'default_privacy', >+ 'canbeguarantee', 'categorycode' >+ ) >+ ); >+ $sth->finish; >+ } >+ else { >+ my $sth = $dbh->prepare( " >+ INSERT INTO categories ( >+ categorycode, >+ description, >+ enrolmentperiod, >+ enrolmentperioddate, >+ upperagelimit, >+ dateofbirthrequired, >+ enrolmentfee, >+ reservefee, >+ hidelostitems, >+ overduenoticerequired, >+ category_type, >+ BlockExpiredPatronOpacActions, >+ default_privacy, >+ canbeguarantee >+ ) >+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)" ); >+ my $inserted = $sth->execute( >+ map { $input->param($_) } ( >+ 'categorycode', 'description', >+ 'enrolmentperiod', 'enrolmentperioddate', >+ 'upperagelimit', 'dateofbirthrequired', >+ 'enrolmentfee', 'reservefee', >+ 'hidelostitems', 'overduenoticerequired', >+ 'category_type', 'block_expired', >+ 'default_privacy', 'canbeguarantee' >+ ) >+ ); >+ if ( $inserted ) { >+ push @messages, { type => 'message', code => 'success_on_insert' }; >+ } else { >+ push @messages, { type => 'error', code => 'error_on_insert' }; >+ } >+ } >+ >+ my @branches = $input->param("branches"); >+ if (@branches) { >+ my $sth = $dbh->prepare( >+ "DELETE FROM categories_branches WHERE categorycode = ?" >+ ); >+ $sth->execute( $input->param("categorycode") ); >+ $sth = $dbh->prepare( >+ "INSERT INTO categories_branches ( categorycode, branchcode ) VALUES ( ?, ? )" >+ ); >+ for my $branchcode (@branches) { >+ next if not $branchcode; >+ $sth->bind_param( 1, $input->param("categorycode") ); >+ $sth->bind_param( 2, $branchcode ); >+ $sth->execute; >+ } >+ } >+ >+ if ( C4::Context->preference('EnhancedMessagingPreferences') ) { >+ C4::Form::MessagingPreferences::handle_form_action( $input, >+ { categorycode => $input->param('categorycode') }, $template ); >+ } >+ >+ $searchfield = q||; >+ $op = 'list'; >+ >+ # END $OP eq ADD_VALIDATE >+################## DELETE_CONFIRM ################################## >+ # called by default form, used to confirm deletion of data in DB >+} >+elsif ( $op eq 'delete_confirm' ) { >+ my $schema = Koha::Database->new()->schema(); >+ $template->param( delete_confirm => 1 ); >+ >+ my $count = >+ $schema->resultset('Borrower') >+ ->search( { categorycode => $categorycode } )->count(); >+ >+ my $category = $schema->resultset('Category')->find($categorycode); >+ >+ $category->enrolmentperioddate( >+ C4::Dates::format_date( $category->enrolmentperioddate() ) ); >+ >+ $template->param( category => $category, patrons_in_category => $count ); >+ >+ # END $OP eq DELETE_CONFIRM >+################## DELETE_CONFIRMED ################################## >+ # called by delete_confirm, used to effectively confirm deletion of data in DB >+} >+elsif ( $op eq 'delete_confirmed' ) { >+ $template->param( delete_confirmed => 1 ); >+ my $dbh = C4::Context->dbh; >+ >+ my $categorycode = uc( $input->param('categorycode') ); >+ >+ my $sth = $dbh->prepare("delete from categories where categorycode=?"); >+ >+ my $deleted = $sth->execute($categorycode); >+ >+ if ( $deleted ) { >+ push @messages, { type => 'message', code => 'success_on_delete' }; >+ } else { >+ push @messages, { type => 'error', code => 'error_on_delete' }; >+ } >+ >+ $op = 'list'; >+ >+ # END $OP eq DELETE_CONFIRMED >+} >+ >+if ( $op eq 'list' ) { >+ $template->param( else => 1 ); >+ my @loop; >+ my ( $count, $results ) = StringSearch( $searchfield, 'web' ); >+ >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare(" >+ SELECT b.branchcode, b.branchname >+ FROM categories_branches AS cb, branches AS b >+ WHERE cb.branchcode = b.branchcode AND cb.categorycode = ? >+ "); >+ >+ for ( my $i = 0 ; $i < $count ; $i++ ) { >+ $sth->execute( $results->[$i]{'categorycode'} ); >+ >+ my @selected_branches; >+ while ( my $branch = $sth->fetchrow_hashref ) { >+ push @selected_branches, $branch; >+ } >+ >+ my $enrolmentperioddate = $results->[$i]{'enrolmentperioddate'}; >+ if ( $enrolmentperioddate && $enrolmentperioddate eq '0000-00-00' ) { >+ $enrolmentperioddate = undef; >+ } >+ >+ $results->[$i]{'category_type'} //= ''; >+ my %row = ( >+ branches => \@selected_branches, >+ categorycode => $results->[$i]{'categorycode'}, >+ description => $results->[$i]{'description'}, >+ enrolmentperiod => $results->[$i]{'enrolmentperiod'}, >+ enrolmentperioddate => $enrolmentperioddate, >+ upperagelimit => $results->[$i]{'upperagelimit'}, >+ dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, >+ overduenoticerequired => $results->[$i]{'overduenoticerequired'}, >+ issuelimit => $results->[$i]{'issuelimit'}, >+ 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 ), >+ "type_" . $results->[$i]{'category_type'} => 1, >+ ); >+ >+ if ( C4::Context->preference('EnhancedMessagingPreferences') ) { >+ my $brief_prefs = >+ _get_brief_messaging_prefs( $results->[$i]{'categorycode'} ); >+ $row{messaging_prefs} = $brief_prefs if @$brief_prefs; >+ } >+ push @loop, \%row; >+ } >+ >+ $template->param( loop => \@loop ); >+ >+ # check that I (institution) and C (child) exists. otherwise => warning to the user >+ $sth = $dbh->prepare("select category_type from categories where category_type='C'"); >+ $sth->execute; >+ my ($categoryChild) = $sth->fetchrow; >+ $template->param( categoryChild => $categoryChild ); >+ >+ $sth = $dbh->prepare("select category_type from categories where category_type='I'"); >+ $sth->execute; >+ my ($categoryInstitution) = $sth->fetchrow; >+ $template->param( categoryInstitution => $categoryInstitution ); >+ $sth->finish; >+ >+} #---- END $OP eq DEFAULT >+ >+$template->param( >+ script_name => $script_name, >+ categorycode => $categorycode, >+ searchfield => $searchfield, >+ messages => \@messages, >+); >+ >+output_html_with_http_headers $input, $cookie, $template->output; >+ >+exit 0; >+ >+sub _get_brief_messaging_prefs { >+ my $categorycode = shift; >+ my $messaging_options = C4::Members::Messaging::GetMessagingOptions(); >+ my $results = []; >+ PREF: foreach my $option (@$messaging_options) { >+ my $pref = C4::Members::Messaging::GetMessagingPreferences( >+ { >+ categorycode => $categorycode, >+ message_name => $option->{'message_name'} >+ } >+ ); >+ next unless $pref->{'transports'}; >+ my $brief_pref = { >+ message_attribute_id => $option->{'message_attribute_id'}, >+ message_name => $option->{'message_name'}, >+ $option->{'message_name'} => 1 >+ }; >+ foreach my $transport ( keys %{ $pref->{'transports'} } ) { >+ push @{ $brief_pref->{'transports'} }, { transport => $transport }; >+ } >+ push @$results, $brief_pref; >+ } >+ return $results; >+} >diff --git a/admin/categories.pl b/admin/categories.pl >index 1370b58..593886c 100755 >--- a/admin/categories.pl >+++ b/admin/categories.pl >@@ -91,6 +91,7 @@ elsif ( $op eq 'add_validate' ) { > my $category_type = $input->param('category_type'); > my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions'); > my $default_privacy = $input->param('default_privacy'); >+ my $canbeguarantee = $input->param('canbeguarantee'); > my @branches = grep { $_ ne q{} } $input->param('branches'); > > my $is_a_modif = $input->param("is_a_modif"); >@@ -112,6 +113,7 @@ elsif ( $op eq 'add_validate' ) { > $category->hidelostitems($hidelostitems); > $category->overduenoticerequired($overduenoticerequired); > $category->category_type($category_type); >+ $category->canbeguarantee($canbeguarantee); > $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions); > $category->default_privacy($default_privacy); > eval { >@@ -137,6 +139,7 @@ elsif ( $op eq 'add_validate' ) { > hidelostitems => $hidelostitems, > overduenoticerequired => $overduenoticerequired, > category_type => $category_type, >+ canbeguarantee => $canbeguarantee, > BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions, > default_privacy => $default_privacy, > }); >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..267e19f >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql >@@ -0,0 +1,11 @@ >+-- ******** -- >+-- 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'; >+ >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 02725fd..1302be2 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 aa53139..fdfe94c 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'), >@@ -517,5 +519,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 641bbad..7cc0c0e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -146,7 +146,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 %]"><i class="fa fa-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 guarantee</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="fa fa-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 >new file mode 100644 >index 0000000..59168b8 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >@@ -0,0 +1,475 @@ >+[% USE KohaDates -%] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Administration › Patron categories › [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %] >+[% IF ( delete_confirm ) %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %] >+</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >+[% INCLUDE 'datatables.inc' %] >+<script type="text/javascript" id="js"> >+//<![CDATA[ >+ $(document).ready(function() { >+ $("#table_categorie").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, >+ { "aTargets": [ 3,4,5 ], "sType": "natural" }, >+ ], >+ "aaSorting": [[ 1, "asc" ]], >+ "sPaginationType": "four_button" >+ })); >+ >+ $( "#enrolmentperioddate" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future >+ >+ if ( $("#branches option:selected").length < 1 ) { >+ $("#branches option:first").attr("selected", "selected"); >+ } >+ $("#category_type").change(function(){ >+ var canbeguarantee_bydefault = ['C','P']; >+ var selected = $(this).val(); >+ $("#canbeguarantee").val( ( $.inArray(selected, canbeguarantee_bydefault) != -1 ) ? "1" : "0" ); >+ }); >+}); >+ function isNotNull(f,noalert) { >+ if (f.value.length ==0) { >+ return false; >+ } >+ return true; >+ } >+ // >+ function isNum(v,maybenull) { >+ var n = new Number(v.value); >+ if (isNaN(n)) { >+ return false; >+ } >+ if (maybenull==0 && v.value=='') { >+ return false; >+ } >+ return true; >+ } >+ // to check if the data are correctly entered. >+ function Check(ff) { >+ var ok=0; >+ var _alertString=_("Form not submitted because of the following problem(s)"); >+ _alertString +="\n-------------------------------------------------------------------\n\n"; >+ ff.categorycode.value = $.trim(ff.categorycode.value); >+ if (ff.categorycode.value.length==0) { >+ ok=1; >+ _alertString += _("- categorycode missing") + "\n"; >+ } >+ else{ >+ var patt=/^[a-zA-Z0-9\-_]+$/g; >+ if ( !patt.test(ff.categorycode.value) ) { >+ ok=1; >+ _alertString += _("- category code can only contain the following characters: letters, numbers, - and _") + "\n"; >+ } >+ } >+ if (!(ff.category_type.value)){ >+ ok=1; >+ _alertString += _("- category type missing") + "\n"; >+ } >+ if (!(isNotNull(ff.description,1))) { >+ ok=1; >+ _alertString += _("- description missing") + "\n"; >+ } >+ if (!isNum(ff.upperagelimit,0) && ff.category_type.value=='C') { >+ ok=1; >+ _alertString += _("- upperagelimit is not a number") + "\n"; >+ >+ } >+ if(!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) { >+ ok=1; >+ _alertString += _("- either Enrollment period or Until date must be provided") + "\n"; >+ } >+ if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){ >+ document.getElementById('enrolmentmessage').className = "error"; >+ return false; >+ } >+ >+ if (ok) { // if there is a problem >+ alert(_alertString); >+ return false; >+ } >+ // if all is good >+ ff.submit(); >+ } >+ //]]> >+</script> >+<style type="text/css">#enrolmentmessage.hint { display : none; }</style> >+</head> >+<body id="admin_categorie" class="admin"> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'patrons-admin-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> › [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %] >+[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> › [% IF ( patrons_in_category > 0 ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %] >+[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> › Category deleted[% END %] >+[% IF ( else ) %]Patron categories[% END %]</div> >+ >+<div id="doc3" class="yui-t2"> >+ >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ >+[% FOR m IN messages %] >+ <div class="dialog [% m.type %]"> >+ [% SWITCH m.code %] >+ [% CASE 'error_on_insert' %] >+ An error occurred when inserting this patron category. The patron category might already exist. >+ [% CASE 'error_on_delete' %] >+ An error occurred when deleting this patron category. Check the logs. >+ [% CASE 'success_on_insert' %] >+ Patron category added successfully >+ [% CASE 'success_on_delete' %] >+ Patron category deleted successfully. >+ [% CASE %] >+ [% m.code %] >+ [% END %] >+ </div> >+[% END %] >+ >+[% IF ( add_form ) %] >+ <form name="Aform" action="[% script_name %]" method="post"> >+ <input type="hidden" name="op" value="add_validate" /> >+ <input type="hidden" name="checked" value="0" /> >+[% IF ( categorycode ) %] >+ <h1>Modify category [% categorycode |html %]</h1> >+ [% ELSE %] >+ <h1>New category</h1> >+ [% END %] >+ <fieldset class="rows"> >+ <ol>[% IF ( categorycode ) %] >+ <li><span class="label">Category code: </span>[% categorycode |html %] >+ <input type="hidden" name="categorycode" value="[% categorycode |html %]" /><input type="hidden" name="is_a_modif" value="1" /></li> >+ [% ELSE %] >+ <li> >+ <label for="categorycode" class="required">Category code: </label> >+ <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" onblur="toUC(this)" /> >+ <span class="required">Required</span> >+ </li> >+ [% END %] >+ <li> >+ <label for="description" class="required">Description: </label> >+ <input type="text" name="description" id="description" size="40" maxlength="80" value="[% description |html %]" /> >+ <span class="required">Required</span> >+ </li> >+ <li><label for="enrolmentperiod" class="required">Enrollment period: </label> >+ <fieldset> >+ <legend>Choose one</legend> >+ <ol> >+ <li><label for="enrolmentperiod" style="width:6em;">In months: </label> >+ <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li> >+ <li><label for="enrolmentperioddate" style="width:6em;">Until date: </label> >+ <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate | $KohaDates %]" /> >+ <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div> >+ </li> >+ </ol> >+ </fieldset> >+ </li> >+ <li><label for="dateofbirthrequired">Age required: </label> <input type="text" name="dateofbirthrequired" id="dateofbirthrequired" value="[% dateofbirthrequired %]" size="3" maxlength="3" /> years</li> >+ <li><label for="upperagelimit">Upperage limit: </label> <input type="text" name="upperagelimit" id="upperagelimit" size="3" maxlength="3" value="[% upperagelimit %]" /> years</li> >+ <li><label for="enrolmentfee">Enrollment fee: </label><input type="text" name="enrolmentfee" id="enrolmentfee" size="6" value="[% enrolmentfee %]" /></li> >+ <li><label for="overduenoticerequired">Overdue notice required: </label> <select name="overduenoticerequired" id="overduenoticerequired"> >+ [% IF ( overduenoticerequired ) %] >+ <option value="0">No</option> >+ <option value="1" selected="selected">Yes</option> >+ [% ELSE %] >+ <option value="0" selected="selected">No</option> >+ <option value="1">Yes</option> >+ [% END %] >+ </select></li> >+ <li><label for="hidelostitems">Lost items in staff client: </label> <select name="hidelostitems" id="hidelostitems"> >+ [% IF ( hidelostitems ) %] >+ <option value="0">Shown</option> >+ <option value="1" selected="selected">Hidden by default</option> >+ [% ELSE %] >+ <option value="0" selected="selected">Shown</option> >+ <option value="1">Hidden by default</option> >+ [% END %] >+ </select></li> >+ <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li> >+ <li> >+ <label for="category_type" class="required">Category type: </label> >+ <select name="category_type" id="category_type"> >+ [% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %] >+ [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %] >+ [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %] >+ [% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %] >+ [% IF ( type_I ) %]<option value="I" selected="selected">Organization</option>[% ELSE %]<option value="I">Organization</option>[% END %] >+ [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %] >+ [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %] >+ </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> >+ [% FOREACH branch IN branches_loop %] >+ [% IF ( branch.selected ) %] >+ <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% ELSE %] >+ <option value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ <span>Select <i>All branches</i> if this category type must to be displayed all the time. Otherwise select libraries you want to associate with this value. >+ </span> >+ </li> >+ <li><label for="block_expired">Block expired patrons</label> >+ <select name="block_expired" id="block_expired"> >+ [% IF ( BlockExpiredPatronOpacActions == -1 ) %] >+ <option value="-1" selected="selected"> Follow system preference BlockExpiredPatronOpacActions </option> >+ [% ELSE %] >+ <option value="-1"> Follow system preference BlockExpiredPatronOpacActions </option> >+ [% END %] >+ >+ [% IF ( BlockExpiredPatronOpacActions == 1 ) %] >+ <option value="1" selected="selected"> Block </option> >+ [% ELSE %] >+ <option value="1"> Block </option> >+ [% END %] >+ >+ [% IF ( BlockExpiredPatronOpacActions == 0 ) %] >+ <option value="0" selected="selected"> Don't block </option> >+ [% ELSE %] >+ <option value="0"> Don't block </option> >+ [% END %] >+ </select> >+ <span> >+ Choose whether patrons of this category be blocked from public catalog actions such as renewing and placing holds when their cards have expired. >+ </span> >+ </li> >+ <li> >+ <label for="default_privacy">Default privacy: </label> >+ <select id="default_privacy" name="default_privacy"> >+ [% SWITCH default_privacy %] >+ [% CASE 'forever' %] >+ <option value="default">Default</option> >+ <option value="never">Never</option> >+ <option value="forever" selected="selected">Forever</option> >+ [% CASE 'never' %] >+ <option value="default">Default</option> >+ <option value="never" selected="selected">Never</option> >+ <option value="forever">Forever</option> >+ [% CASE %] >+ <option value="default" selected="selected">Default</option> >+ <option value="never">Never</option> >+ <option value="forever">Forever</option> >+ [% END %] >+ </select> >+ <span>Controls how long a patrons checkout history is kept for new patrons of this category. "Never" anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob <i>batch_anonymise.pl</i> which should be set up by your system administrator.</span> >+ </li> >+ </ol> >+</fieldset> >+ >+ [% IF ( EnhancedMessagingPreferences ) %] >+ <fieldset class="rows"> >+ <h4>Default messaging preferences for this patron category</h4> >+ [% INCLUDE 'messaging-preference-form.inc' %] >+ </fieldset> >+ [% END %] >+ <fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset> >+ </form> >+ >+[% END %] >+ >+[% IF ( delete_confirm ) %] >+ <form action="[% script_name %]" method="post"> >+ <fieldset> >+ <legend> >+ [% IF ( patrons_in_category > 0 ) %] >+ Category [% categorycode |html %] is in use. Deletion not possible! >+ [% ELSE %] >+ Confirm deletion of category [% categorycode |html %] >+ [% END %] >+ </legend> >+ >+[% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %] >+ <table> >+ <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr> >+ <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr> >+ <tr><th scope="row">Enrollment period: </th> >+ <td> >+ [% IF ( enrolmentperiod ) %] >+ [% enrolmentperiod %] months >+ [% ELSE %] >+ until [% enrolmentperioddate | $KohaDates %] >+ [% END %] >+ </td> >+ </tr> >+ <tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr> >+ <tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr> >+ <tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr> >+ <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> >+ [% SWITCH category.default_privacy %] >+ [% CASE 'default' %] >+ Default >+ [% CASE 'never' %] >+ Never >+ [% CASE 'forever' %] >+ Forever >+ [% END %] >+ </td> >+ </tr> >+</table> >+ <fieldset class="action">[% IF ( totalgtzero ) %] >+<input type="submit" value="OK" /></form> >+ [% ELSE %] >+ <input type="hidden" name="op" value="delete_confirmed" /> >+ <input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a> >+ [% END %]</fieldset></fieldset></form> >+[% END %] >+ >+[% IF ( else ) %] >+ >+<div id="toolbar" class="btn-toolbar"> >+ <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form"><i class="icon-plus"></i> New category</a> >+</div> >+ >+<h2>Patron category administration</h2> >+[% IF ( searchfield ) %] >+ You Searched for [% searchfield %]</span> >+ [% END %] >+[% IF ( loop ) %] >+<div id="pagertable_categorie"> >+</div> >+ <table id="table_categorie"> >+ <thead> >+ <tr> >+ <th scope="col">Code</th> >+ <th scope="col">Category name</th> >+ <th scope="col">Type</th> >+ <th scope="col">Enrollment period</th> >+ <th scope="col">Age required</th> >+ <th scope="col">Upper age limit</th> >+ <th scope="col">Enrollment fee</th> >+ <th scope="col">Overdue</th> >+ <th scope="col">Lost items</th> >+ <th scope="col">Hold fee</th> >+ [% IF ( EnhancedMessagingPreferences ) %] >+ <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> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH loo IN loop %] >+ <tr> >+ <td>[% loo.categorycode |html %]</td> >+ <td> >+ <a href="[% loo.script_name %]?op=add_form&categorycode=[% loo.categorycode |uri %]">[% loo.description |html %]</a> >+ </td> >+ <td> >+ [% IF ( loo.type_A ) %]Adult[% END %] >+ [% IF ( loo.type_C ) %]Child[% END %] >+ [% IF ( loo.type_P ) %]Prof.[% END %] >+ [% IF ( loo.type_I ) %]Org.[% END %] >+ [% IF ( loo.type_S ) %]Staff[% END %] >+ [% IF ( loo.type_X ) %]Statistical[% END %] >+ </td> >+ <td> >+ [% IF ( loo.enrolmentperiod ) %] >+ [% loo.enrolmentperiod %] months >+ [% ELSE %] >+ until [% loo.enrolmentperioddate | $KohaDates %] >+ [% END %] >+ >+ </td> >+ <td>[% loo.dateofbirthrequired %] years</td> >+ <td>[% loo.upperagelimit %] years</td> >+ <td>[% loo.enrolmentfee %]</td> >+ <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td> >+ <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td> >+ <td>[% loo.reservefee %]</td> >+ [% IF ( EnhancedMessagingPreferences ) %] >+ <td style="white-space: nowrap; font-size:80%;"> >+ [% IF ( loo.messaging_prefs ) %] >+ [% FOREACH prefs IN loo.messaging_prefs %] >+ [% FOREACH transport IN prefs.transports %] >+ [% IF ( transport.transport ) %] >+ [% IF ( prefs.Item_Due ) %]Item due >+ [% ELSIF ( prefs.Advance_Notice ) %]Advance notice >+ [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events >+ [% ELSIF ( prefs.Hold_Filled ) %]Hold filled >+ [% ELSIF ( prefs.Item_Check_in ) %]Item check-in >+ [% ELSIF ( prefs.Item_Checkout ) %]Item checkout >+ [% ELSE %]Unknown >+ [% END %]: >+ <strong>[% transport.transport %]</strong><br /> >+ [% ELSE %]None<br />[% END %] >+ [% END %] >+ [% END %] >+ [% ELSE %] >+ None >+ [% END %] >+ </td> >+ [% END %] >+ <td> >+ [% IF loo.branches.size > 0 %] >+ [% branches_str = "" %] >+ [% FOREACH branch IN loo.branches %] >+ [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %] >+ [% END %] >+ <span title="[% branches_str %]"> >+ [% IF loo.branches.size > 1 %] >+ [% loo.branches.size %] branches limitations >+ [% ELSE %] >+ [% loo.branches.size %] branch limitation >+ [% END %] >+ </span> >+ [% ELSE %] >+ No limitation >+ [% END %] >+ </td> >+ <td>[% IF loo.canbeguarantee %]Yes[% ELSE %]No[% END %]</td> >+ <td> >+ [% SWITCH loo.default_privacy %] >+ [% CASE 'default' %] >+ Default >+ [% CASE 'never' %] >+ Never >+ [% CASE 'forever' %] >+ Forever >+ [% END %] >+ </td> >+ <td><a href="[% loo.script_name %]?op=add_form&categorycode=[% loo.categorycode |uri %]">Edit</a></td> >+ <td><a href="[% loo.script_name %]?op=delete_confirm&categorycode=[% loo.categorycode |uri %]">Delete</a></td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+[% ELSE %] >+ <div class="dialog alert">No categories have been defined. <a href="/cgi-bin/koha/admin/categorie.pl?op=add_form">Create a new category</a>.</div> >+[% END %] >+[% END %] >+ >+</div> >+</div> >+<div class="yui-b"> >+[% INCLUDE 'admin-menu.inc' %] >+</div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >index d4d0130..4112d44 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >@@ -238,6 +238,18 @@ > </select> > <span class="required">Required</span> > </li> >+ <li> >+ <label for="canbeguarantee">Can be guarantee</label> >+ <select name="canbeguarantee" id="canbeguarantee"> >+ [% IF category.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> >@@ -345,6 +357,7 @@ > <tr><th scope="row">Receives overdue notices: </th><td>[% IF category. overduenoticerequired %]Yes[% ELSE %]No[% END %]</td></tr> > <tr><th scope="row">Lost items in staff client</th><td>[% IF category.hidelostitems %]Hidden by default[% ELSE %]Shown[% END %]</td></tr> > <tr><th scope="row">Hold fee: </th><td>[% category.reservefee | $Price %]</td></tr> >+ <tr><th scope="row">Can be guarantee</th><td>[% IF category.canbeguarantee %]Yes[% ELSE %]No[% END %]</td></tr> > <tr> > <th scope="row">Default privacy: </th> > <td> >@@ -401,6 +414,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> >@@ -478,6 +492,7 @@ > No limitation > [% END %] > </td> >+ <td>[% IF category.canbeguarantee %] Yes [% ELSE %] no [% END %]</td> > <td> > [% SWITCH category.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 ee64970..0b80c92 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 >@@ -159,6 +159,11 @@ Patrons: > yes: Do > no: "Don't" > - charge a fee when a patron changes to a category with an enrollment fee. >+ - >+ - "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 e646890..dac1483 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -131,14 +131,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"); > >@@ -435,7 +430,6 @@ > [% END %] > </li> > [% ELSE %] >- [% IF ( C ) %] > [% IF ( guarantorid ) %] > <li id="contact-details"> > [% ELSE %] >@@ -453,9 +447,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> >@@ -1025,6 +1018,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 57bd588..c961653 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -232,13 +232,24 @@ function validate1(date) { > </li>[% 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> >+ <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 ae54383..fa2f009 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -39,6 +39,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 Email::Valid; >@@ -232,8 +233,9 @@ if ( ( $op eq 'insert' ) and !$nodouble ) { > } > } > >- #recover all data from guarantor address phone ,fax... >-if ( $guarantorid ) { >+#recover all data from guarantor address phone ,fax... >+if ( $guarantorid and ( $category_type eq 'C' || $category_type eq 'P')) { >+ > if (my $guarantordata=GetMember(borrowernumber => $guarantorid)) { > $category_type = $guarantordata->{categorycode} eq 'I' ? 'P' : 'C'; > $guarantorinfo=$guarantordata->{'surname'}." , ".$guarantordata->{'firstname'}; >@@ -245,8 +247,14 @@ if ( $guarantorid ) { > 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)) { >- $newdata{$_} = $guarantordata->{$_}; >+ $newdata{$_} = $guarantordata->{$_}; > } >+ my $additionalGuarantorField=C4::Context->preference("AdditionalGuarantorField"); >+ my @field_add=split(/\|/,$additionalGuarantorField); >+ my $guarantordata=GetMember(borrowernumber => $guarantorid); >+ foreach (@field_add) { >+ $newdata{$_} = $guarantordata->{$_}; >+ } > } > } > } >@@ -674,7 +682,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 482f2a2..80a3170 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -171,33 +171,34 @@ 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)); > } >-else { >- if ($data->{'guarantorid'}){ >- my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'}); >- $template->param(guarantor => 1); >- foreach (qw(borrowernumber cardnumber firstname surname)) { >- $template->param("guarantor$_" => $guarantor->{$_}); >- } >+( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' || $category_type eq 'I' ); >+ >+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); >- } > } >- >-$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' ); >- > 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