Bugzilla – Attachment 76681 Details for
Bug 17047
Mana Knowledge Base : Data sharing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[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
Bug-17047---Fix-template-code-in-subscription-addj.patch (text/plain), 14.55 KB, created by
Alex Arnaud
on 2018-07-04 13:34:59 UTC
(
hide
)
Description:
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
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2018-07-04 13:34:59 UTC
Size:
14.55 KB
patch
obsolete
>From 909b64a03094370d91442b24f5fd3f4b9974a553 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >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 > >Rebased-by: Alex Arnaud <alex.arnaud@biblibre.com> (2018-07-04) >--- > 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 | 6 ----- > .../prog/en/includes/serials-toolbar.inc | 2 +- > .../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, 47 insertions(+), 26 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 d08193c..429a97a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >@@ -132,12 +132,6 @@ > [% END %] > > <script type="text/javascript"> >- $(document).ready( function(){ >- $(".mana_search_button").on("click",function(){ >- mana_search($("#mana_search_field").val()); >- }); >- }); >- > function mana_use( mana_id ){ > $.ajax( { > type:"POST", >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc >index cdc194e..ffa83ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc >@@ -38,7 +38,7 @@ > }); > }); > //]]> >- </script> >+</script> > [% IF subscriptionid and ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription || CAN_user_serials_receive_serials ) %] > <div id="toolbar" class="btn-toolbar"> > [% 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 5ac9805..fbdc4c0 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 >@@ -336,10 +336,12 @@ canned reports and writing custom SQL reports.</p> > <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p> > </div> > [% END %] >+ <div id="note-error" class="alert alert-danger" role="alert"> >+ Please enter a report name and descriptive note before sharing (minimum 20 characters) >+ </div> > [% IF ( languages_loop ) %] > [% UNLESS ( one_language_enabled ) %] >- <label id="noteerror" type="hidden">Please enter a report name and descriptive note before sharing (minimum 20 characters)</label> >- <div id="shared_infos" class="rows"> >+ <div class="shared_infos rows"> > <li> <span class="label">Id: </span><div id="shared_id"></div> > </li> > <li> <span class="label">Name: </span><div id="shared_name"></div> >@@ -358,7 +360,7 @@ canned reports and writing custom SQL reports.</p> > <form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl?phase=Share" class="validated" > > <input type="hidden" name="phase" value="Share"> > >- <fieldset> >+ <fieldset class="shared_infos"> > <label for="mana_language">Language:</label> > <select id="mana_language" name="mana_language"> > [% FOREACH languages_loo IN languages_loop %] >@@ -418,11 +420,11 @@ canned reports and writing custom SQL reports.</p> > [% END %] > </div> > <div class="modal-footer"> >- <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> >+ <button class="btn" id="ManaCloseButton" data-dismiss="modal" aria-hidden="true">Close</button> > [% IF one_language_enabled==0 %] >- <button id="ManaShareButton" type="submit" form="mana_share_form" class="btn btn-primary">Share</button> >+ <button id="ManaShareButton" type="submit" form="mana_share_form" class="btn btn-primary shared_infos">Share</button> > [% ELSE %] >- <div id="ManaShareButton" class="btn-group"><a class="btn btn-primary">Share</a></div> >+ <div id="ManaShareButton" class="btn-group"><a class="btn btn-primary shared_infos">Share</a></div> > [% END %] > </div> > </div> >@@ -1055,6 +1057,7 @@ $(document).ready(function() { > > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'mana.inc' %] > [% IF ( saved1 ) %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >@@ -1106,11 +1109,15 @@ $(document).ready(function() { > window.history.back(); > }); > >+ $(".mana_search_button").on("click",function(){ >+ mana_search($("#mana_search_field").val()); >+ }); >+ > $(".ShareButton").on("click", function(){ >+ $("#note-error").hide(); > if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){ >- $("#shared_infos").hide(); >- $("#ManaShareButton").hide(); >- $("#noterror").show(); >+ $(".shared_infos").hide(); >+ $("#note-error").show(); > } > else{ > $("#shared_id").html($(this).closest("tr").find(".report_id").text()); >@@ -1122,6 +1129,10 @@ $(document).ready(function() { > } > }); > >+ $("#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 bb1042d..718993c 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 >@@ -415,6 +415,7 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'mana.inc' %] > <script type="text/javascript"> > var subscriptionid = "[% subscriptionid %]"; > var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index deb380d..1be60ef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -512,6 +512,7 @@ width: 300px; /* not enough for IE7 apparently */ > > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> > var subscriptionid = "[% subscriptionid %]"; > var irregularity = "[% irregularity %]"; >@@ -520,6 +521,7 @@ width: 300px; /* not enough for IE7 apparently */ > [% FOREACH field IN dont_export_field_loop %] > tags.push("[% field.fieldid %]"); > [% END %] >+ var mana_enabled = [% Koha.Preference('Mana') %] > var MSG_LINK_TO_VENDOR = _("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor"); > var MSG_LINK_BIBLIO = _("You must choose or create a bibliographic record"); > var MSG_REQUIRED_SUB_LENGTH = _("You must choose a subscription length or an end date."); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js b/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js >index 1f181c2..fe575d0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js >@@ -40,4 +40,7 @@ function popup(subscriptionid) { > popup( subscriptionid ); > return false; > }); >+ $("#mana-subscription-share").click(function() { >+ window.location="subscription-detail.pl?subscriptionid=[% subscriptionid %]&op=share"; >+ }); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >index 0eb311b..3981995 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >@@ -617,9 +617,9 @@ $(document).ready(function() { > }); > $("#subscription_add_next").on("click",function(){ > if ( Check_page1() ){ >- [% IF Koha.Preference('Mana') == 1 %] >+ if ( mana_enabled ) { > mana_search(); >- [% END %] >+ } > show_page_2(); > } > }); >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index e9af612..6bee879 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -302,7 +302,7 @@ sub redirect_add_subscription { > )->store(); > $periodicity = $subscription_freq->id; > } >- my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing($query->Vars); >+ my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing({ $query->Vars }); > > my $auser = $query->param('user'); > my $branchcode = $query->param('branchcode'); >@@ -409,7 +409,7 @@ sub redirect_mod_subscription { > )->store(); > $periodicity = $subscription_freq->id; > } >- my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing($query->Vars); >+ my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing({ $query->Vars }); > > my $subtype = $query->param('subtype'); > my $sublength = $query->param('sublength'); >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17047
:
56175
|
56176
|
56177
|
56178
|
56179
|
56180
|
56181
|
59728
|
59729
|
59931
|
61905
|
62045
|
62046
|
62047
|
62048
|
62049
|
62050
|
62051
|
62052
|
62053
|
62054
|
62075
|
62465
|
62475
|
62485
|
62540
|
62542
|
62543
|
62544
|
62545
|
62546
|
62547
|
62548
|
62549
|
62550
|
62551
|
62552
|
62553
|
62589
|
62591
|
62592
|
62593
|
62594
|
62595
|
62596
|
62597
|
62598
|
62599
|
62603
|
62604
|
62605
|
62606
|
62607
|
62768
|
63476
|
63601
|
63618
|
63619
|
63620
|
63621
|
63622
|
63623
|
64484
|
64530
|
64618
|
64619
|
64620
|
64621
|
64622
|
64623
|
64624
|
64625
|
64626
|
64627
|
64628
|
64629
|
64630
|
64631
|
64632
|
64633
|
64634
|
64635
|
64636
|
64637
|
64638
|
64639
|
64640
|
64641
|
64642
|
64643
|
64648
|
64649
|
64650
|
64651
|
64652
|
64653
|
64654
|
64706
|
64962
|
65058
|
65059
|
65060
|
65061
|
65062
|
65063
|
65064
|
65065
|
65773
|
66667
|
66668
|
66987
|
67003
|
67004
|
67005
|
67006
|
67009
|
67010
|
67011
|
67012
|
67013
|
67014
|
67015
|
67016
|
67017
|
67018
|
67019
|
67020
|
67021
|
67022
|
67023
|
69034
|
69035
|
69036
|
69037
|
69038
|
69039
|
69040
|
69041
|
69091
|
70203
|
70204
|
70205
|
70206
|
70208
|
70209
|
70210
|
70211
|
70561
|
70874
|
72660
|
72661
|
72662
|
72663
|
72664
|
72665
|
72666
|
72667
|
72668
|
72669
|
72670
|
73699
|
73737
|
73738
|
73739
|
73740
|
73741
|
73742
|
73743
|
73744
|
73745
|
73746
|
73747
|
73748
|
73975
|
73976
|
73977
|
73978
|
73979
|
73980
|
73981
|
73982
|
73983
|
73984
|
73985
|
73986
|
76673
|
76674
|
76675
|
76676
|
76677
|
76678
|
76679
|
76680
|
76681
|
76682
|
76683
|
76684
|
78215
|
78216
|
78217
|
78218
|
78219
|
78220
|
78221
|
78222
|
78223
|
78224
|
78225
|
78226
|
78227
|
78228
|
78229
|
79868
|
79869
|
79870
|
79871
|
79872
|
79874
|
79877
|
79878
|
79879
|
79880
|
79881
|
79882
|
79883
|
79884
|
79885
|
79886
|
79887
|
79888
|
79922
|
79923
|
79924
|
79925
|
79926
|
79927
|
79928
|
79929
|
79930
|
79931
|
79932
|
79933
|
79934
|
79935
|
79936
|
79937
|
79938
|
79939
|
80183
|
80184
|
80185
|
80186
|
80187
|
80188
|
80189
|
80190
|
80191
|
80192
|
80193
|
80194
|
80195
|
80196
|
80197
|
80198
|
80199
|
80200
|
80471
|
80472
|
80473
|
80907
|
80908
|
80909
|
80910
|
80911
|
80912
|
80913
|
80914
|
80915
|
80916
|
80917
|
80918
|
80919
|
80920
|
80921
|
80922
|
80923
|
80924
|
81935
|
81936
|
81937
|
81938
|
81939
|
81940
|
81941
|
81942
|
81943
|
81944
|
81945
|
81946
|
81947
|
81948
|
81949
|
81950
|
81951
|
81952
|
81968
|
83863
|
83864
|
83865
|
83866
|
83867
|
83868
|
83869
|
83870
|
83871
|
83872
|
83873
|
83874
|
83875
|
83876
|
83877
|
83878
|
83879
|
83880
|
83881
|
83892
|
83893
|
83894
|
83895
|
83896
|
83897
|
83898
|
83899
|
83900
|
83901
|
83902
|
83903
|
83904
|
83905
|
83906
|
83907
|
83908
|
83909
|
83910
|
83911
|
83912
|
84142
|
84145
|
84210
|
84260
|
84261
|
84262
|
84263
|
84264
|
84265
|
84323
|
84324
|
84325
|
84326
|
84327
|
84328
|
84329
|
84332