Bug 6364

Summary: Display of item availability broken on OPAC detail screen
Product: Koha Reporter: Owen Leonard <oleonard>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Bugs List <koha-bugs>
Severity: normal    
Priority: PATCH-Sent (DO NOT USE) CC: chris, f.demians, magnus
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 5917    
Attachments: Proposed fix
Signed-off patch with improvement

Description Owen Leonard 2011-05-18 14:57:20 UTC
Because of a T:T scoping issue the OPAC detail page will always show all items as "Available."
Comment 1 Owen Leonard 2011-05-18 15:06:32 UTC
Created attachment 4166 [details] [review]
Proposed fix

    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.
Comment 2 Frédéric Demians 2011-05-21 06:39:12 UTC
Created attachment 4213 [details] [review]
Signed-off patch with improvement
Comment 3 Frédéric Demians 2011-05-21 06:40:32 UTC
I confirm the bug.

I propose a alternative solution which solve the bug and keep its
versatility-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
temporally masking any existing variable.
Comment 4 Owen Leonard 2011-05-23 13:32:55 UTC
Thanks Frédéric, your solution is the correct one. I knew I could pass an individual variable using that method but I didn't realize a whole loop could be passed the same way.
Comment 5 Chris Cormack 2011-05-29 03:51:17 UTC
T::T Bug, pushed please test
Comment 6 Magnus Enger 2011-07-16 09:25:54 UTC
E.g. opac-detail.pl?biblionumber=4 shows the correct mix of "Checked out" and "Available".