Commit graph

2758 commits

Author SHA1 Message Date
08cc23626c
Bug 32393: (QA follow-up) Add explicit undef response in two catch blocks
Do not implicitly depend on last statement returning nothing.
Make it explicit. We want $args to be null here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-27 15:10:01 -03:00
85c330d8f2
Bug 32393: Deal with the DB fallback part
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-27 15:10:01 -03:00
8df96262c1
Bug 32393: Split into 2 try catch blocks
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-27 15:10:00 -03:00
ca9a598183
Bug 32393: Prevent invalid job to block the job queue
I have faced a problem when testing an incorrect version of bug 32370.
The frame sent to the message broker was not a correct JSON encoded
string, and its decoding was obviously failing, exploding the worker
script.
Additionally, as we don't send a ack for this frame, the next pull will
result in processing the same message, and so in the same explosion.
No more messages can be processed!

This patch is logging the error and ack the message to the broker, in
order to not get stuck.

Test plan:
0. Dont' apply this patch
1. Enqueue a bad message
  a. Apply 32370
  b. Comment the following line in Koha::BackgroundJob::enqueue
    $self->set_encoded_json_field( { data => $job_args,    field => 'data' } );
  c. restart_all
  d. Use the batch item modification tool to enqueue a new job
=> Notice the error in the log
=> Note that the status of the job is "new"
=> Inspect rabbitmq queue:
% rabbitmq-plugins enable rabbitmq_management
% rabbitmqadmin get queue=koha_kohadev-long_tasks
You will notice there is a message in the "long_tasks" queue
2. Enqueue a good message
  a. Remove the change from 1.b
  b. restart_all
  c. Enqueue another job
=> Same error in the log
=> Both jobs are new
=> Inspect rabbitmq, there are 2 messages
3. Apply this patch
4. restart_all
=> Second (good) job is finished
=> rabbitmq long_tasks queue is empty

We cannot mark the first job as done, we have no idea which job it was!

QA: Note that this patch is dealing with another problem, not tested in
this test plan. If an exception is not correctly caught by the ->process
method of the job, we won't crash the worker. The job will be marked as
failed.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-27 15:10:00 -03:00
b3c5bd02e1
Bug 32573: Send ACK message to RabbitMQ before handling the job
Splitting off this functionality from bug 32558. This is the comment that started this discussion: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32558#c15

From the O'Reilly book Mobile and Web Messaging:

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-27 15:09:52 -03:00
790f00781a
Bug 32656: Script delete_records_via_leader.pl no longer deletes items
Bug 29788 inadvertantly replaced a call to safe_delete() with safe_to_delete()
such that any time the script should delete an item it only checks to see if
the item is delectable, after which deletion of the record fails because the
items were not deleted.

Test Plan:
1) Mark a record with items to be deleted via the record leader
2) Run delete_records_via_leader.pl -i -b -v
3) Note the script says it is deleting the items but then the record
   deletion fails. Note the items remain in the items table of the
   database.
4) Apply this patch
5) Repeat step 2
6) This time the items and record should be deleted!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-01-20 13:53:09 +00:00
cd89c38321
Bug 32481: Limit prefetch size for background jobs worker
This patch adds a prefetch size of 1 to the background jobs worker,
so that it fetches 1 message at a time. Without this change,
the RabbitMQ connection timeout when too many messages for slow tasks
are fetched at the same time.

To test:
0. Apply patch
1. Run background worker
2. Rapidly enqueue multiple jobs that in total will take longer
than 30 minutes to process

Bug 32481: Use correct prefetch syntax for RabbitMQ

According to https://www.rabbitmq.com/stomp.html the header to
use for managing the prefetch is "prefetch-count".

You can verify the number of delivered and unacknowledged messages
on a channel on a connection by running "rabbitmqctl list_channels"
on the RabbitMQ host. This will tell you how many messages have been
delivered and are awaiting acknowledgement

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-11 20:46:01 -03:00
Koha translators
623fb377ad
Translation updates for Koha 22.11.00
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-25 15:20:05 -03:00
0b6837ea22
Add release notes for Koha 22.11.00
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-25 15:20:02 -03:00
404c88fe87 Bug 31969: Use filter_by_last_update
This script has a pattern to delete rows depending on a given
date/number of days, we should use the filter_by_last_update
Koha::Objects method.
No need for another method and tests, everything is already tested
there.

This patch also suggests to rename the reference to "background" and
"bg" with "jobs", which seems more appropriate and not an abbreviation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-25 09:40:09 -03:00
Katrin Fischer
356e136b0f
Bug 32093: Make help and code match for bg-days in cleanup_database.pl
There as a mismatch between the parameter name in documentation (bg-days)
and what was checked in the code (bg-jobs). This makes both match.

To test:
* Apply patch
* Make sure you have some background_jobs older than one day
* Verify the help of the script documents the parameter bg-days
* Run the cleanup_database.pl job
  Example:  ./misc/cronjobs/cleanup_database.pl --bg-days  --confirm -v
* Verify there are no errors and the lines have been deleted as expected

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-17 14:55:12 -03:00
a9e0bcff16
Bug 27920: (QA follow-up) Fix POD in cli tool
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-09 14:37:27 -03:00
1afc3b741b
Bug 27920: (QA follow-up) Fix syntax error
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-09 14:37:20 -03:00
e4e453d5df
Bug 27920: Add ability to update patron expiration dates when importing patrons
Some libraries need to recalculate a patron's expiration date any time they are updated via a patron import from file.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Patrons/Import.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-09 14:37:07 -03:00
0232ee9cc4
Bug 32030: Remove maintenance file
This script is actually not used.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-09 09:48:21 -03:00
862de51915
Bug 32030: Wrong permissions on maintenance script
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 21:04:10 -03:00
de77f3a719
Bug 32030: I18N rewrite
The previous implementation was using vue-i18n inject localized strings
into the Vue app. However it was using json files, and we needed
additional overhead to convert from/to PO files.

I've also tried vue3-gettext that use PO, but the overhead to work with
our workflow was existent as well (see branch joubu/vue3-gettext).

vue-i18n-extract was using for extracting, and a specific misc script
(misc/translate_json.pl) was also used to generate the json file. They
can be removed.

Here we are simply reusing our existing workflow, and we will improve it
(ie. make it more vue-ish) later if we need it.

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:38 -03:00
6be1de94e0
Bug 32030: I18N - Load de-DE, es-ES, fr-FR strings
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:18 -03:00
487470b411
Bug 32030: maintenance holdingsIQ
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:05 -03:00
151f6f3f0c
Bug 32030: add maintenance script for HoldingsIQ
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:03 -03:00
74be73121e
Bug 32030: Update I18N
Note that we are adding an extra space for id and counter, otherwise
they got removed in favor of the "simple" string.
  { Agreement: Agreement }
replaced
  { Agreement: { id: ..., counter: ... } }

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:02 -03:00
0c763b7dc4
Bug 32030: Improve I18N
* Remove ":" from the translation to prevent duplication string
* Add a script to auto-translate the strings in English

echo "{}" > koha-tmpl/intranet-tmpl/prog/js/vue/locales/en.json
npx vue-i18n-extract --vueFiles 'koha-tmpl/intranet-tmpl/prog/js/vue/**/*.?(js|vue)' \
                     --exclude koha-tmpl/intranet-tmpl/prog/js/vue/dist/main.js \
                     --languageFiles 'koha-tmpl/intranet-tmpl/prog/js/vue/locales/*.json' \
                     --add --remove
perl misc/translate_json.pl | sponge koha-tmpl/intranet-tmpl/prog/js/vue/locales/en.json

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:01 -03:00
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
Katrin Fischer
469aff4c16
Bug 31854: (QA follow-up) Terminology: loans > checkouts
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-03 10:04:27 -03:00
Magnus Enger
e57ed68a02
Bug 31854: Document --not_borrowed_since and anonymization
To test:
- Run "perldoc misc/cronjobs/delete_patrons.pl"
- Note the absence of information about the potential conflict
  between --not_borrowed_since and anonymization
- Apply this patch
- Re-run the perldoc command and make sure the note about
  anonymization make sense

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-03 10:04:27 -03:00
Katrin Fischer
a4f2e6ae85
Bug 31995: (QA follow-up) Add 'system preference' to help text
We often get asked where something can be found in setting,
adding the hint that RealTimeHoldsQueue is a system preference
is hopefully helpful here.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-03 09:54:33 -03:00
1088e3fb79
Bug 31995: build_holds_queue.pl should check to see if the RealTimeHoldsQueue syspref is on
The real time hold queue and the build_holds_queue.pl jobs are not 100% compatible in that we should not be running the cron if the real time queue is enabled, this could lead to double server work. It would be good to have a check in build_holds_queue for the RealTimeHoldsQueue syspref and not run the job if the preference is enabled.

There might be times when we'd want to force a run of this job without changing the syspref. To that end we would also want a flag for this job so that system administrators could force the job from the command line if required, overriding this limitation.

Test Plan:
1) Apply this patch
2) Try run misc/cronjobs/holds/build_holds_queue.pl with the -h/--help and -m/--man options
3) Disable RealTimeHoldsQueue
4) Run with no options, should succeed
5) Enable RealTimeHoldsQueue
6) Run with no options, should display a message and not rebuild the
   holds queue
7) Run again with the -f/--force option, should succeed

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-03 09:54:32 -03:00
9aa21276b2
Bug 32012: runreport.pl should use binmode UTF-8
Like Bug 26832 added binmode UTF-8 to script misc/search_tools/export_elasticsearch_mappings.pl, this should be added to misc/cronjobs/runreport.pl.

Test plan :
1) Do not apply patch
2) Create a SQL report with :
   SELECT 'accentué',barcode FROM items limit 3
3) Note the id of this report, for example 1
4) Run : misc/cronjobs/runreport.pl 1 --format csv | tee /tmp/without.csv
=> You see output with unknown character instead of é :
5) Run : file --mime-type /tmp/without.csv
=> You see : /tmp/without.csv: iso-8859-1
6) Apply patch
7) Run : misc/cronjobs/runreport.pl 1 --format csv | tee /tmp/with.csv
=> You see correct output with é
8) Run : file --mime-type /tmp/without.csv
=> You see : /tmp/without.csv: utf-8

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-02 19:15:48 -03:00
Björn Nylén
78219e72f6
Bug 31969: (follow-up) Move deletion code to Koha::BackgroundJobs->purge for reuse.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-27 15:03:26 -03:00
Björn Nylén
6565328092
Bug 31969: Add background queue options to cleanup_database
This patch adds background queue options to cleanup_database.pl to allow
for purging completed background jobs.

--bg-jobs DAYS Purge all finished background jobs this many days old. Defaults to 1 if no DAYS provided.
--bg-type TYPE What type of background job to purge. Defaults to "update_elastic_index" if omitted
               Specifying "all" will purge all types. Repeatable.

To test:
 1 - Enable elastic search in Koha
 2 - perl misc/maintenance/touch_all_items.pl
 3 - Generate an number of diffrent types of bg-jobs (eg batch_hold_cancel,
     batch_biblio_record_deletion, batch_item_record_deletion)
 4 - Check db and note there are a bunch of diffrent jobs
 5 - Update to make them old
     UPDATE background_jobs SET ended_on = '2022-10-01 00:00:00', status='finished'
 6 - perl misc/cronjobs/cleanup_database.pl
 7 - Note bg-jobs entry shows in help
 8 - perl misc/cronjobs/cleanup_database.pl --bg-jobs 1 -v
 9 - Note that elasticqueue would have been cleared
10 - perl misc/cronjobs/cleanup_database.pl --bg-jobs 1 -v --confirm
11 - Note that number of entries deleted is reported
12 - Attempt to clear other job types, including "all" eg
     perl misc/cronjobs/cleanup_database.pl --bg-jobs 1 --bg-type batch_item_record_deletion  -v --confirm
     perl misc/cronjobs/cleanup_database.pl --bg-jobs 1 --bg-type all  -v --confirm
13 - Confirm in staff interface that jobs are gone:
     http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
     (Uncheck 'Current jobs only')

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-27 15:03:21 -03:00
c14951baee Revert "Bug 15187: Index 880 in Zebra the same as Elasticsearch"
This reverts commit 85690a14f8.
2022-10-24 14:03:44 -03:00
ae986b992d
Bug 27265: (QA follow-up) Typo on L99 cron script
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-17 21:11:41 -03:00
da7bcc2252
Bug 27265: Enable message queue cron to accept multiple codes and types
It would be nice to be able to combine several types in a single run,
but exclude others, without having to have multiple cron lines

Test Plan:
1) Apply this patch
2) Run process_message_queue.pl with a single -c parameter
3) Note behavior is unchanged
4) Run process_message_queue.pl with multiple -c parameters
5) Note all the codes specified are processed
6) Repeat 2-5 with -t for type limits

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-17 21:11:40 -03:00
c184e88464
Bug 28555: (follow-up) Add to script documenation
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-17 21:09:03 -03:00
125ec8a207
Bug 28555: (follow-up) Make verbose count flags passed
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-17 21:09:03 -03:00
fe376c7d85
Bug 28555: Improve logging for overdue_notices.pl
Currenlty the output with -v from overdue_notices is a bit overwhelming and hard to parse

I do a few things here:
1 - Only show SQL if verbose > 1
2 - Add some separators to make it more readab;e
3 - Remove some redundant messages with branchcode and borrowernumber

To test:
1: perl misc/cronjobs/overdue_notices.pl -v
2: Notice you get a LOT of information all smushed together
3: Apply patch
4: perl misc/cronjobs/overdue_notices.pl -v
5: Less info, and easier to read
6: perl misc/cronjobs/overdue_notices.pl -v -v
7: All the info, but nicer to read

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-17 21:08:58 -03:00
Petro Vashchuk
b04e8185a3
Bug 31776: Fix a typo in cleanup_database.pl cronjob's help/usage
cleanup_database.pl cronjob has a typo in it's usage/help:
"preserve-logs" option should be "preserve-log" as it is everywhere
in the code.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-17 08:14:21 -03:00
543454f765
Bug 28950: Mark serial late when past grace period
This script had some oddities:
- There was a LEFT JOIN to subscription, but no error printed if no subscription
  I changed this to a JOIN as there is a constraint, so this shoudl not happen
- Publisheddate was checked after the SQL, moved into query
- We checked for the next issue, and marked late only if that issue was already expected
  This overruled grace period, which should be the mnarker for a serial being late
  The grace period should be extended if you wish to wait for next issue
- If no next published date, we reported an error on the planneddate
- Script without confirm had no reporting

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-11 10:42:26 -03:00
906d5b1a85
Bug 31203: Alter other cronjobs that currenlty use cronlogaction
Added command line ooption logging and completion logging where
cronlogaction was already imported. We should probably standardize all
cronjobs, but this is a start

One cron didn't log on confirm, likely we need to update all crons to log
if confirm, and possibly not log if running in test mode? Another bug as well

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-05 16:12:59 -03:00
7749e73526
Bug 31203: Add End action to cronjobs and log viewer
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-05 16:12:55 -03:00
e68d2beaf0
Bug 31203: POC advance_notices
This patch proposes a new standard for cronlogaction

We copy @ARGV into a space separated string, then pass this to
cronlogaction

At the end of the script we add a call with info "COMPLETED"

To test:
1 - Apply patch
2 - perl misc/cronjobs/advance_notices.pl -v -m 4 -n -c
3 - sudo koha-mysql kohadev
4 - SELECT * FROM action_logs WHERE interface="CRON";
5 - Note start and completion logged
6 - Note command line arguments included in info

If this looks good I will copy this pattern to the other cronjobs

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-05 16:12:51 -03:00
bf6bbc29a0
Bug 20457: Overdue and pre-overdue cronjobs not skipping phone notices
The overdue and pre-overdue cron scripts are not skipping the generation of phone notices. This causes many phone notices to be created that will always be left at 'pending' as the Talking Tech outbound script creates its own phone notices and puts them in the message queue.

Test Plan:
1) Enable Talking Tech
2) Enable predue and overdue notice phone transports for a patron
3) Generate overdues and predues, notice phone notices are generated
4) Apply the patch
5) Repeat steps 2-3
6) Note phone notices are not generated

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-03 14:13:18 -03:00
4c3d18091d
Bug 31540: Exclude expired holds from the reminder job
Some libraries don't want to auto-cancel holds, but we should not remind
a patron about a hold which has expired.

To test:
1 - Place a hold for a patron
2 - Set it waiting
3 - Run the holds reminder script in the future
    perl misc/cronjobs/holds/holds_reminder.pl -day 1 --date '2023-09-12' -v
4 - Note the holds would be reminded
5 - Set expirationdate for the hold less than today
    UPDATE reserves SET expirationdate = DATE_SUB(CURDATE(), INTERVAL 1 DAY);
6 - Run the remidner cron again
7 - No holds trigger!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-03 08:39:06 -03:00
Andrew Isherwood
65a2fc2fa3
Bug 30484: Implement support for ILL request updates
This commit adds support for the concept of ILL request update notices.

- Adds a new Koha::Illrequest::SupplierUpdate class that is used to
encapsulate an update to a request, this update may come from a
supplier via a backend or from core ILL via, perhaps, a user action
- Adds a new Koha::Illrequest::SupplierUpdateProcessor base class that
can be subclassed in order to create a processor that can be passed an
update and act accordingly.
- Updates to Illrequest.pm to support the above classes and allow core
Koha to offer update processors
- A shell script to initiate a periodic process to check for updates
meeting given criteria and run the appropriate processors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

https://bugs.koha-community.org/show_bug.cgi?id=28909
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 09:18:45 -03:00
980871b19f
Bug 7021: Remove superflous 'open'
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 09:31:28 -03:00
791702a363
Bug 7021: Terminology - usercode -> categorycode
Lets stick to standard terminology and use categorycode rather than
usercode here.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 09:31:28 -03:00
a80a96b933
Bug 31342: Add execution locking to process_message_queue.pl
This patch makes the script use an execution lock as provided by
Koha::Script. Previous attempt got too complex and contentious, and
given we have a simple way to achieve the same thing, I decided to
submit an alternative approach.

To test:
1. Apply this patch
2. Add the following content to misc/cronjobs/process_message_queue.pl
   on line 83:

  sleep 100;

3. Save the file
4. Have two terminals open
5. On the first one, run:
   $ kshell
  k$ misc/cronjobs/process_message_queue.pl
6. On the second one, run the same
=> SUCCESS: The second one dies telling it had to skip the run
7. Undo your changes:
   $ git checkout misc/cronjobs/process_message_queue.pl
8. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Liz Rea <liz@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-19 15:13:52 -03:00
95ebfa1f29
Bug 30755: (follow-up) Add a results hash to automatic renewals
It's slightly debatable whether auto_too_soon is an error or not. I think
it leans far enough towards error that the other patch is correct. The change, however,
will affect notices and means we cannot count auto_too_soon anymore

This patch adds a new 'results' hash to the info - this includes a count per error
(including auto_renew i.e. success) allowing for notices to decide how to display the info.

To test:
1 - Add to Auto renew digest notice:
[% IF results %]
There were [% results.auto_too_soon %] items that were too soon.
[% END %]
2 - Check out some items to a patron that will be too soon
3 - Check out one that is not too soon and will renew
4 - Ensure patron has auto renew digest selected and that AutoRenewalNotices is set to follow patron preferences
5 - Run the auto renewals cron
6 - Confirm the notice for the patron displays 1 successful renewal, no failures, and a correct count of too_soon

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-19 15:11:06 -03:00
c41fab2292
Bug 30755: Remove auto_too_soon from error count
This patch prevents auto_too_soon errors being counted towards auto
renew errors.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-19 15:11:06 -03:00
3d0015fe69
Bug 31299: Fix duplicate output in search_for_data_inconsistencies.pl
In search_for_data_inconsistencies.pl when there are several inconsistencies on same framework, the second output of items contains the first one.

Looks like it is since Bug 21466

Test plan using koha-testing-docker :
1) Create 2 inconsistencies on the same item via SQL :
   update items set itemlost = 9 where itemnumber=900;
   update items set notforloan = 8 where itemnumber=900;
2) Without patch
3) Run ./misc/maintenance/search_for_data_inconsistencies.pl
=> You see duplicate output :
== Wrong values linked to authorised values ==
	* The Framework *BKS* is using the authorised value's category *NOT_LOAN*, but the following items.notforloan do not have a value defined ({itemnumber => value }):
 {900 => 8}
	* The Framework *BKS* is using the authorised value's category *LOST*, but the following items.itemlost do not have a value defined ({itemnumber => value }):
 {900 => 8} {900 => 9}

4) Apply patch
5) Run ./misc/maintenance/search_for_data_inconsistencies.pl
=> Fixed :D
== Wrong values linked to authorised values ==
	* The Framework *BKS* is using the authorised value's category *LOST*, but the following items.itemlost do not have a value defined ({itemnumber => value }):
 {900 => 9}
	* The Framework *BKS* is using the authorised value's category *NOT_LOAN*, but the following items.notforloan do not have a value defined ({itemnumber => value }):
 {900 => 8}

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-16 16:46:41 -03:00