Lines 21-28
use Modern::Perl;
Link Here
|
21 |
use C4::Output; |
21 |
use C4::Output; |
22 |
use C4::Auth; |
22 |
use C4::Auth; |
23 |
use C4::Context; |
23 |
use C4::Context; |
24 |
use C4::RotatingCollections; |
|
|
25 |
|
24 |
|
|
|
25 |
use Koha::Libraries; |
26 |
use Koha::RotatingCollections; |
26 |
use Koha::RotatingCollections; |
27 |
|
27 |
|
28 |
use CGI qw ( -utf8 ); |
28 |
use CGI qw ( -utf8 ); |
Lines 32-37
my $query = new CGI;
Link Here
|
32 |
my $colId = $query->param('colId'); |
32 |
my $colId = $query->param('colId'); |
33 |
my $toBranch = $query->param('toBranch'); |
33 |
my $toBranch = $query->param('toBranch'); |
34 |
|
34 |
|
|
|
35 |
my $collection = Koha::RotatingCollections->find( $colId ); |
36 |
|
35 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
37 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
36 |
{ |
38 |
{ |
37 |
template_name => "rotating_collections/transferCollection.tt", |
39 |
template_name => "rotating_collections/transferCollection.tt", |
Lines 44-74
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
44 |
); |
46 |
); |
45 |
|
47 |
|
46 |
## Transfer collection |
48 |
## Transfer collection |
47 |
my ( $success, $errorCode, $errorMessage ); |
|
|
48 |
if ($toBranch) { |
49 |
if ($toBranch) { |
49 |
( $success, $errorCode, $errorMessage ) = |
50 |
my $branch = Koha::Libraries->find( $toBranch ); |
50 |
TransferCollection( $colId, $toBranch ); |
51 |
|
|
|
52 |
my $transferred = eval ( $collection->transfer( $branch ) ); |
51 |
|
53 |
|
52 |
if ($success) { |
54 |
if ( $@ and not $transferred ) { |
|
|
55 |
$template->param( transferFailure => 1 ); |
56 |
} else { |
53 |
$template->param( transferSuccess => 1 ); |
57 |
$template->param( transferSuccess => 1 ); |
54 |
} |
58 |
} |
55 |
else { |
|
|
56 |
$template->param( |
57 |
transferFailure => 1, |
58 |
errorCode => $errorCode, |
59 |
errorMessage => $errorMessage |
60 |
); |
61 |
} |
62 |
} |
59 |
} |
63 |
|
60 |
|
64 |
## Get data about collection |
|
|
65 |
my $collection = Koha::RotatingCollections->find($colId); |
66 |
|
67 |
$template->param( |
61 |
$template->param( |
68 |
colId => $collection->colId, |
62 |
collection => $collection, |
69 |
colTitle => $collection->colTitle, |
|
|
70 |
colDesc => $collection->colDesc, |
71 |
colBranchcode => $collection->colBranchcode, |
72 |
); |
63 |
); |
73 |
|
64 |
|
74 |
output_html_with_http_headers $query, $cookie, $template->output; |
65 |
output_html_with_http_headers $query, $cookie, $template->output; |
75 |
- |
|
|