Bugzilla – Attachment 121986 Details for
Bug 28565
Adding a new syspref for sharing through HEA should be simpler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28565: Move the sysprefs to a reusable sub
Bug-28565-Move-the-sysprefs-to-a-reusable-sub.patch (text/plain), 2.97 KB, created by
David Nind
on 2021-06-15 11:11:44 UTC
(
hide
)
Description:
Bug 28565: Move the sysprefs to a reusable sub
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-06-15 11:11:44 UTC
Size:
2.97 KB
patch
obsolete
>From b80b679c70f1fe999feaa207c602776bead1b9d5 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 14 Jun 2021 17:44:30 -0300 >Subject: [PATCH] Bug 28565: Move the sysprefs to a reusable sub > >This patch moves the big sysprefs list to a sub. Behavior shouldn't >change. > >To test: >1. Run: > $ kshell > k$ prove t/db_dependent/UsageStats.t >=> SUCCESS: Things work as expected, no changes. >2. Sign off :-D > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/UsageStats.pm | 83 ++++++++++++++++++++++++++++-------------------- > 1 file changed, 48 insertions(+), 35 deletions(-) > >diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm >index 1fa95bcb5f..3904075d51 100644 >--- a/C4/UsageStats.pm >+++ b/C4/UsageStats.pm >@@ -87,8 +87,52 @@ sub BuildReport { > } > > # Get systempreferences. >- foreach ( >- qw/ >+ foreach ( @{ _shared_preferences() } ) >+ { >+ $report->{systempreferences}{$_} = C4::Context->preference($_); >+ } >+ return $report; >+} >+ >+=head2 ReportToCommunity >+ >+ ReportToCommunity; >+ >+Send to hea.koha-community.org database informations >+ >+=cut >+ >+sub ReportToCommunity { >+ my $data = shift; >+ my $json = encode_json($data); >+ >+ my $url = "https://hea.koha-community.org/upload.pl"; >+ my $ua = LWP::UserAgent->new; >+ my $res = $ua->post( >+ $url, >+ 'Content-type' => 'application/json;charset=utf-8', >+ Content => $json, >+ ); >+ my $content = decode_json( $res->decoded_content ); >+ if ( $content->{koha_id} ) { >+ C4::Context->set_preference( 'UsageStatsID', $content->{koha_id} ); >+ } >+ if ( $content->{id} ) { >+ C4::Context->set_preference( 'UsageStatsPublicID', $content->{id} ); >+ } >+} >+ >+=head2 _shared_preferences >+ >+ my $preferences = C4::UsageStats::_shared_preferences >+ >+Returns an I<arreyref> with the system preferences to be shared. >+ >+=cut >+ >+sub _shared_preferences { >+ >+ my @preferences = qw/ > AcqCreateItem > AcqWarnOnDuplicateInvoice > AcqViewBaskets >@@ -324,40 +368,9 @@ sub BuildReport { > ILS-DI > OAI-PMH > version >- / >- ) >- { >- $report->{systempreferences}{$_} = C4::Context->preference($_); >- } >- return $report; >-} >- >-=head2 ReportToCommunity >- >- ReportToCommunity; >- >-Send to hea.koha-community.org database informations >- >-=cut >+ /; > >-sub ReportToCommunity { >- my $data = shift; >- my $json = encode_json($data); >- >- my $url = "https://hea.koha-community.org/upload.pl"; >- my $ua = LWP::UserAgent->new; >- my $res = $ua->post( >- $url, >- 'Content-type' => 'application/json;charset=utf-8', >- Content => $json, >- ); >- my $content = decode_json( $res->decoded_content ); >- if ( $content->{koha_id} ) { >- C4::Context->set_preference( 'UsageStatsID', $content->{koha_id} ); >- } >- if ( $content->{id} ) { >- C4::Context->set_preference( 'UsageStatsPublicID', $content->{id} ); >- } >+ return \@preferences; > } > > =head2 _count >-- >2.20.1
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 28565
:
121938
|
121939
|
121986
|
121987
|
122289
|
122353
|
122354
|
123167
|
123168