From b197d8bf90c13267ffcc534e19a958b14c1d568e 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 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. Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../bootstrap/en/includes/item-status.inc | 90 ++++++++++++------- .../bootstrap/en/modules/opac-basket.tt | 3 +- koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 10 +++ 3 files changed, 70 insertions(+), 33 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 f8980a6836..23b3a19339 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,54 +9,79 @@ 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 ) %] - [% IF item.onsite_checkout %] - [% IF ( OPACShowCheckoutName ) %] - Currently in local use by [% item.cardnumber %] [% item.firstname %] [% item.surname %] - [% ELSE %] - Currently in local use - [% END %] - [% ELSE %] - [% IF ( OPACShowCheckoutName ) %] - Checked out to [% item.cardnumber %] [% item.firstname %] [% item.surname %] +[% END %] + +[% IF ( item.datedue || issue.date_due ) %] + [% SET itemavailable = 0 %] + [% IF item.onsite_checkout %] + [% IF ( OPACShowCheckoutName ) %] + Currently in local use by [% item.firstname %] [% item.surname %] [% IF ( item.cardnumber ) %]([% item.cardnumber %])[% END %] + [% ELSE %] + Currently in local use + [% END %] [% ELSE %] - Checked out + [% IF ( OPACShowCheckoutName ) %] + Checked out to [% item.firstname %] [% item.surname %] [% IF ( item.cardnumber ) %]([% item.cardnumber %])[% END %] + [% ELSE %] + Checked out + [% END %] [% END %] - [% 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 f1d43d61b8..4a44b33947 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 d44734fa6b..5b69d30de5 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 { -- 2.20.1