From bc4d5f6639e6ec901b541288a8f9cafc625cb87d Mon Sep 17 00:00:00 2001
From: Fridolin Somers <fridolin.somers@biblibre.com>
Date: Mon, 8 Feb 2021 15:28:35 +0100
Subject: [PATCH] Bug 27656: misc/cronjobs/longoverdue.pl better error message

There are two ways of configuring misc/cronjobs/longoverdue.pl :
use --lost arg or system preferencies DefaultLongOverdueLostValue and DefaultLongOverdueDays.

Actually if you don't use any of it, you get a message :
  "ERROR: No --lost (-l) option defined"
Should also say something about preferencies :
  "ERROR: No --lost (-l) option no system preferences DefaultLongOverdueLostValue/DefaultLongOverdueDays defined"

Test plan:
1) Set empty preferences DefaultLongOverdueLostValue and DefaultLongOverdueDays
2) Run : misc/cronjobs/longoverdue.pl --maxdays 365
3) You see error message
4) Set DefaultLongOverdueLostValue = 1 and DefaultLongOverdueDays = 90
5) Run : misc/cronjobs/longoverdue.pl --maxdays 365
6) You don't see error message

Signed-off-by: David Nind <david@davidnind.com>
---
 misc/cronjobs/longoverdue.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl
index 1f4a380bab..c12a95d6f2 100755
--- a/misc/cronjobs/longoverdue.pl
+++ b/misc/cronjobs/longoverdue.pl
@@ -270,7 +270,7 @@ if ( ! defined($lost) ) {
     else {
         pod2usage( {
                 -exitval => 1,
-                -msg => q|ERROR: No --lost (-l) option defined|,
+                -msg => q|ERROR: No --lost (-l) option or system preferences DefaultLongOverdueLostValue/DefaultLongOverdueDays defined|,
         } );
     }
 }
-- 
2.30.2