@@ -, +, @@
---
C4/Circulation.pm | 2 +-
C4/RotatingCollections.pm | 37 ++--
installer/data/mysql/updatedatabase.pl | 8 +-
.../intranet-tmpl/prog/en/includes/tools-menu.inc | 2 -
.../en/modules/rotating_collections/addItems.tt | 164 +++++++++-------
.../rotating_collections/editCollections.tt | 209 ++++++++++----------
.../rotating_collections/rotatingCollections.tt | 81 +++++----
.../rotating_collections/transferCollection.tt | 78 ++++----
rotating_collections/addItems.pl | 4 +-
rotating_collections/editCollections.pl | 18 +-
10 files changed, 315 insertions(+), 288 deletions(-)
--- a/C4/Circulation.pm
+++ a/C4/Circulation.pm
@@ -1899,7 +1899,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(
--- a/C4/RotatingCollections.pm
+++ a/C4/RotatingCollections.pm
@@ -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;
--- a/installer/data/mysql/updatedatabase.pl
+++ a/installer/data/mysql/updatedatabase.pl
@@ -9017,13 +9017,9 @@ 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";
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc
@@ -66,11 +66,9 @@
Label creator
Quick spine label creator
[% END %]
-
[% IF ( CAN_user_tools_marc_modification_templates ) %]
Manage MARC modification templates
[% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt
@@ -15,83 +15,107 @@
-
-
-
+
+
+
+ [% INCLUDE 'tools-menu.inc' %]
+
-
Rotating collections: Add/Remove items
+
+
-
-
- [% IF ( previousActionAdd ) %]
- [% IF ( addSuccess ) %]
-
Item with barcode '[% addedBarcode %]' Added successfully!
- [% ELSE %]
-
Failed to add item with barcode '[% addedBarcode %]'!
-
Reason: [% failureMessage %]
- [% END %]
- [% END %]
+
Rotating collections: Add/Remove items
- [% IF ( previousActionRemove ) %]
- [% IF ( removeSuccess ) %]
-
Item with barcode '[% addedBarcode %]' Removed successfully!
- [% ELSE %]
-
Failed to remove item with barcode '[% removedBarcode %]'!
-
Reason: [% failureMessage %]
- [% END %]
- [% END %]
+
+
+ [% IF ( previousActionAdd ) %]
+ [% IF ( addSuccess ) %]
+
Item with barcode '[% barcode %]' added successfully!
+ [% ELSE %]
+
+
Failed to add item with barcode [% barcode %]:
+
+ [% 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 %]
+
+
+ [% END %]
+ [% END %]
-
Add item to [% colTitle %]
-
+ [% IF ( previousActionRemove ) %]
+ [% IF ( removeSuccess ) %]
+
Item with barcode [% barcode %] removed successfully!
+ [% ELSE %]
+
+ Failed to remove item with barcode
[% barcode %]:
+
+ [% IF failureMessage == "NO_ITEM" %]
+ No item with matching barcode found!
+ [% ELSE %]
+ [% failureMessage %]
+ [% END %]
+
+
+ [% END %]
+ [% END %]
-
+
-
-
-
-
+
+
Items in this collection
+ [% IF ( collectionItemsLoop ) %]
+
+
+ Title |
+ Call number |
+ Barcode |
+
+ [% FOREACH collectionItemsLoo IN collectionItemsLoop %]
+
+ [% collectionItemsLoo.title |html %] |
+ [% collectionItemsLoo.itemcallnumber %] |
+ [% collectionItemsLoo.barcode %] |
+
+ [% END %]
+
+ [% ELSE %]
+ There are no items in this collection.
+ [% END %]
+
-
-
-[% INCLUDE 'intranet-bottom.inc' %]
+
+
+
+
+
+
+
+
+[% INCLUDE 'intranet-bottom.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt
@@ -8,125 +8,118 @@
-
-
-
-
Rotating collections: Edit collections
+
+
+
+ [% INCLUDE 'tools-menu.inc' %]
+
-
+ [% IF ( previousActionCreate ) %]
+ [% IF ( createSuccess ) %]
+
Collection [% createdTitle %] created successfully!
+ [% ELSE %]
+
+
Collection [% createdTitle %] failed to be created!
+
+ [% IF failureMessage == "NO_TITLE" %]
+ No title entered.
+ [% ELSIF failureMessage == "NO_DESCRIPTION" %]
+ No description entered.
+ [% ELSE %]
+ [% failureMessage %]
+ [% END %]
+
+
+ [% END %]
+ [% END %]
+
+ [% IF ( previousActionDelete ) %]
+ [% IF ( deleteSuccess ) %]
+
Collection deleted successfully!
+ [% ELSE %]
+
Collection failed to be deleted!
+ [% END %]
+ [% END %]
- [% IF ( previousActionUpdate ) %]
- [% IF ( updateSuccess ) %]
-
Collection '[% updatedTitle %]' Updated successfully!
- [% ELSE %]
-
Collection '[% updatedTitle %]' Failed to be updated!
-
Reason: [% failureMessage %]
- [% END %]
- [% END %]
+ [% IF ( previousActionUpdate ) %]
+ [% IF ( updateSuccess ) %]
+
Collection [% updatedTitle %] updated successfully!
+ [% ELSE %]
+
+
Collection [% updatedTitle %] failed to be updated!
+
+ [% IF failureMessage == "NO_ID" %]
+ No collection id given.
+ [% ELSE %]
+ [% failureMessage %]
+ [% END %]
+
+
+ [% END %]
+ [% END %]
-
- [% IF ( collectionsLoop ) %]
-
-
-
- Title |
- Description |
- Holding library |
- |
- |
-
-
-
- [% FOREACH collectionsLoo IN collectionsLoop %]
-
- [% collectionsLoo.colTitle %] |
- [% collectionsLoo.colDesc %] |
- [% collectionsLoo.colBranchcode %] |
- Edit |
- Delete |
-
- [% END %]
-
-
- [% ELSE %]
- There are no collections currently defined.
- [% END %]
-
+
+
-
-
+ [% IF action == "new" || action == "edit" %]
+ [% IF ( previousActionEdit ) %]
+
Edit collection [% editColTitle %]
+ [% ELSE %]
+
Create new collection
+ [% END %]
- [% IF ( previousActionEdit ) %]
-
Edit Collection
- [% ELSE %]
-
Create new collection
- [% END %]
+
-
+
-
-
-
-
+
+ Return to rotating collections home
+
-
-
+
+
+
[% INCLUDE 'intranet-bottom.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/rotatingCollections.tt
@@ -1,3 +1,4 @@
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
Koha › Tools › Rotating collections
[% INCLUDE 'doc-head-close.inc' %]
@@ -8,40 +9,50 @@
-
-
-
+
+
+
+ [% INCLUDE 'tools-menu.inc' %]
+
-
Rotating collections
-
- [% IF ( collectionsLoop ) %]
-
-
- Title |
- Description |
- Current location |
- Add/Remove items |
- Transfer collection |
-
- [% FOREACH collectionsLoo IN collectionsLoop %]
-
- [% collectionsLoo.colTitle %] |
- [% collectionsLoo.colDesc %] |
- [% collectionsLoo.colBranchcode %] |
- Add/Remove Items |
- Transfer Collection |
-
- [% END %]
-
- [% ELSE %]
- There are no collections currently defined.
- [% END %]
-
+
-[% INCLUDE 'intranet-bottom.inc' %]
+
Rotating collections
+
+ [% IF ( collectionsLoop ) %]
+
+
+ Title |
+ Description |
+ Current location |
+ |
+ |
+ |
+ |
+
+
+ [% FOREACH collectionsLoo IN collectionsLoop %]
+
+ [% collectionsLoo.colTitle %] |
+ [% collectionsLoo.colDesc %] |
+ [% Branches.GetName( collectionsLoo.colBranchcode ) %] |
+ Add/remove items |
+ Transfer |
+ Edit |
+ Delete |
+
+ [% END %]
+
+ [% ELSE %]
+ There are no collections currently defined.
+ [% END %]
+
+
+
+ Create collection
+
+
+
+
+[% INCLUDE 'intranet-bottom.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/transferCollection.tt
@@ -7,42 +7,50 @@
[% INCLUDE 'cat-search.inc' %]
-
-
-
-
Rotating collections: Transfer collection
-
- [% IF ( transferSuccess ) %]
-
Collection transferred successfully
- [% END %]
-
- [% IF ( transferFailure ) %]
-
Failed to transfer collection!
-
Reason: [% errorMessage %]
- [% END %]
-
- [% IF ( transferSuccess ) %]
- [% ELSE %]
-
-
+
+
+
+
+ [% INCLUDE 'tools-menu.inc' %]
- [% END %]
-
-
-
-
+
+
+
Rotating collections: Transfer collection
+
+ [% IF ( transferSuccess ) %]
+
Collection transferred successfully
+ [% ELSIF ( transferFailure ) %]
+
Failed to transfer collection!
+ [% END %]
+
+ [% IF ( transferSuccess ) %]
+ [% ELSE %]
+
+
-
+
+
+
+ [% END %]
+
+
+ Return to rotating collections home
+
+
+
+
+
[% INCLUDE 'intranet-bottom.inc' %]
--- a/rotating_collections/addItems.pl
+++ a/rotating_collections/addItems.pl
@@ -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,
);
--- a/rotating_collections/editCollections.pl
+++ a/rotating_collections/editCollections.pl
@@ -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;
--