Commit graph

5441 commits

Author SHA1 Message Date
30f4726697 Bug 28847: Remove diag statements
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 15:58:01 +02:00
2c546b662d Bug 29315: Remove warnings from Search.t
The syspref SearchLimitLibrary was requested but I don't know what to
say; this indicates that the test requires updating at
t/db_dependent/Search.t line 198.
The syspref FacetOrder was requested but I don't know what to say; this
indicates that the test requires updating at t/db_dependent/Search.t
line 198.
The syspref OPACResultsUnavailableGroupingBy was requested but I don't
know what to say; this indicates that the test requires updating at
t/db_dependent/Search.t line 198.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 14:37:56 +02:00
a84deb0446 Bug 29306: Fix warning on undefined $_ in Holds.t
Use of uninitialized value $_ in concatenation (.) or string at t/db_dependent/Holds.t line 1658.

Results from copying line 70.

Test plan:
Run Holds.t

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 14:08:06 +02:00
b8c32b2cca Bug 29284: Unit test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 14:08:06 +02:00
707a01380c Bug 28585: (QA follow-up) Add explicit tests for setting date/date-time attributes
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 14:06:46 +02:00
c1eb935d0a Bug 28585: (QA follow-up) Fix object.t
Object.t was still testing for the return of DateTime objects from
attributes_from_api. I checked all calls to attrbutes_from_api for
reliance of DateTime objects and confirmed they all get passed into
search calls and thus are better served as SQL formatted strings.

I then converted the test to check that the rfc3339 formatted dates
passed in were converted to strings appropriate for feeding into SQL
where statements instead.

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

JD amended patch:
  FAIL   spelling
    formated ==> formatted

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 14:06:27 +02:00
538ab104f3 Bug 28585: (follow-up) Tests for q= supporting date/date-time parameters
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 13:56:37 +02:00
90ccfb8f34 Bug 28585: Regression tests
This patch adds tests for filtering GET calls with date/date-time
parameters. Tests fail because the feature is not working

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 13:56:37 +02:00
e203730002 Bug 19185: Add missing +x on new test files
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 13:09:34 +02:00
39e969f05f Bug 19185: Split installation and onboarding
The previous installation tests were testing the full onboarding process
by not selecting all the sample data.
It would be good to test the whole sample data set.

So there are now 2 files, 00-onboarding.t and 01-installation.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
4fb71cc8ac Bug 19185: DB must exist but empty
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
f02a58da9e Bug 19185: Fix language selection
'en' is in an optgroup

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
cfccfcab02 Bug 19185: Fix tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
ae7ddc4ab2 Bug 19185: Add selenium tests for installation and onboarding process
== Test plan ==
1. Apply the patches (including bug 19821)
2. restart_all
3. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t
4. result: Config entry 'database_test' does not exist at
     /home/vagrant/kohaclone/t/lib/Bootstrap.pm line 18
5. Edit $KOHA_CONF, add a database_test entry identical to database
     You should have:
     <database>koha_kohadev</database>
     <database_test>koha_kohadev</database_test>
6. restart_all
7. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t
8. result: Entries 'database_test' and 'database' have the same value in your
     config at /home/vagrant/kohaclone/t/lib/Bootstrap.pm line 20.
9. Edit $KOHA_CONF, edit database_test with koha_test as DB name
10. restart_all
11. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t
12. result: Access denied for user 'koha_kohadev'@'localhost'
       to database 'koha_test'
13. Connect to the DBMS
14. Example for koha_testing_docker
      docker exec -it koha_db_1 bash
      mysql -u root --password=password
15. GRANT ALL PRIVILEGES ON `koha_test`.* TO 'koha_kohadev';
16. prove -Mt::lib::Bootstrap t/db_dependent/selenium/00-installation.t
17. result: All tests successful.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
f22576157f Bug 19185: Use submit button if only one exists on the page
During the installation process we do not have fieldset.action, in order
to not complicate changes we are just going to use the submit button if
only one exists.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
cfd25f0ed7 Bug 19821: Require database_test != database
To prevent developpers to drop their database.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
98c42b8d5a Bug 19821: Do not modify KOHA_CONF, use new database_test entry instead
I have tried to use the original idea of this patch for bug 19185, but
it cannot work as it. ENV is not shared between processus and KOHA_CONF
will not be read by webserver (used for selenium tests).

Moreover on bug 19185 we are testing the installation process and we do
not want the database to be populated with sample data, we just need a
new and clean DB.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
Julian Maurice
16442dabd1 Bug 19821: Ignore .proverc and .proverc.dist in Makefile.t
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
Julian Maurice
d33552f871 Bug 19821: Install sample data, ES mappings and Version syspref
Also move .proverc to .proverc.dist, so it cannot be used by accident.

Different ways to use it:

1/ prove --rc .proverc.dist
   Use defaults

2/ cp .proverc.dist .proverc && prove
   Allows to configure db name, marcflavour, and prove options

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
Julian Maurice
a78c4b45e4 Bug 19821: Close filehandle after writing
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
Julian Maurice
0308261de6 Bug 19821: Run tests on a separate database
Running the tests on the same database as the one used for dev has some
drawbacks:
- Everybody has different data, so we cannot make any assumptions about
data in tests and it can make tests fail for non-obvious reasons.
- Tests have to clean up every change to the database using SQL
transactions, so we cannot write testable code that use transactions
(AFAIK)
- Transactions in tests happen to be committed sometimes, resulting in
garbage data added to the dev database

This patch provides a .proverc file that will load t/lib/Bootstrap.pm
before the tests are run.
t/lib/Bootstrap.pm is responsible for recreating a fresh database and
telling the test scripts to use it.
To use it, just run prove normally from the root directory of Koha.
By default, the database is 'koha_test' and it's created using MARC21
SQL files, it can be changed by running:

    prove --norc \
    --Mt::lib::Bootstrap=database,koha_test,marcflavour,UNIMARC

Test plan:
1. Apply bug 19185 which will also apply these patches
2. In the DBMS run `select count(*) from koha_kohadev.borrowers;`
     (adapt if your usual koha DB isn't koha_kohadev)
3. Run the test plan of bug 19185 and during execution of the
   installation test, pay attention to the following:
4. List the databases in the DBMS (show databases;) to ensure that
   koha_test is created
5. After the test has run, the koha_test database should not be here anymore.
6. In the DBMS run `select count(*) from koha_kohadev.borrowers;`
7. That was to verify that the database you use usually was untouched.
   The counts should be the same.

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-25 11:27:40 +02:00
ad1d734e54 Bug 16446: Add ability to add patrons to list by borrowernumber
AddPatronsToList already took a borrowernumber parameter, however, it
did not check if those were valid numbers. This patch expands the search
to apply to cardnumber or borrowernumbers in the subroutine.

Template and script are adjusted to allow choosing borrowernumbers or cardnumbers

To test:
1 - Apply patch
2 - Browse to Tools->Patron lists
3 - Create a list, or choose Actions->Add patrons for an existing list
4 - Click 'Add multiple patrons'
5 - Cardnumbers is preselected
6 - Enter a list of cardnumbers, ensure you test:
    Cardnumber already in list
    Cardnumber not in list
    Non-existent cardnumber
7 - Patrons should be added/errors reported correctly
8 - Repeat with borowernumbers

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-21 12:24:04 +02:00
da13a79d57 Bug 27287: (QA follow-up) Unit tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-21 12:24:04 +02:00
515a596fb9 Bug 25030: (QA follow-up) Fix tests
Fluid is not a valid value for cxn_pool - valid values are:
Sniff,Static,NoPing

AddAuthority call calls index - the indexing call was trying to access
the ES server with mocked values and dying when they were invalid

This patch uses a correct value for cxn_pool and inserts directly into DB
to avoid indexing

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-21 10:09:50 +02:00
Julian Maurice
2c0d09e993 Bug 25030: Implement IncludeSeeFromInSearches with Elasticsearch
Test plan:
1. Create an authority with at least a 1XX$a and a 4XX$a, for instance:
    100 $a Foo
    400 $a Bar
2. Create a biblio and add a link to this authority using the
   cataloguing plugin
3. Disable syspref IncludeSeeFromInSearches
4. Reindex the biblio. You should be able to find it when searching
   'Foo' but not when searching 'Bar'
5. Enable syspref IncludeSeeFromInSearches
6. Reindex the biblio. You should be able to find it when searching
   'Foo' and also when searching 'Bar'
   without the patch, 'Bar' doesn't yeld results. With it, it does.
7. prove t/db_dependent/Koha/SearchEngine/Elasticsearch.t

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Lucy Vaux-Harvey <lucy.vaux-harvey@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-21 10:09:50 +02:00
6c4fa7d82d Bug 28211: (QA follow-up) Test for hook calls properly
Some warnings, that mean a hook has been called were not tested.
This patch adds those tests, and does some tidy also.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-19 15:30:57 +02:00
ddef2c6a0d Bug 28211: Fix test
#   Failed test 'Plugin enabled, route defined'
    #   at t/db_dependent/Koha/REST/Plugin/PluginRoutes.t line 125.
    # Looks like you failed 1 test of 2.

105         $good_plugin = $plugin
106             if $plugin->{metadata}->{description} eq 'Test plugin';

The wrong plugin was considered the good one.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-19 09:25:25 +02:00
71914b14d1 Bug 28211: (QA follow-up) Add unit tests
JD amended patch: typo multipled ==> multiplied

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-18 11:28:41 +02:00
6cf8bcef44 Bug 28211: (QA follow-up) Remove test_call_recursive
Obsoleted now.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-18 11:28:41 +02:00
18c1500772 Bug 28211: Replace use of call_recursive() with call()
This is based on Julian's idea on bug 28026 where we could get rid of call_recursive by passing refs as arguments to call.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Plugins/Plugins.t
3) prove t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-18 11:28:41 +02:00
95fd884441 Bug 28445: Split and join on ' | ' instead of '|' for repeatable
Is that correct?!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-18 11:28:40 +02:00
cd7641b2c8 Bug 28445: Improve robustness of tests
* Libraries are ordered by name by default but if others have been added
the test may fail

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-18 11:28:40 +02:00
424aca3d56 Bug 28445: Use the task queue for the batch delete and update items tool
Here we go!

Disclaimer: this patch is huge and does many things, but splitting it in
several chunks would be time consuming and painful to rebase. However it
adds many tests and isolate/refactor code to make it way more reusable.

This patchset will make the "batch item modification" and "batch item
deletion" features use the task queue (reminder: Since bug 28158, and so
21.05.00, we do no longer use the old "background job" functionality and
the user does not get any info about the progress of the job).

More than that, more of the code to build an item form and a list of
items is now isolated in module (.pm) and include files (.inc)

We are reusing the changes made by bug 27526 that simplifies the way we
edit/create items (no more unecessary serialization Koha > MARC > MARCXML
> XML > HTML)

New module:
* Koha::BackgroundJob::BatchDeleteItem
    Subclass for process item deletion in batch
* Koha::BackgroundJob::BatchUpdateItem
    Subclass for process item modification in batch
* Koha::Item::Attributes
    We needed an object to represent item's attributes that are not
    mapped with a koha field (aka "more subfields xml")
    This module will help us to create the marcxml from a hashref and the
    reverse.
* Koha::UI::Form::Builder::Item
    The code that was used to build the add/edit item form is
    centralised in this module. In conjunction with the
    subfields_for_item BLOCK (from html_helpers.inc) it will be really
    easy to reuse this code in other places where the item form is used
    (acquisition and serials modules)
* Koha::UI::Table::Builder::Items
    Same as previously for the table. We are now using this table from 3
    different places (batch item mod, batch item del, backgroung job
    detail view) and the code is only in one place.
    To use with items_table_batchmod BLOCK (still from html_helpers.inc)

This patch is fixing some bugs about repeatable subfields and regex. A UI
change will reflect the limitation: if you want to apply a regex on a
subfield you cannot add several subfields for the same subfield code.

Test plan:

Prepare the ground:
- Make sure you are always using a bibliographic/item record using the framework
you are modifying!
- Add some subfields for items that are not mapped with a koha field
(note that you can use 'é' for more fun, don't try more funny
characters)
- Make some subfields (mapped and not mapped with a kohafield)
repeatable
- Add default values to some of your subfields

There are 4 main screens to test:
1. Add/edit item form
The behaviour should be the same before and after this patch.
See test plan from bug 27526.
Those 2 prefs must be tested:
    * SubfieldsToAllowForRestrictedEditing
    * SubfieldsToUseWhenPrefill

2. Batch modification
a. Fill some values, play with repeatable and regex.
Note that the behaviour in master was buggy, only the first value was modified by the regex:
    * With subfield = "a | b"
    1 value added with "new"
    => "new | b"

    * With subfield = "a | b"
    2 new fields "new1","new2"
    => "new2 | b"

Important note: For repeatable subfields, a regex will apply on the subfields in
the "concatenated form". To apply the regex on all the different subfields of a given
subfield code you must use the "g" modifier.
This could be improved later, but keep in mind that it's not a regression or behaviour
change.

b. Play with the "Populate fields with default values from default framework" checkbox

c. Use this tool to modify items and play with the different sysprefs that
interfer with it:
    * NewItemsDefaultLocation
    * SubfieldsToAllowForRestrictedBatchmod
    * MaxItemsToDisplayForBatchMod
    * MaxItemsToProcessForBatchMod

3. Batch deletion
a. Batch delete some items
b. Check items out and try to delete them
c. Use the "Delete records if no items remain" checkbox to delete
bibliographic records without remaining items.
d. Play with the following sysprefs and confirm that it works as
expected:
    * MaxItemsToDisplayForBatchDel
e. Stress the tool: Go to the confirmation screen with items that can be
deleted, don't request the job to be processed right away, but check the
item out before.

4. Background job detail view
You must have seen it already if you are curious and tested the above.
When a new modification or deletion batch is requested, the confirmation
screen will tell you that the job has enqueued. A link to the progress
of the job can be followed.
On this screen you will be able to see the result of the job once it's
fully processed.

QA notes:
* There are some FIXME's that are not blocker in my opinion. Feel free to
discuss them if you have suggestions.
* Do we still need MaxItemsToProcessForBatchMod?
* Prior to this patchset we had a "Return to the cataloging module" link
if we went from the cataloguing module and that the biblio was deleted.
We cannot longer know if the biblio will be deleted but we could display
a "Go to the cataloging module" link on the "job has been enqueued"
screen regardless from where we were coming from.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-18 11:28:40 +02:00
c66668b16c Bug 28769: Remove tabloop from cataloguing plugins
There is a "tabloop" variable that is passed from the add item form logic to the cataloguing plugins.
But there is confusion, sometimes it's an iterator ($i) and sometimes (batchMod.pl) an array.

Actually this tabloop variable is never used from cataloguing plugins, we should remove it.

Test plan:
Read the code and confirm the above.
You can also test a couple of plugins and confirm that they are still
working.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-18 11:28:40 +02:00
9a8563d074 Bug 29157: Regression tests
This patch implements regression tests for the filed bug.

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

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-15 11:34:26 +02:00
b0038f4035 Bug 29172: Make CustomCoverImagesURL compatible with control fields
Bug 22445 added CustomCoverImagesURL that deals with MARC fields, but
control fields were not supported.

Test plan:
Turn CustomCoverImages on
Fill CustomCoverImagesURL with https://covers.openlibrary.org/b/isbn/{006}-M.jpg
Add an isbn in 006 (0596001738 will work)
Go to the detail page of the bibliographic record and confirm that you
see a cover image.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-12 11:15:32 +02:00
Ere Maijala
155c3f1824 Bug 29135: Fix handling of deleted items in OAI-PMH provider
When the OAI-PMH provider was configured to include item information
in the returned records, deleting an item would cause the record to
be reported as deleted. The provider also did some useless checks when
determining the timestamp of a deleted record. These checks only had
a performance impact.

To test:
1) Create /var/lib/koha/kohadev/OAI.yaml with:

format:
  marcxml:
    metadataPrefix: marcxml
    metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
    schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
    include_items: 1

2) Set preference OAI-PMH to Enable
3) Set preference OAI-PMH:ConfFile to /var/lib/koha/kohadev/OAI.yaml
4) Delete an item from a record
5) View the page: http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=marcxml
6) Note the record is now listed as deleted
7) Run prove -v t/db_dependent/OAI/

Sponsored-by: The National Library of Finland

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-12 10:14:29 +02:00
f6d013efad Bug 28734: Clear cache to prevent random failures
MSS is modified, we must clear the cache before and after

    #   Failed test 'Authorised value is correctly parsed to show description rather than code'
    #   at t/db_dependent/Koha/Biblio.t line 617.
    #          got: 'CODE'
    #     expected: 'Description should show'

    #   Failed test 'Authorised value is correctly parsed for OPAC to show description rather than code'
    #   at t/db_dependent/Koha/Biblio.t line 624.
    #          got: 'CODE'
    #     expected: 'Description should show OPAC'
    # Looks like you failed 2 tests of 13

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-12 09:12:54 +02:00
f2c7c9430b Bug 3142: Add tests for item-level_itypes=0
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-08 16:57:30 +02:00
05ddd7eede Bug 3142: (QA follow-up) Include notforloan itemtypes
As was done in the code already.
Note that we are ignoring effective itemtype now.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-08 16:57:30 +02:00
bd438ff99d Bug 3142: Add test for the circ rule
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-08 16:57:29 +02:00
70a303a5de Bug 3142: Add tests
And fix a bug!

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-08 16:57:29 +02:00
5eca355cbc Bug 29182: (follow-up) Fix ArticleRequests.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-07 15:49:01 +02:00
b356ad25de Bug 29182: Regression tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-07 15:49:01 +02:00
3f981b1f28 Bug 29062: Unit tests
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-07 15:49:01 +02:00
08c03af2ae Bug 18984: Remove NORMARC support
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-07 15:36:40 +02:00
5be090b556 Bug 28730: Add option to format AH field (due date) in SIP checkout response
This patch adds a new option to sip accounts:
format_due_date

If set to 1 the AH field in checkouts will follow the dateFormat system preference and format as due dates (ignoring time portion if 23:59:59 or 11:59:59)

To test:
 1 - checkout an item via SIP:
perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -t CR --item 3999900000001 --patron enda -m checkout
 2 - Note the AH field is like "YYYYMMDD    HHMMSS"
 3 - Apply patch
 4 - repeat SIP checkout - nothing has changed
 5 - edit SIPConfig.xml and add format_due_date="1" to 'term1' account:
    <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii"     checked_in_ok="1" format_due_date="1"/>
 6 - restart all
 7 - repeat the SIP checkout
 8 - AH field now matches dateFormat system preference
 9 - Change your dateFormat preference
10 - repeat the SIP checkout
11 - AH matches new format

Note: If you cannot renew and don't get an AH just check the item back in:
perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -t CR --item 3999900000001 --patron enda -m checkin

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-07 11:18:29 +02:00
41a92321de Bug 28931: Remove unused Koha::DateUtils from tests
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-07 11:01:05 +02:00
9e249435f9 Bug 28931: Use EXPORT_OK from Koha::DateUtils
It has been missed on bug 17600.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-07 11:01:05 +02:00
f968a65793 Bug 29084: Update article requests-related Koha::Biblio methods to use relationships
This patch makes Koha::Patron->article_requests use the underlying DBIC
relationship and _new_from_dbic instead of a plain search. It also
refactors 'article_requests_current' and 'article_requests_finished' to
use ->article_requests, as well as the new methods introduced by bug
29082 for filtering.

No behavior change should take place.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t \
           t/db_dependent/ArticleRequests.t
=> SUCCESS: Tests pass!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

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

Bug 29084: Unit tests

This patch adds missing tests for Koha::Biblio->article_requests and
reorganizes (and extends) the tests for 'article_requests_current' and
'article_requests_finished' that were originally in ArticleRequests.t
into Koha/Biblio.t as we do now.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/ArticleRequests.t \
           t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 29084: Remove article_requests_finished and article_requests_current

This patch removes those methods that are not really needed. Templates
are adjusted to use the expected combination of
->article_requests->filter_by_current.

To test:
1. Apply this patch
2. Visit a biblio with article requests
=> SUCCESS: All works
3. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass, less tests.
4. Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-07 10:54:59 +02:00