Bug 8836 [QA Followup 2]
authorKyle M Hall <kyle@bywatersolutions.com>
Thu, 30 Oct 2014 10:58:42 +0000 (06:58 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 6 Nov 2014 18:12:19 +0000 (15:12 -0300)
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
C4/Circulation.pm
C4/RotatingCollections.pm
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt
koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt
koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt
koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt
rotating_collections/addItems.pl
rotating_collections/editCollections.pl

index 99dc3c8..4597db9 100644 (file)
@@ -1904,7 +1904,7 @@ sub AddReturn {
     my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} );
 
     # if we have a transfer to do, we update the line of transfers with the datearrived
-    my $is_in_rotating_collection = 1 if C4::RotatingCollections::isItemInAnyCollection( $item->{'itemnumber'} );
+    my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $item->{'itemnumber'} );
     if ($datesent) {
         if ( $tobranch eq $branch ) {
             my $sth = C4::Context->dbh->prepare(
index 5a63cd8..12d835d 100644 (file)
@@ -26,7 +26,7 @@ use Modern::Perl;
 
 use C4::Context;
 use C4::Circulation;
-use C4::Reserves qw(GetReserveStatus);
+use C4::Reserves qw(CheckReserves);
 
 use DBI;
 
@@ -86,10 +86,10 @@ sub CreateCollection {
 
     ## Check for all neccessary parameters
     if ( !$title ) {
-        return ( 0, 1, "No Title Given" );
+        return ( 0, 1, "NO_TITLE" );
     }
     if ( !$description ) {
-        return ( 0, 2, "No Description Given" );
+        return ( 0, 2, "NO_DESCRIPTION" );
     }
 
     my $success = 1;
@@ -130,13 +130,13 @@ sub UpdateCollection {
 
     ## Check for all neccessary parameters
     if ( !$colId ) {
-        return ( 0, 1, "No Id Given" );
+        return ( 0, 1, "NO_ID" );
     }
     if ( !$title ) {
-        return ( 0, 2, "No Title Given" );
+        return ( 0, 2, "NO_TITLE" );
     }
     if ( !$description ) {
-        return ( 0, 3, "No Description Given" );
+        return ( 0, 3, "NO_DESCRIPTION" );
     }
 
     my $dbh = C4::Context->dbh;
@@ -175,7 +175,7 @@ sub DeleteCollection {
 
     ## Paramter check
     if ( !$colId ) {
-        return ( 0, 1, "No Collection Id Given" );
+        return ( 0, 1, "NO_ID" );
     }
 
     my $dbh = C4::Context->dbh;
@@ -239,7 +239,7 @@ sub GetItemsInCollection {
 
     ## Paramter check
     if ( !$colId ) {
-        return ( 0, 0, 1, "No Collection Id Given" );
+        return ( 0, 0, 1, "NO_ID" );
     }
 
     my $dbh = C4::Context->dbh;
@@ -317,17 +317,17 @@ sub AddItemToCollection {
 
     ## Check for all neccessary parameters
     if ( !$colId ) {
-        return ( 0, 1, "No Collection Given" );
+        return ( 0, 1, "NO_ID" );
     }
     if ( !$itemnumber ) {
-        return ( 0, 2, "No Itemnumber Given" );
+        return ( 0, 2, "NO_ITEM" );
     }
 
     if ( isItemInThisCollection( $itemnumber, $colId ) ) {
-        return ( 0, 2, "Item is already in the collection!" );
+        return ( 0, 2, "IN_COLLECTION" );
     }
     elsif ( isItemInAnyCollection($itemnumber) ) {
-        return ( 0, 3, "Item is already in a different collection!" );
+        return ( 0, 3, "IN_COLLECTION_OTHER" );
     }
 
     my $dbh = C4::Context->dbh;
@@ -367,11 +367,11 @@ sub RemoveItemFromCollection {
 
     ## Check for all neccessary parameters
     if ( !$itemnumber ) {
-        return ( 0, 2, "No Itemnumber Given" );
+        return ( 0, 2, "NO_ITEM" );
     }
 
     if ( !isItemInThisCollection( $itemnumber, $colId ) ) {
-        return ( 0, 2, "Item is not in the collection!" );
+        return ( 0, 2, "NOT_IN_COLLECTION" );
     }
 
     my $dbh = C4::Context->dbh;
@@ -408,10 +408,10 @@ sub TransferCollection {
 
     ## Check for all neccessary parameters
     if ( !$colId ) {
-        return ( 0, 1, "No Id Given" );
+        return ( 0, 1, "NO_ID" );
     }
     if ( !$colBranchcode ) {
-        return ( 0, 2, "No Branchcode Given" );
+        return ( 0, 2, "NO_BRANCHCODE" );
     }
 
     my $dbh = C4::Context->dbh;
@@ -435,9 +435,8 @@ sub TransferCollection {
     $sth->execute($colId) or return ( 0, 4, $sth->errstr );
     my @results;
     while ( my $item = $sth->fetchrow_hashref ) {
-        transferbook( $colBranchcode, $item->{barcode},
-            my $ignore_reserves = 1 )
-          unless ( GetReserveStatus( $item->{itemnumber} ) eq "Waiting" );
+        my ($status) = CheckReserves( $item->{itemnumber} );
+        transferbook( $colBranchcode, $item->{barcode}, my $ignore_reserves = 1 ) unless ( $status eq 'Waiting' );
     }
 
     return 1;
index 37b8cde..38d9901 100755 (executable)
@@ -9069,14 +9069,10 @@ if ( CheckVersion($DBversion) ) {
 
 $DBversion = "3.17.00.XXX";
 if ( CheckVersion($DBversion) ) {
-    $dbh->do(q{
-        ALTER TABLE collections CHANGE colBranchcode colBranchcode VARCHAR( 10 ) NULL DEFAULT NULL
-    });
-    $dbh->do(q{
-        ALTER TABLE collections ADD INDEX ( colBranchcode )
-    });
     $dbh->do(q{
         ALTER TABLE collections
+            CHANGE colBranchcode colBranchcode VARCHAR( 10 ) NULL DEFAULT NULL,
+            ADD INDEX ( colBranchcode ),
             ADD CONSTRAINT collections_ibfk_1 FOREIGN KEY (colBranchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
     });
     print "Upgrade to $DBversion done (Bug 8836 - Resurrect Rotating Collections)\n";
index 45d9b4e..963195d 100644 (file)
        <li><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></li>
        <li><a href="/cgi-bin/koha/labels/spinelabel-home.pl">Quick spine label creator</a></li>
     [% END %]
-<!--
     [% IF ( CAN_user_tools_rotating_collections ) %]
     <li><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></li>
     [% END %]
--->
     [% IF ( CAN_user_tools_marc_modification_templates ) %]
         <li><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">Manage MARC modification templates</a></li>
     [% END %]
index 195b324..fef190c 100644 (file)
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Add/Remove items</div>
 
-<div id="doc3">
-<div id="bd">
-        <div class="yui-gb">
+<div id="doc3" class="yui-t2">
+    <div id="bd">
+        <div class="yui-b">
+            [% INCLUDE 'tools-menu.inc' %]
+        </div>
 
-      <h1>Rotating collections: Add/Remove items</h1>
+        <div class="yui-main">
+            <div class="yui-db">
 
-      <div>
-          <br />
-          [% IF ( previousActionAdd ) %]
-            [% IF ( addSuccess ) %]
-              <div>Item with barcode '[% addedBarcode %]' Added successfully!</div>
-            [% ELSE %]
-              <div>Failed to add item with barcode '[% addedBarcode %]'!</div>
-              <div>Reason: <strong>[% failureMessage %]</strong></div>
-            [% END %]
-          [% END %]
+              <h1>Rotating collections: Add/Remove items</h1>
 
-          [% IF ( previousActionRemove ) %]
-            [% IF ( removeSuccess ) %]
-              <div>Item with barcode '[% addedBarcode %]' Removed successfully!</div>
-            [% ELSE %]
-              <div>Failed to remove item with barcode '[% removedBarcode %]'!</div>
-              <div>Reason: <strong>[% failureMessage %]</strong></div>
-            [% END %]
-          [% END %]
+              <div>
+                  <br />
+                  [% IF ( previousActionAdd ) %]
+                    [% IF ( addSuccess ) %]
+                      <div class="alert">Item with barcode '[% barcode %]' added successfully!</div>
+                    [% ELSE %]
+                      <div class="alert">
+                        <p>Failed to add item with barcode <i>[% barcode %]</i>:
+                        <p>
+                            [% IF failureMessage == "NO_ITEM" %]
+                                No item with matching barcode found!
+                            [% ELSIF failureMessage == "IN_COLLECTION_OTHER" %]
+                                Item is already in a different rotating collection!
+                            [% ELSE %]
+                                [% failureMessage %]
+                            [% END %]
+                        </p>
+                    </div>
+                    [% END %]
+                  [% END %]
 
-          <h3>Add item to <i>[% colTitle %]</i></h3>
-      </div>
+                  [% IF ( previousActionRemove ) %]
+                    [% IF ( removeSuccess ) %]
+                      <div class="alert">Item with barcode <i>[% barcode %]</i> removed successfully!</div>
+                    [% ELSE %]
+                      <div class="alert">
+                        Failed to remove item with barcode <i>[% barcode %]</i>:
+                        <p>
+                            [% IF failureMessage == "NO_ITEM" %]
+                                No item with matching barcode found!
+                            [% ELSE %]
+                                [% failureMessage %]
+                            [% END %]
+                        </p>
+                    </div>
+                    [% END %]
+                  [% END %]
 
-      <div>
-        <form action="addItems.pl" method="post">
-        <table>
-          <tr>
-            <th><label for="barcode">Barcode: </label></td>
-            <td><input type="text" id="barcode" name="barcode" /></td>
-            <td>
-              [% IF ( removeChecked ) %]<input type="checkbox" name="removeItem" checked="checked" />
-              [% ELSE %]<input type="checkbox" name="removeItem" />[% END %]
-              <label for="removeItem">Remove item from collection</label>
-            </td>
-          </tr>
+                  <h3>Add item to <i>[% colTitle %]</i></h3>
+              </div>
 
-          <input type="hidden" id="colId" name="colId" value="[% colId %]" />
-          <input type="hidden" name="action" value="addItem" />
-          <tr><td align="right" colspan="99"><input type="submit" value="Submit" /></td></tr>
-        </table>
-        </form>
-      </div>
+              <div>
+                <form action="addItems.pl" method="post">
+                <table>
+                  <tr>
+                    <th><label for="barcode">Barcode: </label></td>
+                    <td><input type="text" id="barcode" name="barcode" /></td>
+                    <td>
+                      [% IF ( removeChecked ) %]<input type="checkbox" name="removeItem" checked="checked" />
+                      [% ELSE %]<input type="checkbox" name="removeItem" />[% END %]
+                      <label for="removeItem">Remove item from collection</label>
+                    </td>
+                  </tr>
 
-      <div>
-        <h2>Items in this collection</h2>
-        [% IF ( collectionItemsLoop ) %]
-          <table>
-            <tr>
-              <th>Title</th>
-              <th>Call number</th>
-              <th>Barcode</th>
-            </tr>
-            [% FOREACH collectionItemsLoo IN collectionItemsLoop %]
-              <tr>
-                <td>[% collectionItemsLoo.title |html %]</td>
-                <td>[% collectionItemsLoo.itemcallnumber %]</td>
-                <td>[% collectionItemsLoo.barcode %]</td>
-              </tr>
-            [% END %]
-          </table>
-        [% ELSE %]
-          There are no items in this collection.
-        [% END %]
-      </div>
+                  <input type="hidden" id="colId" name="colId" value="[% colId %]" />
+                  <input type="hidden" name="action" value="addItem" />
+                  <tr><td align="right" colspan="99"><input class="btn" type="submit" value="Submit" /></td></tr>
+                </table>
+                </form>
+              </div>
 
-      <div>
-        <br/>
-        <input type="button" value="Return to rotating collections home" onclick="window.location.href='rotatingCollections.pl'">
-      </div>
+              <div>
+                <h2>Items in this collection</h2>
+                [% IF ( collectionItemsLoop ) %]
+                  <table>
+                    <tr>
+                      <th>Title</th>
+                      <th>Call number</th>
+                      <th>Barcode</th>
+                    </tr>
+                    [% FOREACH collectionItemsLoo IN collectionItemsLoop %]
+                      <tr>
+                        <td>[% collectionItemsLoo.title |html %]</td>
+                        <td>[% collectionItemsLoo.itemcallnumber %]</td>
+                        <td>[% collectionItemsLoo.barcode %]</td>
+                      </tr>
+                    [% END %]
+                  </table>
+                [% ELSE %]
+                  There are no items in this collection.
+                [% END %]
+              </div>
 
-</div>
-</div>
-[% INCLUDE 'intranet-bottom.inc' %]
+              <div>
+                <br/>
+                <input type="button" value="Return to rotating collections home" onclick="window.location.href='rotatingCollections.pl'">
+              </div>
+
+            </div>
+        </div>
+    </div>
 
+[% INCLUDE 'intranet-bottom.inc' %]
index e1bb2a8..fa1099a 100644 (file)
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Edit collections</div>
 
-<div id="doc3">
-<div id="bd">
-        <div class="yui-gb">
-      <h1>Rotating collections: Edit collections</h1>
+<div id="doc3" class="yui-t2">
+    <div id="bd">
+        <div class="yui-b">
+           [% INCLUDE 'tools-menu.inc' %]
+        </div>
 
-<!--
-      [% IF ( previousActionCreate ) %]
-        [% IF ( createSuccess ) %]
-          <div>Collection '[% createdTitle %]' Created successfully!</div>
-        [% ELSE %]
-          <div>Collection '[% createdTitle %]' Failed to be created!</div>
-          <div>Reason: <strong>[% failureMessage %]</strong></div>
-        [% END %]
-      [% END %]
+        <div class="yui-main">
+            <div class="yui-bd">
 
-      [% IF ( previousActionDelete ) %]
-        [% IF ( DeleteSuccess ) %]
-          <div>Collection Deleted successfully!</div>
-        [% ELSE %]
-          <div>Collection Failed to be deleted!</div>
-        [% END %]
-      [% END %]
--->
+              [% IF ( previousActionCreate ) %]
+                [% IF ( createSuccess ) %]
+                  <div class="alert">Collection <i>[% createdTitle %]</i> created successfully!</div>
+                [% ELSE %]
+                  <div class="alert">
+                    <p>Collection <i>[% createdTitle %]</i> failed to be created!</p>
+                    <p>
+                        [% IF failureMessage == "NO_TITLE" %]
+                            No title entered.
+                        [% ELSIF failureMessage == "NO_DESCRIPTION" %]
+                            No description entered.
+                        [% ELSE %]
+                            [% failureMessage %]
+                        [% END %]
+                    </p>
+                  </div>
+                [% END %]
+              [% END %]
+
+              [% IF ( previousActionDelete ) %]
+                [% IF ( deleteSuccess ) %]
+                  <div class="alert">Collection deleted successfully!</div>
+                [% ELSE %]
+                  <div class="alert">Collection failed to be deleted!</div>
+                [% END %]
+              [% END %]
 
-      [% IF ( previousActionUpdate ) %]
-        [% IF ( updateSuccess ) %]
-          <div>Collection '[% updatedTitle %]' Updated successfully!</div>
-        [% ELSE %]
-          <div>Collection '[% updatedTitle %]' Failed to be updated!</div>
-          <div>Reason: <strong>[% failureMessage %]</strong></div>
-        [% END %]
-      [% END %]
+              [% IF ( previousActionUpdate ) %]
+                [% IF ( updateSuccess ) %]
+                  <div class="alert">Collection <i>[% updatedTitle %]</i> updated successfully!</div>
+                [% ELSE %]
+                  <div class="alert">
+                    <p>Collection <i>[% updatedTitle %]</i> failed to be updated!</p>
+                    <p>
+                        [% IF failureMessage == "NO_ID" %]
+                            No collection id given.
+                        [% ELSE %]
+                            [% failureMessage %]
+                        [% END %]
+                    </p>
+                </div>
+                [% END %]
+              [% END %]
 
-      <div>
-        [% IF ( collectionsLoop ) %]
-          <table>
-           <thead>
-            <tr>
-              <th>Title</th>
-              <th>Description</th>
-              <th>Holding library</th>
-              <th>&nbsp;</th>
-              <th>&nbsp;</th>
-            </tr>
-           <thead>
-           <tbody>
-            [% FOREACH collectionsLoo IN collectionsLoop %]
-              <tr>
-                <td>[% collectionsLoo.colTitle %]</td>
-                <td>[% collectionsLoo.colDesc %]</td>
-                <td>[% collectionsLoo.colBranchcode %]</td>
-                <td><a href="editCollections.pl?action=edit&amp;colId=[% collectionsLoo.colId %]">Edit</a></td>
-                <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.
-        [% END %]
-      </div>    
+              <div>
+                <br />
 
-      <div>
-        <br />
+                [% IF action == "new" || action == "edit" %]
+                    [% IF ( previousActionEdit ) %]
+                      <h1>Edit collection <i>[% editColTitle %]</i></h1>
+                    [% ELSE %]
+                      <h1>Create new collection</h1>
+                    [% END %]
 
-        [% IF ( previousActionEdit ) %]
-          <h1>Edit Collection</h1>
-        [% ELSE %]
-          <h1>Create new collection</h1>
-        [% END %]
+                    <form action="editCollections.pl" method="post">
+                      [% IF ( previousActionEdit ) %]
+                        <input type="hidden" name="action" value="update" />
+                        <input type="hidden" name="colId" value="[% editColId %]" />
+                      [% ELSE %]
+                        <input type="hidden" name="action" value="create" />
+                      [% END %]
 
-        <form action="editCollections.pl" method="post">
-          [% IF ( previousActionEdit ) %]
-            <input type="hidden" name="action" value="update" />
-            <input type="hidden" name="colId" value="[% editColId %]" />
-          [% ELSE %]
-            <input type="hidden" name="action" value="create" />
-          [% END %]
+                      <table>
+                        <tr>
+                          <td>
+                            <label class="required" for="title">Title: </label>
+                          </td>
+                          <td>
+                            [% IF ( editColTitle ) %]<input type="text" name="title" value="[% editColTitle %]" />
+                            [% ELSE %]<input type="text" name="title" />[% END %]
+                          </td>
+                        </tr>
 
-          <table>
-            <tr>
-              <td>
-                <label for="title">Title: </label>
-              </td>
-              <td>
-                [% IF ( editColTitle ) %]<input type="text" name="title" value="[% editColTitle %]" />
-                [% ELSE %]<input type="text" name="title" />[% END %]
-              </td>
-            </tr>
-        
-            <tr>
-              <td>
-                <label for="description">Description: </label>
-              </td>
-              <td>
-                [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[% editColDescription %]" />
-                [% ELSE %]<input type="text" size="50" name="description" />[% END %]
-              </td>
-            </tr>
+                        <tr>
+                          <td>
+                            <label class="required" for="description">Description: </label>
+                          </td>
+                          <td>
+                            [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[% editColDescription %]" />
+                            [% ELSE %]<input type="text" size="50" name="description" />[% END %]
+                          </td>
+                        </tr>
 
-            <tr>
-              <td colspan="2">
-                [% IF ( previousActionEdit ) %]
-                  <input type="submit" value="Update" />
-                [% ELSE %]
-                  <input type="submit" value="Create" />
+                        <tr>
+                          <td colspan="2">
+                            [% IF ( previousActionEdit ) %]
+                              <input class="btn" type="submit" value="Update" />
+                            [% ELSE %]
+                              <input class="btn" type="submit" value="Create" />
+                            [% END %]
+                          </td>
+                        </tr>
+                      </table>
+                    </form>
                 [% END %]
-              </td>
-            </tr>
-          </table>
-        </form>
-      </div>
+              </div>
 
-      <div>
-        <br/>
-        <input type="button" value="Return to rotating collections home" onclick="window.location.href='rotatingCollections.pl'">
-      </div>
+              <p>
+                <a class="btn" href="rotatingCollections.pl">Return to rotating collections home</a>
+              </p>
 
-</div>
-</div>
+            </div>
+        </div>
+    </div>
 [% INCLUDE 'intranet-bottom.inc' %]
 
index e1780ad..0a893ab 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Branches %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Rotating collections</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -8,40 +9,50 @@
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Rotating collections</div>
 
-<div id="doc3">
-<div id="bd">
-        <div class="yui-gb">
+<div id="doc3" class="yui-t2">
+    <div id="bd">
+        <div class="yui-b">
+            [% INCLUDE 'tools-menu.inc' %]
+        </div>
 
-      <h1>Rotating collections</h1>
-      <div>
-        [% IF ( collectionsLoop ) %]
-          <table>
-            <tr>
-              <th><strong>Title</strong></th>
-              <th>Description</strong></th>
-              <th>Current location</th>
-              <th>Add/Remove items</th>
-              <th>Transfer collection</th>
-            </tr>
-            [% FOREACH collectionsLoo IN collectionsLoop %]
-              <tr>
-                <td>[% collectionsLoo.colTitle %]</td>
-                <td>[% collectionsLoo.colDesc %]</td>
-                <td>[% collectionsLoo.colBranchcode %]</td>
-                <td><a href="addItems.pl?colId=[% collectionsLoo.colId %]">Add/Remove Items</a></td>
-                <td><a href="transferCollection.pl?colId=[% collectionsLoo.colId %]">Transfer Collection</a></td>
-              </tr>
-            [% END %]
-          </table>
-        [% ELSE %]
-          There are no collections currently defined.
-        [% END %]
-      </div>
+        <div class="yui-main">
+            <div class="yui-bd">
 
-      <div>
-       <br/>
-    <input type="button" value="Edit collections" onclick="window.location.href='editCollections.pl'">
-      </div>    
-</div>
-</div>
-[% INCLUDE 'intranet-bottom.inc' %]
\ No newline at end of file
+                <h1>Rotating collections</h1>
+                <div>
+                    [% IF ( collectionsLoop ) %]
+                        <table>
+                            <tr>
+                                <th><strong>Title</strong></th>
+                                <th>Description</strong></th>
+                                <th>Current location</th>
+                                <th>&nbsp;</th>
+                                <th>&nbsp;</th>
+                                <th>&nbsp;</th>
+                                <th>&nbsp;</th>
+                            </tr>
+
+                            [% FOREACH collectionsLoo IN collectionsLoop %]
+                                <tr>
+                                    <td>[% collectionsLoo.colTitle %]</td>
+                                    <td>[% collectionsLoo.colDesc %]</td>
+                                    <td>[% Branches.GetName( collectionsLoo.colBranchcode ) %]</td>
+                                    <td><a href="addItems.pl?colId=[% collectionsLoo.colId %]">Add/remove items</a></td>
+                                    <td><a href="transferCollection.pl?colId=[% collectionsLoo.colId %]">Transfer</a></td>
+                                    <td><a href="editCollections.pl?action=edit&colId=[% collectionsLoo.colId %]">Edit</a></td>
+                                    <td><a href="editCollections.pl?action=delete&colId=[% collectionsLoo.colId %]">Delete</a></td>
+                                </tr>
+                            [% END %]
+                        </table>
+                    [% ELSE %]
+                        There are no collections currently defined.
+                    [% END %]
+                </div>
+
+                <p>
+                    <a class="btn" href="editCollections.pl?action=new">Create collection</a>
+                </p>
+            </div>
+        </div>
+    </div>
+[% INCLUDE 'intranet-bottom.inc' %]
index 25f2cb2..fe582f6 100644 (file)
@@ -7,42 +7,50 @@
 [% INCLUDE 'cat-search.inc' %]
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a> &rsaquo; Transfer collection</div>
-<div id="doc3">
-<div id="bd">
-        <div class="yui-gb">
-      <h1>Rotating collections: Transfer collection</h1>
-    <br />
-      [% IF ( transferSuccess ) %]
-        <div>Collection transferred successfully</div>
-      [% END %]
-
-      [% IF ( transferFailure ) %]
-        <div>Failed to transfer collection!</div>
-        <div>Reason: <strong>[% errorMessage %]</strong></div>
-      [% END %]
-
-      [% IF ( transferSuccess ) %]
-      [% ELSE %]
-        <div>
-          <form action="transferCollection.pl" method="post">
-            <input type="hidden" name="colId" value="[% colId %]">
-  
-            <label for="toBranch">Choose your library:</label>
-            <select name="toBranch">
-              [% FOREACH branchoptionloo IN branchoptionloop %]
-                [% IF ( branchoptionloo.selected ) %]<option value="[% branchoptionloo.code %]" selected="selected">[% branchoptionloo.name %]</option>[% ELSE %]<option value="[% branchoptionloo.code %]">[% branchoptionloo.name %]</option>[% END %]
-              [% END %]
-            </select>
-            <INPUT type="submit" value="Transfer collection">
-          </form>
+
+<div id="doc3" class="yui-t2">
+    <div id="bd">
+        <div class="yui-b">
+            [% INCLUDE 'tools-menu.inc' %]
         </div>
-      [% END %]
 
-      <div>
-        <br/>
-        <input type="button" value="Return to rotating collections home" onclick="window.location.href='rotatingCollections.pl'">
-      </div>
+        <div class="yui-main">
+            <div class="yui-bd">
+                <h1>Rotating collections: Transfer collection</h1>
+
+                [% IF ( transferSuccess ) %]
+                    <div class="alert">Collection transferred successfully</div>
+                [% ELSIF ( transferFailure ) %]
+                    <div class="alert">Failed to transfer collection!</div>
+                [% END %]
+
+                [% IF ( transferSuccess ) %]
+                [% ELSE %]
+                    <div>
+                        <form action="transferCollection.pl" method="post">
+                            <input type="hidden" name="colId" value="[% colId %]">
+
+                            <label for="toBranch">Choose your library:</label>
+                            <select name="toBranch">
+                                [% FOREACH branchoptionloo IN branchoptionloop %]
+                                    [% IF ( branchoptionloo.selected ) %]
+                                        <option value="[% branchoptionloo.code %]" selected="selected">[% branchoptionloo.name %]</option>
+                                    [% ELSE %]
+                                        <option value="[% branchoptionloo.code %]">[% branchoptionloo.name %]</option>
+                                    [% END %]
+                                [% END %]
+                            </select>
 
-</div>
-</div>
+                            <input class="btn" type="submit" value="Transfer collection">
+                        </form>
+                    </div>
+                [% END %]
+
+                <p>
+                    <a class="btn" href="rotatingCollections.pl">Return to rotating collections home</a>
+                </p>
+
+            </div>
+        </div>
+    </div>
 [% INCLUDE 'intranet-bottom.inc' %]
index 10be5cb..df87908 100755 (executable)
@@ -48,13 +48,14 @@ if ( $query->param('action') eq 'addItem' ) {
 
     my ( $success, $errorCode, $errorMessage );
 
+    $template->param( barcode => $barcode );
+
     if ( !$removeItem ) {
         ( $success, $errorCode, $errorMessage ) =
           AddItemToCollection( $colId, $itemnumber );
 
         $template->param(
             previousActionAdd => 1,
-            addedBarcode      => $barcode,
         );
 
         if ($success) {
@@ -72,7 +73,6 @@ if ( $query->param('action') eq 'addItem' ) {
 
         $template->param(
             previousActionRemove => 1,
-            removedBarcode       => $barcode,
             removeChecked        => 1,
         );
 
index 39e94a5..4372074 100755 (executable)
@@ -39,8 +39,11 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
+my $action = $query->param('action');
+$template->param( action => $action );
+
 # Create new Collection
-if ( $query->param('action') eq 'create' ) {
+if ( $action eq 'create' ) {
     my $title       = $query->param('title');
     my $description = $query->param('description');
 
@@ -62,7 +65,7 @@ if ( $query->param('action') eq 'create' ) {
 }
 
 ## Delete a club or service
-elsif ( $query->param('action') eq 'delete' ) {
+elsif ( $action eq 'delete' ) {
     my $colId = $query->param('colId');
     my ( $success, $errorCode, $errorMessage ) = DeleteCollection($colId);
 
@@ -77,9 +80,8 @@ elsif ( $query->param('action') eq 'delete' ) {
 }
 
 ## Edit a club or service: grab data, put in form.
-elsif ( $query->param('action') eq 'edit' ) {
-    my $colId = $query->param('colId');
-    my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection($colId);
+elsif ( $action eq 'edit' ) {
+    my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $query->param('colId') );
 
     $template->param(
         previousActionEdit => 1,
@@ -90,7 +92,7 @@ elsif ( $query->param('action') eq 'edit' ) {
 }
 
 # Update a Club or Service
-elsif ( $query->param('action') eq 'update' ) {
+elsif ( $action eq 'update' ) {
     my $colId       = $query->param('colId');
     my $title       = $query->param('title');
     my $description = $query->param('description');
@@ -112,15 +114,11 @@ elsif ( $query->param('action') eq 'update' ) {
     }
 }
 
-my $collections = GetCollections();
-
 $template->param(
     intranetcolorstylesheet =>
       C4::Context->preference("intranetcolorstylesheet"),
     intranetstylesheet => C4::Context->preference("intranetstylesheet"),
     IntranetNav        => C4::Context->preference("IntranetNav"),
-
-    collectionsLoop => $collections,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;