Lines 26-32
use C4::Auth qw(check_cookie_auth);
Link Here
|
26 |
use CGI; |
26 |
use CGI; |
27 |
use JSON; |
27 |
use JSON; |
28 |
|
28 |
|
29 |
|
|
|
30 |
my $input = new CGI; |
29 |
my $input = new CGI; |
31 |
binmode STDOUT, ":encoding(UTF-8)"; |
30 |
binmode STDOUT, ":encoding(UTF-8)"; |
32 |
print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); |
31 |
print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); |
Lines 40-69
if ( $auth_status ne "ok" ) {
Link Here
|
40 |
} |
39 |
} |
41 |
|
40 |
|
42 |
|
41 |
|
43 |
my $content; |
42 |
my $resource_id = $input->param("resource_id"); |
44 |
$content->{resource_id} = $input->param("resource_id"); |
43 |
my $resource_type = $input->param("resource"); |
45 |
$content->{resource_type} = $input->param("resource"); |
44 |
my $comment = $input->param("message"); |
46 |
$content->{message} = $input->param("message"); |
45 |
my $result = Koha::SharedContent::comment_entity($resource_id, $resource_type, $comment); |
47 |
Koha::SharedContent::send_entity('', undef, undef, 'resource_comment', $content); |
|
|
48 |
my $package = "Koha::".ucfirst($input->param('resource')); |
49 |
my $resource; |
50 |
my $result; |
51 |
eval{ |
52 |
$result = Koha::SharedContent::get_entity_by_id( |
53 |
scalar $input->param('resource'), |
54 |
scalar $input->param('id') |
55 |
); |
56 |
}; |
57 |
if ( $@ or $result->{code} == 500 ){ |
58 |
$resource->{errmsg} = "Error: mana access got broken, please try again later\n\n ( error: $@ )"; |
59 |
} |
60 |
else{ |
61 |
if ( $input->param( 'saveinbase' )) { |
62 |
$resource = { id => $package->new_from_mana($result->{data})->id }; |
63 |
} |
64 |
else{ |
65 |
$resource = $result->{data}; |
66 |
} |
67 |
} |
68 |
|
46 |
|
69 |
print(to_json($resource)); |
47 |
print(to_json($result)); |