3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
20 #use warnings; FIXME - Bug 2505
26 use C4
::RotatingCollections
;
32 my ($template, $loggedinuser, $cookie)
33 = get_template_and_user
({template_name
=> "rotating_collections/addItems.tt",
37 flagsrequired
=> { tools
=> 'rotating_collections' },
41 if ( $query->param('action') eq 'addItem' ) {
42 ## Add the given item to the collection
43 my $colId = $query->param('colId');
44 my $barcode = $query->param('barcode');
45 my $removeItem = $query->param('removeItem');
46 my $itemnumber = GetItemnumberFromBarcode
( $barcode );
48 my ( $success, $errorCode, $errorMessage );
50 if ( ! $removeItem ) {
51 ( $success, $errorCode, $errorMessage ) = AddItemToCollection
( $colId, $itemnumber );
54 previousActionAdd
=> 1,
55 addedBarcode
=> $barcode,
59 $template->param( addSuccess
=> 1 );
61 $template->param( addFailure
=> 1 );
62 $template->param( failureMessage
=> $errorMessage );
65 ## Remove the given item from the collection
66 ( $success, $errorCode, $errorMessage ) = RemoveItemFromCollection
( $colId, $itemnumber );
69 previousActionRemove
=> 1,
70 removedBarcode
=> $barcode,
75 $template->param( removeSuccess
=> 1 );
77 $template->param( removeFailure
=> 1 );
78 $template->param( failureMessage
=> $errorMessage );
84 my ( $colId, $colTitle, $colDescription, $colBranchcode ) = GetCollection
( $query->param('colId') );
85 my $collectionItems = GetItemsInCollection
( $colId );
86 if ( $collectionItems ) {
87 $template->param( collectionItemsLoop
=> $collectionItems );
91 intranetcolorstylesheet
=> C4
::Context
->preference("intranetcolorstylesheet"),
92 intranetstylesheet
=> C4
::Context
->preference("intranetstylesheet"),
93 IntranetNav
=> C4
::Context
->preference("IntranetNav"),
96 colTitle
=> $colTitle,
97 colDescription
=> $colDescription,
98 colBranchcode
=> $colBranchcode,
101 output_html_with_http_headers
$query, $cookie, $template->output;