From 97a0dd97681e9028af967b6e87de92fd7edece87 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=UTF-8 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 --- 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 3b43316..941306a 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 68dd762..5b467ac 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 ee8ea09..4cf9095 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 0943994..85c9ff5 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 76b3492..8150b7f 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 906e2fe..86c9506 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 c188d98..b89707e 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 39bdf30..1625e32 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 7bea08da..4f88862 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 076e787..962a3f1 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 7e008d4..9bf470e 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 ac1c281..2089006 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 ed58f1c..bb4b316 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.9.3