[Koha-patches] [PATCH 3/4] simplify logic for displaying item status

Galen Charlton gmcharlt at gmail.com
Sat May 1 20:40:41 CEST 2010


Flatten the tmpl_if tree for determining the item status
to display and tweaked the order in which statuses are checked to

1. (circ reality) item on loan
2. (circ reality) item in transit
3. (circ reality) item wating at hold shelf
4. (item status that makes circ impossible) item withdrawn
5. (item status that makes circ impossible) item lost
6. (policy that implies no circ but in-house use possible) item not-for-loan per item
7. (policy that implies no circ but in-house use possible) item not-for-loan per item type
8  (item status that *might* affect circ) damaged
8. (fallback) item available

Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
---
 .../opac-tmpl/prog/en/includes/item-status.inc     |   60 ++++++++++----------
 1 files changed, 29 insertions(+), 31 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 af71a99..5e881fe 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc
@@ -1,34 +1,32 @@
-<!-- TMPL_IF name="notforloan_per_itemtype" -->
-    Not for loan <!-- TMPL_IF NAME="notforloanvalue" -->(<!-- TMPL_VAR NAME="notforloanvalue" -->)<!-- /TMPL_IF -->
-<!-- TMPL_ELSE -->
-    <!-- TMPL_IF name="datedue" -->
-        <!-- TMPL_IF name="OPACShowCheckoutName" -->
-            Checked out to <!-- TMPL_VAR NAME="cardnumber" --> <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" -->
-        <!-- TMPL_ELSE -->
-            Checked out
-        <!-- /TMPL_IF -->
+<!-- TMPL_IF name="datedue" -->
+    <!-- TMPL_IF name="OPACShowCheckoutName" -->
+        Checked out to <!-- TMPL_VAR NAME="cardnumber" --> <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" -->
+    <!-- TMPL_ELSE -->
+        Checked out
+    <!-- /TMPL_IF -->
+<!-- TMPL_ELSIF Name="transfertwhen" -->
+    In transit from <!-- TMPL_VAR NAME="transfertfrom" -->
+    to <!-- TMPL_VAR NAME="transfertto" --> since <!-- TMPL_VAR NAME="transfertwhen" -->
+<!-- TMPL_ELSIF NAME="waiting" -->
+    On hold
+<!-- TMPL_ELSIF NAME="wthdrawn" -->
+    Item withdrawn
+<!-- TMPL_ELSIF name="itemlost"-->
+    <!-- TMPL_IF name="lostimageurl"-->
+        <img src="<!-- TMPL_VAR NAME="lostimageurl" -->" alt="<!-- TMPL_VAR NAME="lostimagelabel" -->" title="<!-- TMPL_VAR NAME="lostimagelabel" -->">
     <!-- TMPL_ELSE -->
-        <!-- TMPL_IF name="itemnotforloan" -->
-            <!-- TMPL_VAR NAME="notforloanvalue" -->
-        <!-- TMPL_ELSE -->
-            <!-- TMPL_IF name="itemlost"-->
-                <!-- TMPL_IF name="lostimageurl"-->
-                    <img src="<!-- TMPL_VAR NAME="lostimageurl" -->" alt="<!-- TMPL_VAR NAME="lostimagelabel" -->" title="<!-- TMPL_VAR NAME="lostimagelabel" -->">
-                <!-- TMPL_ELSE -->
-                    Item lost
-                <!-- /TMPL_IF -->
-            <!-- TMPL_ELSE -->
-                <!-- TMPL_IF NAME="wthdrawn" -->
-                    Item withdrawn
-                <!-- TMPL_ELSIF NAME="damaged" -->
-                    Item damaged
-                <!-- TMPL_ELSIF Name="transfertwhen" -->
-                    In transit from <!-- TMPL_VAR NAME="transfertfrom" -->
-                    to <!-- TMPL_VAR NAME="transfertto" --> since <!-- TMPL_VAR NAME="transfertwhen" -->
-                <!-- TMPL_ELSE -->
-                    <!-- TMPL_IF NAME="waiting" -->On hold<!-- TMPL_ELSE -->Available<!-- /TMPL_IF -->
-                <!-- /TMPL_IF -->
-            <!-- /TMPL_IF -->
-        <!-- /TMPL_IF -->
+        Item lost
     <!-- /TMPL_IF -->
+<!-- TMPL_ELSIF name="itemnotforloan" -->
+    <!-- TMPL_IF NAME="notforloanvalue" -->
+        <!-- TMPL_VAR NAME="notforloanvalue" -->
+    <!-- TMPL_ELSE -->
+        Not for loan
+    <!-- /TMPL_IF -->
+<!-- TMPL_ELSIF name="notforloan_per_itemtype" -->
+    Not for loan
+<!-- TMPL_ELSIF NAME="damaged" -->
+    Item damaged
+<!-- TMPL_ELSE -->
+    Available
 <!-- /TMPL_IF -->
-- 
1.7.0




More information about the Koha-patches mailing list