View | Details | Raw Unified | Return to bug 13287
Collapse All | Expand All

(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 337-342 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
337
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
337
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
338
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
338
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
339
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
339
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
340
('PurgeSuggestionsOlderThan', '', NULL, 'If this script is called without the days parameter', 'Integer'),
340
('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'),
341
('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'),
341
('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'),
342
('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'),
342
('QueryStemming','1',NULL,'If ON, enables query stemming','YesNo'),
343
('QueryStemming','1',NULL,'If ON, enables query stemming','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 9525-9530 if ( CheckVersion($DBversion) ) { Link Here
9525
    SetVersion($DBversion);
9525
    SetVersion($DBversion);
9526
}
9526
}
9527
9527
9528
$DBversion = "XXX";
9529
if ( CheckVersion($DBversion) ) {
9530
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('PurgeSuggestionsOlderThan', '', NULL, 'If this script is called without the days parameter', 'Integer')");
9531
    print "Upgrade to $DBversion done (Bug 13287 - Add a system preference to define the number of days used in purge_suggestions.pl)\n";
9532
    SetVersion($DBversion);
9533
}
9534
9535
9528
=head1 FUNCTIONS
9536
=head1 FUNCTIONS
9529
9537
9530
=head2 TableExists($table)
9538
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+9 lines)
Lines 555-560 OPAC: Link Here
555
                no: "Don't block"
555
                no: "Don't block"
556
            - expired patrons from OPAC actions such as placing a hold or renewing.  Note that the setting for a patron category takes priority over this system preference.
556
            - expired patrons from OPAC actions such as placing a hold or renewing.  Note that the setting for a patron category takes priority over this system preference.
557
557
558
        -
559
            - Keep purchase suggestions for a period of
560
            - pref: PurgeSuggestionsOlderThan
561
              class: integer
562
            - days.
563
            - <br>WARNING - Leave this field empty if you don't want to activate this automatic feature.
564
            - "<br>Example: [30] Sets purgation of suggestions for those older than 30 days."
565
            - <br>(Used when the purge_suggestions.pl script is called with a specific number of days)
566
558
    Privacy:
567
    Privacy:
559
        -
568
        -
560
            - pref: AnonSuggestions
569
            - pref: AnonSuggestions
(-)a/misc/cronjobs/purge_suggestions.pl (-14 / +32 lines)
Lines 32-37 BEGIN { Link Here
32
use Getopt::Long;
32
use Getopt::Long;
33
use Pod::Usage;
33
use Pod::Usage;
34
use C4::Suggestions;
34
use C4::Suggestions;
35
use C4::Context;
35
36
36
my ($help, $days);
37
my ($help, $days);
37
38
Lines 40-60 GetOptions( Link Here
40
    'days=s'         => \$days,
41
    'days=s'         => \$days,
41
);
42
);
42
43
43
if($help or not $days){
44
my $usage = << 'ENDUSAGE';
44
    print <<EOF
45
This script delete old suggestions
45
    This script delete olds suggestions
46
Parameters:
46
    Parameters :
47
-help|? This message
47
    -help|? This message
48
-days TTT to define the age of suggestions to delete
48
    -days TTT to define the age of suggestions to delete
49
49
50
Example:
50
     example :
51
$PERL5LIB/misc/cronjobs/purge_suggestions.pl -days 30
51
     export PERL5LIB=/path/to/koha;export KOHA_CONF=/etc/koha/koha-conf.xml;./purge_suggestions.pl -days 30
52
ENDUSAGE
52
EOF
53
53
;
54
# If this script is called without the 'days' parameter, we use the system preferences value instead.
55
if ( ! defined($days) and not $help) {
56
    my $purge_sugg_days = C4::Context->preference('PurgeSuggestionsOlderThan') || '';
57
    if($purge_sugg_days ne '' and $purge_sugg_days >= 0) {
58
        $days = $purge_sugg_days;
59
    }
60
}
61
# If this script is called with the 'help' parameter, we show up the help message and we leave the script without doing anything.
62
if ($help) {
63
    print $usage;
54
    exit;
64
    exit;
55
}
65
}
56
66
57
if($days){
67
if(defined($days) && $days > 0 && $days ne ''){
58
    DelSuggestionsOlderThan($days);
68
    DelSuggestionsOlderThan($days);
59
}
69
}
60
70
elsif(defined($days) && $days == 0) {
71
    print << 'ERROR';
72
    This script is not executed with 0 days. Aborted.
73
ERROR
74
}
75
else {
76
    print << 'ERROR';
77
    This script requires a positive number of days. Aborted.
78
ERROR
79
}
61
- 

Return to bug 13287