Bugzilla – Attachment 72106 Details for
Bug 13287
Add a system preference to define the number of days used in purge_suggestions.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13287: (QA follow-up) Add db revision
Bug-13287-QA-follow-up-Add-db-revision.patch (text/plain), 6.65 KB, created by
Marcel de Rooy
on 2018-02-23 10:44:55 UTC
(
hide
)
Description:
Bug 13287: (QA follow-up) Add db revision
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-02-23 10:44:55 UTC
Size:
6.65 KB
patch
obsolete
>From cc63358266d2f4f2c8d3b34113d621062821edfd Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Tue, 23 Feb 2016 19:29:36 -0500 >Subject: [PATCH] Bug 13287: (QA follow-up) Add db revision >Content-Type: text/plain; charset=utf-8 > >Added missing upgrade SQL system preference. >Corrected system preference screen message >Fixes on purge_suggestions.pl >- perlcritic friendlier >- address $PERL5LIB comment by using $PROGRAM_NAME (comment #10) >- used STDERR (comment #10) >- perltidy > >TEST PLAN >--------- >$ ./installer/data/mysql/updatedatabase.pl >-- should run upgrade and generate new systempreference in table >$ ./misc/cronjobs/purge_suggestions.pl --help >-- should give help with a real path used instead of $PERL5LIB. >$ ./misc/cronjobs/purge_suggestions.pl -days -1 >-- should give error message as expected >$ ./misc/cronjobs/purge_suggestions.pl -days 0 >-- should give error message as expected > >Go to OPAC system preferences tab and check the >PurgeSuggestionsOlderThan system preference >-- message should be as expected (see comment #9) > >run koha qa test tools >-- all should pass > >Signed-off-by: Marc Veron <veron@veron.ch> >Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Amended: Moved new pref from OPAC to Acquisitions preferences. >--- > ...dPurgeSuggestionsOlderThan_SystemPreference.sql | 2 ++ > .../en/modules/admin/preferences/acquisitions.pref | 8 +++++ > .../prog/en/modules/admin/preferences/opac.pref | 8 ----- > misc/cronjobs/purge_suggestions.pl | 37 +++++++++++----------- > 4 files changed, 28 insertions(+), 27 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_13287_AddPurgeSuggestionsOlderThan_SystemPreference.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_13287_AddPurgeSuggestionsOlderThan_SystemPreference.sql b/installer/data/mysql/atomicupdate/bug_13287_AddPurgeSuggestionsOlderThan_SystemPreference.sql >new file mode 100644 >index 0000000..6c66bbc >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_13287_AddPurgeSuggestionsOlderThan_SystemPreference.sql >@@ -0,0 +1,2 @@ >+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+('PurgeSuggestionsOlderThan', '', NULL, 'If this script is called without the days parameter', 'Integer'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >index dad79f3..ac63e2c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >@@ -76,6 +76,14 @@ Acquisitions: > yes: Send > no: Don't send > - blind copy (BCC) to logged in user when sending serial or acquisitions claims notices. >+ - >+ - Keep accepted or rejected purchase suggestions for a period of >+ - pref: PurgeSuggestionsOlderThan >+ class: integer >+ - days. >+ - <br>WARNING - Leave this field empty if you don't want to activate this automatic feature. >+ - "<br>Example: [30] Sets purgation of suggestions for those older than 30 days." >+ - <br>(Used when the cronjob purge_suggestions.pl is active and called without a specific number of days) > > Printing: > - >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 973c86a..c44b109 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -614,14 +614,6 @@ OPAC: > - pref: MaxOpenSuggestions > class: integer > - "open suggestions. Leave empty for no limit. **Note: this setting does not affect anonymous suggestions" >- - >- - Keep accepted or rejected purchase suggestions for a period of [ ] days. >- - pref: PurgeSuggestionsOlderThan >- class: integer >- - days. >- - <br>WARNING - Leave this field empty if you don't want to activate this automatic feature. >- - "<br>Example: [30] Sets purgation of suggestions for those older than 30 days." >- - <br>(Used when the cronjob purge_suggestions.pl is active and called without a specific number of days) > Privacy: > - > - pref: StoreLastBorrower >diff --git a/misc/cronjobs/purge_suggestions.pl b/misc/cronjobs/purge_suggestions.pl >index 2b69170..6dff5db 100755 >--- a/misc/cronjobs/purge_suggestions.pl >+++ b/misc/cronjobs/purge_suggestions.pl >@@ -17,8 +17,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > use utf8; > > BEGIN { >@@ -35,11 +34,11 @@ use C4::Suggestions; > use C4::Log; > use C4::Context; > >-my ($help, $days); >+my ( $help, $days ); > > GetOptions( >- 'help|?' => \$help, >- 'days=s' => \$days, >+ 'help|?' => \$help, >+ 'days=s' => \$days, > ); > > my $usage = << 'ENDUSAGE'; >@@ -49,34 +48,34 @@ Parameters: > -days TTT to define the age of suggestions to delete > > Example: >-$PERL5LIB/misc/cronjobs/purge_suggestions.pl -days 30 > ENDUSAGE >+$usage .= $0 . " -days 30\n"; > > # If this script is called without the 'days' parameter, we use the system preferences value instead. >-if ( ! defined($days) and not $help) { >- my $purge_sugg_days = C4::Context->preference('PurgeSuggestionsOlderThan') || ''; >- if($purge_sugg_days ne '' and $purge_sugg_days >= 0) { >+if ( !defined($days) && !$help ) { >+ my $purge_sugg_days = >+ C4::Context->preference('PurgeSuggestionsOlderThan') || q{}; >+ if ( $purge_sugg_days ne q{} and $purge_sugg_days >= 0 ) { > $days = $purge_sugg_days; > } > } >+ > # If this script is called with the 'help' parameter, we show up the help message and we leave the script without doing anything. > if ($help) { > print $usage; > exit; > } > >-if(defined($days) && $days > 0 && $days ne ''){ >+if ( defined($days) && $days ne q{} && $days > 0 ) { > cronlogaction(); > DelSuggestionsOlderThan($days); > } >- >-elsif(defined($days) && $days == 0) { >- print << 'ERROR'; >- This script is not executed with 0 days. Aborted. >-ERROR >+elsif (!defined($days)){ >+ print $usage; >+} >+elsif ( $days == 0 ) { >+ warn "This script is not executed with 0 days. Aborted.\n"; > } > else { >- print << 'ERROR'; >- This script requires a positive number of days. Aborted. >-ERROR >-} >\ No newline at end of file >+ warn "This script requires a positive number of days. Aborted.\n"; >+} >-- >2.1.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 13287
:
33661
|
41219
|
44312
|
48323
|
48324
|
50296
|
50297
|
60569
|
60570
|
68187
|
69142
|
69143
|
72105
| 72106 |
72107
|
72108
|
72109
|
72217