Commit graph

6572 commits

Author SHA1 Message Date
2059f7d801 Bug 16735: Migrate library search groups into the new hierarchical groups
Test Plan:
1) Apply this patch set
2) Note your existing search groups have been ported over to the new
   __SEARCH_GROUPS__ group if you had any
3) Create the group __SEARCH_GROUPS__ if one does not already exist
4) Add some first level subgroups to this group, add libraries to those groups
5) Search the library group searching in the intranet and opac
6) Note you get the same results as pre-patch

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-02-12 15:41:25 -03:00
0f43bdd641 Bug 12904: Pass KOHA_VERSION in C4::Auth
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
2018-02-08 14:53:23 -03:00
e6da42de89 Bug 20126: (follow-up bug 10455) Restore MARC field length calculation in ModBiblioMarc
Trivial fix. Problem raised by bug 10455.

Test plan:
[1] Create or edit biblio record.
[2] Save and check leader field lengths in MARC view.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-02-02 12:08:42 -03:00
9215cb7caf Bug 18198: MARC21: Further improve handling of 5XX$u in GetMarcNotes
Bug 14306 only handled field 555 in MARC21 as an URI. But a lot of other
5XX fields have a $u subfield for URIs; actually $u is not used in any
other way. This patch generalizes the change made for 555 and extends
it to all 5XX $u.

Test plan:
[1] Run t/Biblio.t
[2] Run t/db_dependent/Biblio.t
[3] Edit a MARC21 record. Add a URL into 505u, 520u, 555u.
[4] Check presentation on opac-detail (tab Title notes)
[5] Check presentation on catalogue/detail (tab Descriptions)

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

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-02-02 12:08:41 -03:00
Zoe Bennett
e1ba582af9 Bug 19827: Removing &checkuniquemember from the export in C4/Members.pm
Test Plan:
- Check that the line &checkuniquemember has been removed from the
export in C4/Members.pm

Signed-off-by: Roch D'Amour <roch.damour@inlibro.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-30 14:21:27 -03:00
Mark Tompsett
13cb7e0490 Bug 13990: (follow-up) silence warnings on testing
prove t/db_dependent/ILSDI_Services.t

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-30 14:21:19 -03:00
Mark Tompsett
5d6e58f7ca Bug 13990: (follow-up) fix various whitespace errors
- tabs to 4 spaces
- trailing whitespace
- missing vertical whitespace before =head3

Without this patch, this bug fails qa test tools.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-30 14:20:59 -03:00
Jon Knight
65e541085c Bug 13990: ILS-DI LookupPatron requires ID Type
Patch provides a constrained set of borrower attributes to try in turn if the
ID type is not specified.  Also added "email" to the POD documented list of
id types seeing as its quite a useful one for integration developers.

Test plan:

1) without the patch applied, turn on ils-di interface in your admin sysprefs
   and then try accessing the URL:

   https://your-server/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=Mabel

   replacing "your-server" your Koha dev test domain name (localhost:8080 if
   you're using a kohadevbox VM) and "Mabel" with the first name of a patron
   (Mabel is in the test database already if you're using that).

   You should get back an error message in the XML.

2) Apply the patch and repeat. This time you should get an <id> element in
   the XML with Mabel's patron ID in it.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-30 14:18:21 -03:00
Olivier Crouzet
5a2d0a8f65 Bug 19971: Typo in the comments of parseQuery routine
TEST PLAN
---------
1) Run these commands:
    git checkout master
    git pull
    perldoc C4::Search
2) look for parseQuery
    -- NOTE: The sample code provided below this heading has
             the wrong function name!
3) Run these commands:
    git checkout -b bug_19971 origin/master
    perldoc C4::Search
4) look for parseQuery
    -- NOTE: The wrong function name is corrected.
5) Run koha qa test tools

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-19 15:50:31 -03:00
Mark Tompsett
3524925631 Bug 19937: Silence warnings t/db_dependent/www/batch.t
TEST PLAN
---------
1) Run the following on a kohadevbox:
    git checkout -b bug_19937 origin/master
    sudo koha-shell -c bash kohadev
    prove t/db_dependent/www/batch.t
    cat /var/log/koha/kohadev/plack-error.log

    The following errors are triggered at the end of the log file:
        Use of uninitialized value in array element at
        /home/vagrant/kohaclone/tools/batch_records_ajax.pl line 50.
        Use of uninitialized value $results_per_page in numeric eq (==) at
        /home/vagrant/kohaclone/tools/batch_records_ajax.pl line 53.
        Use of uninitialized value in uc at
        /home/vagrant/kohaclone/C4/ImportBatch.pm line 1120.

2) Run the following on a kohadevbox:
    exit
    git bz apply 19937
    restart_all
    sudo koha-shell -c bash kohadev
    prove t/db_dependent/www/batch.t
    cat /var/log/koha/kohadev/plack-error.log

    The log file will end with the restarting of plack, not the
    errors.

3) run koha qa test tools

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended handling of $results_per_page.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-15 12:22:16 -03:00
e0ed339ad5 Bug 11046: Improve the readability of the regex using named capture
The tests tell me I am good

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-09 17:24:17 -03:00
b1e4acac3c Bug 11046: Add the form YYY-? for uncertain years
This form occurred in Dutch ISBD rules.
The question mark should follow the hyphen(s).

Test plan:
Run t/db_dependent/Biblio/TransformMarcToKoha.t

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

TransformMarcToKoha tests passed. Also this patch passed QA test tool

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-09 17:24:17 -03:00
665fcd2777 Bug 11046: Better handling of uncertain years for publicationyear
This patch makes it possible that uncertain year like 18.. or 197x are
converted to 1800 or 1970 in Koha field copyrightdate (MARC21) or
publicationyear (UNIMARC). (The corresponding MARC record will not be
changed obviously.)

This change will allow for better results when sorting search results or
list contents on copyrightdate. Currently, things like 18.. will sort
together with zero.

Note: The regex now allows four possible uncertain year markers: x or X,
question mark or dot.

Test plan:
[1] Run t/db_dependent/Biblio/TransformMarcToKoha.t
[2] Edit a biblio record. Save 18.. into 260c. Check biblio.copyrightdate.

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

Followed test plan, patch worked as described, it also passed QA test
tool

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-09 17:24:16 -03:00
3647665f46 Bug 19280: refresh unblessed patron too
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-09 17:23:15 -03:00
d8dc86bc4b Bug 19280: Pass a Koha::Patron to CanBookBeIssued
We need to make subroutine from C4 use more Koha::Object objects
Seeing bug 19276, starting here is a good start.

Test plan:
The tests should still pass.

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-09 17:23:15 -03:00
3a5534fcf5 Bug 19304: Move C4::Members::GetNoticeEmailAddress to Koha::Patron->notice_email_address
This subroutine is quite trivial and can be replaced easily with a new
method of Koha::Patron

Test plan:
Overdue notices and shelf sharing must be send the to an email address,
according to the value of the pref AutoEmailPrimaryAddress

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-02 11:46:40 -03:00
9782fa1846 Bug 19303: Move C4::Members::GetFirstValidEmailAddress to Koha::Patron->first_valid_email_address
This new Koha::Patron->first_valid_email_address already exists, it
should be called directly

Test plan:
- With a logged in user who have an email address defined, send a basket.
The email should be marked sent by this email address

- On the "Holds awaiting pickup", the email address must be displayed as well

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-02 11:46:40 -03:00
19e5eeb8e5 Bug 19300: Replace C4::Reserves::OPACItemHoldsAllowed - Remove the subroutine
At this point the subroutine is not longer in use, we can remove it

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-02 11:46:40 -03:00
14e2185f94 Bug 19841: Make AddMember raise an exception if categorycode is invalid
This patch makes C4::Members::AddMember raise a Koha::Exceptions::BadParameter
exception. The current behaviour is to just explode. Code calling
AddReturn should work as expected, unless they are looking for a
specific failure message.

It is just explodes in a way we know what happened, in the case the
categorycode is invalid.

To test:
- Apply the Unit tests patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Members.t
=> FAIL: Tests fail because AddReturn doesn't raise an exception
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Members.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Dominic Pichette <dominic.pichette@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-26 12:52:34 -03:00
46f4f7d6c2 Bug 19788: Preserve case sensitivity when creating Local preferences
Fix a bug tranforming new local preference variable name in lowercase.

TO TEST:

1. Admin > System preferences > Local use
2. Button New preference. Fill variable field with 'TESTfoo'. Click
   Save.
3. The new variable is named: 'testfoo'.
4. Apply the patch.
5. Button New preference. Fill variable field with 'TESTfoo2'. Click
   Save.
6. The new variable is properly named: 'TESTfoo2'.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-22 13:15:37 -03:00
Janusz Kaczmarek
70bb6fe0ae Bug 18458: Fix subfields ordering when Merging authority records
While doing a merge, if a subfield(s) precedes the controlled subfields
(like $i before $a in 7XX, which comes before $a -- rare but will
become more and more usual) after merging will be moved to the end.
This is not right.

The patch (with AuthorityMergeMode == loose) make merge consider the
subfields order: all subfields which originally were found before
the first controlled subfield (e.g. $i before $a in 7XX / MARC 21)
will remain in the front, the rest of not controlled subfields that
should remain in the field will come after the subfields copied
from authority rec.

As a bonus, $9 will be placed at the end.

To test:
0) Have AuthorityMergeMode == loose;
1) Have some field in bibliorecord, controlled by an authority, with
extra subfield(s) (i.e. not present in authority rec.) placed at the
beginning of the field;
2) Open (not necessarily edit) and save the connected authority;
3) See that the extra subfieds were moved to the end of the field
   (and $9 is in the front);
4) Apply the patch;
5) Reorder subfields in biblio field;
6) Open (not necessarily edit) and save the connected authority;
7) See that the order has been conserved, additionally $9 the last
   subfield in the field.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended:
Moved field creation to its original place. Changed $9 handling. Simplified the following add_subfields for loop. Edited comments.
Restored the append_fields_ordered call (see comment6).

With this patch, the Merge.t test now passes.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-22 13:15:36 -03:00
Srdjan
79c2848b14 Bug 19450: Fixed WebService::ILS bug upstream (0.17)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-21 13:09:17 -03:00
Priya Patel
75e6c204a4 Bug 19713: Remove 2 occurences of OpacShowLibrariesPullDownMobile
To test:
1/ Grep to find OpacShowLibrariesPullDownMobile
2/ Notice it is in t/db_dependent/UsageStats.t and C4/UsageStats.pm
3/ Apply patch
4/ Grep to check OpacShowLibrariesPullDownMobile was removed from 2
files

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-20 13:34:09 -03:00
Jessica Freeman
eddc1acd70 Bug 19714: Removing 2 occurrences of memberofinstitution
To Test:
1/grep for memberofinstitution
2/Notice it occurs in C4/UsageStats.pm and t/db_dependent/UsageStats.t
3/grep again, notice they have been removed

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-19 11:15:54 -03:00
a8f4aacb1d Bug 19444: Do not auto renew if patron is expired and BlockExpiredPatronOpacActions is set
If the patron's account has expired and BlockExpiredPatronOpacActions is set,
we expect auto renewal to be rejected.

Test plan:
Use the automatic_renewals.pl cronjob script to auto renew a checkout

Before this patch, if the patron's account has expired the auto renew was done.
With this patch, it will only be auto renewed if BlockExpiredPatronOpacActions is not set.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-18 12:16:26 -03:00
6ea21c395a Bug 19514: Add client-side check
Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-14 16:58:13 -03:00
5359488528 Bug 12227: Remove the demo functionality
This is a legacy mode that did not really work.

Test plan:
Play with frameworks and sysprefs and confirm the changes
(add/del/update) are taken into account.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-11 11:34:20 -03:00
e110f90c34 Bug 19299: Replace C4::Reserves::GetReservesForBranch with Koha::Holds->waiting
GetReservesForBranch simply returns the waiting holds, for a specific
branch of not. This can easily be replaced with a call to
Koha::Holds->waiting

To avoid any regressions, I reuse the exact conditions (priority = 0),
but I do not think it is useful.

Test plan:
Make sure the holds information are correctly displayed on the waiting
holds screen.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-11 11:34:19 -03:00
f54693ac86 Bug 10021: Drop columns notify_id and notify_level from accountlines
It appears that has never worked.
Could someone confirm?

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-11 11:34:18 -03:00
32fcf995a3 Bug 10021: Drop table notifys and related code
This patch drops the notifys table and its related code in C4::Overdues.
A second patch should remove the 2 columns notify_id and notify_level
from the accountlines table.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-11 11:34:18 -03:00
590cae04fd Bug 19096: Make Default authoritative in core modules
After feedback from the dev mailing list, it seems appropriate here to
propose making the Default framework authoritative for Koha to MARC
mappings. This implies checking only the Default framework in the
routines:

[1] GetMarcFromKohaField: The parameter frameworkcode is removed. A
    follow-up report (19097) will update the calls not adjusted here.
    This is safe since the parameter is silently ignored.
[2] GetMarcSubfieldStructureFromKohaField: Framework parameter is removed
    and calls are adjusted. Includes acquisitions_stats.pl.
[3] TransformKohaToMarc: The parameter is removed; all calls are verified
    or adjusted.
[4] TransformMarcToKoha: The parameter is no longer used and will be
    removed in a follow-up report (19097). It always goes to Default now.
[5] TransformMarcToKohaOneField: The parameter is removed and all calls
    are adjusted. Including: Breeding, XISBN and MetadataRecord modules.
[6] C4::Koha::IsKohaFieldLinked: This routine was called only once (in
    C4::Items::_build_default_values_for_mod_marc. It can be replaced by
    calling GetMarcFromKohaField. If there is no kohafield linked, undef
    is returned. (Corresponding unit test is removed here.)
[7] C4::Items::ModItemFromMarc: The helper routine
    _build_default_values_for_mod_marc does no longer have a framework
    parameter. The cache key default_value_for_mod_marc- is no longer
    combined with a frameworkcode. Three admin scripts are adjusted
    accordingly; some tests will be corrected in the next patch.

Test plan:
See next patch. That patch adjusts all tests involved.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-07 14:44:15 -03:00
54467a76d7 Bug 10306: Restructure TransformMarcToKoha and update some POD lines
This patch makes the following changes:

[1] Added POD for CountItemsIssued, GetBiblioItemData
[2] Moved TransformMarcToKohaOneField closer to TransformMarcToKoha (before
    sub CountItemsIssued)
[3] Restructured TransformMarcToKoha by extracting individual kohafields via
    TransformMarcToKohaOneField. The latter does no longer call the former.
    This small optimization avoids traversing the whole MARC record again
    and again.
[4] Moved adjusting copyrightdate/publicationyear to separate helper routine
    _adjust_pubyear
[5] Removed obsolete sub _get_inverted_marc_field_map.

Test plan:
Run t/db_dependent/Biblio/TransformMarcToKoha.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-07 14:44:15 -03:00
db32f394a6 Bug 10306: Allow controlfields in TransformKohaToMarc
Since the interface allows you to connect a kohafield to a MARC
controlfield, this routine should be able to handle that. Unfortunately
it did not.

Test plan:
Change will be tested in Biblio/TransformKohaToMarc.t in the next patch.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-07 14:44:15 -03:00
01fbe2be99 Bug 10306: Core module changes for multiple mappings
In order to allow multiple Koha to MARC mappings (for one kohafield), we
need to adjust a few key routines in C4/Biblio.pm. This results in a few
changes in dependent modules too.

Note: Multiple mappings also include 'alternating' mappings. Such as the
case of MARC21 260 and 264: only one of both fields will be used. Sub
TransformMarcToKoha will handle that just fine; the opposite transformation
is harder, since we do no longer know which field was the source. In that
case TransformKohaToMarc will fill both fields. We only use that operation
in Koha for items (in Acquisition and Cataloging).

Sub GetMarcSubfieldStructure
This sub used a selectall_hashref, which is fine as long as we have only
one mapping for each kohafield. But as DBI states it: If a row has the same
key as an earlier row then it replaces the earlier row. In other words,
we lose the first mapping if we have two.
This patch uses selectall_arrayref with Slice and rearranges the output so
that the returned hash returns an arrayref of hashrefs for each kohafield.
In order to improve consistency, we add an order clause to the SQL
statement used too.

Sub GetMarcFromKohaField
This sub just returned one tag and subfield, but in case of multiple
mappings we should return them all now.
Note: Many calls still expect just one result and will work just fine:
    my ($tag, $sub) = GetMarcFromKohaField(...)
A possible second mapping would be silently ignored. Often the sub is
called for biblionumber or itemnumber. I would not recommend the use of
multiple mappings for such fields btw.
In case the sub is called in scalar context, it will return only the first
tag (instead of the number of tags and subfields).

Sub GetMarcSubfieldStructureFromKohaField
This sub previously returned the hash for one kohafield.
In scalar context it will behave like before: it returns the first hashref
in the arrayref that comes from GetMarcSubfieldStructure.
In list context, it returns an array of all hashrefs (incl. multiple
mappings).
The sub is not used in C4::Ris. Removed the use statement.

Sub TransformKohaToMarc
This sub got a second parameter: frameworkcode.
Historically, Koha more or less assumes kohafields to be defined across all
frameworks (see Koha to MARC mappings). Therefore it falls back to Default
when it is not passed.
When going thru all mappings in building a MARC record, it also supports
multiple mappings. Note that Koha uses this routine in Acquisition and in
Cataloging for items. Normally the MARC record is leading however and the
Koha fields are derivatives for optimization and reporting.

The added third parameter allows for passing a new option no_split => 1.
We use this option in C4::Items::Item2Marc; if two item fields are mapped to
one kohafield but would have different values (which would be very unusual),
these values are glued together. When transforming to MARC again, we do not
want to duplicate the item subfields, but we keep the glued value in both
subfields. This operation only affects items, since we are not doing this
reverse operation for biblio and biblioitem fields.

Sub _get_inverted_marc_field_map
This sub is a helper routine of TransformMarcToKoha, the opposite
transformation. When saving a MARC record, all kohafields are extracted
including multiple mappings.
Suppose that you had both 260c and 264c in your record (which you won't),
than both values get saved initially into copyrightdate like A | B. The
additional code for copyrightdate will extract the first year from this
string.
A small fix in TransformMarcToKoha makes that it only saves a value in a
kohafield if it is defined and not empty. (Same for concatenation.)

Sub TransformMarcToKohaOneField
This sub now just calls TransformMarcToKoha and extracts the requested
field. Note that since we are caching the structure, this does not result
in additional database access and is therefore performance-wise
insignificant. We simplify code and maintenance.
Instead of modifying the passed hashref, it simply returns a value. A call
in C4::Breeding is adjusted accordingly. The routine getKohaField in
Koha::MetadataRecord is redirected to TransformMarcToKohaOneField.
NOTE: The fourth patch restructures/optimizes TransformMarcToKoha[OneField].

Sub get_koha_field_from_marc
This sub can be removed. A call is replaced by TransformMarcToKohaOneField
in C4::XISBN.

Note: The commented lines for sub ModZebrafiles are removed (directly under
TransformMarcToKohaOneField).

Test plan:
For unit tests and interface tests, please see follow-ups.
Run qa tools in order to verify that the modules still compile well.
Read the code changes and verify that they make sense.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-07 14:44:15 -03:00
db68a2f432 Bug 18993: Allow Test::More version 1.302073
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-07 10:09:51 -03:00
8e61e6ee2c Bug 18993: Bump Test::More to 1.302075
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-07 10:09:51 -03:00
e46ab82e28 Bug 18990: Overdue Notices are not sending through SMS correctly
Bug 18478 fixed sms via email problems under the assumption that
to_address was either smsalertnumber or blank.

It seems overdues set the to_address to email. This patch changes the
code to enforce that an sms sent with emial driver will use the
smsalertnumebr and provider defined for the borrower, regardless of what
is set in the queue

To test:
 1 - Define a messaging prefs for a patron to recieve hold notices via
  SMS
 2 - Ensure you have defined an SMS message for an overdue letter
 3 - Set an SMS alert number for patron
 4 - Set the SMS::Send driver to 'Email'
 5 - Checkout an item as overdue to trigger notice above
 6 - Run overdue_notices.pl
 6 - Check the db and note the address is email
 7 - run process_message_queue.pl
 8 - Check db - address is email followed by service provider
 9 - Apply patch
 10 - repeat
 11 - Message to_address should be populated with smsalertnumber

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-07 09:37:11 -03:00
d5a6179852 Bug 19766: (bug 19058 follow-up) Fix Preview routing slip
This patch fixes the following errors:
The method reserve_id is not covered by tests at /home/vagrant/kohaclone/C4/Reserves.pm line 859.
The method set is not covered by tests at /home/vagrant/kohaclone/C4/Reserves.pm line 871.
Can't call method "store" on an undefined value at /home/vagrant/kohaclone/C4/Reserves.pm line 871.

This is caused by
  commit ba1f2f93ef
    Bug 19058: Move C4::Reserves::GetReserveId to the Koha namespace

We are calling ->reserve_id on a Koha::Holds set.

Test plan:
- Serials -> Find subscription -> "Edit routing list" in the sidebar
- Add 1+ recipients
- Save -> "Save and preview routing slip"

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-12-07 09:37:01 -03:00
b780a14ad9 Bug 18357: Handle unlimited on-site checkouts
If on-site checkouts are set to unlimited (i.e. NULL/undef), they are
currently blocked.

Test plan:
1/ Set All/All rule with Unlimited/unlimited for normal/onsite checkouts
2/ Will be able to perform onsite checkout
3/ Edit rule to be 15/Unlimited normal/onsite
4/ Will be able to perform onsite checkout
=> Without this patch it was blocked
5/ Set rule to 15/15
6/ Onsite checkouts work again

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-26 13:00:17 -03:00
7c78e4c97e Bug 18131: Followup - Use data if biblionumber_tag < 10
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-26 12:59:51 -03:00
4ebb0bbb18 Bug 18131: ES - Fix matching staged records - Authority
Occurrences of C4::AuthoritiesMarc::SearchAuthorities must be replaced
by search_auth_compat.

You need to define the search index of matching rule with one of the
values defined in %koha_to_index_name (from
Koha::SearchEngine::Elasticsearch::QueryBuilder::build_authorities_query_compat)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-26 12:59:51 -03:00
eed1c91c8f Bug 18131: ES - Fix matching staged records
The code in C4::Matches::get_matches is terrible and a bug has been introduced
by bug 12478 because of its way to handle uniqueness.

If search engine is elastic, simple_search_compat returns array ref of MARC::Record,
used as a string for the key of the matches hashref we get things like
"MARC::Record=HASH(0x8f76ab0)".
Yes, terrible...

The file is never staged and we get an internal server error:
    stage-marc-import.pl: Can't locate object method "fields" via package "MARC::Record=HASH(0x8f76ab0)" (perhaps you forgot to load "MARC::Record=HASH(0x8f76ab0)"?) at /home/vagrant/kohaclone/C4/Biblio.pm line 2691

To recreate the issue:
- Set SearchEngine == Elastic
- Create a matching rule on 999$c (you need to edit the existing one and specify
'Local-number' as search index, not 'local-number')
- Import a file with bibliographic records and use the matching rule you defined.

Test plan:
Import authority and bibliographic records with Zebra and Elastic using a matching rule.
Everything should work correctly.

Note: I found a bug when importing authorities using Elastic, see bug 17255 comment 38.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-26 12:59:51 -03:00
Stefan Berndtsson
2fe0a816fe Bug 19651: SIP/ILS/Item misses title and author
Signed-off-by: Benjamin Rokseth <bensinober@gmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-26 12:59:31 -03:00
Mirko Tietgen
eba47394d1 Bug 18547: On shelf holds allowed > "If all unavailable" ignores default hold policy
If in the circ rules matrix you set "On shelf holds allowed" to "If all unavailable",
default hold policy "From home library" is ignored.

Test plan:

- Have a test user from one branch (eg Centerville)

- Set "On shelf holds allowed" to "If all unavailable" for your patron and item
  category (or everyone and everything)
- For "Default checkout, hold and return policy", set hold policy to "From home library"
  -> make sure there is no "Default holds policy by item type" to override the setting

- Have two items for a record.
  1. An item with home branch same as test user (eg Centerville)
  -> check this item out to somebody else
  2. an item with a different home branch (eg Fairfield)
  -> available, not checked out
- Try to place a hold for your test user. Does not work.

- Apply the patch
- Try to place a hold. Should work now.

Followed test plan, worked as intended
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Followed test plan in the intranet and OPAC, worked as intended.
With few assumptions made:
- when the hold works, should be on the item 1 (Centerville)
  item 2 is only there to trigger the bug
- the circ rules were identically setup on each branch and in "Standard rules for all libraries"
Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-26 11:30:17 -03:00
ecb65def5a Bug 18894: (QA follow-up) POD changes
Add limit parameter to POD section.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-08 13:35:28 -03:00
58bc11a7d4 Bug 18894: Add ability to limit the number of messages sent by process_message_queue.pl at a time
Having the ability to limit the number of messages sent by process_message_queue.pl on a single run would be very useful for controlling home many messages are sent at a given time. This can help prevent too many messages being sent out at once and getting flagged as a spammer.

Test Plan:
1) Apply this patch
2) Generate some number of messages in the message queue
3) Run process_message_queue.pl with the new --limit option,
   set limit to a number smaller than the number of pending messages
4) After the script has run, check the database and note that only
   a number of pending messages were sent, and that the remaining amount
   of pending messages is the original amount less the number specified
   as the limit

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-08 13:35:17 -03:00
8db65715fa Bug 18882: (QA follow-up) Ensure stats with no or undef location are set to NULL in db
Confirm that only NULL or a string are in the location field of the
statistics table. Test with two items, one with shelving location set,
and one without it set.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-08 13:34:37 -03:00
9fd0555ae8 Bug 18882: Add location code to statistics table for checkouts and renewals
Some libraries wish to track what the current location of items was at the time they were checked out. This will help libraries track which physical locations in the library patrons are more likely to check out a given book from.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Check out an item that has a location set
4) Renew that item
5) View the checkout and renewal in the statistics table,
   verify each has the location column populated correctly

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-08 13:34:32 -03:00
97c0b5a5dc Bug 10748: (QA follow-up) Add comment in SIP's do_checkin
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-08 11:07:48 -03:00
529793d4ae Bug 10748: Add the ability to block return of lost items
Mimicking what does BlockReturnOfWithdrawnItems we can easily add a new
syspref to block return of lost items.
This patch adds BlockReturnOfLostItems, if set to 'Block' a item marked
as lost cannot be checked in.

Test plan:
1/ Set BlockReturnOfLostItems to 'Do not block'
2/ Check an item out to a patron
3/ Edit the item and mark it as lost (*)
4/ Check the item in
=> The item is checked in
5/ Edit the item and remove the lost status
6/ Check the item out again
7/ Edit the item and mark it as lost (*)
8/ Check the item in
=> The item is not checked in

(*) There are 2 ways to mark an item lost:
- From the item list view (/catalogue/moredetail.pl?biblionumber=42)
If you set the lost status from this form, the issue will be returned
Maybe this should be optional (?)

- From the edit items form (/cataloguing/additem.pl?biblionumber=42)
It is the form you must use to not mark the issue returned.

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Dominic Pichette <dominic@inlibro.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-11-08 11:07:09 -03:00