From 559091c5589887adc774e2f217c64de390270d4e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 18 May 2011 11:01:20 -0400 Subject: [PATCH] Fix for Bug 6364 - Display of item availability broken on OPAC detail screen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Owen: The markup for showing item availability has been moved to an include file. The include lacked the scope declaration for the item results loop. Adding the scope declaration to the include file means it can't be used by other template unless within the same scope, but I'm not aware of a better way to do it given the number of variables in use. Frédéric: I confirm the bug. I propose a alternative solution which solve the bug and keep its versability-reusability to the include file. With this solution, when including item-status.inc, the foreach loop variable name, which can change from template to template, is renamed by using a local variable definition: ie a variable name specified after file name in the INCLUDE directive, this variable temporalily masking any existing variable. Signed-off-by: Frédéric Demians Signed-off-by: Chris Cormack --- .../prog/en/includes/item-status.inc | 36 +++++++++---------- .../opac-tmpl/prog/en/modules/opac-detail.tt | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc index fcfe12074d..d05583f5a4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc @@ -1,32 +1,32 @@ -[% IF ( datedue ) %] +[% IF ( item.datedue ) %] [% IF ( OPACShowCheckoutName ) %] - Checked out to [% cardnumber %] [% firstname %] [% surname %] + Checked out to [% item.cardnumber %] [% item.firstname %] [% item.surname %] [% ELSE %] Checked out [% END %] -[% ELSIF ( transfertwhen ) %] - In transit from [% transfertfrom %] - to [% transfertto %] since [% transfertwhen %] -[% ELSIF ( waiting ) %] +[% ELSIF ( item.transfertwhen ) %] + In transit from [% item.transfertfrom %] + to [% item.transfertto %] since [% item.transfertwhen %] +[% ELSIF ( item.waiting ) %] On hold -[% ELSIF ( wthdrawn ) %] +[% ELSIF ( item.wthdrawn ) %] Item withdrawn -[% ELSIF ( itemlost ) %] - [% IF ( lostimageurl ) %] - [% lostimagelabel %] +[% ELSIF ( item.itemlost ) %] + [% IF ( item.lostimageurl ) %] + [% item.lostimagelabel %] [% ELSE %] Item lost [% END %] -[% ELSIF ( itemnotforloan ) %] - [% IF ( notforloanvalue ) %] - [% notforloanvalue %] [% IF ( restrictedopac ) %]([% restrictedopac %])[% END %] +[% ELSIF ( item.itemnotforloan ) %] + [% IF ( item.notforloanvalue ) %] + [% item.notforloanvalue %] [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] [% ELSE %] - Not for loan [% IF ( restrictedopac ) %]([% restrictedopac %])[% END %] + Not for loan [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] [% END %] -[% ELSIF ( notforloan_per_itemtype ) %] - Not for loan [% IF ( restrictedopac ) %]([% restrictedopac %])[% END %] -[% ELSIF ( damaged ) %] +[% ELSIF ( item.notforloan_per_itemtype ) %] + Not for loan [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] +[% ELSIF ( item.damaged ) %] Item damaged [% ELSE %] - Available [% IF ( restrictedopac ) %]([% restrictedopac %])[% END %] + Available [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 7263b1e6eb..ff4b52c0b7 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -410,7 +410,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( itemdata_enumchron ) %][% ITEM_RESULT.enumchron %][% END %] [% IF ( itemdata_uri ) %][% ITEM_RESULT.uri %][% END %] [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] - [% INCLUDE 'item-status.inc' %] + [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] [% ITEM_RESULT.datedue %] [% IF ( ITEM_RESULT.type ) %] -- 2.39.2