Commit graph

2365 commits

Author SHA1 Message Date
e5e26645ee
Bug 23571: (QA follow-up) Add missing newline in warning
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:59:15 +01:00
0d4fed8899
Bug 23571: Prevent concurrent execution of fines.pl
This patch introduces locking in fines.pl. It does so by leveraging on
bug 25109, which introduces a generic locking implementation on
Koha::Script.

The introduced changes:
1. Try to get the lock
2.a. If success, normal execution happens
2.b. If rejected, cronlogaction is called with a meaningful message and
  a normal exit happens, so we don't flood the logs in vain. --verbose
  will make the script print the same message on STDERR, as already is
  the case with this script

To test:
1. Apply this patch
2. In two separate consoles run:
   $ kshell
  k$ perl misc/cronjobs/fines.pl --verbose
SUCCESS => The first one runs normally, the second one exists really fast
  and prints a message about the lock.
3. Sign off :-D

Sponsored-by: Orex Digital
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:59:01 +01:00
ec6c143f1b
Bug 23871: data inconsistencies - check title exists
In biblio records, a field must be linked to biblio.title.
200$a in UNIMARC, 100$a MARC21 (and other).

If this field is undefined, some pages like checkouts table can fail.

Test plan :
1) Remove biblio title in SQL :
   UPDATE biblio SET title='' WHERE biblionumber=XXX
2) Run misc/maintenance/search_for_data_inconsistencies.pl
3) You see the record as an inconsistency
4) Reset a title
   UPDATE biblio SET title='50 shades of Grey' WHERE biblionumber=XXX
5) Run misc/maintenance/search_for_data_inconsistencies.pl
6) Record is no longer an inconsistency

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:55:13 +01:00
74c63d27c7
Bug 21865: allow test arg alone
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:54:24 +01:00
e788ac4e58
Bug 21865: add confirm to remove_unused_authorities.pl script
Like in most scripts in misc, add confirm argument
to ensure script is not run without knowing what it does.

Test plan:
1) Run misc/migration_tools/remove_unused_authorities.pl -h
2) You see help line for confirm
3) Run misc/migration_tools/remove_unused_authorities.pl
4) You see help and script does nothing
5) Run misc/migration_tools/remove_unused_authorities.pl -c
6) Script runs like wanted

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:54:19 +01:00
fc4cffe1f0
Bug 21865: ES compatiblity of remove_unused_authorities.pl
The script misc/migration_tools/remove_unused_authorities.pl directly checks if Zebra search is OK.

This patch changes so that this test is only if Zebra is the search engine.
It also adds a test on the search off any authority number indexed (index 'an').
With Zebra its : an,alwaysmatches=''
With ES its : an:*
This test ensure that biblios records are indexed and that not all autorities will be deleted.

Test plan:
1) On a catalog create a new authority
2) Use Zebra in systempreference SearchEngine
3) Stop Zebra server
4) Run misc/migration_tools/remove_unused_authorities.pl -c
5) The script does nothing and says :
   Zebra server seems not to be available. This script needs Zebra runs.
6) Restart Zebra server
7) Delete biblio index base
8) Run misc/migration_tools/remove_unused_authorities.pl -c
9) The script does nothing and says :
   Searching authority number in biblio records seems not to be available : an,alwaysmatches=''
10) Use ElasticSearch in systempreference SearchEngine
11) Delete biblio index base
12) Run misc/migration_tools/remove_unused_authorities.pl -c
13) The script does nothing and says :
    Searching authority number in biblio records seems not to be available : an:*

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:54:10 +01:00
bf60a9c88c
Bug 21865: improve remove_unused_authorities.pl script
remove_unused_authorities.pl script can be improved.

This patch changes changes verbosity so than test mode can be used
to know the autorities that are used and those that can be deleted.
It also writes a line in output if limited authority type(s).

This patch also removes the unused vars $thresholdmin and $thresholdmax.

It also changes the query to use SQL with parameters for authority types.

Test plan :
1) On a catalog create a new authority
2) Be sure catalog is well indexed
3) Run misc/migration_tools/remove_unused_authorities.pl -t
4) You will see the line :
   *** Testing only, authorities will not be deleted. ***
5) You will see lines of :
   authid=x type=y : used X time(s)
6) You will see the line for the authority created in 1) :
   authid=x type=y : can be deleted
7) You will see at the end :
   x authorities parsed
   y can be deleted because unused
   z unchanged because used
8) Run misc/migration_tools/remove_unused_authorities.pl
9) You don't see the line :
   *** Testing only, authorities will not be deleted. ***
10) You will see lines of :
   authid=x type=y : used X time(s)
11) You will see the line for the authority created in 1) :
   authid=x type=y : deleted
12) You will see at the end :
   x authorities parsed
   y deleted because unused
   z unchanged because used
13) Run misc/migration_tools/remove_unused_authorities.pl --auth NP --auth CO
14) You see the line :
    Restricted to authority type(s) : NP,CO.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:53:58 +01:00
d6fc05891b
Bug 22784: Add a cronjob to archive suggestions given age or status criteria
In order to deal automatically with suggestions that need to be
archived, this cronjob will help to add the "archived" flag following
their age or status.

Test plan:
- Execute the script with the --help parameter and read the documentation.
- Does it make sense?
- Use it without the --confirm flag and try several combination

For instance you will want to archive suggestions that have been
rejected for more than a week:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=rejecteddate --age=weeks:1

or even suggestion that have been suggested for more than a year and
have a ORDERED status:
  perl misc/cronjobs/archive_purchase_suggestions.pl
  --age-date-field=suggesteddate --age=years:1 --status=ORDERED

- Use it with the --confirm flag and make sure the suggestions have been
archived.

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:22:02 +01:00
3dd79180f3
Bug 25040: monkeypatch Schema::Loader for recent MariaDB
Recent versions of MariaDB changed the output of 'DESCRIBE' for
timestamp columns with defaults from `CURRENT_TIMESTAMP` to
`current_timestamp()`.  As such the code inside
DBIx::Class::Schema::Loader which catches such cases and outputs
`\"current_timestamp"` as a sensible cross platform default is missed
and this leads of inconsistent class files and bugs with out default
lookup code in Koha::Objects.

This patch serves as a backport of the code I have submitted upstream
such that out developers can continue to use update_dbix_class_files.pl
to build their schema classes from the database and regardless of their
db server version get a consistently correct output.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 08:26:10 +01:00
Aleisha Amohia
f406aa2ae3
Bug 24266: (alternate patch) Only use defined borrowernumbers in reconcile_balances.pl cron
I believe the error is triggered when borrowernumbers are left empty in
the accountlines table. Not sure why this would happen, but it appears
to be what causes the problem.

Do not apply the first patch if testing this patch.

To test:
1) sudo koha-mysql INSTANCENAME
2) Create a test borrower, add any payment etc to create an accountline,
    then delete this borrower
3) ensure the AccountAutoReconcile syspref is disabled
4) Go to another borrower's accounting tab
5) Create a manual credit or debit. Confirm this shows in the 'Make a
payment' tab as an amount that COULD be applied, but isn't automatically
applied
6) in your terminal, run the reconcile_balances.pl script
7) Confirm the error does not show in the logs and the balance for
the borrower is correctly reconciled.

Sponsored-by: Horowhenua District Council
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 08:21:31 +01:00
94ec55d767
Bug 24840: (follow-up) Catch some further cases of DateTime->now
This patch corrects a few additional cases where DateTime->now is called
directly instead of via Koha::DateUtils.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-08 11:54:36 +01:00
6ac037f817
Bug 24840: Replace DateTime->now with dt_from_string
We should use Koha::DateUtils instead of Date::Time directly

This patch simplay replaces calls to now() with a call to dt_from_string()
which does effectively the same thing.

Probably reading the code and verifying changes is sufficient but...

To test:
1 - confirm the files all compile
2 - confirm all tests pass
3 - confirm Koha still works

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-08 11:54:23 +01:00
8a56f176c0
Bug 24183: Add before_send_messages hook
This patch adds a simple hook to the process_message_queue cronjob
to allow plugins to pre-process messages in the messaging queue before
they are sent.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-06 10:43:25 +01:00
6464ada6c6
Bug 23473: Allow overwrite of passwords during import
To test:
 1 - Have some patrons in your system
 2 - Export some of their info via reports
    SELECT cardnumber, userid, surname, firstname, password, branchcode, categorycode
 3 - Edit the file from above, changing all the password lines
 4 - Import the file with overwrite
 5 - Confirm passwords have not changed (run the report again and confirm the hashes are the same)
 6 - Apply patch
 7 - Restart all the things
 8 - Check the new box on import screen to overwrite passwrods
 9 - Import file again
10 - Confirm passwords have changed
11 - Signin using new password to verify the hash is the password as supplied
12 - Repeat via commandline import supplying --overwrite_passwords option
13 - Verify works as expected
14 - Prove -v t/db_dependent/Koha/Patrons/Import.t

Sponsored-by: ByWater Solutions
Signed-off-by: Ron Marion <ron.marion@goddard.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 12:21:59 +00:00
5982159f35
Bug 24883: (RM follow-up) Use Koha::Script
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 12:12:31 +00:00
Bernardo Gonzalez Kriegel
52b1314154
Bug 24883: Add POD entry and remove unused variable
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 12:11:32 +00:00
1439abcfe2
Bug 24883: Move new sub from load_yaml.pl
Use the sub from C4::Installer to avoid dup of code.

Note:
We are going to modify the script and so will do more stuffs.
We may want to rename it, maybe installer_utilities.pl,
misc/installer/yaml_utility.pl, any suggestions?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 12:11:23 +00:00
Bernardo Gonzalez Kriegel
f52c9fde3f
Bug 24883: Command line utility to load yaml files
This patch adds a command line utility to load
yaml files.

To test:
1) Apply the patch
2) Try loading a file, e.g. sample notices
 a) mysql -e "delete from letter"
 b) misc/load_yaml.pl -f installer/data/mysql/en/mandatory/sample_notices.yml
3) Try loading a file with a syntax error,
   edit previous file adding ':' at the end of a field without quotes
   then load again

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 12:11:05 +00:00
93393036e5
Bug 23204: (RM follow-up) Use Koha::Script
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 12:08:54 +00:00
c7dbc27420
Bug 23204: Adjust copyright and license
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 11:55:52 +00:00
Alex Arnaud
e160af97a6
Bug 23204: Add exec permission on the script
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 11:55:14 +00:00
Alex Arnaud
85f3a3a302
Bug 23204: Move code in a unit tested sub
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 11:54:51 +00:00
Alex Arnaud
e1f8522391
Bug 23204: Add script for exporting Elasticsearch mappings
Test plan:

  - launch perl misc/search_tools/export_elasticsearch_mappings.pl >
    /path/to/my_mappings.yaml
  - set koha-conf.elasticsearch_index_mappings to
    /path/to/my_mappings.yaml,
  - go to admin -> Search engine configuration,
  - click on "Reset mappins",
  - check that your search fields and mappings are as expected

Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-27 11:54:35 +00:00
21c9b685bf
Bug 20415: Remove UseKohaPlugins system preference
Owen Leonard 2018-03-16 10:47:47 UTC :
<<
I don't think the system preference adds any security. There are already multiple permissions required for working with plugins:

- Configure plugins
- Manage plugins ( install / uninstall )
- Use report plugins
- Use tool plugins

And even with those permissions your server must be configured to allow the use of plugins.
>>

Test plan :
1) Install kitchen sink plugin https://github.com/bywatersolutions/koha-plugin-kitchen-sink
2) Run misc/devel/install_plugins.pl
3) Set config enable_plugins=1
4) Check all parts of the plugin are working
5) Set config enable_plugins=0
6) Check all parts of the plugin are disabled

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-26 11:42:02 +00:00
e3c6c4beed
Bug 24476: Rename autorenewal to autorenew_checkouts
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-24 11:23:54 +00:00
47f9ec9446
Bug 24476: Allow patrons to opt out of auto-renewal
To test:
1 - Verify on staff side that patron can be edited to opt in our out of auto renewal
2 - Check out some items to a patron opted in to auto renewal
3 - Ensure the items are checked out and set to autorenew
4 - Login on the opac at the patron
5 - Verify items cannot be renewed as scheduled for auto-renewal
6 - On staff side, opt patron out of auto renewal
7 - Verify on opac items are no longer marked for auto renewal
8 - Run the auto renewal cron job, items are not renewed
9 - Set 'no renewal before' to a setting that would prevent renewal
10 - Verify that opting patron in or out of auto renewal changes only the reason items cannot be renewed
11 - Set 'no renewal before' to a setting that would allow for renewal
12 - Verify that opting patron in/out changes their ability to renew
13 - Verify that when opted out cron does not renew
14 - Verify that when opted in the item is auto renewed
15 - Reset the due date, opt out, verify manual renewal succeeds

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-24 11:23:47 +00:00
ce6229cd75
Bug 22589: Remove C4::Overdues::BorType
Test plan:
0) Apply patch
1) try to run affected scripts and ensure the amounts are corectly
calculated for different patron categories:
    installer/data/mysql/fix_unclosed_nonaccruing_fines_bug17135.pl
    misc/cronjobs/fines.pl
    misc/cronjobs/staticfines.pl

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-24 10:57:55 +00:00
Matthias Meusburger
15dd83268b
Bug 15214: bulkmarcimport should log if an authority has been updated
When importing with bulkmarcimport, authorities may or may not be updated based
on which authority is newer (005 are compared). This patch allows to keep track
in the result yaml file if an authority has been updated or not:

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-24 10:54:46 +00:00
Rogan Hamby
5e2fe4418d
Bug 18414: Allow to use other select criteria with delete_patrons.pl
Adds the ability to specify a file with the --file flag that
should be a list of borrowernumbers for deletion.
If used without other flags it will delete the list of borrowers,
if used with other flags it will treat the other criteria
as filters for the list.

To Test:
1) Specify a list, e.g. borrowers.txt, of borrowernumbers in the database and put them in a text file with one per line
2) Invoke the script like ./delete_patrons.pl --file borrowers.txt to delete those patrons
3) Populate the list with a mix of borrowers in a category and those not, say categoryfoo
4) Invoke the scirpt as ./delete_patrons.pl --category_code categoryfoo --file borrowers.txt
5) Only the borrowers in the file that have the specified category will be deleted

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-24 10:42:18 +00:00
Liz Rea
60c31d70bb
Bug 24324: Resolve error with delete_records_via_leader.pl
To test:

Have a record with the 000 position 5 set to "deleted" (record status)
Use koha-shell to run the job with the -i flag: perl misc/cronjobs/delete_records_via_leader.pl -c -i -v
* items and the record should be deleted
Mark another record with the 000 position 5 set to deleted (record status)
Use koha-shell to run the job without the -i flag: perl misc/cronjobs/delete_records_via_leader.pl -c -v
* if the record had items, it will not be deleted
* if the record did not have items, it will be deleted.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-24 08:03:30 +00:00
a3687711b0
Bug 23463: Remove DelItemCheck and ItemSafeToDelete
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 09:26:31 +00:00
bbb504c86f
Bug 23463: Replace ModItem with Koha::Item->store
Starting to replace the ModItem calls with Koha::Item->store

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-23 09:26:30 +00:00
87acc552d5
Bug 23411: Do not fall back to 'email' for SMS messages
To test:
 1 - Have a patron wiht an sms number, but no email
 2 - Enable sms by setting SMSDriver syspref to Email
 3 - Set Notice triggers to send an overdue via sms and email
 4 - Ensure the selected notice is defined only for 'email'
 5 - Checkout an overdue to the patron above
    You can set a specify a due date in the past
 6 - perl misc/cronjobs/overdue_notices.pl -t
 7 - Check the patron notices tab, they have a print notice and an SMS notice pending
 8 - The SMS notice used the 'email' template
 9 - Apply patch
10 - sudo koha-mysql kohadev
11 - DELETE * FROM message_queue WHERE borrowernumber={borrower as above};
12 - Run the cron again
13 - Patron should have a print notice queued, no sms
14 - Define an SMS notice
15 - delete the message queue
16 - Run again
17 - The patron should have a print and an SMS

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-20 15:19:27 +00:00
29fe1f4fb4
Bug 24726: Replace one occurrence in print statement
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-19 09:34:53 +00:00
a696d4ecc3
Bug 24726: Update overdue_notices to use inbound_email_address
This patch updates the overdue_notices functionality to use the
inbound_email_address method to obtain the correct email address
for a branch.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-19 09:34:34 +00:00
Andreas Roussos
1d26fb3a9d
Bug 24827: Standardise on 'UTF-8' as the encoding name
This patch standardises the encoding name used in direct calls
to new_from_xml() to 'UTF-8' instead of 'utf8' or 'utf-8'.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-16 14:45:39 +00:00
07b0c5bc0e
Bug 17845: Adjust few other occurrences
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-10 15:18:28 +00:00
Bernardo Gonzalez Kriegel
31774a2ee8
Bug 24262: (follow-up) admit null values on labels
This patch adds handling of null values on translatable
labels.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-09 13:54:24 +00:00
Bernardo Gonzalez Kriegel
33c1ddf86b
Bug 24262: Translate installer data in YAML format
This patch adds the ability to:
1) Create new translation files from yaml installer files
2) Create installer directory for a given language

It will not create a installer directory if it already exists.

New (possible) translation files:
  xx-YY-installer.po
  xx-YY-installer-MARC21.po
  xx-YY-installer-UNIMARC.po

Needs Bug 13897 (for yaml files)

NOTE: updated version adding ability to process multiline
fields, discard small ( < 2) strings, and discard strings
with pure html, TT or punctuation.

To test:
1) Apply patches from Bug 13897
2) Apply this patch
3) Go to misc/translation
4) Create translation files for a NEW language
   $ ./translate create xx-YY

   check new file 'xx-YY-installer.po'

5) Copy ../../installer/data/mysql/en/optional/auth_val.yml
   into ../../installer/data/mysql/en/marcflavour/marc21/mandatory/
   and ../../installer/data/mysql/en/marcflavour/unimarc/mandatory/

   remove po/xx-YY*, then repeat creation

   check new files 'xx-YY-installer.po', 'xx-YY-installer-MARC21.po'
   and 'xx-YY-installer-UNIMARC.po'

   remove all new files

6) Create for xx-YY again and try update
   $ ./translate create xx-YY
   edit ../../installer/data/mysql/en/optional/auth_val.yml
   and change one char in one of the translatable values,
   also edit 'xx-YY-installer.po', translate the same
   string (in msgstr).

   Do an update
   $ ./translate update xx-YY

   check in 'xx-YY-installer.po' a fuzzy value for the
   translated value and the preservation of the translation
   Fix the translation, or add a new one.

7) Create an install dir for xx-YY
   ./translate install xx-YY

    Check new dir '../../installer/data/mysql/xx-YY/'
    Check files on it
    $ tree ../../installer/data/mysql/xx-YY/
    and compare with ../../installer/data/mysql/en/

    All installation files must be present

8) Try a new Koha install using this language in the
   usual way.
   Check in authorised_values table for the translated string.

9) Try create an install dir for an existing language
   (eg. es-ES, de-DE or fr-FR ), eg.
   ./translate install de-DE

   Install dir is detected and not changed, a note is printed.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-09 13:50:41 +00:00
52e95fff34
Bug 24735: Remove QueryParser-related code
At the last development meeting we have voted to remove the
QueryParser-related code
https://wiki.koha-community.org/wiki/Development_IRC_meeting_19_February_2020

Hea tells us that it has not been adopted, and the code/bug tracker that
it is not really usable as it. As nobody is willing to work on it, we
decided to remove it instead.

Test plan:
 % prove t/db_dependent/Search.t
must return green

See commits from bug 9239 and confirm that the code is removed in this
patch.

Also play with the search on the UI and confirm that you do not see
obvious regressions

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-02 11:13:03 +00:00
Bernardo Gonzalez Kriegel
95e4e0a153
Bug 24664: Add missing *-messages-js.po
If you try to update some language translation files
translate script will complain of missing *-messajes-js.po
file.

This patch adds those missing files

To test:
1) Go to misc translation
2) Update some language, eg- fr-FR
Check error
/usr/bin/msgmerge: error while opening "/.../misc/translator/po/es-ES-messages-js.po" for reading: No such file or directory
3) Apply this patch
4) Repeat 2), no error message

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-02 10:51:25 +00:00
Julian Maurice
cab8dd8cf1
Bug 24734: Fix paths in LangInstaller.pm for JS files
Use intrahtdocs and opachtdocs in order to get the correct paths for all
kind of installations

Test plan:
1. With a dev install, run ./translator create/update/install xx-XX and
   verify that there is no error message
2. With a standard install, run ./translator create/update/install xx-XX
   and verify that there is no error message

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested for dev/single/standard installs, no errors,
just a (normal) warn from po2json.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-02 09:49:56 +00:00
7d8b96803f
Bug 24545: Fix license statements
Bug 9978 should have fixed them all, but some were missing.
We want all the license statements part of Koha to be identical, and
using the GPLv3 statement.

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>
2020-02-24 13:31:26 +00:00
Bernardo Gonzalez Kriegel
e875e39806
Bug 24211: Compress/uncompress translation files
This patch adds the ability to compress/uncompress
translations files.

On update/install the files are uncompressed first

The only gain is to use less space.

To test:
1) Apply the patch
2) Go to misc/translator
3) Try it
   $ ./translate compress fr-FR (check po/*.gz)
   $ ./translate uncompress fr-FR ( check normal files)
4) Try again with verbose mode
   $ ./translate compress fr-FR -v (list compressed files)
   $ ./translate uncompress fr-FR -v (list uncompressed files)
5) Try update compressed files
   $ ./translate compress fr-FR
   $ ./translate update fr-FR (result is uncompressed)
6) Try install compressed files
   $ ./translate compress fr-FR
   $ ./translate install fr-FR
7) Try compress all
   $ ./translate compress  (add '-v' for verbose output)
8) Try uncompress all
   $ ./translate uncompress  (add '-v' for verbose output)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-24 13:19:31 +00:00
cd2a99e456
Bug 24114: (QA follow-up) Fix counts for lock, anonymize and delete
Since these operations impact on the resultset, the counts should be
saved before.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-24 13:17:39 +00:00
7e1db56dd8
Bug 24114: Remove warn statements from Koha::Patrons
The warn must be done in the cronjob.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Followed this test plan (with two follow-ups applied):
[1] Prefs: UnsubscribeReflectionDelay=1, PatronAnonymizeDelay=2, PatronRemovalDelay=3, FailedLoginAttempts was undef
[2] Pick borrower and set expiry to NOW-2, and lock him (login_attempts=-1) Could be achieved too by settings FailedLoginAttempts and trying wrong passwords. Run cleanup job:
    Locked 0 patrons
    Anonymized 1 patrons
    Deleted 0 patrons
[3] Pick borrower, set expiry to NOW-3. Run cleanup job:
    Locked 0 patrons
    Anonymized 0 patrons
    Deleted 1 patrons

Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-24 13:17:39 +00:00
18afaf438b
Bug 24527: misc/cronjobs/update_totalissues.pl problem with multiple items
misc/cronjobs/update_totalissues.pl when issuing statistics table, no-incremental,  has a problem for biblio with multiple items.
The first SQL query gets the biblios linked to items with issues in statistics :

SELECT
  biblio.biblionumber, COUNT(statistics.itemnumber)
FROM
  biblio
LEFT JOIN
  items
ON
  (biblio.biblionumber=items.biblionumber)
LEFT JOIN
  statistics
ON
  (items.itemnumber=statistics.itemnumber)
WHERE
  statistics.type = 'issue'
$limit
GROUP BY
  biblio.biblionumber

The second SQL query is :
SELECT
  biblio.biblionumber, 0
FROM
  biblio
LEFT JOIN
  items
ON
  (biblio.biblionumber=items.biblionumber)
LEFT JOIN
  statistics
ON
  (items.itemnumber=statistics.itemnumber)
WHERE
  statistics.itemnumber IS NULL
GROUP BY
  biblio.biblionumber

The problem is that this second query will set to 0 where ANY item has no entry in statistics table.
So when running it sets 0 to the biblio that had a value from first
query.

I think the best fix is to use "WHERE statistics.type = 'issue'" inside que JOIN :
LEFT JOIN statistics ON (items.itemnumber=statistics.itemnumber AND statistics.type = 'issue')

Test plan :
1) Begin with an empty database
2) Create a biblio 1 with no items
3) Create a biblio 2 with 3 items
4) Create a biblio 3 with 2 items
5) Checkout and checkin all items of biblio 2
6) Checkout and checkin the firt item of biblio 3
7) run misc/cronjobs/update_totalissues.pl --use-stats -v
8) Check biblio 1 has biblioitems.totalissues = 0
9) Check biblio 2 has biblioitems.totalissues = 3
10) Without patch the biblio 3 has biblioitems.totalissues = 0
11) With patch the biblio 3 has biblioitems.totalissues = 1
12) Check misc/cronjobs/update_totalissues.pl --incremental is OK

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-24 13:14:24 +00:00
aa83cb59ce
Bug 21633: Remove finesMode 'test'
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-19 11:32:11 +00:00
71d0775cc7
Bug 24651: Add maxdays option to fines cronjob
This patch adds an optional maxdays parameter to the fines.pl cronjob.
The new parameter allows system administrators to set a maximum number
of days for the job to process overdues.  This can improve performance.

Signed-off-by: Sally Healey <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-17 11:26:22 +00:00
82716a0172
Bug 23084: Replace grep {^$var$} with grep {$_ eq $var}
We certainly faced 3 similar bugs due to this syntax: bug 23006, bug
22941 and bug 17526.

To prevent other issues related to this syntax this patch suggests to
replace them all in one go.

Test plan:
Confirm that the 2 syntaxes are similar
Eyeball the patch and confirm that there is no typo!

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-17 10:44:45 +00:00