koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha circ/returns.pl koha-tmpl/intranet-tmpl/cc... [dev_week]


From: Kyle Hall
Subject: [Koha-cvs] koha circ/returns.pl koha-tmpl/intranet-tmpl/cc... [dev_week]
Date: Mon, 23 Apr 2007 14:54:55 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Kyle Hall <kylemhall>   07/04/23 14:54:55

Modified files:
        circ           : returns.pl 
Added files:
        koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections: 
                                                              addItems.tmpl 
                                                              
editCollections.tmpl 
                                                              
rotatingCollections.tmpl 
                                                              
transferCollection.tmpl 
        rotatingCollections: addItems.pl editCollections.pl 
                             rotatingCollections.pl 
                             transferCollection.pl 

Log message:
        Added module for handling Rotating Collections

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/circ/returns.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.37.2.6.2.6&r2=1.37.2.6.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/addItems.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/editCollections.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/rotatingCollections.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/transferCollection.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/rotatingCollections/addItems.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/rotatingCollections/editCollections.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/rotatingCollections/rotatingCollections.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/rotatingCollections/transferCollection.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1

Patches:
Index: circ/returns.pl
===================================================================
RCS file: /sources/koha/koha/circ/returns.pl,v
retrieving revision 1.37.2.6.2.6
retrieving revision 1.37.2.6.2.7
diff -u -b -r1.37.2.6.2.6 -r1.37.2.6.2.7
--- circ/returns.pl     16 Apr 2007 03:07:28 -0000      1.37.2.6.2.6
+++ circ/returns.pl     23 Apr 2007 14:54:54 -0000      1.37.2.6.2.7
@@ -23,6 +23,8 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
+use PrintR;
+
 use strict;
 
 use CGI;
@@ -38,6 +40,7 @@
 use C4::Auth;
 use C4::Interface::CGI::Output;
 use C4::Koha;
+use C4::RotatingCollections;
 
 my $query = new CGI;
 
@@ -146,6 +149,9 @@
 # actually return book and prepare item table.....
 if ($barcode) {
    
+    #CCFLS ONLY
+    system "php /usr/local/koha/intranet/htdocs/ccflsFines/createFine.php 
$barcode";
+
     # decode cuecat
     $barcode = cuecatbarcodedecode($barcode);
     ( $returned, $messages, $iteminformation, $borrower ) = returnbook( 
$barcode, $branch );
@@ -478,6 +484,18 @@
        IntranetNav => C4::Context->preference("IntranetNav"),
 );
 
+## Check to see if returned item is a rotating collection item returned to the 
wrong branch
+my $itemnumber = getItemnumberByBarcode( $query->param('barcode') );
+if ( $itemnumber ) {
+  my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( 
$itemnumber );
+  if ( ! ( $holdingBranch eq $collectionBranch ) ) {
+    $template->param(
+      collectionItemNeedsTransferred => 1,
+      collectionBranch => $collectionBranch,
+    );
+  }
+}
+
 # actually print the page!
 output_html_with_http_headers $query, $cookie, $template->output;
 

Index: koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/addItems.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/addItems.tmpl
diff -N koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/addItems.tmpl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/addItems.tmpl  23 Apr 
2007 14:54:54 -0000      1.1.2.1
@@ -0,0 +1,79 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-noneSelected.inc" -->
+  <dl class="bodyPane">
+    <dt class="bodyPane">Add Items to a Collection</dt>
+    <dd class="bodyPane">
+      <div>
+          <br />
+          <!-- TMPL_IF NAME="previousActionAdd" -->
+            <!-- TMPL_IF NAME="addSuccess" -->
+              <div>Item with barcode '<!-- TMPL_VAR NAME="addedBarcode" -->' 
Added Succesfully!</div>
+            <!-- TMPL_ELSE -->
+              <div>Failed to add item with barcode '<!-- TMPL_VAR 
NAME="addedBarcode" -->'!</div>
+              <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" 
--></strong></div>
+            <!-- /TMPL_IF -->
+          <!-- /TMPL_IF -->
+
+          <!-- TMPL_IF NAME="previousActionRemove" -->
+            <!-- TMPL_IF NAME="removeSuccess" -->
+              <div>Item with barcode '<!-- TMPL_VAR NAME="addedBarcode" -->' 
Removed Succesfully!</div>
+            <!-- TMPL_ELSE -->
+              <div>Failed to remove item with barcode '<!-- TMPL_VAR 
NAME="removedBarcode" -->'!</div>
+              <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" 
--></strong></div>
+            <!-- /TMPL_IF -->
+          <!-- /TMPL_IF -->
+
+          <h3>Add Item to <i><!-- TMPL_VAR NAME="colTitle" --></i></h3>
+      </div>
+
+      <div>
+        <form action="addItems.pl" method="post">
+        <table>
+          <tr>
+            <td><label for="barcode">Barcode: </label></td>
+            <td><input type="text" id="barcode" name="barcode" /></td>
+            <td>
+              <input type="checkbox" name="removeItem" <!-- TMPL_IF 
NAME="removeChecked" -->checked<!-- /TMPL_IF--> >
+              <label for="removeItem">Remove Item from Collection</label>
+            </td>
+          </tr>
+
+          <input type="hidden" id="colId" name="colId" value="<!-- TMPL_VAR 
NAME="colId" -->" />
+          <input type="hidden" name="action" value="addItem" /> 
+          <tr><td><input type="submit" value="Submit" /></td></tr>
+        </table>
+        </form>
+      </div>
+
+      <br />
+      <div><a 
href="/cgi-bin/koha/rotatingCollections/rotatingCollections.pl">Rotating 
Collections Home</a></div>
+      <br />
+
+      <div>
+        <h2>Items In This Collection</h2>
+        <!-- TMPL_IF NAME="collectionItemsLoop" -->
+          <table>
+            <tr>
+              <th>Title</th>
+              <th>Callnumber</th>
+              <th>Barcode</th>
+            </tr>
+            <!-- TMPL_LOOP NAME="collectionItemsLoop" -->
+              <tr>
+                <td><!-- TMPL_VAR NAME="title" --></td>
+                <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
+                <td><!-- TMPL_VAR NAME="barcode" --></td>
+              </tr>
+            <!-- /TMPL_LOOP -->
+          </table>
+        <!-- TMPL_ELSE -->
+          There are no Items in this Collection.
+        <!-- /TMPL_IF -->
+      </div>
+
+
+    </dd>
+  </dl>
+</body>
+</html>

Index: koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/editCollections.tmpl
===================================================================
RCS file: 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/editCollections.tmpl
diff -N 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/editCollections.tmpl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/editCollections.tmpl   
23 Apr 2007 14:54:54 -0000      1.1.2.1
@@ -0,0 +1,115 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-noneSelected.inc" -->
+  <dl class="bodyPane">
+    <dt class="bodyPane">Clubs & Services</dt>
+    <dd class="bodyPane">
+      <br />
+
+      <!-- TMPL_IF NAME="previousActionCreate" -->
+        <!-- TMPL_IF NAME="createSuccess" -->
+          <div>Club Or Service '<!-- TMPL_VAR NAME="createdTitle" -->' Created 
Succesfully!</div>
+        <!-- TMPL_ELSE -->
+          <div>Collection '<!-- TMPL_VAR NAME="createdTitle" -->' Failed To Be 
Created!</div>
+          <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" 
--></strong></div>
+        <!-- /TMPL_IF -->
+      <!-- /TMPL_IF -->
+
+      <!-- TMPL_IF NAME="previousActionDelete" -->
+        <!-- TMPL_IF NAME="DeleteSuccess" -->
+          <div>Collection Deleted Succesfully!</div>
+        <!-- TMPL_ELSE -->
+          <div>Collection Failed To Be Deleted!</div>
+        <!-- /TMPL_IF -->
+      <!-- /TMPL_IF -->
+
+      <!-- TMPL_IF NAME="previousActionUpdate" -->
+        <!-- TMPL_IF NAME="updateSuccess" -->
+          <div>Collection '<!-- TMPL_VAR NAME="updatedTitle" -->' Updated 
Succesfully!</div>
+        <!-- TMPL_ELSE -->
+          <div>Collection '<!-- TMPL_VAR NAME="updatedTitle" -->' Failed To Be 
Updated!</div>
+          <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" 
--></strong></div>
+        <!-- /TMPL_IF -->
+      <!-- /TMPL_IF -->
+
+      <div>
+        <!-- TMPL_IF NAME="collectionsLoop" -->
+          <table>
+            <tr>
+              <th>Title</th>
+              <th>Description</th>
+              <th>Holding Library</th>
+              <td></td>
+              <td></td>
+            </tr>
+            <!-- TMPL_LOOP NAME="collectionsLoop" -->
+              <tr>
+                <td><!-- TMPL_VAR NAME="colTitle" --></td>
+                <td><!-- TMPL_VAR NAME="colDesc" --></td>
+                <td><!-- TMPL_VAR NAME="colBranchcode" --></td>
+                <td><a href="editCollections.pl?action=edit&colId=<!-- 
TMPL_VAR NAME="colId" -->">Edit</a></td>
+                <td><a href="editCollections.pl?action=delete&colId=<!-- 
TMPL_VAR NAME="colId" -->">Delete</a></td>
+              </tr>
+            <!-- /TMPL_LOOP -->
+          </table>
+        <!-- TMPL_ELSE -->
+          There are no Collections currently defined.
+        <!-- /TMPL_IF -->
+      </div>    
+
+      <div>
+        <br />
+
+        <!-- TMPL_IF NAME="previousActionEdit" -->
+          <h1>Edit Collection</h1>
+        <!-- TMPL_ELSE -->
+          <h1>Create New Collection</h1>
+        <!-- /TMPL_IF -->
+
+        <form action="editCollections.pl" method="post">
+          <!-- TMPL_IF NAME="previousActionEdit" -->
+            <input type="hidden" name="action" value="update" />
+            <input type="hidden" name="colId" value="<!-- TMPL_VAR 
NAME="editColId" -->" />
+          <!-- TMPL_ELSE -->
+            <input type="hidden" name="action" value="create" />
+          <!-- /TMPL_IF -->
+
+          <table>
+            <tr>
+              <td>
+                <label for="title">Title: </label>
+              </td>
+              <td>
+               <input type="text" name="title" <!-- TMPL_IF 
NAME="editColTitle" --> value="<!-- TMPL_VAR NAME="editColTitle" -->" <!-- 
/TMPL_IF --> />
+              </td>
+            </tr>
+        
+            <tr>
+              <td>
+                <label for="description">Description: </label>
+              </td>
+              <td>
+                <input type="text" size="50" name="description" <!-- TMPL_IF 
NAME="editColDescription" --> value="<!-- TMPL_VAR NAME="editColDescription" 
-->" <!-- /TMPL_IF --> />
+              </td>
+            </tr>
+
+            <tr>
+              <td colspan="2">
+                <!-- TMPL_IF NAME="previousActionEdit" -->
+                  <input type="submit" value="Update" />
+                <!-- TMPL_ELSE -->
+                  <input type="submit" value="Create" />
+                <!-- /TMPL_IF -->
+              </td>
+            </tr>
+          </table>
+        </form>
+      </div>
+
+      <br />
+      <div><a 
href="/cgi-bin/koha/rotatingCollections/rotatingCollections.pl">Rotating 
Collections Home</a></div>
+
+    </dd>
+  </dl>
+</body>
+</html>

Index: 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/rotatingCollections.tmpl
===================================================================
RCS file: 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/rotatingCollections.tmpl
diff -N 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/rotatingCollections.tmpl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/rotatingCollections.tmpl   
    23 Apr 2007 14:54:54 -0000      1.1.2.1
@@ -0,0 +1,40 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-noneSelected.inc" -->
+  <dl class="bodyPane">
+    <dt class="bodyPane">Rotating Collections</dt>
+    <dd class="bodyPane">
+    <br />
+      <div>
+        <!-- TMPL_IF NAME="collectionsLoop" -->
+          <table>
+            <tr>
+              <th><strong>Title</strong></th>
+              <th>Description</strong></th>
+              <th>Current Locataion</th>
+              <th>Add Items</th>
+              <th>Transfer</th>
+            </tr>
+            <!-- TMPL_LOOP NAME="collectionsLoop" -->
+              <tr>
+                <td><!-- TMPL_VAR NAME="colTitle" --></td>
+                <td><!-- TMPL_VAR NAME="colDesc" --></td>
+                <td><!-- TMPL_VAR NAME="colBranchcode" --></td>
+                <td><a href="addItems.pl?colId=<!-- TMPL_VAR NAME="colId" 
-->">Add Items</a></td>
+                <td><a href="transferCollection.pl?colId=<!-- TMPL_VAR 
NAME="colId" -->">Transfer</a></td>
+              </tr>
+            <!-- /TMPL_LOOP -->
+          </table>
+        <!-- TMPL_ELSE -->
+          There are no Collections currently defined.
+        <!-- /TMPL_IF -->
+      </div>
+
+      <div>
+        <div><a href="editCollections.pl">Create New Collection</a></div>
+      </div>    
+
+    </dd>
+  </dl>
+</body>
+</html>

Index: 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/transferCollection.tmpl
===================================================================
RCS file: 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/transferCollection.tmpl
diff -N 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/transferCollection.tmpl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
koha-tmpl/intranet-tmpl/ccfls/en/rotatingCollections/transferCollection.tmpl    
    23 Apr 2007 14:54:54 -0000      1.1.2.1
@@ -0,0 +1,40 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-noneSelected.inc" -->
+  <dl class="bodyPane">
+    <dt class="bodyPane">Transfer Collection: <!-- TMPL_VAR NAME="colTitle" 
--></dt>
+    <dd class="bodyPane">
+    <br />
+      <!-- TMPL_IF NAME="transferSuccess" -->
+        <div>Collection Transfered Successfully</div>
+      <!-- /TMPL_IF -->
+
+      <!-- TMPL_IF NAME="transferFailure" -->
+        <div>Failed to Transfer Collection!</div>
+        <div>Reason: <strong><!-- TMPL_VAR NAME="errorMessage" 
--></strong></div>
+      <!-- /TMPL_IF -->
+
+      <!-- TMPL_IF NAME="transferSuccess" -->
+      <!-- TMPL_ELSE -->
+        <div>
+          <form action="transferCollection.pl" method="post">
+            <input type="hidden" name="colId" value="<!-- TMPL_VAR 
NAME="colId" -->">
+  
+            <label for="toBranch">Choose your Library:</label>
+            <select name="toBranch">
+              <!-- TMPL_LOOP Name="branchoptionloop" -->
+                <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR 
Name="code" -->" selected="selected"><!-- TMPL_VAR Name="name" --></option><!-- 
TMPL_ELSE --><option value="<!-- TMPL_VAR Name="code" -->"><!-- TMPL_VAR 
Name="name" --></option><!-- /TMPL_IF -->
+              <!-- /TMPL_LOOP -->
+            </select>
+            <INPUT type="submit" value="Transfer Collection">
+          </form>
+        </div>
+      <!-- /TMPL_IF -->
+      <div>
+        <div><a href="rotatingCollections.pl">Rotating Collections 
Home</a></div>
+      </div>    
+
+    </dd>
+  </dl>
+</body>
+</html>

Index: rotatingCollections/addItems.pl
===================================================================
RCS file: rotatingCollections/addItems.pl
diff -N rotatingCollections/addItems.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ rotatingCollections/addItems.pl     23 Apr 2007 14:54:54 -0000      1.1.2.1
@@ -0,0 +1,85 @@
+#!/usr/bin/perl
+use HTML::Template;
+use strict;
+require Exporter;
+use C4::Database;
+use C4::Output;  # contains gettemplate
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Context;
+use C4::RotatingCollections;
+
+use Data::Dumper;
+use CGI;
+
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => 
"rotatingCollections/addItems.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
+
+if ( $query->param('action') eq 'addItem' ) {
+  ## Add the given item to the collection
+  my $colId = $query->param('colId');
+  my $barcode = $query->param('barcode');
+  my $removeItem = $query->param('removeItem');
+  my $itemnumber = getItemnumberByBarcode( $barcode );
+
+  my ( $success, $errorCode, $errorMessage );
+  
+  if ( ! $removeItem ) {
+    ( $success, $errorCode, $errorMessage ) = AddItemToCollection( $colId, 
$itemnumber );
+
+    $template->param(
+      previousActionAdd => 1,
+      addedBarcode => $barcode,
+    );
+
+    if ( $success ) {
+      $template->param( addSuccess => 1 );
+    } else {
+      $template->param( addFailure => 1 );
+      $template->param( failureMessage => $errorMessage );
+    }
+  } else {
+    ## Remove the given item from the collection
+    ( $success, $errorCode, $errorMessage ) = RemoveItemFromCollection( 
$colId, $itemnumber );
+
+    $template->param(
+      previousActionRemove => 1,
+      removedBarcode => $barcode,
+      removeChecked => 1,
+    );
+
+    if ( $success ) {
+      $template->param( removeSuccess => 1 );
+    } else {
+      $template->param( removeFailure => 1 );
+      $template->param( failureMessage => $errorMessage );
+    }
+
+  }  
+}
+
+my ( $colId, $colTitle, $colDescription, $colBranchcode ) = GetCollection( 
$query->param('colId') );
+my $collectionItems = GetItemsInCollection( $colId );
+if ( $collectionItems ) {
+  $template->param( collectionItemsLoop => $collectionItems );
+}
+
+$template->param(
+                intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
+                intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
+                IntranetNav => C4::Context->preference("IntranetNav"),
+                                  
+                colId => $colId,
+                colTitle => $colTitle,
+                colDescription => $colDescription,
+                colBranchcode => $colBranchcode,
+                );
+
+output_html_with_http_headers $query, $cookie, $template->output;

Index: rotatingCollections/editCollections.pl
===================================================================
RCS file: rotatingCollections/editCollections.pl
diff -N rotatingCollections/editCollections.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ rotatingCollections/editCollections.pl      23 Apr 2007 14:54:54 -0000      
1.1.2.1
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+
+use strict;
+require Exporter;
+
+use HTML::Template;
+use CGI;
+use Data::Dumper;
+
+use C4::Database;
+use C4::Output;  # contains gettemplate
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Context;
+
+use C4::RotatingCollections;
+
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => 
"rotatingCollections/editCollections.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
+
+# Create new Collection
+if ( $query->param('action') eq 'create' ) {
+  my $title = $query->param('title');
+  my $description = $query->param('description');
+                            
+  my ( $createdSuccessfully, $errorCode, $errorMessage ) = CreateCollection( 
$title, $description );
+                              
+  $template->param(
+    previousActionCreate => 1,
+    createdTitle => $title,
+  );
+                                          
+  if ( $createdSuccessfully ) {
+    $template->param( createSuccess => 1 );
+  } else {
+    $template->param( createFailure => 1 );
+    $template->param( failureMessage => $errorMessage );
+  }                                                        
+}
+
+## Delete a club or service
+elsif ( $query->param('action') eq 'delete' ) {
+  my $colId = $query->param('colId');
+  my ( $success, $errorCode, $errorMessage ) = DeleteCollection( $colId );
+    
+  $template->param( previousActionDelete => 1 );
+  if ( $success ) {
+    $template->param( deleteSuccess => 1 );
+  } else {
+    $template->param( deleteFailure => 1 );
+    $template->param( failureMessage => $errorMessage );
+  }
+}
+
+## 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 );
+
+  $template->param(
+      previousActionEdit => 1,
+      editColId => $colId,
+      editColTitle => $colTitle,
+      editColDescription => $colDesc,
+  );
+}
+
+# Update a Club or Service
+elsif ( $query->param('action') eq 'update' ) {
+  my $colId = $query->param('colId');
+  my $title = $query->param('title');
+  my $description = $query->param('description');
+                            
+  my ( $createdSuccessfully, $errorCode, $errorMessage ) 
+    = UpdateCollection( $colId, $title, $description );
+                              
+  $template->param(
+    previousActionUpdate => 1,
+    updatedTitle => $title,
+  );
+                                          
+  if ( $createdSuccessfully ) {
+    $template->param( updateSuccess => 1 );
+  } else {
+    $template->param( updateFailure => 1 );
+    $template->param( failureMessage => $errorMessage );
+  }                                                        
+}
+                                                        
+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;

Index: rotatingCollections/rotatingCollections.pl
===================================================================
RCS file: rotatingCollections/rotatingCollections.pl
diff -N rotatingCollections/rotatingCollections.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ rotatingCollections/rotatingCollections.pl  23 Apr 2007 14:54:54 -0000      
1.1.2.1
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+use HTML::Template;
+use strict;
+require Exporter;
+use C4::Database;
+use C4::Output;  # contains gettemplate
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Context;
+use C4::RotatingCollections;
+
+use Data::Dumper;
+
+use CGI;
+
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => 
"rotatingCollections/rotatingCollections.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
+
+my $branchcode = $query->cookie('branch');
+
+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;

Index: rotatingCollections/transferCollection.pl
===================================================================
RCS file: rotatingCollections/transferCollection.pl
diff -N rotatingCollections/transferCollection.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ rotatingCollections/transferCollection.pl   23 Apr 2007 14:54:54 -0000      
1.1.2.1
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+use HTML::Template;
+use strict;
+require Exporter;
+use C4::Database;
+use C4::Output;  # contains gettemplate
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Context;
+use C4::RotatingCollections;
+use C4::Koha;
+
+use Data::Dumper;
+
+use CGI;
+
+my $query = new CGI;
+
+my $colId = $query->param('colId');
+my $toBranch = $query->param('toBranch');
+
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => 
"rotatingCollections/transferCollection.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {parameters => 1},
+                            debug => 1,
+                            });
+
+## Transfer collection
+my ( $success, $errorCode, $errorMessage );
+if ( $toBranch ) {
+  ( $success, $errorCode, $errorMessage ) = TransferCollection( $colId, 
$toBranch );
+
+  if ( $success ) {
+    $template->param( transferSuccess => 1 );
+  } else {
+    $template->param( transferFailure => 1,
+                      errorCode => $errorCode,
+                      errorMessage => $errorMessage
+    );
+  }
+}
+
+## Set up the toBranch select options
+my $branches = getbranches();
+my @branchoptionloop;
+foreach my $br (keys %$branches) {
+  my %branch;
+  $branch{code}=$br;
+  $branch{name}=$branches->{$br}->{'branchname'};
+  push (@branchoptionloop, \%branch);
+}
+    
+## Get data about collection
+my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );  
                              
+$template->param(
+                intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
+                intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
+                IntranetNav => C4::Context->preference("IntranetNav"),
+                                  
+                colId => $colId,
+                colTitle => $colTitle,
+                colDesc => $colDesc,
+                colBranchcode => $colBranchcode,
+                branchoptionloop => address@hidden
+                );
+                                                                               
                 
+output_html_with_http_headers $query, $cookie, $template->output;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]