diff --git a/Koha/Subscription/Frequency.pm b/Koha/Subscription/Frequency.pm index d7d06dc3c0..64dd327861 100644 --- a/Koha/Subscription/Frequency.pm +++ b/Koha/Subscription/Frequency.pm @@ -25,11 +25,7 @@ use base qw(Koha::Object); =head1 NAME -<<<<<<< b4c9007cc708d995838eae801a5a24b47435095e -Koha::Subscription::Frequency - Koha Subscription Frequency Object class -======= Koha::Subscription::Frequency - Koha Subscription::Frequency Object class ->>>>>>> Bug 17047 subscriptions management with Mana-KB =head1 API diff --git a/admin/admin-home.pl b/admin/admin-home.pl index ae16bf6680..f6a7b23ac1 100755 --- a/admin/admin-home.pl +++ b/admin/admin-home.pl @@ -25,6 +25,7 @@ use Koha::Plugins; my $query = new CGI; my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins"); +my $mana_url = C4::Context->config('mana_config'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -38,5 +39,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); $template->param( plugins_enabled => $plugins_enabled, ); +$template->param( mana_url => $mana_url, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/admin/share_content.pl b/admin/share_content.pl new file mode 100755 index 0000000000..d900b3e6d6 --- /dev/null +++ b/admin/share_content.pl @@ -0,0 +1,89 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use CGI qw ( -utf8 ); +use JSON; +use HTTP::Request; + +use C4::Auth; +use C4::Output; + +use Koha::SharedContent; + +my $query = new CGI; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "admin/share_content.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { parameters => '*' }, + debug => 1, + } +); + +my $op = $query->param('op') || q||; + +if ( $op eq 'save' ) { + my $auto_share = $query->param('autosharewithmana'); + my $mana = $query->param('mana'); + + C4::Context->set_preference('Mana', $mana); + + if ( $auto_share ne '' ) { + C4::Context->set_preference('AutoShareWithMana', 'subscription'); + } else { + C4::Context->set_preference('AutoShareWithMana', ''); + } +} + +if ( $op eq 'reset' ) { + C4::Context->set_preference('ManaToken', ''); +} + +if ( $op eq 'send' ) { + my $name = $query->param('lastname'); + my $firstname = $query->param('firstname'); + my $email = $query->param('email'); + + my $content = to_json({firstname => $firstname, + lastname => $name, + email => $email}); + + my $mana_ip = C4::Context->config('mana_config'); + my $url = "$mana_ip/getsecuritytoken"; + my $request = HTTP::Request->new( POST => $url ); + $request->content($content); + my $result = Koha::SharedContent::process_request($request); + + $template->param( result => $result ); + + if ( $result->{code} eq '201' && $result->{token} ) { + C4::Context->set_preference('ManaToken', $result->{token}); + } +} + + +my $mana_url = C4::Context->config('mana_config') || ''; + +$template->param( + mana_url => $mana_url, +); + +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/installer/data/mysql/atomicupdate/mana_02-add_Mana_syspref.sql b/installer/data/mysql/atomicupdate/mana_02-add_Mana_syspref.sql index dda85a5409..2a3c2738a8 100644 --- a/installer/data/mysql/atomicupdate/mana_02-add_Mana_syspref.sql +++ b/installer/data/mysql/atomicupdate/mana_02-add_Mana_syspref.sql @@ -1 +1,2 @@ -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'); +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('Mana','1',NULL,'request to Mana Webservice. Mana centralize common 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.','YesNo'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index f94efd63f9..bc012d370f 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -275,7 +275,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('LocalHoldsPriorityItemControl', 'holdingbranch', 'holdingbranch|homebranch', 'decides if the feature operates using the item''s home or holding library.', 'Choice'), ('LocalHoldsPriorityPatronControl', 'PickupLibrary', 'HomeLibrary|PickupLibrary', 'decides if the feature operates using the library set as the patron''s home library, or the library set as the pickup library for the given hold.', 'Choice'), ('makePreviousSerialAvailable','0','','make previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.','YesNo'), -('Mana','1',NULL,'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.','YesNo'), +('Mana','1',NULL,'request to Mana Webservice. Mana centralize common 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.','YesNo'), ('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'), ('MARCAuthorityControlField008','|| aca||aabn | a|a d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'), ('MarcFieldDocURL', NULL, NULL, 'URL used for MARC field documentation. Following substitutions are available: {MARC} = marc flavour, eg. "MARC21" or "UNIMARC". {FIELD} = field number, eg. "000" or "048". {LANG} = user language, eg. "en" or "fi-FI"', 'free'), diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js b/koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js deleted file mode 100644 index 0e9b2e2eb2..0000000000 --- a/koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js +++ /dev/null @@ -1,18 +0,0 @@ -$(document).ready(function(){ - $("#activatemana").on("click", function(){ - var mylastname = $("#lastname").val() - var myfirstname = $("#firstname").val() - var myemail = $("#email").val() - $.ajax( { - type: "POST", - url: "/cgi-bin/koha/svc/mana/token", - data: { lastname: mylastname, firstname: myfirstname, email: myemail}, - dataType: "json", - }) - .done(function(result){ - $("#pref_ManaToken").val(result.token); - $("#pref_ManaToken").trigger("input"); - }); - return false; - }); -}); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc index b95600cb7b..fca1b12e3f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc @@ -2,6 +2,7 @@ [% USE Koha %] [% USE AuthorisedValues %] [% USE Branches %] +[% USE raw %] +[% END %] +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index 17d3ccba15..b8c4b0c24a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -137,7 +137,7 @@ canned reports and writing custom SQL reports.

[% IF report_converted %]
- The report "[% report_converted %]" has been converted. + The report "[% report_converted | html %]" has been converted.
[% END %] @@ -179,7 +179,7 @@ canned reports and writing custom SQL reports.

[% IF manamsg %] [% END %] @@ -355,85 +355,78 @@ canned reports and writing custom SQL reports.

- [% IF ( languages_loop ) %] - [% UNLESS ( one_language_enabled ) %] -
-
  • Id:
    -
  • -
  • Name:
    -
  • -
  • SQL:
    -
  • -
  • Group:
    -
  • -
  • Type:
    -
  • -
  • Notes:
    -
  • - -
    -
    -
    - - -
    - - + + [% IF (languages_loop) %] +
    + + - -
    - -
    - [% END %] - [% END %] + [% END %] + + + [% ELSE %] + + [% END %] + + +