From 84dec6c002ecb8142f71388cc0dbc1d6544a67e9 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) --- 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 | 190 +++++++++++++++++++++ .../prog/en/modules/circ/circulation.tt | 170 +----------------- .../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, 284 insertions(+), 287 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 44f87b6281..b3d6404b94 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -468,7 +468,7 @@ if ($patron) { if ( $patron ) { my $noissues; if ( $patron->gonenoaddress ) { - $template->param( gna => 1 ); + $template->param( gonenoaddress => 1 ); $noissues = 1; } if ( $patron->lost ) { @@ -476,7 +476,7 @@ if ( $patron ) { $noissues = 1; } if ( $patron->is_debarred ) { - $template->param( dbarred=> 1 ); + $template->param( is_debarred=> 1 ); $noissues = 1; } my $account = $patron->account; @@ -545,7 +545,7 @@ if ( $patron ) { } } -my $messages = Koha::Patron::Messages->search( +my $patron_messages = Koha::Patron::Messages->search( { 'me.borrowernumber' => $borrowernumber, }, @@ -601,7 +601,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 d54a1ecdb1..6299683295 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -1702,18 +1702,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;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1IiBoZWlnaHQ9IjUiIHZpZXdCb3g9IjAgMCAyNSAyNSI+PHBhdGggZmlsbD0iIzk5OSIgZD0iTTkuNjYuOTVoNC41Nmw5LjIxIDExLjg1LTkuMjEgMTAuNTNIOS42Nmw1LjA4LTEwLjUzeiIvPjwvc3ZnPg=="); + 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..934d2db21b --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -0,0 +1,190 @@ +[% 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 %] +
+

Holds waiting

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

Notes

+
    +
  • + + [% patron.borrowernotes | $raw | html_line_break %] + +
  • +
+
+[% 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 7fcde8578d..b278628ffc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -721,178 +721,10 @@ [% ELSE %]
-

Attention:

[% END %] -
    - [% IF ( has_modifications ) %] -
  • Pending modifications: Patron has pending modifications. - [% IF CAN_user_borrowers_edit_borrowers && ( !Koha.Preference('IndependentBranchesPatronModifications') || borrower.branch == branch ) %] - View all pending patron modifications - [% END %] -
  • - [% END %] - - [% IF ( warndeparture ) %] -
  • - Expiration: Patron's card will expire soon. - Patron's card expires on [% expiry | $KohaDates %] Renew or Edit details - -
  • - [% END %] - - [% IF ( returnbeforeexpiry ) %] -
  • - Set due date to expiry: You have the ReturnBeforeExpiry system preference enabled this means if the expiry date is before the date due, the date due will be set to the expiry date -
  • - [% END %] - - [% IF ( expired ) %] -
  • - Expiration: Patron's card has expired. - [% IF ( expiry ) %] - Patron's card expired on [% expiry | $KohaDates %] - [% END %] - Renew or Edit details -
  • - [% END %] - - [% IF ( gna ) %] -
  • Address: Patron's address in doubt
  • - [% END %] - - [% IF ( lost ) %] -
  • Lost: Patron's card is lost
  • - [% END %] - - [% IF ( userdebarred ) %] -
  • - Restricted: Patron's account is restricted - - [% IF ( userdebarreddate ) %] - until [% userdebarreddate | $KohaDates %] - [% END %] - - [% IF ( debarredcomment ) %] - with the explanation:
    - - [% IF debarredcomment.search('OVERDUES_PROCESS') %] - Restriction added by overdues process [% debarredcomment.remove('OVERDUES_PROCESS ') | $raw | html_line_break %] - [% ELSE %] - [% debarredcomment | $raw | html_line_break %] - [% END %] - - [% END %] -
    - View restrictions - - [% IF (noissues && patron && CAN_user_circulate_force_checkout) %] - - Override restriction temporarily - - [% END %] -
  • - [% END # /IF userdebarred %] - - [% IF ( odues ) %] -
  • Overdues: Patron has ITEMS OVERDUE. See highlighted items below
  • - [% END %] + [% INCLUDE 'patron_messages.inc' %] - [% SET ClaimReturnedWarningThreshold = Koha.Preference('ClaimReturnedWarningThreshold') %] - [% SET return_claims = patron.return_claims %] - [% IF return_claims.count > ClaimReturnedWarningThreshold %] -
  • Return claims: Patron has [% return_claims.count | html %] RETURN CLAIMS. - [% END %] - - - [% IF age_limitations %] - [% INCLUDE 'category-out-of-age-limit.inc' %] - [% END %] - - [% IF ( charges ) %] - [% INCLUDE 'blocked-fines.inc' fines = chargesamount %] - [% END %] - [% IF ( charges_guarantors_guarantees ) %] -
  • - Charges: Patron's guarantors and their other guarantees collectively owe [% charges_guarantors_guarantees | $Price %]. - [% IF noissues %] - Checkouts are BLOCKED because fine balance is OVER THE LIMIT. - [% END %] -
  • - [% END %] - [% IF ( charges_guarantees ) %] -
  • - Charges: Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %]. - [% IF noissues %] - Checkouts are BLOCKED because fine balance is OVER THE LIMIT. - [% END %] -
  • - [% END %] - - - [% IF ( credits ) %] -
  • - Credits: Patron has a credit[% IF ( creditsamount ) %] of [% creditsamount | $Price %][% END %] -
  • - [% END %] - -
- - [% IF WaitingHolds.count %] -
-

Holds waiting:

- [% FOREACH w IN WaitingHolds %] -
    -
  • - [% 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 %]. - -
    - [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode() ) %][% ELSE %][% END %] - [% SET expires_on = w.expirationdate %] - Waiting at [% w.branch.branchname | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %] - -
  • -
- [% END %] -
- [% END # /IF WaitingHolds.count %] - - [% IF ( notes ) %] -
-

Notes:

-

[% notesmsg | $raw %]

-
- [% END %] - -
-

Messages:

- - Add a new message -
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 fbcca2948b..97b53546cf 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