The word "offset" is now a keyword. At the very least we need to escape the fieldname with backticks.
It would be nice to switch to Koha::Objects for this module eventually.
C4::Matcher::_store_matchpoint(): DBI Exception: DBD::mysql::st execute failed: You have an error in
your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax
to use near 'offset, length) VALUES ('27', '1', '999'...' at line 2 at /usr/share/koha/lib/C4/Matcher.pm
line 314
Test Plan:
1) Set up Koha with MariaDB 10.6
2) Attempt to create a matching rule
3) Note the error screen
4) Apply this patch
5) Restart all the things!
6) Attempt to create another matching rule
7) No errors this time
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch adds an exception to stash_embed that is thrown when we
find an x-koha-embed header that we're not expecting.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch adds unit tests to prove we return a 400 and an appropriate
error message when calling an endpoint that is not defined to support
x-koha-embed whilst passing an x-koha-embed header.
Test plan:
1) Run test prior to applying second patch and confirm it fails
2) Run test after applying second patch and confirm it passes
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch filters out non_priorty holds in the on_reserve condition.
Test plan
1) Run t/db_dependant/Holds.t
2) Note it fails without this patch
3) Apply patch
4) Re-run the above test, note it now passes
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Preventing:
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry 'ActionLogsTraceDepth' for key 'PRIMARY' at /usr/share/koha/C4/Installer.pm line 739
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
After the patch we fail on renewing a not for loan item with an item
level hold.
I don't find justification for why this should be renewable, so I just
change the test expectation
This needs another QA eye
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
introduced in:
73c3c5d2f1
Bug 31112: (QA follow-up) Reduce database queries
started from:
8ba1a9a534
Bug 31112: Remove unnecessary if-clause
Currently, you can renew the item even if someone already made an item level
hold on that item. This patch changes that, making it not possible to do so.
To reproduce:
1. Checkout an item, and make another item level hold on that specific item.
2. Renew it using the "Renew" checkbox, it should get renewed without any problems.
3. Apply the patch.
4. Checkbox should be gone and replaced with "On Hold" link that leads to the hold that doesn't allow you to renew the item again.
5. "Renew all" button should not work either.
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
To test:
1. Place some holds
2. Go to Circulation > Holds to pull
3. Notice there is not column to indicate collection ( CCODE )
4. Apply patch and restart services
5. Step 2 again, this time you should see a column for holds to pull
6. Using both the Columns button and via 'Table setting' attempt to hide the column and other columns. Ensure everything is being heiiden correctly.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 32421: (follow-up) Correct table settings
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Not needed for storage. You can always display pretty in the
interface (on a follow-up report).
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
It can be useful to know where in Koha a particular logged action was generated from, and how. We should add the ability to attach a syspref controlled basic stack trace with the caller depth controlled via the syspref. We can the call caller() until the specified depth has been reached.
Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
4) Restart all the things!
5) Set the new syspref ActionLogsTraceDepth to a number ( e.g. 3 )
6) Update a syspref or trigger another enabled log action
7) Query the database: SELECT * FROM action_logs WHERE trace IS NOT NULL
8) Note the stack trace was created!
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
If you have EmailOverduesNoEmail = Send and specify "--html somedir",
overdue_notices.pl will send a file by email that contains partial
HTML, as a file called attachment.txt. This patch fixes that.
To reproduce in koha-testing-docker:
- EmailOverduesNoEmail = Send
- Make sure you have a loan that was due yesterday, by backdating the
due date
- Set up an overdue action to send "Overdue Notice" (ODUE) to the
category you made the loan to above, when a loan is one day overdue
- Run this command:
$ sudo koha-shell -c "perl misc/cronjobs/overdue_notices.pl -v -t -html /tmp/" kohadev
- Look at the file /tmp/notices-<DATE>.html and make sure it is a full
HTML document, with <html>, <head>, <body> etc.
- Create a report like this:
SELECT message_id, letter_id, borrowernumber, subject, CONCAT( '<pre>', content, '</pre>' ) AS content,
metadata, letter_code, message_transport_type, time_queued, updated_on, to_address, content_type, failure_code
FROM message_queue
WHERE subject = 'Overdue Notices'
ORDER BY message_id DESC
- Run the report and verify there is a line like this in the "content"
of the newest message:
Content-Type: text/plain; name=attachment.txt
- A part of the "content" will be a block of several lines of gibberish
(base64) that look something like "RGVhciAga29oYSwNCg0KQWN...". Copy
this block of text to somewhere like base64decode.org and decode the
text. You should see a fragment of HTML, without <html>, <head>,
<body> etc.
To test:
- Apply the patch
- Run overdue_notices.pl again, with the same arguments as above
- Make sure /tmp/notices-<DATE>.html is still a full HTML document
- Re-run the report, and make sure you now have this in the "content":
Content-Type: text/html; name=attachment.html
- Decode the base64 and make sure it is now a full HTML document, with
<html>, <head>, <body> etc.
- Re-run overdue_notices.pl as above, but replace "-html /tmp/" with
"-csv /tmp/test.csv"
- Make sure /tmp/test.csv and the decoded base64 from the report
contains CSV data
- Re-run overdue_notices.pl as above, but replace "-html /tmp/" with
"-text /tmp/"
- Make sure /tmp/notices-<DATE>.txt and the decoded base64 from the
report contains no HTML
Note:
- The actual text from the different messages will be enclosed in
<pre>-tags
- If you have HTML in your ODUE message template and run with -v, you
will have warnings saying "The following terms were not matched and
replaced"
These are due to Bug 14347, and are not adressed by the current patch.
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
The message "No renewals allowed" is incorrect when it is too soon for renewal,
this patch adds a specific error message.
To test:
- Make sure the system preference SCOAllowCheckin is set to "allow"
- Go to Koha administration -> Circulation and fine rules
- Edit the rule for all items and change "No renewal before" to 1 and save.
- Check out an item to a borrower (for instance barcode 39999000000719 to the user koha with cardnumber 42).
- Go to self checkout (http://localhost:8080/cgi-bin/koha/sco/sco-main.pl)
- Log in as the user (koha/koha)
- Verify that the error message in the Renew column is "This item cannot yet be renewed."
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Alternative implementation outside sub new.
Test plan:
Run t/db_dependent/SIP/Message.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
The SIP patron status and information responses always return false foe "too many items lost". It would be reasonable to check the count of lost items still checked out to the patron and compare that to a threshold set in the sip config file. Though not all libraries operate in this way, it seems like a good and reasonable implementation as long is it is properly documented.
This patch adds the ability to set the SIP "too many items lost" flag
for a patron based on the number of lost checkouts the patron has where
the lost flag on those items is greater than the given flag value.
For example, one could specify that the flag be set if the patron has
more than 2 items checked out where itemlost is greater than 3.
By default the feature is disabled to retain the existing functionality.
If enabled, the default itemlost minimum flag value is 1 unless
specified.
Test Plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Message.t
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
While the basic editor is happy with an array of subfields it can
stuff into separate fields, the advanced editor needs to get a JS
string back from the authority lookup plugin, because it is going
to just add the whole thing as text. The string has to be HTML
entity encoded, both to not allow XSS and just to not break the
window, but it needs to then be unencoded before being inserted
into the editor.
Test plan:
1. Set the system preference EnableAdvancedCatalogingEditor to
Enable
2. Edit any Topical Term authority, and at the end of tag 150
subfield a, add & </script>
3. Cataloging - Advanced editor
4. Press return in the editor to get a new blank line, type 650
and press tab three times, then type Ctrl-Shift-L
5. Search for your modified authority, and click Choose
6. Verify that the tiny popup opened by the search window finished
its job and closed itself
7. Verify that your 650 now shows as "‡aAbduction &
</script>‡vDrama" rather than "‡aAbduction &
</script>‡vDrama."
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch adds optional support for using `:` as the modifier for
invoking the 'count' method for relations as discussed.
We retain support for `+` for backward compatability to prevent a
breaking change.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch makes GetAuthorisedValueDesc used cache keys match what we
discussed on the bug, which seems to have been lost on some rebase and
highlighted by failing tests.
I also add some more cache flushes.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This is theorical (caught when writting tests) but we need to deal with
it.
Can't call method "resources" on an undefined value at /kohadevbox/koha/Koha/BackgroundJob/CreateEHoldingsFromBiblios.pm line 94.
Test plan:
prove t/db_dependent/Koha/BackgroundJob/CreateEHoldingsFromBiblios.t
must return green
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch makes the current background jobs classes use the added
helpers in order to simplify them.
No behavior change is expected.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off by: Bob Bennhoff/AspenCat Team
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
To test:
1. Apply patch, updatedatabase, restart_all
2. Have a user with superlibrarian privileges ( User1 )
3. Have a user who has staff access and circulate privileges but is not a super librarian. ( User2 ) Make note of this users home library
4. Turn on the system preference 'CircSidebar'.
-MAIN log in ( auth.tt )
5. As User1, go to the main login screen and try logging in. You should be able to log in AND you should be able to properly chnage your branch BEFORE logging in.
6. As User2, to to the main login screnn amd try logging in. You should be able to but if you try and switch your libraray to anything beside the user's home branch it will not work. You will be logged in at your home branch.
7. For User2, set the new top level permission 'Allow staff to change logged in library (loggedinlibrary).
8. Now you should be able to successfully switch libraries before log in.
9. Turn the 'loggedinlibrary' permission back off for User2.
-AFTER log in-
10. With User1, click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'.
11. With User2, click on your name/branch in the top right. If you have 'UseCirculationDesks' on, you should see 'Set desk', otherwise you should see nothing.
12. Repeat step 7.
13. NOw if you click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'.
14. Repeat Step 9.
-CircSideBar-
15. With 'CircSideBar' turned on, go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup) with User1. You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'.
16. Try with User2 and you will not see a 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set desk' link.
17. Repeat step 7.
18. For with User2 you go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup). You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'.
19. Repeat step 9.
-Set library page-
20. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User1. You will see a dropdown for 'Set library'. Make sure you can change your library successfully.
21. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. You should NOT see see a dropdown for 'Set library'.
22. Repeat step 7.
23. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. Now you should see a dropdown for 'Set library'.
Signed-off by: Bob Bennhoff/AspenCat Team
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This trivial patch removes some wrongly hardcoded bits, and makes the
tests also clear the cache before and after being run.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This is using plain `$biblios->to_api` but as of bug 33080, the new
helper should be used instead. This patch fixes that.
To test:
1. Run:
$ ktd --shell
k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
On bug 33083 we introduce a better way to implement a reusable method
for the same functionality.
This patch just removes the one in `Koha::Biblios` and the result should
be the same as the one inherited from `Koha::Objects::Record::Collections` will be picked instead.
To test:
1. Run:
$ prove t/db_dependent/Koha/Biblios.t \
t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch adds an endpoint to list biblios
To test:
1. apply patch
2. enable basic auth
3. call to GET /api/v1/biblios with the following Accept headers:
* application/json
* application/marcxml+xml
* application/marc-in-json
* application/marc
* text/plain
4. notice how data changes with each Accept header
5. prove t/db_dependent/Koha/Biblios.t t/db_dependent/api/v1/biblios.t
6. sign off
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
To test:
1. Apply patch
2. prove t/db_dependent/Koha/Objects/Record/Collections.t
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
We can't rely on our cache flushing in either 'store' or 'delete'
triggers as t/lib/TestBuilder::build_object skips the Koha::Object store
and uses direct DB inserts in preference.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
We simply return early and empty if $value is not passed
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
We missed the flush on delete triggers for the various caches introduced
here.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
We missed a few places, namely the flushes, when renaming the cache
keys.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
We can rely on DBIC's get_dirty_columns to check if the descriptions
have changed, and set things for flushing without an extra DB query.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch adds caching to C4::Biblio::GetAuthorisedValueDesc for performance.
We cache each hash involved in the method use for description lookup and
we're careful to clear said caches appropraitely on changes.
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>
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Pick a biblio to modify, and modify it's marc record
4. Make a PUT request to /api/v1/biblios/:biblionumber with one of the following content type header
- application/marcxml+xml
- application/marc-in-json
- application/marc
5. Add the following header in the request 'x-framework-id: <framework id>'
5. Check that the biblio was modified
6. Sign off
Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
In Elasticsearch mappings table, in tabs for mappings we should add search field name in addition to label ; in order to find them when searching using DataTable search field. This is very useful when debugging.
Also the lines are sorting alphabetically by search field name.
So I propose to display name and label between parenthesis.
And also add label to the form in last line.
By default label equals name so I display label only if different from name.
Test plan :
1) Go to : Administration > Search engine configuration (Elasticsearch)
2) In first tabe edit a line to change label, for example : author => Auteur
3) Save
4) Go to second tab
5) Check you see a line with 'author (Auteur)' and lines with only name when label equals name
6) Look at last line (addition form)
7) Check you see in combobox : 'author (Auteur)' and lines with only name when label equals name
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This patch updates some templates in authorities, cataloging, and
circulation so that fieldsets with the "action" class are placed outside
the form's main fieldset.
To test, apply the patch and check the following pages to confirm that
changes to form structure look correct:
- Authorities -> Authority search -> Merge
- Catalog -> Search -> Merge records
- Catalog -> Bibliographic record details -> Edit -> Attach item
- Circulation -> Check out to patron -> Batch check out
- Circulation -> Overdues -> Sidebar filter
- Circulation -> Holds to pull -> Sidebar filter
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>