From 42c829837cef09fa5449ec415ec2926784830ddb Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 12 Mar 2013 13:46:41 -0400 Subject: [PATCH] Bug 6739: (follow-up) fix various issues - translation issues - wording issues Signed-off-by: Melia Meggs Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Galen Charlton --- C4/Members.pm | 9 +++++ .../prog/en/modules/admin/categorie.tt | 20 +++++++++-- .../opac-tmpl/prog/en/modules/opac-user.tt | 18 ++++++++-- opac/opac-renew.pl | 36 ++++++++++--------- opac/opac-reserve.pl | 9 ++--- opac/opac-user.pl | 3 +- 6 files changed, 68 insertions(+), 27 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index fc0f0b42c7..c3bd1c3c19 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -380,6 +380,15 @@ sub GetMemberDetails { $borrower->{'showname'} = $borrower->{'firstname'}; } + # Handle setting the true behavior for BlockExpiredPatronOpacActions + $borrower->{'BlockExpiredPatronOpacActions'} = + C4::Context->preference('BlockExpiredPatronOpacActions') + if ( $borrower->{'BlockExpiredPatronOpacActions'} == -1 ); + + $borrower->{'is_expired'} = + Date_to_Days( Today() ) > + Date_to_Days( split /-/, $borrower->{'dateexpiry'} ); + return ($borrower); #, $flags, $accessflagshash); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt index 44c0b1e6f1..40898ad134 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt @@ -191,9 +191,23 @@
  • Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
  • diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt index c71ad2d38a..882a9ba892 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -92,17 +92,29 @@ var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended [% IF ( BORROWER_INF.warnexpired ) %]
    - Please note: Your card has expired. Please contact the library for more information. + Please note: Your account has expired. Please contact the library for more information.
    [% ELSIF ( BORROWER_INF.warnexpired ) %]
    - Please note: You card has expired as of [% BORROWER_INF.warnexpired %]. Please contact the library if you wish to renew your subscription. + Please note: You account has expired as of [% BORROWER_INF.warnexpired %]. Please contact the library if you wish to renew your account.
    [% END %] [% IF ( RENEW_ERROR ) %]
    - Please note: You're renew failed with the following error: [% RENEW_ERROR %] + Please note: + + Your account renewal failed because of the following: + [% FOREACH error IN RENEW_ERROR.split('|') %] + [% IF error == 'card_expired' %] + Your account has expired. Please contact the library for more information. + [% ELSIF error == 'too_many' %] + You have renewed this item the maximum number of times allowed. + [% ELSIF error == 'on_reserve' %] + This item is on hold for another patron. + [% END %] + [% END %] +
    [% END %] diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl index 9c6511a0fa..ca58f3ded8 100755 --- a/opac/opac-renew.pl +++ b/opac/opac-renew.pl @@ -27,6 +27,7 @@ use warnings; use CGI; use C4::Circulation; use C4::Auth; +use C4::Context; use C4::Items; use C4::Members; use Date::Calc qw( Today Date_to_Days ); @@ -48,38 +49,41 @@ my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); my $errorstring=''; my $member_details = GetMemberDetails($borrowernumber); -# BlockExpiredPatronOpacActions syspref 0 is false, 1 is true. BlockExpiredPatronOpacActions for categories (from GetMemberDetails) -1 means use syspref, 0 is false, 1 is true (where false means dont block, true means block) -if( ($member_details->{'BlockExpiredPatronOpacActions'} == -1 ? C4::Conext->preference('BlockExpiredPatronOpacActions') : $member_details->{'BlockExpiredPatronOpacActions'}) - && Date_to_Days( Today() ) > Date_to_Days( split /-/, $member_details->{'dateexpiry'} ) ){ - $errorstring='unable to renew as your card has expired'; -} else { - for my $itemnumber ( @items ) { - my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber ); + +if ( $member_details->{'BlockExpiredPatronOpacActions'} + && $member_details->{'is_expired'} ) +{ + $errorstring = 'card_expired'; +} +else { + for my $itemnumber (@items) { + my ( $status, $error ) = + CanBookBeRenewed( $borrowernumber, $itemnumber ); if ( $status == 1 && $opacrenew == 1 ) { my $renewalbranch = C4::Context->preference('OpacRenewalBranch'); my $branchcode; - if ($renewalbranch eq 'itemhomebranch'){ + if ( $renewalbranch eq 'itemhomebranch' ) { my $item = GetItem($itemnumber); - $branchcode=$item->{'homebranch'}; + $branchcode = $item->{'homebranch'}; } - elsif ($renewalbranch eq 'patronhomebranch'){ + elsif ( $renewalbranch eq 'patronhomebranch' ) { my $borrower = GetMemberDetails($borrowernumber); $branchcode = $borrower->{'branchcode'}; } - elsif ($renewalbranch eq 'checkoutbranch'){ + elsif ( $renewalbranch eq 'checkoutbranch' ) { my $issue = GetOpenIssue($itemnumber); $branchcode = $issue->{'branchcode'}; } - elsif ($renewalbranch eq 'NULL'){ - $branchcode=''; + elsif ( $renewalbranch eq 'NULL' ) { + $branchcode = ''; } else { - $branchcode='OPACRenew' + $branchcode = 'OPACRenew'; } - AddRenewal( $borrowernumber, $itemnumber, $branchcode); + AddRenewal( $borrowernumber, $itemnumber, $branchcode ); } else { - $errorstring .= $error ."|"; + $errorstring .= $error . "|"; } } } diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 65ea94640c..a842869b28 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -67,12 +67,13 @@ sub get_out { my ( $borr ) = GetMemberDetails( $borrowernumber ); # check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block -if( $borr->{'BlockExpiredPatronOpacActions'} == -1 ? C4::Context->preference("BlockExpiredPatronOpacActions") : $borr->{'BlockExpiredPatronOpacActions'} ) { +if ( $borr->{'BlockExpiredPatronOpacActions'} ) { + + if ( $borr->{'is_expired'} ) { - if( Date_to_Days( Today() ) > Date_to_Days( split /-/, $borr->{'dateexpiry'} ) ){ # cannot reserve, their card has expired and the rules set mean this is not allowed - $template->param( message=>1, expired_patron=>1 ); - get_out($query, $cookie, $template->output); + $template->param( message => 1, expired_patron => 1 ); + get_out( $query, $cookie, $template->output ); } } diff --git a/opac/opac-user.pl b/opac/opac-user.pl index c16d575422..935850e513 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -135,7 +135,7 @@ if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') } # pass on any renew errors to the template for displaying -$template->param( RENEW_ERROR => $query->param('renew_error') ) if $query->param('renew_error'); +my $renew_error = $query->param('renew_error'); $template->param( BORROWER_INFO => \@bordat, borrowernumber => $borrowernumber, @@ -143,6 +143,7 @@ $template->param( BORROWER_INFO => \@bordat, OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0, surname => $borr->{surname}, showname => $borr->{showname}, + RENEW_ERROR => $renew_error, ); #get issued items .... -- 2.39.5