From df8533fece2ee1b3666b1be15ba4de4af3a317ab Mon Sep 17 00:00:00 2001 From: Maryse Simard Date: Tue, 1 Oct 2019 15:41:21 -0400 Subject: [PATCH] Bug 12446: (follow-up) Code cleaning Some variable name change, remove unused code and other small fixes. --- C4/Utils/DataTables/Members.pm | 2 -- installer/data/mysql/kohastructure.sql | 2 +- .../prog/en/modules/common/patron_search.tt | 2 +- .../prog/en/modules/members/moremember.tt | 4 ++-- .../en/modules/members/tables/guarantor_search.tt | 2 +- members/moremember.pl | 12 ++++-------- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index f5a0b10458..eda02f05c9 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -2,7 +2,6 @@ package C4::Utils::DataTables::Members; use Modern::Perl; use C4::Context; -use C4::Members; use C4::Utils::DataTables; use Koha::DateUtils; @@ -78,7 +77,6 @@ sub search { } } - $dbh = C4::Context->dbh; my @columns = qw( borrowernumber surname firstname othernames flags streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode phone phonepro mobile fax email emailpro); my @guarantor_attributes = split(/\|/, C4::Context->preference("GuarantorFields")); if( @guarantor_attributes ){ diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index fd49cda51a..4fca3bb8fd 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -323,9 +323,9 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr `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 `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'. + `canbeguarantee` tinyint(1) NOT NULL default '0', `reset_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can do the password reset flow, `change_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can change their passwords in the OAPC - `canbeguarantee` tinyint(1) NOT NULL default '0' PRIMARY KEY (`categorycode`), UNIQUE KEY `categorycode` (`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt index d647e90e20..94701857fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt @@ -225,7 +225,7 @@ e.preventDefault(); var borrowernumber = $(this).data("borrowernumber"); var borrower_data = $("#borrower_data"+borrowernumber).val(); - var guarantor_attributes = $("#guarantor_attributes").val(); + var guarantor_attributes = $("#guarantor_attributes"+borrowernumber).val(); if ( !guarantor_attributes ) guarantor_attributes = "{}"; select_user( borrowernumber, JSON.parse(borrower_data), JSON.parse(guarantor_attributes) ); 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 ef7afef746..332e1c6421 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -267,7 +267,7 @@ [% IF logged_in_user.can_see_patron_infos( guarantee ) %] [% guarantee.firstname | html %] [% guarantee.surname | html %] - [% guarantee.account.balance | html %] + [% guarantee.account.balance | $Price %] [% ELSE %] [% guarantee.firstname | html %] [% guarantee.surname | html %] [% END %] @@ -275,7 +275,7 @@ [% END %] [% IF logged_in_user.can_see_patron_infos( guarantee ) %] Total - [% amounttot | html %] + [% amount_total | $Price %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt index 20cfca2dbc..593b0bafb7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt @@ -18,7 +18,7 @@ "dt_address": "[% INCLUDE escape_address data=data %]", "dt_action": - "Select" + "Select" }[% UNLESS loop.last %],[% END %] [% END %] ] diff --git a/members/moremember.pl b/members/moremember.pl index b05ee53ce7..389bd301ff 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -115,18 +115,14 @@ $template->param( my $relatives_issues_count = Koha::Checkouts->count({ borrowernumber => \@relatives }); -my $count = scalar @guarantees; -if ( $count ) { - $template->param( isguarantee => 1 ); - my $totalmount = 0; +if ( @guarantees ) { + my $total_amount = 0; foreach my $guarantee (@guarantees){ - $totalmount += $guarantee->account->balance; - + $total_amount += $guarantee->account->balance; } - $template->param( guarantees => \@guarantees); - $template->param( amounttot => sprintf("%.2f",$totalmount)); + $template->param( amount_total => $total_amount ); } # Calculate and display patron's age -- 2.17.1