|
Lines 87-94
sub BuildReport {
Link Here
|
| 87 |
} |
87 |
} |
| 88 |
|
88 |
|
| 89 |
# Get systempreferences. |
89 |
# Get systempreferences. |
| 90 |
foreach ( |
90 |
foreach ( @{ _shared_preferences() } ) |
| 91 |
qw/ |
91 |
{ |
|
|
92 |
$report->{systempreferences}{$_} = C4::Context->preference($_); |
| 93 |
} |
| 94 |
return $report; |
| 95 |
} |
| 96 |
|
| 97 |
=head2 ReportToCommunity |
| 98 |
|
| 99 |
ReportToCommunity; |
| 100 |
|
| 101 |
Send to hea.koha-community.org database informations |
| 102 |
|
| 103 |
=cut |
| 104 |
|
| 105 |
sub ReportToCommunity { |
| 106 |
my $data = shift; |
| 107 |
my $json = encode_json($data); |
| 108 |
|
| 109 |
my $url = "https://hea.koha-community.org/upload.pl"; |
| 110 |
my $ua = LWP::UserAgent->new; |
| 111 |
my $res = $ua->post( |
| 112 |
$url, |
| 113 |
'Content-type' => 'application/json;charset=utf-8', |
| 114 |
Content => $json, |
| 115 |
); |
| 116 |
my $content = decode_json( $res->decoded_content ); |
| 117 |
if ( $content->{koha_id} ) { |
| 118 |
C4::Context->set_preference( 'UsageStatsID', $content->{koha_id} ); |
| 119 |
} |
| 120 |
if ( $content->{id} ) { |
| 121 |
C4::Context->set_preference( 'UsageStatsPublicID', $content->{id} ); |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
=head2 _shared_preferences |
| 126 |
|
| 127 |
my $preferences = C4::UsageStats::_shared_preferences |
| 128 |
|
| 129 |
Returns an I<arreyref> with the system preferences to be shared. |
| 130 |
|
| 131 |
=cut |
| 132 |
|
| 133 |
sub _shared_preferences { |
| 134 |
|
| 135 |
my @preferences = qw/ |
| 92 |
AcqCreateItem |
136 |
AcqCreateItem |
| 93 |
AcqWarnOnDuplicateInvoice |
137 |
AcqWarnOnDuplicateInvoice |
| 94 |
AcqViewBaskets |
138 |
AcqViewBaskets |
|
Lines 325-364
sub BuildReport {
Link Here
|
| 325 |
ILS-DI |
369 |
ILS-DI |
| 326 |
OAI-PMH |
370 |
OAI-PMH |
| 327 |
version |
371 |
version |
| 328 |
/ |
372 |
/; |
| 329 |
) |
|
|
| 330 |
{ |
| 331 |
$report->{systempreferences}{$_} = C4::Context->preference($_); |
| 332 |
} |
| 333 |
return $report; |
| 334 |
} |
| 335 |
|
| 336 |
=head2 ReportToCommunity |
| 337 |
|
| 338 |
ReportToCommunity; |
| 339 |
|
| 340 |
Send to hea.koha-community.org database informations |
| 341 |
|
| 342 |
=cut |
| 343 |
|
373 |
|
| 344 |
sub ReportToCommunity { |
374 |
return \@preferences; |
| 345 |
my $data = shift; |
|
|
| 346 |
my $json = encode_json($data); |
| 347 |
|
| 348 |
my $url = "https://hea.koha-community.org/upload.pl"; |
| 349 |
my $ua = LWP::UserAgent->new; |
| 350 |
my $res = $ua->post( |
| 351 |
$url, |
| 352 |
'Content-type' => 'application/json;charset=utf-8', |
| 353 |
Content => $json, |
| 354 |
); |
| 355 |
my $content = decode_json( $res->decoded_content ); |
| 356 |
if ( $content->{koha_id} ) { |
| 357 |
C4::Context->set_preference( 'UsageStatsID', $content->{koha_id} ); |
| 358 |
} |
| 359 |
if ( $content->{id} ) { |
| 360 |
C4::Context->set_preference( 'UsageStatsPublicID', $content->{id} ); |
| 361 |
} |
| 362 |
} |
375 |
} |
| 363 |
|
376 |
|
| 364 |
=head2 _count |
377 |
=head2 _count |
| 365 |
- |
|
|