From dd2cdd865db4ea3d6e2ba02d4720c3537d15885d Mon Sep 17 00:00:00 2001 From: Baptiste Wojtkowski Date: Wed, 31 May 2017 12:27:59 +0000 Subject: [PATCH] Bug 17047: Minor changes - search on reports module is now also validated by pressing enter. - AutoShare now initialized with nothing autmaticaly shared. - To create a report you now have to click on New report => New report from Mana. - Error messages are displayed in case of fail --- .../atomicupdate/mana_03-add_mana_autoshare.sql | 2 +- .../en/includes/mana/mana-report-search-result.inc | 2 +- .../prog/en/includes/reports-toolbar.inc | 148 ++++++++++++++++++++- .../en/modules/reports/guided_reports_start.tt | 125 ++--------------- .../prog/en/modules/serials/subscription-add.tt | 21 ++- reports/guided_reports.pl | 1 + svc/mana/share | 19 +++ 7 files changed, 197 insertions(+), 121 deletions(-) diff --git a/installer/data/mysql/atomicupdate/mana_03-add_mana_autoshare.sql b/installer/data/mysql/atomicupdate/mana_03-add_mana_autoshare.sql index 353ffc1..f5cc363 100644 --- a/installer/data/mysql/atomicupdate/mana_03-add_mana_autoshare.sql +++ b/installer/data/mysql/atomicupdate/mana_03-add_mana_autoshare.sql @@ -1,2 +1,2 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES -('AutoShareWithMana','subscription','','defines datas automatically shared with mana','multiple'); +('AutoShareWithMana','','','defines datas automatically shared with mana','multiple'); 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 455f453..2de9fea 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 @@ -30,7 +30,7 @@ [% END %] [% IF ( report.report_name ) %][% report.report_name %][% END %] -
+
[% IF report.notes.length > 200 %] [% report.notes.substr(0,200) %]Show More
[% END %] @@ -64,12 +67,155 @@ [% END %]
+ +[% IF Koha.Preference('Mana')==1 %] + +[% END %] + + + + + 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 624e232..1fe073e 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 @@ -81,10 +81,6 @@ $(".goback").on("click",function(e){ window.history.back(); }); -$(".mana_search_button").on("click",function(){ - mana_search($(this).prev().val()); -}); - $(".ShareButton").on("click", function(){ if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){ $("#shared_infos").hide(); @@ -101,9 +97,6 @@ $(".ShareButton").on("click", function(){ } }); -$('#search_form').submit(function () { - return false; -}); $("#addColumn").on("click",function(){ addColumn(); @@ -283,104 +276,6 @@ $("#delColumn").on("click",function(){ [% END %] }); -function mana_increment(mana_id, resourcename, fieldvalue, stepvalue = 1){ - $.ajax( { - type: "POST", - url: "/cgi-bin/koha/svc/mana/addvaluetofield", - data: {id: mana_id, field: fieldvalue, resource: resourcename, step: stepvalue}, - datatype: "json", - }).done( function() { - }).fail( function(){ }); -} - -function mana_use( mana_id ){ - $.ajax( { - type:"POST", - url: "/cgi-bin/koha/svc/mana/use", - data: {id:mana_id, resource: 'report', saveinbase: 1}, - dataType: "json", - }) - .done( function (result){ - window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL"); - }) - .fail( function ( foo, msg, longmsg){ - }); -} - -function mana_search( textquery ){ - $.ajax({ - type: "POST", - url: "/cgi-bin/koha/svc/mana/search", - data: {biblionumber: $("#biblionumber").val(), resource: 'report', id: textquery, usecomments: 1}, - dataType: "html", - }) - .done( function( result ) { - $("#mana_search_result .modal-body").html(result); - $("#mana_search_result_label").text("Results from Mana Knowledge Base"); - $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{ - "sPaginationType":"four_button", - "autoWidth": false, - "columnDefs": [ - { "width": "35%", "targets": 1 } - ], - "aoColumnDefs": [ - { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, - { "sType": "title-string", "aTargets" : [ "title-string" ] }, - { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] } - ] - })); - if($("td.dataTables_empty").length == 0){ - $("#mana_search").show(); - } - - $( "select[class='actionreport1']" ).show(); - $( "button[class='actionreport2']" ).hide(); - $("#CommentButton").on("click", function(){ - var resource_type = "report"; - var target_id = $("#selected_id").val(); - var manamsg = $("#manamsg").val(); - mana_comment(target_id, manamsg, resource_type); - $("#comment_box").modal("hide"); - }); - - $(".showbutton").on("click", function(){ - $(this).parent().hide(); - $(this).parent().next().show(); - }); - - $("a[class='hidebutton']").on("click", function(){ - $(this).parent().hide(); - $(this).parent().prev().show(); - }); - - $("#commentCloseButton").on("click", function(){ - $("#comment_box").modal("hide"); - }); - - $(".actionreport1").on("click", function(){ - $("#selectedcomment").val($(this).val()); - $(this).parent("select").hide(); - $(this).parent("select").next().show(); - }); - - $(".actionreport2").on("click", function(){ - $(this).hide(); - $(this).prev().show(); - mana_increment($("#selectedcomment").val(), 'resource_comment', 'nb', -1); - }); - }).fail( function( result ){ - }); -} - -function mana_comment( target_id, manamsg, resource_type ){ - $.ajax( { - type: "POST", - url: "/cgi-bin/koha/svc/mana/share", - data: {message: manamsg, resource: resource_type , resource_id: target_id}, - datatype: "json", - }) -} - @@ -492,6 +387,13 @@ canned reports and writing custom SQL reports.

+[% IF report_converted %] +
+ The report "[% report_converted %]" has been converted. +
+[% END %] + + [% IF ( saved1 ) %] [% IF ( savedreports ) %]

Saved reports

@@ -516,14 +418,8 @@ canned reports and writing custom SQL reports.

[% END %] - [% IF (Koha.Preference('Mana') == 1) %] - - [% END %] - -

[% savedreport.sql %]

+
@@ -1280,6 +1176,11 @@ Sub report: