View | Details | Raw Unified | Return to bug 17047
Collapse All | Expand All

(-)a/Koha/SharedContent.pm (-15 / +27 lines)
Lines 24-46 use LWP::UserAgent; Link Here
24
24
25
use Koha::Serials;
25
use Koha::Serials;
26
use Koha::Reports;
26
use Koha::Reports;
27
use C4::Context;
27
28
28
our $MANA_IP = C4::Context->config('mana_config');
29
our $MANA_IP = C4::Context->config('mana_config');
29
30
30
sub manaRequest {
31
sub manaRequest {
31
    my $mana_request = shift;
32
    my $mana_request = shift;
32
    my $result;
33
    my $result;
33
34
    $mana_request->content_type('application/json');
34
    $mana_request->content_type('application/json');
35
    my $userAgent = LWP::UserAgent->new;
35
    my $userAgent = LWP::UserAgent->new;
36
    if ( $mana_request->method eq "POST" ){
37
        my $content;
38
        if ($mana_request->content) {$content = from_json( $mana_request->content )};
39
        $content->{securitytoken} = C4::Context->preference("ManaToken");
40
        $mana_request->content( to_json($content) );
41
    }
42
36
    my $response  = $userAgent->request($mana_request);
43
    my $response  = $userAgent->request($mana_request);
37
44
38
    if ( $response->code ne "204" ) {
45
    eval { $result = from_json( $response->decoded_content ); };
39
        $result = from_json( $response->decoded_content );
40
    }
41
    $result->{code} = $response->code;
46
    $result->{code} = $response->code;
42
47
    if ( $@ ){
43
    return $result if ( $response->code =~ /^2..$/ );
48
        $result->{msg} = $response->{_msg};
49
    }
50
    if ($response->is_error){
51
        $result->{msg} = "An error occurred, mana server returned: ".$result->{msg};
52
    }
53
    return $result ;
44
}
54
}
45
55
46
sub manaIncrementRequest {
56
sub manaIncrementRequest {
Lines 71-77 sub manaPostRequest { Link Here
71
    $content->{bulk_import} = 0;
81
    $content->{bulk_import} = 0;
72
    my $json = to_json( $content, { utf8 => 1 } );
82
    my $json = to_json( $content, { utf8 => 1 } );
73
    $request->content($json);
83
    $request->content($json);
74
75
    return manaRequest($request);
84
    return manaRequest($request);
76
}
85
}
77
86
Lines 88-100 sub manaShareInfos{ Link Here
88
    my $mana_email;
97
    my $mana_email;
89
    if ( $loggedinuser ne 0 ) {
98
    if ( $loggedinuser ne 0 ) {
90
        my $borrower = Koha::Patrons->find($loggedinuser);
99
        my $borrower = Koha::Patrons->find($loggedinuser);
91
        $mana_email = $borrower->email
100
        if ($borrower){
92
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
101
            $mana_email = $borrower->email
93
        $mana_email = $borrower->emailpro
102
              if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
94
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
103
            $mana_email = $borrower->emailpro
95
        $mana_email =
104
              if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
96
          Koha::Libraries->find( C4::Context->userenv->{'branch'} )->branchemail
105
            $mana_email =
97
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
106
              Koha::Libraries->find( C4::Context->userenv->{'branch'} )->branchemail
107
              if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
108
        }
98
    }
109
    }
99
    $mana_email = C4::Context->preference('KohaAdminEmailAddress')
110
    $mana_email = C4::Context->preference('KohaAdminEmailAddress')
100
      if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
111
      if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
Lines 114-121 sub manaShareInfos{ Link Here
114
125
115
    my $result = Koha::SharedContent::manaPostRequest( $ressourcetype,
126
    my $result = Koha::SharedContent::manaPostRequest( $ressourcetype,
116
        $ressource_mana_info );
127
        $ressource_mana_info );
128
117
    if ( $result and ($result->{code} eq "200" or $result->{code} eq "201") ) {
129
    if ( $result and ($result->{code} eq "200" or $result->{code} eq "201") ) {
118
        $ressource->set( { mana_id => $result->{id} } )->store;
130
       eval { $ressource->set( { mana_id => $result->{id} } )->store };
119
    }
131
    }
120
    return $result;
132
    return $result;
121
}
133
}
(-)a/installer/data/mysql/atomicupdate/mana_04-add_mana_token.sql (+2 lines)
Line 0 Link Here
1
INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
2
('ManaToken','',NULL,'Security token used for authentication on Mana KB service (anti spam)','Textarea');
(-)a/koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js (+20 lines)
Line 0 Link Here
1
$(document).ready(function(){
2
    $("#activatemana").on("click", function(){
3
        var mylastname = $("#lastname").val()
4
        var myfirstname = $("#firstname").val()
5
        var myemail = $("#email").val()
6
        $.ajax( {
7
            type: "POST",
8
            url: "/cgi-bin/koha/svc/mana/getToken",
9
            data: { lastname: mylastname, firstname: myfirstname, email: myemail},
10
            dataType: "json",
11
        })
12
        .done(function(result){
13
            console.log(result.token);
14
                $("#pref_ManaToken").val(result.token);
15
                $("#pref_ManaToken").trigger("input");
16
        }).fail( function( result ){
17
        });
18
        return false;
19
    });
20
});
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc (-44 / +46 lines)
Lines 3-34 Link Here
3
[% USE AuthorisedValues %]
3
[% USE AuthorisedValues %]
4
[% USE Branches %]
4
[% USE Branches %]
5
5
6
<table id="mana_results_datatable" width=100%>
6
[% IF statuscode == "200" AND reports %]
7
    <thead>
7
    <table id="mana_results_datatable" width=100%>
8
        <tr>
8
        <thead>
9
            <th>Report Name</th>
9
            <tr>
10
            <th class="anti-the" width=35%>Notes</th>
10
                <th>Report Name</th>
11
            <th>Type</th>
11
                <th class="anti-the" width=35%>Notes</th>
12
            <th title="number of libraries using this pattern"># of users</th>
12
                <th>Type</th>
13
            <th class="title-string" title="last time a library used this pattern">Last import</th>
13
                <th title="number of libraries using this pattern"># of users</th>
14
            <th> Comments </th>
14
                <th class="title-string" title="last time a library used this pattern">Last import</th>
15
            [% UNLESS search_only %]
15
                <th> Comments </th>
16
              <th class="NoSort">Actions</th>
16
                [% UNLESS search_only %]
17
            [% END %]
17
                  <th class="NoSort">Actions</th>
18
        </tr>
18
                [% END %]
19
    </thead>
19
            </tr>
20
    <tbody>
20
        </thead>
21
        [% FOREACH report IN reports %]
21
        <tbody>
22
            [% UNLESS report.cannotdisplay %]
22
            [% FOREACH report IN reports %]
23
                <tr id="row[% report.id %]"
23
                [% UNLESS report.cannotdisplay %]
24
                     [% IF report.nbofcomment > highWarned  %]
24
                    [% IF report.nbofcomment > highWarned %]
25
                        class = "high-warned-row"
25
                  <tr id="row[% report.id %]" class = "high-warned-row">
26
                     [% ELSIF report.nbofcomment > warned  %]
26
                    [% ELSIF report.nbofcomment > warned %]
27
                        class = "warned-row"
27
                  <tr id="row[% report.id %]" class = "warned-row">
28
                     [% ELSIF report.nbofcomment > lowWarned  %]
28
                    [% ELSIF report.nbofcomment > lowWarned %]
29
                        class = "highlighted-row"
29
                  <tr id="row[% report.id %]" class = "highlighted-row">
30
                     [% END %]
30
                    [% END %]
31
                >
32
                    <input hidden class="rowid" value="[% report.id %]">
31
                    <input hidden class="rowid" value="[% report.id %]">
33
                    <td>[% IF ( report.report_name ) %][% report.report_name %][% END %]</td>
32
                    <td>[% IF ( report.report_name ) %][% report.report_name %][% END %]</td>
34
                    <td title="[% report.savedsql %]"><div>
33
                    <td title="[% report.savedsql %]"><div>
Lines 37-68 Link Here
37
                        [% END %]
36
                        [% END %]
38
                            [% report.notes %]
37
                            [% report.notes %]
39
                        [% IF report.notes.length > 200 %]
38
                        [% IF report.notes.length > 200 %]
40
                            <a class="hidebutton">Show Less</a></div> </td>
39
                                <a class="hidebutton">Show Less</a></div> </td>
41
                        [% END %]
40
                        [% END %]
42
                    <td> [% report.type %] </td>
41
                    <td> [% report.type %] </td>
43
                    <td>[% IF ( report.nbofusers ) %][% report.nbofusers %][% END %]</td>
42
                    <td>[% IF ( report.nbofusers ) %][% report.nbofusers %][% END %]</td>
44
                    <td><span title="[% report.lastimport %]">[% report.lastimport | $KohaDates %]</span></td>
43
                    <td><span title="[% report.lastimport %]">[% report.lastimport | $KohaDates %]</span></td>
45
		    <td>[% FOREACH comment IN report.comments %][% comment.message %] ([% comment.nb %]) <br>[% END %]</td>
44
                    <td>[% FOREACH comment IN report.comments %][% comment.message %] ([% comment.nb %]) <br>[% END %]</td>
46
45
47
                    [% UNLESS search_only %]
46
                    [% UNLESS search_only %]
48
                      <td>
47
                        <td>
49
                          <button onclick="mana_use([% report.id %])"> <i class="fa fa-inbox"></i> Use</button>
48
                            <button onclick="mana_use([% report.id %])"> <i class="fa fa-inbox"></i> Use</button>
50
                          <input hidden type="text" id="selectedcomment">
49
                            <input hidden type="text" id="selectedcomment">
51
                          <select>
50
                            <select>
52
                              <option selected disabled>Report mistake</option>
51
                                <option selected disabled>Report mistake</option>
53
                              [% FOREACH comment IN report.comments %]
52
                                [% FOREACH comment IN report.comments %]
54
                                  <option class="actionreport1" value="[% comment.id %]" onclick="mana_increment('[% comment.id %]', 'resource_comment', 'nb')"> [% comment.message %] ([% comment.nb %])
53
                                    <option class="actionreport1" value="[% comment.id %]" onclick="mana_increment('[% comment.id %]', 'resource_comment', 'nb')"> [% comment.message %] ([% comment.nb %])
55
                              [% END %]
54
                                [% END %]
56
                                  <option data-toggle="modal" onclick="($('#selected_id').val($('.rowid').val()))" data-target="#comment_box"> other
55
                                    <option data-toggle="modal" onclick="($('#selected_id').val($('.rowid').val()))" data-target="#comment_box"> other
57
                          </select>
56
                            </select>
58
                          <button hidden class="actionreport2" hidden> Cancel</button>
57
                            <button hidden class="actionreport2" hidden> Cancel</button>
59
                      </td>
58
                        </td>
60
                    [% END %]
59
                    [% END %]
61
                </tr>
60
                  </tr>
61
                [% END %]
62
            [% END %]
62
            [% END %]
63
        [% END %]
63
        </tbody>
64
    </tbody>
64
    </table>
65
</table>
65
[% ELSE %]
66
    <h4> [% msg %]  statuscode: [% statuscode %]</h4>
67
[% END %]
66
68
67
<div id="comment_box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
69
<div id="comment_box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
68
    <div class="modal-dialog modal-lg" style="width: 30%">
70
    <div class="modal-dialog modal-lg" style="width: 30%">
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc (-55 / +57 lines)
Lines 5-67 Link Here
5
5
6
6
7
7
8
<table id="mana_results_datatable" width=100%>
8
[% IF statuscode == "200" %]
9
    <thead>
9
    <table id="mana_results_datatable" width=100%>
10
        <tr>
10
        <thead>
11
            <th>ISSN</th>
11
            <tr>
12
            <th class="anti-the" width=50%>Title</th>
12
                <th>ISSN</th>
13
            <th> Published by </th>
13
                <th class="anti-the" width=50%>Title</th>
14
            <th>Frequency</th>
14
                <th> Published by </th>
15
            <th>Numbering pattern</th>
15
                <th>Frequency</th>
16
            <th title="number of libraries using this pattern"># of users</th>
16
                <th>Numbering pattern</th>
17
            <th class="title-string" title="last time a library used this pattern">Last import</th>
17
                <th title="number of libraries using this pattern"># of users</th>
18
            <th> Comments </th>
18
                <th class="title-string" title="last time a library used this pattern">Last import</th>
19
            [% UNLESS search_only %]
19
                <th> Comments </th>
20
              <th class="NoSort">Actions</th>
20
                [% UNLESS search_only %]
21
            [% END %]
21
                  <th class="NoSort">Actions</th>
22
        </tr>
22
                [% END %]
23
    </thead>
23
            </tr>
24
    <tbody>
24
        </thead>
25
        [% FOREACH subscription IN subscriptions %]
25
        <tbody>
26
            [% UNLESS subscription.cannotdisplay %]
26
            [% FOREACH subscription IN subscriptions %]
27
                <tr id="row[% subscription.subscriptionid %]"
27
                [% UNLESS subscription.cannotdisplay %]
28
                     [% IF subscription.nbofcomment > highWarned  %]
28
                    [% IF subscription.nbofcomment > highWarned  %]
29
                        class = "high-warned-row" title="this resource has been reported more than [% highWarned %] times, take care!"
29
                    <tr id="row[% subscription.subscriptionid %]" class = "high-warned-row" title="this resource has been reported more than [% highWarned %] times, take care!">
30
                     [% ELSIF subscription.nbofcomment > warned  %]
30
                    [% ELSIF subscription.nbofcomment > warned  %]
31
                        class = "warned-row" title="this resource has been reported more than [% warned %] times, take care!"
31
                    <tr id="row[% subscription.subscriptionid %]" class = "warned-row" title="this resource has been reported more than [% warned %] times, take care!">
32
                     [% ELSIF subscription.nbofcomment > lowWarned  %]
32
                    [% ELSIF subscription.nbofcomment > lowWarned  %]
33
                        class = "highlighted-row" title="this resource has been reported more than [% lowWarned %] times, take care!"
33
                    <tr id="row[% subscription.subscriptionid %]" class = "highlighted-row" title="this resource has been reported more than [% lowWarned %] times, take care!">
34
                     [% END %]
35
                >
36
                <input hidden class="rowid" value="[% subscription.id %]">
37
                    <td>[% IF ( subscription.issn ) %][% subscription.issn %][% END %]</td>
38
                    <td>[% subscription.title %]</a></td>
39
                    <td>[% IF ( subscription.publishercode ) %][% subscription.publishercode %][% END %]</td>
40
                    <td>[% IF ( subscription.sfdescription ) %][% subscription.sfdescription %][% END %]</td>
41
                    <td>[% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod %][% END %]</td>
42
                    <td>[% IF ( subscription.nbofusers ) %][% subscription.nbofusers %][% END %]</td>
43
                    <td><span title="[% subscription.lastimport %]">[% subscription.lastimport | $KohaDates %]</span></td>
44
		    <td>[% FOREACH comment IN subscription.comments %][% comment.message %] ([% comment.nb %]) <br>[% END %]</td>
45
46
                    [% UNLESS search_only %]
47
                      <td>
48
                          <button onclick="mana_use([% subscription.id %])"> <i class="fa fa-inbox"></i> Use</button>
49
                          <input hidden type="text" id="selectedcomment">
50
                          <select>
51
                              <option selected disabled>Report mistake</option>
52
                              [% FOREACH comment IN subscription.comments %]
53
                                  <option class="actionreport1" value="[% comment.id %]" onclick="mana_increment('[% comment.id %]', 'resource_comment', 'nb')"> [% comment.message %] ([% comment.nb %])
54
                              [% END %]
55
                                  <option data-toggle="modal" onclick="($('#selected_id').val($('.rowid').val()))" data-target="#comment_box"> other
56
                          </select>
57
                          <button hidden class="actionreport2" hidden> Cancel</button>
58
                      </td>
59
                    [% END %]
34
                    [% END %]
60
                </tr>
35
                    <input hidden class="rowid" value="[% subscription.id %]">
36
                        <td>[% IF ( subscription.issn ) %][% subscription.issn %][% END %]</td>
37
                        <td>[% subscription.title %]</a></td>
38
                        <td>[% IF ( subscription.publishercode ) %][% subscription.publishercode %][% END %]</td>
39
                        <td>[% IF ( subscription.sfdescription ) %][% subscription.sfdescription %][% END %]</td>
40
                        <td>[% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod %][% END %]</td>
41
                        <td>[% IF ( subscription.nbofusers ) %][% subscription.nbofusers %][% END %]</td>
42
                        <td><span title="[% subscription.lastimport %]">[% subscription.lastimport | $KohaDates %]</span></td>
43
                        <td>[% FOREACH comment IN subscription.comments %][% comment.message %] ([% comment.nb %]) <br>[% END %]</td>
44
45
                        [% UNLESS search_only %]
46
                            <td>
47
                                <button onclick="mana_use([% subscription.id %])"> <i class="fa fa-inbox"></i> Use</button>
48
                                <input hidden type="text" id="selectedcomment">
49
                                <select>
50
                                    <option selected disabled>Report mistake</option>
51
                                    [% FOREACH comment IN subscription.comments %]
52
                                        <option class="actionreport1" value="[% comment.id %]" onclick="mana_increment('[% comment.id %]', 'resource_comment', 'nb')"> [% comment.message %] ([% comment.nb %])
53
                                    [% END %]
54
                                        <option data-toggle="modal" onclick="($('#selected_id').val($('.rowid').val()))" data-target="#comment_box"> other
55
                                </select>
56
                                <button hidden class="actionreport2" hidden> Cancel</button>
57
                            </td>
58
                        [% END %]
59
                    </tr>
60
                [% END %]
61
            [% END %]
61
            [% END %]
62
        [% END %]
62
        </tbody>
63
    </tbody>
63
    </table>
64
</table>
64
[% ELSE %]
65
    <h4> [% msg %] statuscode: [% statuscode %] </h4>
66
[% END %]
65
67
66
<div id="comment_box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
68
<div id="comment_box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
67
    <div class="modal-dialog modal-lg" style="width: 30%">
69
    <div class="modal-dialog modal-lg" style="width: 30%">
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc (+1 lines)
Lines 80-85 Link Here
80
            <div class="modal-body">
80
            <div class="modal-body">
81
                [% IF (mana_id) %]
81
                [% IF (mana_id) %]
82
                    <div class="alert">
82
                    <div class="alert">
83
<h1>[% (mana_id) %]</h1>
83
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
84
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
84
                    </div>
85
                    </div>
85
                [% END %]
86
                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref (+5 lines)
Lines 67-72 Web services: Link Here
67
                  1: Enable
67
                  1: Enable
68
                  2: No, let me think about it
68
                  2: No, let me think about it
69
            - request to Mana Webservice. Mana centralize commun information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana. The informations shared with Mana KB are shared under the CC-0 license. More infos about CC-0 license on https://creativecommons.org/choose/zero/
69
            - request to Mana Webservice. Mana centralize commun information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana. The informations shared with Mana KB are shared under the CC-0 license. More infos about CC-0 license on https://creativecommons.org/choose/zero/
70
        -
71
             - "Security token used to authenticate on mana:"
72
             - pref: ManaToken
73
               class: Text
74
             - <br> You need a security token to authenticate on Mana. If this sytem preference is empty, please fill in the following form, you will receive an email to confirm and activate your token. <script src=/intranet-tmpl/lib/jquery/activatemana.js></script> <br> <form> Firstname <input name="firstname" type="text" id="firstname"> <br> Lastname <input name="lastname" type=text id=lastname> <br> email <input name="email" type=text id=email><br> <input type=submit id=activatemana value="Send"></form>
70
        -
75
        -
71
            - 'Fields automatically shared with mana'
76
            - 'Fields automatically shared with mana'
72
            - pref: AutoShareWithMana
77
            - pref: AutoShareWithMana
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-6 / +2 lines)
Lines 190-202 canned reports and writing custom SQL reports.</p> Link Here
190
            </select>
190
            </select>
191
        </div>
191
        </div>
192
<div style="display:inline-block">
192
<div style="display:inline-block">
193
    [% IF (manamsg == 'success') %]
193
    [% IF manamsg %]
194
     <div id="mana_search" class="dialog message">
194
     <div id="mana_search" class="dialog message">
195
        <p> Shared successfully! Thanks for your help.</p>
195
        <p> [% manamsg %] </p>
196
    </div>
197
    [% ELSIF (manamsg == 'fail') %]
198
     <div id="mana_search" class="dialog message">
199
        <p> An error occured while sharing, please try again later.</p>
200
    </div>
196
    </div>
201
    [% END %]
197
    [% END %]
202
198
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-1 / +1 lines)
Lines 222-228 width: 300px; /* not enough for IE7 apparently */ Link Here
222
                    </fieldset>
222
                    </fieldset>
223
                [% END %]
223
                [% END %]
224
224
225
                        <div id="mana_search" class="dialog message">
225
                        <div hidden id="mana_search" class="dialog message">
226
                            <p>Subscription found on Mana Knowledge Base:</p><p> <a style="cursor:pointer" data-toggle="modal" data-target="#mana_search_result">Quick fill</a></p>
226
                            <p>Subscription found on Mana Knowledge Base:</p><p> <a style="cursor:pointer" data-toggle="modal" data-target="#mana_search_result">Quick fill</a></p>
227
                        </div>
227
                        </div>
228
                        <div id="subscription_form_planning">
228
                        <div id="subscription_form_planning">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-5 / +1 lines)
Lines 62-72 Link Here
62
    [% IF mana_code.defined %]
62
    [% IF mana_code.defined %]
63
        <div id="alert-community" class="dialog message">
63
        <div id="alert-community" class="dialog message">
64
            <p>
64
            <p>
65
                [% IF (mana_code == 201) %]
65
                [% mana_code %]
66
                    The export is done, thank you for your contribution.
67
                [% ELSIF (mana_code == 200) %]
68
                    The model already exists on Mana, thank you for your contribution.
69
                [% END %]
70
            </p>
66
            </p>
71
        </div>
67
        </div>
72
    [% END %]
68
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js (-1 / +1 lines)
Lines 415-421 function mana_search() { Link Here
415
                { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
415
                { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
416
            ]
416
            ]
417
        }));
417
        }));
418
        if($("td.dataTables_empty").length == 0){
418
        if( $("#mana_results_datatable").length && $("td.dataTables_empty").length == 0){
419
            $("#mana_search").show();
419
            $("#mana_search").show();
420
        }
420
        }
421
        $( "select[class='actionreport1']" ).show();
421
        $( "select[class='actionreport1']" ).show();
(-)a/reports/guided_reports.pl (-3 / +3 lines)
Lines 673-682 elsif ( $phase eq 'Save Report' ) { Link Here
673
673
674
elsif ($phase eq 'Share'){
674
elsif ($phase eq 'Share'){
675
    my $result = Koha::SharedContent::manaShareInfos($input, $borrowernumber, $input->param('reportid'), 'report');
675
    my $result = Koha::SharedContent::manaShareInfos($input, $borrowernumber, $input->param('reportid'), 'report');
676
    if ( $result and ($result->{code} eq "200" or $result->{code} eq "201") ) {
676
    if ( $result ) {
677
        print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&manamsg=success");
677
        print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&manamsg=".$result->{msg});
678
    }else{
678
    }else{
679
        print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&manamsg=fail");
679
        print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&manamsg=noanswer");
680
    }
680
    }
681
}
681
}
682
elsif ($phase eq 'Run this report'){
682
elsif ($phase eq 'Run this report'){
(-)a/serials/subscription-add.pl (-2 / +2 lines)
Lines 406-414 sub redirect_add_subscription { Link Here
406
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
406
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
407
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
407
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
408
    );
408
    );
409
    if ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana')) ){
409
    if ( (C4::Context->preference('Mana')) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
410
        my $result = Koha::SharedContent::manaShareInfos( $query, $loggedinuser, $subscriptionid, 'subscription');
410
        my $result = Koha::SharedContent::manaShareInfos( $query, $loggedinuser, $subscriptionid, 'subscription');
411
        $template->param( mana_code => $result->{code} );
411
        $template->param( mana_msg => $result->{msg} );
412
    }
412
    }
413
    my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } );
413
    my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } );
414
    insert_additional_fields( $additional_fields, $biblionumber, $subscriptionid );
414
    insert_additional_fields( $additional_fields, $biblionumber, $subscriptionid );
(-)a/serials/subscription-detail.pl (-1 / +1 lines)
Lines 105-111 if ($op eq 'del') { Link Here
105
}
105
}
106
elsif ( $op and $op eq "share" ) {
106
elsif ( $op and $op eq "share" ) {
107
    my $result = Koha::SharedContent::manaShareInfos($query, $loggedinuser, $subscriptionid, 'subscription');
107
    my $result = Koha::SharedContent::manaShareInfos($query, $loggedinuser, $subscriptionid, 'subscription');
108
    $template->param( mana_code => $result->{code} );
108
    $template->param( mana_code => $result->{msg} );
109
    $subs->{mana_id} = $result->{id};
109
    $subs->{mana_id} = $result->{id};
110
}
110
}
111
111
(-)a/svc/mana/getToken (+55 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2016 BibLibre Baptiste Wojtkowski
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
#
20
21
22
use Modern::Perl;
23
24
use Koha::SharedContent;
25
use C4::Auth qw(check_cookie_auth);
26
27
use CGI;
28
use JSON;
29
30
my $input = new CGI;
31
binmode STDOUT, ":encoding(UTF-8)";
32
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
33
34
my ( $auth_status, $sessionID ) =
35
  check_cookie_auth( $input->cookie('CGISESSID'),
36
    { serials => 'create_subscription' } );
37
38
if ( $auth_status ne "ok" ) {
39
    exit 0;
40
}
41
42
my $mana_ip = C4::Context->config('mana_config');
43
44
my $url = "$mana_ip/getsecuritytoken";
45
my $request = HTTP::Request->new( POST => $url );
46
47
my $content;
48
$content->{ firstname }= $input->param("firstname");
49
$content->{ lastname }= $input->param("lastname");
50
$content->{ email }= $input->param("email");
51
my $json = to_json( $content, { utf8 => 1 } );
52
$request->content($json);
53
my $result = Koha::SharedContent::manaRequest($request);
54
55
print(to_json($result));
(-)a/svc/mana/search (-1 / +2 lines)
Lines 73-77 foreach my $resource (@{ $result->{data} }){ Link Here
73
}
73
}
74
74
75
$template->param( $input->param('resource')."s" => $result->{data} );
75
$template->param( $input->param('resource')."s" => $result->{data} );
76
$template->param( statuscode => $result->{code} );
77
$template->param( msg => $result->{msg} );
76
78
77
output_with_http_headers $input, $cookie, $template->output, 'json';
79
output_with_http_headers $input, $cookie, $template->output, 'json';
78
- 

Return to bug 17047