koha.git
4 years agoBug 23571: Prevent concurrent execution of fines.pl
Tomas Cohen Arazi [Sun, 12 Apr 2020 13:27:57 +0000]
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>

4 years agoBug 25109: (QA follow-up) Add a test for lockdir writable in about.pl
Tomas Cohen Arazi [Mon, 13 Apr 2020 18:45:50 +0000]
Bug 25109: (QA follow-up) Add a test for lockdir writable in about.pl

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>

4 years agoBug 25109: (QA follow-up) Fix typo in configuration entry name
Tomas Cohen Arazi [Mon, 13 Apr 2020 15:02:29 +0000]
Bug 25109: (QA follow-up) Fix typo in configuration entry name

This patch fixes an error in the configuration retrieving line.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25109: Add 'wait' tests
Tomas Cohen Arazi [Mon, 13 Apr 2020 11:43:10 +0000]
Bug 25109: Add 'wait' tests

This simple patch introduces a test for the lock waiting scenario. It
replicates the previous tests, but calls a script that passes the wait
=> 1 parameter to ->lock_exec.

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>

4 years agoBug 25109: Add ->new and ->lock_exec to Koha::Script
Tomas Cohen Arazi [Fri, 10 Apr 2020 22:37:31 +0000]
Bug 25109: Add ->new and ->lock_exec to Koha::Script

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>

4 years agoBug 25109: Add entry in about.pl about the configuration lockdir entry
Tomas Cohen Arazi [Fri, 10 Apr 2020 22:36:41 +0000]
Bug 25109: Add entry in about.pl about the configuration lockdir entry

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>

4 years agoBug 25109: Add lockdir configuration entry
Tomas Cohen Arazi [Fri, 10 Apr 2020 22:36:09 +0000]
Bug 25109: Add lockdir configuration entry

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>

4 years agoBug 23871: data inconsistencies - check title exists
Fridolin Somers [Tue, 22 Oct 2019 12:31:08 +0000]
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>

4 years agoBug 21865: allow test arg alone
Fridolin Somers [Wed, 11 Mar 2020 14:39:18 +0000]
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>

4 years agoBug 21865: add confirm to remove_unused_authorities.pl script
Fridolin Somers [Mon, 19 Nov 2018 14:45:49 +0000]
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>

4 years agoBug 21865: ES compatiblity of remove_unused_authorities.pl
Fridolin Somers [Mon, 19 Nov 2018 14:19:46 +0000]
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>

4 years agoBug 21865: improve remove_unused_authorities.pl script
Fridolin Somers [Mon, 19 Nov 2018 13:46:05 +0000]
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>

4 years agoBug 22774: DBRev 19.12.00.070
Martin Renvoize [Tue, 14 Apr 2020 15:52:49 +0000]
Bug 22774: DBRev 19.12.00.070

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22774: (QA follow-up) Rephrase OPAC notes
Katrin Fischer [Mon, 13 Apr 2020 18:28:06 +0000]
Bug 22774: (QA follow-up) Rephrase OPAC notes

I've changed the OPAC notes a little bit, main change is
the removal of the <b> tags used to highlight single words
in one sentence as they would result in splitting up the
sentence into multiple parts which makes proper translations really
hard.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22774: (QA follow-up) Add syspref descriptions to database update and sysprefs.sql
Katrin Fischer [Mon, 13 Apr 2020 18:11:00 +0000]
Bug 22774: (QA follow-up) Add syspref descriptions to database update and sysprefs.sql

Moves the updatedatabase entry to the new format and
adds information for the explanation column of the
systempreferences table.

Also slightly rephrases the description in the system preference
editor.

To test:
- Verify database update still works the same with addition
  of explanations
- Verify the sys pref description makes sense

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22774: (follow-up) Limit purchase suggestion in a specified time period
Nazlı Çetin [Mon, 23 Mar 2020 13:30:48 +0000]
Bug 22774: (follow-up) Limit purchase suggestion in a specified time period

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22774: Limit Purchase Suggestion in a specified Time period
Devinim [Thu, 9 Jan 2020 10:48:15 +0000]
Bug 22774: Limit Purchase Suggestion in a specified Time period

Test plan:
 1 - Apply this patch
 2 - Run updatedatabase.pl
 3 - By default the preferences are blank and do not limit.
 4 - Set the limits to 3 in 30 days
 5 - Go to purchase suggestion page from OPAC as a logged in patron
 6 - Place 3 suggestions and confirm you cannot place any more
 7 - Alter one of the suggestions to have been made more than 30 days ago
    UPDATE suggestions SET suggesteddate = '2020-01-01' WHERE suggestionid=3;
 8 - Confirm you can place another suggestion
 9 - Log out of OPAC
10 - Make sure AnonSyggestions is set to 'Allow' and AnonymousPatron is set
11 - Confirm anonymous suggestions are not limited by the syspref
12 - Confirm that a blank value in either  MaxTotalSuggestions  or  NumberOfSuggestionDays  does not limit suggestions

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Rhonda Kuiper <rkuiper@roundrocktexas.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22774: New systempreferences for suggestions added to sysprefs.sql
Nazlı Çetin [Fri, 21 Feb 2020 14:08:16 +0000]
Bug 22774: New systempreferences for suggestions added to sysprefs.sql

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20728: Remove the 2 GetLastOrder* subroutines
Jonathan Druart [Fri, 15 Mar 2019 22:38:29 +0000]
Bug 20728: Remove the 2 GetLastOrder* subroutines

At this point the 2 subroutines are no longer in used.

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>

4 years agoBug 20728: Replace the calls by their Koha::Acq::Orders->search equivalent
Jonathan Druart [Fri, 15 Mar 2019 22:37:52 +0000]
Bug 20728: Replace the calls by their Koha::Acq::Orders->search equivalent

There are 2 subroutines from C4::Acquisition that could be removed:
- GetLastOrderReceivedFromSubscriptionid
- GetLastOrderNotReceivedFromSubscriptionid

After bug 20726 only GetLastOrderReceivedFromSubscriptionid will be used
(from acqui/neworderempty.pl) and this call could be replaced easily with Koha::Acquisition::Orders

The code (+ tests) related to these 2 subroutines could then be removed.

The parameters for the search is basic and does no really deserve its own subroutine.

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>

4 years agoBug 20728: Proof that there is no cheating
Jonathan Druart [Fri, 15 Mar 2019 22:24:19 +0000]
Bug 20728: Proof that there is no cheating

To make sure the replacing code will acchieve the same things as the
actual one, we replace the raw SQL query with the DBIC version of it.
Then the tests will show us that they are equivalent.

Test plan:
Apply only this patch, run the tests, confirm they pass.

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>

4 years agoBug 23591: Compiled CSS
Martin Renvoize [Tue, 14 Apr 2020 15:37:43 +0000]
Bug 23591: Compiled CSS

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23591: Hide archived suggestions
Jonathan Druart [Tue, 19 Nov 2019 16:35:09 +0000]
Bug 23591: Hide archived suggestions

However we are adding a note on top of the table to tell how many
suggestions are archived. It seems that there is no good reason to
display the archived suggestions on this table.

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>

4 years agoBug 23591: Use same css for suggestion notes
Jonathan Druart [Mon, 18 Nov 2019 15:37:43 +0000]
Bug 23591: Use same css for suggestion notes

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>

4 years agoBug 23591: Display a new "Suggestion detail" tab on the bib detail page
Jonathan Druart [Mon, 18 Nov 2019 14:50:55 +0000]
Bug 23591: Display a new "Suggestion detail" tab on the bib detail page

This patch adds a new "Suggestion detail" tab on the bibliographic
detail page. It will help suggestion management.

Test plan:
- Create several suggestions for a given biblio
- Go to the detail page of the bibliographic record and confirm that
there is a new "Suggestion detail" tab with all the suggestions you
created.

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>

4 years agoBug 23591: Add some useful methods to Koha::Suggestions
Jonathan Druart [Mon, 18 Nov 2019 14:52:57 +0000]
Bug 23591: Add some useful methods to Koha::Suggestions

Those are methods initially written for bug 23991. I finally need them
before than expected.

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>

4 years agoBug 23596: (follow-up) Add missing use statement and set correct variable name
Jonathan Druart [Mon, 17 Feb 2020 16:21:03 +0000]
Bug 23596: (follow-up) Add missing use statement and set correct variable name

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23596: Edit suggestion's reason when receiving
Jonathan Druart [Fri, 8 Nov 2019 14:50:57 +0000]
Bug 23596: Edit suggestion's reason when receiving

This patch displays and let the librarian edit the suggestion.reason
information when receiving an order.

Note that if no reason was given the edit is not possible (easily
modifiable if needed but it seems that we do not want to display too
much details unnecessarily)

Test plan:
- Create a suggestion and fill the reason
- Create an order from this suggestion
- Close the basket and start receiving the order
=> The reason is displayed and editable
- Modify the reason and click Save
- Receive again
=> The reason has been correctly modified
- Play with the "Others..." option and give a specific reason

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25053: Clarify the description of syspref PatronSelfRegistrationExpireTemporaryAc...
David Roberts [Sat, 4 Apr 2020 23:13:00 +0000]
Bug 25053: Clarify the description of syspref PatronSelfRegistrationExpireTemporaryAccountsDelay

This patch changes the wording of this system preference.

To test:

1) Check the current wording of this system preference.
2) Install the patch.
3) Check that the wording of this system preference has changed to "Delete patrons still in the category indicated by PatronSelfRegistrationDefaultCategory X days after account creation."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22784: DBRev 19.12.00.069
Martin Renvoize [Tue, 14 Apr 2020 15:25:31 +0000]
Bug 22784: DBRev 19.12.00.069

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22784: Fix small display issue with fa icon in suggestions table
Katrin Fischer [Sat, 11 Apr 2020 09:39:31 +0000]
Bug 22784: Fix small display issue with fa icon in suggestions table

The <i> was not closed resulting in the "Archived" displaying in
the wrong font. Might be a browser specific issue, but adding the
closing </i> fixed it and follows the existing pattern.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22784: DBIC changes
Jonathan Druart [Fri, 27 Mar 2020 06:55:52 +0000]
Bug 22784: DBIC changes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22784: Add a cronjob to archive suggestions given age or status criteria
Jonathan Druart [Thu, 14 Nov 2019 15:41:40 +0000]
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>

4 years agoBug 22784: Do not display an empty table
Jonathan Druart [Mon, 18 Nov 2019 14:16:24 +0000]
Bug 22784: Do not display an empty table

This is terrible and highlight that the whole script must be rewrite.
GetDistinctValues does not handle the "archived" flag (and we do not
want to put our hands there), so let's hack that and plan to rewrite the
whole script.

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>

4 years agoBug 22784: Bugfix - do not modify #description build Debian packages from a git repos...
Jonathan Druart [Mon, 18 Nov 2019 13:56:05 +0000]
Bug 22784: Bugfix - do not modify #description build Debian packages from a git repository

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>

4 years agoBug 22784: Add the ability to archive/unarchive a purchase suggestions
Jonathan Druart [Wed, 13 Nov 2019 15:34:56 +0000]
Bug 22784: Add the ability to archive/unarchive a purchase suggestions

There are performance issues when searching suggestions if there are
thousands of suggestions.
To prevent that we are going to add the ability to archive purchase
suggestions, in order to remove them from the search list (by default).

Test plan:
0. Apply all the patches, execute the updatedatabase.pl script, restart
all
1. Create some suggestions
2. Search for them
3. Use the "Archive" action button for one of them
4. Restart the search
=> The archived suggestion does no longer appear in the list
5. Use the filter "Included archived" in the "Suggestion information"
filter box
=> The archived suggestion is now displayed
6. Use other filters
=> The "archived" filter is kept from one search to another
7. Use one of the action at the bottom of the suggestion list (change
the status for instance)
=> The "archived" filter is still kept

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>

4 years agoBug 22784: DB Changes
Jonathan Druart [Wed, 13 Nov 2019 14:06:23 +0000]
Bug 22784: DB Changes

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>

4 years agoBug 24547: Add more action logs for holds
Kyle M Hall [Thu, 30 Jan 2020 15:29:05 +0000]
Bug 24547: Add more action logs for holds

It seems like ModReserveFill and ModReserveAffect should both produce action logs for holds.

Test Plan:
1) Apply this patch
2) Place a hold
3) Check in the item to trap the hold
4) Check out the item to fill the hold
5) Check the action logs for that reserve id
6) Note the new logs!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: DBRev 19.12.00.068
Martin Renvoize [Tue, 14 Apr 2020 14:57:58 +0000]
Bug 21190: DBRev 19.12.00.068

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: (follow-up) Save patron id in failure when available
Marcel de Rooy [Thu, 30 Jan 2020 09:27:56 +0000]
Bug 21190: (follow-up) Save patron id in failure when available

The wrong password might belong to an existing user. If that is the case,
we have a $patron.
Note that logaction will save the object info but has no user in the
context environment for a failure.

Test plan:
Login with good user, bad pw and bad user, bad pw. Check logviewer.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: Add tests for authentication success and failure
Marcel de Rooy [Mon, 28 Oct 2019 10:06:11 +0000]
Bug 21190: Add tests for authentication success and failure

Test plan:
Run t/db_dependent/Log.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: Allow browsing the system logs for AUTH events
Marcel de Rooy [Fri, 25 Oct 2019 10:12:16 +0000]
Bug 21190: Allow browsing the system logs for AUTH events

Trivial change, adding AUTH to viewlog template only.

Test plan:
Look for the Authentication log lines in viewlog.pl (intranet tools).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: Add authentication logging to checkpw
Marcel de Rooy [Fri, 25 Oct 2019 09:55:32 +0000]
Bug 21190: Add authentication logging to checkpw

Add optional logging for successful and failing login attempts in
checkpw.

Test plan:
Enable the preferences
Perform a good login and a bad attempt
Check action_logs

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: Introduce preferences AuthFailureLog and AuthSuccessLog
Marcel de Rooy [Fri, 25 Oct 2019 09:36:03 +0000]
Bug 21190: Introduce preferences AuthFailureLog and AuthSuccessLog

Test plan:
Run atomic update.
Check the Logs tab of preferences.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: Remove t/Log.t
Marcel de Rooy [Fri, 25 Oct 2019 08:21:20 +0000]
Bug 21190: Remove t/Log.t

Since we have t/db../Log.t and t/Log.t simply does nothing, we would
better remove it.

No test plan either :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: Add interfaces parameter to POD in C4::Logs
Marcel de Rooy [Fri, 25 Oct 2019 08:10:18 +0000]
Bug 21190: Add interfaces parameter to POD in C4::Logs

Just fixing documentation along the way.
No test plan, just read the patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: Add subtest to Log.t for GDPR logging
Marcel de Rooy [Fri, 25 Oct 2019 07:32:56 +0000]
Bug 21190: Add subtest to Log.t for GDPR logging

Apart from a new subtest, doing some more cleanup:
[1] Copyright statement
[2] Removing the (unneeded) flush
[3] Removing C4::Log from the BEGIN block; we seem to skip that nowadays.
[4] $succes goes to the subtest, $schema and $dbh are global our vars.
    Not required but just what we should do if it would run under Plack.

Test plan:
Run t/db_dependent/Log.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 21190: Prepare Log.t for further changes
Marcel de Rooy [Fri, 25 Oct 2019 07:14:18 +0000]
Bug 21190: Prepare Log.t for further changes

This patch only makes cosmetic changes:
[1] It moves the existing tests at 'root level' inside a new subtest.
[2] It obviously adds indentation for step 1.
[3] It fixes some whitespace (tabs, space before newline)

Test plan:
Run t/db../Log.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25027: Use localStorage instead of sessionStorage for results browser
Jonathan Druart [Tue, 31 Mar 2020 14:39:12 +0000]
Bug 25027: Use localStorage instead of sessionStorage for results browser

Staff side, when a search a done and a result clicked, a browser appears
on the left, to navigate between the different results.

We use sessionStorage to know the list of biblionumber from the result.

As sessionStorage is only for the current tab, we do some ugly things,
to catch the click events, then open the new tab, attach it to the
current window, and put the focus back on the result list.

We really should not do that, and let the user decide what they want to
do with their clicks!

To do so, let use the correct storage, localStorage, and have the
results shared between the windows.

We may need to clear that at some point, isn't it?

Test plan:
Launch a search, click result (left or middle), confirm you see the
browser and that the window/tab opened like any other websites
(depending on your web browser settings).

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20754: (RM follow-up) Fix DB Update
Martin Renvoize [Tue, 14 Apr 2020 14:54:17 +0000]
Bug 20754: (RM follow-up) Fix DB Update

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25044: (follow-up) Fix wrong tests
Tomas Cohen Arazi [Tue, 14 Apr 2020 11:53:15 +0000]
Bug 25044: (follow-up) Fix wrong tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22534: (RM follow-up) Remove errant hidden file
Martin Renvoize [Tue, 14 Apr 2020 10:08:32 +0000]
Bug 22534: (RM follow-up) Remove errant hidden file

An nfs share file got commited by mistake :(

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23173: Compiled CSS
Martin Renvoize [Tue, 14 Apr 2020 08:13:17 +0000]
Bug 23173: Compiled CSS

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25044: Remove the need to define koha_object[s]_class for standard object class...
Jonathan Druart [Thu, 2 Apr 2020 14:03:17 +0000]
Bug 25044: Remove the need to define koha_object[s]_class for standard object class names

In Koha::Object[s]->prefetch_whitelist, there is a call to the koha_object[s]_class DBIC resultset class. We should not, otherwise those 2 methods will have to be defined all the time, even when we can guess it easily.

Koha::Item <> Schema::Result::Item => standard
Koha::Acquisition::Order <> Schema::Result::Aqorder => non-standard

sub _get_object_class {
    my ( $type ) = @_;
    return unless $type;

    if( $type->can('koha_object_class') ) {
        return $type->koha_object_class;
    }
    $type =~ s|Schema::Result::||;
    return ${type};
}

Test plan:
 % prove t/db_dependent/Koha/Object.t t/db_dependent/Koha/Objects.t
should return green before and after this patch

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20370: Misleading comment for bcrypt - #encrypt it; Instead it should be #hash it
David Roberts [Mon, 13 Apr 2020 01:22:07 +0000]
Bug 20370: Misleading comment for bcrypt - #encrypt it; Instead it should be #hash it

This patch changes the wording of the comment

To test:

1) Check the wording of Line 67 of Koha/AuthUtils.pm
2) Apply the patch
3) Check that the wording has changed from "Encrypt it" to "Hash it"

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24993: fix increment
Liz Rea [Thu, 9 Apr 2020 15:50:04 +0000]
Bug 24993: fix increment

Aparently ((i++)) isn't portable, changed for an admittedly uglier
but functional increment.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24993: Make sure we are not going to loop indefinitely
Jonathan Druart [Wed, 8 Apr 2020 09:57:06 +0000]
Bug 24993: Make sure we are not going to loop indefinitely

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24993: Make sure SIP server is stopped before restarting it
Jonathan Druart [Thu, 2 Apr 2020 10:36:16 +0000]
Bug 24993: Make sure SIP server is stopped before restarting it

Sometimes doing koha-sip --restart instance happens too fast and
the SIP server is not started.

To test:
- have SIP enabled and running for your instance
- issue a restart, make sure it restarts
  sudo koha-sip --restart inst

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25008: Overload Koha::RecordProcessor->options to update filters
Tomas Cohen Arazi [Mon, 30 Mar 2020 13:06:43 +0000]
Bug 25008: Overload Koha::RecordProcessor->options to update filters

This patch overloads the 'options' accessor generated by Class:Accessor.
It does so the passed options are used to refresh the loaded filters.

Tests are added for this overloaded method as well.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/RecordProcessor.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25008: Tests for ->options
Tomas Cohen Arazi [Mon, 30 Mar 2020 13:20:11 +0000]
Bug 25008: Tests for ->options

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25008: Regression tests
Tomas Cohen Arazi [Fri, 27 Mar 2020 20:53:32 +0000]
Bug 25008: Regression tests

This patch highlights a behaviour of Koha::RecordProcessor that is
unexpected: if you change the original options using ->options, the
loaded filters don't pick the change. That's because the filter objects
are loaded on ->new, and they are never updated.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/RecordProcessor.t
=> FAIL: Test prove ->options doesn't update the filters!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24764: TinyMCE shouldnt do automatic code cleanup when editing HTML in News Feature
Lucas Gass [Thu, 26 Mar 2020 22:46:26 +0000]
Bug 24764: TinyMCE shouldnt do automatic code cleanup when editing HTML in News Feature

TEST PLAN:
1. Make a new news item and use the TinyMCE editor, click on the <> icon to go to the Source code editor
2. Add some HTML like <i class="fa fa-facebook-official" aria-hidden="true">TEST</i> and save it.
3. Go back in and notice that TinyMCE has changed it to: <p><em class="fa fa-facebook-official">TEST</em></p>
4. It should not auto clean up and also it should not autowrap with <p> tag.
5. Apply patch patch, and repeat step 2. Save again.
6. It should not have automatiicly changed any HTML or added any <p> wrapper.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24903: Add tests for _handle_seqno
Marcel de Rooy [Thu, 19 Mar 2020 13:39:14 +0000]
Bug 24903: Add tests for _handle_seqno

Trivial tests.

Test plan:
Run t/Serials/ModSerialStatus.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24903: Special characters like parentheses in numbering pattern cause duplication...
Marcel de Rooy [Thu, 19 Mar 2020 13:20:38 +0000]
Bug 24903: Special characters like parentheses in numbering pattern cause duplication in recievedlist

Test plan:
Use serial with a numbering pattern with parentheses like "2018 (No. 1)".
Mark serial issue as arrived, check receivedlist on summary.
Edit issue again, check if not duplicated on receivedlist.
Mark issue as missing or not available, check missinglist.
Mark missing issue as not missing, check list again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25038: Fix tabs on the OPAC reading history view
Jonathan Druart [Tue, 7 Apr 2020 11:25:09 +0000]
Bug 25038: Fix tabs on the OPAC reading history view

OPAC reading history table has three tabs for different checkout types: All, Checkouts, On-site checkouts.

However, all of your checkouts are visible every tab regardless of checkout type.

Test plan:
1. Enable OnSiteCheckouts system preference
2. Perform two checkouts: one normal checkout, one on-site checkout
3. Go to OPAC /cgi-bin/koha/opac-readingrecord.pl
4. Observe your checkouts all are visible in first tab
5. Select second tab and notice that the table is now filtered
6. Same with third tab

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24966: Add unit tests
Kyle M Hall [Fri, 10 Apr 2020 10:43:51 +0000]
Bug 24966: Add unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24966: (QA follow-up) Fix return value of hold_patron_bcode
Marcel de Rooy [Fri, 10 Apr 2020 09:50:13 +0000]
Bug 24966: (QA follow-up) Fix return value of hold_patron_bcode

It is used in list context, but we need a scalar value.
Can be fixed by adding scalar's, or returning empty string as here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25040: monkeypatch Schema::Loader for recent MariaDB
Martin Renvoize [Fri, 3 Apr 2020 10:16:39 +0000]
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>

4 years agoBug 25069: Fix AddressFormat="fr" behavior
Jonathan Druart [Mon, 6 Apr 2020 10:44:13 +0000]
Bug 25069: Fix AddressFormat="fr" behavior

Something went wrong during a rebase of bug 13618
  commit dcd1f5d48c758aee17b6c6f069c6146b42efe117
  Bug 13618: Add html filters to all the variables

Several changes related to AddressFormat are wrong:

-    [% IF Koha.Preference( 'AddressFormat' ) %]
-        [% INCLUDE "member-main-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
-    [% ELSE %]
-        [% INCLUDE 'member-main-address-style-us.inc' %]
-    [% END %]
+    [% SWITCH Koha.Preference( 'AddressFormat' ) %]
+        [% CASE 'de' %]
+            [% INCLUDE 'member-main-address-style-de.inc' %]
+        [% CASE # us %]
+            [% INCLUDE 'member-main-address-style-us.inc' %]
+     [% END %]

Test plan:
Create a patron with all the address fields filled
Play with the 3 option values of AddressFormat, and confirm that the address is displayed correctly
on the patron's view, and in the patron module (top left)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25005: (bug 22868 follow-up) Fix suggestions pending on main page
Jonathan Druart [Tue, 7 Apr 2020 11:32:51 +0000]
Bug 25005: (bug 22868 follow-up) Fix suggestions pending on main page

There is a "Suggestions pending approval" link on the main page that is
displayed if there are new suggestions and the logged in user has the
permission to manage them.

On bug bug 22868 the permission changed from
acquisition.suggestions_manage to suggestions.suggestions_manage

But in the template, one occurrence has not been replaced correctly
(certainly because it was already wrong actually).

Test plan:
Create a suggestion at the OPAC
Create a patron with the suggestions permission
Use this patron to login at the staff interface
=> Without this patch the link does not appear on the main page
=> With this patch applied the link appears

Signed-off-by: David Roberts <david@koha-ptfs.co.uk>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24800: Handle inexistent return date on self checking
Jonathan Druart [Wed, 11 Mar 2020 12:01:52 +0000]
Bug 24800: Handle inexistent return date on self checking

See bug 24800 comment 0 for a description of the problem.

We do not want the SIP server to crash if it receives a checkin request
with a return date that is not given.

The option this patch chose is to parse it only if provided.

Signed-off-by: Clemens Elmlinger <clemens.elmlinger@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24800: Add tests
Jonathan Druart [Wed, 11 Mar 2020 11:56:41 +0000]
Bug 24800: Add tests

Signed-off-by: Clemens Elmlinger <clemens.elmlinger@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25050: Adjust marc_records_to_documents to search entire mapping array
Nick Clemens [Fri, 3 Apr 2020 12:14:27 +0000]
Bug 25050: Adjust marc_records_to_documents to search entire mapping array

There was an assumption in the ES code that match-heading mappings will appear in
a specified portion of the mappings array.

Certain mappings setups will not meet this assumption.
We need to move our searching up one level

The key seems to be having a mapping for a complete field, say 150, in both the
match-heading and another field as well as having mappings for ungrouped fields like
150a 150ab etc.

The unit test coverage should be sufficient for testing

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25050: Unit tests
Nick Clemens [Fri, 3 Apr 2020 12:12:49 +0000]
Bug 25050: Unit tests

This patch simplay alters the data we use for the tests, doing so causes them to fail

To test:
1 - Apply only this patch
2 - prove -v t/Koha/SearchEngine/Elasticsearch.t
3 - It fails!
4 - Apply next patch
5 - It passes!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24266: (alternate patch) Only use defined borrowernumbers in reconcile_balances...
Aleisha Amohia [Mon, 16 Mar 2020 22:09:51 +0000]
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>

4 years agoBug 25095: Remove warn left in FeePayment.pm
Kyle M Hall [Thu, 9 Apr 2020 12:24:44 +0000]
Bug 25095: Remove warn left in FeePayment.pm

It appears that a debugging statement was accidentally left in FeePayment.pm by bug 5605.

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22778: Add unit test
Kyle M Hall [Wed, 8 Apr 2020 14:52:23 +0000]
Bug 22778: Add unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22778: Suggestions with no "suggester" can cause errors
Kyle M Hall [Thu, 25 Apr 2019 19:50:35 +0000]
Bug 22778: Suggestions with no "suggester" can cause errors

If one tries to modify a suggestion that has no suggester you will get the following error:

Can't call method "lang" on an undefined value at /usr/share/koha/lib/C4/Suggestions.pm line 506

Koha assumes that every suggestion has a borrowernumber in suggestedby

Test Plan:
1) Create a suggestion with an unpopulated suggestedby
2) Attempt to modify that suggestion
3) Note the error
4) Apply this patch
5) Restart all teh things
6) Attempt to modify that suggestion
7) No error!

Signed-off-by: David Roberts <david@koha-ptfs.co.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24027: Add POD about the new parameter in Koha::Item->store
Jonathan Druart [Wed, 8 Apr 2020 14:11:54 +0000]
Bug 24027: Add POD about the new parameter in Koha::Item->store

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24027: (QA follow-up) Fix POD warning
Tomas Cohen Arazi [Wed, 8 Apr 2020 13:17:32 +0000]
Bug 24027: (QA follow-up) Fix POD 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>

4 years agoBug 24027: Call ModZebra once after all items added/deleted in a batch
Andrew Nugged [Mon, 6 Apr 2020 16:11:35 +0000]
Bug 24027: Call ModZebra once after all items added/deleted in a batch

Issue description:
- call to ModZebra was unconditional inside 'store' method for Koha::Item,
  so it was after each item added, or deleted.
- ModZebra called with param biblionumber, so it is the same parameter
  across calls for each items with same biblionumber, especially when we
  adding/removing in a batch.
- with ElasticSearch enabled this makes even more significant load
  and it is also progressively grows when more items already in DB

Solution:
- to add extra parameter 'skip_modzebra_update' and propagate it down to
 'store' method call to prevent call of ModZebra,
- but to call ModZebra once after the whole batch loop in the upper layer

Test plan / how to replicate:
- make sure that you have in the admin settings "SearchEngine" set to
  "Elasticsearch" and your ES is configured and working
  ( /cgi-bin/koha/admin/preferences.pl?op=search&searchfield=SearchEngine )
- select one of biblioitems without items
  ( /cgi-bin/koha/cataloguing/additem.pl?biblionumber=XXX )
- press button "add multiple copies of this item",
- enter 200 items, start measuring time and submit the page/form...

On my test machine when adding 200 items 3 times in a row (so 600 in
total, but to show that time grows with every next batch gradually):

WHEN ElasticSearch DISABLED (only Zebra queue):
- 9s, 12s, 13s
WHEN ElasticSearch ENABLED:
- 1.3m, 3.2m, 4.8m
WITH PATCH WHEN ElasticSearch ENABLED:
- 10s, 13s, 15s

Same slowness (because also same call to ModZebra) happens when you try
to delete all items ("op=delallitems"). And same fix.

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>

4 years agoBug 23514: Split Call Numbers for all layout types
Theodoros Theodoropoulos [Wed, 8 Apr 2020 07:21:12 +0000]
Bug 23514: Split Call Numbers for all layout types

This patch ensures call numbers are properly split for layout types
other than 'BAR'.

Test plan:

1. Go to Label Creator and choose/create a Label Layout with "Choose
layout type: Biblio"
2. make sure you have at least "itemcallnumber" in Bibliographic data to
print/Data fields
3. check "Split call numbers" box and save the layout (ie testlayout)
4. create a label batch, using items that have a call number (ie
DC611.B848 H84 1997). LCC is used here, but you may try with Dewey as
well.
5. export selected batch using any template and the layout you created
in previous step to a PDF
6. Call numbers are splitted (as expected) in the resulting PDF file
7. edit the layout you created in the previous step (ie testlayout) and
change the  "Choose layout type:" to either Biblio/Barcode (BIBBAR) or
Barcode/Biblio (BARBIB)
8. export the same batch using the same template and layout as before
9. Call numbers are NOT splitted at all

After patch is applied, call numbers splitting functions are applied
even in Biblio/Barcode (BIBBAR) or Barcode/Biblio (BARBIB) layout types.

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>

4 years agoBug 7046: (RM follow-up) Add Filters
Martin Renvoize [Wed, 8 Apr 2020 12:18:46 +0000]
Bug 7046: (RM follow-up) Add Filters

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24840: (follow-up) Catch some further cases of DateTime->now
Martin Renvoize [Wed, 8 Apr 2020 09:43:54 +0000]
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>

4 years agoBug 24840: Replace DateTime->now with dt_from_string
Nick Clemens [Thu, 26 Mar 2020 11:05:32 +0000]
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>

4 years agoBug 25081: Fix wrong comment
Jonathan Druart [Wed, 8 Apr 2020 09:45:51 +0000]
Bug 25081: Fix wrong comment

Not directly related to previous patch, coming from 23435.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25081: Fix creation of new item for a received issue
Janusz Kaczmarek [Tue, 7 Apr 2020 20:23:20 +0000]
Bug 25081: Fix creation of new item for a received issue

The Bug 23435 introduced the idea of multiple copies added while
receiving a new issue.  Unfortunately, under some circumstances, it
causes no items being added at all.  It occurs stochastically, only
under some conditions.  But it is quite likely to happen while receiving
a supplemental issue.

The reason fot hist is that, in serials-edit.pl, line ca 292 and infra,
@num_copies is treated in the same way as @tags, while it should be
treated similarly to @bibnums.  It will be obvious after examining the
content of parameters tag, subfield, field_value, ..., number_of_copies.
In other words, for every edited issue number_of_copies is a scalar.

Nota bene:
a) beter to initialize $countdistinct with zero;
b) note that in master, now, before applying the patch,
$itemhash{$item}->{'num_copies'} is treated once as a scalar
and in the next line--as an array:

$itemhash{$item}->{'num_copies'} //= 1;

for (my $copy = 0; $copy < $itemhash{$item}->{'num_copies'}[$index];){

TEST PLAN
=========
1. Have a subscription with the option "Create an item
record when receiving this serial" active and try to receive a
supplemental issue.  Control that a new item under the biblio record
(usually) will not be created.
2. Apply the patch.
3. Repeat p. 1 -- a new item should be created.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 22937: Add hint to groups editor
Kyle M Hall [Fri, 27 Mar 2020 16:01:05 +0000]
Bug 22937: Add hint to groups editor

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25046: Add test
Jonathan Druart [Wed, 8 Apr 2020 09:28:31 +0000]
Bug 25046: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25046: Include borrowers.othernames in SELECT statement
Andreas Roussos [Thu, 2 Apr 2020 17:14:57 +0000]
Bug 25046: Include borrowers.othernames in SELECT statement

In C4/Utils/DataTables/Members.pm, the SELECT statement that fetches
patron data from the database does not include borrowers.othernames
in the field list. As a consequence, when the output is in the form
of a DataTable, the Template Toolkit files that refer to .othernames
(such as the patron-title.inc include) won't display the information
from the 'Other name' input field if that field has been filled in.

This patch fixes that.

Test plan:
0) Have a few patrons with some data in the 'Other name' field.
1) Perform a generic search in Home > Patrons to ensure you will get
   a DataTable with results.
2) Observe that the 'Name' column does not include 'Other name' info.
3) Apply the patch, and restart Plack if necessary.
4) Repeat your search: this time you should see the information from
   the 'Other name' field, it will be next to the patron's First name
   and within parentheses.

Sponsored-by: Eugenides Foundation Library
Signed-off-by: Devinim <nazli@devinim.com.tr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 7046: Preselect dropdown option and prefill input
Jonathan Druart [Wed, 8 Apr 2020 08:42:41 +0000]
Bug 7046: Preselect dropdown option and prefill input

With previous renew values

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 7046: Implemented subscription renewal dropdown sub length element
Alex Buckley [Mon, 27 Nov 2017 02:31:35 +0000]
Bug 7046: Implemented subscription renewal dropdown sub length element

To make this work I moved the _get_sub_length function from
subscription-add.pl to C4/Serials.pm so that the subscription-renew.pl
script could also call it to store the sublength for the appropriate
field of the subscriptions database table.

Test plan:
1. Create a subscription and notice that there is a dropdown box for sub
   length containing the values: issues, weeks, months
2. Renew the subscription and notice that there are 3 input text boxes:
   'number of num', 'number of weeks' and 'number of months'
3. Input a 'Number of weeks' value of 2
4. Query the subscription database table and notice that the value of 2
   has been stored in the weeklength field for the subscription record you
   just renewed
5. Apply the patch
6. Renew the subscription and notice that there is now a sublength
   dropdown box containing issues, weeks and months
7. Set the month value to 3
8. Query the database and notice that 3 was stored in the monthlength
   field for the subscription record
9. Create a new subscription and select the sub length values of issues
   and 3
10. Query the database and notice that the numberlength field for the
   subscription you just created is set to 3 showing that the sublength
   dropbox is still working for creating a new subscription

Sponsored-By: Catalyst IT
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24826: Remove warnings from Sendmail
Jonathan Druart [Wed, 11 Mar 2020 15:21:06 +0000]
Bug 24826: Remove warnings from Sendmail

Use of uninitialized value $mail{"Cc"} in substitution (s///) at /usr/share/perl5/Mail/Sendmail.pm

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24940: Serials statistics wizard: order vendor list alphabetically
David Roberts [Fri, 3 Apr 2020 15:23:01 +0000]
Bug 24940: Serials statistics wizard: order vendor list alphabetically

This patch changes the dropdown from being sorted by aqbookseller.id to
aqbookseller.name

To test:
1) Add at least 2 vendors:
 - First: ZZZZ
 - Second: AAAA
2) Add subscriptions for each of the vendors
3) Check the pull down in the serials statistics wizard and verify it
lists them as ZZZZ, AAAA
4) Apply the patch
5) Re-check the pull down in the wizard and check that the vendors are
now listed AAAA,ZZZZ

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25019: Make the ViewPolicy filter initialization standard
Tomas Cohen Arazi [Mon, 30 Mar 2020 12:39:13 +0000]
Bug 25019: Make the ViewPolicy filter initialization standard

This patch makes the ViewPolicy filter use the 'params' accessor instead
of relying of ->{options} which has no accessor. This will allow
interacting with the filter object be similar through all the filters in
the chain.

To test, we just need to verify no behaviour change takes place:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Filter_MARC_ViewPolicy.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25041: Restore #ASKED anchor in suggestions table
Jonathan Druart [Fri, 3 Apr 2020 09:42:59 +0000]
Bug 25041: Restore #ASKED anchor in suggestions table

On commit 4494e8ba6ca7d28972fcc1161c680ecf0b091f62
   Bug 23594: Batch modification for itemtypes on suggestions page
The anchors of the tabs on suggestion.pl has been replaced with
tab_$count instead of the status code.
There was a need at the time, but I cannot remember it.
I restored the previous behavior, and did not find any regressions.

Test plan:
1 - Add several suggestions to Koha
2 - Set them in different status, leaving at least one pending
3 - Go to home page, note it shows count of pending
4 - Click the link on home page
5 - It takes you to correct tab

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24801: (follow-up) Display all the libraries - Selenium fix
Jonathan Druart [Wed, 8 Apr 2020 06:47:49 +0000]
Bug 24801: (follow-up) Display all the libraries - Selenium fix

We have it failing now for the delete link..
14:26:50 selenium_1   | 05:26:50.451 WARN - Exception: Unable to locate element: {"method":"xpath","selector":"//*[@id=\"delete_library_UT_BC\"]"}

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23355: (RM follow-up) Restore lost ID's
Martin Renvoize [Tue, 7 Apr 2020 11:43:43 +0000]
Bug 23355: (RM follow-up) Restore lost ID's

Some ID's were lost during a QA followup, this patch restores them.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 4944: (RM follow-up) Add OpacNoItemTypeImages to UsageStats test
Martin Renvoize [Mon, 6 Apr 2020 12:02:54 +0000]
Bug 4944: (RM follow-up) Add OpacNoItemTypeImages to UsageStats test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 20754: DBRev 19.12.00.067
Martin Renvoize [Mon, 6 Apr 2020 11:28:36 +0000]
Bug 20754: DBRev 19.12.00.067

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>