Commit graph

8076 commits

Author SHA1 Message Date
728f3816e3 Bug 17600: Fix missing C4::AuthoritiesMARC import
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-29 15:34:25 +02:00
18aff2331c Bug 28758: (bug 17600 follow-up) Import subroutines from C4/AuthoritiesMarc
To test:
1 - Stage authority records
2 - Attempt to import - nothing happnes
3 - Apply patch
4 - Stage file again
5 - IMport records
6 - Success!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-26 16:29:22 +02:00
b7c955c950 Bug 28565: Move the sysprefs to a reusable sub
This patch moves the big sysprefs list to a sub. Behavior shouldn't
change.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/UsageStats.t
=> SUCCESS: Things work as expected, no changes.
2. Sign off :-D

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-26 12:46:35 +02:00
006c70f4f2 Bug 25464: Add ability to specify client IP and SIP account used in SIP2 logging
Bug 15253 originally had the ability to specify the incoming IP address used for
a given log statement via SIP, as well as the SIP2 account that was in use at the time.
This data is very helpful for debugging purposes, and should be brought back.

Test Plan:
1) Apply this patch
2) Update you SIP ConversionPattern to "[%d] [%p] %X{accountid}@%X{peeraddr}: %m %l %n"
3) Restart SIP
4) Use the SIP cli tester to make some SIP requests
5) View the SIP2 log, note the account id and client ip address show in the log!

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-26 12:46:32 +02:00
09e0799a8d Bug 28660: (bug 21325 follow-up) Fix auto self check
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Works as expected.
The need for an additional check of pref WebBasedSelfCheck is
merely theoretical.

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-22 08:12:51 +02:00
f5bf73f722 Bug 17600: Fix tests
No idea why UpdateStats in C4::Circulation needs the fully qualified
namespace!

I kept getting
Undefined subroutine &C4::Circulation::UpdateStats called at /kohadevbox/koha/C4/Circulation.pm line 1643.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-16 09:47:01 +02:00
9d6d641d1f Bug 17600: Standardize our EXPORT_OK
On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.

That way we will need to explicitely define the subroutine we want to
use from a module.

This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests

And a lot of other manual changes.

export.pl is a dirty script that can be found on bug 17600.

"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;

The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules

Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).

EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.

@EXPORT and @EXPORT_OK are the two main variables used during export operation.

@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.

@EXPORT_OK does export of symbols on demand basis.
"""

If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
  - use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-16 08:58:47 +02:00
af7e41d114 Bug 28606: Remove warning from C4::Auth 887
[WARN] Use of uninitialized value in sprintf at /kohadevbox/koha/C4/Auth.pm line 887.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-16 08:58:45 +02:00
5da5a2bbc5 Bug 28384: Add 'no_items' option to TransformMarcToKoha
This patch adds a new option 'no_items' and uses it in the C4::Search::searchResults
routine. We don't use the item info fetched here, so skipping those lines saves us time.

Additionally, I fix an incorrect FIXME comment, and pass the ISBN returned by the routine above
into GetNormalizedISBN to save another lookup

TO test:
1 - Enable AmazonCoverImages system preference
2 - Search staff client with a term that returns books with covers
3 - Apply patch
4 - prove -v t/db_dependent/Biblio/TransformMarcToKoha.t
5 - Confirm searching works
6 - Confirm Amazon images display (normalized_isbn is used for these)

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Amended, replacing a tab character.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 15:47:34 +02:00
5b17567f2b Bug 27908: Add support for circulation status 1 ( other ) for damaged items
Some libraries would like to transmit if an item is damaged via the
circulation status field. There is no specific code for a damaged item,
so we should use value 1 (other) along with an AF screen message to
describe the reason for the the circulation status of 1.

Test Plan:
1) Apply these patches
2) prove t/db_dependent/SIP/Transaction.t

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 15:47:34 +02:00
f859b21b7d Bug 27907: Add support for circulation status 2 ( on order )
In Koha, we represent on order items by giving those items a notforloan
value less then zero. We can use this to implement circ status 02 ( on
order ) in for SIP.

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 15:47:33 +02:00
6b1822b3be Bug 27906: Add support for circulation status 9 ( waiting to be re-shelved )
In Koha, we can support circ status 09 in SIP by checking if the item's
location is "CART".

Test Plan:
1) prove t/db_dependent/SIP/Transaction.t

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 15:47:33 +02:00
46f2527388 Bug 14237: (follow-up) Make the routines exclusively take itemnumber, biblionumber, or ci_id
This patch changes the parameters for several of the CourseReserves routines to take a single
identifier exclusively.

Following the existing pattern we simply return if the params are incorrect

This patch also:
removes an unused 'title' variable
adds a prefetch to save some db calls where we fetch related objects
adjusts tests

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 12:09:44 +02:00
Aleisha Amohia
580c390bda Bug 14237: Add individual bibliographic records to course reserves
This feature allows a patron to add bibliographic records to course
reserves. They can be added individually or in a batch. The courses that
have reserved this record will also show on the record's detail page.

To test:
1) Update database, refresh schema, and restart services
2) Enable the system preference UseCourseReserves
3) Set up a couple of biblios and a couple of items (attached to
    different biblios)
4) Go to Course Reserves and add a new course
5) Click Add reserves and put something in both the barcode field and
biblionumber field. Click submit and confirm you get an error.
6) Add a barcode in the barcode field and submit. Confirm the item is
reserved for the course as expected.
7) Add a biblionumber in the barcode field and submit. Add notes and
Save. Confirm the record is reserved for the course as expected and the
notes are saved correctly.
8) Edit the record-level course reserve that you just added. Confirm the
correct record shows and any edits save as expected.
9) Go back to the course and try removing reserves. Use both the Remove
action button for individual reserves and the Remove all reserves
button. Confirm both work as expected.
10) Go to Batch add reserves and put something in both the barcodes
field and biblionumbers field. Click submit and confirm you get an
error.
11) Remove the barcodes and put some biblionumbers in the biblionumbers
field. Add notes and Submit. Confirm the records are all added as
expected.
12) Click on one of the biblios that has been reserved for the course.
Confirm that the course shows under 'Courses that have reserved this
title' on the biblio detail page.
13) Go back to the course and click Add reserves. Try and add a
biblionumber that is already reserved. Confirm it detects that the
biblio has already been reserved.

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)

Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 12:01:13 +02:00
a8736a1a98 Bug 28644: Fix calling borrowernumber on undefined value
If the hold is not found (e.g. already cancelled), we should
return earlier without crashing:
    Can't call method "borrowernumber" on an undefined value at /usr/share/koha/C4/Reserves.pm line 521
    (Note: line number from 19.11)

Test plan:
Run t/db_dependent/Reserves.t
Add a hold, go to user menu with holds in OPAC.
At the same time, cancel this hold from staff.
Now click the Cancel in OPAC.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 11:58:35 +02:00
b8ab792dc4 Bug 28483: Remove warnings from Search.t
There are too many warnings about uninitialized variables in Search.pm.
This patch deals with that, the same way it is dealt accross the file:
by setting an empty string when things are not defined.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Search.t
=> FAIL: Wow, too many warnings. Some related to this bug, some not.
2. Apply this patch
3. Repeat 1
=> SUCCESS: No more warnings!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-12 11:44:55 +02:00
c4b4db21d2 Bug 22544: Restore newdate and timestamp for slip notices
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Fixed typo pubished_on

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:17:28 +02:00
98392c82ee Bug 22544: Clarify documentation and change param 'type' to 'location'
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:17:28 +02:00
6eaae7e626 Bug 22544: Refactor searching of news items
Test plan:
1) Go to tools and define some news
2) Try different parameters, try to edit new items, and delete some
3) Go to all places where news are presented and ensure that there are
the right ones shown:
    opac main page - based on language
    opac righ column (formerly syspref OpacNavRight) - based on language
    opac news rss feed
    circulation slip (not quick slip)
    intranet main page
4) run tests:
prove t/db_dependent/Koha/News.t

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:17:28 +02:00
9ca8d08a51 Bug 22544: Move GetNewsToDisplay to Koha namespace
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 22544: fix count call - to squash

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:17:26 +02:00
05798ec1aa Bug 22544: Move add_opac_item to Koha namespace
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:09:24 +02:00
3d5a719920 Bug 22544: Move upd_opac_new to Koha namespace
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:09:24 +02:00
5866c88d84 Bug 22544: Move del_opac_new to Koha namespace
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:09:24 +02:00
ae0c08c936 Bug 22544: Move get_opac_news to Koha namespace
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:09:24 +02:00
eb606ddfcf Bug 22544: Move get_opac_new to Koha namespace
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 12:09:23 +02:00
3a2a0eef10 Bug 28455: lastseen should be updated at checkout if TrackLastPatronActivity is enabled
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 10:18:52 +02:00
a882783326 Bug 28299: Make buildKohaItemsNamespace accept Koha::Items
This patch makes buildKohaItemsNamespace (and its only caller,
XSLTParse4Display) accept a an optional Koha::Items resultset.

This way we don't need to calculate (from the DB) the list of hidden
itemnumbers, but solve it in one query.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-06 10:18:52 +02:00
ce5d409cfd Bug 28571: Remove C4::Auth::_session_log
It's not used and must be removed

Test plan:
  % git grep _session_log
must not return any result.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-24 11:53:44 +02:00
41a8005d10 Bug 28606: Remove $DEBUG and $ENV{DEBUG}
We should remove the debug statements or use Koha::Logger when we want
to keep it.

Test plan:
Confirm that occurrences of remaining occurrences of DEBUG need to be
kept (historical scripts for instance)
Confirm that the occurrences removed by this patch can be removed
Confirm that the occurrences replaced by Koha::Logger are correct

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Looks good to me, noting a few minor points on BZ.

JD amended patch: replace "warn #Finished" with "#warn Finished", and
put the statement on a single line

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-24 11:53:44 +02:00
e188b5c899 Bug 28581: (QA follow-up) Fix method on unblessed reference
Speaks for itself.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-23 15:09:55 +02:00
0636e1a8f0 Bug 28581: Enhance POD for EnqueueLetter
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-23 15:09:55 +02:00
7c7794f1b2 Bug 28581: Use 'from_email_address' where appropriate
This patch replaces a few more trivial cases where we were using
library->branchemail with a fallback to KohaAdminEmail to just use the
new library->from_email_address method directly instead.

There were also a couple of cases where we were passing borrowernumber
and the patrons library from address too.. this is unneccesary as the
code in _send_email_massage will already default to patron library from
address if we do not pass an override.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Added a semicolon.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-23 15:09:55 +02:00
7c6575e86a Bug 28581: (QA follow-up) Prevent code failure
This patch prevents a fatal error when both $params->{from} and
$params->{borrowernumber} are undefined. We fallback to
KohaAdminEmailAddress before finally falling through to setting a
failure status for the message if that last fallback is not found.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-23 15:09:55 +02:00
fdf75e4cb0 Bug 28581: Use from_email_address in the codebase
Adding only a few (trivial) cases now. Changes in C4::Letters
are not trivial after all..
We now add the KohaAdminEmail fallback implicitly when the from
address was still empty. The extra check makes us not rely on
a do or die action in Email::Stuffer.

Test plan:
Run password recovery or membership expiry cron.
Check sender address.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-23 15:09:55 +02:00
Katrin Fischer
8c3862d557 Bug 26205: (QA follow-up) Change OPACNEWS to just NEWS
As news are usable in OPAC and staff interface, I suggest changing the code
to just be NEWS instead of OPACNEWS.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-23 14:56:56 +02:00
52fcc6b904 Bug 26205: Add logging of news items
To test:

1. Apply patch, updatedatabase, restart_all
2. Make sure the system pref 'NewsLog' is turned on.
3. Go to the Koha News tool and create a new news item.
4. View the logs and display only the OPAC News module
5. You should see your new news, it will include the lang (
   OPACheader_en ) and the content of the news item.
6. Filter the logs so the only action is 'Add', your new news item
   should appear
7. Modify some news items
8. They should appear in the logs now as modification.
9. Make sure you can filter the action to 'Modify' and can confirm it
   works
10. Delete some news items
11. They should appear in the logs now as deletinon
12. Make sure you can filter the action to 'Delete' and can confirm it
    works

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-23 14:56:55 +02:00
3fe837bc74 Bug 28572: Remove C4::Debug
We are using Koha::Logger when it makes sense to keep the info,
otherwise we simply remove it

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Bug 28572: Replace missing occurrence in misc/admin/koha-preferences

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-22 12:04:32 +02:00
512c7ba7e4 Bug 28590: Remove get_shelves_userenv and set_shelves_userenv
They are no longer used since bug 7310, now we are using
Koha::Virtualshelves->get_some_shelves

Test plan:
Create some lists, login at the OPAC and confirm that you see
the list in the navbar (top)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-22 12:04:31 +02:00
a2abd3c305 Bug 28563: Add AllowHoldItemTypeSelection to HEA
This patch adds the mentioned syspref to the sysprefs list, shared for
statistical purposes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-21 14:01:51 +02:00
238500c965 Bug 27600: Remove password check from add_hold
As suggested in the bugzilla comments, the add_hold method also
doesn't require the password checking code.

Test plan
1/ Run t/db_dependent/SIP/ILS.t and watch it pass

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-21 14:01:50 +02:00
e8eef48790 Bug 27600: Remove password check from cancel_hold
As suggested in the bugzilla comments, the cancel_hold method also
doesn't require the password checking code.

Test plan
1/ Run t/db_dependent/SIP/ILS.t and watch it pass

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-21 14:01:50 +02:00
5699c825cc Bug 27600: Remove password check from SIP2 renew_all
This patch removes the password check code from the renew_all method for
SIP2. This is required, as many units send an empty AD field in the SIP
message which can cause the transaction to fail.. but the authentication
should have already taken place earlier in the session.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-21 14:01:50 +02:00
b82c91d8cb Bug 28514: Remove getletter
The way we handle notice templates is confusing (see bug 27660, bug 26787, bug 28487).

This patch remove C4::Letters::getletter and use either Koha::Notice::Templates->find
or the newly created methods ->find_effective_template that will do
all necessary to return the correct template.

Test plan:
- Create and modify notice templates
- Make sure you have TranslateNotices turned on and that some notices
templates have a translated version
- Use holds_reminder.pl and overdue_notices.pl cronjobs and confirm that
the generated notices are the expected ones
- Test also pos/printreceipt.pl
- And finally test some other notices (CHECKIN, RENEWAL for instance)

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Amended by removing comment for $params={%$params}

JD amended patch:
* Add missing POD
* Fix spelling (dont  ==> don't)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-21 13:49:58 +02:00
a3c5ecd0e4 Bug 28388: Preserve "Browse results" when "view plain" is clicked
This patch modifies the way search sessions are preserved in the OPAC so
that viewing the "plain MARC" view will not cause the search context to
be lost.

To test, apply the patch and make sure OpacBrowseResults is enabled.

- Perform a search in the OPAC which will return multiple search
  results.
- View the details of one of the search results.
  - You should see a "Browse results" box in the right-hand sidebar.
- Click the "MARC view" link.
  - If you click back to the "Normal view" now, the results browser
    should still appear.
  - From the MARC view, click the "view plain" link.
  - Return to the "Normal view."
    - Before the patch: The results browser is gone.
    - After the patch: The results browser is still there.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-21 12:07:28 +02:00
40089a0a53 Bug 28519: Put CGI::Session::Serialize::yamlxs in lib directory
This patch adds a "lib" directory to the source tree which gets
mapped to the same directory as "C4" and "Koha" for single and
standard installations.

CGI::Session::Serialize::yamlxs is put into this "lib" directory.

This patch also includes some changes so that dev/git installations
work as well.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-17 10:07:36 +02:00
3d5fa815be Revert "Bug 20985: Add OnShelfHoldsAllowed checks to CanItemBeReserved"
This reverts commit a151d7ba0f.
2021-06-16 14:44:10 +02:00
acb0fdb688 Bug 28503: Compare item homebranch to patron branch when hold policy set to 'from_home_library'
This fixes an issue in the way we calculate the check for hold policy 'from_home_library'

Currently we change the comparison based on ReservesControlBranch, however, that should
only control the rule we fetch, not how we compare

When ReservesControlBranch is set to "patron's home library" we compare the patron's branch to
the patron's branch, this is useless and means we pass the check for all branches all of the time

We should instead compare the patron's branch to the item's branch, and only fetch the rule using ReservesControlBranch

To test:
 1 - Have a record with an item from library A and library B
 2 - Set the 'Default checkout, hold and return policy'->Hold policy->From home library for all libraries
     and ensure you have no branch specific/itemtype specific rules set
 3 - Attempt to place a hold on the record for a patron from library B
 4 - Note that only the library B item is holdable - place a title level hold (do not choose an item)
 5 - Check in the item from library A
 6 - It fills the hold - This is incorrect - ignore the hold
 7 - Apply patch
 8 - Restart all the things
 9 - Check in the item from library A
10 - No hold found
11 - Check in the item from library B
12 - Hold found, correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Bug 28503: Clarify what ReservesControlBranch controls

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-15 16:41:47 +02:00
a151d7ba0f Bug 20985: Add OnShelfHoldsAllowed checks to CanItemBeReserved
The expected behaviour for "On shelf holds allowed" setting for the circulation rules (Koha administration > Patrons and circulation > Circulation and fines rules):
- Allow holds only on items that are currently checked out or otherwise unavailable.
- If set to "Yes", patrons can place holds on items currently checked in.
- If set to "If any unavailable", patrons can only place holds on items that are not unavailable.
- If set to "If all unavailable", patrons can only place holds on items where *all* items on the record are unavailable.
(Adapted from https://bywatersolutions.com/education/preparing-for-library-closures)

These rules should also work when using ILS-DI, but currently they don't. This bug makes sure that the "On shelf holds allowed" rules work correctly when using ILS-DI to place holds.

Test plan:

1. Enable ILS-DI (set the ILS-DI system preference to Enable).
2. Go to Koha administration > Patrons and circulation > Circulation and fines rules.
3. Work through steps 4-5 for each of the settings for "On shelf holds allowed" for all libraries/patron categories/item types:
   . "Yes", "If any unavailable", and "If all unavailable"
4. Staff interface - place a hold on a record with items available for loan, the rules should work as expected before and after the patch is applied:
   . "Yes"
      ==> information column in the item table displays "Not on hold", the hold is placed, cancel the hold
   . "If any unavailable" and "If all unavailable"
      ==> the hold is not placed, message is "Cannot place hold. No items are available to be placed on hold.", red "X" in the hold column and the information column displays "Not on hold".
5. ILS-DI - place a hold on a record with items available for loan (note: without the patch, holds can be placed):
   . Query to place a hold using ILS-DI on a title that have all its items available,
     example query: http://127.0.0.1:8080/cgi-bin/koha/ilsdi.pl?service=HoldTitle&patron_id=1&bib_id=1&request_location=127.0.0.1
     ==> Without the patch the hold is placed but it shouldn't be allowed, cancel the hold
   . Query to place a hold using ILS-DI on an available item,
     example query: http://127.0.0.1:8080/cgi-bin/koha/ilsdi.pl?service=HoldItem&patron_id=1&bib_id=1&item_id=1)
     ==> Without the patch the hold is placed but it shouldn't be allowed, cancel the hold
6. Run the tests prove t/db_dependent/Reserves.t - these should pass.
7. Apply the patch (and flush_memcached and restart_all if using koha-testing-docker).
8. Run through steps 3-6 again, and note the changes when "If any unavailable" and "If all unavailable" options are used:
   . For the staff interface: there should be no change in behavour and should work as expected, for the red "X" in the items table additional text is added "onShelfHoldsNotAllowed".
   . For ILS-DI: these should now work as expected, with holds not placed, and this message in the results returned <code>onShelfHoldsNotAllowed</code> (check to confirm no holds place for either the patron or the item)
   . Tests: should still pass.
9. Sign off.

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

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-15 16:41:47 +02:00
Joonas Kylmälä
97f6d9a087 Bug 28520: Allow creating a transfer back automatically if a hold is canceled during transit
This fixes regression caused by "Bug 12362: Cancel transfer with hold
cancelation" where cancelled hold's transfer didn't show up in
intranet and opac because it create a new transfer that was not yet
put in in-transit state. The original idea of bug 12362 was to be able
to trigger transfer back home if a hold was cancelled (a regression
caused by bug 26078). However, we can do it more simply by setting the
$validTransfer variable true in the item check-in code when we are
dealing with Reserve transfers. More down in the AddReturn() code
there is also a check "and !$resfound" to make sure we only try to
trigger the transfer back home automatically if there is no hold
waiting at the current location the item arrived in.

It should be noted however that now we only display generic message
for the automatic transfer reason. Bug 12362 made the return display
as the reason "Transfer was cancelled whilst in transit". However,
since this fixes the original regressions caused by bug 26078 and
restores similar behaviour to that I think giving a more descriptive
message for example regarding a hold being cancelled can be considered
a further enhancement.

To test:
 1) Apply patch
 1) Have biblio with item in branch A
 2) Create a new hold with a pickup library to branch B
 3) Check-in the item at branch A and confirm the hold and transfer
 4) Cancel the hold
 5) Check-in the hold at branch B and notice it prompt to return it to
 branch A

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-15 16:41:47 +02:00
b031ec5845 Bug 24434: Reinstate updateWrongTransfer
This patch re-instates the call to updateWrongTransfer to ensure the
transfer line is updated to reflect the new frombranch.

Test plan
note: when applying the patches, also update the database

1/ Check an item out from it's home library
2/ Check the item in at another library
   (with AutomaticItemReturn system preferences enabled)
2a/ Accept the transfer and note we now have a transfer present from the
    items check-in library to it's home library
3/ Check the item in at a third library
3a/ Note you are asked to return the item to it's home library.
3b/ With the patch applied, the modal title should highlight that a
    'Wrong transfer' was detected.
4/ Go to the item record and note the holding library has been updated
   to reflect where the item was most recently checked in.
4a/ With the patch applied the item status should reflect the last
    checked in branch as the 'from' branch of the transfer.
5/ check-in from a 4th library, but use the 'Print slip' option for
   accepting the transfer and confirm that also works.
6/ check-in from a 5th library, but use the 'Cancel' option and check
   that this results in the item staying at it's current location and the
   final transfer having been cancelled.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-06-15 11:46:13 +02:00