Bugzilla – Attachment 95859 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: (follow-up) Code cleaning
Bug-12446-follow-up-Code-cleaning.patch (text/plain), 10.47 KB, created by
Maryse Simard
on 2019-11-27 16:19:25 UTC
(
hide
)
Description:
Bug 12446: (follow-up) Code cleaning
Filename:
MIME Type:
Creator:
Maryse Simard
Created:
2019-11-27 16:19:25 UTC
Size:
10.47 KB
patch
obsolete
>From dfc03ce7303db84f072ff0ea506ad56298f7358b Mon Sep 17 00:00:00 2001 >From: Maryse Simard <maryse.simard@inlibro.com> >Date: Tue, 1 Oct 2019 15:41:21 -0400 >Subject: [PATCH] Bug 12446: (follow-up) Code cleaning > >Some variable name change, >put database update in a perl file, >remove unused code >and other small fixes. >--- > C4/Utils/DataTables/Members.pm | 2 -- > .../atomicupdate/bug_12446-EnableAdultGarantee.sql | 11 ----------- > installer/data/mysql/atomicupdate/bug_12446.perl | 21 +++++++++++++++++++++ > 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 | 14 +++++--------- > 8 files changed, 31 insertions(+), 27 deletions(-) > delete mode 100644 installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql > create mode 100644 installer/data/mysql/atomicupdate/bug_12446.perl > >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index a6526c5..00030b0 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::Members::Attributes qw/get_guarantor_shared_attributes/; > use C4::Utils::DataTables; > use Koha::DateUtils; >@@ -58,7 +57,6 @@ sub search { > } > } > >- $dbh = C4::Context->dbh; > my @columns = qw( borrowernumber surname firstname streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode phone phonepro mobile fax email emailpro); > if( my @guarantor_attributes = @{ get_guarantor_shared_attributes() }){ > foreach my $item (@guarantor_attributes) { >diff --git a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql b/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql >deleted file mode 100644 >index ded53de..0000000 >--- a/installer/data/mysql/atomicupdate/bug_12446-EnableAdultGarantee.sql >+++ /dev/null >@@ -1,11 +0,0 @@ >--- ******** -- >--- SYSPREFS -- >--- ******** -- >-INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) >-VALUES ('GuarantorFields', 'streetnumber|address|address2|city|state|zipcode|country|branchcode|phonepro|mobile|email|emailpro|fax', NULL, 'Fields to be transfered from guarantor to guarantee.', 'free') >- >--- ********* -- >--- STRUCTURE -- >--- ********* -- >-ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0' AFTER `checkprevcheckout`; >-UPDATE categories SET canbeguarantee = 1 WHERE category_type = 'P' OR category_type = 'C'; >diff --git a/installer/data/mysql/atomicupdate/bug_12446.perl b/installer/data/mysql/atomicupdate/bug_12446.perl >new file mode 100644 >index 0000000..6ad0e37 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_12446.perl >@@ -0,0 +1,21 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ ## ******** ## >+ ## SYSPREFS ## >+ ## ******** ## >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) >+ VALUES ('GuarantorFields', 'streetnumber|address|address2|city|state|zipcode|country|branchcode|phonepro|mobile|email|emailpro|fax', NULL, 'Fields to be transfered from guarantor to guarantee.', 'free') >+ }); >+ >+ ## ********* ## >+ ## STRUCTURE ## >+ ## ********* ## >+ if ( !column_exists( 'categories', 'canbeguarantee') ){ >+ $dbh->do("ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0' AFTER `checkprevcheckout`"); >+ $dbh->do("UPDATE categories SET canbeguarantee = 1 WHERE category_type = 'P' OR category_type = 'C'"); >+ } >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 12446 - Enable an adult to have a guarantor)\n"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 78dcc37..a56962a 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -322,9 +322,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 0d1938a..7e57427 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 >@@ -220,7 +220,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 cf372ce..5bfa849 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -257,7 +257,7 @@ > <tr> > [% IF logged_in_user.can_see_patron_infos( guarantee ) %] > <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber | uri %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></td> >- <td style='text-align:right'>[% guarantee.account.balance | html %]</td> >+ <td style='text-align:right'>[% guarantee.account.balance | $Price %]</td> > [% ELSE %] > <td>[% guarantee.firstname | html %] [% guarantee.surname | html %]</td> > [% END %] >@@ -265,7 +265,7 @@ > [% END %] > [% IF logged_in_user.can_see_patron_infos( guarantee ) %] > <td>Total</td> >- <td style='text-align:right'>[% amounttot | html %]</td> >+ <td style='text-align:right'>[% amount_total | $Price %]</td> > [% END %] > </table> > </li> >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 e0b5b72..cf0e7ec 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": >- "<a href=\"#\" class=\"btn btn-default btn-xs select_user\" data-borrowernumber=\"[% data.borrowernumber | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber | html %]\" name=\"borrower_data[% data.borrowernumber | html %]\" value=\"[% To.json(data) | html %]\" /><input type=\"hidden\" id=\"guarantor_attributes\" name=\"guarantor_attributes\" value=\"[% To.json(attributes) | html %]\" />" >+ "<a href=\"#\" class=\"btn btn-default btn-xs select_user\" data-borrowernumber=\"[% data.borrowernumber | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber | html %]\" name=\"borrower_data[% data.borrowernumber | html %]\" value=\"[% To.json(data) | html %]\" /><input type=\"hidden\" id=\"guarantor_attributes[% data.borrowernumber | html %]\" name=\"guarantor_attributes[% data.borrowernumber | html %]\" value=\"[% To.json(attributes) | html %]\" />" > }[% UNLESS loop.last %],[% END %] > [% END %] > ] >diff --git a/members/moremember.pl b/members/moremember.pl >index 5ffd06f..c19546c 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -116,19 +116,15 @@ $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.7.4
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