Fix for Bug 5715, Adding note about ReservesMaxPickUpDelay value
[koha.git] / rotating_collections / transferCollection.pl
1 #!/usr/bin/perl
2 use strict;
3 #use warnings; FIXME - Bug 2505
4 require Exporter;
5
6 use C4::Output;
7 use C4::Auth;
8 use C4::Context;
9 use C4::RotatingCollections;
10 use C4::Branch;
11
12 use CGI;
13
14 my $query = new CGI;
15
16 my $colId = $query->param('colId');
17 my $toBranch = $query->param('toBranch');
18
19 my ($template, $loggedinuser, $cookie)
20     = get_template_and_user({template_name => "rotating_collections/transferCollection.tmpl",
21                              query => $query,
22                              type => "intranet",
23                              authnotrequired => 1,
24                              flagsrequired => {parameters => 1},
25                              debug => 1,
26                              });
27
28 ## Transfer collection
29 my ( $success, $errorCode, $errorMessage );
30 if ( $toBranch ) {
31   ( $success, $errorCode, $errorMessage ) = TransferCollection( $colId, $toBranch );
32
33   if ( $success ) {
34     $template->param( transferSuccess => 1 );
35   } else {
36     $template->param( transferFailure => 1,
37                       errorCode => $errorCode,
38                       errorMessage => $errorMessage
39     );
40   }
41 }
42
43 ## Set up the toBranch select options
44 my $branches = GetBranches();
45 my @branchoptionloop;
46 foreach my $br (keys %$branches) {
47   my %branch;
48   $branch{code}=$br;
49   $branch{name}=$branches->{$br}->{'branchname'};
50   push (@branchoptionloop, \%branch);
51 }
52     
53 ## Get data about collection
54 my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );                                
55 $template->param(
56                 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
57                 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
58                 IntranetNav => C4::Context->preference("IntranetNav"),
59                                   
60                 colId => $colId,
61                 colTitle => $colTitle,
62                 colDesc => $colDesc,
63                 colBranchcode => $colBranchcode,
64                 branchoptionloop => \@branchoptionloop
65                 );
66                                                                                                 
67 output_html_with_http_headers $query, $cookie, $template->output;