Bug 28948: Make is_public stashed on public routes
This patch makes the API authentication code stash the 'is_public' value
when public routes are hit.
This will be particularly useful to have $c->objects->search generically
pass this info down to the ->to_api method.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t
=> SUCCESS: Tests pass! When a public route is reached, the controller
has the 'is_public' value stashed
3. Sign off :-D
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 28948: Add a generic way to handle API privileged access attributes deny-list
This patch introduces a way for Koha::Object(s)->to_api to filter out
attributes that require privileged access. It is done in a way that the
'public' parameter is recursively passed to nested objects in recursive
to_api() calls.
This way, Koha::Object-based classes can determine how they will render
depending on this parameter. For example, for implementing a
route for fetching an library looks like:
GET /libraries
The controller will look like:
my $library = Koha::Libraries->find( $c->validation->param('library_id') );
return $c->render(
status => 200,
openapi => $library->to_api
);
Implementing an unprivileged (public) route would look like:
GET /public/libraries/:library_id
The controller will look like:
my $library = Koha::Libraries->find( $c->validation->param('library_id') );
return $c->render(
status => 200,
openapi => $library->to_api({ public => 1 })
);
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Object*.t
=> SUCCESS: Tests pass (i.e. current behaviour is kept, new behaviour
passes the tests)
3. Sign off :-D
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch introduces routes to handle purchase suggestions, from the
staff POV.
Tests are added as well.
To test:
1. Apply this patches
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/suggestions.t
=> SUCCESS: Tests pass! And they are meaningful!
3. Play with your favourite REST tool (Postman?)
4. Sign off :-D
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 17314: Make TestBuilder set good defaults for Suggestions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Wed, 13 Oct 2021 08:25:37 +0000 (10:25 +0200)]
Bug 28859: Correctly handle 'Checked out by' visibility
We must have the column in the table and let DT deal with the
visibility.
This patch hides the "Checked out by" column by default if
RecordStaffUserOnCheckout is off, but the DT column settings is aware of
its existence and the end user can still display the column.
IMO that's the most optimal situation considering both maintenance and ergonomic.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Andrew Isherwood [Fri, 17 Sep 2021 13:14:36 +0000 (14:14 +0100)]
Bug 28859: Fix missing column setting
This commit adds the missing checked_out_by column to
columns_settings.yaml
Test plan:
- Follow the test plans in the bug description and note that the
symptoms are no longer seen
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Wed, 13 Oct 2021 19:05:10 +0000 (19:05 +0000)]
Bug 29229: Use Flatpickr in suggestion search sidebar filter
This patch corrects the date field configurations for the suggestions
sidebar filter. These fields are now linked Flatpickr widgets instead of
jQueryUI datepickers.
To test, apply the patch and go to Suggestions.
- In the sidebar, click "Suggestion information" to expand the form.
- Test these linked date fields:
- "Suggested date from" and "to"
- "Managed date from" and "to"
- "Accepted by from" and "to"
- Each should trigger Flatpickr calendars which are linked, i.e. you
can't select a "to" date which is before a "from" date.
- Test that the dates submit correctly to filter as expected.
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>
Owen Leonard [Thu, 21 Oct 2021 12:16:07 +0000 (12:16 +0000)]
Bug 29301: Display error with serials search flatpickr when searching Mana
This patch changes the way certain serials search fields are hidden when
a standalone search of Mana is being performed (from the "Search on
Mana" link). Instead of targeting specific labels and inputs to hide we
can hide list items by class.
Unrelated: This patch updates the page heading so that it is different
depending on whether you're searching Koha subscriptions or Mana
subscriptions.
To test, apply the patch and enable Mana.
- Go to Serials -> Advanced search (in the search header).
- The search form should include all fields, including call number,
vendor, library, location, and "Expires before."
- Click "Search on Mana" in the sidebar.
- This page should have the heading "Mana subscriptions search," and
there should only be three fields visible: ISSN, Title, and Publisher.
- When you perform a Mana search which returns results the page should
have the heading "Mana subscriptions (X found).
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Thu, 21 Oct 2021 12:02:06 +0000 (12:02 +0000)]
Bug 29299: (follow-up) Add markup comments
This patch adds comments to the template to highlight the markup
structure.
This patch should have no effect on the page's appearance or
functionality.
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>
Owen Leonard [Thu, 21 Oct 2021 11:51:47 +0000 (11:51 +0000)]
Bug 29299: Reindent serials search template
This patch updates the serials search template to give it consistent
indentation.
The patch also moves one section of markup: The <tfoot> section is moved
to after <tbody> in order to conform to current standards.
To test, apply the patch and go to Serials -> Search subscriptions (in
the header).
- Serials search should work correctly and the page should look correct.
- With Mana enabled, click on the "Search on Mana" link in the sidebar.
- Searches of Mana should work correctly too.
- If you view the diff while ignoring whitespace the only changes should
be the move of <tfoot> and places where line breaks were introduced.
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>
Bug 28613: Add missing parameters to objects.search-based routes
The objects.search helper provides convenient ways to paginate and a 'q' filter parameter to build complex queries on this Koha::Objects-based routes.
Some routes were created prior to this feature getting introduced. We need to adjust the parameters for all existing objects.search-based routes.
This patch adds that.
The only GET (as in list) routes that would still be missing the
parameters are those about ILL, that are not objects.search based, and
probably need to be rewritten.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Thu, 21 Oct 2021 12:10:35 +0000 (13:10 +0100)]
Bug 29300: Add 22.05 release team to teams.yaml
Add the 22.05 release team.
Test plan
1/ Check against
https://wiki.koha-community.org/wiki/Release_Teams
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 26234 allowed to remove the different classes we use in aoColumnDefs
for sorting columns of table using DT.
However there is a terrible mistake, the merge of existing aoColumnDefs
array with the default one is totally wrong:
$.extend(true, new_parameters, default_column_defs);
When we actually wanted to do:
$.extend(true, new_parameters["aoColumnDefs"], default_column_defs);
But it's still wrong, extend is doing a deep copy and the array will be
replaced by the other one, whereas we want to append.
We want to merge default_column_defs with the existing aocolumnDefs,
this patch is doing it explicitely.
This bug only exists when there is an existing aocolumnDefs.
See commit d3f3a55e0b1544ebcd3166d141e126a4324baab1
It happens on:
* cataloguing/z3950_search.tt
* reports/guided_reports_start.tt
* serials/subscription-detail.tt
* opac-course-reserves.tt
* opac-detail.tt
However this bug has been hidden as we have in master related bug from
bug 27945, which removes title-string.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch removes an early short-circuit we had, which wasn't correct
regarding the OpacPasswordChange syspref. If a patron category is
allowed to change password, it overrides the syspref.
To test:
1. Tests still pass.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 29272: Make public password changing honour category constraints
This patch makes the public API routes validate
$user->category->effective_change_password before allowing the change.
To test:
1. Apply the regression tests patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/patrons_password.t
=> FAIL: Tests fail, it allows the first change instead of returning
403.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch introduces regression tests for the described bug.
To test:
1. Apply this patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/patrons_password.t
=> FAIL: Tests fail, excepted failures are considered success
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Wed, 27 Oct 2021 10:50:18 +0000 (11:50 +0100)]
Bug 29332: Set default library limits in search_for_display
Koha::AdditionalContents->search_for_display needs to filter to just
items with a 'null' branchcode if no library_id is passed.
Test plan
1/ Add some additional content blocks that should display only for
specific branches.
2/ Navigate to the OPAC and note that blocks display for all libraries
prior to login
3/ Login to the OPAC and note that now you only see you users library
block
4/ Apply the patch
5/ Repeat steps 2 and 3 and note that now you see only the 'All
libraries' blocks display prior to login and that 'All libraries' +
'Your users library' blocks appear after login.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Wed, 27 Oct 2021 11:07:02 +0000 (12:07 +0100)]
Bug 29332: Unit tests
This patch adds unit tests to ensure we do not leak branch specific
addtional contents blocks outside of logged in sessions (i.e. where a
users branch is not yet set).
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Thu, 28 Oct 2021 10:15:17 +0000 (12:15 +0200)]
Bug 28445: Add diag for failing test
Temporary patch to help trying to fix the following random error:
# Failed test 'Item types should be sorted by description and an empty entries should be shown'
# at t/db_dependent/Koha/UI/Form/Builder/Item.t line 121.
# Structures begin differing at:
# $got->[12] = 'Be9T9FH5aO'
# $expected->[12] = 'REF'
# Looks like you failed 1 test of 2.
# Failed test 'itemtypes'
# at t/db_dependent/Koha/UI/Form/Builder/Item.t line 130.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Mon, 11 Oct 2021 09:11:26 +0000 (11:11 +0200)]
Bug 27526: Correct NULL vs empty string when editing
When an item is edit we must keep the NULL values in DB if the input
have been left empty.
It also fixes the "barcode cannot be unique" error when an item does not
have a barcode.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nick Clemens [Mon, 25 Oct 2021 18:50:17 +0000 (18:50 +0000)]
Bug 29318: Tidy the code
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nick Clemens [Mon, 25 Oct 2021 18:47:22 +0000 (18:47 +0000)]
Bug 29318: Remove permission check from overdrive search page
This removes the 'edit_borrowers' permission from OverDrive search
To test:
1 - Enable OverDrive via koha system preferences
2 - Sign in to opac with a user with no permissions
3 - Perform a search that will return OD results, 'love' works
4 - Click thje "Found XX results in the library's OverDrive collection"
5 - Note you are logged out of Koha
6 - Apply patch
7 - Repeat
8 - Success
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Owen Leonard [Mon, 25 Oct 2021 18:00:12 +0000 (18:00 +0000)]
Bug 29286: Typo: Librarien will need the manage_auth_values subpermission.
This patch fixes a typo in the Cataloging system preferences text.
"Librarien" -> "Librarian"
To test, apply the patch and go to Administration -> System preferences
-> Cataloging.
- Check the CreateAVFromCataloguing system preference.
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>
Jonathan Druart [Mon, 25 Oct 2021 09:49:38 +0000 (11:49 +0200)]
Bug 29158: (bug 22435 follow-up) Remove ref to account_offset_types.sql in intaller
Caused by
commit 3d6a6e79f79bfbc17807072faf0ff1d4e6aafb82
Bug 22435: (follow-up) Drop account_offset_types table
that removes the file but the reference to it from the installer
process.
Test plan:
Go through the install process and notice that the following warning
does not appear in the log:
[2021/10/25 09:47:58] [WARN] Something went wrong loading file /kohadevbox/koha/installer/data/mysql/mandatory/account_offset_types.sql (Couldn't read '/kohadevbox/koha/installer/data/mysql/mandatory/account_offset_types.sql' : No such file or directory at /usr/share/perl5/DBIx/RunSQL.pm line 180.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Fri, 7 May 2021 16:20:19 +0000 (18:20 +0200)]
Bug 14957: Improve readbility of tests
Not saying that they were not readable before, but I had to do some
changes to compare the before/after records and it was easier that way.
Feel free to obsolete if you disagree.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
It appears this patchset doesn't fully support bulkmarcimport (see bug
25539 for details).
At this time, to get this bug moving I think we should comment out the
ability to define rules that affect bulkmarcimport and then we can fix
and re-enable that feature at a later date.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Mon, 29 Mar 2021 09:31:52 +0000 (10:31 +0100)]
Bug 14957: (QA follow-up) Rename and move admin link
This patch renames 'MARC overlay rules' to 'Record overlay rules' and
moves it up the list to just below 'Record matching rules' to make it
more contextually ordered.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch renames the (passed through) 'context' param for
'overlay_context'. I propose doing so, because in Koha-land 'context'
has a special meaning, related to C4::Context and it reads ambigous.
The patch itself is pretty trivial.
Tests should pass:
1. Run:
$ kshell
k$ prove t/db_dependent/Biblio/MarcOverlayRules.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 14957: (follow-up) Clarify 'context' param
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 14957: Feature hidden in menues if no other 'cagaloguing' permissions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch acknowledges the fact that 'merging' has a different meaning
in Koha than the behavior this great patchset introduces. The more
idiomatic way of describing the behavior is to talk about 'overlay rules'.
This patch also:
- Fixes kohastructure.sql missing table encoding a collation
- Fixes the atomic update completely missing a table
- Moves the syspref entry to 'Importing', probably a rebase issue
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 14957: (QA follow-up) Fix syntax error in atomicupdate
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 14957: Fix imports in tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 14957: Fix imports in marc-overlay-rules.pl
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 14957: Fix syspref's values
It didn't switch off when set to "don't use"
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
JD amended patch: Fix license statement
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Fri, 26 Mar 2021 17:00:27 +0000 (17:00 +0000)]
Bug 14957: (QA follow-up) Add tooltips
This patch adds an info-tooltip to the field rules in the table header
to expand on their meaning to reduce the need to read the documentation
each time you come to use the configuration tool
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Fri, 26 Mar 2021 16:31:39 +0000 (16:31 +0000)]
Bug 14957: (QA follow-up) Button styling
This patch updates the action buttons to include btn-default and
switched from btn-sm to btn-xs to match other similar UI's found in
datatable based admin pages.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 14957: fix context for batchmod and batchimport
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Aleisha Amohia [Wed, 10 Feb 2021 03:49:16 +0000 (16:49 +1300)]
Bug 14957: Updated schema files
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Bug 14957: Merge rules system for merging of MARC records
Add a rule based system for merging MARC records to for example
prevent field data from being overwritten.
To test:
1. Apply this patch.
2. Log in to staff client.
3. Enable new syspref MARCMergeRules.
4. Click the new link "MARC merge rules" in the "Catalog"
section of the Koha administration page.
5. Create a new rule:
Module: source, Filter: *, Tag: 245, Preset: Protect.
6. Clicking "Edit" should allow you to edit corresponding rule.
7. Clicking "Delete" should remove corresponding rule after confirmation.
8. Selecting one or more rules followed by clicking "Delete
selected" should remove all selected rules after confirmation.
9. Try creating a rule with tag set to "**", the other options does
not matter. Verify that saving this rule produces an error
message complaining about invalid tag regular expression.
10. Try creating a rule with tag set to "008" (or other control
field) and set Appended: Append and Removed: Skip, the other
options does not matter. Verify that saving this rule produces
an error message complaining about invalid combination of actions
for control field.
11. With the 245 rule in step 5 in place, edit a bibliographic record,
change 245a for example (which should be Title for MARC21) and save.
12. Verify that the changes has not been saved.
13. Create a new rule:
Module: source, Filter: intranet, Tag: 245, Preset: Overwrite.
14. Repeat step 12, and verify that the changes has now been saved.
15. Run tests in t/db_dependent/Biblio/MarcMergeRules.t and very
that all tests pass.
Sponsored-by: Halland County Library Sponsored-by: Catalyst IT Sponsored-by: Gothenburg University Library Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Tue, 26 Oct 2021 09:48:11 +0000 (10:48 +0100)]
Bug 11175: (QA follow-up) Restore bug 29284
This patch restores the functional fixes introduced in bug 29284 and
also prevents the 'Show analytics' link from displaying when no
component parts are found and inline display is enabled.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: Fixed error with $err vs $error(s) :)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Marcel de Rooy [Sun, 24 Oct 2021 12:11:02 +0000 (12:11 +0000)]
Bug 11175: (QA follow-up) Do not fetch twice
We were fetching components in the first call of XSLTParse4Display
(opac-detail around L220). And again (opac-detail around L660).
Same for catalogue/detail.pl.
Moving the XSLT block in both scripts and removing the code from
XSLT.pm which again makes the tests obsolete.
Not hiding the link when there are components. Might be helpful too.
Also fixing biblionumber in the XSLTParse4Display call for parts.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Mon, 18 Oct 2021 15:14:07 +0000 (16:14 +0100)]
Bug 11175: (QA follow-up) Be more specific with title fields
We were using the MARC::Record title accessor, but that just stringifies
all the subfields of field 245. The indexer, and the XSLT, specifically
use 245a so we need to do the same.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Tue, 12 Oct 2021 09:31:47 +0000 (10:31 +0100)]
Bug 11175: (QA follow-up) Display components tab if no holdings
This patch updates the default details tab selection to components for
the case when there are no holdings attached to the record and there is
no HTML5 content to display in preference.
Bug 11175: (QA follow-up) OPAC - Display components tab if no holdings
As for the staff client, this selects the default tab to be 'Components'
for the case where no holdings are found.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Tue, 12 Oct 2021 08:49:34 +0000 (09:49 +0100)]
Bug 11175: (QA follow-up) Account for difference in simple_search return
Thanks to a comment from Andrew, I discovered that the return from
simple_search_compat actually differs depending on if you are using
ElasticSearch or Zebra. The 'results' arrayref contains MARC::Record
objects for ES and raw marc strings if you are using Zebra. This is
actually already dealt with in the misnamed new_record_from_zebra
function inside C4::Search.. so this patch simply replaces our
MARC::Record instantiation code with a call to that function.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Wed, 1 Sep 2021 15:16:33 +0000 (16:16 +0100)]
Bug 11175: (follow-up) Use clean_search_term
This patch uses the now public clean_search_term from bug 28316 to
sanitize the title string and prevent crashes in elastic search when
title contain reserved characters.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Mon, 9 Aug 2021 07:30:12 +0000 (08:30 +0100)]
Bug 11175: Display components in own tab
This patch updates the display so that rather than displaying the
components using the main XSLT and then using CSS to move them into a
box on the right side for display, which causes issues with RTL records;
We instead add them in a new tab beneath the rest of the record details
alongside holdings and other details.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com>
Bug 11175: (QA follow-up) Fixes for bug 12561
Bug 12561 changed the prototype for XSLTParse4Display so this patcha
accounts for the additional calls to that method introduced in this
patchset.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Fri, 6 Aug 2021 16:01:38 +0000 (17:01 +0100)]
Bug 11175: (QA follow-up) Fix queries
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Fri, 6 Aug 2021 12:00:29 +0000 (13:00 +0100)]
Bug 11175: (QA follow-up) Only get biblio once
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This patch removes Koha::Util::Search in preference to embedding the
search query builder in Koha::Biblio as get_analytics_query.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com>
Bug 11175: (QA follow-up) Rename back to get_marc_components
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Tue, 3 Aug 2021 13:29:27 +0000 (14:29 +0100)]
Bug 11175: (QA follow-up) Take account of bug 15851
We can simplify the code introduced by bug 15851 by moving the
'show_analytics_link' variable assignment into C4::XSLT and thus making
the code more DRY.
Taking the code in bug 15851 as inspiration this patch also adds proper
handling for UseControlNumber vs EasyAnalytics style 773 linking and
ensures we only return analytic component parts and no other records
containing 773's.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Martin Renvoize [Tue, 3 Aug 2021 08:03:13 +0000 (09:03 +0100)]
Bug 11175: (QA follow-up) Move preference to 'Display'
The 'ShowComponentRecords' preference was displaying under the 'Export'
section in the cataloging system preferences tab. As a display related
feature, I felt it was more appropriate to put it into the 'Display'
section.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
For consistency with other marc data accessor methods rename the new
'components' method to 'get_marc_components'.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Petro Vashchuk [Tue, 27 Apr 2021 09:50:56 +0000 (12:50 +0300)]
Bug 11175: (follow-up) make atomic update idempotent
Atomic update tries to insert line into system preferences even if it's
already there. This patch fixes that by adding 'IGNORE' to the query,
making it idempotent.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Joonas Kylmälä [Wed, 10 Jun 2020 17:21:46 +0000 (20:21 +0300)]
Bug 11175: (follow-up) Add tests
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Joonas Kylmälä [Tue, 24 Nov 2020 17:19:04 +0000 (19:19 +0200)]
Bug 11175: Search using double quotes to support Elasticsearch
With Elasticsearch if you would use the search string here without the
change to double quotes, i.e.
(rcn='1234' AND cni='FI-XXX') OR rcn='FI-XXX 1234'
then the search would somehow manage to return a record with 001 =
1234 and 003 = FI-XXX. Using double quotes prevents that. Also using
parenthesis around the latter part of the OR seems to work:
(rcn='1234' AND cni='FI-XXX') OR (rcn='FI-XXX 1234')
Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Joonas Kylmälä [Fri, 13 Nov 2020 17:52:18 +0000 (19:52 +0200)]
Bug 11175: Limit the amount of component parts returned
There was already before this a limit of 100 results when using
Elasticsearch but then the list of component parts was truncated
silently. This change now limits the amount to hard coded limit of 300
which is still fast to render. Also when the 300 component part record
limit is reached there is a link in the list now to list all the
records via the cataloging search.
To test:
1) Create 300+ component part records and see if the link to list
all the component part records shows up
2) Make sure prove t/Koha/Util/Search.t passes
Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com>
Bug 11175: (QA follow-up) Replace en dash with hyphen in perldoc
This fixes the QA tool failure.
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Joonas Kylmälä [Fri, 13 Nov 2020 17:08:17 +0000 (19:08 +0200)]
Bug 11175: Keep component part record list items inside the box
Without this the number denoting the component part item in the list
will overflow and is partly hidden.
To test:
1) Create 100 component parts
2) Notice without this patch the number next to the component part is
not fully shown
Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nick Clemens [Mon, 2 Nov 2020 14:59:33 +0000 (14:59 +0000)]
Bug 11175: Add Elasticsearch support
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Joonas Kylmälä [Mon, 2 Nov 2020 15:24:39 +0000 (17:24 +0200)]
Bug 11175: (follow-up) Relocate and reword ShowComponentRecords syspref description
The syspref is not only affecting staff interface so moving it to
Cataloguing section. Added also notes about UNIMARC and Elasticsearch
not being supported.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Joonas Kylmälä [Wed, 10 Jun 2020 17:20:19 +0000 (20:20 +0300)]
Bug 11175: (follow-up) Return empty array if no components
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This would create in list context an list of one element that is
undef, which we don't want, we want empty list if there are no
components.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pasi Kallinen [Mon, 20 Aug 2018 06:51:55 +0000 (09:51 +0300)]
Bug 11175: Show record component parts in the detail view
Shows the component records of a host, on the hosts detail view in
staff client or OPAC, with clickable links to the component records.
The host does not require linking entries to the components, but
components do require a link to the host record via 773$w.
Adds a new search index, Control-number-identifier (aka cni), which
indexes the 003 controlfield.
Adds 'Yet Another System Preference', ShowComponentRecords, which can
be used to turn this feature on or off in staff client and/or OPAC,
and defaults to off.
When looking up the component part records, the code searches for
records with (773$w=Host001 and 003=Host003) or 773$w='Host003 Host001'
or, if the 003 is not defined in the Host, 773$w=Host001.
Does not use easyanalytics or useControlNumber.
Only for MARC21 biblios - UNIMARC has not been updated.
staff-global.css and opac.css have not been recreated, so you need
to use sass to recreate those from staff-global.scss and opac.scss
Test plan:
0) Apply patch
1) perl bulkmarcimport -file /tmp/easypiano.mrc -m MARCXML
(This file is an attachment on the bug)
2) rebuild the zebra biblio index
3) Search for "easy piano" in staff client, and go to
the biblio detail page. You should not see anything different
in the record detail page.
4) Do the same on OPAC.
5) Change the ShowComponentRecords syspref appropriately and check
the record detail page in staff client and OPAC.
You should see a list of component part records.
Rebased-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Pasi Kallinen <pasi.kallinen@koha-suomi.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Andrew Nugged <nugged@gmail.com>
JD amended path
- if ($xslsyspref =~ m/Details/) {
+ if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" ) {
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Jonathan Druart [Tue, 26 Oct 2021 10:20:54 +0000 (12:20 +0200)]
Bug 19185: Fix regressions.t
The following test is failing:
| # Failed test 'OPAC - Remove from cart'
| # at t/db_dependent/selenium/regressions.t line 132.
| Can't call method "get_value" on an undefined value at t/db_dependent/selenium/regressions.t line 110.
| # Looks like your test exited with 2 just after 3.
| [12:14:08] t/db_dependent/selenium/regressions.t
We are dependind on the search engine and the records in the DB but the
installer is not inserting any records.
This patch is suggesting to reuse the code from search_utf8
(and so make it reusable first) for remove_from_cart test.
This code is mocking the Zebra index with some MARC data and so the
search will return results. We will finally be able to click on the
add to/remove from cart links.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>