UPDATE: In the meanwhile another occurrence was added to Reserves.t, but
easy to replace
Test plan:
% git grep _get_itype
must not return any occurrences.
If one needs it, Koha::Item->effective_itemtype must be used instead.
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>
Katrin Fischer [Sun, 22 Mar 2020 14:06:35 +0000 (15:06 +0100)]
Bug 22098: (QA follow-up) Improving documentation
Improves the documentation of the script a bit, but makes one
important change:
-If no prefix is submitted, or prefix does not contain only
-numbers, it returns the inserted code (= keep a field unchanged)
+If no prefix is submitted, or the prefix does contain only
+numbers, it returns the inserted code (= keep the field unchanged).
To test:
- Add an authorised INVENTORY value with 2020 as prefix
- After linking the stocknumberAV.pl to the 952$i in the frameworks
- Edit an item
- Add 2020 in the stocknumber field
- Trigger plugin
- Verify nothing happens
If the prefix contains only numbers... nothing happens.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
- nubers => numbers
- some vertical spacing
- !}fmt -w65
- "contains of letters" => "containing letters"
TEST PLAN
---------
perldoc cataloguing/value_builder/stocknumberAV.pl
apply patch
perldoc cataloguing/value_builder/stocknumberAV.pl
-- after the patch is more readable.
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>
Josef Moravec [Fri, 11 Jan 2019 09:25:00 +0000 (09:25 +0000)]
Bug 22098: Update stocknumberAV cataloguing plugin to use objects
This patch:
- changes SQL to Koha::AuthorisedValues
- remove type param from script tag
- fixes the plugin description
0) Do not apply the patch
1) Set the plugin
1.1) Update a biblio framework and link plugin stocknumberAV.pl to some item
subfield
1.2) Add authorised values category called "INVENTORY"
1.3) Add some authorised values: authorised value is prefix and
description is a current stock/inventory number
2) Add an item and try to use this plugin to ensure you set it
correctly
2.1) Use a defined prefix to see if the number is correct
2.2) Ensure the number is correctly incremented in authorised values
2.3) Use not defined prefix to see the error message
2.4) Insert a not prefix string (eg number) to see it is not changed
3) Apply the patch
4) Repeat 2) and see it is working the same
5) Look into patch and confirm the description does make sense and is
rigth according to what you see in UI
6) Sign off :D
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>
Marcel de Rooy [Thu, 20 Feb 2020 08:56:03 +0000 (08:56 +0000)]
Bug 21800: Add tests for _check_split
This new subroutine supports checking the repeatable tag from another
framework. (It will be useful for the item editor.)
Test plan:
Run t/db_dependent/Biblio/TransformKohaToMarc.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Marcel de Rooy [Thu, 13 Feb 2020 14:35:42 +0000 (14:35 +0000)]
Bug 21800: Check the correct framework for the repeatable tag
This depends on the framework parameter. Which should be added back to
the call in C4::Items.
Test plan:
[1] Mark in Default framework one subfield A repeatable and B not repeatable.
Go to item editor. (Work on a biblio in Default framework.)
Check saving and reopening these subfields with VAL1 | VAL2.
Subfield A should be cloned, B should be glued as entered.
[2] Mark in another Framework A not repeatable and B repeatable.
Change framework for this biblio.
Go to item editor again. Reopen item. Behavior subfields in reverse?
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Marcel de Rooy [Thu, 13 Feb 2020 11:33:15 +0000 (11:33 +0000)]
Bug 21800: Make TransformKohaToMarc aware of non-repeatable subfields
If a kohafield (in Koha to MARC mappings) contains a pipe char (say A | B),
we split it up into two subfields A and B in MARC.
We will only do that for repeatable subfields now. If the field is not
repeatable, the value will just be 'A | B'.
Note 1: As bug 10306 and its friends (19096) made the Default framework
authoritative, we do no longer have the frameworkcode in this routine.
Formally, we should check the corresponding framework.
Note 2: Does this impact the reverse operation in TransformMarcToKoha?
No, the check on repeatable subfields is done in the interface and not
in TransformMarcToKoha. This routine simply translates two instances of the
same subfield, say A and B, into the value 'A | B' for a kohafield. Not
allowing two instances of a non-repeatable subfield is not in the scope of
this report.
Test plan:
[1] Mark an item field as repeatable in the Default framework.
Edit an item. Insert A|B in this field and another not-repeatable
field. Save and reopen. Verify that the repeatable field is duplicated
and the other one contains the pipe character in the text box.
[2] Look for a repeatable subfield in MARC like e.g. 260$c.
Go to the cataloguing editor and add A|B in this field.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Marcel de Rooy [Thu, 13 Feb 2020 11:55:32 +0000 (11:55 +0000)]
Bug 21800: Add tests for repeatable subfields
Test plan:
Do not apply the second patch [note 1].
Run t/db_dependent/Biblio/TransformKohaToMarc.t
Run t/db_dependent/Biblio/TransformMarcToKoha.t
Apply the second patch and run them again. Both tests should pass now.
Note 1: The TransformKohaToMarc test should fail with something like:
# Failed test 'Check 260e'
# at t/db_dependent/Biblio/TransformKohaToMarc.t line 60.
# got: 'A'
# expected: 'A | B'
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 15214: bulkmarcimport should log if an authority has been updated
When importing with bulkmarcimport, authorities may or may not be updated based
on which authority is newer (005 are compared). This patch allows to keep track
in the result yaml file if an authority has been updated or not:
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nick Clemens [Fri, 20 Mar 2020 15:07:27 +0000 (15:07 +0000)]
Bug 24759: (follow-up) Fix tests
Earlier tests delete borrowers before issues, can cause a constraint failure
Wrong test count
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>
Jonathan Druart [Tue, 3 Mar 2020 13:26:06 +0000 (14:26 +0100)]
Bug 24759: Test intranet at the same time
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>
Jonathan Druart [Tue, 3 Mar 2020 13:22:06 +0000 (14:22 +0100)]
Bug 24759: Simplify tests
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>
Nick Clemens [Mon, 2 Mar 2020 17:01:42 +0000 (17:01 +0000)]
Bug 24759: Rename renewalbranch to renewal_branchcode
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>
Kyle M Hall [Wed, 26 Jun 2019 11:43:53 +0000 (07:43 -0400)]
Bug 24759: Unit tests for AddRenewal
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>
Nick Clemens [Fri, 28 Feb 2020 13:23:44 +0000 (13:23 +0000)]
Bug 24759: CleanUp OpacRenewalBranch values
We had a unique behvaiour where the syspref was set to string 'NULL'
as opposed to undef, we need to clean that up
To test:
1 - Set OpacRenewalBranch to 'NULL' in staff interface
2 - Renew via opac
3 - Check statistics to ensure branch is blank
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>
Nick Clemens [Fri, 28 Feb 2020 13:09:29 +0000 (13:09 +0000)]
Bug 24759: Move OpacRenewalBranch code to Koha::Item
This patchset moves all code to calculate the correct renewal branch into Koha::Item.pm
When interface is opac we follow the syspref, otherwise we use the current userenv, or pass through
a defined branch
To test:
1 - Check out an item to a patron
2 - Set allowed renewals in the circ rules to 100 (just so you can keep testing)
3 - Renew the item in staff interface, confirm it is recorded correctly in statistics table (as signed in branch)
4 - Renew via the opac, testing with each setting of OpacRenewalbranch
5 - prove -v t/db_dependent/Koha/Item.t
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>
Jonathan Druart [Mon, 24 Feb 2020 14:17:56 +0000 (15:17 +0100)]
Bug 24696: Use strftime
Seems easier to me.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Thu, 20 Feb 2020 14:30:29 +0000 (14:30 +0000)]
Bug 24696: Add completion times to updatedatabase
This patch adds completion times to the print statements in
updateadatabase.pl.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Jonathan Druart [Wed, 11 Mar 2020 11:00:25 +0000 (12:00 +0100)]
Bug 24131: Remove bullet points for secondary descriptions
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Tue, 10 Mar 2020 14:31:20 +0000 (14:31 +0000)]
Bug 24131: (QA follow-up) Formatting in web client
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Mon, 24 Feb 2020 13:45:30 +0000 (13:45 +0000)]
Bug 24131: (follow-up) Another rebase
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Thu, 20 Feb 2020 14:29:47 +0000 (14:29 +0000)]
Bug 24131: (follow-up) Fix and rebase
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Jonathan Druart [Thu, 6 Feb 2020 12:28:15 +0000 (13:28 +0100)]
Bug 24131: Handle several descriptions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Jonathan Druart [Thu, 6 Feb 2020 12:07:35 +0000 (13:07 +0100)]
Bug 24131: Move the print statement to a new subroutine
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Marcel de Rooy [Thu, 27 Feb 2020 08:02:03 +0000 (08:02 +0000)]
Bug 24052: Add koha_xslt_security to koha-conf.xml
The line for enabling the unsafe expand_entities option is commented
and includes a warning to keep it like that ;)
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>
Marcel de Rooy [Tue, 25 Feb 2020 15:09:53 +0000 (15:09 +0000)]
Bug 24052: Catch warning between test 5 and 6
Resolve:
ok 5 - Engine returns error on undefined text
XSLT::Base: Empty String at /usr/share/koha/Koha/XSLT/Base.pm line 214.
ok 6 - Engine returns error on empty string
Test plan:
Run perl Base.t and verify that this warning is no longer printed.
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>
Marcel de Rooy [Tue, 25 Feb 2020 14:56:15 +0000 (14:56 +0000)]
Bug 24052: Fix Koha/XSLT/Base.t
Moving the separate small attachments into the test script.
Creating them now as temporary files or code fragments.
Deleting original files.
Since Breeding.t also used one of these files, a similar change was made in
that script.
Test plan:
Run t/db_dependent/Koha/XSLT/Base.t. Should pass now.
Run t/db_dependent/Breeding.t again.
Git grep on XSLT_Handler. You should only find release notes.
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>
Marcel de Rooy [Tue, 25 Feb 2020 14:23:55 +0000 (14:23 +0000)]
Bug 24052: Rename XSLT_Handler
Should be XSLT::Base now.
Removes old XSLT_Handler stub too (from bug 23290).
Result of a git grep | sed statement.
Test plan:
Run qa tools (so modules compile).
Run t/db_dependent/Breeding.t
Run t/db_dependent/Koha/XSLT/Base.t (This test fails when only this patch
has been applied; see subsequent patch.)
Enable XSLT use on results and details display. Check search results and
detail view on OPAC and staff.
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>
Rogan Hamby [Fri, 11 Oct 2019 12:47:55 +0000 (08:47 -0400)]
Bug 18414: Allow to use other select criteria with delete_patrons.pl
Adds the ability to specify a file with the --file flag that
should be a list of borrowernumbers for deletion.
If used without other flags it will delete the list of borrowers,
if used with other flags it will treat the other criteria
as filters for the list.
To Test:
1) Specify a list, e.g. borrowers.txt, of borrowernumbers in the database and put them in a text file with one per line
2) Invoke the script like ./delete_patrons.pl --file borrowers.txt to delete those patrons
3) Populate the list with a mix of borrowers in a category and those not, say categoryfoo
4) Invoke the scirpt as ./delete_patrons.pl --category_code categoryfoo --file borrowers.txt
5) Only the borrowers in the file that have the specified category will be deleted
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 24872: Set languages prefererences after install
This patch set 'languages' and 'opaclanguages' system
preferences with the language used during install.
To test:
1. Apply the patch
2. Do a clean install in a language other than english
3. Verify that 'languages' and 'opaclanguages' system
preferences show the language code used during install,
besides english.
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Jonathan Druart [Mon, 17 Feb 2020 13:58:02 +0000 (14:58 +0100)]
Bug 24672: (bug 24430 follow-up) Do not get active orders on deleted biblio record
On bug 24430 we replaced the call to CountBiblioInOrders with
Koha::Biblio->active_orders
In case the bibliographic record is deleted, the count must be set to 0.
This prevent the app to crash with:
Can't call method "active_orders" on an undefined value at
/home/vagrant/kohaclone/acqui/parcel.pl line 244
Test plan:
Create 2+ orders
Receive one, delete it, delete the bibliographic record
Receive the order one
=> Without this patch, on the parcel page you should get the error
=> With this patch applied you must be allowed to finish the receive
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>