@@ -, +, @@ statistics 'Yes' : It set the 'UsageStats' syspref to 1 (activate sharing) and the 'UsageStatsLastDisplay' syspref to 0. 'Later' : It set the 'UsageStats' syspref to 0 and the 'UsageStatsLastDisplay' syspref to the today's date and it will show again the message after 7 days. 'No' : It set the 'UsageStats' syspref to 0 and the 'UsageStatsLastDisplay' syspref to 0. 'Yes' : It set the 'UsageStats' syspref to 1 (activate sharing) and the 'UsageStatsLastDisplay' syspref to 0. 'Later' : It set the 'UsageStats' syspref to 0 and the 'UsageStatsLastDisplay' syspref to the today's date. A message on the Administration page will offer you again the possibility of sharing your stats in 7 days. 'No' : It set the 'UsageStats' syspref to 0 and the 'UsageStatsLastDisplay' syspref to 0. --- admin/admin-home.pl | 28 +++++++++ installer/data/mysql/atomicupdate/14608.sql | 2 + installer/data/mysql/sysprefs.sql | 1 + installer/install.pl | 16 ++++++ .../prog/en/modules/admin/admin-home.tt | 64 +++++++++++++++++++++ .../prog/en/modules/installer/step3.tt | 34 ++++++++--- koha-tmpl/intranet-tmpl/prog/img/later.png | Bin 0 -> 1359 bytes 7 files changed, 137 insertions(+), 8 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/14608.sql create mode 100644 koha-tmpl/intranet-tmpl/prog/img/later.png --- a/admin/admin-home.pl +++ a/admin/admin-home.pl @@ -34,4 +34,32 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); +# +# Usage stats sharing +# +my $usageStats = C4::Context->preference("UsageStats"); +if( $usageStats ){ + $template->param(usageStats => 1); +} +else{ + $template->param(usageStats => 0); +} + +my $DAYS = 7; #Number of days before remind to send usage stats +my $today = DateTime->now->epoch; +my $lastDisplay; +if ( (C4::Context->preference("UsageStatsLastDisplay")) eq "" ){ + $lastDisplay = 1; +} +else{ + $lastDisplay = C4::Context->preference("UsageStatsLastDisplay") / 1000; #milliseconds to seconds +} + +if( ($lastDisplay != 0) && ( $today > ($lastDisplay+ ( 60 * 60 * 24 * $DAYS)) ) ){ + $template->param(lastDisplay => $today); +} +else{ + $template->param(lastDisplay => 0); +} + output_html_with_http_headers $query, $cookie, $template->output; --- a/installer/data/mysql/atomicupdate/14608.sql +++ a/installer/data/mysql/atomicupdate/14608.sql @@ -0,0 +1,2 @@ +INSERT INTO systempreferences (variable, value, options, explanation, type ) +VALUES ('UsageStatsLastDisplay', '', NULL, 'The last time we offered you to share your statistics', 'Free'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -525,6 +525,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'), ('UsageStatsLibraryType', 'public', 'public|school|academic|research|private|societyAssociation|corporate|government|religiousOrg|subscription', 'The library type to be shown on the Hea Koha community website', 'Choice'), ('UsageStatsLibraryUrl', '', NULL, 'The library URL to be shown on Hea Koha community website', 'Free'), +('UsageStatsLastDisplay', '', NULL, 'The last time we offered you to share your statistics', 'Free'), ('UseAuthoritiesForTracings','1','0','Use authority record numbers for subject tracings instead of heading strings.','YesNo'), ('UseBranchTransferLimits','0','','If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.','YesNo'), ('UseControlNumber','0','','If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','YesNo'), --- a/installer/install.pl +++ a/installer/install.pl @@ -193,6 +193,22 @@ elsif ( $step && $step == 3 ) { elsif ( $op && $op eq 'finish' ) { $installer->set_version_syspref(); + # + # Share usage stats with Hea + # + if($query->param('hea') eq "1"){ + C4::Context->set_preference('UsageStats', 1); + C4::Context->set_preference('UsageStatsLastDisplay', 0); + } + elsif($query->param('hea') eq "-1"){ + C4::Context->set_preference('UsageStats', 0); + C4::Context->set_preference('UsageStatsLastDisplay', ((DateTime->now->epoch) * 1000)); + } + elsif($query->param('hea') eq "0"){ + C4::Context->set_preference('UsageStats', 0); + C4::Context->set_preference('UsageStatsLastDisplay', 0); + } + # Installation is finished. # We just deny anybody access to install # And we redirect people to mainpage. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -2,6 +2,58 @@ [% INCLUDE 'doc-head-open.inc' %]
Installation complete.
-
Click on 'Finish' to complete and load the Koha Staff Interface. -
+ + + + [% END %]