Bug 39802: Report when no branches will be selected and exit
This highlights the issue mentioned in the last patch, reporting that nothign will be done and exiting the script To test: 1 - perl misc/cronjobs/longoverdue.pl -l 5=1 --library CPL 2 - Confirm script exits with warning that nothing has been done Sponsored-by: MAIN Library Alliance Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
95789607e2
commit
f5377250f5
|
|
@ -106,6 +106,21 @@ if ( scalar @branches && scalar @skip_branches ) {
|
|||
);
|
||||
}
|
||||
|
||||
my $lost_control_pref = C4::Context->preference('LostChargesControl');
|
||||
my $home_holding_pref = C4::Context->preference('HomeOrHoldingBranch');
|
||||
if ( ( scalar @branches || scalar @skip_branches )
|
||||
&& $lost_control_pref eq 'PickupLibrary'
|
||||
&& !( C4::Context->userenv->{branch} ) )
|
||||
{
|
||||
pod2usage(
|
||||
-verbose => 0,
|
||||
-message =>
|
||||
"There is no branch set for the cron user, LostCharge Control is set to 'library you are logged in at'.\n"
|
||||
. "No branches will satisfy this requirement - exiting.",
|
||||
-exitval => 1
|
||||
);
|
||||
}
|
||||
|
||||
if ( scalar @$itemtype && scalar @$skip_itemtype ) {
|
||||
pod2usage(
|
||||
-verbose => 1,
|
||||
|
|
@ -359,9 +374,7 @@ sub longoverdue_sth {
|
|||
return C4::Context->dbh->prepare($query);
|
||||
}
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $lost_control_pref = C4::Context->preference('LostChargesControl');
|
||||
my $home_holding_pref = C4::Context->preference('HomeOrHoldingBranch');
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
my @available_categories = Koha::Patron::Categories->search()->get_column('categorycode');
|
||||
$borrower_category = [ map { uc $_ } @$borrower_category ];
|
||||
|
|
|
|||
Loading…
Reference in New Issue