From 7700f30f19ccff98448b8ea4a45a41f43fbd2180 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: Kyle M Hall (cherry picked from commit e28f19f0a88e334c99a45fadf96ae504bbb17ebe) Signed-off-by: Katrin Fischer --- circ/circulation.pl | 1 - koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc | 4 ++-- members/boraccount.pl | 1 - members/deletemem.pl | 1 - 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(+), 15 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 903c73a220..5f8685736c 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -645,7 +645,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 bb8b68ddf9..22248211de 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -142,8 +142,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 ee8ea09cb4..4cf9095fb3 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -115,7 +115,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 d293ef7ca4..c4eb8b69c1 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -126,7 +126,6 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_ phone => $bor->{'phone'}, email => $bor->{'email'}, branchcode => $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 76b34923ff..8150b7ff46 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -99,7 +99,6 @@ if ($add){ borrowernumber => $borrowernumber, categoryname => $data->{'description'}, 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 906e2fe194..86c9506229 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -124,7 +124,6 @@ if ($add){ borrowernumber => $borrowernumber, categoryname => $data->{'description'}, 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 c4f7ec10c8..5aa40a93bc 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -202,7 +202,6 @@ $template->param( branchcode => $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 39bdf30c9e..1625e32d56 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -143,7 +143,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 3a7edfccaf..98356f4867 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -338,7 +338,6 @@ $template->param( quickslip => $quickslip, housebound_role => $patron->housebound_role, 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 076e78713f..962a3f1c30 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -79,7 +79,6 @@ $template->param( borrowernumber => $borrowernumber, sentnotices => 1, 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 bfca78b80e..6e24c6f7ff 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -107,7 +107,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 1cb6ad9a70..42e5fb21f0 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -152,7 +152,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 ed58f1c448..bb4b316fd5 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -126,8 +126,6 @@ $template->param( categoryname => $data->{description}, is_child => ( $data->{category_type} eq 'C' ), 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