@@ -, +, @@ - add a value "no, let me think about it", that is the default value. - as long as this value is selected, messages ask if user want to activate it ( in Administration and Add-subscription(page 2) ) - Add the syspref AutoShareWithMana: user can automatically share infos with Mana-KB (not set by default) - On mana-search, rows are now sorted by date of last import, then by number of users - Windows redesigned to improve the user experience - people can now report an invalid data (wrong, obsolete,...) - if a data is reported as invalid many time, it will appear differently - Added few tooltip (to explain the fields last import, nb of users, to explain the new feature) - When reporting a data as invalid, a comment can also be added. Koha will then display comments related to data in result lists - add svc/mana/addvaluetofield: allows to ask mana incrementing a field of a resource - no hardcoding for resources in the code of api (api needs to be called with a ressourcename) - Create Koha::Report.pm and Koha::Reports.pm, objects class for Reports - New feature: share reports with Mana-KB - New feature: search report in Mana-KB with keywords - New feature: load reports from Mana-KB 1 - Apply Patch + update database 2 - Copy the three lines about mana config in etc/koha-conf.xml in ../etc/koha-conf.xml (after for example) https://mana-kb.koha-community.org 3 - Check Mana syspref and AutoShareWithMana syspref are not activated 4 - Search the syspref ManaToken and follow the instructions 5 - subscriptions - Try create a new subscription for a first serial => Mana-KB shouldn't show you anything (except if the base hase been filled) - Share this serial with Mana-KB (on the serial individual's page there must be a Share button) - Try to create a new subscription for serial nr1 => a message should appear when you click on "next", click on "use", the fields should automaticaly appear - Activate AutoShareWithMana => Subscriptions - Create a new subscription for a second serial - There shouldn't be any Share button - Create a second subscription => the message should appear, click again on use 6 - SQL Report - Create a new SQL report, without notes. - On the table with all report (reports > use saved), there should be the action "Share" - If you click on share, you have an error message - Create a new report, with a title and notes longer than 20 characters - You can share it with mana => you will have a success message - On (report > use saved), there must be a message inviting you to search on Mana-KB for more results, enter a few word from title, notes, type of the report you shared, it should appear. You can use it, it will load it into your report list. 7 - Report mistakes. - On any table containing Mana-KB search results, you can report a mistake and add a comment. 8 - For each previous test, try to send wrong data, to delete the security token, to send nothing: it should show a correct warning message. --- C4/Reports/Guided.pm | 1 + C4/Serials.pm | 7 + Koha/Report.pm | 57 ++++ Koha/Reports.pm | 6 + Koha/SharedContent.pm | 196 +++++++++--- Koha/Subscription.pm | 14 +- Koha/Subscription/Numberpatterns.pm | 34 ++- debian/templates/koha-conf-site.xml.in | 3 + etc/koha-conf.xml | 4 + .../mysql/atomicupdate/mana_01-add_mana_id.perl | 13 + .../mana_01-add_mana_id_in_subscription.sql | 1 - .../atomicupdate/mana_02-add_Mana_syspref.sql | 2 +- .../atomicupdate/mana_03-add_mana_autoshare.sql | 2 + .../mysql/atomicupdate/mana_04-add_mana_token.sql | 2 + installer/data/mysql/atomicupdate/skeleton.perl | 2 +- installer/data/mysql/kohastructure.sql | 2 + installer/data/mysql/sysprefs.sql | 2 +- koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js | 18 ++ .../intranet-tmpl/prog/css/src/staff-global.scss | 6 + .../intranet-tmpl/prog/en/includes/calendar.inc | 2 +- .../includes/mana-subscription-search-result.inc | 46 --- koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc | 44 +++ .../en/includes/mana/mana-report-search-result.inc | 81 +++++ .../mana/mana-subscription-search-result.inc | 92 ++++++ .../prog/en/includes/reports-toolbar.inc | 138 +++++++++ .../prog/en/includes/serials-toolbar.inc | 53 +++- .../prog/en/modules/admin/admin-home.tt | 7 +- .../prog/en/modules/admin/preferences.tt | 1 + .../en/modules/admin/preferences/web_services.pref | 17 +- .../en/modules/mana/mana-report-search-result.tt | 1 + .../mana/mana-subscription-search-result.tt | 1 + .../en/modules/reports/guided_reports_start.tt | 170 ++++++++++- .../serials/mana-subscription-search-result.tt | 1 - .../prog/en/modules/serials/serials-search.tt | 3 +- .../prog/en/modules/serials/subscription-add.tt | 25 +- .../prog/en/modules/serials/subscription-detail.tt | 9 +- koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js | 3 + .../intranet-tmpl/prog/js/subscription-add.js | 44 ++- reports/guided_reports.pl | 19 +- serials/serials-collection.pl | 2 +- serials/serials-search.pl | 5 +- serials/subscription-add.pl | 69 ++--- serials/subscription-detail.pl | 48 +-- svc/mana/increment | 48 +++ svc/mana/search | 37 ++- svc/mana/share | 69 +++++ svc/mana/token | 55 ++++ svc/mana/use | 22 +- t/db_dependent/Koha/SharedContent.t | 227 +++++++++++++- t/db_dependent/Koha/Subscription.t | 4 +- t/db_dependent/Koha/Subscription/Numberpatterns.t | 97 ++++++ t/db_dependent/Serials.t | 2 +- t/db_dependent/Serials/GetFictiveIssueNumber.t | 332 ++++++++++++++------- 53 files changed, 1778 insertions(+), 368 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/mana_01-add_mana_id.perl delete mode 100644 installer/data/mysql/atomicupdate/mana_01-add_mana_id_in_subscription.sql create mode 100644 installer/data/mysql/atomicupdate/mana_03-add_mana_autoshare.sql create mode 100644 installer/data/mysql/atomicupdate/mana_04-add_mana_token.sql create mode 100644 koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana-subscription-search-result.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/mana/mana-report-search-result.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/mana/mana-subscription-search-result.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/serials/mana-subscription-search-result.tt create mode 100755 svc/mana/increment create mode 100755 svc/mana/share create mode 100755 svc/mana/token create mode 100644 t/db_dependent/Koha/Subscription/Numberpatterns.t --- a/C4/Reports/Guided.pm +++ a/C4/Reports/Guided.pm @@ -33,6 +33,7 @@ use C4::Log; use Koha::AuthorisedValues; use Koha::Patron::Categories; +use Koha::SharedContent; BEGIN { require Exporter; --- a/C4/Serials.pm +++ a/C4/Serials.pm @@ -35,6 +35,7 @@ use Koha::DateUtils; use Koha::Serial; use Koha::Subscriptions; use Koha::Subscription::Histories; +use Koha::SharedContent; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -280,6 +281,12 @@ sub GetSubscription { }); $subscription->{additional_fields} = $additional_field_values->{$subscriptionid}; + if ( my $mana_id = $subscription->{mana_id} ) { + my $mana_subscription = Koha::SharedContent::get_entity_by_id( + 'subscription', $mana_id, {usecomments => 1}); + $subscription->{comments} = $mana_subscription->{data}->{comments}; + } + return $subscription; } --- a/Koha/Report.pm +++ a/Koha/Report.pm @@ -20,6 +20,8 @@ use Modern::Perl; use Carp; use Koha::Database; +use JSON; +use Koha::Reports; use base qw(Koha::Object); @@ -33,6 +35,61 @@ Koha::Report - Koha Report Object class =cut +=head3 get_search_info + +Return search info + +=cut + +sub get_search_info { + my $self = shift; + my $sub_mana_info = { 'query' => shift }; + return $sub_mana_info; +} + +=head3 get_sharable_info + +Return properties that can be shared. + +=cut + +sub get_sharable_info { + my $self = shift; + my $shared_report_id = shift; + my $report = Koha::Reports->find($shared_report_id); + my $sub_mana_info = { + 'savedsql' => $report->savedsql, + 'report_name' => $report->report_name, + 'notes' => $report->notes, + 'report_group' => $report->report_group, + 'type' => $report->type, + }; + return $sub_mana_info; +} + +=head3 new_from_mana + +Clear a Mana report to be imported in Koha? + +=cut + +sub new_from_mana { + my $self = shift; + my $data = shift; + + $data->{mana_id} = $data->{id}; + + delete $data->{exportemail}; + delete $data->{kohaversion}; + delete $data->{creationdate}; + delete $data->{lastimport}; + delete $data->{id}; + delete $data->{nbofusers}; + delete $data->{language}; + + Koha::Report->new($data)->store; +} + =head3 _type Returns name of corresponding DBIC resultset --- a/Koha/Reports.pm +++ a/Koha/Reports.pm @@ -55,4 +55,10 @@ sub object_class { return 'Koha::Report'; } +=head1 AUTHOR + +Kyle M Hall + +=cut + 1; --- a/Koha/SharedContent.pm +++ a/Koha/SharedContent.pm @@ -22,69 +22,191 @@ use JSON; use HTTP::Request; use LWP::UserAgent; -our $MANA_IP = "http://10.25.159.107:5000"; +use Koha::Serials; +use Koha::Reports; +use C4::Context; -sub manaRequest { +=head1 DESCRIPTION + +Package for accessing shared content via Mana + +=head2 Package Functions + +=cut + +=head3 process_request + +=cut + +sub process_request { my $mana_request = shift; my $result; - $mana_request->content_type('application/json'); my $userAgent = LWP::UserAgent->new; - my $response = $userAgent->request($mana_request); - - if ( $response->code ne "204" ) { - $result = from_json( $response->decoded_content ); + if ( $mana_request->method eq "POST" ){ + my $content; + if ($mana_request->content) {$content = from_json( $mana_request->content )}; + $content->{securitytoken} = C4::Context->preference("ManaToken"); + $mana_request->content( to_json($content) ); } + + my $response = $userAgent->request($mana_request); + + eval { $result = from_json( $response->decoded_content, { utf8 => 1} ); }; $result->{code} = $response->code; + if ( $@ ){ + $result->{msg} = $@; + } + if ($response->is_error){ + $result->{msg} = "An error occurred, mana server returned: " . $response->message; + } + return $result ; +} + +=head3 increment_entity_value + +=cut - return $result if ( $response->code =~ /^2..$/ ); +sub increment_entity_value { + return process_request(build_request('increment', @_)); } -sub manaNewUserPatchRequest { - my $resource = shift; - my $id = shift; +=head3 send_entity + +=cut + +sub send_entity { + my ($lang, $loggedinuser, $resourceid, $resourcetype, $content) = @_; - my $url = "$MANA_IP/$resource/$id.json/newUser"; - my $request = HTTP::Request->new( PATCH => $url ); + unless ( $content ) { + $content = prepare_entity_data($lang, $loggedinuser, $resourceid, $resourcetype); + } + + my $result = process_request(build_request('post', $resourcetype, $content)); - return manaRequest($request); + if ( $result and ($result->{code} eq "200" or $result->{code} eq "201") ) { + my $packages = "Koha::".ucfirst($resourcetype)."s"; + my $resource = $packages->find($resourceid); + eval { $resource->set( { mana_id => $result->{id} } )->store }; + } + return $result; } -sub manaPostRequest { - my $resource = shift; - my $content = shift; +=head3 prepare_entity_data + +=cut - my $url = "$MANA_IP/$resource.json"; - my $request = HTTP::Request->new( POST => $url ); +sub prepare_entity_data { + my ($lang, $loggedinuser, $ressourceid, $ressourcetype) = @_; + $lang ||= C4::Context->preference('language'); - $content->{bulk_import} = 0; - my $json = to_json( $content, { utf8 => 1 } ); - $request->content($json); + my $mana_email; + if ( $loggedinuser ne 0 ) { + my $borrower = Koha::Patrons->find($loggedinuser); + $mana_email = $borrower->first_valid_email_address + || Koha::Libraries->find( C4::Context->userenv->{'branch'} )->branchemail + } + $mana_email = C4::Context->preference('KohaAdminEmailAddress') + if ( ( not defined($mana_email) ) or ( $mana_email eq '' ) ); - return manaRequest($request); + my %versions = C4::Context::get_versions(); + + my $mana_info = { + language => $lang, + kohaversion => $versions{'kohaVersion'}, + exportemail => $mana_email + }; + + my $ressource_mana_info; + my $packages = "Koha::".ucfirst($ressourcetype)."s"; + my $package = "Koha::".ucfirst($ressourcetype); + $ressource_mana_info = $package->get_sharable_info($ressourceid); + $ressource_mana_info = { %$ressource_mana_info, %$mana_info }; + + return $ressource_mana_info; +} + +=head3 get_entity_by_id + +=cut + +sub get_entity_by_id { + return process_request(build_request('getwithid', @_)); +} + +=head3 search_entities + +=cut + +sub search_entities { + return process_request(build_request('get', @_)); } -sub manaGetRequestWithId { +=head3 build_request + +=cut + +sub build_request { + my $type = shift; my $resource = shift; - my $id = shift; + my $mana_url = get_sharing_url(); + + if ( $type eq 'get' ) { + my $params = shift; + $params = join '&', + map { defined $params->{$_} ? $_ . "=" . $params->{$_} : () } + keys %$params; + my $url = "$mana_url/$resource.json?$params"; + return HTTP::Request->new( GET => $url ); + } + + if ( $type eq 'getwithid' ) { + my $id = shift; + my $params = shift; + $params = join '&', + map { defined $params->{$_} ? $_ . "=" . $params->{$_} : () } + keys %$params; + + my $url = "$mana_url/$resource/$id.json?$params"; + return HTTP::Request->new( GET => $url ); + } + + if ( $type eq 'post' ) { + my $content = shift; - my $url = "$MANA_IP/$resource/$id.json"; - my $request = HTTP::Request->new( GET => $url ); + my $url = "$mana_url/$resource.json"; + my $request = HTTP::Request->new( POST => $url ); - return manaRequest($request); + my $json = to_json( $content, { utf8 => 1 } ); + $request->content($json); + + return $request; + } + + if ( $type eq 'increment' ) { + my $id = shift; + my $field = shift; + my $step = shift; + my $param; + + $param->{step} = $step || 1; + $param->{id} = $id; + $param->{resource} = $resource; + $param = join '&', + map { defined $param->{$_} ? $_ . "=" . $param->{$_} : () } + keys %$param; + my $url = "$mana_url/$resource/$id.json/increment/$field?$param"; + my $request = HTTP::Request->new( POST => $url ); + + } } -sub manaGetRequest { - my $resource = shift; - my $parameters = shift; +=head3 get_sharing_url - $parameters = join '&', - map { defined $parameters->{$_} ? $_ . "=" . $parameters->{$_} : () } - keys %$parameters; - my $url = "$MANA_IP/$resource.json?$parameters"; - my $request = HTTP::Request->new( GET => $url ); +=cut - return manaRequest($request); +sub get_sharing_url { + return C4::Context->config('mana_config'); } 1; --- a/Koha/Subscription.pm +++ a/Koha/Subscription.pm @@ -125,13 +125,15 @@ sub frequency { return Koha::Subscription::Frequency->_new_from_dbic($frequency_rs); } -=head3 type +=head3 get_search_info =cut sub get_search_info { + my $self=shift; my $searched_sub_id = shift; my $biblio = Koha::Biblios->find( { 'biblionumber' => $searched_sub_id } ); + return unless $biblio; my $biblioitem = Koha::Biblioitems->find( { 'biblionumber' => $searched_sub_id } ); @@ -144,7 +146,12 @@ sub get_search_info { return $sub_mana_info; } +=head3 get_sharable_info + +=cut + sub get_sharable_info { + my $self = shift; my $shared_sub_id = shift; my $subscription = Koha::Subscriptions->find($shared_sub_id); my $biblio = Koha::Biblios->find( $subscription->biblionumber ); @@ -189,6 +196,11 @@ sub get_sharable_info { return $sub_mana_info; } + +=head3 _type + +=cut + sub _type { return 'Subscription'; } --- a/Koha/Subscription/Numberpatterns.pm +++ a/Koha/Subscription/Numberpatterns.pm @@ -32,7 +32,7 @@ Koha::SubscriptionNumberpatterns - Koha SubscriptionNumberpattern object set cla =cut -=head3 uniqeLabel +=head3 uniqueLabel =cut @@ -52,6 +52,38 @@ sub uniqueLabel { return $label; } +=head3 new_or_existing + +=cut + +sub new_or_existing { + my ($self, $params) = @_; + + my $params_np; + if ( $params->{'numbering_pattern'} eq 'mana' ) { + foreach (qw/numberingmethod label1 add1 every1 whenmorethan1 setto1 + numbering1 label2 add2 every2 whenmorethan2 setto2 numbering2 + label3 add3 every3 whenmorethan3 setto3 numbering3/) { + $params_np->{$_} = $params->{$_} if $params->{$_}; + } + + my $existing = Koha::Subscription::Numberpatterns->search($params_np)->next(); + + if ($existing) { + return $existing->id; + } + + $params_np->{label} = Koha::Subscription::Numberpatterns->uniqueLabel($params->{'patternname'}); + $params_np->{description} = $params->{'sndescription'}; + + + my $subscription_np = Koha::Subscription::Numberpattern->new()->set($params_np)->store(); + return $subscription_np->id; + } + + return $params->{'numbering_pattern'}; +} + =head3 type =cut --- a/debian/templates/koha-conf-site.xml.in +++ a/debian/templates/koha-conf-site.xml.in @@ -285,6 +285,9 @@ __END_SRU_PUBLICSERVER__ __LOG_DIR__ /usr/share/doc/koha-common /var/spool/koha/__KOHASITE__ + + + https://mana-kb.koha-community.org --- a/etc/koha-conf.xml +++ a/etc/koha-conf.xml @@ -153,6 +153,10 @@ __PAZPAR2_TOGGLE_XML_POST__ __KOHA_CONF_DIR__/sms_send/ + + + http://mana-kb.koha-community.org + 50 2 --- a/installer/data/mysql/atomicupdate/mana_01-add_mana_id.perl +++ a/installer/data/mysql/atomicupdate/mana_01-add_mana_id.perl @@ -0,0 +1,13 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + if( !column_exists( 'subscription', 'mana_id' ) ) { + $dbh->do( "ALTER TABLE subscription ADD mana_id int(11) NULL DEFAULT NULL" ); + } + + if( !column_exists( 'saved_sql', 'mana_id' ) ) { + $dbh->do( "ALTER TABLE saved_sql ADD mana_id int(11) NULL DEFAULT NULL" ); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 17047 - Add column mana_id in subscription and saved_sql tables)\n"; +} --- a/installer/data/mysql/atomicupdate/mana_01-add_mana_id_in_subscription.sql +++ a/installer/data/mysql/atomicupdate/mana_01-add_mana_id_in_subscription.sql @@ -1, +0,0 @@ -ALTER TABLE subscription ADD mana_id int(11); --- a/installer/data/mysql/atomicupdate/mana_02-add_Mana_syspref.sql +++ a/installer/data/mysql/atomicupdate/mana_02-add_Mana_syspref.sql @@ -1, +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'); +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 +++ a/installer/data/mysql/atomicupdate/mana_03-add_mana_autoshare.sql @@ -0,0 +1,2 @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('AutoShareWithMana','','','defines datas automatically shared with mana','multiple'); --- a/installer/data/mysql/atomicupdate/mana_04-add_mana_token.sql +++ a/installer/data/mysql/atomicupdate/mana_04-add_mana_token.sql @@ -0,0 +1,2 @@ +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('ManaToken','',NULL,'Security token used for authentication on Mana KB service (anti spam)','Textarea'); --- a/installer/data/mysql/atomicupdate/skeleton.perl +++ a/installer/data/mysql/atomicupdate/skeleton.perl @@ -1,4 +1,4 @@ -$DBversion = 'XXX'; # will be replaced by the RM +$DBversion = 'XXX'; if( CheckVersion( $DBversion ) ) { # you can use $dbh here like: # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" ); --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1462,6 +1462,7 @@ CREATE TABLE saved_sql ( -- saved sql reports report_area varchar(6) default NULL, report_group varchar(80) default NULL, report_subgroup varchar(80) default NULL, + `mana_id` int(11) NULL DEFAULT NULL, PRIMARY KEY (`id`), KEY sql_area_group_idx (report_group, report_subgroup), KEY boridx (`borrowernumber`) @@ -2127,6 +2128,7 @@ CREATE TABLE `subscription` ( -- information related to the subscription `reneweddate` date default NULL, -- date of last renewal for the subscription `itemtype` VARCHAR( 10 ) NULL, `previousitemtype` VARCHAR( 10 ) NULL, + `mana_id` int(11) NULL DEFAULT NULL, PRIMARY KEY (`subscriptionid`), KEY `by_biblionumber` (`biblionumber`), CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE, --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -66,6 +66,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'), ('AutoEmailOpacUser','0',NULL,'Sends notification emails containing new account details to patrons - when account is created.','YesNo'), ('AutoEmailPrimaryAddress','OFF','email|emailpro|B_email|cardnumber|OFF','Defines the default email address where \'Account Details\' emails are sent.','Choice'), +('AutoShareWithMana','subscription','','defines datas automatically shared with mana','multiple'), ('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff client from unauthorized IP addresses','YesNo'), ('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'), ('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'), @@ -275,7 +276,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('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'), -('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','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'), --- a/koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js +++ a/koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js @@ -0,0 +1,18 @@ +$(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; + }); +}); --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -717,6 +717,12 @@ ol { background-color: #FFD000 !important; } +.warned-row, +.warned-row td { background-color: #FF9000 !important } + +.high-warned-row, +.high-warned-row td { background-color: #FF0000 !important } + tbody { tr { &:nth-child(odd) { --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -118,7 +118,7 @@ jQuery(function($){ dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")], weekHeader: _("Wk"), dateFormat: "[% IF ( dateformat == "us" ) %]mm/dd/yy[% ELSIF ( dateformat == "metric" ) %]dd/mm/yy[% ELSIF ( dateformat == "dmydot" ) %]dd.mm.yy[% ELSE %]yy-mm-dd[% END %]", - firstDay: [% Koha.Preference('CalendarFirstDayOfWeek') | html %], + firstDay: '[% Koha.Preference('CalendarFirstDayOfWeek') | html %]', isRTL: [% IF ( bidi ) %]true[% ELSE %]false[% END %], showMonthAfterYear: false, yearSuffix: ''}; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana-subscription-search-result.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/mana-subscription-search-result.inc @@ -1,46 +0,0 @@ -[% USE KohaDates %] - - - - - - - - - - [% UNLESS search_only %] - - [% END %] - - - - - - - - - - - [% UNLESS search_only %] - - [% END %] - - - - [% FOREACH subscription IN subscriptions %] - [% UNLESS subscription.cannotdisplay %] - - - - - - - - [% UNLESS search_only %] - - [% END %] - - [% END %] - [% END %] - -
ISSNTitleFrequencyNumbering patternNumber of usersLast ImportActions
[% IF ( subscription.issn ) %][% subscription.issn %][% END %][% subscription.title %][% IF ( subscription.sfdescription ) %][% subscription.sfdescription %][% END %][% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod %][% END %][% IF ( subscription.nbofusers ) %][% subscription.nbofusers %][% END %][% subscription.lastimport | $KohaDates %] Use
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc @@ -0,0 +1,44 @@ + --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc @@ -0,0 +1,81 @@ +[% USE KohaDates %] +[% USE Koha %] +[% USE AuthorisedValues %] +[% USE Branches %] + + +[% INCLUDE 'mana.inc' %] + +[% IF statuscode == "200" AND reports %] + + + + + + + + + + [% UNLESS search_only %] + + [% END %] + + + + [% FOREACH report IN reports %] + [% UNLESS report.cannotdisplay %] + [% IF report.nbofcomment > highWarned %] + + [% ELSIF report.nbofcomment > warned %] + + [% ELSIF report.nbofcomment > lowWarned %] + + [% END %] + + + + [% END %] + + + + + + [% UNLESS search_only %] + + [% END %] + + [% END %] + [% END %] + +
Report NameNotesType# of usersLast import Comments Actions
[% IF ( report.report_name ) %][% report.report_name %][% END %]
+ [% IF report.notes.length > 200 %] + [% report.notes.substr(0,200) %]Show More
[% report.type %] [% IF ( report.nbofusers ) %][% report.nbofusers %][% END %][% report.lastimport | $KohaDates %][% FOREACH comment IN report.comments %][% comment.message %] ([% comment.nb %])
[% END %]
+ +
+[% ELSE %] +

[% msg %] statuscode: [% statuscode %]

+[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc @@ -0,0 +1,92 @@ +[% USE KohaDates %] +[% USE Koha %] +[% USE AuthorisedValues %] +[% USE Branches %] +[% INCLUDE 'mana.inc' %] + + +[% IF statuscode == "200" %] + + + + + + + + + + + + [% UNLESS search_only %] + + [% END %] + + + + [% FOREACH subscription IN subscriptions %] + [% UNLESS subscription.cannotdisplay %] + [% IF subscription.nbofcomment > highWarned %] + + [% ELSIF subscription.nbofcomment > warned %] + + [% ELSIF subscription.nbofcomment > lowWarned %] + + [% END %] + + + + + + + + + + + [% UNLESS search_only %] + + [% END %] + + [% END %] + [% END %] + +
ISSNTitle Published by FrequencyNumbering pattern# of usersLast import Comments Actions
[% IF ( subscription.issn ) %][% subscription.issn %][% END %][% subscription.title %][% IF ( subscription.publishercode ) %][% subscription.publishercode %][% END %][% IF ( subscription.sfdescription ) %][% subscription.sfdescription %][% END %][% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod %][% END %][% IF ( subscription.nbofusers ) %][% subscription.nbofusers %][% END %][% subscription.lastimport | $KohaDates %][% FOREACH comment IN subscription.comments %][% comment.message %] ([% comment.nb %])
[% END %]
+ + + +
+[% ELSE %] +

Mana search fails with the code: [% statuscode %]

+[% END %] + + --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc @@ -6,6 +6,9 @@ [% END %] @@ -47,6 +50,40 @@ [% END %] + [% IF ( mana_id && Koha.Preference('Mana') == 1 ) %] +
+ + +
+ + + [% END %] + [% IF ( execute ) %] [% BLOCK params %] [%- FOREACH param IN sql_params %]&sql_params=[% param | uri %][% END %] @@ -77,3 +114,104 @@ [% END %] + +[% IF Koha.Preference('Mana')==1 %] + +[% END %] + + --- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc @@ -7,11 +7,11 @@ [% ELSE %] [% END %] - [% IF Koha.Preference('Mana') %] + [% IF Koha.Preference('Mana') and Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %] [% IF one_language_enabled==0 or mana_id %] - + [% ELSE %] - + [% END %] [% END %] [% END %] @@ -60,6 +60,40 @@ [% END %] [% END %] [% END %] + + [% IF ( mana_id && Koha.Preference('Mana') == 1 ) %] +
+ + +
+ + + [% END %] [% ELSIF CAN_user_serials_create_subscription %]
@@ -80,18 +114,17 @@