From a809f90f0229c1e9e6ed8f3655cf0a90de0db3bb Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Tue, 16 Jan 2018 10:41:51 +0000 Subject: [PATCH] Bug 17047 - Fix template code in subscription-add.js Fix errors when saving a serial Provide a more visible message when sharing a report without note Fix Internal server error when trying to share a new report Make update DB idempotent --- Koha/SharedContent.pm | 1 - .../mysql/atomicupdate/mana_01-add_mana_id.perl | 13 +++++++ .../mana_01-add_mana_id_in_subscription.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 +- .../prog/en/includes/reports-toolbar.inc | 7 ---- .../prog/en/includes/serials-toolbar.inc | 40 ---------------------- .../en/modules/reports/guided_reports_start.tt | 29 +++++++++++----- .../prog/en/modules/serials/serials-search.tt | 1 + .../prog/en/modules/serials/subscription-add.tt | 2 ++ koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js | 3 ++ .../intranet-tmpl/prog/js/subscription-add.js | 4 +-- serials/subscription-add.pl | 4 +-- 14 files changed, 46 insertions(+), 66 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 diff --git a/Koha/SharedContent.pm b/Koha/SharedContent.pm index ca484c1..a6b8584 100644 --- a/Koha/SharedContent.pm +++ b/Koha/SharedContent.pm @@ -178,7 +178,6 @@ sub buildRequest { my $url = "$MANA_IP/$resource.json"; my $request = HTTP::Request->new( POST => $url ); - $content->{bulk_import} = 0; my $json = to_json( $content, { utf8 => 1 } ); $request->content($json); diff --git a/installer/data/mysql/atomicupdate/mana_01-add_mana_id.perl b/installer/data/mysql/atomicupdate/mana_01-add_mana_id.perl new file mode 100644 index 0000000..1e5fdbd --- /dev/null +++ b/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"; +} diff --git a/installer/data/mysql/atomicupdate/mana_01-add_mana_id_in_subscription.sql b/installer/data/mysql/atomicupdate/mana_01-add_mana_id_in_subscription.sql deleted file mode 100644 index a7443db..0000000 --- a/installer/data/mysql/atomicupdate/mana_01-add_mana_id_in_subscription.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE subscription ADD mana_id int(11) NULL DEFAULT NULL; -ALTER TABLE saved_sql ADD mana_id int(11) NULL DEFAULT NULL; 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 f5cc363..a8b3519 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 +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('AutoShareWithMana','','','defines datas automatically shared with mana','multiple'); diff --git a/installer/data/mysql/atomicupdate/mana_04-add_mana_token.sql b/installer/data/mysql/atomicupdate/mana_04-add_mana_token.sql index 200f3e5..3c94ccd 100644 --- a/installer/data/mysql/atomicupdate/mana_04-add_mana_token.sql +++ b/installer/data/mysql/atomicupdate/mana_04-add_mana_token.sql @@ -1,2 +1,2 @@ -INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('ManaToken','',NULL,'Security token used for authentication on Mana KB service (anti spam)','Textarea'); diff --git a/installer/data/mysql/atomicupdate/skeleton.perl b/installer/data/mysql/atomicupdate/skeleton.perl index 66e599c..c63e6eb 100644 --- a/installer/data/mysql/atomicupdate/skeleton.perl +++ b/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" ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc index e6b80a9..056498b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc @@ -1,4 +1,3 @@ -[% INCLUDE 'mana.inc' %]
[% IF ( CAN_user_reports_create_reports ) %]
@@ -125,12 +124,6 @@ [% END %] [% IF subscriptionid and ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription || CAN_user_serials_receive_serials ) %]
[% IF CAN_user_serials_create_subscription %] 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 7217dfa..ac58e97 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 @@ -324,10 +324,12 @@ canned reports and writing custom SQL reports.

Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.

[% END %] + [% IF ( languages_loop ) %] [% UNLESS ( one_language_enabled ) %] - -
+
  • Id:
  • Name:
    @@ -346,7 +348,7 @@ canned reports and writing custom SQL reports.

    -
    +
    [% MACRO jsinclude BLOCK %] [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'mana.inc' %] [% IF ( saved1 ) %] [% INCLUDE 'datatables.inc' %] [% END %] @@ -1094,11 +1097,15 @@ Sub report: } }); + $("#ManaCloseButton").on("click", function() { + $(".shared_infos").show(); + }); + $("#addColumn").on("click",function(){ addColumn(); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt index 0779c15..1ca0713 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt @@ -433,6 +433,7 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'calendar.inc' %] [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'mana.inc' %]