From b04b6ba4c721dd21ec2a402ede1a5b3ce3797c8c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 1 Apr 2021 13:29:29 +0000 Subject: [PATCH] Bug 27873: Improve message consistency: checkout and patron detail pages This patch creates a new include for showing circulation and patron-related messages on both the checkout page and the patron detail page. This allows the two pages to be consistent with each other. The patch also makes some minor CSS adjustments, including the addition of an SVG to replace an old GIF, arrow-bullet.gif. To test, apply the patch and rebuild the staff interface CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - View both the checkout and patron details page for patrons in the staff interface, confirming that the information is displayed in the same way, including: - Pending modifications - Pending expiration - Expired - Address in doubt - Card lost - Restricted (indefinite and with expiration) - Outstanding overdues - Outstanding return claims - Patron age incorrect for their category - Outstanding charges - Account credit - Waiting holds (at logged-in library or other library) - Circulation note (from borrowers.borrowernotes) - Messages (added at logged-in library or other library) EDIT: Fixed merge error. --- circ/circulation.pl | 8 +- .../intranet-tmpl/prog/css/src/staff-global.scss | 9 +- .../prog/en/includes/borrower_debarments.inc | 2 +- .../prog/en/includes/patron_messages.inc | 226 +++++++++++++++++++++ .../prog/en/modules/circ/circulation.tt | 133 +----------- .../prog/en/modules/members/moremember.tt | 117 +---------- koha-tmpl/intranet-tmpl/prog/img/arrow-bullet.gif | Bin 48 -> 0 bytes members/moremember.pl | 75 ++++++- 8 files changed, 320 insertions(+), 250 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc delete mode 100644 koha-tmpl/intranet-tmpl/prog/img/arrow-bullet.gif diff --git a/circ/circulation.pl b/circ/circulation.pl index f6dd318f97..4fd72616c4 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -465,7 +465,7 @@ if ($patron) { if ( $patron ) { my $noissues; if ( $patron->gonenoaddress ) { - $template->param( gna => 1 ); + $template->param( gonenoaddress => 1 ); $noissues = 1; } if ( $patron->lost ) { @@ -473,7 +473,7 @@ if ( $patron ) { $noissues = 1; } if ( $patron->is_debarred ) { - $template->param( dbarred=> 1 ); + $template->param( is_debarred=> 1 ); $noissues = 1; } my $account = $patron->account; @@ -542,7 +542,7 @@ if ( $patron ) { } } -my $messages = Koha::Patron::Messages->search( +my $patron_messages = Koha::Patron::Messages->search( { 'me.borrowernumber' => $borrowernumber, }, @@ -598,7 +598,7 @@ if ($restoreduedatespec || $stickyduedate) { } $template->param( - messages => $messages, + patron_messages => $patron_messages, borrowernumber => $borrowernumber, branch => $branch, was_renewed => scalar $query->param('was_renewed') ? 1 : 0, diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 6d9db96973..26ab296775 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -1720,18 +1720,15 @@ i { } } -.blocker { - color: #990000; -} - +.blocker, .inaccurate-item-statuses { color: #990000; } .circmessage { li { - list-style: url("../img/arrow-bullet.gif"); - margin-bottom: .2em; + list-style: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='5' height='5' viewBox='0 0 25 25'%3E%3Cpath fill='%23999' d='M9.66.95h4.56l9.21 11.85-9.21 10.53H9.66l5.08-10.53z'/%3E%3C/svg%3E"); + margin-bottom: .4em; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc index 511a6b88a5..632b3dc6d6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc @@ -23,7 +23,7 @@ [% CASE 'MANUAL' %] Manual [% CASE 'OVERDUES' %] - Overdues + Overdues [% CASE 'SUSPENSION' %] Suspension [% CASE 'DISCHARGE' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc new file mode 100644 index 0000000000..8f56ab2dd5 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -0,0 +1,226 @@ +[% SET ClaimReturnedWarningThreshold = Koha.Preference('ClaimReturnedWarningThreshold') %] +[% SET return_claims = patron.return_claims %] + +[% IF ( has_modifications || warndeparture || returnbeforeexpiry || expired || patron.gonenoaddress || patron.lost || userdebarred || odues || ( return_claims.count > ClaimReturnedWarningThreshold ) || age_limitations || charges || charges_guarantors_guarantees || charges_guarantees || credits ) %] +

Attention

+ + +[% END # /F ( has_modifications || warndeparture... %] + + +[% IF WaitingHolds.count %] +
+ [% SET waiting_here = 0 %] + [% SET waiting_elsewhere = 0 %] + [% FOREACH w IN WaitingHolds %] + [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode() ) %] + [% waiting_here = waiting_here + 1 %] + [% ELSE %] + [% waiting_elsewhere = waiting_elsewhere + 1 %] + [% END %] + [% END %] + + [% IF ( waiting_here > 0 ) %] +

Holds waiting here ([% waiting_here | html %])

+ + [% END %] + + [% IF ( waiting_elsewhere > 0 ) %] +

Holds waiting at other libraries ([% waiting_elsewhere | html %])

+ + [% END %] +
+[% END # /IF WaitingHolds.count %] + +[% IF ( patron.borrowernotes ) %] +
+

Notes

+ +
+[% END # /IF patron.borrowernotes %] + +[% IF ( patron_messages ) %] +
+

Messages

+ + Add a new message +
+[% END # /IF patron_messages %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index fb3abec220..79b19d171a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -750,82 +750,9 @@ [% ELSE %]
-

Attention:

[% END %] - - [% IF WaitingHolds.count %] -
- [% SET waiting_here = 0 %] - [% SET waiting_elsewhere = 0 %] - [% FOREACH w IN WaitingHolds %] - [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode() ) %] - [% waiting_here = waiting_here + 1 %] - [% ELSE %] - [% waiting_elsewhere = waiting_elsewhere + 1 %] - [% END %] - [% END %] - - [% IF ( waiting_here > 0 ) %] -

Holds waiting here ([% waiting_here | html %])

-
    - [% FOREACH w IN WaitingHolds %] - [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode() ) %] -
  • - [% w.biblio.title | html %] - ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]), - [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %] - [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %] - Hold placed on [% w.reservedate | $KohaDates %]. -
    - - [% SET expires_on = w.expirationdate %] - Waiting here [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %] - -
  • - [% END %] - [% END %] -
- [% END %] - - [% IF ( waiting_elsewhere > 0 ) %] -

Holds waiting at other libraries ([% waiting_elsewhere | html %])

-
    - [% FOREACH w IN WaitingHolds %] - [% IF ( w.branch.branchcode != Branches.GetLoggedInBranchcode() ) %] -
  • - [% w.biblio.title | html %] - ([% ItemTypes.GetDescription( w.item.effective_itemtype ) | html %]), - [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %] - [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber | html %]] [% END %] - Hold placed on [% w.reservedate | $KohaDates %]. -
    - - [% SET expires_on = w.expirationdate %] - Waiting at [% w.branch.branchname | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %] - -
  • - [% END %] - [% END %] -
- [% END %] - -
- [% END # /IF WaitingHolds.count %] [% IF ( notes ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index cd416da0ec..a26c35c493 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -2,6 +2,7 @@ [% USE Asset %] [% USE Koha %] [% USE Branches %] +[% USE ItemTypes %] [% USE KohaDates %] [% USE AuthorisedValues %] [% USE TablesSettings %] @@ -83,119 +84,23 @@
+

+ [% UNLESS ( I ) %] + [% patron.title | html %] [% patron.firstname | html %] + [% END %] + [% patron.surname | html %] ([% patron.cardnumber | html %]) +

+ [% IF ( was_renewed ) %]
Patron's account has been renewed until [% patron.dateexpiry | $KohaDates %]
[% END %] - [% IF fines || age_limitations %] -
-
    - [% IF fines %] - [% INCLUDE 'blocked-fines.inc' %] - [% END %] - [% IF age_limitations %] - [% INCLUDE 'category-out-of-age-limit.inc' %] - [% END %] -
-
- [% END %] - - [% IF ( patron_messages ) %] -
-

Messages:

- - Add a new message -
- [% END %] - - [% IF ( patron.borrowernotes ) %] -
-

Notes:

-
  • - - [% patron.borrowernotes | $raw | html_line_break %] - -
-
- [% END %] - - [% IF ( flagged ) %] -
-
    - [% IF ( patron.is_debarred ) %] -
  • Patron's account is restricted - [% IF ( userdebarreddate ) %] - until [% userdebarreddate | $KohaDates %] - [% END %] - - [% IF ( patron.debarredcomment ) %] - with the explanation: - [% IF patron.debarredcomment.search('OVERDUES_PROCESS') %] - Restriction added by overdues process [% patron.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %] - [% ELSE %] - [% patron.debarredcomment | html_line_break %] - [% END %] - - [% END %] - View restrictions -
  • - [% END %] - [% IF ( patron.gonenoaddress ) %] -
  • Patron's address is in doubt.
  • - [% END %] - [% IF ( patron.lost ) %] -
  • Patron's card has been reported lost.
  • - [% END %] - [% IF ( patron.is_expired ) %] -
  • - Expiration: - [% IF ( patron.dateexpiry ) %] - Patron's card expired on [% patron.dateexpiry | $KohaDates %]. - [% ELSE %] - Patron's card has expired. - [% END %] - Renew or Edit details -
  • - [% ELSIF ( patron.is_going_to_expire ) %] -
  • - Expiration: Patron's card will expire soon. - Patron's card expires on [% patron.dateexpiry | $KohaDates %] - Renew or Edit details -
  • - [% END %] - -
-
- [% END %] +
+ [% INCLUDE 'patron_messages.inc' %] +
-

- [% UNLESS ( I ) %] - [% patron.title | html %] [% patron.firstname | html %] - [% END %] - [% patron.surname | html %] ([% patron.cardnumber | html %]) -

diff --git a/koha-tmpl/intranet-tmpl/prog/img/arrow-bullet.gif b/koha-tmpl/intranet-tmpl/prog/img/arrow-bullet.gif deleted file mode 100644 index 7e3155ed3698562325e3cb9c9e3cfbe1ce00ce89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48 zcmZ?wbhEHbWMyDwXkcWRIdkU!|Nj+#vM@3*Ff!;c00Bsbfr;HGp>x;rFa`!|05FmZ Af&c&j diff --git a/members/moremember.pl b/members/moremember.pl index 8f6e959850..c2edb86961 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -34,11 +34,13 @@ use C4::Auth; use C4::Output; use C4::Form::MessagingPreferences; use List::MoreUtils qw/uniq/; +use Scalar::Util qw( looks_like_number ); use Koha::Patron::Attribute::Types; use Koha::Patron::Debarments qw(GetDebarments); use Koha::Patron::Messages; use Koha::DateUtils; use Koha::CsvProfiles; +use Koha::Holds; use Koha::Patrons; use Koha::Patron::Files; use Koha::Token; @@ -89,12 +91,16 @@ for (qw(gonenoaddress lost borrowernotes is_debarred)) { if ( $patron->is_debarred ) { $template->param( - debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }), + 'debarments' => scalar GetDebarments({ borrowernumber => $borrowernumber }), + 'userdebarred' => $patron->debarred, + 'debarredcomment' => $patron->debarredcomment, ); + if ( $patron->debarred ne "9999-12-31" ) { $template->param( 'userdebarreddate' => $patron->debarred ); } } + $template->param( flagged => 1 ) if $patron->account_locked; my @relatives; @@ -196,6 +202,71 @@ if ( $patron->is_expired || $patron->is_going_to_expire ) { ); } +my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); # FIXME must be Koha::Patron->holds +my $waiting_holds = $holds->waiting; +$template->param( + holds_count => $holds->count(), + WaitingHolds => $waiting_holds, +); + +my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees"); +$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); +if ( defined $no_issues_charge_guarantees ) { + my $guarantees_non_issues_charges = 0; + my $guarantees = $patron->guarantee_relationships->guarantees; + while ( my $g = $guarantees->next ) { + $guarantees_non_issues_charges += $g->account->non_issues_charges; + } + if ( $guarantees_non_issues_charges > $no_issues_charge_guarantees ) { + $template->param( + charges_guarantees => 1, + chargesamount_guarantees => $guarantees_non_issues_charges, + ); + } +} + +if ( $patron->has_overdues ) { + $template->param( odues => 1 ); +} +my $issues = $patron->checkouts; + +my $balance = 0; +$balance = $patron->account->balance; + +my $account = $patron->account; +if( ( my $owing = $account->non_issues_charges ) > 0 ) { + my $noissuescharge = C4::Context->preference("noissuescharge") || 5; # FIXME If noissuescharge == 0 then 5, why?? + $template->param( + charges => 1, + chargesamount => $owing, + ) +} elsif ( $balance < 0 ) { + $template->param( + credits => 1, + creditsamount => -$balance, + ); +} + +# if the expiry date is before today ie they have expired +if ( $patron->is_expired ) { + #borrowercard expired, no issues + $template->param( + expired => "1", + ); +} +# check for NotifyBorrowerDeparture +elsif ( $patron->is_going_to_expire ) { + # borrower card soon to expire warn librarian + $template->param( "warndeparture" => $patron->dateexpiry , + ); + if (C4::Context->preference('ReturnBeforeExpiry')){ + $template->param("returnbeforeexpiry" => 1); + } +} + + +my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count; + $template->param( patron => $patron, issuecount => $patron->checkouts->count, @@ -210,6 +281,8 @@ $template->param( relatives_borrowernumbers => \@relatives, logged_in_user => $logged_in_user, files => Koha::Patron::Files->new( borrowernumber => $borrowernumber ) ->GetFilesInfo(), + #debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }), + has_modifications => $has_modifications, ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.11.0