From 46fd998c85ea36291f5af6169f8860d36fb57a94 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 12 Apr 2017 10:23:56 -0400 Subject: [PATCH] Bug 18423 - Add child button not always appearing - problem in template variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch removes the retrieval of the syspref borrowerRelationship from the scripts and moves it to a check using the Template Toolkit plugin To test: 1 - Apply patch 2 - Ensure 'Add child' button displays appropriately on all member pages. Tested 3 pateches together, works as expected. Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Signed-off-by: Mason James --- circ/circulation.pl | 1 - koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc | 4 ++-- members/boraccount.pl | 1 - members/deletemem.pl | 2 -- members/mancredit.pl | 1 - members/maninvoice.pl | 1 - members/member-flags.pl | 1 - members/member-password.pl | 1 - members/moremember.pl | 1 - members/notices.pl | 1 - members/pay.pl | 1 - members/paycollect.pl | 1 - members/readingrec.pl | 2 -- 13 files changed, 2 insertions(+), 16 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 92446c838a..e0e9dd5a81 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -644,7 +644,6 @@ $template->param( AudioAlerts => C4::Context->preference("AudioAlerts"), fast_cataloging => $fast_cataloging, CircAutoPrintQuickSlip => C4::Context->preference("CircAutoPrintQuickSlip"), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), RoutingSerials => C4::Context->preference('RoutingSerials'), 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 1a047967e2..af2b1292d4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -145,8 +145,8 @@ function searchToHold(){ [% END %] [% IF ( CAN_user_borrowers ) %] - [% IF ( adultborrower AND activeBorrowerRelationship ) %] - Add child + [% IF adultborrower AND Koha.Preference("borrowerRelationship") %] + Add child [% END %] [% IF ( CAN_user_borrowers ) %] Change password diff --git a/members/boraccount.pl b/members/boraccount.pl index 0b64083faa..8f86c04f3b 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -116,7 +116,6 @@ $template->param( is_child => ($data->{'category_type'} eq 'C'), reverse_col => $reverse_col, accounts => $accts, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); diff --git a/members/deletemem.pl b/members/deletemem.pl index b765db78e9..2c0db7092f 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -127,8 +127,6 @@ if ($countissues > 0 or $flags->{'CHARGES'} or $data->{'borrowernumber'} or $de phone => $bor->{'phone'}, email => $bor->{'email'}, branchcode => $bor->{'branchcode'}, - branchname => GetBranchName($bor->{'branchcode'}), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); if ($countissues >0) { diff --git a/members/mancredit.pl b/members/mancredit.pl index c48f8cd219..7270002b67 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -100,7 +100,6 @@ if ($add){ categoryname => $data->{'description'}, branchname => GetBranchName($data->{'branchcode'}), is_child => ($data->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 355887116e..b7839b80ab 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -125,7 +125,6 @@ if ($add){ categoryname => $data->{'description'}, branchname => GetBranchName($data->{'branchcode'}), is_child => ($data->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/member-flags.pl b/members/member-flags.pl index e1e6bc0398..2fce9f4e4e 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -203,7 +203,6 @@ $template->param( branchname => GetBranchName($bor->{'branchcode'}), loop => \@loop, is_child => ($bor->{'category_type'} eq 'C'), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), csrf_token => Koha::Token->new->generate_csrf( { session_id => scalar $input->cookie('CGISESSID'), } ), ); diff --git a/members/member-password.pl b/members/member-password.pl index 257883ed9f..9e2a04d0a7 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -146,7 +146,6 @@ $template->param( userid => $bor->{'userid'}, destination => $destination, is_child => ( $bor->{'category_type'} eq 'C' ), - activeBorrowerRelationship => ( C4::Context->preference('borrowerRelationship') ne '' ), minPasswordLength => $minpw, RoutingSerials => C4::Context->preference('RoutingSerials'), csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID'), }), diff --git a/members/moremember.pl b/members/moremember.pl index ee5249bc71..f3c36e8017 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -340,7 +340,6 @@ $template->param( samebranch => $samebranch, quickslip => $quickslip, privacy_guarantor_checkouts => $data->{'privacy_guarantor_checkouts'}, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), RoutingSerials => C4::Context->preference('RoutingSerials'), diff --git a/members/notices.pl b/members/notices.pl index 2668e1fe3c..ac68c000b5 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -81,7 +81,6 @@ $template->param( sentnotices => 1, branchname => GetBranchName($borrower->{'branchcode'}), categoryname => $borrower->{'description'}, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/pay.pl b/members/pay.pl index 9d5a37a9a6..fdd0ef7928 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -105,7 +105,6 @@ for (@names) { $template->param( finesview => 1, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); diff --git a/members/paycollect.pl b/members/paycollect.pl index aafca6de99..68eeed42cd 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -151,7 +151,6 @@ $template->param( borrower => $borrower, categoryname => $borrower->{description}, total => $total_due, - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'), ); diff --git a/members/readingrec.pl b/members/readingrec.pl index 79351ff51a..56a77a00f4 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -130,8 +130,6 @@ $template->param( is_child => ( $data->{category_type} eq 'C' ), branchname => $branches->{ $data->{branchcode} }->{branchname}, loop_reading => $issues, - activeBorrowerRelationship => - ( C4::Context->preference('borrowerRelationship') ne '' ), RoutingSerials => C4::Context->preference('RoutingSerials'), ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5