From b7c56dd7c663d7813217e4d4667cefdad4a4c891 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 7 Oct 2014 14:08:02 -0400 Subject: [PATCH] Bug 9214 - Show damaged status in the OPAC for items which are not for loan Content-Type: text/plain; charset="utf-8" Item statuses in the OPAC displayed according to a cascading hierarchy: If something is lost it will appear as lost, "else if" it is checked out it will appear as checked out, etc. I don't think there is a logical reason why statuses should appear this way. This patch modifies the logic in the template so that multiple statuses can be displayed at the same time. The patch also wraps each status in its own class so that libraries can apply custom CSS if they wish. Some tweaks have been made to the LESS file adding some style to the common "item-status" class for display of item statuses. To test, apply the patch and view one or more titles in the OPAC which have items with the following statuses: lost, checked out, damaged, not for loan, waiting, on order, in transit, withdrawn, and available. Modify items to have more that one status simultaneously, in particular not for loan and damaged. Also test the display of item statuses in the OPAC cart and the OPAC's course details page (Course reserves -> [Course name]) since these pages use the same include file. --- .../bootstrap/en/includes/item-status.inc | 72 +++++++++++++------- .../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 3 +- koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 10 +++ 3 files changed, 61 insertions(+), 24 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc index 16599de..c3721b0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -1,4 +1,5 @@ [% USE AuthorisedValues %] +[% SET itemavailable = 1 %] [%#- This include takes two parameters: an item structure @@ -8,46 +9,71 @@ not use an API to fetch items that populates item.datedue. -%] [% IF ( item.itemlost ) %] + [% SET itemavailable = 0 %] [% av_lib_include = AuthorisedValues.GetByCode( 'LOST', item.itemlost, 1 ) %] [% IF ( av_lib_include ) %] - [% av_lib_include %] + [% av_lib_include %] [% ELSE %] [% IF ( item.lostimageurl ) %] [% item.lostimagelabel %] [% ELSE %] - Item lost + Item lost [% END %] [% END %] -[% ELSIF ( item.datedue || issue.date_due ) %] +[% END %] + +[% IF ( item.datedue || issue.date_due ) %] + [% SET itemavailable = 0 %] [% IF ( OPACShowCheckoutName ) %] - Checked out to [% item.cardnumber %] [% item.firstname %] [% item.surname %] + Checked out to [% item.firstname %] [% item.surname %] [% IF ( item.cardnumber ) %]([% item.cardnumber %])[% END %] [% ELSE %] - Checked out + Checked out [% END %] -[% ELSIF ( item.transfertwhen ) %] - In transit from [% item.transfertfrom %] - to [% item.transfertto %] since [% item.transfertwhen %] -[% ELSIF ( item.waiting ) %] - On hold -[% ELSIF ( item.withdrawn ) %] - Item withdrawn -[% ELSIF ( item.itemnotforloan ) %] +[% END %] + +[% IF ( item.transfertwhen ) %] + [% SET itemavailable = 0 %] + In transit from [% item.transfertfrom %] + to [% item.transfertto %] since [% item.transfertwhen | $KohaDates %] +[% END %] + +[% IF ( item.waiting ) %] + [% SET itemavailable = 0 %] + On hold +[% END %] + +[% IF ( item.withdrawn ) %] + [% SET itemavailable = 0 %] + Item withdrawn +[% END %] + +[% IF ( item.itemnotforloan ) %] + [% SET itemavailable = 0 %] [% IF ( item.notforloanvalueopac ) %] - [% item.notforloanvalueopac %] [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] + [% item.notforloanvalueopac %] [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] [% ELSE %] - Not for loan [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] + Not for loan [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] [% END %] [% ELSIF ( item.notforloan_per_itemtype ) %] - Not for loan [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] -[% ELSIF ( item.damaged ) %] + [% SET itemavailable = 0 %] + Not for loan [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] +[% END %] + +[% IF ( item.damaged ) %] + [% SET itemavailable = 0 %] [% av_lib_include = AuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %] [% IF av_lib_include %] - [% av_lib_include %] + [% av_lib_include %] [% ELSE %] - Item damaged + Item damaged [% END %] -[% ELSIF item.on_order %] - On order -[% ELSE %] - Available [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] +[% END %] + +[% IF item.on_order %] + [% SET itemavailable = 0 %] + On order +[% END %] + +[% IF ( itemavailable ) %] + Available [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index f1d43d6..4a44b33 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -1,10 +1,11 @@ [% USE Koha %] +[% USE KohaDates %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && TagsEnabled && TagsInputOnList ) %] [% INCLUDE 'doc-head-open.inc' %] [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your cart [% INCLUDE 'doc-head-close.inc' %] -[% BLOCK cssinclude %][% END %] +[% BLOCK cssinclude %][% END %] [% INCLUDE 'bodytag.inc' bodyid='basket' %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less index 9e1a964..88b7e9d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less +++ b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less @@ -2054,6 +2054,12 @@ button.closebtn{padding:0;cursor:pointer;background:transparent;border:0;-webkit margin-bottom : .5em; } +.item-status { + display: block; + font-size: 95%; + margin-bottom: .5em; +} + .available { color : #006600; } @@ -2195,6 +2201,10 @@ td img { padding-right: 19px; background: #ECEDE6 none; } + th, + td { + line-height: 135%; + } } .tags { ul { -- 1.7.9.5