From 321328d0db9207cd43e5ae5f0b9d7cbb2923b1d4 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Mon, 6 Jan 2014 11:37:34 -0500
Subject: [PATCH] Bug 8836 - Resurrect Rotating Collections - Followup 3

* Fix bad TT Tag
* Fix bad sql query
* Fix capitalization ( HTML4 )
* Allow a rotating collection's location to keep AutomaticItemReturn
  from sending it back to the branch of origin
* Fix bad query
---
 C4/Circulation.pm                                  |    2 ++
 C4/RotatingCollections.pm                          |    6 ++++--
 .../intranet-tmpl/prog/en/modules/circ/returns.tt  |    2 +-
 .../rotating_collections/editCollections.tt        |   10 +++++++---
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index f8b204a..4ff8fc2 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -42,6 +42,7 @@ use C4::Koha qw(
     GetKohaAuthorisedValueLib
 );
 use C4::Overdues qw(CalcFine UpdateFine);
+use C4::RotatingCollections qw(GetCollectionItemBranches);
 use Algorithm::CheckDigits;
 
 use Data::Dumper;
@@ -1948,6 +1949,7 @@ sub AddReturn {
             $messages->{'NeedsTransfer'} = 1;   # TODO: instead of 1, specify branchcode that the transfer SHOULD go to, $item->{homebranch}
         }
     }
+
     return ( $doreturn, $messages, $issue, $borrower );
 }
 
diff --git a/C4/RotatingCollections.pm b/C4/RotatingCollections.pm
index 7767867..6030089 100644
--- a/C4/RotatingCollections.pm
+++ b/C4/RotatingCollections.pm
@@ -333,8 +333,10 @@ sub AddItemToCollection {
 
     my $sth;
     $sth = $dbh->prepare("
-        INSERT INTO collections_tracking ( collections_tracking_id, colId, itemnumber )
-        VALUES ( NULL, ?, ? )
+        INSERT INTO collections_tracking (
+            colId,
+            itemnumber
+        ) VALUES ( ?, ? )
     ");
     $sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() );
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
index aee0a5e..4ec28d3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
@@ -67,7 +67,7 @@ $(document).ready(function () {
 [% END %]
 
 [% IF ( collectionItemNeedsTransferred ) %]
-	<div id="rotating-collection" class="dialog message">This item is part of a Rotating Collection and needs to be Transferred to [% collectionBranch %]</div>
+ <div id="rotating-collection" class="dialog message">This item is part of a rotating collection and needs to be transferred to [% collectionBranch %]</div>
 [% END %]
 
 <!-- Patron has fines -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt
index 4917ff2..e1bb2a8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt
@@ -44,13 +44,16 @@
       <div>
         [% IF ( collectionsLoop ) %]
           <table>
+           <thead>
             <tr>
               <th>Title</th>
               <th>Description</th>
               <th>Holding library</th>
-              <td></td>
-              <td></td>
+              <th>&nbsp;</th>
+              <th>&nbsp;</th>
             </tr>
+           <thead>
+           <tbody>
             [% FOREACH collectionsLoo IN collectionsLoop %]
               <tr>
                 <td>[% collectionsLoo.colTitle %]</td>
@@ -60,6 +63,7 @@
                 <td><a href="editCollections.pl?action=delete&amp;colId=[% collectionsLoo.colId %]">Delete</a></td>
               </tr>
             [% END %]
+           </tbody>
           </table>
         [% ELSE %]
           There are no collections currently defined.
@@ -99,7 +103,7 @@
                 <label for="description">Description: </label>
               </td>
               <td>
-                [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[ editColDescription %]" />
+                [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[% editColDescription %]" />
                 [% ELSE %]<input type="text" size="50" name="description" />[% END %]
               </td>
             </tr>
-- 
1.7.2.5