[Koha-bugs] [Bug 24968] Add Syspref controls for cronjobs

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Mar 31 15:10:35 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24968

--- Comment #10 from Magnus Enger <magnus at libriotech.no> ---
Thinking a bit about this at the end of the hackfest...

Question: Do we want the sysprefs or the command line options to "have the last
word"? 

One of the arguments for having sysprefs is that we could run the cronjob with 
koha-foreach, and still have different choices for different libraries. So that
would indicate that sysprefs should "have the last word". 

Then there is the question of how to implement this. We could have one syspref
per command line option, and do something like this:

exit unless C4::Context->preference('CronAutomaticRenewalsActivate');

my ( $help, $send_notices, $verbose, $confirm, $digest_per_branch );
GetOptions(
    'h|help' => \$help,
    's|send-notices' => \$send_notices,
    'v|verbose'    => \$verbose,
    'c|confirm'     => \$confirm,
    'b|digest-per-branch' => \$digest_per_branch,
) || pod2usage(1);

$send_notices      =
C4::Context->preference('CronAutomaticRenewalsSendNotices');
$verbose           = C4::Context->preference('CronAutomaticRenewalsVerbose');
$confirm           = C4::Context->preference('CronAutomaticRenewalsConfirm');
$digest_per_branch =
C4::Context->preference('CronAutomaticRenewalDigestPerBranch');

This would introduce a lot of new sysprefs, and we would have to add a new
syspref
when a new command line switch was added. On the other hand it would be easy to 
add descriptions for each setting, and link to related sysprefs. 

Another approach could be to have two sysprefs per cronjob, one to turn it on
and off, and one to do the configuration. This could be done with YAML:

send_notices: 1
verbose: 0
confirm: 1
digest_per_branch: 0

Then we could perhaps do something like this:

$send_notices = get_cronjob_setting( 'CronAutomaticRenewals', 'send_notices' );

This way we could add new command line options without adding a new syspref, 
but editing YAML in a text field might not be the most user friendly interface.
Are there other syntaxes that would be as flexible, but more user friendly?

There there is of course the possibilty of some whole new tool to edit the
options, but that is not something to think about at the end of a hackfest...
So just some thoughts to get the ball rolling and try and provoke folks to 
come up with better ideas  than mine. :-)

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list