From 9dcdc42433a2a5d6c6e72ca7703d12683bbda512 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 26 Jun 2014 12:34:36 -0400 Subject: [PATCH] Bug 9303 [5] [QA Followup 2] * Hides the ability to set visibility of checkouts if patron has no guarantor * Hides the setting on "your personal details" if OPACPrivacy is enabled * Adds the name of the guarantor near the setting on both opac pages * Changes "Call No." to "Call number". There is pleny of space for the real word, so why not use it? --- Koha/Schema/Result/Borrower.pm | 6 +++- Koha/Template/Plugin/Koha.pm | 15 +++++++++ installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 2 +- .../prog/en/modules/admin/preferences/opac.pref | 2 +- .../bootstrap/en/modules/opac-memberentry.tt | 10 ++++-- .../opac-tmpl/bootstrap/en/modules/opac-privacy.tt | 32 ++++++++++++-------- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 6 ++-- 8 files changed, 52 insertions(+), 23 deletions(-) diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 3915ed7..6a3fb10 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1021,6 +1021,10 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07000 @ 2013-11-07 08:15:21 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TQTGI0fDt+xCFs+8nOarfA +__PACKAGE__->belongs_to( + "guarantor", + "Koha::Schema::Result::Borrower", + { borrowernumber => "guarantorid" }, +); -# You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/Koha/Template/Plugin/Koha.pm b/Koha/Template/Plugin/Koha.pm index 2eff9f1..e5f3374 100644 --- a/Koha/Template/Plugin/Koha.pm +++ b/Koha/Template/Plugin/Koha.pm @@ -22,6 +22,7 @@ use Modern::Perl; use base qw( Template::Plugin ); use C4::Context; +use Koha::Database; =pod @@ -44,4 +45,18 @@ sub Preference { return C4::Context->preference( $pref ); } +sub Find { + my ( $self, $rs, $id ) = @_; + + return unless ( $rs && $id ); + + my $resultset = Koha::Database->new()->schema()->resultset($rs); + + return unless $resultset; + + my $row = $resultset->find($id); + + return $row; +} + 1; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index e4b08e5..08871ab 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -25,7 +25,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'), ('AllowOfflineCirculation','0','','If on, enables HTML5 offline circulation functionality.','YesNo'), ('AllowOnShelfHolds','0','','Allow hold requests to be placed on items that are not on loan','YesNo'), -('AllowPatronToSetRelativesCheckoutsVisibility', '0', NULL, 'If enabled, the patron can set checkouts to be visible to guarantor from opac-memberentry.pl', 'YesNo'), +('AllowPatronToSetRelativesCheckoutsVisibility', '0', NULL, 'If enabled, the patron can set checkouts to be visible to his or her guarantor', 'YesNo'), ('AllowPKIAuth','None','None|Common Name|emailAddress','Use the field from a client-side SSL certificate to look a user in the Koha database','Choice'), ('AllowPurchaseSuggestionBranchChoice','0','1','Allow user to choose branch when making a purchase suggestion','YesNo'), ('AllowRenewalLimitOverride','0',NULL,'if ON, allows renewal limits to be overridden on the circulation screen','YesNo'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 468e6a9..8eee821 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8615,7 +8615,7 @@ if(CheckVersion($DBversion)) { INSERT INTO systempreferences (variable, value, options, explanation, type ) VALUES ( 'AllowPatronToSetRelativesCheckoutsVisibility', '0', NULL, - 'If enabled, the patron can set checkouts to be visible to guarantor from opac-memberentry.pl', 'YesNo' + 'If enabled, the patron can set checkouts to be visible to his or her guarantor', 'YesNo' ) }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index bb26bcb..973d4fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -593,7 +593,7 @@ OPAC: choices: yes: Allow no: "Don't allow" - - patrons to choose their own privacy settings for showing checkouts to relatives from "your personal details" reguardless of the setting for OPACPrivacy. + - patrons to choose their own privacy settings for showing the patron's checkouts to the patron's guarantor". - - Use borrowernumber - pref: AnonymousPatron diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index c3b29cc..313cdff 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -54,12 +54,12 @@
You typed in the wrong characters in the box before submitting. Please try again.
[% END %] - [% IF Koha.Preference('AllowPatronToSetRelativesCheckoutsVisibility') %] + [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetRelativesCheckoutsVisibility') %]
Privacy
  1. - + -
    - - -
    + [% SET b = Koha.Find('Borrower', borrower.borrowernumber) %] + [% IF b.guarantorid && Koha.Preference('AllowPatronToSetRelativesCheckoutsVisibility') %] +
    + + + + Your gurantor is [% b.guarantor.firstname %] [% b.guarantor.surname %] + +
    - + + [% END %]

Immediate deletion

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 126d404..ab82bb0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -134,7 +134,7 @@ [% IF ( show_barcode ) %] Barcode [% END %] - Call No. + Call number [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %] Renew [% END %] @@ -371,7 +371,7 @@ Title Due Barcode - Call No. + Call number Relative @@ -420,7 +420,7 @@ Title [% UNLESS ( item_level_itypes ) %]Item type [% END %] [% IF ( show_barcode ) %]Barcode[% END %] - Call no. + Call number Due [% IF ( OpacRenewalAllowed ) %] Renew -- 1.7.2.5