From d45a9ff3cdda8d266fac663d83b647a46db9de85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Capovilla?= Date: Wed, 8 Feb 2012 13:02:28 -0500 Subject: [PATCH] Add a new syspref for changing the parameters to the longoverdue cron script --- .../en/modules/admin/preferences/circulation.pref | 17 +++++++++ .../pref/lbo_fix_longoverdue_parameter.po | 35 ++++++++++++++++++++ misc/cronjobs/longoverdue.pl | 17 ++++++++- 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 lbo_traductions/pref/lbo_fix_longoverdue_parameter.po diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index cafc7d1..f3fb9ca 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -234,6 +234,23 @@ Circulation: confirmation: Ask for confirmation - when checking out to a borrower that has overdues outstanding - + - By default, set the LOST value of an item to + - pref: DefaultLongOverdueLostValue + class: integer + - when the item has been overdue for more than + - pref: DefaultLongOverdueDays + class: integer + - days. + -
WARNING — These preferences will activate the automatic item loss process. Leave these fields empty if you don't want to activate this feature. + - "
Example: [1] [30] Sets an item to the LOST value 1 when it has been overdue for more than 30 days." + -
(Used when the longoverdue.pl script is called without the --lost parameter) + - + - "Charge a lost item to the borrower's account when the LOST value of the item changes to :" + - pref: DefaultLongOverdueChargeValue + class: integer + -
Leave this field empty if you don't want to charge the user for lost items. + -
(Used when the longoverdue.pl script is called without the --charge parameter) + - - On checkin route the returned item to - pref: HomeOrHoldingBranchReturn type: choice diff --git a/lbo_traductions/pref/lbo_fix_longoverdue_parameter.po b/lbo_traductions/pref/lbo_fix_longoverdue_parameter.po new file mode 100644 index 0000000..7c61cbd --- /dev/null +++ b/lbo_traductions/pref/lbo_fix_longoverdue_parameter.po @@ -0,0 +1,35 @@ +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueLostValue# By default, set the LOST value of an item to" +msgstr "Par défaut, changer la valeur LOST d'un exemplaire pour " + +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueLostValue# when the item has been overdue for more than" +msgstr "lorsqu'un exemplaire est en retard pour plus de " + +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueLostValue# days." +msgstr "jours." + +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueLostValue#
Example: [1] [30] Sets an item to the LOST value 1 when it has been overdue for more than 30 days." +msgstr "
Exemple: [1] [30] Donne la valeur LOST 1 à un item s'il a été en retard pour plus de 30 jours." + +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueLostValue#
(Used when the longoverdue.pl script is called without the --lost parameter)" +msgstr "
(Utilisé lorsque le script longoverdue.pl est appellé sans spécifier le paramètre --lost)" + +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueLostValue#
WARNING — These preferences will activate the automatic item loss process. Leave these fields empty if you don't want to activate this feature." +msgstr "
ATTENTION — Cette préférence déclenche automatiquement le processus de perte de livres. Laissez ce champ vide en tout temps si vous ne voulez pas activer cette fonctionnalité." + +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueChargeValue# Charge a lost item to the borrower's account when the LOST value of the item changes to :" +msgstr "Ajouter une amende au compte du membre si la valeur LOST du livre emprunté devient :" + +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueChargeValue#
Leave this field empty if you don't want to charge the user for lost items." +msgstr "
Laisser ce champ vide si vous ne voulez par ajouter d'amende pour les exemplaires perdus." + +# Circulation > Checkout Policy +msgid "circulation.pref#DefaultLongOverdueChargeValue#
(Used when the longoverdue.pl script is called without the --charge parameter)" +msgstr "
(Utilisé lorsque le script longoverdue.pl est appellé sans spécifier le paramètre --charge)" diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl index 159db51..22fa33f 100755 --- a/misc/cronjobs/longoverdue.pl +++ b/misc/cronjobs/longoverdue.pl @@ -108,8 +108,21 @@ ENDUSAGE # FIXME: allow --help or -h # if ( ! defined($lost) ) { - print $usage; - die "ERROR: No --lost (-l) option defined"; + my $longoverdue_value = C4::Context->preference('DefaultLongOverdueLostValue'); + my $longoverdue_days = C4::Context->preference('DefaultLongOverdueDays'); + if(defined($longoverdue_value) and defined($longoverdue_days) and $longoverdue_value ne '' and $longoverdue_days ne '' and $longoverdue_days >= 0) { + $lost->{$longoverdue_days} = $longoverdue_value; + } + else { + print $usage; + die "ERROR: No --lost (-l) option defined"; + } +} +if ( ! defined($charge) ) { + my $charge_value = C4::Context->preference('DefaultLongOverdueChargeValue'); + if(defined($charge_value) and $charge_value ne '') { + $charge = $charge_value; + } } unless ($confirm) { $verbose = 1; # If you're not running it for real, then the whole point is the print output. -- 1.7.2.5