Support for suppressing items, needed for multiple copies
authorArt Rhyno <art632000@yahoo.ca>
Fri, 24 Jun 2011 04:06:28 +0000 (00:06 -0400)
committerArt Rhyno <art632000@yahoo.ca>
Fri, 24 Jun 2011 04:06:28 +0000 (00:06 -0400)
when reverting circ parameters.

Signed-off-by: Art Rhyno <art632000@yahoo.ca>
conifer/integration/evergreen_site.py
conifer/syrup/views/items.py
conifer/templates/components/site.xhtml
conifer/templates/item/common_metadata.xhtml

index 32f6e76..51e3105 100644 (file)
@@ -175,7 +175,7 @@ class EvergreenIntegration(object):
         assert self.RESERVES_DESK_NAME, 'No RESERVES_DESK_NAME specified!'
         try:
             counts = E1(OPENSRF_COPY_COUNTS, bib_id, 1, 0)
-            lib = desk = avail = vol = 0
+            lib = desk = avail = vol = anystatus_here = 0
             dueinfo = ''
             callno  = ''
             circmod = ''
@@ -189,6 +189,7 @@ class EvergreenIntegration(object):
                 avail_here = stats.get(self.AVAILABLE, 0)
                 avail_here += stats.get(self.RESHELVING, 0)
                 anystatus_here = sum(stats.values())
+                lib += anystatus_here
 
                 # volume check - based on v.1, etc. in call number
                 voltest = re.search(r'\w*v\.\s?(\d+)', callnum)
@@ -214,7 +215,6 @@ class EvergreenIntegration(object):
                     else:
                         callno = callnum
 
-                    lib += anystatus_here
                     copyids = E1(OPENSRF_CN_CALL, bib_id, callnum, org)
 
                     # we want to return the resource that will be returned first if
index b3a36c2..3fdecb1 100644 (file)
@@ -383,11 +383,19 @@ def item_edit(request, site_id, item_id):
                 location_option = request.POST.get('location_option')
                 modifier_option = request.POST.get('modifier_option')
                 callno_option = request.POST.get('orig_callno')
+                suppress_option = request.POST.get('suppress_item')
                 update_status = True
 
                 if update_option == 'Cat':
                     update_status = opensrf.ils_item_update(item.barcode, callno_option,
                                                             modifier_option, location_option)
+                    # we need to carry over suppress flag for instances where a call number
+                    # is modified for a second copy - this might be a common workflow
+                    if suppress_option == None:
+                        item.suppress_item = False
+                    else:
+                        item.suppress_item = True
+                    item.save()
 
                 #leave values alone if update failed
                 if update_status and update_option == 'One':
index df15e54..eb1c2e6 100644 (file)
@@ -30,7 +30,8 @@ searchtext = _('search this site...')
   <ul py:def="show_tree(tree, edit=False)"
       py:if="tree"
       class="itemtree">
-    <li py:for="item, subs in tree" py:with="forbidden=not item.copyright_status_ok()" class="item_${item.item_type} an_item ${forbidden and 'forbidden' or ''}"
+    <span py:for="item, subs in tree" py:with="forbidden=not item.copyright_status_ok()">
+    <li py:if="not item.suppress_item or user.is_staff" class="item_${item.item_type} an_item ${forbidden and 'forbidden' or ''}"
        id="item_${item.id}">
       <abbr py:if="not item.item_type=='HEADING'" class="unapi-id" title="${item.id}"/>
       <?python
@@ -104,6 +105,7 @@ searchtext = _('search this site...')
               src="${ROOT}/static/tango/lock.png"/></span>
          <a href="${item.item_url()}" class="mainlink"
             py:strip="item.item_type=='ELEC' and not downloads_allowed">${item}</a> 
+       <span py:if="item.suppress_item">[additional copy - not displayed]</span>
       </div>
       <div class="author_pub" py:if="item.author or item.publisher or item.published">
        <span py:with="vt=item.video_type()"><span class="videotype" py:if="vt">[${vt}]</span></span>
@@ -111,7 +113,7 @@ searchtext = _('search this site...')
                <span py:if="item.published">(${item.published}).</span>
                <span py:if="item.source_title"><i>${item.source_title}.</i></span>
                <span py:if="item.volume or item.issue"><i>${item.volume}</i>(${item.issue}), ${item.pages}.</span>
-                 <div py:if="edit">
+                 <div py:if="edit and user.is_staff">
             <span><i>Source: </i></span>
                    <span py:if="item.circ_modifier">${item.circ_modifier}, </span>
                    <span py:if="item.orig_callno">${item.orig_callno}, </span>
@@ -135,6 +137,7 @@ searchtext = _('search this site...')
       <!-- !to show a full tree, uncomment the following: -->
       ${show_tree(subs, edit)}
     </li>
+    </span>
   </ul>
 
   <ul py:def="heading_tree(tree, stop_at=None)" class="heading_tree">
index 9299b98..e32d33e 100644 (file)
@@ -25,6 +25,8 @@ if len(authors) < 2:
       <tr><th>ISBN</th><td><input type="text" name="isbn" value="${item.isbn}"/></td></tr>
       <tr><th>Bib Id of Item</th><td><input type="text" name="bib_id" value="${item.bib_id}"/></td></tr>
       <tr><th>Item Notes</th><td><textarea rows="3" name="itemnotes">${item.itemnotes}</textarea></td></tr>
+      <tr><th>Suppress Item</th><td><input type="checkbox" name="suppress_item" 
+        py:attrs="{'checked': item.suppress_item==True or None}"/></td></tr>
       <tr py:if="user.is_staff and item.item_type == 'ELEC'">
        <th>Copyright Status</th>
        <td>