Commit graph

7441 commits

Author SHA1 Message Date
794c18b8e6
Bug 19735: Remove C4::Installer::PerlDependancies
This patch does the actual removal of the PerlDependancies module.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-12 16:33:03 +00:00
cc595325d6
Bug 19735: Add support for max_ver
This patchset adds support for extracting 'max_ver' from the cpanfile so
we can use version ranges properly and report errors if we have modules
installed that do not fit within that version range.

Test plan:
1) Manually modify the module version of a required module in the cpanfile
   to have a max version greater than the version you have installed.
2) Run through the install proceedure and note the new warning that a
   module needs upgrade for the module in question.
3) The module should also be reported in the about page

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-12 16:33:02 +00:00
Julian Maurice
a34d086a24
Bug 19735: Move Perl deps definitions into a cpanfile
cpanfile is a format for describing CPAN dependencies for Perl
applications.
It is more concise - thus easier to read and maintain - than
C4::Installer::PerlDependencies, and allows to describe requirements
more accurately (using version ranges or features for instance)
Additionally it can be read by tools such as cpanm or carton for an
easy way to install dependencies on non-Debian-based systems.

For more information on cpanfile, see
http://search.cpan.org/~miyagawa/Module-CPANfile-1.1002/lib/cpanfile.pod

This patch replace C4::Installer::PerlDependencies by an equivalent
cpanfile and update all scripts/modules that were using PerlDependencies
It also removes dead code from C4::Installer::PerlModules (some
subroutines were not used at all, except in unit tests)

Added dependencies:
 - Module::CPANfile
 - CPAN::Meta (dependency of Module::CPANfile, but we need a more recent
   version than the one Module::CPANfile requires)

Test plan:
  1. Go to About page, tab Perl modules and keep this browser tab open
  2. Apply patch
  3. Install Module::CPANfile and CPAN::Meta
    a. On Debian-based systems:
       # will install libcpan-meta-perl as a dependency
       sudo apt install libmodule-cpanfile-perl
    b. Others:
       # will install CPAN::Meta as a dependency
       sudo cpanm Module::CPANfile
  4. In a new browser tab, go to About page, tab Perl modules and compare
     the table with the one in the previous browser tab
     They should be identical, except for newly added dependencies
     (Module::CPANfile and CPAN::Meta)
  5. Do a 'standard' install
    a. perl Makefile.PL (select 'standard')
    b. make
    c. sudo make install
    d. Configure your database, web server, ... and go through the web
       install process
  6. Verify that the cpanfile got copied into PERL_MODULE_DIR (which
     should be /usr/share/koha/lib)
  7. Go to the about page of this fresh install and compare it with your
     dev install
  8. Verify that debian/list-deps still works
     This takes a lot of time and it may not be necessary to wait until
     the end. If you see some Debian package names that correspond to
     modules in cpanfile, it means it still works
     (you need apt-file for this script to work)
  9. Verify that koha_perl_deps.pl still works
 10. prove t/Installer_pm.t t/Installer_PerlModules.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-12 16:33:02 +00:00
f9dd77cfab
Bug 24642: Make Cache::Memcached::Fast::Safe required
There is something wrong between the logic in Koha::Cache->new and our
dependencies.

We are having Cache::Memcached required, but
Cache::Memcached::Fast::Safe is optional.
However, in Koha::Cache->new we are initializing the Memcached cache
only if Cache::Memcached::Fast::Safe is installed.

We could fix the logic in Koha::Cache, but it seems better to make
Cache::Memcached::Fast::Safe mandatory (especially after bug 13193).

Note that after bug 13193, you are loosing the Memcached cache, as
Cache::Memcached::Fast::Safe will not get installed by default.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-12 16:24:39 +00:00
c2d3a60566
Bug 19014: on_reserve blocks auto_renew
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-12 16:08:56 +00:00
51f5f6ca49
Bug 19014: Return auto_too_soon before on_reserve
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-12 16:08:52 +00:00
a6b359ccbb
Bug 8643: Fix IsMarcStructureInternal tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-11 15:51:37 +00:00
simith
339c27ca80
Bug 8643: Add important constraint to marc subfields
This fix permits to add an "Important" option to the marc structure pages.

Testing:

1) Apply the patch
2) Run updatedatabase.pl
3) Regenerate CSS
4) Define 100 as an "important" field ( Administration » MARC bibliographic framework » MARC structure ( Default Frameword) » Edit )
5) Define 100$a as an "important" subfield (Administration » MARC bibliographic framework » MARC structure (Default Frameword) » Subfield » Onglet a)
6) Edit a record to clear the field 100 (subfields are all blank)
7) Save the record.
8) Validate the following message:

A few important fields are not filled:

    * tag 100 subfield a Nom de personne in tab
    * Field 100 is important, at least one of its subfields should be filled.

Are you sure you want to save?

Sponsored by the CCSR ( http://www.ccsr.qc.ca )
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
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>
2020-02-11 14:33:29 +00:00
11b44869d9
Bug 14711: Change prototype for AddReserve - pass a hashref
The number of parameters of AddReserve makes it hard to read and
maintain.
This patch replace it with a hashref, which will make the calls more
readable.

Moreover the bibitems has been removed as it was not used by the
subroutine.

Test plan:
- Make sure the tests pass
- Read the diff and search for typos
- Place a hold on few items

Note for QA: reservation_date and expiration_date do not match the DB column's names,
should we?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-11 14:32:47 +00:00
Julian Maurice
9d6ec5c64b
Bug 21156: Add plural translation capabilities to JS files
It adds Javascript equivalent of Koha::I18N's exported subroutines, and
they are used the same way.

String extraction is done only on *.js files and require gettext 0.19
(available in Debian jessie, and also in wheezy-backports)

It adds Javascript library Gettext.js for handling translation and a
Perl script po2json to transform PO file into JSON.

Gettext.js and po2json both come from Locale::Simple.
There are several tools named po2json. It's simpler to integrate this
one into Koha than to check if the good one is installed on the system.
Locale::Simple is not needed.

To avoid polluting the global namespace too much, this patch also
introduce a global JS object named Koha and add some stuff in Koha.i18n

Test plan:
1. Add a translatable string in a JS file. For example, add this:
     alert(__nx("There is one item", "There are {count} items", 3,
     {count: 3}));
   to staff-global.js
2. cd misc/translator && ./translate update fr-FR
3. Open misc/translator/po/fr-FR-messages-js.po, verify that your
   string is present, and translate it
4. cd misc/translator && ./translate install fr-FR
5. (Optional) Verify that
   koha-tmpl/intranet-tmpl/prog/fr-FR/js/locale_data.js exists and
   contains your translation
6. Open your browser on the staff main page, change language and verify
   that the message is translated
7. Repeat 1-6 on OPAC side

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works well, translation is OK and test message is displayed correctly.
Current qa-tool error is a false positive.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-10 10:14:46 +00:00
30005cd2ea
Bug 13305: Remove tabindex from PrepareItemsRecordDisplay
Test plan:
Check the tab order of the item block on additem.pl (item editor),
Acquisition (neworderempty or addiso2709), serials-edit.pl.
You could also check services/itemrecorddisplay.pl and pass a
biblionumber; this script is used in additem.js for cataloguing and
acquisition.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-10 09:19:47 +00:00
125d8c2d8b
Bug 16719: (QA follow-up) Remove tabs
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-10 09:19:07 +00:00
Oliver Behnke
be7ca413fd
Bug 16719: (follow-up) Update check on password mapping
Change to allow for unmapped default passwords

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-10 09:18:58 +00:00
Oliver Behnke
f514a37d88
Bug 16719: Pass through undef rather than empty string in LDAP mapping
Nullable DB fields should be passed null in cases where ldap fields are
empty and not replaced with empty strings.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-10 09:18:50 +00:00
d2cdd913fa
Bug 23640: Flushing L1 on every SIP connection
This patch flushes the L1 cache on each SIP connection
(ie every invocation of process_request).

This means each SIP connection will fetch values from the
L2 cache (ie memcached) and persist the L1 cache (in Perl
memory cache) only until a new SIP connection comes in.

Without this patch, the L1 cache persists for the length
of the server process, which means the L1 cache will become
stale very quickly, which can lead to unexpected behaviour.

Test plan:
1. Enable IssueLog
2. Start SIP server
    2a. change to Koha git directory
    2b. koha-shell kohadev
    2c. perl C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml
3. Issue book via SIP

    perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1 -l CPL --patron 1 --item 3999900000001 -m checkout

4. Check action_logs for "CIRCULATION ISSUE <borrowernumber> <biblionumber>" line

    http://localhost:8081/cgi-bin/koha/tools/viewlog.pl

5. Disable IssueLog

6. Check in the book and then check it out again

    perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1 -l CPL --patron 1 --item 3999900000001 -m checkin
    perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1 -l CPL --patron 1 --item 3999900000001 -m checkout

7. Check action_logs for "CIRCULATION ISSUE <borrowernumber> <biblionumber>" line

    http://localhost:8081/cgi-bin/koha/tools/viewlog.pl

8. Note results

Without the patch, you'll see a 2nd checkout.

With the patch, you won't see the 2nd checkout.

(Note: After applying the patch, you have to restart the SIP server.)

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-10 08:57:53 +00:00
99e2fbd083
Bug 13193: (RM follow-up) Remove Cache::Memcached::Fast from PerlDependencies
We replaced this module with Cache::Memcached::Fast::Safe and so do not
need to depend upon it any longer.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-07 15:17:26 +00:00
Joonas Kylmälä
31f1a76625
Bug 13193: Make Memcached usage fork safe
When a high enough number of forks try to access for example system
preferences with Koha::Cache using memcached as backend the results of
different cache requests get mixed up.

The problem is fixed by using Cache::Memcached::Fast::Safe that is a
fork safe version of Cache::Memcached::Fast.

Sponsored-by: The National Library of Finland
Signed-off-by: David Cook <dcook@prosentient.com.au>

Works as described, and solves an insidious difficult to debug
problem in Koha.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-07 09:58:47 +00:00
Agustin Moyano
5ac7f3690d
Bug 23673: Add "Updated on" column to patron's notices
This patch adds "Updated on" column to patron's notices tab. It also adds logic to C4::Letters to retrieve updated_on column.

To test:

1. Apply patches.
2. Restart plack.
3. Choose a patron and add a purchase suggestion.
4. Change suggestion status.
5. Open patron's notifications.
   CHECK => Messages table has now "Updated on" and "Time created" columns, and "Time" column is gone.
   SUCCESS => There is a message with status pending, with a "time created" that equals "updated on"
6. Execute in the shell in Koha directory
   $ ./misc/cronjobs/process_message_queue.pl
7. Open patron's notifications one more time.
   SUCCESS => The message changed status. Time created remained the same, and now "updated on" has the current timestamp.
8. Resend the message and repeat sep 6.
   SUCCESS => Every time you change the status, time created remains the same and updated on updates.
9. Run `prove t/db_dependant/Letters.t`
10. Sign off

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
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>
2020-02-05 14:22:43 +00:00
eedb6ce233
Bug 24595: Silent warnings from Circulation.t
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-05 14:20:48 +00:00
4668a31dc5
Bug 24449: Add too_many_overdue to patron status for SIP
To test:
1 - Have sip running and use the cli to get info for a patron
    example: perl misc/sip_cli_emulator.pl  -a localhost -p 6001 -su koha -sp koha -l CPL -m patron_status_request --patron koha
2 - Checkout an item to the patron, backdated so it is overdue
3 - Set syspref 'OverduesBlockCirc' to anything but "Don't Block"
4 - Get the patron status via SIP, note circ blocked flag is set, but too_many_overdue is not
5 - Apply patch
6 - Restart all the things
7 - Get the patron status via SIP
8 - Note the too_many_overdue flag is now triggered and there is a message
    example: READ: 24Y     Y       00120200117    142716AEEdna Acosta|AA23529001000463|BLY|CQN|BV0.25|AFGreetings from Koha.  -- Patron has overdues -- Patron owes 0.25|AOCPL|

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>
2020-02-05 14:20:18 +00:00
585001c6d3
Bug 24529: Silence another uninitialised value warning
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-05 12:38:33 +00:00
1069bc2405
Bug 24529: Silence warnings for title level holds
This patch simply adds a test for itemnumber being defined in the
reserve before comparing it to silence the warning.

Test plan:
1) Prior to patch, run prove t/db_dependant/Circulation.t and note lots
   of `Use of uninitialized value in numeric eq (==) at
   /kohadevbox/koha/C4/Reserves.pm line 790` warnings.
2) Apply the patch, re-run the test and note the tests still pass but
   the warnings are now gone.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-05 12:38:25 +00:00
8854a14fe7
Bug 22302: Make ITEMTYPECAT descriptions fallback to lib description if no opac description
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>
2020-02-05 12:35:32 +00:00
Joonas Kylmälä
0401d13d2c
Bug 18936: (follow-up) Make possible to have unlimited value for holds_per_day
Without this it is not possible to make for a specific patron category
or itemtype a more specific unlimited holds_per_day rule if you have a
catch all rule (categorycode = *, itemtype = *) with limited
holds_per_day value.

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:56:29 +00:00
25848e5af3
Bug 18936: Fix some more tests
* CanItemBeReserved
Prior to "Bug 18936: Convert issuingrules fields to circulation_rules",
GetHoldRule returned holds_per_record even if no reservesallowed was
defined. This change restores this behavior.
FIXME Note: In GetHoldRule we return itemtype only if reservesallowed is set,
not sure it is correct.

* t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t
When setting returnbranch, holdallowed and hold_fulfillment_policy, we
should not provide categorycode.

* t/db_dependent/Holds.t
Prefer to keep the existing rules instead of removing them. It got quite
hard to understand what was going on here because of the mixup with
the rule reservesallowed that was in issuingrules, and the other rules
we used for the tests. Also, categorycode should not be passed to set
those 3 rules (holdallowed, hold_fulfillment_policy and returnbranch)

* t/db_dependent/Circulation.t
Setting lengthunit to 'hours', no need to make sure the rule has been
correctly be saved

* t/db_dependent/Circulation/CalcDateDue.t
It uses hardcoded data that is not in the sample data (categorycode=C).
Let use K that exists and postpone a refactore of the whole script (to
make it create the data it needs).

* t/db_dependent/Circulation/ReturnClaims.t
* t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t
Simple replace Koha::IssuingRule with Koha::CirculationRules

* t/db_dependent/Koha/Charges/Fees.t
=> FIXME Still failing, stuck here, need help

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:56:27 +00:00
Joonas Kylmälä
e4dfe623d9
Bug 18936: (follow-up) Don't retrieve unused issuing rule
The chargename rule is not used anywhere in the code

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:56:27 +00:00
72442dc8d2
Bug 18936: More fixes
Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:56:26 +00:00
7077bffdd9
Bug 18936: new suspension_chargeperiod
Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:56:26 +00:00
Jesse Weaver
5712ec566f
Bug 18936: (follow-up) fix tests, null vs. empty behavior for limiting rules
Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:56:24 +00:00
Jesse Weaver
f541228579
Bug 18936: (follow-up) fix rental discount lookup
Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:56:24 +00:00
Jesse Weaver
f2dfa17f0e
Bug 18936: (follow-up) Add foreign key and scope enhancement to circ rules
This necessitates moving the circ rules from using '*' to using
undef/NULL.

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:56:24 +00:00
58fda20e85
Bug 18936: Convert issuingrules fields to circulation_rules
Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-04 09:23:55 +00:00
9384ed4aa8
Bug 24377: Record passed branch if renewing via cron
To test:
1 - Checkout an item with auto renewal set and eligible for auto renew
2 - Set no renewal before in the circ rules to 99 (something greater than the checkout period)
3 - perl misc/cronjobs/automatic_renewals.pl
4 - Check the statistics table, note the branch for renewal is null
    SELECT * FROM statistics WHERE itemnumber={itemnumber} AND type='RENEWAL'
5 - Apply patch
6 - Repeat 1-4
7 - Note the branch is set to the issuing branch

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Ed Veal <eveal@mckinneytexas.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-30 15:36:00 +00:00
eb970752b4
Bug 23896: logaction should pass the correct interface to Koha::Logger
Trivial fix.

Test plan:
Run t/db../Log.t to ensure that we did not break stuff.
If you set opac to debug in log4perl config, inspect opac-error.log to see
if you have extra loglines from running the test script.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-30 10:53:56 +00:00
Andreas Jonsson
4111f4f186
Bug 24348: Pass marc record to _passes_required_checks
Test plan:

* Add record matching rule:

 Matching rule code: test
 Description: 001 and 003
 Match threshold: 1000
 Record type: Bibliografic record

 Match points:
    Search index: Control-number
    Score: 1000
    Tag: 001
    Subfields:
    Offset:
    Length:
    Normalization rule: none

 Required match checks:

    Source (incoming) record check field

    Tag: 003
    Subfields:
    Offset:
    Length:
    Normalization rule: none

    Target (database) record check field

    Tag: 003
    Subfields:
    Offset:
    Length:
    Normalization rule: none

* Note the match rule identity number.
* Stage a marc-file for import, for instance this one ftp://ftp.libris.kb.se/pub/export2/X/marc/X.20200104.marc

sudo /usr/sbin/koha-shell -c "perl /home/vagrant/kohaclone/misc/stage_file.pl --match 4 --file 'X.20200104.marc' --format ISO2709 --comment 'test'" kohadev

* Note the batch number and commit the file using the batch number:

sudo /usr/sbin/koha-shell -c "perl /home/vagrant/kohaclone/misc/commit_file.pl --batch-number 1" kohadev

* Again, stage the same marc-file  for import:

sudo /usr/sbin/koha-shell -c "perl /home/vagrant/kohaclone/misc/stage_file.pl --match 4 --file 'X.20200104.marc' --format ISO2709 --comment 'test'" kohadev

* Note the number of records matched.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-28 14:54:29 +00:00
a29d1db971
Bug 24361: Silent t/db_dependent/Items.t
its output is displaying tons of
Use of uninitialized value $field in regexp compilation at /kohadevbox/koha/C4/Items.pm line 2106.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-27 18:57:06 +00:00
c129a47ae5
Bug 24421: Check if subfields are valid using the biblio tag
To test:
 1 - Enable the sysprefs
     AutoCreateAuthorities
     BiblioAddsAuthorities
     CatalogModuleRelink
 2 - Open a record with a subject heading with a subdivision and add a new subfield, or add a new unauthroized heading to a record and save it
    e.g. 650$aChess$xOpenings$vFiction.
 3 - Save the record, note the created authority and that field is linked
 4 - Save the record again and note the authority number changes
 5 - Find and view the authority linked to the record
 6 - The record is for 'Chess', not Chess openings'
 7 - Search authorities for 'Chess' - note duplicated records
 8 - Apply patch, restart all
 9 - Save the record, auth number increases again, we shoudl create the correct record this time
10 - Save again, auth number should not change
11 - Search authorities and confirm the generated authority has the correct subfields

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-27 15:56:16 +00:00
194cdef333
Bug 24511: Update variable names to avoid confusion
To test:
1 - Create a report
    SELECT borrowernumber, firstname, surname, email, emailpro FROM borrowers WHERE surname='acosta'
2 - Create or edit patron with surname acosta to have a separate email and emailpro
3 - perl misc/cronjobs/patron_emailer --notice HOLDS --module reserves --verbose --email emailpro --report ## --from 'me@you.us'
4 - Note email is used, not email pro
5 - Apply patch
6 - Repeat, correct eamil is used

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-27 10:14:15 +00:00
518bb04d8a
Bug 23443: Do not checkin an item if checked out to another patron when lost fee is paid
Test plan:
0 - Do not apply this patch
1 - Check out an item to a patron
2 - Make sure a fee will be charged when lost
3 - Mark the item lost
4 - Make sure the fee will not be refunded on return of the item
5 - Return the item
6 - Check it out to a new patron
7 - Write off the fine for the original patron
=> The item is now checked in
8 - Apply this patch and repeat 1 to 7
=> The item is still checked out

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-24 12:57:54 +00:00
7c2319f807
Bug 23407: Don't process items for XSLT on details pages
To test:
1 - Add 1000 items to a record
    Go to biblio
    Edit items
    Add multiple copies of this item
    Add 1000 and confirm
    Wait..
2 - Load the record in staff client and OPAC, note how long it takes
    Press F12 in browser to open the console
    use the Network tab of the console
    note the load time
    refresh a few times to see average time
3 - Apply patch
4 - Restart all the things
5 - Reload the record in staff and opac
6 - Note decresed time
7 - Verify nothing on the page has changed

QA can grep the standard XSLT files for details pages for 'item' to note occurences do not use items information

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-24 12:50:26 +00:00
80f1374f26
Bug 24443: Consider NULL as 0 for issues in items search
In items search, we can filter by items issues count, data coming from items.issues.
Most of the time, for an item with no issues this column contains NULL.
This enhancement proposes to consider NULL as 0 to allow searching items with no issues.

Test plan:
1) Use SQL to count items with items.issues = NULL :
   select count(*) from items where issues is null;
2) Go to items search
3) Perform search with filter "Checkout count" = 0
4) Check you get the same number of results as SQL query

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-24 12:49:06 +00:00
Julian Maurice
0e73e723ef
Bug 19809: Re-allow to call Koha::Objects::find in list context
and remove 'scalar' keyword in calls where it's not needed.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-23 10:27:28 +00:00
2b32aee825
Bug 22831: Elasticsearch - add a maintenance script for checking DB vs index counts
This script uses Array::Utils and adds a dependency

To test:
 1 - Have Koha with ES running
 2 - Delete some records from ES
     curl -X DELETE "es:9200/koha_kohadev_biblios/data/5"
     curl -X DELETE "es:9200/koha_kohadev_authorities/data/5"
 3 - perl misc/maintenance/compare_es_to_db.pl
 4 - Note you are notified of problems in both indexes
 5 - perl misc/search_tools/rebuild_elastic_search.pl  -a
 6 - perl misc/maintenance/compare_es_to_db.pl
 7 - Note you are only notified about problems in biblios (assuming you don't have other issues)
 8 - perl misc/search_tools/rebuild_elasticsearch.pl  -b
 9 - perl misc/maintenance/compare_es_to_db.pl
10 - Both counts match, no problems

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-23 10:11:09 +00:00
1c07cacff2
Bug 23064: Use Koha::Subscription in ModSubscription
We must use Koha::Subscription instead of raw SQL.
It will fix issue with default and integer values.

Test plan:
Edit a subscription and set number of issues = "f"
Save
=> Without this patch there is a SQL error in the log:
  Incorrect integer value: 'f' for column 'numberlength'
=> With this patch the other changes are effective.

Note: We also could change the type attribute of the input to "number",
to have a client-side check

Also, the return value of ModSuggestion is never used, so we are safe
with that.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-23 09:09:30 +00:00
78190371d0
Bug 24286: Escape forward slash in GENRE/FORM (and any authtype)
Note that bug 24267 will fix the issue during Z39 searching for new auth, but the duplicate check at saving will still fail

To test:
 0 - Set SearchEngine to Elasticsearch,  QueryRegexEscapeOptions  to 'Don't Escape'
 1 - Browse to Authorities
 2 - Select New->New from Z3950
 3 - Search for subject 'Short stories'
 4 - Auth search explodes
 5 - Apply patch
 6 - Repeat and confirm the search results return
 7 - Import and save the GENRE/FORM record for Short stories
 8 - Repeat the search and import the same record
 9 - Confirm that upon save you are notified of duplicate, don't save
10 - set  QueryRegexEscapeOptions to 'Escape' and confirm Z39 searching works and importing/save notifies of duplicate
11 - set SearchEngine to Zebra and confirm Z39 searching works and importing/save notifies of duplicate

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-23 09:05:08 +00:00
0dbf76c290
Bug 24441: Error when checking in an item with BranchTansferLimitsType set to itemtype
It appears that the transition to using Koha::Item in AddReturn has introduced a bug. Previously $item was a hashref with the key 'itemtype', now that it's an object, it has no itemtype method and so triggers an error with the message "The method Koha::Item->itemtype is not covered by tests!".

Test Plan:
1) Enable Branch Transfer Limits via itemtype
2) Check in an item
3) Note the error
4) Apply this patch
5) Restart all the things!
6) Check in an item
7) No error!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Maribeth (Turner) Shafer <mshafer@ckls.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-23 09:03:51 +00:00
David Bourgault
89b658885f
Bug 7468: Print barcodes by range
Adds an option to the label creator to print a range of barcodes.
Only allows printing to PDF.

C4/Label.pm had to get minor changes to override database-based barcode
generation. Same with labels/label-create-pdf.pl. By default, the
barcode is fetched from the database using the itemnumber, but when
printing ranges, you might not have a corresponding  database entry.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-21 11:28:19 +00:00
2aa49ebab4
Bug 3426: Allow for multiple fields in itemcallnumber syspref
Note that we change both cataloguing/additem.pl and C4/Items->PrepareItemrecordfordisplay

I can find no code that uses callnumber from the C4/Items sub, except for the itemrecorddisplay script
which is not called with an itemnumber from Koha and should be deprecated for REST or ILSDI or OAI (imho)

To test:
 1 - Define itemcallnumber syspref as "082ab,092ab,9520,245a"
 2 - Find a record with no items
 3 - Ensure it has no 082 field, but an 092 field
 4 - Go to add an item - itemcallnumber is empty
 5 - Apply patch
 6 - Go to add item, itemcallnumber should be the 092ab fields
 7 - Delete the 092 field
 8 - Go to add item, itemcallnumber should be the 245a
 9 - Edit the callnumber to be "testing" and save item
10 - For should now show itemcallnumber="testing" as default
11 - Browse to http://localhost:8081/cgi-bin/koha/services/itemrecorddisplay.pl?itemnumber=## subbing the correct itemnumber
12 - Ensure the callnumber is defaulting to testing
13 - delete the item you created
14 - browse to URL above - callnumber should now be 245 again
15 - Add an 092 field to record and ensure it is now default callnumber
16 - Add an 082 field, it should now be default

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-21 11:26:18 +00:00
f31993d126
Bug 24430: Remove CountBiblioInOrders and its traces
This patch replaces the only uses of CountBiblioInOrders and makes that
code use $biblio->orders->count instead.

Test nothing breaks in basket.pl and parcel.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-21 11:21:57 +00:00
David Bourgault
34dfe783c6
Bug 12502: Add vendor note, internal note, ordernumber and isbn to late orders page
Test plan:

0) Make sure you have a late order
    a) Create a test vendor unless you have one
    b) Create a test basket unless you have one
    c) Close the basket to mark the order as late
1) Go to the late orders table
Before patch : Orderno, ISBN, vendor notes, internal notes are absent
After patch: fields are present

2) Edit the vendor note and/or the internal note
3) Press the save notes button
4) Refresh page and cache (CTRL+F5), if notes have been correctly saved, your modifications should be displayed.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-20 16:37:21 +00:00
a155575f9d
Bug 17667: Do not modify quantity of the original standing order when a receipt is cancelled
When cancelling a receipt, the quantity of the original order is
increased.

Test plan:
Create a basket, mark is as "standing orders"
Create an order
receive it
cancel the receipt
=> Without this patch the quantity of the original order is 2
=> With this patch applied the quantity it always 1

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-20 14:03:50 +00:00
Matthias Meusburger
de0161db1e
Bug 21520: More complex OAI sets mappings
Currently, the rules used to create OAI sets are processed with the 'or'
boolean operator between each rule.

This patch allows to use 'or' or 'and' between the rules.

The evaluation of the rules is done according to the boolean operators
precedence: AND has a higher precedence than OR.

For example:

A and B or C and D

will be evaluated as follow:

(A and B) or (C and D)

Test plan:

 - Apply the patch
 - Apply the atomicupdate
 - Prove t/db_dependant/OAI/AndSets.t
 - Check that existing mappings still work
 - Try modifying existing mappings
 - Try creating new mappings
 - Check that the boolean operators precedence is correctly taken into account

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>
2020-01-15 13:49:19 +00:00
1906a69e51
Bug 20567: Count found holds for holds limit
Signed-off-by: Hans Palsson <hans.palsson@hkr.se>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-15 13:48:10 +00:00
4c89fd3989
Bug 24361: Remove warning from GetAgeRestriction
Use of uninitialized value $record_restrictions in uc at /kohadevbox/koha/C4/Circulation.pm line 3981

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-13 14:48:36 +00:00
f94b32f074
Bug 24146: Corrections to UpdateFine logic concerning maxFine
The `maxFine` system preference actually refers to the amount of
outsanding debt (in fines) a patron may have at a given time. This patch
corrects the functionality of UpdateFine such that it properly respects
that counter given the payment of accruing fines scenario.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-13 13:40:21 +00:00
7a1e1a1f88
Bug 24146: Increment existing fine
We should increment an existing fine even if it has been fully paid off
whilst it is still incrementing and not create a new fine.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-13 13:40:12 +00:00
73ce2a3685
Bug 23934: Item level holds not checked for LocalHoldsPriority in Holds Queue
Test plan:
- Set LocalHoldsPriority to "Give priority for filling holds to patrons
whose pickup library matches the item's holding library"
- set yourself at Library A
- find at item at Library A
- place an item-level hold (Hold 1) for item for pickup at Library B
- set an item-level hold (Hold 2) for item for pickup at Library A
- Confirm Hold 1 shows priority=1
- Check in item
- confirm item would be captured for Hold 2, ignore hold
- run holds queue
- check item in
- confirm item is captured for Hold 2

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>
2020-01-10 16:19:40 +00:00
790f0ee572
Bug 15142: Remove titles facet for UNIMARC
There is a facet using 500$a, 501$a and 503$a and Subject index.
In UNIMARC 500$a, 501$a and 503$a are not indexed as Subject.
I propose to remove this facet for UNIMARC, looks like it does not make
sens.

Test plan:
1) Install UNIMARC database
2) Edit some records to have 500$a
3) Perform a search to find those records
4) Check you dont see the titles facet

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-10 16:16:21 +00:00
2278ff2b08
Bug 24396: Fix Suggestions.t with MySQL 8
#   Failed test 'DelSuggestion deletes the correct suggestion'
 #   at t/db_dependent/Suggestions.t line 413.
 #          got: 'my title 3'
 #     expected: 'my deleted title'
 t/db_dependent/Suggestions.t .. 112/113 # Looks like you failed 1 test of 113.

Suggestions were returned in the reverse order. Adding an ORDER BY clause fixes the problem.

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-10 10:54:28 +00:00
c7ea3cb0c9
Bug 14759: Replace Text::Unaccent with Unicode::Normalize
As shown in the comments on the bug, it appears that Unicode::Normalize
is the most reliable way to strip accents from strings for this use
case.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-10 10:44:35 +00:00
f5739acdd8
Bug 24277: Fix date received editing when receiving an order
Bug 8417 added the ability to edit the date received, but a merge
conflict was wrongly resolved during a rebase of
  commit 20d9ed618f
  Bug 13321: Rename variables

Test plan:
Create an order
Receive it
Set a date (different from today)
=> The date you picked should have been set in DB for the order

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-08 14:26:57 +00:00
6b6f7f1654
Bug 24361: (RM follow-up) Restore 0 handling in CalcFine
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-08 10:02:54 +00:00
094f0623c2
Bug 24361: (bug 24217 follow-up) Fix several warnings in C4 modules
With bug 24217 pushed, lot of warnings appears during the tests are run.
Most of them are "Use of uninitialized value in "

Test plan:
Take a look at the output of run 1049
https://jenkins.koha-community.org/job/Koha_Master_D9/1049/consoleFull

Most of the warnings from this run will be removed by this patch

At least 2 are not fixed:
Use of uninitialized value in numeric eq (==) at /kohadevbox/koha/C4/Reserves.pm line 791.
t/db_dependent/Items_DelItemCheck.t => see 23463

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-07 13:59:51 +00:00
60e5f77770
Bug 24361: Fix warning in C4::Record line 435
Use of uninitialized value in concatenation (.) or string at /kohadevbox/koha/C4/Record.pm line 435

Caught by a failing test:
    #   Failed test 'Export csv with wrong marcxml should raise a warning'
    #   at t/db_dependent/Exporter/Record.t line 113.
    # found warning:  problem with :721 : :1: parser error : Start tag expected, '<' not found
    # found warning: Use of uninitialized value in concatenation (.) or string at /kohadevbox/koha/C4/Record.pm line 435.
    # expected to find warning: (?^u:.*Start tag expected.*)

Test plan:
Make sure the tests pass now

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-07 13:59:36 +00:00
Agustin Moyano
3b25ea7c94
Bug 22284: Add "patron's hold group" as new hold_fulfillment_policy option
This patch adds "patron's hold group" as a new option to Hold pickup library match

To test:
1. Set ReservesControlBranch preference to item.
2. Create a hold group
3. Go to circulation and fines rules
SUCCESS => in 'Hold pickup library match' there is a new option called "patron's hold group"
4. In a library not in hold group set 'Hold policy' to "any" and 'Hold pickup library match' to "patron's hold group"
5. Search for a user in the hold group
6. 'Search to hold' for items of the library of step 4
7. Select an item and 'Place hold for [user]'
SUCCESS => in 'Pickup at' you should see patron's hold group as options
8. In OPAC sign in as the same user of step 5
9. Search for the item in step 7
SUCCESS => in 'Pick up locations' you should see patron's hold group as options
10. Sign off

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-03 12:58:05 +00:00
Agustin Moyano
da620fdf91
Bug 22284: (follow-up) Squash multiple follow-ups
* Bug 22284: (follow-up) Remove commented warn and address test failures
  * Bug 22284: (follow-up) fix test count after merge
  * Bug 22284: (follow-up) fixes after 15496
  * Bug 22284: (follow-up) fixes after 18936
  * Bug 22284: (follow-up) Remove HomeOrHolding from reserves

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-03 12:58:05 +00:00
Agustin Moyano
a998ba5714
Bug 22284: Control hold groups in C4::Reserves
This patch modifies C4::Reserves to control when hold group options where selected
in smart rules.
In CanItemBeReserved adds 2 new error status messages
1) branchNotInHoldGroup: when a patron's homebranch is not in item's hold group
2) pickupNotInHoldGroup: when a selected pickup location is not in item's hold group
Also CheckReserves is modified when item's priority is defined, to control by hold
group when required.
Finally, IsAvailableForItemLevelRequest was also modified to control by hold group when
required.

To test:
1) Apply this patch
2) prove t/db_dependent/Holds.t
SUCCESS => Result: PASS
3) Sign off

Sponsored-by: VOKAL
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-03 12:58:03 +00:00
dc5fe323d2
Bug 24217: use Modern::Perl for modules when strict is missing
We absolutely need that for modules.
We are enabling strict by using Modern::Perl.
Note that other modules from C4 use strict and warnings, instead of
Modern::Perl

Test plan: git grep 2505 **/*.pm should not return any results

And let's see later what needs to be fixed.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-03 10:45:46 +00:00
f480ca803b
Bug 24267: (QA follow-up) Remove two calls, add transaction
Call to GetAuthorizedHeading is already done just before calling ImportBreedingAuth.
Call to GuessAuthTypeCode is not used.
Adding transaction to test (check your database, kidclamp ;)

Test plan:
Add new authority via Z3950 in the interface.
Run t/db_dependent/Breeding.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-02 14:04:45 +00:00
7abb7350ef
Bug 24267: Improve ImportBreedingAuth
git grep ImportBreedingAuth - there is only one call to this routine
from SearchZ3950Auth

We pass it a MARC record, '2' for overwrite_auth

We then check for this record in the DB and get the breeding id,
however, when overwrite_auth is 2 we always add the auth to the batch
and return the new breeding id.

We don't actually use any of the other parameters returned here either

To recreate:
1 - Browse to Authorities
2 - Select New form Z3950
3 - Perform a search that returns results
4 - SELECT COUNT(*) FROM import_auths
5 - Repeat the search
6 - SELECT COUNT(*) FROM import_auths
7 - There are 20 more records
8 - SELECT * FROM import_auths - note the repeated rows

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-02 14:04:18 +00:00
Alex Arnaud
5e5e50ac17
Bug 14973: Check existing biblio when submitting a purchase suggestion (staff side)
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-02 12:31:20 +00:00
Alex Arnaud
880fc53d74
Bug 14973: Check existing biblio when submitting a purchase suggestion (opac side)
Test plan:
- Go to opac suggestions page (opac-suggestions.pl) and click on "New purchase suggestion",
- type the title (and author?) of a document that stand in you database
- you should get a warning message about an exiting biblio.
- clicking on confirm your suggestion add it, cancel does nothing

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-02 12:30:56 +00:00
ee4d99cc76
Bug 24244: Send null instead of empty string if branch not set
Fix NewSuggestion if branchcode is passed with an empty string.
Error was "Broken FK constraint"

Test plan:
Create a new suggestion, select "any" for the library.

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>
2020-01-02 12:15:11 +00:00
15db14d62f
Bug 7047: Change ReNewSubscription prototype - use hashref
It also removes a warn statement.

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>
2019-12-23 12:06:45 +00:00
5c5f8ecfed
Bug 7047: Storing subscription renewal note in suggestion to be displayed on the suggestion page.
Additionally I have added a library input field in case the librarian wants to set a library branch whilst renewing a subscription. With the use case being they may have ommitted to set the branchcode whilst creating the subscription.

Test plan:
1. Create a subscription (if one does not already exist)

2. Set the RenewSerialAddsSuggestion syspref to 'Add'

3. Renew the item making sure to write in a value into the note field

3. Visit the suggestions page and notice that the note is not displayed
for the newly created suggestion

4. Apply patch

5. Repeat step 3. Notice that there is now a new branchcode dropdown
box. Select one of your libraries and write in the value into the note
field

6. Visit suggestions and notice there is now a 'Suggestion note' column
in the table containing the note.

Also note that the suggestion has the correct branchcode associated with
it

Sponsored-By: Catalyst IT
Signed-off-by: Maksim Sen <maksim@inlibro.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
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>
2019-12-23 12:06:28 +00:00
Pedro Amorim
f93e5bc59a
Bug 24121: Item types icons in intra search results are requesting icons from opac images path
When searching in INTRA you'll notice the item type icons not showing.

To test:
1) Set syspref item-level_itypes to biblio
2) Confirm that there is a biblioitems.itemtype mapping to a MARC field
3) Verify that item type icons are set for all the types
4) Perform a search where biblios with said MARC field is filled with a type value
5) Verify that where the icon should appear, it's showing the browser icon for image not found
6) Apply patch.
7) Repeat step 4.
8) Observe the icons are now displayed correctly

Sponsored-by: Governo Regional dos Açores
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-23 12:04:42 +00:00
d2bdccdb64
Bug 24175: Take advantage of Koha::Item->holds
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-23 10:56:41 +00:00
09aa99391f
Bug 24175: Use itemnumber when searching for holds in SIP drop_hold
To test:
1 - place a hold for a patron
2 - Get SIP running
    https://wiki.koha-community.org/wiki/Koha_SIP2_server_setup
3 - edit the sip_cli_emulator.pl for hold_mode from '+' to '-'
4 - Attempt to cancel hold
5 - It fails
6 - Apply patch
7 - Try again
8 - It succeeds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-23 10:56:35 +00:00
f4746340c1
Bug 23233: Remove use of AllowItemsOnHoldCheckout from C4::Items::GetItemsInfo
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-16 11:09:09 +00:00
50bb8e96f1
Bug 23233: AllowItemsOnHoldCheckout is misnamed and does not indicate it is for SIP-based checkouts only
The system preference AllowItemsOnHoldCheckout only affects SIP based checkouts. I believe we should rename it AllowItemsOnHoldCheckoutSIP so it matches AllowItemsOnHoldCheckoutSCO. We should also update the description as well.

As far as I know AllowItemsOnHoldCheckout has never affected anything except SIP traffic. That does not preclude the addition of another AllowItemsOnHoldCheckout syspref that would affect the staff interface, but that would be an enhancement and is outside the scope of this bug report.

Test Plan:
1) Test AllowItemsOnHoldCheckout via SIP
2) Apply this patch
3) Test AllowItemsOnHoldCheckoutSIP via SIP
4) Note there is no difference!
5) Note the syspref description has been update to mention SIP

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-16 11:08:52 +00:00
76cd9cd7e7
Bug 24164: Copy the letter for each email
To test:
1 - Set or have two patrons with emails - note thier borrowernumber for the report
2 - Create a report - note the report id ($REPORT_ID)
SELECT borrowernumber, surname, firstname, email FROM borrowers WHERE borrowernumber IN (##,##);
3 - Create a notice in circulation with code TESTEMAIL
4 - The content should be "[% surname %]"
5 - perl misc/cronjobs/patron_emailer.pl --report $REPORT_ID --notice TESTEMAIL --module circulation --from anyone@anywhere.com --verbose
6 - Note that the emails both have the same surname
7 - Apply patch
8 - Repeat 5
9 - Emails now have correct content

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-13 14:01:01 +00:00
704ea1a62e
Bug 24138: Fix calculation of suspension days when a limit is set
If there is a limit for the number of suspension days
(maxsuspensiondays), the calculation is wrong. We are reducing the
number of days before taking into account the suspension charging
interval.

For instance, a checkin is 1 year late and the circ rules are defined to
charge 7 days every 15 days.
It results in 365 * 7 / 15 days of suspension => 170 days

Before this patch the calculation was:
365 * 7 limited to 333, 333 / 15 => 22 days

Test plan:
Given the examples in the commit messages and the description of the bug
report, setup complex circulation rules and confirm that the debarment
dates are calculated correctly

Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-10 16:14:50 +00:00
fc72ce1a5f
Bug 24138: Move the calculation out of the sub
No changes expected here. For the next patch we are going to need to add
test and calculate the new debarment date. To ease the writing of these
tests the calculation is moved out of the existing subroutine.

Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-10 16:14:42 +00:00
b022b37db7
Bug 24199: (bug 23042 follow-up) Prevent t/Auth_with_shibboleth.t to fail randomly
CGI->url_param does not always return the parameters in the same order.

Test plan:
0/ Recreate the random failure, does not apply the patch and run
t/Auth_with_shibboleth.t several times.
You will notice that it fails inconsistenly
1/ Apply the patch and confirm that it now passes 100% of the time

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-12-10 10:43:20 +00:00
8a766c2208
Bug 23042: Correct shib param escaping
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>
2019-11-27 11:30:20 +00:00
4e02adb5df
Bug 23042: Only include GET params in return URL for Shibboleth
The shibboleth return target included POST parameters in the URL string,
this meant that a failed local login POST would include the username and
password used in the attemtped login in plaintext in the redirect URL
that is appended to the shibboleth login URL.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
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>
2019-11-27 11:30:20 +00:00
7fa1cde78e
Bug 23329: Move error page to its own subroutine
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-27 11:30:19 +00:00
Magnus Enger
d20c9ff588
Bug 22543: Prevent "back and refresh attack"
To reproduce and test:
- Log into the OPAC, you are taken to /cgi-bin/koha/opac-user.pl
- Log out, you are taken to /cgi-bin/koha/opac-main.pl?logout.x=1
- Click "Back", you are taken to /cgi-bin/koha/opac-user.pl
- Reload the page, you see an error like "Confirm new submission
  of form"
- Reload the page again and confirm the submission of the form
- You are now logged in to the OPAC again!
- Log out again
- Apply this patch
- Log in to the OPAC, you are taken to /cgi-bin/koha/opac-user.pl
- Log out, you are taken to /cgi-bin/koha/opac-main.pl?logout.x=1
- Click back, you are taken to /cgi-bin/koha/opac-user.pl
- No matter how many times you reload /cgi-bin/koha/opac-user.pl,
  you should not see anything other than the login form.
- Check that Self Check Out still works as it should, by making
  sure you have a user with self_check permissions, then setting
  WebBasedSelfCheck, AutoSelfCheckAllowed, AutoSelfCheckID and
  AutoSelfCheckPass appropriately. Then visit
  /cgi-bin/koha/sco/sco-main.pl and verify everything works as
  expected.

The messages and errors pages you see related to resubmitting the
form might differ from the ones described here, depending on what
browser you use. I tested in Chromium 76.0.x.

This fix was originally proposed by LMSCloud:
74a7fe0f0c

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>
2019-11-27 11:30:18 +00:00
0f4bc4fd81
Bug 23964: (follow-up) We should check for only active holds when determining to set waiting
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-25 16:38:16 +00:00
4c853b0034
Bug 24013: Fix transferbook if item is checked out
Wrong conflict resolution, the following
  commit 6eade474ed
  Bug 18276: Remove GetBiblioFromItemNumber - Easy ones
restored a previous change from
  commit 546379cc92
  Bug 17680: C4::Circulation - Remove GetItemIssue, simple calls

Not that "easy" or "simple"...

Test plan:
Run the test before and after this patch.

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>
2019-11-25 08:38:10 +00:00
39cc13d070
Bug 24075: Backdating a return to the exact due date and time results in the fine not being refunded
When you use the date picker or book drop mode and check in an item that is due on that date, a fine is assessed and not refunded.

For example: item 12345 is due on 11/19/2109 23:59.  On 11/20/2019 I check the item in using date picker/book drop setting the check in date to 11/19/2019 23:59, the patron is charged a fine, and the fine is not cleared as would be expected, since the item is being checked in before it is overdue.

Test Plan:
1) Back date a checkout so it is overdue
2) Run fines.pl to generate the fine
3) Return the item, backdating to the same date/time is was due
4) Note the fine was not removed
5) Apply this patch
6) Repeat steps 1-3
7) Fine should be zeroed out now!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-22 15:08:21 +00:00
d4589500d1
Bug 24065: Fail shib login if multiple users matched
Ideally you could test against active shib, but is a small code change and
covered by tests and should be readable

To test:
prove -v t/Auth_with_shibboleth.t

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-21 11:33:11 +00:00
f847cfdd7e
Bug 23964: (follow-up) Add comments and improve readability
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-21 11:27:12 +00:00
e083287048
Bug 23964: ReservesNeedReturn should only apply to available items
To test:
 1 - Checkout an item to a patron
 2 - Make sure 'ReservesNeedReturn' is set to 'Automatically'
 3 - Place an item level hold on the checked out item
 4 - Note the hold is marked waiting
 5 - Delete the hold
 6 - Apply patch
 7 - Place a new hold
 8 - Hold is not marked waiting
 9 - Please a hold on a different item
10 - Note it is marked waiting
11 - Test when item is damaged and hold not allowed on damaged items
12 - Test when item is in transit
13 - Test when item has another hold
14 - Only in the case where none of the above are true should the hold be marked waiting

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-21 11:26:53 +00:00
c0a34045df
Bug 23982: Fix the failing test
#   Failed test 'nb_rows returns 0 on bad queries'
    #   at t/db_dependent/Reports/Guided.t line 441.
    #          got: undef
    #     expected: '0'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-20 09:00:17 +00:00
24f780e22f
Bug 23982: (bug 23624 follow-up) Handle SQL error caused by derived table
Caused by
  commit bca4453c50
  Bug 23624: (QA follow-up) Optimize even more

A report like:
SELECT * FROM issues JOIN borrowers USING (borrowernumber)

will have two borrowernumber columns - SQL will give us there rsults,
but if we try to wrap them in a SELECT COUNT(*) FROM (report) it throws
a duplicated column error.

This patch suggests to execute the query the old way if the derived
table optimization failed.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-19 15:09:19 +00:00
17d2211446
Bug 23985: (bug 21206 follow-up) Fix checkout list when "Hold pickup library match" not set
This patch restores the behavior prior to bug 21206.
If "Hold pickup library match" is "Not set", then
hold_fulfillment_policy equals an empty string.

Test plan:
1. Go to "Circulation and fines rules"
2. Under "Default checkout, hold and return policy", unset "Hold pickup
library match" and Save
3. Place a hold on one item for one patron
4. Try to checkout the same item with another patron

=> Without this patch you the checkout list do not show, and the logs
contain "The method Koha::Item-> is not covered by tests!"
=> With this patch applied you see the checkout list

QA will take care of comparing the statement with the one before bug 21206
and make sure they are equivalent

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-13 14:01:08 +00:00
86f999812e
Bug 23765: Do not display localized templates if TranslateNotices is off
To test:
1. Enable multi-languages
2. Set the preference 'TranslateNotices' on  'Allow'
3. Go to: tools==>Notices & slips==>Edit, make sure it has multilingual
email templates.
4. Set the preference TranslateNotices on 'Don't allow'.
5. Go to: tools==>Notices & slips==>Edit, the template shows several tab
for the same transport type.
6. Apply the patch.
7. Repeat the steps 4 and 5
8. Success. It only shows the default template when TranslateNotices is
'Dont allow'.

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>
2019-11-13 13:36:45 +00:00
dfb33b7f87
Bug 24030: Fix GetItemsForInventory under MySQL 8
t/db_dependent/Items/GetItemsForInventory.t .. 1/9 DBD::mysql::st execute failed: Expression #1 of ORDER BY clause is not in SELECT list, references column 'koha_kohadev.items.cn_sort' which is not in SELECT list; this is incompatible with DISTINCT [for Statement "
        SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber

        FROM items
        LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber
        LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber
     ORDER BY items.cn_sort, itemcallnumber, title"] at /kohadevbox/koha/C4/Items.pm line 838.

We simply follow what the error says, and add items.cn_sort to the SELECT list

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-13 13:25:28 +00:00
150361c0e5
Bug 24002: One more occurrence of datecancellationprinted
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-11-12 13:50:27 +00:00