]> git.koha-community.org Git - koha.git/log
koha.git
4 years agoBug 24874: Printing is broken on opac-results.pl page
Mason James [Thu, 19 Mar 2020 07:41:00 +0000 (20:41 +1300)]
Bug 24874: Printing is broken on opac-results.pl page

to test:

- search for something in opac
- print page using file -> print
- observe printing is broken (pic1)

- apply patch

- search for something in opac
- print page using file -> print
- observe printing is fixed (pic2)

it seems this issue was introduced by bug 5287

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24876: Fix capitalization on patron search for holds
Katrin Fischer [Sun, 22 Mar 2020 11:10:43 +0000 (12:10 +0100)]
Bug 24876: Fix capitalization on patron search for holds

When placing a hold in the staff interface, the heading on the
search box reads: Search Patrons or clubs
The patch changes it to be Search patrons...  instead.
Also changes club id to club ID.

To test:
- Place a hold in the staff interface
- Verify the capitalization error
- Switch tabs to Clubs, see: club id
- Apply patch
- Verify it's all good now

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24854: DBRev 19.12.00.050
Martin Renvoize [Tue, 24 Mar 2020 08:09:14 +0000 (08:09 +0000)]
Bug 24854: DBRev 19.12.00.050

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24854: Remove IDreamBooks integration
Katrin Fischer [Fri, 13 Mar 2020 17:16:28 +0000 (17:16 +0000)]
Bug 24854: Remove IDreamBooks integration

The IDreamBooks service has not seen updates in a long time, so
we should remove the service from Koha as it's no longer operational.

To test:
- Apply patch and run the database update
- Verify that the IDreamBooks related system preferences are gone
- Verify that opac detail pages and result lists still work
  as expected
- Run t/db_dependent/UsageStats.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24918: Fix attribute mappings in Koha::Acquisition::Basket
Tomas Cohen Arazi [Fri, 20 Mar 2020 19:05:46 +0000 (16:05 -0300)]
Bug 24918: Fix attribute mappings in Koha::Acquisition::Basket

When bug 18731 was written, the official vote on the RFC hadn't been
held yet. Once it got voted, the mappings were adapted and all the
dependent work fixed as well. But three attribute names were overlooked
and they become evident on developing 20212 which required them.

This patch fixes this really tiny mistake.

To test:
1. Just verify the voted attribute names.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24464: (QA follow-up) Make the method reflect the lack of FK
Tomas Cohen Arazi [Fri, 20 Mar 2020 18:53:35 +0000 (15:53 -0300)]
Bug 24464: (QA follow-up) Make the method reflect the lack of FK

This patch makes it super obvious to understand by reading the code that
there's originally no foreign key.

To test:
1. Run the tests and notice they pass
2. Spot the # FIXME
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24464: Add K::A::Basket->creator
Tomas Cohen Arazi [Mon, 20 Jan 2020 19:00:05 +0000 (16:00 -0300)]
Bug 24464: Add K::A::Basket->creator

This patch adds a ->creator method to Koha::Acquisition::Basket to
retrieve the related Koha::Patron object.

Note: this should be re-done once 22658 is pushed, but at the time
being, there's not patch submitted, and it is not a trivial task because
of the column type missmatch. That said, the implementation of ->creator
in this class is simple enough to just rewrite it once 22658 is
submitted, and the tests will reflect the expected/unchanged behavior.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24464: Unit tests
Tomas Cohen Arazi [Mon, 20 Jan 2020 18:59:59 +0000 (15:59 -0300)]
Bug 24464: Unit tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24463: Add a basket_group relationship for baskets
Tomas Cohen Arazi [Mon, 20 Jan 2020 14:56:36 +0000 (11:56 -0300)]
Bug 24463: Add a basket_group relationship for baskets

This patch aims to bring consistency between the accessor name and the
underlying relationship to ease things when using it from the API.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Acquisition/Basket.t
=> SUCCESS: Tests pass! No behavior change!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21708: Sort MARC fields in TransformHtmlToMarc
Marcel de Rooy [Tue, 10 Mar 2020 15:11:07 +0000 (15:11 +0000)]
Bug 21708: Sort MARC fields in TransformHtmlToMarc

Instead of pushing 999 in the front :)

Test plan:
Do not yet apply this patch.
Edit a record. Save. And open MARC view/view plain on opac-detail.
Verify that the biblionumber field (MARC21 999) follows leader.
Apply this patch. Restart Plack.
Edit a record. Save. And open MARC view/view plain on opac-detail.
Verify that the biblionumber field is in right position.
Run t/db_dependent/Biblio/TransformHtmlToMarc.t. Should pass now.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21708: Add a few tests in TransformHtmlToMarc.t
Marcel de Rooy [Wed, 11 Mar 2020 13:22:31 +0000 (13:22 +0000)]
Bug 21708: Add a few tests in TransformHtmlToMarc.t

Test plan:
Run t/db_dependent/Biblio/TransformHtmlToMarc.t without the module change
patch. Verify that the test fails on the order of fields.
Go to test plan of the second patch.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24324: Resolve error with delete_records_via_leader.pl
Liz Rea [Fri, 3 Jan 2020 21:18:27 +0000 (21:18 +0000)]
Bug 24324: Resolve error with delete_records_via_leader.pl

To test:

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

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24902: Join different mc- limits with AND (elasticsearch)
Julian Maurice [Thu, 19 Mar 2020 08:38:52 +0000 (09:38 +0100)]
Bug 24902: Join different mc- limits with AND (elasticsearch)

In the advanced search form, you can enable several limits using syspref
AdvancedSearchTypes (namely itemtypes, shelving locations, collections)
When used, the resulting query parts end up being joined with OR, even
if the field is different. That means that if you pick "Book" under
itemtypes tab, and "Fiction" under collection tab, it will search
"itype:BOOK OR ccode:FIC". It should be AND.

For instance, if you select:
    Itemtypes:
        ✓ Book
        ✓ DVD
    Location:
        ✓ Child
        ✓ Adult

it should search:
    itype:(Book OR DVD) AND location:(Child OR Adult)

Test plan:
0. Do not apply the patch yet
1. Enable elasticsearch
2. Set syspref AdvancedSearchTypes = 'itemtypes|loc|ccode'
3. Create a new itemtype and a new authorised value for categories LOC
   and CCODE
4. Create a biblio with the new itemtype, another biblio with the new
   location, another biblio with the new collection, and again another
   biblio with the new itemtype, location and collection
5. Verify that you can find these new biblio records using only the
   "advanced search types" in the advanced search form
6. In the advanced search form, pick all 3 limits (itemtype, location,
   collection) and verify that it returns the 4 records.
7. Apply the patch
8. Repeat step 6, it should now return only the biblio that satisfies
   all criteria
9. Verify that if you select more than one
   {itemtype|location|collection} it still returns results that
   satisfies any selected criteria
10. prove t/Koha/SearchEngine/ElasticSearch/QueryBuilder.t

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Add missing use statement
Jonathan Druart [Mon, 23 Mar 2020 15:47:11 +0000 (16:47 +0100)]
Bug 20443: Add missing use statement

This is a follow-up for commit 836e950d25148ca04ed0561c487772e3b0f7f8ee
    Bug 20443: Remove SearchIdMatchingAttribute

We removed the use of C4::Members::Attributes, that was using Text::CSV

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Fix merge_with behavior
Jonathan Druart [Fri, 20 Mar 2020 09:58:54 +0000 (10:58 +0100)]
Bug 20443: Fix merge_with behavior

merge_with were returning Koha::Patron::Attribute for existing attribute
and hashref for new attribute.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Handle non existent attribute when importing patrons
Jonathan Druart [Fri, 20 Mar 2020 08:38:03 +0000 (09:38 +0100)]
Bug 20443: Handle non existent attribute when importing patrons

There is much more to do here, but this patch has the same behavior than
before: a warn is displayed in the log, the UI is not aware of it

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Fix patron modification approval
Jonathan Druart [Mon, 9 Mar 2020 10:43:14 +0000 (11:43 +0100)]
Bug 20443: Fix patron modification approval

There was a mismatch between "value" and "attribute". Before this
patchset, "value" was sometimes used, but then it comes "attribute" to
match the DB column's name.
We must keep both here, when an upgrade is done we could have "value"
that is still in the borrower_modifications.extended_attributes JSON

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Do not explode if attribute does not have a valid av
Jonathan Druart [Mon, 9 Mar 2020 10:02:54 +0000 (11:02 +0100)]
Bug 20443: Do not explode if attribute does not have a valid av

Template process failed: undef error -
Can't call method "lib" on an undefined value at /kohadevbox/koha/Koha/Patron/Attribute.pm line 109.
                                                    at /kohadevbox/koha/C4/Templates.pm line 122

We should not crash as it if the attribute is linked to an invalid
authorised value (for instance the AV has been deleted)

We must provide a check in the search_for_data_inconsistencies.pl script

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Fix creation of new patron with attributes
Jonathan Druart [Wed, 4 Mar 2020 14:44:42 +0000 (15:44 +0100)]
Bug 20443: Fix creation of new patron with attributes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Fix POD
Jonathan Druart [Tue, 21 Jan 2020 12:03:56 +0000 (13:03 +0100)]
Bug 20443: Fix POD

Fixes the following failures:

 FAIL Koha/Patron/Attribute.pm
   FAIL   pod
*** ERROR:
empty =head3

 in file Koha/Patron/Attribute.pm

*** ERROR:
empty =head3

 in file Koha/Patron/Attribute.pm

 FAIL Koha/Patron/Attributes.pm
   FAIL   pod
*** ERROR:
empty =head3

 in file Koha/Patron/Attributes.pm

   FAIL   pod coverage
POD is missing for merge_with
POD is missing for object_class

 FAIL Koha/Patrons.pm
   FAIL   spelling
 paramter  ==> parameter

except the missing pod for object_class, not needed.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Fix add/edit for checkboxes
Jonathan Druart [Tue, 3 Dec 2019 18:30:44 +0000 (19:30 +0100)]
Bug 20443: Fix add/edit for checkboxes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Fix Patrons/Import.t
Jonathan Druart [Wed, 27 Nov 2019 14:49:36 +0000 (15:49 +0100)]
Bug 20443: Fix Patrons/Import.t

->get_patrons has been removed but not replaced!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Use search_with_library_limits for attribute types
Jonathan Druart [Wed, 27 Nov 2019 14:35:07 +0000 (15:35 +0100)]
Bug 20443: Use search_with_library_limits for attribute types

Dealt with that previously in the module during the rebase.
It conflicted with bug 23281.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Fix Auth_with_ldap.t
Jonathan Druart [Mon, 29 Apr 2019 15:49:04 +0000 (11:49 -0400)]
Bug 20443: Fix Auth_with_ldap.t

Must be a hashref

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: (follow-up) Fix t/db_dependent/Koha/Patrons.t
Josef Moravec [Thu, 7 Mar 2019 07:23:33 +0000 (07:23 +0000)]
Bug 20443: (follow-up) Fix t/db_dependent/Koha/Patrons.t

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: (follow-up) Move GetBorrowerAttributes to Koha::Patron - ILSDI
Jonathan Druart [Thu, 9 Aug 2018 22:46:35 +0000 (19:46 -0300)]
Bug 20443: (follow-up) Move GetBorrowerAttributes to Koha::Patron - ILSDI

Either we display everything, or only the info from the attribute itself
(i.e. not its type)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove extended_attributes_code_value_arrayref AND C4::Members::Attributes
Jonathan Druart [Tue, 17 Jul 2018 14:03:49 +0000 (11:03 -0300)]
Bug 20443: Remove extended_attributes_code_value_arrayref AND C4::Members::Attributes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove extended_attributes_merge
Jonathan Druart [Tue, 17 Jul 2018 12:50:10 +0000 (09:50 -0300)]
Bug 20443: Remove extended_attributes_merge

TODO We need tests here!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove SearchIdMatchingAttribute
Jonathan Druart [Mon, 16 Jul 2018 17:23:27 +0000 (14:23 -0300)]
Bug 20443: Remove SearchIdMatchingAttribute

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove SearchIdMatchingAttribute - prove we are not cheating
Jonathan Druart [Mon, 16 Jul 2018 23:34:42 +0000 (20:34 -0300)]
Bug 20443: Remove SearchIdMatchingAttribute - prove we are not cheating

Tests are still passing that way, we can continue

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove C4::Members::AttributeTypes
Jonathan Druart [Mon, 16 Jul 2018 23:17:22 +0000 (20:17 -0300)]
Bug 20443: Remove C4::Members::AttributeTypes

We do no longer need this package, we can use
Koha::Patron::Attribute::Types directly instead.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove num_patron
Jonathan Druart [Mon, 16 Jul 2018 22:37:30 +0000 (19:37 -0300)]
Bug 20443: Remove num_patron

Replace C4::Members::AttributeTypes->num_patron with
Koha::Patrons->filter_by_attribute_type

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Move C4::Members::AttributeTypes::GetAttributeTypes to Koha::Patron::Attri...
Jonathan Druart [Mon, 16 Jul 2018 22:04:03 +0000 (19:04 -0300)]
Bug 20443: Move C4::Members::AttributeTypes::GetAttributeTypes to Koha::Patron::Attribute::Types

We can then now start to move methods from C4::Members::AttributeTypes
as well.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove CheckUniqueness
Jonathan Druart [Fri, 13 Jul 2018 19:40:14 +0000 (16:40 -0300)]
Bug 20443: Remove CheckUniqueness

There is already a method in Koha::Patron::Attribute to check the
uniqueness constraint, let us it to replace CheckUniqueness

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove UpdateBorrowerAttribute and SetBorrowerAttributes
Jonathan Druart [Fri, 13 Jul 2018 17:11:44 +0000 (14:11 -0300)]
Bug 20443: Remove UpdateBorrowerAttribute and SetBorrowerAttributes

This patch replace Koha::Patron->get_extended_attributes with
->extended_attributes
It's now a getter a setter method.

It permits to replace UpdateBorrowerAttribute and use
create_related from DBIx::Class

Notes:
* We face the same variable names difference than in a previous patch
(value vs attribute)

Bug 20443: Remove SetBorrowerAttributes

squash  + RM get_extended_attributes

 RM get_extended_attributes

SQUASH Bug 20443: Remove UpdateBorrowerAttribute and SetBorrowerAttribute

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove DeleteBorrowerAttribute
Jonathan Druart [Fri, 13 Jul 2018 16:07:05 +0000 (13:07 -0300)]
Bug 20443: Remove DeleteBorrowerAttribute

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove DeleteBorrowerAttributes
Jonathan Druart [Fri, 13 Jul 2018 15:42:08 +0000 (12:42 -0300)]
Bug 20443: Remove DeleteBorrowerAttributes

This subroutine was only used once, easy to replace.
SetBorrowerAttributes must replace the attributes for the ones logged-in
user is allowed to edit, that's why we filter by the library limits

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Improve filtering method
Jonathan Druart [Fri, 13 Jul 2018 15:10:47 +0000 (12:10 -0300)]
Bug 20443: Improve filtering method

Koha::Patron::Attributes->search mimicks what is done in
Koha::AuthorisedValues->search.
But actually it should be more explicit when the caller use it.
For instance filter_by_branch_limitation (see discussion on bug 11983).

This will be useful for the following patches as we will need a way to
replace the $no_branch_limit flag.
When the $no_branch_limit flag is called, a simple ->search call should
be done.
When we want to limit on a specific library we can pass the branchcode
in paramter of filter_by_branch_limitation (this is not used yet).
If not passed the logged-in user library will be used by default.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Move GetBorrowerAttributes to Koha::Patron->extended_attributes
Jonathan Druart [Thu, 12 Jul 2018 21:26:58 +0000 (18:26 -0300)]
Bug 20443: Move GetBorrowerAttributes to Koha::Patron->extended_attributes

The GetBorrowerAttributes subroutine return the attributes for a given
patron.

Using get_extended_attributes we can acchieve it easily. The problematic
here is to restore the method's name (value vs attribute,
value_description vs description of the authorised value, as well as
display_checkout that should not be a method of Attribute, but
Attribute::Type instead)

value_description was used when the attribute types were attached to an
authorised value category. To avoid the necessary test in template and
controller there is now a $attribute->description method that will
display either the attribute's value OR the value of the authorised
value when needed. We should certainly use this one from few other
places.

Notes:
* This patch rename Koha::Patron->attributes with Koha::Patron->get_extended_attributes.
It will be renamed with Koha::Patron->extended_attributes in ones of the next
patches when it will become a setter as well.
* GetBorrowerAttributes did not care about the library limits, we still
do not
* The opac_only flag was not used outside of test, we drop it off.
* To maintain the existing behavior we add a default order-by clause to
the search method [code, attribute]
* From C4::Letters::_parseletter we always display the staff description
of the AV, There is now a FIXME to warn about it
* FIXMEs are not regressions, existing behaviors must be kept
* TODO add a new check to bug 21010 to search for inconsistencies in
patron's attributes attached to non-existent authorised values
* One test has been updated in Modifications.t, order_by is now
by default set to ['code', 'attribute']

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Move GetBorrowerAttributes to Koha::Patron - ILSDI
Jonathan Druart [Fri, 13 Jul 2018 12:01:03 +0000 (09:01 -0300)]
Bug 20443: Move GetBorrowerAttributes to Koha::Patron - ILSDI

FIXME See comment

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Move GetBorrowerAttributeValue to Koha::Patron->get_extended_attribute_value
Jonathan Druart [Thu, 12 Jul 2018 20:20:57 +0000 (17:20 -0300)]
Bug 20443: Move GetBorrowerAttributeValue to Koha::Patron->get_extended_attribute_value

We want to retrieve a specific patron's attribute for a given patron.
We then add a new method to Koha::Patron.

This patch add a getter method ->get_extended_attribute_value
to use the DBIx::Class relation

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Remove opac_display and opac_editable from Patron::Attribute
Jonathan Druart [Tue, 17 Jul 2018 14:13:09 +0000 (11:13 -0300)]
Bug 20443: Remove opac_display and opac_editable from Patron::Attribute

Same as previously for methods that have been added by bug 17792.
It's better to be explicite and tell we are fetch the related attribute's type

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20443: Revert some stuffs from 12159
Jonathan Druart [Fri, 13 Jul 2018 13:41:15 +0000 (10:41 -0300)]
Bug 20443: Revert some stuffs from 12159

These methods have been added to Koha::Patron::Attribute but are wrong, see bug 18339

We should use ->type->$method instead

Moreover the tests exist in another subtest, we do not need them.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Fix selenium tests (highlight a bug in date management)
Jonathan Druart [Mon, 23 Mar 2020 12:09:07 +0000 (13:09 +0100)]
Bug 23463: Fix selenium tests (highlight a bug in date management)

There is something wrong, and a regression has been caught by those
tests:
If an invalid date is passed from the add item form, the app now
crashes.
Before:
 * if the date was completely invalid, the field was blanked
silently
 * DateTime::Format::MySQL was used to convert dates, and it's not
 strict at all. For instance, what happened in the selenium tests for
 dateaccessionned: %Y-%m-%d was prefilled by the framework plugin, then
 the biblionumber was added, we ended with something like (eg for today)
 2020-03-234242 (with biblionumber=4242). DateTime::Format::MySQL
 converts that to 2020-03-23

We must deal with invalid dates, but I do not think it is good to add it
back to Koha::Item->store, we will prefer to raise the error to the end
user, saying that something went wrong (and more specifically the
dates).

The (ugly) trick was in C4::Items::_mod_item_dates

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Fix wrong variable name
Jonathan Druart [Mon, 23 Mar 2020 10:36:55 +0000 (11:36 +0100)]
Bug 23463: Fix wrong variable name

Fix for t/db_dependent/Labels/t_Batch.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Fix CourseReserves/CourseItems.t
Jonathan Druart [Mon, 23 Mar 2020 10:34:43 +0000 (11:34 +0100)]
Bug 23463: Fix CourseReserves/CourseItems.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Replace a new occurrence of ModItem
Jonathan Druart [Mon, 23 Mar 2020 10:23:46 +0000 (11:23 +0100)]
Bug 23463: Replace a new occurrence of ModItem

This new script have been pushed just before 23463.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: (RM follow-up) Add try block around Illrequest item creation
Martin Renvoize [Mon, 23 Mar 2020 10:31:39 +0000 (10:31 +0000)]
Bug 23463: (RM follow-up) Add try block around Illrequest item creation

The recently introduced Ill item creation for circulation feature was
not properly handling the move from AddItem to Koha::Item->new()->store.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Fix items.cn_sort vs cn_sort
Jonathan Druart [Fri, 20 Mar 2020 14:15:17 +0000 (15:15 +0100)]
Bug 23463: Fix items.cn_sort vs cn_sort

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: (follow-up 2) Fix timestamp default value
Jonathan Druart [Mon, 16 Mar 2020 13:56:08 +0000 (14:56 +0100)]
Bug 23463: (follow-up 2) Fix timestamp default value

Removing previous change, again.
But this time in Object.pm
It fixes t/db_dependent/Koha/Object.t and t/db_dependent/Koha/Item.t is
still passing.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Use new method Koha::Object->set_or_blank
Jonathan Druart [Mon, 16 Mar 2020 13:51:06 +0000 (14:51 +0100)]
Bug 23463: Use new method Koha::Object->set_or_blank

This patch fixes an issue when editing items.

* The issue
Cannot blank a subfield when editing an item.
If you have an item with itemcallnumber=42, then edit it, blank it and
save. The itemcallnumber is still 42

* Why? (line numbers from https://gitlab.com/joubu/Koha/-/tree/bug_23463)
additem (and other item's edition forms) receives a list of tags,
subfields and values, generates a MARC::Record::XML then calls
ModItemFromMarc:

717     my $itemtosave=MARC::Record::new_from_xml($xml, 'UTF-8');
727         my $newitem = ModItemFromMarc($itemtosave, $biblionumber,
$itemnumber);

And ModItemFromMarc:
 282     my $item = TransformMarcToKoha( $localitemmarc,
$frameworkcode, 'items' );
 283     $item->{cn_source} = delete $item->{'items.cn_source'}; #
Because of C4::Biblio::_disambiguate
 284     $item_object->set($item);

ModItemFromMarc never knows that the field has been blank.
Prior to bug 23463 we had a map of default values, and ModItemFromMarc
was doing:
 426     my $item = TransformMarcToKoha( $localitemmarc,
$frameworkcode, 'items' );
 427     my $default_values = _build_default_values_for_mod_marc();
 428     foreach my $item_field ( keys %$default_values ) {
 429         $item->{$item_field} = $default_values->{$item_field}
 430           unless exists $item->{$item_field};
 431     }

I do not want to reinsert that list of default values.

Here I wrote a generic method in Koha::Object to set the value passed in parameter,
or "blank" if not passed.
It's nulled if can be set to null in DB, or the default value is retrieved from
the schema info.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Replace new occurrence of AddItem
Jonathan Druart [Mon, 16 Mar 2020 12:49:01 +0000 (13:49 +0100)]
Bug 23463: Replace new occurrence of AddItem

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Fix XSLT.t
Jonathan Druart [Fri, 6 Mar 2020 09:40:29 +0000 (10:40 +0100)]
Bug 23463: Fix XSLT.t

From commit bf49eecdd87e2b29760226281ab1afc0a185c7f0
     Bug 23463: Replace AddItem calls with Koha::Item->store

in build_sample_item:
-    my $itype = delete $args->{itype}
-      || $self->build_object( { class => 'Koha::ItemTypes' } )->itemtype;
+    # If itype is not passed it will be picked from the biblio (see Koha::Item->store)

So before we generated a new itemtype if not passed, now we pick the one from biblioitem->itemtype.

For this specific test we need to make sure they are different.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Fix cn_source for new item
Jonathan Druart [Thu, 6 Feb 2020 14:06:07 +0000 (15:06 +0100)]
Bug 23463: Fix cn_source for new item

get_dirty_columns only work for existing items.

This fixes t/db_dependent/ShelfBrowser.t

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>
4 years agoBug 23463: Fix IsItemIssued.t
Jonathan Druart [Thu, 6 Feb 2020 13:34:36 +0000 (14:34 +0100)]
Bug 23463: Fix IsItemIssued.t

It seems that some of those tests could be removed as safe_delete is
widely tested in Koha/Item.t

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>
4 years agoBug 23463: Fix tests
Tomas Cohen Arazi [Thu, 6 Feb 2020 13:24:04 +0000 (10:24 -0300)]
Bug 23463: Fix tests

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>
4 years agoBug 23463: Fix safe_return return value in deletion tools
Jonathan Druart [Thu, 30 Jan 2020 15:15:14 +0000 (16:15 +0100)]
Bug 23463: Fix safe_return return value in deletion tools

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>
4 years agoBug 23463: (follow-up) Fix timestamp default value
Jonathan Druart [Tue, 28 Jan 2020 11:54:37 +0000 (12:54 +0100)]
Bug 23463: (follow-up) Fix timestamp default value

For discussion, this patch revert the changes made previously.

This line exists in Koha::Item->store as it is the translation of:
    if (exists $item->{'timestamp'}) {
        delete $item->{'timestamp'};
    }
that was coming from _do_column_fixes_for_mod (called from ModItem)

To preserve existing behavior I would be in favor of keeping it like that to
avoid regression, and deal with it separately if we want to improve/remove it.

So basically here we are setting it to undef in Koha::Item->store to make it
handle correctly by the parent Koha::Object->store. I agree that's kind of weird
and must be improved.

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>
4 years agoBug 23463: Move DelItem.t and Items_DelItemCheck.t tests to a Koha/Item.t subtest
Jonathan Druart [Mon, 27 Jan 2020 16:20:26 +0000 (17:20 +0100)]
Bug 23463: Move DelItem.t and Items_DelItemCheck.t tests to a Koha/Item.t subtest

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>
4 years agoBug 23463: Fix timestamp default value
Jonathan Druart [Mon, 27 Jan 2020 15:54:20 +0000 (16:54 +0100)]
Bug 23463: Fix timestamp default value

This sounds wrong as we should let the DBMS do that, but it was failing.
Here we are doing the same as Koha::Patron->store for dateenrolled

To recreate the failure, prove t/db_dependent/Koha/Item.t without this
patch:
DBD::mysql::st execute failed: Column 'timestamp' cannot be null [for
Statement "UPDATE `items` SET `more_subfields_xml` = ?, `timestamp` = ?
WHERE ( `itemnumber` = ? )" with ParamValues: 0='<?xml version="1.0"
encoding="UTF-8"?>

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>
4 years agoBug 23463: (follow-up) Remove DelItemCheck and ItemSafeToDelete
Jonathan Druart [Tue, 10 Dec 2019 11:58:09 +0000 (12:58 +0100)]
Bug 23463: (follow-up) Remove DelItemCheck and ItemSafeToDelete

Wrong replacement in additem.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>
4 years agoBug 23463: cn_sort needs to be updated if cn_source changed
Jonathan Druart [Mon, 2 Dec 2019 13:32:09 +0000 (14:32 +0100)]
Bug 23463: cn_sort needs to be updated if cn_source changed

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>
4 years agoBug 23463: Replace recently added occurrences
Jonathan Druart [Mon, 2 Dec 2019 11:02:28 +0000 (12:02 +0100)]
Bug 23463: Replace recently added occurrences

Few occurrences have been added since this patchset has been originaly
written

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>
4 years agoBug 23463: build cn_sort only if needed
Jonathan Druart [Mon, 12 Aug 2019 23:27:30 +0000 (18:27 -0500)]
Bug 23463: build cn_sort only if needed

No need to calculate cn_sort if not dirty when we store

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Fix items.cn_source vs cn_source
Jonathan Druart [Mon, 12 Aug 2019 22:51:24 +0000 (17:51 -0500)]
Bug 23463: Fix items.cn_source vs cn_source

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>
4 years agoBug 23463: update permanent_location if location has been updated
Jonathan Druart [Thu, 8 Aug 2019 02:13:18 +0000 (21:13 -0500)]
Bug 23463: update permanent_location if location has been updated

This change to Koha::Item->store seems correct here, but tests from /db_dependent/Items.t is failing now.

Adjusting them to make them pass.

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>
4 years agoBug 23463: Fix AutomaticItemModificationByAge.t
Jonathan Druart [Thu, 8 Aug 2019 01:47:20 +0000 (20:47 -0500)]
Bug 23463: Fix AutomaticItemModificationByAge.t

We do not want to log if nothing changed

How could we do that better?

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>
4 years agoBug 23463: Getting less item-level_itypes warnings (?)
Jonathan Druart [Thu, 8 Aug 2019 01:28:06 +0000 (20:28 -0500)]
Bug 23463: Getting less item-level_itypes warnings (?)

So, we get less warnings. I do not really understand why...

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>
4 years agoBug 23463: Fix failing tests
Jonathan Druart [Wed, 7 Aug 2019 16:09:57 +0000 (11:09 -0500)]
Bug 23463: Fix failing tests

And adding a FIXME about discard_changes

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>
4 years agoBug 23463: Fix CancelReceipt.t
Jonathan Druart [Wed, 7 Aug 2019 16:00:49 +0000 (11:00 -0500)]
Bug 23463: Fix CancelReceipt.t

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>
4 years agoBug 23463: Remove no longer needed subs related to default values
Jonathan Druart [Wed, 7 Aug 2019 15:44:24 +0000 (10:44 -0500)]
Bug 23463: Remove no longer needed subs related to default values

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>
4 years agoBug 23463: Remove DelItemCheck and ItemSafeToDelete
Jonathan Druart [Tue, 6 Aug 2019 16:58:01 +0000 (11:58 -0500)]
Bug 23463: Remove DelItemCheck and ItemSafeToDelete

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Remove DelItem
Jonathan Druart [Tue, 6 Aug 2019 16:29:27 +0000 (11:29 -0500)]
Bug 23463: Remove DelItem

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>
4 years agoBug 23463: Remove ModItem
Jonathan Druart [Tue, 6 Aug 2019 16:14:25 +0000 (11:14 -0500)]
Bug 23463: Remove ModItem

There should not be any calls left

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>
4 years agoBug 23463: Remove _mod_item_dates
Jonathan Druart [Tue, 6 Aug 2019 16:14:07 +0000 (11:14 -0500)]
Bug 23463: Remove _mod_item_dates

We did not do anything useful here.

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>
4 years agoBug 23463: _do_column_fixes_for_mod dealt with integer location and timestamp moved
Jonathan Druart [Tue, 6 Aug 2019 16:12:31 +0000 (11:12 -0500)]
Bug 23463: _do_column_fixes_for_mod dealt with integer location and timestamp moved

That's done in Koha::Item->store, and Koha::Object->store for integers.

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>
4 years agoBug 23463: _set_derived_columns_for_mod was only used for cn_sort
Jonathan Druart [Tue, 6 Aug 2019 16:11:38 +0000 (11:11 -0500)]
Bug 23463: _set_derived_columns_for_mod was only used for cn_sort

Same as _set_defaults_for_add

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>
4 years agoBug 23463: Move plugin hook
Jonathan Druart [Tue, 6 Aug 2019 15:17:28 +0000 (10:17 -0500)]
Bug 23463: Move plugin hook

From C4::Items to Koha::Item

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>
4 years agoBug 23463: remove trivial UpdateHoldingbranch sub
Jonathan Druart [Mon, 18 Mar 2019 18:06:03 +0000 (15:06 -0300)]
Bug 23463: remove trivial UpdateHoldingbranch sub

We do not need this subroutine, moving it where it is used.

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>
4 years agoBug 23463: Replace ModItem with Koha::Item->store
Jonathan Druart [Mon, 18 Mar 2019 17:56:19 +0000 (14:56 -0300)]
Bug 23463: Replace ModItem with Koha::Item->store

Starting to replace the ModItem calls with Koha::Item->store

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: AddItem removing
Jonathan Druart [Mon, 18 Mar 2019 17:41:37 +0000 (14:41 -0300)]
Bug 23463: AddItem removing

We are done with AddItem, only need to log and index.

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>
4 years agoBug 23463: Replace _set_derived_columns_for_add
Jonathan Druart [Mon, 18 Mar 2019 17:20:51 +0000 (14:20 -0300)]
Bug 23463: Replace _set_derived_columns_for_add

Remove the unique call to _set_derived_columns_for_add
Even if design to deal with other values it only dealts with cn_sort

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>
4 years agoBug 23463: Remove _set_defaults_for_add
Jonathan Druart [Mon, 18 Mar 2019 17:15:37 +0000 (14:15 -0300)]
Bug 23463: Remove _set_defaults_for_add

_set_defaults_for_add is no longer needed as it is handled by dbic and koha::object->store

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: Replace AddItem calls with Koha::Item->store
Jonathan Druart [Mon, 18 Mar 2019 02:12:46 +0000 (23:12 -0300)]
Bug 23463: Replace AddItem calls with Koha::Item->store

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: fix for testbuilder - set default value items.damaged=0
Jonathan Druart [Mon, 18 Mar 2019 02:12:22 +0000 (23:12 -0300)]
Bug 23463: fix for testbuilder - set default value items.damaged=0

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>
4 years agoBug 23463: Remove uneeded SearchItemsByField subroutine
Jonathan Druart [Mon, 18 Mar 2019 00:10:00 +0000 (21:10 -0300)]
Bug 23463: Remove uneeded SearchItemsByField subroutine

It is no longer used.

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>
4 years agoBug 23463: Replace SearchItemsByField by SearchItems
Jonathan Druart [Mon, 18 Mar 2019 00:09:29 +0000 (21:09 -0300)]
Bug 23463: Replace SearchItemsByField by SearchItems

The subroutine SearchItemsByField is only called once and can be
replaced easily with SearchItems

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>
4 years agoBug 24297: Record 'Manual' trigger transfers
Martin Renvoize [Fri, 17 Jan 2020 11:25:28 +0000 (11:25 +0000)]
Bug 24297: Record 'Manual' trigger transfers

To test:
1 - Apply patches, restart_all
2 - Gi to Circulation->Transfer
3 - Transfer an item
4 - Check the branch transfers table
5 - The reason is set to 'Manual'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24436: DBRev 19.12.00.049
Martin Renvoize [Fri, 20 Mar 2020 16:02:15 +0000 (16:02 +0000)]
Bug 24436: DBRev 19.12.00.049

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24436: Add handling for reserve transfer triggers
Martin Renvoize [Fri, 17 Jan 2020 10:47:49 +0000 (10:47 +0000)]
Bug 24436: Add handling for reserve transfer triggers

To test:
1 - Place a hold for pickup at a different branch than you are signed in at on an item owned by current branch
2 - Check in the item
3 - Confirm the transfer
4 - Check the branchtransfers table and note the reason is 'Reserve'
5 - Set the preference CanMarkHoldsToPullAsLost to allow
6 - Place a hold on an item at branch you are singed in at
7 - Ensure you are not using strict sql modes (bug 22431)
8 - Go to Circulation->Holds to pull
9 - Mark hold as lost
10 - Check branchtransfers and confirm reason is "LostReserve"
11 - Check in item from step 1 at the correct branch
12 - Go to Circulation->Holds awaiting pickup
13 - Cancel the reserve
14 - Check branchtransfers and confirm reason is "CancelReserve"

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24436: Add 'Reserve' options to branchtransfers trigger
Martin Renvoize [Fri, 17 Jan 2020 11:20:37 +0000 (11:20 +0000)]
Bug 24436: Add 'Reserve' options to branchtransfers trigger

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24299: DBRev 19.12.00.048
Martin Renvoize [Fri, 20 Mar 2020 15:57:45 +0000 (15:57 +0000)]
Bug 24299: DBRev 19.12.00.048

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24299: Add Unit test for 'reason' in transferbook
Martin Renvoize [Fri, 20 Mar 2020 11:15:54 +0000 (11:15 +0000)]
Bug 24299: Add Unit test for 'reason' in transferbook

Test plan
1/ Run test and verify it passes
2/ Signoff

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24299: Record 'RotatingCollection' as a transfer trigger
Martin Renvoize [Thu, 16 Jan 2020 16:40:10 +0000 (16:40 +0000)]
Bug 24299: Record 'RotatingCollection' as a transfer trigger

This patch adds support for passing a trigger to
C4::Circulation::transferbook and passes 'RotatingCollection' to it when
called inside the rotating collections routine.

Test plan:
1/ Perform a rotating collection transfer operations
2/ Check the database for instances of 'RotatingCollection' in the
branchtransfers.reason field.
3/ Signoff

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24299: Add 'RotatingCollection' branchtransfer trigger
Martin Renvoize [Thu, 16 Jan 2020 16:43:09 +0000 (16:43 +0000)]
Bug 24299: Add 'RotatingCollection' branchtransfer trigger

This patch adds the RotatingCollection value to the database enum for
branchtransfer.reason

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24688: Check the priority of the fulfilled hold when fixing priorities
Aleisha Amohia [Thu, 20 Feb 2020 01:36:32 +0000 (01:36 +0000)]
Bug 24688: Check the priority of the fulfilled hold when fixing priorities

Currently when fixing priorities of existing holds, priorities aren't
fixed when checking out a middle priority hold because the hold has been
fulfilled and deleted. This patch adds a check for, if the hold can't be
found, an old hold with the required reserve_id.

To test:
1. Place at least four holds on a biblio for different borrowers
2. Check out an item to the 3rd priority borrower
3. Check the existing holds table for the biblio. The priorities might be
out of order, or try clicking the dropdowns and there might be an empty
dropdown option, or open the browser developer tools and notice the option
values in the select are missing value=3.
4. Apply patch and restart memcached
5. Check out an item to the 2nd priority borrower
6. Check the existing holds table for the biblio. Confirm the priorities
have been fixed and are now consecutive with no gaps.

Sponsored-by: Chartered Accountants Australia and New Zealand
Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24892: Resolve uninitialized warns from opac-memberentry
Marcel de Rooy [Wed, 18 Mar 2020 13:54:52 +0000 (13:54 +0000)]
Bug 24892: Resolve uninitialized warns from opac-memberentry

Especially line 500 (current master).

Use of uninitialized value $new_data{"sort2"} in string eq at /usr/share/koha/opac/opac-memberentry.pl line 500.
Use of uninitialized value in string eq at /usr/share/koha/opac/opac-memberentry.pl line 500.

Simple fix, not completely trivial due to adding xor ;)

Test plan:
Do not apply, update from opac memberentry. Check warns in log.
Apply patch, update again. Less warns?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24848: Improve manual links for the label creator
Katrin Fischer [Fri, 13 Mar 2020 17:40:38 +0000 (17:40 +0000)]
Bug 24848: Improve manual links for the label creator

Some of the manual links in the label creator tool were
not working correctly or pointing to the wrong pages.

A problem is the label-manage.pl file. This can show
different data depending on an added parameter. Example:
/cgi-bin/koha/labels/label-manage.pl?label_element=template

But it appears that parameters will be ignored when creating
links to the manual. So this patch links to the beginning
of the label creator section in the manual for now.

To test:
- Go to the lable creator
- Try the various pages of the tool
  - Note: All 'New ...' links should point to the
    correct section in the manual (batches, templates, ...)
    Except: Barcode range. This feature is new and not
    yet documented in the manual. Link goes to label creator section.
  - Note: All 'Manage ...' links should point to the
    beginning of the 'label creator' section in the manual

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24553: Use 'barcode' not 'item_id' when removing hold from SIP patron
Nick Clemens [Tue, 25 Feb 2020 14:42:29 +0000 (14:42 +0000)]
Bug 24553: Use 'barcode' not 'item_id' when removing hold from SIP patron

The drop_hold routine was using the wrong parameter for item info in the patron's
array of holds. We store it as 'barcode' not 'item_id'. This is true for both waiting and unavailable
holds

To test:
1 - Apply unit tests patch
2 - prove -v t/db_dependent/SIP/ILS.t
3 - It fails
4 - Apply second patch
5 - prove -v t/db_dependent/SIP/ILS.t
6 - It passes!

You can also see bug 24175 - you cna hack sip_cli_emulator to allow cancelling a hold
and check the messages, test coverage is improved by this patch and should be sufficient
for testing

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.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>
4 years agoBug 24553: Unit tests
Nick Clemens [Tue, 25 Feb 2020 14:42:17 +0000 (14:42 +0000)]
Bug 24553: Unit tests

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.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>