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

(-)a/Koha/Report.pm (+54 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Carp;
20
use Carp;
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use JSON;
24
use Koha::Reports;
23
25
24
use base qw(Koha::Object);
26
use base qw(Koha::Object);
25
27
Lines 33-38 Koha::Report - Koha Report Object class Link Here
33
35
34
=cut
36
=cut
35
37
38
=head3 get_search_info
39
40
Return search info
41
42
=cut
43
44
sub get_search_info {
45
    my $self=shift;
46
    my $sub_mana_info = { 'query' => shift };
47
    return $sub_mana_info;
48
}
49
50
=head3 get_sharable_info
51
52
Return properties that can be shared.
53
54
=cut
55
56
sub get_sharable_info {
57
    my $self=shift;
58
    my $shared_report_id=shift;
59
    my $report = Koha::Reports->find($shared_report_id);
60
    my $sub_mana_info = {
61
        'savedsql' => $report->savedsql,
62
        'report_name' => $report->report_name,
63
        'notes' => $report->notes,
64
        'report_group' => $report->report_group,
65
        'type' => $report->type,
66
    };
67
    return $sub_mana_info;
68
}
69
70
=head3 new_from_mana
71
72
Clear a Mana report to be imported in Koha?
73
74
=cut
75
76
sub new_from_mana{
77
    my $self = shift;
78
    my $data = shift;
79
    delete $data->{exportemail};
80
    delete $data->{kohaversion};
81
    delete $data->{creationdate};
82
    delete $data->{lastimport};
83
    $data->{mana_id} = $data->{id};
84
    delete $data->{id};
85
    delete $data->{nbofusers};
86
    delete $data->{language};
87
    Koha::Report->new($data)->store;
88
}
89
36
=head3 _type
90
=head3 _type
37
91
38
Returns name of corresponding DBIC resultset
92
Returns name of corresponding DBIC resultset
(-)a/Koha/Reports.pm (+6 lines)
Lines 55-58 sub object_class { Link Here
55
    return 'Koha::Report';
55
    return 'Koha::Report';
56
}
56
}
57
57
58
=head1 AUTHOR
59
60
Kyle M Hall <kyle@bywatersolutions.com>
61
62
=cut
63
58
1;
64
1;
(-)a/Koha/SharedContent.pm (-5 / +61 lines)
Lines 22-28 use JSON; Link Here
22
use HTTP::Request;
22
use HTTP::Request;
23
use LWP::UserAgent;
23
use LWP::UserAgent;
24
24
25
our $MANA_IP = "http://10.25.159.107:5000";
25
use Koha::Serials;
26
use Koha::Reports;
27
28
our $MANA_IP = C4::Context->config('mana_config');
26
29
27
sub manaRequest {
30
sub manaRequest {
28
    my $mana_request = shift;
31
    my $mana_request = shift;
Lines 40-51 sub manaRequest { Link Here
40
    return $result if ( $response->code =~ /^2..$/ );
43
    return $result if ( $response->code =~ /^2..$/ );
41
}
44
}
42
45
43
sub manaNewUserPatchRequest {
46
sub manaIncrementRequest {
44
    my $resource = shift;
47
    my $resource = shift;
45
    my $id       = shift;
48
    my $id       = shift;
46
49
    my $field    = shift;
47
    my $url = "$MANA_IP/$resource/$id.json/newUser";
50
    my $step     = shift;
48
    my $request = HTTP::Request->new( PATCH => $url );
51
    my $param;
52
    $param->{step} = $step || 1;
53
    $param->{id} = $id;
54
    $param->{resource} = $resource;
55
    $param = join '&',
56
       map { defined $param->{$_} ? $_ . "=" . $param->{$_} : () }
57
           keys %$param;
58
    my $url = "$MANA_IP/$resource/$id.json/increment/$field?$param";
59
    my $request = HTTP::Request->new( POST => $url );
49
60
50
    return manaRequest($request);
61
    return manaRequest($request);
51
}
62
}
Lines 64-69 sub manaPostRequest { Link Here
64
    return manaRequest($request);
75
    return manaRequest($request);
65
}
76
}
66
77
78
sub manaShareInfos{
79
    my ($query, $loggedinuser, $ressourceid, $ressourcetype) = @_;
80
    my $mana_language;
81
    if ( $query->param('mana_language') ) {
82
        $mana_language = $query->param('mana_language');
83
    }
84
    else {
85
        my $result = $mana_language = C4::Context->preference('language');
86
    }
87
88
    my $mana_email;
89
    if ( $loggedinuser ne 0 ) {
90
        my $borrower = Koha::Patrons->find($loggedinuser);
91
        $mana_email = $borrower->email
92
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
93
        $mana_email = $borrower->emailpro
94
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
95
        $mana_email =
96
          Koha::Libraries->find( C4::Context->userenv->{'branch'} )->branchemail
97
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
98
    }
99
    $mana_email = C4::Context->preference('KohaAdminEmailAddress')
100
      if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
101
    my %versions = C4::Context::get_versions();
102
103
    my $mana_info = {
104
        language    => $mana_language,
105
        kohaversion => $versions{'kohaVersion'},
106
        exportemail => $mana_email
107
    };
108
    my ($ressource, $ressource_mana_info);
109
    my $packages = "Koha::".ucfirst($ressourcetype)."s";
110
    my $package = "Koha::".ucfirst($ressourcetype);
111
    $ressource_mana_info = $package->get_sharable_info($ressourceid);
112
    $ressource_mana_info = { %$ressource_mana_info, %$mana_info };
113
    $ressource = $packages->find($ressourceid);
114
115
    my $result = Koha::SharedContent::manaPostRequest( $ressourcetype,
116
        $ressource_mana_info );
117
    if ( $result and ($result->{code} eq "200" or $result->{code} eq "201") ) {
118
        $ressource->set( { mana_id => $result->{id} } )->store;
119
    }
120
    return $result;
121
}
122
67
sub manaGetRequestWithId {
123
sub manaGetRequestWithId {
68
    my $resource = shift;
124
    my $resource = shift;
69
    my $id       = shift;
125
    my $id       = shift;
(-)a/Koha/Subscription.pm (+2 lines)
Lines 116-121 sub remove_subscriber { Link Here
116
=cut
116
=cut
117
117
118
sub get_search_info {
118
sub get_search_info {
119
    my $self=shift;
119
    my $searched_sub_id = shift;
120
    my $searched_sub_id = shift;
120
    my $biblio = Koha::Biblios->find( { 'biblionumber' => $searched_sub_id } );
121
    my $biblio = Koha::Biblios->find( { 'biblionumber' => $searched_sub_id } );
121
    my $biblioitem =
122
    my $biblioitem =
Lines 131-136 sub get_search_info { Link Here
131
}
132
}
132
133
133
sub get_sharable_info {
134
sub get_sharable_info {
135
    my $self = shift;
134
    my $shared_sub_id = shift;
136
    my $shared_sub_id = shift;
135
    my $subscription  = Koha::Subscriptions->find($shared_sub_id);
137
    my $subscription  = Koha::Subscriptions->find($shared_sub_id);
136
    my $biblio        = Koha::Biblios->find( $subscription->biblionumber );
138
    my $biblio        = Koha::Biblios->find( $subscription->biblionumber );
(-)a/etc/koha-conf.xml (+4 lines)
Lines 153-158 __PAZPAR2_TOGGLE_XML_POST__ Link Here
153
 <!-- Path to the config file for SMS::Send -->
153
 <!-- Path to the config file for SMS::Send -->
154
 <sms_send_config>__KOHA_CONF_DIR__/sms_send/</sms_send_config>
154
 <sms_send_config>__KOHA_CONF_DIR__/sms_send/</sms_send_config>
155
155
156
 <!-- URL of the mana KB server -->
157
 <!-- alternative value http://mana-test.koha-community.org to query the test server -->
158
 <mana_config>http://mana-kb.koha-community.org</mana_config>
159
156
 <!-- Configuration for Plack -->
160
 <!-- Configuration for Plack -->
157
 <plack_max_requests>50</plack_max_requests>
161
 <plack_max_requests>50</plack_max_requests>
158
 <plack_workers>2</plack_workers>
162
 <plack_workers>2</plack_workers>
(-)a/installer/data/mysql/atomicupdate/mana_01-add_mana_id_in_subscription.sql (+1 lines)
Line 1 Link Here
1
ALTER TABLE subscription ADD mana_id int(11);
1
ALTER TABLE subscription ADD mana_id int(11);
2
ALTER TABLE saved_sql ADD mana_id int(11);
(-)a/installer/data/mysql/atomicupdate/mana_02-add_Mana_syspref.sql (-1 / +1 lines)
Line 1 Link Here
1
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('Mana', '1', '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.', NULL, 'YesNo');
1
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('Mana','2', 0|1|2,'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.','Choice');
(-)a/installer/data/mysql/atomicupdate/mana_03-add_mana_autoshare.sql (+2 lines)
Line 0 Link Here
1
INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
2
('AutoShareWithMana','subscription','','defines datas automatically shared with mana','multiple');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 63-68 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
63
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
63
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
64
('AutoEmailOpacUser','0',NULL,'Sends notification emails containing new account details to patrons - when account is created.','YesNo'),
64
('AutoEmailOpacUser','0',NULL,'Sends notification emails containing new account details to patrons - when account is created.','YesNo'),
65
('AutoEmailPrimaryAddress','OFF','email|emailpro|B_email|cardnumber|OFF','Defines the default email address where \'Account Details\' emails are sent.','Choice'),
65
('AutoEmailPrimaryAddress','OFF','email|emailpro|B_email|cardnumber|OFF','Defines the default email address where \'Account Details\' emails are sent.','Choice'),
66
('AutoShareWithMana','subscription','','defines datas automatically shared with mana','multiple'),
66
('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff client from unauthorized IP addresses','YesNo'),
67
('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff client from unauthorized IP addresses','YesNo'),
67
('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'),
68
('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'),
68
('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'),
69
('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+6 lines)
Lines 715-720 ol { Link Here
715
    background-color: #FFD000 !important;
715
    background-color: #FFD000 !important;
716
}
716
}
717
717
718
.warned-row,
719
.warned-row td { background-color: #FF9000 !important }
720
721
.high-warned-row,
722
.high-warned-row td { background-color: #FF0000 !important }
723
718
tbody {
724
tbody {
719
    tr {
725
    tr {
720
        &:nth-child(odd) {
726
        &:nth-child(odd) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana-subscription-search-result.inc (-46 lines)
Lines 1-46 Link Here
1
[% USE KohaDates %]
2
<table id="mana_results_datatable">
3
    <thead>
4
        <tr>
5
            <th>ISSN</th>
6
            <th class="anti-the">Title</th>
7
            <th>Frequency</th>
8
            <th>Numbering pattern</th>
9
            <th class="NoSort">Number of users</th>
10
            <th class="title-string">Last Import</th>
11
            [% UNLESS search_only %]
12
              <th class="NoSort">Actions</th>
13
            [% END %]
14
        </tr>
15
    </thead>
16
    <tfoot>
17
        <tr>
18
            <td><input type="text" class="dt-filter" data-column_num="0" placeholder="Search ISSN" /></td>
19
            <td><input type="text" class="dt-filter" data-column_num="1" placeholder="Search title" /></td>
20
            <td><input type="text" class="dt-filter" data-column_num="2" placeholder="Search frequency" /></td>
21
            <td><input type="text" class="dt-filter" data-column_num="3" placeholder="Search numbering pattern" /></td>
22
            <td></td>
23
            <td><input type="text" class="dt-filter" data-column_num="5" placeholder="Search last import" /></td>
24
            [% UNLESS search_only %]
25
              <td></td>
26
            [% END %]
27
        </tr>
28
    </tfoot>
29
    <tbody>
30
        [% FOREACH subscription IN subscriptions %]
31
            [% UNLESS subscription.cannotdisplay %]
32
                <tr id="row[% subscription.subscriptionid %]">
33
                    <td>[% IF ( subscription.issn ) %][% subscription.issn %][% END %]</td>
34
                    <td>[% subscription.title %]</a></td>
35
                    <td>[% IF ( subscription.sfdescription ) %][% subscription.sfdescription %][% END %]</td>
36
                    <td>[% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod %][% END %]</td>
37
                    <td>[% IF ( subscription.nbofusers ) %][% subscription.nbofusers %][% END %]</td>
38
                    <td><span title="[% subscription.lastimport %]">[% subscription.lastimport | $KohaDates %]</span></td>
39
                    [% UNLESS search_only %]
40
                      <td><a style="cursor:pointer" onclick="mana_use([% subscription.id %])"> <i class="fa fa-inbox"></i> Use</a></td>
41
                    [% END %]
42
                </tr>
43
            [% END %]
44
        [% END %]
45
    </tbody>
46
</table>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc (+83 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% USE Koha %]
3
[% USE AuthorisedValues %]
4
[% USE Branches %]
5
6
<table id="mana_results_datatable" width=100%>
7
    <thead>
8
        <tr>
9
            <th>Report Name</th>
10
            <th class="anti-the" width=35%>Notes</th>
11
            <th>Type</th>
12
            <th title="number of libraries using this pattern"># of users</th>
13
            <th class="title-string" title="last time a library used this pattern">Last import</th>
14
            <th> Comments </th>
15
            [% UNLESS search_only %]
16
              <th class="NoSort">Actions</th>
17
            [% END %]
18
        </tr>
19
    </thead>
20
    <tbody>
21
        [% FOREACH report IN reports %]
22
            [% UNLESS report.cannotdisplay %]
23
                <tr id="row[% report.id %]"
24
                     [% IF report.nbofcomment > highWarned  %]
25
                        class = "high-warned-row"
26
                     [% ELSIF report.nbofcomment > warned  %]
27
                        class = "warned-row"
28
                     [% ELSIF report.nbofcomment > lowWarned  %]
29
                        class = "highlighted-row"
30
                     [% END %]
31
                >
32
                    <input hidden class="rowid" value="[% report.id %]">
33
                    <td>[% IF ( report.report_name ) %][% report.report_name %][% END %]</td>
34
                    <td title="[% report.savedsql %]"><div>
35
                        [% IF report.notes.length > 200 %]
36
                            [% report.notes.substr(0,200) %]<a class="showbutton">Show More</a></div><div hidden>
37
                        [% END %]
38
                            [% report.notes %]
39
                        [% IF report.notes.length > 200 %]
40
                            <a class="hidebutton">Show Less</a></div> </td>
41
                        [% END %]
42
                    <td> [% report.type %] </td>
43
                    <td>[% IF ( report.nbofusers ) %][% report.nbofusers %][% END %]</td>
44
                    <td><span title="[% report.lastimport %]">[% report.lastimport | $KohaDates %]</span></td>
45
		    <td>[% FOREACH comment IN report.comments %][% comment.message %] ([% comment.nb %]) <br>[% END %]</td>
46
47
                    [% UNLESS search_only %]
48
                      <td>
49
                          <button onclick="mana_use([% report.id %])"> <i class="fa fa-inbox"></i> Use</button>
50
                          <input hidden type="text" id="selectedcomment">
51
                          <select>
52
                              <option selected disabled>Report mistake</option>
53
                              [% FOREACH comment IN report.comments %]
54
                                  <option class="actionreport1" value="[% comment.id %]" onclick="mana_increment('[% comment.id %]', 'resource_comment', 'nb')"> [% comment.message %] ([% comment.nb %])
55
                              [% END %]
56
                                  <option data-toggle="modal" onclick="($('#selected_id').val($('.rowid').val()))" data-target="#comment_box"> other
57
                          </select>
58
                          <button hidden class="actionreport2" hidden> Cancel</button>
59
                      </td>
60
                    [% END %]
61
                </tr>
62
            [% END %]
63
        [% END %]
64
    </tbody>
65
</table>
66
67
<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%">
69
        <div class="modal-content" style="">
70
            <div class="modal-header">
71
                <button type="button" id="commentCloseButton" class="closebtn"  aria-hidden="true">×</button>
72
                <h3 id="mana_submit_comment"> Please enter a new commment (max 35 caracters)</h3>
73
            </div>
74
            <div class="modal-body">
75
                <form>
76
                    <input hidden id="selected_id" value="">
77
                    <input type="text" id="manamsg">
78
                </form>
79
                <button id="CommentButton"> Comment </button>
80
            </div>
81
        </div>
82
    </div>
83
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc (+82 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% USE Koha %]
3
[% USE AuthorisedValues %]
4
[% USE Branches %]
5
6
7
8
<table id="mana_results_datatable" width=100%>
9
    <thead>
10
        <tr>
11
            <th>ISSN</th>
12
            <th class="anti-the" width=50%>Title</th>
13
            <th> Published by </th>
14
            <th>Frequency</th>
15
            <th>Numbering pattern</th>
16
            <th title="number of libraries using this pattern"># of users</th>
17
            <th class="title-string" title="last time a library used this pattern">Last import</th>
18
            <th> Comments </th>
19
            [% UNLESS search_only %]
20
              <th class="NoSort">Actions</th>
21
            [% END %]
22
        </tr>
23
    </thead>
24
    <tbody>
25
        [% FOREACH subscription IN subscriptions %]
26
            [% UNLESS subscription.cannotdisplay %]
27
                <tr id="row[% subscription.subscriptionid %]"
28
                     [% IF subscription.nbofcomment > highWarned  %]
29
                        class = "high-warned-row" title="this resource has been reported more than [% highWarned %] times, take care!"
30
                     [% ELSIF subscription.nbofcomment > warned  %]
31
                        class = "warned-row" title="this resource has been reported more than [% warned %] times, take care!"
32
                     [% ELSIF subscription.nbofcomment > lowWarned  %]
33
                        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 %]
60
                </tr>
61
            [% END %]
62
        [% END %]
63
    </tbody>
64
</table>
65
66
<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%">
68
        <div class="modal-content" style="">
69
            <div class="modal-header">
70
                <button type="button" id="commentCloseButton" class="closebtn" aria-hidden="true">×</button>
71
                <h3 id="mana_submit_comment"> Please enter a new commment (max 35 caracters)</h3>
72
            </div>
73
            <div class="modal-body">
74
                <form>
75
                    <input hidden id="selected_id" value="">
76
                    <input type="text" id="manamsg"> Comment:
77
                </form>
78
                <button id="CommentButton"> Comment </button>
79
            </div>
80
        </div>
81
    </div>
82
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc (-9 / +7 lines)
Lines 7-17 Link Here
7
            [% ELSE %]
7
            [% ELSE %]
8
                <div class="btn-group"><a id="newsubscription" class="btn btn-default btn-sm" href="/cgi-bin/koha/serials/subscription-add.pl"><i class="fa fa-plus"></i> New subscription</a></div>
8
                <div class="btn-group"><a id="newsubscription" class="btn btn-default btn-sm" href="/cgi-bin/koha/serials/subscription-add.pl"><i class="fa fa-plus"></i> New subscription</a></div>
9
            [% END %]
9
            [% END %]
10
            [% IF Koha.Preference('Mana') %]
10
            [% IF Koha.Preference('Mana') and Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %]
11
                [% IF one_language_enabled==0 or mana_id %]
11
                [% IF one_language_enabled==0 or mana_id %]
12
                    <div class="btn-group"><a data-toggle="modal" data-toggle="tooltip" title="Your email address will be associated to your sharing." data-target="#mana_share_modal" class="btn btn-small"><i class="fa fa-share-alt"></i> Share</a></div>
12
                    <div class="btn-group"><a data-toggle="modal" data-toggle="tooltip" title="Share the subscription with other librairies. Your email address will be associated to your sharing." data-target="#mana_share_modal" class="btn btn-default btn-sm"><i class="fa fa-share-alt"></i> Share</a></div>
13
                [% ELSE %]
13
                [% ELSE %]
14
                    <div class="btn-group" data-toggle="tooltip" title="Your email address will be associated to your sharing."><a class="btn btn-small" onclick="share()"><i class="fa fa-share-alt"></i> Share</a></div>
14
                    <div class="btn-group" data-toggle="tooltip" title="Share the subscription with other libraries. Your email address will be associated to your sharing."><a class="btn btn-default btn-sm" onclick="share()"><i class="fa fa-share-alt"></i> Share</a></div>
15
                [% END %]
15
                [% END %]
16
            [% END %]
16
            [% END %]
17
        [% END %]
17
        [% END %]
Lines 80-97 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
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwide it will do nothing.</p>
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
                    </div>
84
                    </div>
85
                [% END %]
85
                [% END %]
86
                [% IF ( languages_loop ) %]
86
                [% IF ( languages_loop ) %]
87
                    [% UNLESS ( one_language_enabled ) %]
87
                    [% UNLESS ( one_language_enabled ) %]
88
                        <div class="rows">
88
                        <div class="rows">
89
                            <p>The frequency and the numberpattern of [% bibliotitle %] are :</p>
89
                                <li><span class="label">Frequency: </span>
90
                            <ol>
91
                                <li><span class="label">Frequency : </span>
92
                                        [% frequency.description %]
90
                                        [% frequency.description %]
93
                                </li>
91
                                </li>
94
                                <li><span class="label">Number pattern : </span>
92
                                <li><span class="label">Number pattern: </span>
95
                                    [% numberpattern.label %]
93
                                    [% numberpattern.label %]
96
                                </li>
94
                                </li>
97
                            </ol>
95
                            </ol>
Lines 99-105 Link Here
99
                        <div class="rows">
97
                        <div class="rows">
100
                            <form method="get" id="mana_share_form" action="/cgi-bin/koha/serials/subscription-detail.pl" class="validated" >
98
                            <form method="get" id="mana_share_form" action="/cgi-bin/koha/serials/subscription-detail.pl" class="validated" >
101
                                <fieldset>
99
                                <fieldset>
102
                                    <label for="mana_language">Language of your sharing :</label>
100
                                    <label for="mana_language">Language:</label>
103
                                    <select id="mana_language" name="mana_language">
101
                                    <select id="mana_language" name="mana_language">
104
                                        [% FOREACH languages_loo IN languages_loop %]
102
                                        [% FOREACH languages_loo IN languages_loop %]
105
                                            [% IF ( languages_loo.group_enabled ) %]
103
                                            [% IF ( languages_loo.group_enabled ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (-2 / +6 lines)
Lines 13-23 Link Here
13
<div class="main container-fluid">
13
<div class="main container-fluid">
14
    <div class="row">
14
    <div class="row">
15
        <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
15
        <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
16
16
            [% IF ( Koha.Preference('Mana') == 2) %]
17
                <fieldset>
18
                    <p><center> You haven't decided if you want to activate Mana Knowlede Base, please let us know by clicking<center></p>
19
                    <a href=/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=request+to+mana+webservice><center>Here</center></a>
20
                </fieldset>
21
           [% END %]
17
        <h1>Koha administration</h1>
22
        <h1>Koha administration</h1>
18
        <div class="row">
23
        <div class="row">
19
            <div class="col-md-6 sysprefs">
24
            <div class="col-md-6 sysprefs">
20
21
                <form action="/cgi-bin/koha/admin/preferences.pl" method="post">
25
                <form action="/cgi-bin/koha/admin/preferences.pl" method="post">
22
                <fieldset>
26
                <fieldset>
23
                    <h4><a href="/cgi-bin/koha/admin/preferences.pl">Global system preferences</a></h4>
27
                    <h4><a href="/cgi-bin/koha/admin/preferences.pl">Global system preferences</a></h4>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref (-3 / +9 lines)
Lines 63-71 Web services: Link Here
63
        -
63
        -
64
            - pref: Mana
64
            - pref: Mana
65
              choices:
65
              choices:
66
                  yes: Enable
66
                  0: Disable
67
                  no: Disable
67
                  1: Enable
68
            - 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.
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/
70
        -
71
            - 'Fields automatically shared with mana'
72
            - pref: AutoShareWithMana
73
              multiple:
74
                subscription: Subscriptions
69
    Reporting:
75
    Reporting:
70
        -
76
        -
71
            - Only return
77
            - Only return
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/mana/mana-report-search-result.tt (+1 lines)
Line 0 Link Here
1
[% INCLUDE 'mana/mana-report-search-result.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/mana/mana-subscription-search-result.tt (+1 lines)
Line 0 Link Here
1
[% INCLUDE 'mana/mana-subscription-search-result.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-6 / +281 lines)
Lines 135-140 canned reports and writing custom SQL reports.</p> Link Here
135
    </div>
135
    </div>
136
[% END %]
136
[% END %]
137
137
138
<div id="mana_search_result" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="width: 100%; left:0%; margin-left: auto; display: none;">
139
    <div class="modal-dialog modal-lg">
140
        <div class="modal-content">
141
            <div class="modal-header">
142
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
143
                <h3 id="mana_search_result_label"> Mana Search</h3>
144
            </div>
145
            <div>
146
                <form id="search_form" style="margin-left: 5%">
147
                    Please enter a few key words:
148
                    <input type=text id=mana_search_field>
149
                    <input type=button class="mana_search_button" value="Search">
150
                </form>
151
                <div class="modal-body">
152
                </div>
153
            </div>
154
        </div>
155
    </div>
156
</div>
157
138
[% IF ( saved1 ) %]
158
[% IF ( saved1 ) %]
139
[% IF ( savedreports ) %]<h1>Saved reports</h1>
159
[% IF ( savedreports ) %]<h1>Saved reports</h1>
140
160
Lines 169-174 canned reports and writing custom SQL reports.</p> Link Here
169
                <option value="">All</option>
189
                <option value="">All</option>
170
            </select>
190
            </select>
171
        </div>
191
        </div>
192
<div style="display:inline-block">
193
    [% IF (manamsg == 'success') %]
194
     <div id="mana_search" class="dialog message">
195
        <p> Shared successfully! Thanks for your help.</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>
201
    [% END %]
202
203
   [% IF (Koha.Preference('Mana') == 1) %]
204
    <div id="mana_search" class="dialog message">
205
        <p> You want more reports? Check the Mana Knowledge Base <p> <a style="cursor:pointer" data-toggle="modal" data-target="#mana_search_result">Quick Search</a></p>
206
    </div>
207
    [% END %]
208
209
</script>
210
<h1> [% savedreport.sql %]</h1>
172
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
211
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
173
<input type="hidden" name="phase" value="Delete Multiple" />
212
<input type="hidden" name="phase" value="Delete Multiple" />
174
        <table id="table_reports">
213
        <table id="table_reports">
Lines 204-226 canned reports and writing custom SQL reports.</p> Link Here
204
            <tbody>
243
            <tbody>
205
                [% FOREACH savedreport IN savedreports %]
244
                [% FOREACH savedreport IN savedreports %]
206
                    [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
245
                    [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
207
                        <td>
246
                        <td class="report_checkbox">
208
                            [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
247
                            [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
209
                                <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
248
                                <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
210
                            [% END %]
249
                            [% END %]
250
                        <input hidden class="report_sql" value="[% savedreport.savedsql %]">
211
                        </td>
251
                        </td>
212
                        <td><label for="ids">[% savedreport.id | html %]</label></td>
252
                        <td class="report_id"><label for="ids">[% savedreport.id | html %]</label></td>
213
                        <td>
253
                        <td class="report_name">
214
                            [% IF ( savedreport.report_name ) %]
254
                            [% IF ( savedreport.report_name ) %]
215
                                [% savedreport.report_name | html %]
255
                                [% savedreport.report_name | html %]
216
                            [% ELSE %]
256
                            [% ELSE %]
217
                                [ no name ]
257
                                [ no name ]
218
                            [% END %]
258
                            [% END %]
219
                        </td>
259
                        </td>
220
                        <td>[% savedreport.type | html %]</td>
260
                        <td class="report_type">[% savedreport.type | html %]</td>
221
                        <td>[% savedreport.groupname | html %]</td>
261
                        <td class="report_group">[% savedreport.groupname | html %]</td>
222
                        <td>[% savedreport.subgroupname | html %]</td>
262
                        <td>[% savedreport.subgroupname | html %]</td>
223
                        <td>[% savedreport.notes | html %]</td>
263
                        <td class="report_notes">[% savedreport.notes | html %]</td>
224
                        <td>[% savedreport.borrowersurname | html %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname | html %][% END %] ([% savedreport.borrowernumber | html %])</td>
264
                        <td>[% savedreport.borrowersurname | html %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname | html %][% END %] ([% savedreport.borrowernumber | html %])</td>
225
                        <td><span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span></td>
265
                        <td><span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span></td>
226
                        <td><span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates with_hours => 1 | html %]</span></td>
266
                        <td><span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates with_hours => 1 | html %]</span></td>
Lines 267-272 canned reports and writing custom SQL reports.</p> Link Here
267
                                            <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
307
                                            <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
268
                                            <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% savedreport.savedsql |uri %]&amp;reportname=[% savedreport.report_name |uri %]&amp;notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
308
                                            <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% savedreport.savedsql |uri %]&amp;reportname=[% savedreport.report_name |uri %]&amp;notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
269
                                        [% END %]
309
                                        [% END %]
310
                                        [% IF (Koha.Preference('Mana') == 1) %]
311
                                            <li><a class="ShareButton" data-toggle="modal" href="#mana_share_report" title="Share your report with Mana Knowledge Base"><i class="fa fa-share-alt"></i> Share</a></li>
312
                                        [% END %]
270
                                        <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
313
                                        <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
271
                                        [% IF ( CAN_user_reports_delete_reports ) %]
314
                                        [% IF ( CAN_user_reports_delete_reports ) %]
272
                                            <li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&amp;phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a></li>
315
                                            <li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&amp;phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a></li>
Lines 279-284 canned reports and writing custom SQL reports.</p> Link Here
279
                [% END %]
322
                [% END %]
280
            </tbody>
323
            </tbody>
281
        </table>
324
        </table>
325
</div>
282
        [% IF ( CAN_user_reports_delete_reports ) %]
326
        [% IF ( CAN_user_reports_delete_reports ) %]
283
        <fieldset class="action">
327
        <fieldset class="action">
284
            <input type="submit" value="Delete selected" />
328
            <input type="submit" value="Delete selected" />
Lines 319-324 canned reports and writing custom SQL reports.</p> Link Here
319
[% END %]
363
[% END %]
320
[% END %]
364
[% END %]
321
365
366
<div id="mana_share_report" class="modal fade" tabindex="-1" role="dialog" arialabelledby="mana_share_modal_label" style="display: none;">
367
    <div class="modal-dialog">
368
        <div class="modal-content">
369
            <div class="modal-header">
370
                <h3 id="mana_share_modal_label">Share with Mana</h3>
371
            </div>
372
            <div class="modal-body">
373
                [% IF (mana_id) %]
374
                    <div class="alert">
375
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
376
                    </div>
377
                [% END %]
378
                [% IF ( languages_loop ) %]
379
                    [% UNLESS ( one_language_enabled ) %]
380
                        <label id="noteerror" type="hidden">Please enter a report name and descriptive note before sharing (minimum 20 characters)</label>
381
                        <div id="shared_infos" class="rows">
382
                                <li> <span class="label">Id: </span><div id="shared_id"></div>
383
                                </li>
384
                                <li> <span class="label">Name: </span><div id="shared_name"></div>
385
                                </li>
386
                                <li> <span class="label">SQL: </span><div id="shared_sql"></div>
387
                                </li>
388
                                <li> <span class="label">Group: </span><div id="shared_group"></div>
389
                                </li>
390
                                <li> <span class="label">Type: </span><div id="shared_type"></div>
391
                                </li>
392
                                <li> <span class="label">Notes: </span><div id="shared_notes"></div>
393
                                </li>
394
395
                        </div>
396
                        <div class="rows">
397
                            <form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl?phase=Share" class="validated" >
398
                                <input type="hidden" name="phase" value="Share">
399
400
                                <fieldset>
401
                                    <label for="mana_language">Language:</label>
402
                                    <select id="mana_language" name="mana_language">
403
                                        [% FOREACH languages_loo IN languages_loop %]
404
                                            [% IF ( languages_loo.group_enabled ) %]
405
                                                [% IF ( languages_loo.plural ) %]
406
                                                    [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
407
                                                        [% IF ( sublanguages_loo.enabled ) %]
408
                                                            [% IF ( sublanguages_loo.sublanguage_current ) %]
409
                                                                <option value="[% languages_loo.rfc4646_subtag %]" selected>
410
                                                                    [% sublanguages_loo.native_description %]
411
                                                                    [% sublanguages_loo.script_description %]
412
                                                                    [% sublanguages_loo.region_description %]
413
414
                                                                    [% sublanguages_loo.variant_description %]
415
                                                                    ([% sublanguages_loo.rfc4646_subtag %])
416
                                                                </option>
417
                                                            [% ELSE %]
418
                                                                <option value="[% languages_loo.rfc4646_subtag %]">
419
                                                                    [% sublanguages_loo.native_description %]
420
                                                                    [% sublanguages_loo.script_description %]
421
                                                                    [% sublanguages_loo.region_description %]
422
                                                                    [% sublanguages_loo.variant_description %]
423
                                                                    ([% sublanguages_loo.rfc4646_subtag %])
424
                                                                </option>
425
                                                            [% END %]
426
                                                        [% END %]
427
                                                    [% END %]
428
                                                [% ELSE %]
429
                                                    [% IF ( languages_loo.group_enabled ) %]
430
                                                        [% IF ( languages_loo.current ) %]
431
                                                            <option value="[% languages_loo.rfc4646_subtag %]" selected>
432
                                                                [% IF ( languages_loo.native_description ) %]
433
                                                                    [% languages_loo.native_description %]
434
                                                                [% ELSE %]
435
                                                                    [% languages_loo.rfc4646_subtag %]
436
                                                                [% END %]
437
                                                            </option>
438
                                                        [% ELSE %]
439
                                                            <option value="[% languages_loo.rfc4646_subtag %]">
440
                                                                [% IF ( languages_loo.native_description ) %]
441
                                                                    [% languages_loo.native_description %]
442
                                                                [% ELSE %]
443
                                                                    [% languages_loo.rfc4646_subtag %]
444
                                                                [% END %]
445
                                                            </option>
446
                                                        [% END %]
447
                                                    [% END %]
448
                                                [% END %]
449
                                            [% END %]
450
                                        [% END %]
451
                                    </select>
452
                                    <input type="hidden" id="reportid" name="reportid" value="[% savedreport.id %]"/>
453
                                </fieldset>
454
                            </form>
455
                        </div>
456
                    [% END %]
457
                [% END %]
458
            </div>
459
            <div class="modal-footer">
460
                <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
461
                [% IF one_language_enabled==0 %]
462
                    <button id="ManaShareButton" type="submit" form="mana_share_form" class="btn btn-primary">Share</button>
463
                [% ELSE %]
464
                    <div id="ManaShareButton" class="btn-group"><a class="btn btn-primary"'onclick="share()">Share</a></div>
465
                [% END %]
466
            </div>
467
        </div>
468
    </div>
469
</div>
470
322
471
323
[% IF ( build1 ) %]
472
[% IF ( build1 ) %]
324
[% IF ( cache_error) %]
473
[% IF ( cache_error) %]
Lines 1022-1027 canned reports and writing custom SQL reports.</p> Link Here
1022
            }
1171
            }
1023
        }
1172
        }
1024
1173
1174
        function share() {
1175
            window.location="/cgi-bin/koha/reports/guided_reports.pl?phase=Save";
1176
        }
1177
1025
        $(document).ready(function(){
1178
        $(document).ready(function(){
1026
1179
1027
            hide_bar_element();
1180
            hide_bar_element();
Lines 1148-1153 canned reports and writing custom SQL reports.</p> Link Here
1148
                window.history.back();
1301
                window.history.back();
1149
            });
1302
            });
1150
1303
1304
            $(".mana_search_button").on("click",function(){
1305
                mana_search($(this).prev().val());
1306
            });
1307
1308
            $(".ShareButton").on("click", function(){
1309
                if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){
1310
                    $("#shared_infos").hide();
1311
                    $("#ManaShareButton").hide();
1312
                    $("#noterror").show();
1313
                }
1314
                else{
1315
                    $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1316
                    $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1317
                    $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1318
                    $("#shared_type").html($(this).closest("tr").find(".report_type").text());
1319
                    $("#shared_group").html($(this).closest("tr").find(".report_group").text());
1320
                    $("#shared_notes").html($(this).closest("tr").find(".report_notes").text());
1321
                }
1322
            });
1323
1324
            $('#search_form').submit(function () {
1325
                return false;
1326
            });
1327
1151
            $("#addColumn").on("click",function(){
1328
            $("#addColumn").on("click",function(){
1152
                addColumn();
1329
                addColumn();
1153
            });
1330
            });
Lines 1339-1344 canned reports and writing custom SQL reports.</p> Link Here
1339
                return confirmDelete(MSG_CONFIRM_DELETE);
1516
                return confirmDelete(MSG_CONFIRM_DELETE);
1340
            });
1517
            });
1341
        });
1518
        });
1519
        function mana_increment(mana_id, resourcename, fieldvalue, stepvalue = 1){
1520
            $.ajax( {
1521
                type: "POST",
1522
                url: "/cgi-bin/koha/svc/mana/addvaluetofield",
1523
                data: {id: mana_id, field: fieldvalue, resource: resourcename, step: stepvalue},
1524
                datatype: "json",
1525
            }).done( function() {
1526
            }).fail( function(){ });
1527
        }
1528
1529
        function mana_use( mana_id ){
1530
            $.ajax( {
1531
                type:"POST",
1532
                url: "/cgi-bin/koha/svc/mana/use",
1533
                data: {id:mana_id, resource: 'report', saveinbase: 1},
1534
                dataType: "json",
1535
            })
1536
            .done( function (result){
1537
                window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&amp;phase=Show%20SQL");
1538
            })
1539
            .fail( function ( foo, msg, longmsg){
1540
            });
1541
        }
1542
1543
        function mana_search( textquery ){
1544
            $.ajax({
1545
                type: "POST",
1546
                url: "/cgi-bin/koha/svc/mana/search",
1547
                data: {biblionumber: $("#biblionumber").val(), resource: 'report', id: textquery, usecomments: 1},
1548
                dataType: "html",
1549
            })
1550
            .done( function( result ) {
1551
                $("#mana_search_result .modal-body").html(result);
1552
                $("#mana_search_result_label").text("Results from Mana Knowledge Base");
1553
                $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
1554
                    "sPaginationType":"four_button",
1555
                    "autoWidth": false,
1556
                    "columnDefs": [
1557
                        { "width": "35%", "targets": 1 }
1558
                    ],
1559
                    "aoColumnDefs": [
1560
                        { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
1561
                        { "sType": "title-string", "aTargets" : [ "title-string" ] },
1562
                        { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
1563
                    ]
1564
                }));
1565
                if($("td.dataTables_empty").length == 0){
1566
                     $("#mana_search").show();
1567
                }
1568
1569
                $( "select[class='actionreport1']" ).show();
1570
                $( "button[class='actionreport2']" ).hide();
1571
                $("#CommentButton").on("click", function(){
1572
                    var resource_type = "report";
1573
                    var target_id = $("#selected_id").val();
1574
                    var manamsg = $("#manamsg").val();
1575
                    mana_comment(target_id, manamsg, resource_type);
1576
                    $("#comment_box").modal("hide");
1577
                });
1578
1579
                $(".showbutton").on("click", function(){
1580
                    $(this).parent().hide();
1581
                    $(this).parent().next().show();
1582
                });
1583
1584
                $("a[class='hidebutton']").on("click", function(){
1585
                    $(this).parent().hide();
1586
                    $(this).parent().prev().show();
1587
                });
1588
1589
                $("#commentCloseButton").on("click", function(){
1590
                    $("#comment_box").modal("hide");
1591
                });
1592
1593
                $(".actionreport1").on("click", function(){
1594
                    $("#selectedcomment").val($(this).val());
1595
                    $(this).parent("select").hide();
1596
                    $(this).parent("select").next().show();
1597
                });
1598
1599
                $(".actionreport2").on("click", function(){
1600
                    $(this).hide();
1601
                    $(this).prev().show();
1602
                    mana_increment($("#selectedcomment").val(), 'resource_comment', 'nb', -1);
1603
                });
1604
            }).fail( function( result ){
1605
            });
1606
        }
1607
1608
        function mana_comment( target_id, manamsg, resource_type ){
1609
            $.ajax( {
1610
                type: "POST",
1611
                url: "/cgi-bin/koha/svc/mana/share",
1612
                data: {message: manamsg, resource: resource_type , resource_id: target_id},
1613
                datatype: "json",
1614
            })
1615
        }
1616
1342
        function addColumn() {
1617
        function addColumn() {
1343
            $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1618
            $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1344
        }
1619
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/mana-subscription-search-result.tt (-1 lines)
Line 1 Link Here
1
[% INCLUDE 'mana-subscription-search-result.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-8 / +12 lines)
Lines 10-16 Link Here
10
<style type="text/css">
10
<style type="text/css">
11
fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
11
fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
12
.yui-u li p label.widelabel {
12
.yui-u li p label.widelabel {
13
    width: 300px;  /* not enough for IE7 apparently */
13
width: 300px;  /* not enough for IE7 apparently */
14
}
14
}
15
</style>
15
</style>
16
</head>
16
</head>
Lines 214-221 fieldset.rows li.radio { width: 100%; } /* override staff-global.css */ Link Here
214
214
215
                <div id="page_2">
215
                <div id="page_2">
216
                    <div class="col-md-6">
216
                    <div class="col-md-6">
217
                [% IF ( Koha.Preference('Mana') == 2) %]
218
                    <fieldset>
219
                        <p><center>You haven't activated the Mana Knowledge Base, click
220
                        <a href=/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=request+to+mana+webservice>here</a>
221
                         to configure.</center></p>
222
                    </fieldset>
223
                [% END %]
224
217
                        <div id="mana_search" class="dialog message">
225
                        <div id="mana_search" class="dialog message">
218
                            <p>Frequency and Numbering pattern have been already proposed for this subscription on Mana. To show results, click <a style="cursor:pointer" data-toggle="modal" data-target="#mana_search_result">Here</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>
219
                        </div>
227
                        </div>
220
                        <div id="subscription_form_planning">
228
                        <div id="subscription_form_planning">
221
                            <fieldset class="rows">
229
                            <fieldset class="rows">
Lines 500-517 fieldset.rows li.radio { width: 100%; } /* override staff-global.css */ Link Here
500
                </div>
508
                </div>
501
            </form>
509
            </form>
502
        </div>
510
        </div>
503
        <div id="mana_search_result" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="width: 90%; left:5%; margin-left: auto; display: none;">
511
        <div id="mana_search_result" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="width: 100%; left:0%; margin-left: auto; display: none;">
504
            <div class="modal-dialog modal-lg">
512
            <div class="modal-dialog modal-lg">
505
                <div class="modal-content">
513
                <div class="modal-content">
506
                    <div class="modal-header">
514
                    <div class="modal-header">
515
                        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
507
                        <h3 id="mana_search_result_label"></h3>
516
                        <h3 id="mana_search_result_label"></h3>
508
                    </div>
517
                    </div>
509
                    <div class="modal-body">
518
                    <div class="modal-body">
510
                    </div>
511
                    <div class="modal-footer">
512
                        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
513
                    </div>
514
                </div>
515
            </div>
519
            </div>
516
        </div>
520
        </div>
517
521
(-)a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js (-5 / +59 lines)
Lines 396-409 function mana_search() { Link Here
396
    $.ajax({
396
    $.ajax({
397
        type: "POST",
397
        type: "POST",
398
        url: "/cgi-bin/koha/svc/mana/search",
398
        url: "/cgi-bin/koha/svc/mana/search",
399
        data: {biblionumber : $("#biblionumber").val()},
399
        data: {id: $("#biblionumber").val(), resource: 'subscription', usecomments: 1},
400
        dataType: "html",
400
        dataType: "html",
401
    })
401
    })
402
    .done( function( result ) {
402
    .done( function( result ) {
403
    $("#mana_search_result .modal-body").html(result);
403
        $("#mana_search_result .modal-body").html(result);
404
        $("#mana_search_result_label").text("Results from Mana");
404
        $("#mana_search_result_label").text("Results from Mana Knowledge Base");
405
        $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
405
        $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
406
            "sPaginationType": "four_button",
406
            "sPaginationType": "four_button",
407
            "order":[[4, "desc"], [5, "desc"]],
408
            "autoWidth": false,
409
            "columnDefs": [
410
                { "width": "35%", "targets": 1 }
411
            ],
407
            "aoColumnDefs": [
412
            "aoColumnDefs": [
408
                { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
413
                { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
409
                { "sType": "title-string", "aTargets" : [ "title-string" ] },
414
                { "sType": "title-string", "aTargets" : [ "title-string" ] },
Lines 413-429 function mana_search() { Link Here
413
        if($("td.dataTables_empty").length == 0){
418
        if($("td.dataTables_empty").length == 0){
414
            $("#mana_search").show();
419
            $("#mana_search").show();
415
        }
420
        }
421
        $( "select[class='actionreport1']" ).show();
422
        $( "button[class='actionreport2']" ).hide();
423
424
        $("#CommentButton").on("click", function(){
425
            var resource_type = "subscription";
426
            var target_id = $("#selected_id").val();
427
            var manamsg = $("#manamsg").val();
428
            mana_comment(target_id, manamsg, resource_type);
429
            $("#comment_box").modal("hide");
430
        });
431
432
        $("#commentCloseButton").on("click", function(){
433
            $("#comment_box").modal("hide");
434
        });
435
436
        $(".actionreport1").on("click", function(){
437
            $("#selectedcomment").val($(this).val());
438
            $(this).parent("select").hide();
439
            $(this).parent("select").next().show();
440
        });
441
442
        $(".actionreport2").on("click", function(){
443
            $(this).hide();
444
            $(this).prev().show();
445
            mana_increment($("#selectedcomment").val(), 'resource_comment', 'nb', -1);
446
        });
447
416
    }).fail(function(result){
448
    }).fail(function(result){
417
    });
449
    });
418
}
450
}
419
451
452
function mana_comment( target_id, manamsg, resource_type ){
453
    $.ajax( {
454
        type: "POST",
455
        url: "/cgi-bin/koha/svc/mana/share",
456
        data: {message: manamsg, resource: resource_type , resource_id: target_id},
457
        datatype: "json",
458
    })
459
}
460
461
function mana_increment(mana_id, resource, fieldvalue, stepvalue = 1){
462
    $.ajax( {
463
        type: "POST",
464
        url: "/cgi-bin/koha/svc/mana/addvaluetofield",
465
        data: {id: mana_id, resource: resource, field: fieldvalue, step: stepvalue},
466
        datatype: "json",
467
    })
468
}
469
420
function mana_use(mana_id){
470
function mana_use(mana_id){
421
    $("tr").removeClass("selected");
471
    $("tr").removeClass("selected");
422
    $("#row"+mana_id).addClass("selected");
472
    $("#row"+mana_id).addClass("selected");
423
    $.ajax( {
473
    $.ajax( {
424
        type: "POST",
474
        type: "POST",
425
        url: "/cgi-bin/koha/svc/mana/use",
475
        url: "/cgi-bin/koha/svc/mana/use",
426
        data: {id : mana_id},
476
        data: {id: mana_id, resource: 'subscription'},
427
        dataType: "json",
477
        dataType: "json",
428
    })
478
    })
429
    .done(function(result){
479
    .done(function(result){
Lines 497-502 function removeDisabledAttr() { Link Here
497
}
547
}
498
548
499
$(document).ready(function() {
549
$(document).ready(function() {
550
    mana_search();
551
    $("#myid").on("click", function(){
552
        debugger;
553
    })
500
    $("#displayexample").hide();
554
    $("#displayexample").hide();
501
    $("#mana_search_result").modal("hide");
555
    $("#mana_search_result").modal("hide");
502
    $("#aqbooksellerid").on('keypress', function(e) {
556
    $("#aqbooksellerid").on('keypress', function(e) {
Lines 606-612 $(document).ready(function() { Link Here
606
    });
660
    });
607
    $("#subscription_add_next").on("click",function(){
661
    $("#subscription_add_next").on("click",function(){
608
        if ( Check_page1() ){
662
        if ( Check_page1() ){
609
            [% IF Koha.Preference('Mana') %]
663
            [% IF Koha.Preference('Mana') == 1 %]
610
                mana_search();
664
                mana_search();
611
            [% END %]
665
            [% END %]
612
            show_page_2();
666
            show_page_2();
(-)a/reports/guided_reports.pl (-1 / +12 lines)
Lines 38-43 use Koha::AuthorisedValues; Link Here
38
use Koha::BiblioFrameworks;
38
use Koha::BiblioFrameworks;
39
use Koha::Libraries;
39
use Koha::Libraries;
40
use Koha::Patron::Categories;
40
use Koha::Patron::Categories;
41
use Koha::SharedContent;
41
42
42
=head1 NAME
43
=head1 NAME
43
44
Lines 145-150 elsif ( $phase eq 'Build new' ) { Link Here
145
        }
146
        }
146
    }
147
    }
147
    $template->param(
148
    $template->param(
149
        'manamsg' => $input->param('manamsg') || '',
148
        'saved1'                => 1,
150
        'saved1'                => 1,
149
        'savedreports'          => $reports,
151
        'savedreports'          => $reports,
150
        'usecache'              => $usecache,
152
        'usecache'              => $usecache,
Lines 547-553 elsif ( $phase eq 'Build report' ) { Link Here
547
549
548
elsif ( $phase eq 'Save' ) {
550
elsif ( $phase eq 'Save' ) {
549
    # Save the report that has just been built
551
    # Save the report that has just been built
550
    my $area           = $input->param('area');
552
    my $area = $input->param('area');
551
    my $sql  = $input->param('sql');
553
    my $sql  = $input->param('sql');
552
    my $type = $input->param('type');
554
    my $type = $input->param('type');
553
    $template->param(
555
    $template->param(
Lines 651-656 elsif ( $phase eq 'Save Report' ) { Link Here
651
                    cache_expiry   => $cache_expiry,
653
                    cache_expiry   => $cache_expiry,
652
                    public         => $public,
654
                    public         => $public,
653
                } );
655
                } );
656
654
                logaction( "REPORTS", "ADD", $id, "$name | $sql" ) if C4::Context->preference("ReportsLog");
657
                logaction( "REPORTS", "ADD", $id, "$name | $sql" ) if C4::Context->preference("ReportsLog");
655
            $template->param(
658
            $template->param(
656
                'save_successful' => 1,
659
                'save_successful' => 1,
Lines 668-673 elsif ( $phase eq 'Save Report' ) { Link Here
668
    }
671
    }
669
}
672
}
670
673
674
elsif ($phase eq 'Share'){
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") ) {
677
        print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&manamsg=success");
678
    }else{
679
        print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&manamsg=fail");
680
    }
681
}
671
elsif ($phase eq 'Run this report'){
682
elsif ($phase eq 'Run this report'){
672
    # execute a saved report
683
    # execute a saved report
673
    my $limit      = $input->param('limit') || 20;
684
    my $limit      = $input->param('limit') || 20;
(-)a/serials/subscription-add.pl (-3 / +6 lines)
Lines 379-385 sub redirect_add_subscription { Link Here
379
    my $mana_id;
379
    my $mana_id;
380
    if ( $query->param('mana_id') ne "" ) {
380
    if ( $query->param('mana_id') ne "" ) {
381
        $mana_id = $query->param('mana_id');
381
        $mana_id = $query->param('mana_id');
382
        Koha::SharedContent::manaNewUserPatchRequest("subscription",$mana_id);
382
        Koha::SharedContent::manaIncrementRequest("subscription",$mana_id, "nbofusers");
383
    }
383
    }
384
    else {
384
    else {
385
        $mana_id = undef;
385
        $mana_id = undef;
Lines 406-412 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
409
    if ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana')) ){
410
        my $result = Koha::SharedContent::manaShareInfos( $query, $loggedinuser, $subscriptionid, 'subscription');
411
        $template->param( mana_code => $result->{code} );
412
    }
410
    my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } );
413
    my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } );
411
    insert_additional_fields( $additional_fields, $biblionumber, $subscriptionid );
414
    insert_additional_fields( $additional_fields, $biblionumber, $subscriptionid );
412
415
Lines 466-472 sub redirect_mod_subscription { Link Here
466
    my $mana_id;
469
    my $mana_id;
467
    if ( defined( $query->param('mana_id') ) ) {
470
    if ( defined( $query->param('mana_id') ) ) {
468
        $mana_id = $query->param('mana_id');
471
        $mana_id = $query->param('mana_id');
469
        Koha::SharedContent::manaNewUserPatchRequest("subscription",$mana_id);
472
        Koha::SharedContent::manaIncrementRequest("subscription",$mana_id, "nbofusers");
470
    }
473
    }
471
    else {
474
    else {
472
        $mana_id = undef;
475
        $mana_id = undef;
(-)a/serials/subscription-detail.pl (-37 / +2 lines)
Lines 104-147 if ($op eq 'del') { Link Here
104
    }
104
    }
105
}
105
}
106
elsif ( $op and $op eq "share" ) {
106
elsif ( $op and $op eq "share" ) {
107
    my $mana_language;
107
    my $result = Koha::SharedContent::manaShareInfos($query, $loggedinuser, $subscriptionid, 'subscription');
108
    if ( $query->param('mana_language') ) {
109
        $mana_language = $query->param('mana_language');
110
    }
111
    else {
112
        $mana_language = C4::Context->preference('language');
113
    }
114
115
    my $mana_email;
116
    if ( $loggedinuser ne 0 ) {
117
        my $borrower = Koha::Patrons->find($loggedinuser);
118
        $mana_email = $borrower->email
119
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
120
        $mana_email = $borrower->emailpro
121
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
122
        $mana_email =
123
          Koha::Libraries->find( C4::Context->userenv->{'branch'} )->branchemail
124
          if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
125
    }
126
    $mana_email = C4::Context->preference('KohaAdminEmailAddress')
127
      if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) );
128
    my %versions = C4::Context::get_versions();
129
130
    my $mana_info = {
131
        language    => $mana_language,
132
        kohaversion => $versions{'kohaVersion'},
133
        exportemail => $mana_email
134
    };
135
    my $sub_mana_info = Koha::Subscription::get_sharable_info($subscriptionid);
136
    $sub_mana_info = { %$sub_mana_info, %$mana_info };
137
    my $result = Koha::SharedContent::manaPostRequest( "subscription",
138
        $sub_mana_info );
139
    if ( $result->{code} eq "200" and $result->{code} eq "201" ) {
140
        my $subscription = Koha::Subscriptions->find($subscriptionid);
141
        $subscription->set( { mana_id => $result->{id} } )->store;
142
        $subs->{mana_id} = $result->{id};
143
    }
144
    $template->param( mana_code => $result->{code} );
108
    $template->param( mana_code => $result->{code} );
109
    $subs->{mana_id} = $result->{id};
145
}
110
}
146
111
147
my $hasRouting = check_routing($subscriptionid);
112
my $hasRouting = check_routing($subscriptionid);
(-)a/svc/mana/addvaluetofield (+42 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2017 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
use Modern::Perl;
22
23
use Koha::SharedContent;
24
use C4::Auth qw(check_cookie_auth);
25
26
use CGI;
27
use JSON;
28
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
my $result = Koha::SharedContent::manaIncrementRequest($input->param('resource'), $input->param('id'), $input->param('field'), $input->param('step') );
42
return $result;
(-)a/svc/mana/search (-8 / +23 lines)
Lines 18-25 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
#
19
#
20
20
21
use strict;
21
use Modern::Perl;
22
use warnings;
23
22
24
use Koha::SharedContent;
23
use Koha::SharedContent;
25
use Koha::Subscription;
24
use Koha::Subscription;
Lines 39-47 if ( $auth_status ne "ok" ) { Link Here
39
    exit 0;
38
    exit 0;
40
}
39
}
41
40
41
my $templatename;
42
$templatename = "mana/mana-".$input->param( "resource" )."-search-result.tt";
43
42
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
44
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
43
    {
45
    {
44
        template_name   => "serials/mana-subscription-search-result.tt",
46
        template_name   => $templatename,
45
        query           => $input,
47
        query           => $input,
46
        type            => "intranet",
48
        type            => "intranet",
47
        authnotrequired => 0,
49
        authnotrequired => 0,
Lines 52-62 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
52
    }
54
    }
53
);
55
);
54
56
55
my $biblionumber = $input->param('biblionumber');
57
my ($identifier, $sub_mana_info);
58
$identifier = $input->param('id');
59
$template->param( lowWarned => 5, warned => 10, highWarned => 20);
60
my $package = "Koha::".ucfirst($input->param( 'resource' ));
61
$sub_mana_info = $package->get_search_info($identifier);
62
63
$sub_mana_info->{ usecomments } = $input->param('usecomments');
64
my $resourcename = $input->param('resource');
65
my $result = Koha::SharedContent::manaGetRequest( $resourcename, $sub_mana_info);
66
my $nbofcomment;
67
foreach my $resource (@{ $result->{data} }){
68
    $nbofcomment = 0;
69
    foreach my $comment (@{ $resource->{comments} }){
70
        $nbofcomment += $comment->{nb};
71
    }
72
    $resource->{nbofcomment} = $nbofcomment;
73
}
56
74
57
my $sub_mana_info = Koha::Subscription::get_search_info($biblionumber);
75
$template->param( $input->param('resource')."s" => $result->{data} );
58
my $result =
59
  Koha::SharedContent::manaGetRequest( "subscription", $sub_mana_info );
60
$template->param( subscriptions => $result->{data} );
61
76
62
output_with_http_headers $input, $cookie, $template->output, 'json';
77
output_with_http_headers $input, $cookie, $template->output, 'json';
(-)a/svc/mana/share (+47 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2017 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
use Modern::Perl;
22
23
use Koha::SharedContent;
24
use C4::Auth qw(check_cookie_auth);
25
26
use CGI;
27
use JSON;
28
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
43
my $content;
44
$content->{resource_id} = $input->param("resource_id");
45
$content->{resource_type} = $input->param("resource");
46
$content->{message} = $input->param("message");
47
Koha::SharedContent::manaPostRequest('resource_comment', $content);
(-)a/svc/mana/use (-8 / +12 lines)
Lines 18-28 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
#
19
#
20
20
21
use strict;
21
use Modern::Perl;
22
use warnings;
23
22
24
use Koha::SharedContent;
23
use Koha::SharedContent;
25
use C4::Auth qw(check_cookie_auth);
24
use C4::Auth qw(check_cookie_auth);
25
use Koha::Report;
26
26
27
use CGI;
27
use CGI;
28
use JSON;
28
use JSON;
Lines 40-48 if ( $auth_status ne "ok" ) { Link Here
40
    exit 0;
40
    exit 0;
41
}
41
}
42
42
43
my $result = Koha::SharedContent::manaGetRequestWithId("subscription", $input->param('id') );
43
my $result = Koha::SharedContent::manaGetRequestWithId($input->param('resource'), $input->param('id') );
44
my $package = "Koha::".ucfirst($input->param('resource'));
45
my $resource;
44
46
45
my $subscription;
47
if ( $input->param( 'saveinbase' )) {
46
$subscription = $result->{data};
48
    $resource = { id => $package->new_from_mana($result->{data})->id };
47
49
}
48
print(to_json($subscription));
50
else{
51
    $resource = $result->{data};
52
}
53
print(to_json($resource));
49
- 

Return to bug 17047