3 #use warnings; FIXME - Bug 2505
9 use C4::RotatingCollections;
15 my ($template, $loggedinuser, $cookie)
16 = get_template_and_user({template_name => "rotating_collections/addItems.tmpl",
20 flagsrequired => {parameters => 1},
24 if ( $query->param('action') eq 'addItem' ) {
25 ## Add the given item to the collection
26 my $colId = $query->param('colId');
27 my $barcode = $query->param('barcode');
28 my $removeItem = $query->param('removeItem');
29 my $itemnumber = GetItemnumberFromBarcode( $barcode );
31 my ( $success, $errorCode, $errorMessage );
33 if ( ! $removeItem ) {
34 ( $success, $errorCode, $errorMessage ) = AddItemToCollection( $colId, $itemnumber );
37 previousActionAdd => 1,
38 addedBarcode => $barcode,
42 $template->param( addSuccess => 1 );
44 $template->param( addFailure => 1 );
45 $template->param( failureMessage => $errorMessage );
48 ## Remove the given item from the collection
49 ( $success, $errorCode, $errorMessage ) = RemoveItemFromCollection( $colId, $itemnumber );
52 previousActionRemove => 1,
53 removedBarcode => $barcode,
58 $template->param( removeSuccess => 1 );
60 $template->param( removeFailure => 1 );
61 $template->param( failureMessage => $errorMessage );
67 my ( $colId, $colTitle, $colDescription, $colBranchcode ) = GetCollection( $query->param('colId') );
68 my $collectionItems = GetItemsInCollection( $colId );
69 if ( $collectionItems ) {
70 $template->param( collectionItemsLoop => $collectionItems );
74 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
75 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
76 IntranetNav => C4::Context->preference("IntranetNav"),
79 colTitle => $colTitle,
80 colDescription => $colDescription,
81 colBranchcode => $colBranchcode,
84 output_html_with_http_headers $query, $cookie, $template->output;