From 62bdd35979172c726fb2062a6888063e93d47ba4 Mon Sep 17 00:00:00 2001 From: Kyle M Hall <kyle@bywatersolutions.com> Date: Fri, 8 Sep 2017 08:48:24 -0400 Subject: [PATCH] Bug 17047 [QA Followup] - Fix misc koha-qa.pl failures - Fix up database schema change, add to kohastructure.sql - Update schema files - Remove javascript debugger call Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com> --- Koha/Report.pm | 25 +++++++++-------- Koha/Schema/Result/SavedSql.pm | 7 +++++ Koha/Schema/Result/Subscription.pm | 7 +++++ Koha/SharedContent.pm | 32 ++++++++++++++++++++++ Koha/Subscription.pm | 11 +++++++- Koha/Subscription/Numberpatterns.pm | 2 +- .../mana_01-add_mana_id_in_subscription.sql | 4 +-- installer/data/mysql/kohastructure.sql | 2 ++ .../en/modules/admin/preferences/web_services.pref | 2 +- serials/serials-collection.pl | 2 +- t/db_dependent/Serials.t | 2 +- 11 files changed, 78 insertions(+), 18 deletions(-) diff --git a/Koha/Report.pm b/Koha/Report.pm index a1d9b56..0458480 100644 --- a/Koha/Report.pm +++ b/Koha/Report.pm @@ -42,7 +42,7 @@ Return search info =cut sub get_search_info { - my $self=shift; + my $self = shift; my $sub_mana_info = { 'query' => shift }; return $sub_mana_info; } @@ -54,15 +54,15 @@ 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, + 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, + 'type' => $report->type, }; return $sub_mana_info; } @@ -73,17 +73,20 @@ Clear a Mana report to be imported in Koha? =cut -sub new_from_mana{ +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}; - $data->{mana_id} = $data->{id}; delete $data->{id}; delete $data->{nbofusers}; delete $data->{language}; + Koha::Report->new($data)->store; } diff --git a/Koha/Schema/Result/SavedSql.pm b/Koha/Schema/Result/SavedSql.pm index 622f588..c12dd7f 100644 --- a/Koha/Schema/Result/SavedSql.pm +++ b/Koha/Schema/Result/SavedSql.pm @@ -105,6 +105,11 @@ __PACKAGE__->table("saved_sql"); is_nullable: 1 size: 80 +=head2 mana_id + + data_type: 'integer' + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -148,6 +153,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 80 }, "report_subgroup", { data_type => "varchar", is_nullable => 1, size => 80 }, + "mana_id", + { data_type => "integer", is_nullable => 1 }, ); =head1 PRIMARY KEY diff --git a/Koha/Schema/Result/Subscription.pm b/Koha/Schema/Result/Subscription.pm index c493b73..f24e1f1 100644 --- a/Koha/Schema/Result/Subscription.pm +++ b/Koha/Schema/Result/Subscription.pm @@ -271,6 +271,11 @@ __PACKAGE__->table("subscription"); is_nullable: 1 size: 10 +=head2 mana_id + + data_type: 'integer' + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -358,6 +363,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 10 }, "previousitemtype", { data_type => "varchar", is_nullable => 1, size => 10 }, + "mana_id", + { data_type => "integer", is_nullable => 1 }, ); =head1 PRIMARY KEY diff --git a/Koha/SharedContent.pm b/Koha/SharedContent.pm index 55d10c5..30619d4 100644 --- a/Koha/SharedContent.pm +++ b/Koha/SharedContent.pm @@ -28,6 +28,18 @@ use C4::Context; our $MANA_IP = C4::Context->config('mana_config'); +=head1 DESCRIPTION + +Package for accessing shared content via Mana + +=head2 Package Functions + +=cut + +=head3 manaRequest + +=cut + sub manaRequest { my $mana_request = shift; my $result; @@ -53,6 +65,10 @@ sub manaRequest { return $result ; } +=head3 manaIncrementRequest + +=cut + sub manaIncrementRequest { my $resource = shift; my $id = shift; @@ -71,6 +87,10 @@ sub manaIncrementRequest { return manaRequest($request); } +=head3 manaPostRequest + +=cut + sub manaPostRequest { my $resource = shift; my $content = shift; @@ -84,6 +104,10 @@ sub manaPostRequest { return manaRequest($request); } +=head3 manaShareInfos + +=cut + sub manaShareInfos{ my ($query, $loggedinuser, $ressourceid, $ressourcetype) = @_; my $mana_language; @@ -132,6 +156,10 @@ sub manaShareInfos{ return $result; } +=head3 manaGetRequestWithId + +=cut + sub manaGetRequestWithId { my $resource = shift; my $id = shift; @@ -142,6 +170,10 @@ sub manaGetRequestWithId { return manaRequest($request); } +=head3 manaGetRequest + +=cut + sub manaGetRequest { my $resource = shift; my $parameters = shift; diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm index 24595a5..8c41b5d 100644 --- a/Koha/Subscription.pm +++ b/Koha/Subscription.pm @@ -53,7 +53,7 @@ sub biblio { return scalar Koha::Biblios->find($self->biblionumber); } -=head3 type +=head3 get_search_info =cut @@ -74,6 +74,10 @@ 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; @@ -120,6 +124,11 @@ sub get_sharable_info { return $sub_mana_info; } + +=head3 _type + +=cut + sub _type { return 'Subscription'; } diff --git a/Koha/Subscription/Numberpatterns.pm b/Koha/Subscription/Numberpatterns.pm index 638e028..271deb0 100644 --- a/Koha/Subscription/Numberpatterns.pm +++ b/Koha/Subscription/Numberpatterns.pm @@ -32,7 +32,7 @@ Koha::SubscriptionNumberpatterns - Koha SubscriptionNumberpattern object set cla =cut -=head3 uniqeLabel +=head3 uniqueLabel =cut 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 index 66c23ac..a7443db 100644 --- 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 @@ -1,2 +1,2 @@ -ALTER TABLE subscription ADD mana_id int(11); -ALTER TABLE saved_sql ADD mana_id int(11); +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/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 52f0922..fd72e7d 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1429,6 +1429,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`) @@ -2088,6 +2089,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`), CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref index 4160853..ed1c34e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref @@ -65,7 +65,7 @@ Web services: - "Security token used to authenticate on mana:" - pref: ManaToken class: Text - - <br> You need a security token to authenticate on Mana. If this sytem preference is empty, please fill in the following form, you will receive an email to confirm and activate your token. <script src=/intranet-tmpl/lib/jquery/activatemana.js></script> <br> <form> Firstname <input name="firstname" type="text" id="firstname"> <br> Lastname <input name="lastname" type=text id=lastname> <br> email <input name="email" type=text id=email><br> <input type=submit id=activatemana value="Send"></form> + - <br> You need a security token to authenticate on Mana. If this sytem preference is empty, please fill in the following form, you will receive an email to confirm and activate your token. <script src=/intranet-tmpl/lib/jquery/activatemana.js></script> <br> <form> First name <input name="firstname" type="text" id="firstname"> <br> Last name <input name="lastname" type=text id=lastname> <br> Email address <input name="email" type=text id=email><br> <input type=submit id=activatemana value="Send"></form> - - 'Fields automatically shared with mana' - pref: AutoShareWithMana diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl index 3c21c1e..ea3f6ed 100755 --- a/serials/serials-collection.pl +++ b/serials/serials-collection.pl @@ -81,7 +81,7 @@ if($op eq 'gennext' && @subscriptionid){ ) = GetNextSeq($subscription, $pattern, $frequency, $expected->{publisheddate}); ## We generate the next publication date - my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); + $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); my $nextpublisheddate = GetNextDate($subscription, $expected->{publisheddate}, $frequency, 1); ## Creating the new issue NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t index 96ed4ca..9c5c849 100755 --- a/t/db_dependent/Serials.t +++ b/t/db_dependent/Serials.t @@ -289,7 +289,7 @@ my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscrip ( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid ); my $publisheddate = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); ( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid ); -my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); +$frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); my $nextpublisheddate = C4::Serials::GetNextDate($subscription, $publisheddate, $frequency, 1); my @statuses = qw( 2 2 3 3 3 3 3 4 4 41 42 43 44 5 ); # Add 14 serials -- 2.1.4