From e28f19f0a88e334c99a45fadf96ae504bbb17ebe 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 --- circ/circulation.pl | 1 - koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc | 2 +- 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, 1 insertion(+), 14 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 3b4331624c..941306a1c8 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -636,7 +636,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 68dd7623b1..5b467ac275 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -142,7 +142,7 @@ function searchToHold(){ [% END %] [% IF ( CAN_user_borrowers ) %] - [% IF ( adultborrower AND activeBorrowerRelationship ) %] + [% IF adultborrower AND Koha.Preference("borrowerRelationship") %] Add child [% END %] [% IF ( CAN_user_borrowers ) %] 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 09439946ee..85c9ff5ec7 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 c188d9803e..b89707ea40 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -212,7 +212,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 7bea08da0a..4f888628bc 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -348,7 +348,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 7e008d4f1a..9bf470ee9a 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -114,7 +114,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 ac1c281277..20890063bd 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -175,7 +175,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