[Koha-patches] [PATCH] Rotating Collections
LAURENT Henri-Damien
henridamien.laurent at biblibre.com
Tue Jan 19 22:32:20 CET 2010
Kyle Hall a écrit :
> I'd say this looks like the best one to use. Frédéric has tested it
> and added a few more necessary additions.
>
> Kyle
>
> http://www.kylehall.info
> Information Technology
> Crawford County Federated Library System ( http://www.ccfls.org )
>
>
mmm.... this latest patch does not apply on master because of
MARC21slimutils edits.
Frustrating ;)
>> C4/RotatingCollections.pm | 479 ++++++++++++++++++++
>> circ/returns.pl | 1 +
>> .../data/mysql/en/mandatory/userpermissions.sql | 1 +
>> .../mysql/fr-FR/1-Obligatoire/userpermissions.sql | 3 +-
>> installer/data/mysql/updatedatabase.pl | 33 ++
>> .../en/modules/rotating_collections/addItems.tmpl | 89 ++++
>> .../rotating_collections/editCollections.tmpl | 125 +++++
>> .../rotating_collections/rotatingCollections.tmpl | 47 ++
>> .../rotating_collections/transferCollection.tmpl | 48 ++
>> .../prog/en/modules/tools/tools-home.tmpl | 5 +
>> .../intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl | 65 ---
>> kohaversion.pl | 2 +-
>> rotating_collections/addItems.pl | 82 ++++
>> rotating_collections/editCollections.pl | 103 +++++
>> rotating_collections/rotatingCollections.pl | 34 ++
>> rotating_collections/transferCollection.pl | 66 +++
>> 16 files changed, 1116 insertions(+), 67 deletions(-)
>> create mode 100644 C4/RotatingCollections.pm
>> create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tmpl
>> create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tmpl
>> create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tmpl
>> create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tmpl
>> delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl
>> create mode 100755 rotating_collections/addItems.pl
>> create mode 100755 rotating_collections/editCollections.pl
>> create mode 100755 rotating_collections/rotatingCollections.pl
>> create mode 100755 rotating_collections/transferCollection.pl
>>
>> diff --git a/C4/RotatingCollections.pm b/C4/RotatingCollections.pm
>> new file mode 100644
>> index 0000000..82a4d5e
>> --- /dev/null
>> +++ b/C4/RotatingCollections.pm
>> @@ -0,0 +1,479 @@
>> +package C4::RotatingCollections;
>> +
>> +# $Id: RotatingCollections.pm,v 0.1 2007/04/20 kylemhall
>> +
>> +# This package is inteded to keep track of what library
>> +# Items of a certain collection should be at.
>> +
>> +# Copyright 2007 Kyle Hall
>> +#
>> +# This file is part of Koha.
>> +#
>> +# Koha is free software; you can redistribute it and/or modify it under the
>> +# terms of the GNU General Public License as published by the Free Software
>> +# Foundation; either version 2 of the License, or (at your option) any later
>> +# version.
>> +#
>> +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
>> +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
>> +# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License along with
>> +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
>> +# Suite 330, Boston, MA 02111-1307 USA
>> +
>> +use strict;
>> +
>> +require Exporter;
>> +
>> +use C4::Context;
>> +use C4::Circulation;
>> +
>> +use DBI;
>> +
>> +use Data::Dumper;
>> +
>> +use vars qw($VERSION @ISA @EXPORT);
>> +
>> +# set the version for version checking
>> +$VERSION = 0.01;
>> +
>> +=head1 NAME
>> +
>> +C4::RotatingCollections - Functions for managing rotating collections
>> +
>> +=head1 FUNCTIONS
>> +
>> +=over 2
>> +
>> +=cut
>> +
>> + at ISA = qw( Exporter );
>> + at EXPORT = qw(
>> + CreateCollection
>> + UpdateCollection
>> + DeleteCollection
>> +
>> + GetItemsInCollection
>> +
>> + GetCollection
>> + GetCollections
>> +
>> + AddItemToCollection
>> + RemoveItemFromCollection
>> + TransferCollection
>> +
>> + GetCollectionItemBranches
>> +
>> + getItemnumberByBarcode
>> +);
>> +
>> +=item CreateCollection
>> + ( $success, $errorcode, $errormessage ) = CreateCollection( $title, $description );
>> + Creates a new collection
>> +
>> + Input:
>> + $title: short description of the club or service
>> + $description: long description of the club or service
>> +
>> + Output:
>> + $success: 1 if all database operations were successful, 0 otherwise
>> + $errorCode: Code for reason of failure, good for translating errors in templates
>> + $errorMessage: English description of error
>> +=cut
>> +sub CreateCollection {
>> + my ( $title, $description ) = @_;
>> +
>> + ## Check for all neccessary parameters
>> + if ( ! $title ) {
>> + return ( 0, 1, "No Title Given" );
>> + }
>> + if ( ! $description ) {
>> + return ( 0, 2, "No Description Given" );
>> + }
>> +
>> + my $success = 1;
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth;
>> + $sth = $dbh->prepare("INSERT INTO collections ( colId, colTitle, colDesc )
>> + VALUES ( NULL, ?, ? )");
>> + $sth->execute( $title, $description ) or return ( 0, 3, $sth->errstr() );
>> + $sth->finish;
>> +
>> + return 1;
>> +
>> +}
>> +
>> +=item UpdateCollection
>> + ( $success, $errorcode, $errormessage ) = UpdateCollection( $colId, $title, $description );
>> + Updates a collection
>> +
>> + Input:
>> + $colId: id of the collection to be updated
>> + $title: short description of the club or service
>> + $description: long description of the club or service
>> +
>> + Output:
>> + $success: 1 if all database operations were successful, 0 otherwise
>> + $errorCode: Code for reason of failure, good for translating errors in templates
>> + $errorMessage: English description of error
>> +=cut
>> +sub UpdateCollection {
>> + my ( $colId, $title, $description ) = @_;
>> +
>> + ## Check for all neccessary parameters
>> + if ( ! $colId ) {
>> + return ( 0, 1, "No Id Given" );
>> + }
>> + if ( ! $title ) {
>> + return ( 0, 2, "No Title Given" );
>> + }
>> + if ( ! $description ) {
>> + return ( 0, 3, "No Description Given" );
>> + }
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth;
>> + $sth = $dbh->prepare("UPDATE collections
>> + SET
>> + colTitle = ?, colDesc = ?
>> + WHERE colId = ?");
>> + $sth->execute( $title, $description, $colId ) or return ( 0, 4, $sth->errstr() );
>> + $sth->finish;
>> +
>> + return 1;
>> +
>> +}
>> +
>> +=item DeleteCollection
>> + ( $success, $errorcode, $errormessage ) = DeleteCollection( $colId );
>> + Deletes a collection of the given id
>> +
>> + Input:
>> + $colId : id of the Archtype to be deleted
>> +
>> + Output:
>> + $success: 1 if all database operations were successful, 0 otherwise
>> + $errorCode: Code for reason of failure, good for translating errors in templates
>> + $errorMessage: English description of error
>> +=cut
>> +sub DeleteCollection {
>> + my ( $colId ) = @_;
>> +
>> + ## Paramter check
>> + if ( ! $colId ) {
>> + return ( 0, 1, "No Collection Id Given" );;
>> + }
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth;
>> +
>> + $sth = $dbh->prepare("DELETE FROM collections WHERE colId = ?");
>> + $sth->execute( $colId ) or return ( 0, 4, $sth->errstr() );
>> + $sth->finish;
>> +
>> + return 1;
>> +}
>> +
>> +=item GetCollections
>> + $collections = GetCollections();
>> + Returns data about all collections
>> +
>> + Output:
>> + On Success:
>> + $results: Reference to an array of associated arrays
>> + On Failure:
>> + $errorCode: Code for reason of failure, good for translating errors in templates
>> + $errorMessage: English description of error
>> +=cut
>> +sub GetCollections {
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth = $dbh->prepare("SELECT * FROM collections");
>> + $sth->execute() or return ( 1, $sth->errstr() );
>> +
>> + my @results;
>> + while ( my $row = $sth->fetchrow_hashref ) {
>> + push( @results , $row );
>> + }
>> +
>> + $sth->finish;
>> +
>> + return \@results;
>> +}
>> +
>> +=item GetItemsInCollection
>> + ( $results, $success, $errorcode, $errormessage ) = GetItemsInCollection( $colId );
>> + Returns information about the items in the given collection
>> +
>> + Input:
>> + $colId: The id of the collection
>> +
>> + Output:
>> + $results: Reference to an array of associated arrays
>> + $success: 1 if all database operations were successful, 0 otherwise
>> + $errorCode: Code for reason of failure, good for translating errors in templates
>> + $errorMessage: English description of error
>> +=cut
>> +sub GetItemsInCollection {
>> + my ( $colId ) = @_;
>> +
>> + ## Paramter check
>> + if ( ! $colId ) {
>> + return ( 0, 0, 1, "No Collection Id Given" );;
>> + }
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth = $dbh->prepare("SELECT
>> + biblio.title,
>> + items.itemcallnumber,
>> + items.barcode
>> + FROM collections, collections_tracking, items, biblio
>> + WHERE collections.colId = collections_tracking.colId
>> + AND collections_tracking.itemnumber = items.itemnumber
>> + AND items.biblionumber = biblio.biblionumber
>> + AND collections.colId = ? ORDER BY biblio.title");
>> + $sth->execute( $colId ) or return ( 0, 0, 2, $sth->errstr() );
>> +
>> + my @results;
>> + while ( my $row = $sth->fetchrow_hashref ) {
>> + push( @results , $row );
>> + }
>> +
>> + $sth->finish;
>> +
>> + return \@results;
>> +}
>> +
>> +=item GetCollection
>> + ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );
>> + Returns information about a collection
>> +
>> + Input:
>> + $colId: Id of the collection
>> + Output:
>> + $colId, $colTitle, $colDesc, $colBranchcode
>> +=cut
>> +sub GetCollection {
>> + my ( $colId ) = @_;
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my ( $sth, @results );
>> + $sth = $dbh->prepare("SELECT * FROM collections WHERE colId = ?");
>> + $sth->execute( $colId ) or return 0;
>> +
>> + my $row = $sth->fetchrow_hashref;
>> +
>> + $sth->finish;
>> +
>> + return (
>> + $$row{'colId'},
>> + $$row{'colTitle'},
>> + $$row{'colDesc'},
>> + $$row{'colBranchcode'}
>> + );
>> +
>> +}
>> +
>> +=item AddItemToCollection
>> + ( $success, $errorcode, $errormessage ) = AddItemToCollection( $colId, $itemnumber );
>> + Adds an item to a rotating collection.
>> +
>> + Input:
>> + $colId: Collection to add the item to.
>> + $itemnumber: Item to be added to the collection
>> + Output:
>> + $success: 1 if all database operations were successful, 0 otherwise
>> + $errorCode: Code for reason of failure, good for translating errors in templates
>> + $errorMessage: English description of error
>> +=cut
>> +sub AddItemToCollection {
>> + my ( $colId, $itemnumber ) = @_;
>> +
>> + ## Check for all neccessary parameters
>> + if ( ! $colId ) {
>> + return ( 0, 1, "No Collection Given" );
>> + }
>> + if ( ! $itemnumber ) {
>> + return ( 0, 2, "No Itemnumber Given" );
>> + }
>> +
>> + if ( isItemInThisCollection( $itemnumber, $colId ) ) {
>> + return ( 0, 2, "Item is already in the collection!" );
>> + } elsif ( isItemInAnyCollection( $itemnumber ) ) {
>> + return ( 0, 3, "Item is already in a different collection!" );
>> + }
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth;
>> + $sth = $dbh->prepare("INSERT INTO collections_tracking ( ctId, colId, itemnumber )
>> + VALUES ( NULL, ?, ? )");
>> + $sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() );
>> + $sth->finish;
>> +
>> + return 1;
>> +
>> +}
>> +
>> +=item RemoveItemFromCollection
>> + ( $success, $errorcode, $errormessage ) = RemoveItemFromCollection( $colId, $itemnumber );
>> + Removes an item to a collection
>> +
>> + Input:
>> + $colId: Collection to add the item to.
>> + $itemnumber: Item to be removed from collection
>> +
>> + Output:
>> + $success: 1 if all database operations were successful, 0 otherwise
>> + $errorCode: Code for reason of failure, good for translating errors in templates
>> + $errorMessage: English description of error
>> +=cut
>> +sub RemoveItemFromCollection {
>> + my ( $colId, $itemnumber ) = @_;
>> +
>> + ## Check for all neccessary parameters
>> + if ( ! $itemnumber ) {
>> + return ( 0, 2, "No Itemnumber Given" );
>> + }
>> +
>> + if ( ! isItemInThisCollection( $itemnumber, $colId ) ) {
>> + return ( 0, 2, "Item is not in the collection!" );
>> + }
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth;
>> + $sth = $dbh->prepare("DELETE FROM collections_tracking
>> + WHERE itemnumber = ?");
>> + $sth->execute( $itemnumber ) or return ( 0, 3, $sth->errstr() );
>> + $sth->finish;
>> +
>> + return 1;
>> +}
>> +
>> +=item TransferCollection
>> + ( $success, $errorcode, $errormessage ) = TransferCollection( $colId, $colBranchcode );
>> + Transfers a collection to another branch
>> +
>> + Input:
>> + $colId: id of the collection to be updated
>> + $colBranchcode: branch where collection is moving to
>> +
>> + Output:
>> + $success: 1 if all database operations were successful, 0 otherwise
>> + $errorCode: Code for reason of failure, good for translating errors in templates
>> + $errorMessage: English description of error
>> +=cut
>> +sub TransferCollection {
>> + my ( $colId, $colBranchcode ) = @_;
>> +
>> + ## Check for all neccessary parameters
>> + if ( ! $colId ) {
>> + return ( 0, 1, "No Id Given" );
>> + }
>> + if ( ! $colBranchcode ) {
>> + return ( 0, 2, "No Branchcode Given" );
>> + }
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth;
>> + $sth = $dbh->prepare("UPDATE collections
>> + SET
>> + colBranchcode = ?
>> + WHERE colId = ?");
>> + $sth->execute( $colBranchcode, $colId ) or return ( 0, 4, $sth->errstr() );
>> + $sth->finish;
>> +
>> + $sth = $dbh->prepare("SELECT barcode FROM items, collections_tracking
>> + WHERE items.itemnumber = collections_tracking.itemnumber
>> + AND collections_tracking.colId = ?");
>> + $sth->execute( $colId ) or return ( 0, 4, $sth->errstr );
>> + my @results;
>> + while ( my $item = $sth->fetchrow_hashref ) {
>> + my ( $dotransfer, $messages, $iteminformation ) = transferbook( $colBranchcode, $item->{'barcode'}, my $ignore_reserves = 1);
>> + }
>> +
>> +
>> +
>> + return 1;
>> +
>> +}
>> +
>> +=item getItemnumberByBarcode
>> + $itemnumber = getItemnumberByBarcode( $barcode );
>> +=cut
>> +sub getItemnumberByBarcode {
>> + my ( $barcode ) = @_;
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE barcode = ?");
>> + $sth->execute( $barcode ) or return( 0 );
>> +
>> + my $row = $sth->fetchrow_hashref;
>> +
>> + my $itemnumber = $$row{'itemnumber'};
>> + $sth->finish;
>> +
>> + return( $itemnumber );
>> +}
>> +
>> +=item isItemInThisCollection
>> +$inCollection = isItemInThisCollection( $itemnumber, $colId );
>> +=cut
>> +sub isItemInThisCollection {
>> + my ( $itemnumber, $colId ) = @_;
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth = $dbh->prepare("SELECT COUNT(*) as inCollection FROM collections_tracking WHERE itemnumber = ? AND colId = ?");
>> + $sth->execute( $itemnumber, $colId ) or return( 0 );
>> +
>> + my $row = $sth->fetchrow_hashref;
>> +
>> + return $$row{'inCollection'};
>> +}
>> +
>> +=item isItemInAnyCollection
>> +$inCollection = isItemInAnyCollection( $itemnumber );
>> +=cut
>> +sub isItemInAnyCollection {
>> + my ( $itemnumber ) = @_;
>> +
>> + my $dbh = C4::Context->dbh;
>> +
>> + my $sth = $dbh->prepare("SELECT itemnumber FROM collections_tracking WHERE itemnumber = ?");
>> + $sth->execute( $itemnumber ) or return( 0 );
>> +
>> + my $row = $sth->fetchrow_hashref;
>> +
>> + my $itemnumber = $$row{'itemnumber'};
>> + $sth->finish;
>> +
>> + if ( $itemnumber ) {
>> + return 1;
>> + } else {
>> + return 0;
>> + }
>> +}
>> +
>> +1;
>> +
>> +__END__
>> +
>> +=back
>> +
>> +=head1 AUTHOR
>> +
>> +Kyle Hall <kylemhall at gmail.com>
>> +
>> +=cut
>> diff --git a/circ/returns.pl b/circ/returns.pl
>> index 40eeed1..f4079ba 100755
>> --- a/circ/returns.pl
>> +++ b/circ/returns.pl
>> @@ -43,6 +43,7 @@ use C4::Items;
>> use C4::Members;
>> use C4::Branch; # GetBranches GetBranchName
>> use C4::Koha; # FIXME : is it still useful ?
>> +use C4::RotatingCollections;
>>
>> my $query = new CGI;
>>
>> diff --git a/installer/data/mysql/en/mandatory/userpermissions.sql b/installer/data/mysql/en/mandatory/userpermissions.sql
>> index a8c37d3..47079d7 100644
>> --- a/installer/data/mysql/en/mandatory/userpermissions.sql
>> +++ b/installer/data/mysql/en/mandatory/userpermissions.sql
>> @@ -31,6 +31,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
>> (13, 'batchmod', 'Perform batch modification of items'),
>> (13, 'batchdel', 'Perform batch deletion of items'),
>> (13, 'manage_csv_profiles', 'Manage CSV export profiles'),
>> + (13, 'rotating_collections', 'Manage rotating collections'),
>> (16, 'execute_reports', 'Execute SQL reports'),
>> (16, 'create_reports', 'Create SQL Reports')
>> ;
>> diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql
>> index d1b826e..4e1902d 100644
>> --- a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql
>> +++ b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql
>> @@ -28,7 +28,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES
>> (11, 'group_manage', 'Gérer les commandes et les bons de commande'),
>> (11, 'order_receive', 'Gérer les réceptions'),
>> (11, 'budget_add_del', 'Ajouter et supprimer les budgets (mais pas modifier)'),
>> - (13, 'manage_csv_profiles', 'Manage CSV export profiles'),
>> + (13, 'manage_csv_profiles', 'Gérer les profils d''export CSV'),
>> + (13, 'rotating_collections', 'Gérer les collections tournantes'),
>> (13, 'batch_mod', 'Modification Par lot des exemplaires'),
>> (13, 'batch_del', 'Suppression par lot des exemplaires')
>> ;
>> diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
>> index 1e9f947..4d38057 100755
>> --- a/installer/data/mysql/updatedatabase.pl
>> +++ b/installer/data/mysql/updatedatabase.pl
>> @@ -2269,6 +2269,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
>> SetVersion ($DBversion);
>> }
>>
>> +$DBversion = "3.01.00.014";
>> +if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
>> + $dbh->do("INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'calcFineOnReturn', '0', '', 'Turns on the feature to calculate fines at the time of return and/or renewal as an alternative to the nightly cronjob fines system.', 'YesNo' )");
>> + print "Upgrade to $DBversion done (add new syspref)\n";
>> + SetVersion ($DBversion);
>> +}
>> +
>> $DBversion = "3.01.00.016";
>> if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
>> $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Babeltheque',0,'Turn ON Babeltheque content - See babeltheque.com to subscribe to this service','','YesNo')");
>> @@ -3305,6 +3312,32 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
>> SetVersion ($DBversion);
>> }
>>
>> +$DBversion = "3.01.00.102";
>> +if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
>> + $dbh->do("
>> + CREATE TABLE `collections` (
>> + `colId` int(11) NOT NULL auto_increment,
>> + `colTitle` varchar(100) NOT NULL default '',
>> + `colDesc` text NOT NULL,
>> + `colBranchcode` varchar(4) default NULL COMMENT 'branchcode for branch where item should be held.',
>> + PRIMARY KEY (`colId`)
>> + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
>> + ");
>> +
>> + $dbh->do("
>> + CREATE TABLE `collections_tracking` (
>> + `ctId` int(11) NOT NULL auto_increment,
>> + `colId` int(11) NOT NULL default '0' COMMENT 'collections.colId',
>> + `itemnumber` int(11) NOT NULL default '0' COMMENT 'items.itemnumber',
>> + PRIMARY KEY (`ctId`)
>> + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
>> + ");
>> + $dbh->do("
>> + INSERT INTO permissions (module_bit, code, description)
>> + VALUES ( 13, 'rotating_collections', 'Manage Rotating collections')" );
>> + print "Upgrade to $DBversion done (added collection and collection_tracking tables for rotataing collection functionnality)\n";
>> + SetVersion ($DBversion);
>> +}
>>
>> =item DropAllForeignKeys($table)
>>
>> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tmpl
>> new file mode 100644
>> index 0000000..b951a44
>> --- /dev/null
>> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tmpl
>> @@ -0,0 +1,89 @@
>> +<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
>> +<title>Koha › Tools › Rotating Collections › Add/Remove Items</title>
>> +<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
>> +</head>
>> +<body>
>> +<!-- TMPL_INCLUDE NAME="header.inc" -->
>> +<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
>> +
>> +<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating Collections</a> › Add/Remove Items</div>
>> +
>> +<div id="doc3">
>> +<div id="bd">
>> + <div class="yui-gb">
>> +
>> + <h1>Rotating Collections: Add/Remove Items</h1>
>> +
>> + <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>
>> + <th><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 align="right" colspan="99"><input type="submit" value="Submit" /></td></tr>
>> + </table>
>> + </form>
>> + </div>
>> +
>> +
>> + <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>
>> +
>> + <div>
>> + <br/>
>> + <input type="button" value="Return to Rotating Collections Home" onclick="window.location.href='rotatingCollections.pl'">
>> + </div>
>> +
>> +</div>
>> +</div>
>> +<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
>> \ No newline at end of file
>> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tmpl
>> new file mode 100644
>> index 0000000..93055c7
>> --- /dev/null
>> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tmpl
>> @@ -0,0 +1,125 @@
>> +<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
>> +<title>Koha › Tools › Rotating Collections › Edit Collections</title>
>> +<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
>> +</head>
>> +<body>
>> +<!-- TMPL_INCLUDE NAME="header.inc" -->
>> +<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
>> +
>> +<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating Collections</a> › Edit Collections</div>
>> +
>> +<div id="doc3">
>> +<div id="bd">
>> + <div class="yui-gb">
>> + <h1>Rotating Collections: Edit Collections</h1>
>> +
>> +<!--
>> + <!-- TMPL_IF NAME="previousActionCreate" -->
>> + <!-- TMPL_IF NAME="createSuccess" -->
>> + <div>Collection '<!-- 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>
>> +
>> + <div>
>> + <br/>
>> + <input type="button" value="Return to Rotating Collections Home" onclick="window.location.href='rotatingCollections.pl'">
>> + </div>
>> +
>> +</div>
>> +</div>
>> +<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
>> \ No newline at end of file
>> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tmpl
>> new file mode 100644
>> index 0000000..999e914
>> --- /dev/null
>> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tmpl
>> @@ -0,0 +1,47 @@
>> +<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
>> +<title>Koha › Tools › Rotating Collections</title>
>> +<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
>> +</head>
>> +<body>
>> +<!-- TMPL_INCLUDE NAME="header.inc" -->
>> +<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
>> +
>> +<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Rotating Collections</div>
>> +
>> +<div id="doc3">
>> +<div id="bd">
>> + <div class="yui-gb">
>> +
>> + <h1>Rotating Collections</h1>
>> + <div>
>> + <!-- TMPL_IF NAME="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>
>> + <!-- 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/Remove Items</a></td>
>> + <td><a href="transferCollection.pl?colId=<!-- TMPL_VAR NAME="colId" -->">Transfer Collection</a></td>
>> + </tr>
>> + <!-- /TMPL_LOOP -->
>> + </table>
>> + <!-- TMPL_ELSE -->
>> + There are no Collections currently defined.
>> + <!-- /TMPL_IF -->
>> + </div>
>> +
>> + <div>
>> + <br/>
>> + <input type="button" value="Edit Collections" onclick="window.location.href='editCollections.pl'">
>> + </div>
>> +</div>
>> +</div>
>> +<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
>> \ No newline at end of file
>> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tmpl
>> new file mode 100644
>> index 0000000..56f29e8
>> --- /dev/null
>> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tmpl
>> @@ -0,0 +1,48 @@
>> +<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
>> +<title>Koha › Tools › Rotating Collections › Transfer Collection</title>
>> +<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
>> +</head>
>> +<body>
>> +<!-- TMPL_INCLUDE NAME="header.inc" -->
>> +<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
>> +
>> +<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › <a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating Collections</a> › Transfer Collection</div>
>> +<div id="doc3">
>> +<div id="bd">
>> + <div class="yui-gb">
>> + <h1>Rotating Collections: Transfer Collection</h1>
>> + <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>
>> + <br/>
>> + <input type="button" value="Return to Rotating Collections Home" onclick="window.location.href='rotatingCollections.pl'">
>> + </div>
>> +
>> +</div>
>> +</div>
>> +<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
>> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tmpl
>> index 090e172..4c61110 100644
>> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tmpl
>> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tmpl
>> @@ -50,6 +50,11 @@
>> <dd>Manage CSV export profiles</dd>
>> <!-- /TMPL_IF -->
>>
>> + <!-- TMPL_IF NAME="CAN_user_tools_rotating_collections" -->
>> + <dt><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating Collections</a></dt>
>> + <dd>Manage Rotating Collections</dd>
>> + <!-- /TMPL_IF -->
>> +
>> </dl>
>> </div>
>> <div class="yui-u">
>> diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl
>> deleted file mode 100644
>> index acfe598..0000000
>> --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl
>> +++ /dev/null
>> @@ -1,65 +0,0 @@
>> -<?xml version='1.0'?>
>> -<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>> - <xsl:template name="datafield">
>> - <xsl:param name="tag"/>
>> - <xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param>
>> - <xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param>
>> - <xsl:param name="subfields"/>
>> - <xsl:element name="datafield">
>> - <xsl:attribute name="tag">
>> - <xsl:value-of select="$tag"/>
>> - </xsl:attribute>
>> - <xsl:attribute name="ind1">
>> - <xsl:value-of select="$ind1"/>
>> - </xsl:attribute>
>> - <xsl:attribute name="ind2">
>> - <xsl:value-of select="$ind2"/>
>> - </xsl:attribute>
>> - <xsl:copy-of select="$subfields"/>
>> - </xsl:element>
>> - </xsl:template>
>> -
>> - <xsl:template name="subfieldSelect">
>> - <xsl:param name="codes"/>
>> - <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>
>> - <xsl:variable name="str">
>> - <xsl:for-each select="marc:subfield">
>> - <xsl:if test="contains($codes, @code)">
>> - <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>
>> - </xsl:if>
>> - </xsl:for-each>
>> - </xsl:variable>
>> - <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
>> - </xsl:template>
>> -
>> - <xsl:template name="buildSpaces">
>> - <xsl:param name="spaces"/>
>> - <xsl:param name="char"><xsl:text> </xsl:text></xsl:param>
>> - <xsl:if test="$spaces>0">
>> - <xsl:value-of select="$char"/>
>> - <xsl:call-template name="buildSpaces">
>> - <xsl:with-param name="spaces" select="$spaces - 1"/>
>> - <xsl:with-param name="char" select="$char"/>
>> - </xsl:call-template>
>> - </xsl:if>
>> - </xsl:template>
>> -
>> - <xsl:template name="chopPunctuation">
>> - <xsl:param name="chopString"/>
>> - <xsl:variable name="length" select="string-length($chopString)"/>
>> - <xsl:choose>
>> - <xsl:when test="$length=0"/>
>> - <xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">
>> - <xsl:call-template name="chopPunctuation">
>> - <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
>> - </xsl:call-template>
>> - </xsl:when>
>> - <xsl:when test="not($chopString)"/>
>> - <xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise>
>> - </xsl:choose>
>> - </xsl:template>
>> -</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
>> -<metaInformation>
>> -<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
>> -</metaInformation>
>> --->
>> \ No newline at end of file
>> diff --git a/kohaversion.pl b/kohaversion.pl
>> index 10e6238..bee2a05 100644
>> --- a/kohaversion.pl
>> +++ b/kohaversion.pl
>> @@ -10,7 +10,7 @@
>> use strict;
>>
>> sub kohaversion {
>> - our $VERSION = '3.01.00.101';
>> + our $VERSION = '3.01.00.102';
>> # version needs to be set this way
>> # so that it can be picked up by Makefile.PL
>> # during install
>> diff --git a/rotating_collections/addItems.pl b/rotating_collections/addItems.pl
>> new file mode 100755
>> index 0000000..9a37423
>> --- /dev/null
>> +++ b/rotating_collections/addItems.pl
>> @@ -0,0 +1,82 @@
>> +#!/usr/bin/perl
>> +use strict;
>> +require Exporter;
>> +
>> +use C4::Output;
>> +use C4::Auth;
>> +use C4::Context;
>> +use C4::RotatingCollections;
>> +
>> +use CGI;
>> +
>> +my $query = new CGI;
>> +my ($template, $loggedinuser, $cookie)
>> + = get_template_and_user({template_name => "rotating_collections/addItems.tmpl",
>> + query => $query,
>> + type => "intranet",
>> + authnotrequired => 1,
>> + 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;
>> diff --git a/rotating_collections/editCollections.pl b/rotating_collections/editCollections.pl
>> new file mode 100755
>> index 0000000..1dba296
>> --- /dev/null
>> +++ b/rotating_collections/editCollections.pl
>> @@ -0,0 +1,103 @@
>> +#!/usr/bin/perl
>> +
>> +use strict;
>> +require Exporter;
>> +
>> +use CGI;
>> +
>> +use C4::Output;
>> +use C4::Auth;
>> +use C4::Context;
>> +
>> +use C4::RotatingCollections;
>> +
>> +my $query = new CGI;
>> +my ($template, $loggedinuser, $cookie)
>> + = get_template_and_user({template_name => "rotating_collections/editCollections.tmpl",
>> + query => $query,
>> + type => "intranet",
>> + authnotrequired => 1,
>> + 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;
>> diff --git a/rotating_collections/rotatingCollections.pl b/rotating_collections/rotatingCollections.pl
>> new file mode 100755
>> index 0000000..7940ebf
>> --- /dev/null
>> +++ b/rotating_collections/rotatingCollections.pl
>> @@ -0,0 +1,34 @@
>> +#!/usr/bin/perl
>> +use strict;
>> +require Exporter;
>> +
>> +use CGI;
>> +
>> +use C4::Output;
>> +use C4::Auth;
>> +use C4::Context;
>> +use C4::RotatingCollections;
>> +
>> +my $query = new CGI;
>> +my ($template, $loggedinuser, $cookie)
>> + = get_template_and_user({template_name => "rotating_collections/rotatingCollections.tmpl",
>> + query => $query,
>> + type => "intranet",
>> + authnotrequired => 1,
>> + 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;
>> diff --git a/rotating_collections/transferCollection.pl b/rotating_collections/transferCollection.pl
>> new file mode 100755
>> index 0000000..6ca822c
>> --- /dev/null
>> +++ b/rotating_collections/transferCollection.pl
>> @@ -0,0 +1,66 @@
>> +#!/usr/bin/perl
>> +use strict;
>> +require Exporter;
>> +
>> +use C4::Output;
>> +use C4::Auth;
>> +use C4::Context;
>> +use C4::RotatingCollections;
>> +use C4::Branch;
>> +
>> +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 => "rotating_collections/transferCollection.tmpl",
>> + query => $query,
>> + type => "intranet",
>> + authnotrequired => 1,
>> + 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 => \@branchoptionloop
>> + );
>> +
>> +output_html_with_http_headers $query, $cookie, $template->output;
>> --
>> 1.6.4.3
>>
>>
>>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha.org
> http://lists.koha.org/mailman/listinfo/koha-patches
>
>
>
More information about the Koha-patches
mailing list