Koha/misc/cronjobs
Joonas Kylmälä 8a63d78c4b
Bug 27259: Add HomeOrHoldingBranch checks where it was missing from
The TooMany() function and fine calculation functions were incorrectly
hard coded to use homebranch for fetching the circulation rules. Those
ignored completely the syspref HomeOrHoldingBranch where the user
might have set it to holdingbranch and therefore the fines and whether
patron has too many checkouts (TooMany()) were counted using the
unintended branch's rules. This problem only arises in the cases where
there are branch specific circulation rules defined.

Test plan:
1. Make sure following tests pass:
   $ prove t/db_dependent/Circulation/_CalculateAndUpdateFine.t
   $ prove t/db_dependent/Circulation/TooMany.t

Test plan for fines.pl:
1. Add branch specific fine rules for branches A and B. A having a
   fine of 1 per day and B having a fine of 0 per day.
2. Set sysprefs:
   CircControl = the library the items is from
   finesMode = Calculate and charge
   HomeOrHoldingBranch = holdingbranch
3. Create an item with home and holding branch of A
4. Checkout the item with a due date in the past (the past due date can be
   specified by clicking "Checkout settings" in the checkout page) and
   make sure the branch you are checking from is B.
5. Run perl /usr/share/koha/bin/cronjobs/fines.pl
6. Notice that fines have popped up now to the patron incorrectly
7. Apply patch
8. Pay fines, Check-in the item and check it out again
9. Run perl /usr/share/koha/bin/cronjobs/fines.pl
10. Notice that fine is now 0. This means that the branch
    B (holdingbranch of the checked-out item) specific rule is used.

Test plan for staticfines.pl:
1. Add branch specific fine rules for branches A and B. A having a
   fine of 1 per day and B having a fine of 0 per day.
2. Set sysprefs:
   CircControl = the library the items is from
   finesMode = Calculate and charge
   HomeOrHoldingBranch = holdingbranch
3. Create an item with homebranch A and holding branch of A
4. Checkout the item with a due date in the past (the past due date can be
   specified by clicking "Checkout settings" in the checkout page) and
   make sure the branch you are checking from is B.
5. Run perl staticfines.pl --library A --library B --category <PATRONS_CATEGORYCODE>
   and notice that now there is inccorectly fines
6. Apply patch
7. Pay fines, Check-in the item and check it out again
8. Run perl staticfines.pl --library A --library B --category <PATRONS_CATEGORYCODE>
    and notice the fines are now not generated

Rebased-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:04:18 -03:00
..
holds Bug 31995: (QA follow-up) Add 'system preference' to help text 2022-11-03 09:54:33 -03:00
recalls Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
rss Bug 17600: Fix POSIX imports 2021-07-29 14:37:26 +02:00
social_data
thirdparty Bug 31356: Use hold expiration date instead of adding days to the waiting date 2022-08-31 14:30:26 -03:00
advance_notices.pl Bug 31203: Add End action to cronjobs and log viewer 2022-10-05 16:12:55 -03:00
archive_purchase_suggestions.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
automatic_checkin.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
automatic_item_modification_by_age.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
automatic_renewals.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
backup.sh
batch_anonymise.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
build_browser_and_cloud.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
cart_to_shelf.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
check-url-quick.pl Bug 29697: Replace GetMarcBiblio occurrences with $biblio->metadata->record 2022-07-22 15:24:11 -03:00
cleanup_database.pl Bug 31969: (follow-up) Move deletion code to Koha::BackgroundJobs->purge for reuse. 2022-10-27 15:03:26 -03:00
cloud-kw.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
cloud-sample.conf
CONFIGURE.gmail
create_koc_db.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
crontab.example Bug 19532: (QA follow-up) Add the cron jobs to the cron files 2022-03-14 22:45:52 -10:00
delete_items.pl Bug 29788: Make Koha::Item->safe_to_delete use Koha::Result::Boolean 2022-01-11 12:38:35 -10:00
delete_patrons.pl Bug 31854: (QA follow-up) Terminology: loans > checkouts 2022-11-03 10:04:27 -03:00
delete_records_via_leader.pl Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
edi_cron.pl Bug 16258: (QA follow-up) Capitalise EDIFACT 2022-04-13 15:55:39 +02:00
fines.pl Bug 27259: Add HomeOrHoldingBranch checks where it was missing from 2022-11-04 19:04:18 -03:00
gather_print_notices.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
import_webservice_batch.pl Bug 30776: import missing subroutine to fix import_webservice_batch.pl 2022-05-18 17:22:08 -10:00
longoverdue.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
membership_expiry.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
merge_authorities.pl Bug 17600: Fix missing C4::AuthoritiesMARC import 2021-07-29 15:34:25 +02:00
notice_unprocessed_suggestions.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
overdue_notices.pl Bug 28555: (follow-up) Add to script documenation 2022-10-17 21:09:03 -03:00
patron_emailer.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
plugins_nightly.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
printoverdues.sh
process_message_queue.pl Bug 27265: (QA follow-up) Typo on L99 cron script 2022-10-17 21:11:41 -03:00
purge_suggestions.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
reconcile_balances.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
remove_temporary_edifiles.pl
runreport.pl Bug 32012: runreport.pl should use binmode UTF-8 2022-11-02 19:15:48 -03:00
serialsUpdate.pl Bug 28950: Mark serial late when past grace period 2022-10-11 10:42:26 -03:00
share_usage_with_koha_community.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
sitemap.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
staticfines.pl Bug 27259: Add HomeOrHoldingBranch checks where it was missing from 2022-11-04 19:04:18 -03:00
stockrotation.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
update_patrons_category.pl Bug 31249: Use cronlogaction on update_patrons_category.pl 2022-08-05 11:53:15 -03:00
update_totalissues.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
writeoff_debts.pl Bug 28994: Fix logical errors with amount vs amoutoutstanding 2021-11-15 12:38:39 +01:00