Fix for Bug 6364 - Display of item availability broken on OPAC detail screen

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 <f.demians@tamil.fr>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit 559091c558)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
Owen Leonard 2011-05-18 11:01:20 -04:00 committed by Chris Nighswonger
parent 4d5460ec85
commit 5da7fb7021
2 changed files with 19 additions and 19 deletions

View File

@ -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 ) %]
<img src="[% lostimageurl %]" alt="[% lostimagelabel %]" title="[% lostimagelabel %]">
[% ELSIF ( item.itemlost ) %]
[% IF ( item.lostimageurl ) %]
<img src="[% item.lostimageurl %]" alt="[% item.lostimagelabel %]" title="[% item.lostimagelabel %]">
[% ELSE %]
Item lost
[% END %]
[% ELSIF ( itemnotforloan ) %]
[% IF ( notforloanvalue ) %]
[% notforloanvalue %] [% IF ( restrictedopac ) %]<span class="restricted">([% restrictedopac %])</span>[% END %]
[% ELSIF ( item.itemnotforloan ) %]
[% IF ( item.notforloanvalue ) %]
[% item.notforloanvalue %] [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
[% ELSE %]
Not for loan [% IF ( restrictedopac ) %]<span class="restricted">([% restrictedopac %])</span>[% END %]
Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
[% END %]
[% ELSIF ( notforloan_per_itemtype ) %]
Not for loan [% IF ( restrictedopac ) %]<span class="restricted">([% restrictedopac %])</span>[% END %]
[% ELSIF ( damaged ) %]
[% ELSIF ( item.notforloan_per_itemtype ) %]
Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
[% ELSIF ( item.damaged ) %]
Item damaged
[% ELSE %]
Available [% IF ( restrictedopac ) %]<span class="restricted">([% restrictedopac %])</span>[% END %]
Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
[% END %]

View File

@ -407,7 +407,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% IF ( itemdata_enumchron ) %]<td>[% ITEM_RESULT.enumchron %]</td>[% END %]
[% IF ( itemdata_uri ) %]<td><a href="[% ITEM_RESULT.uri %]">[% ITEM_RESULT.uri %]</a></td>[% END %]
[% IF ( itemdata_copynumber ) %]<td>[% ITEM_RESULT.copynumber %]</td>[% END %]
<td>[% INCLUDE 'item-status.inc' %]</td>
<td>[% INCLUDE 'item-status.inc' item = ITEM_RESULT %]</td>
[% IF ( itemdata_itemnotes ) %]<td>[% ITEM_RESULT.itemnotes %]</td>[% END %]
<td>[% ITEM_RESULT.datedue %]</td>
[% IF ( ITEM_RESULT.type ) %]