Nick [Thu, 10 Oct 2019 16:06:08 +0000 (16:06 +0000)]
Bug 23089: Fix sorting on sum and regular fields
As of bug 20589 we no longer analyze sort fields and so we no longer need to append ".phrase"
to our sort in searches.
Additionally, sort fields based on 'sum' should also use sum in building the value to sort on
To test:
0 - Be using ES
1 - Find the most circulated item in your collection
2 - Search for '*'
3 - Sort by popularity DESC
4 - Note that item is not first
5 - Try to sort by anything but relevancy, it fails
6 - Apply patch
7 - Redo searches and sorts
8 - Things should now work as expected
Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
MariaDB and MySQL support different syntaxes for CHECK constraints at
different versions. To remove complexities in the updatedatabase script
I have opted to remove all CHECK constraints entirely.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Katrin Fischer [Thu, 10 Oct 2019 12:53:10 +0000 (12:53 +0000)]
Bug 22814: Make patron names on holds modal consistent (second check-in)
Bug 22203 changed the behavior on the hold-found2 modal
that pops up when a hold is found so that whether or not
the patron's name is displayed is now governed by the
HidePatronName system preference.
However, if a hold is confirmed and you check the item
in a second time, the modal that pops up is hold-found1
and whether or not the patron's name is displayed in
the hold-found1 modal is not governed by the HidePatronName
system preference.
For the sake of consistency, the display of the patron's
name on hold-found2 and hold-found1 should both be governed
by the HidePatronName system preference.
To test:
- Place a hold on an item
- Check in the item to trigger the hold modal
- Confirm hold
- Check the item in again - verify name of patron displays
- Apply patch
- Repeat
- Verify name display now matches between the two modals
- change HidePatronName pref
- Repeat
- Name display should still match
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
The /cities endpoint is refered in several places as the reference
implementation of a route for devs to pick it for copy and pasting. Yet,
it is outdated in terms of how the tests are written.
This patch rewrites some bits so it uses BASIC auth and the built-ins
Test::Mojo provides.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Thu, 6 Jun 2019 19:35:10 +0000 (15:35 -0400)]
Bug 23068: Add ability for Koha to handle X-Forwarded-For headers so REMOTE_ADDR features work behind a proxy
Koha has a number of features that rely on knowing the IP address of the connecting client. If that server is behind a proxy these features do not work.
This patch adds a module to automatically convert the X-Forwarded-For header into the REMOTE_ADDR environment variable for both CGI and Plack processes.
TEST PLAN:
1) Apply this patch set
2) Install Plack::Middleware::RealIP via cpanm or your favorite utility
3) Update your plack.psgi with the changes you find in this patch set ( this process differs based on your testing environment )
4) Restart plack
5) Tail the plack error log for your instance
6) Use curl to access the OPAC, adding an X-Forwarded-For header: curl --header "X-Forwarded-For: 32.32.32.32" http://127.0.0.1:8080
7) Note the logs output this address if you are unproxied
8) If you are proxied, restart plack using a command like below, where the ip you see in the logs ("REAL IP) is what you put in the koha conf:
<koha_trusted_proxies>172.22.0.1 1.1.1.1</koha_trusted_proxies>
9) Restart all the things!
10) Repeat step 6
11) You should now see "REAL IP: 32.32.32.32" in the plack logs as the remote address in your plack-error.log logs!
12) Disable plack so you are running in cgi mode, repeat step 6 again
13) You should see "REAL IP: 32.32.32.32" as the remove address in your opac-error.log logs!
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Ed Veal <eveal@mckinneytexas.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Owen Leonard [Fri, 25 Oct 2019 18:41:34 +0000 (18:41 +0000)]
Bug 23903: Replace OPAC icons with Font Awesome
This patch replaces CSS-based background image icons with Font Awesome
icons. This will eliminate the use of sprite.png altogether.
To test, apply the patch and regenerate the OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).
Because JavaScript events are often triggered by class, the changes made
in this patch require testing of JavaScript-driven behavior as well as
visual confirmation of the changes.
Enable OPAC features to expose them for testing: Login, Holds, Article
requests, Tags, Cart, Search term highlighting.
- Perform a search in the OPAC
- In the header at the top of the search results, check the
'Unhighlight/Highlight' link.
- Select some search results and verify that the multi-item controls
are enabled: Add to cart/Lists; Place hold; Tag. Check that these
controls work correctly.
- Verify that the following links look correct and work correctly:
'Place hold,' 'Request article,' 'Log in to add tags,' 'Add to
cart.'
- Log in to the OPAC and return to the search results page. Check the
'Add tag' and 'Save to lists' links.
- View the lists page
- Test the 'Edit' and 'Delete' controls.
- View the contents of a list. Test the following:
- Controls at the top of the table of results ('New list,'
'Download list,' 'Send list,' 'Print list,' 'Edit list,' and
'Delete list').
- Multi-selection operations: 'Place hold,' 'Tag,' and 'Remove
from list.'
- Controls for each item on the list: 'Place hold,' 'Add tag,'
'Save to another list,' 'Remove from this list,' and 'Add to
cart.'
- View the bibliographic detail page for any search result
- In the right-hand sidebar menu, verify that these controls look
correct and work correctly: 'Place hold,' 'Print,' 'Request
article,' 'Save to your lists,' 'Add to your cart,'
'Unhighlight,' 'Send to device,' 'Save record,' and 'More
searches.'
- Test the shelf browser by clicking 'Browse shelf' under the call
number for any of the holdings.
- Test the 'Next' and 'Previous' controls.
- Check the tabs for switching between 'Normal,' 'MARC,' and 'ISBD'
views and verify that they look correct on each of those pages.
- Add some items to the Cart and open the Cart
- Test the cart controls at the top: 'More details/Brief display,'
'Send,' 'Download,' 'Empty and close,' 'Hide window,' 'Print.'
- Test the multiple-selection controls: 'Remove,' 'Add to list,'
'Place hold,' and 'Tag.'
- Log in to the OPAC as a user who has items checked out which can be
renewed. On the 'Your summary' page, on the 'Checked out' tab, test
the 'Renew selected' and 'Renew all' links.
Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 14697: (QA follow-up) Organize tests in subtests
This patch organizes the tests better, and adds some more.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 14697: Make controller methods rely on the stashed user
This patch adjusts the return values and HTTP status codes, as well as
removing the use of C4::Context->userenv. It also makes the date
calculation happen on the DB engine in the case of resolving the claim.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 14697: (follow-up) Rely on the UNIQUE constraint and return 409 for issue_id
This patch avoids querying the DB for an already existing
Koha::Checkouts::ReturnClaim with the same issue_id, now that there's a
UNIQUE constraint on it.
Also, 409 should be returned instead. Tests added for this changes.
To test:
- Apply this patch
- Run:
$ kshell
k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: tests pass!
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Tue, 29 Oct 2019 15:32:15 +0000 (12:32 -0300)]
Bug 14697: Schema updates
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Tue, 29 Oct 2019 15:29:54 +0000 (12:29 -0300)]
Bug 14697: Enhance the return claims feature
This adds a "Claims returned" feature that extends and enhances the claims returned lost status.
To use this feature, a new LOST status to represent an item claimed as returned needs to be created.
The value of this LOST authorised value should be set in the new syspref ClaimReturnedLostValue.
Setting this system preference turns on the feature.
Once the feature is enabled, you should be able to mark checked out items as return claims from the
checkout and patron details pages, and also modify them from the new claims tab on those pages.
Returning a claimed item will notify the librarian that the item in question has a claim on it.
Setting the ClaimReturnedWarningThreshold will add an alert to make librarians aware that this
patron has many return claims on the patron's record.
Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim
Sponsored-by: North Central Regional Library System Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Tue, 29 Oct 2019 15:29:37 +0000 (12:29 -0300)]
Bug 14697: Add routes to handle return claims
This patch adds the /return_claims route to add new return claims, and
then routes to updates notes and the resolution code.
To test:
1. Apply this patches
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Tue, 29 Oct 2019 15:28:53 +0000 (12:28 -0300)]
Bug 14697: Add Koha::Patron->return_claims
Adds the ability to get a list of a patron's return claims directly
from the Patron object.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Tue, 29 Oct 2019 15:28:36 +0000 (12:28 -0300)]
Bug 14697: Add Koha::Checkout->claim_returned
Adds the ability to generate a return claim from a Checkout object.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Tue, 29 Oct 2019 15:28:24 +0000 (12:28 -0300)]
Bug 14697: Add return claim handling to AddReturn
This adds the ability to alert a librarian of an item claimed as returned is actually returned.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This patch introduces the Koha::Object(s)-derived classes for handling
return claims. Tests are added to cover the overloaded ->store method,
and domain-specific exceptions are added as well.
To test:
1. Apply this patches
2. Run:
$ kshell
k$ prove t/db_dependent/Koha/Checkouts/ReturnClaim.t
=> SUCCESS: Tests pass!
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Fri, 22 Feb 2019 14:40:35 +0000 (09:40 -0500)]
Bug 14697: Add new schema file
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Kyle M Hall [Fri, 22 Feb 2019 13:46:34 +0000 (08:46 -0500)]
Bug 14697: Update database
This patch introduces the new table and related sysprefs.
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
prev_open_days can receive either positive or negative numbers and
then does the right thing with them. However, we weren't also doing this
with the number it receives back from get_push_amt
Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Andrew Isherwood [Fri, 12 Apr 2019 11:31:31 +0000 (12:31 +0100)]
Bug 15260: (follow-up) Fix misnamed variable
This was causing the amount to push by to be incorrectly calculated
Sponsored-by: Cheshire West and Chester Council Sponsored-by: Cheshire East Council Sponsored-by: Newcastle City Council Sponsored-by: Sefton Council Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Andrew Isherwood [Tue, 26 Mar 2019 14:43:34 +0000 (14:43 +0000)]
Bug 15260: Fix calculation of add amount
In a sequence of closed days, we should take into account the nature
of each closed day as we encounter it in order to calculate the amount
to add to reach the next potential closed date. We are now doing this.
Sponsored-by: Cheshire West and Chester Council Sponsored-by: Cheshire East Council Sponsored-by: Newcastle City Council Sponsored-by: Sefton Council Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This patch adds unit tests of the CalcDueDate function to ensure that
the useDaysMode "Dayweek" mode works as expected
Sponsored-by: Cheshire West and Chester Council Sponsored-by: Cheshire East Council Sponsored-by: Newcastle City Council Sponsored-by: Sefton Council Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This patch will, when appropriate, roll due dates forward by full weeks,
rather than single days.
Sponsored-by: Cheshire West and Chester Council Sponsored-by: Cheshire East Council Sponsored-by: Newcastle City Council Sponsored-by: Sefton Council Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
We require next_open_day & prev_open_day to be more flexible. We could
create a separate sub, but that's not very DRY given that they'll do
pretty much the same thing.
So next_open_day becomes next_open_days and prev_open_day becomes
prev_open_days and both functions accept an additional parameter which
determines how many days they add or subtract.
All calls of these two functions have been modified accordingly.
Sponsored-by: Cheshire West and Chester Council Sponsored-by: Cheshire East Council Sponsored-by: Newcastle City Council Sponsored-by: Sefton Council Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Sponsored-by: Cheshire West and Chester Council Sponsored-by: Cheshire East Council Sponsored-by: Newcastle City Council Sponsored-by: Sefton Council Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Andrew Isherwood [Thu, 31 Jan 2019 15:36:52 +0000 (15:36 +0000)]
Bug 15260: Add new useDaysMode option "Dayweek"
This patch adds a new "Dayweek" option to the useDaysMode syspref, it
has the description: "the calendar to push the due date to the next open
day on the same weekday".
Sponsored-by: Cheshire West and Chester Council Sponsored-by: Cheshire East Council Sponsored-by: Newcastle City Council Sponsored-by: Sefton Council Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Tue, 22 Oct 2019 12:57:42 +0000 (13:57 +0100)]
Bug 23866: Prompt for HEA configuration
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Thu, 31 Oct 2019 10:11:07 +0000 (10:11 +0000)]
Bug 22706: (RM follow-up) Remove use of Koha::Plugins::Handler
Using both Koha::Plugins and Koha::Plugins::Handler inside the same
class causes issues for runtime module loading which in turn caused all
the plugins tests to fail.
This patch converts this patchset to use the direct call style used
elsewhere in Koha removing the need for Koha::Plugins::Handler.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This patchset introduces a route to fetch items. It relies on the
already implemented code/mappings to get a single item.
To test:
- Apply this patches
- Run:
$ kshell
k$ prove t/db_dependent/api/v1/items.t
=> SUCCESS: Tests pass!
- Try the endpoint with your favourite API tool (Postman?)
- Sign off :-D
Note: to do exact searching on barcode, you need to build the query like
this:
GET /api/v1/items?external_id=<your_barcode>&_match=exact
Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Magnus Enger [Wed, 24 Apr 2019 12:59:03 +0000 (14:59 +0200)]
Bug 22706: Add plugin hooks for Norwegian national patron database
The main point of this patch is to make it possible to integrate Koha
with the Norwegian national patron database (NNPDB). Code for this was
earlier introduced in Bug 11401 and removed again in Bug 21068.
To test this is mainly a question of spotting regressions, it should
still be possible to set and change a password in all possible ways:
- Setting a password for a new user
- Changing a password in the staff client
- Changing a password in the OPAC
If these work as expected, everything should be OK.
A nice side effect of this work is that it will allow for plugins that
validate passwords. I have created a tiny plugin that enforces PIN
codes of 4 digits. (Yeah, I know, those are the worst passwords, but
some libraries do require them.) It is published here:
https://github.com/Libriotech/koha-plugin-pin
To test this way, install the plugin and try to change the password
of an exsisting user to something that is not a 4 digit PIN. You
should get an error that says "The password was rejected by a plugin".
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Updated 2019-10-23:
- Moved the plugin checks to before the call to $self->SUPER::store to
make sure patrons are not saved if the password fails a plugin check
- Made the plugin checks in set_password respect skip_validation while
retaining the functionality for NNPDB
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
caroline [Mon, 21 Oct 2019 14:25:55 +0000 (10:25 -0400)]
Bug 23853: Typo in authorised_values.tt
This patch corrects the Bsort1 typo in authorised_values.tt and changes the Bsort2 description to match Bsort1's.
To test:
1- Go to Administration > Authorised values
2- Make sure descriptions for Bsort1 and Bsort2 match their category and are the same (except for 1 and 2)
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nick [Sat, 21 Sep 2019 11:33:47 +0000 (11:33 +0000)]
Bug 23663: Only process itemtype summary if using non-xslt opac results
To test:
1 - Set OpacXSLTResultsDisplay to "" to use non-xslt view
2 - In Administration->Itemtypes define a summary for an itemtype:
This is the summary for [245a]
3 - Perform a search on the opac that will return results with this itemtype
4 - Note "This is the summary" appears in results with the title
5 - Set OPACXSLTResultsDisplay to 'default'
6 - Refresh your search results, note the summary disappears
7 - Try search in other places and note that summary never appears
8 - Apply patch
9 - Repeat 1-7 and note nothing changed
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Fridolin Somers [Thu, 8 Jun 2017 14:22:55 +0000 (16:22 +0200)]
Bug 18757: Problem when importing only items in MARC records
When importing records with Stage MARC records for import, one can use matching rules to only import items into existing records.
Those imported items are stored as XML to be staged.
The bug is that when MARC Flavour is UNIMARC the XML serialization fails because its is looking in field 100$a which does not exist.
You see in logs the error : Unsupported UNIMARC character encoding [] for XML output for UNIMARC; 100$a
This patch adds the format "USMARC" to XML serialization, like in C4::Items::_get_unlinked_subfields_xml
Test plan :
- On a UNIMARC database
- Define a maching rule on title 200$a
- Select a record with items
- Export it using : Save as > MARC (Unicode/UTF-8)
- Delete all items
- Go to Tools > Stage MARC records for import
- Upload exported file
- Select title matching rule
- Select "Ingore incoming record" in "Action if matching record found :"
- Select Yes and "Always add items" in "Check for embedded item record data?"
- Click Stage for import
=> Without patch you get the error
=> With patch the import is staged
- Import into the catalog and check item is well recreated
Signed-off-by: Amandine Zocca <azocca@ville-montauban.fr> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 23630: Do not remove field 999 in Elasticsearch indexing
Elasticsearch indexing uses 999$c to store record id by deleting the all field first !
So you can not store anything in field 999, even in UNIMARC and even in authorities records.
Looks like it is quick fix code added to start Elasticsearch use.
This behavior is disturbing and very strange for UNIMARC flavour.
This patch corrects by defining record ids mandatory in Koha::SearchEngine::Elasticsearch::Indexer::update_index().
This ids array is actually always given (except in UT).
I think it is useless to allow adding a record without its id.
Test plan :
1) Use Elasticsearch as SearchEngine
2) Create a subfield 999$z in default framework
3) Create a record with default framework
4) Enter a random string (never used in catalog) like "tototata" in 999$z
5) In Search engine configuration, define search field "subject" for 999$z
6) Rebuild record : misc/search_tools/rebuild_elasticsearch.pl -b -bn <biblionumber> -v
7) Search for the random string => You get a result
8) Optionnaly look at records in ES : <es server>:9200/<es index name>/data/<biblionumber>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nick Clemens [Thu, 2 May 2019 10:21:36 +0000 (10:21 +0000)]
Bug 22826: Allow indexing of individual authorities in Elasticsearch
To test:
1 - perl misc/search_tools/rebuild_elastic_search.pl -h
2 - Note it indicates the bn option can be passed to index individual authids
3 - perl misc/search_tools/rebuild_elastic_search.pl -a -bn 92 -v
4 - Note the error
5 - Apply patch
6 - perl misc/search_tools/rebuild_elastic_search.pl -h
7 - Note new option ai|authid for indexing individual authids
8 - Note updated text for bn|biblionumber option
9 - perl misc/search_tools/rebuild_elastic_search.pl -a -bn 92 -v
10 - No errors, but no records indexed
11 - perl misc/search_tools/rebuild_elastic_search.pl -a -ai 92 -v
12 - 1 record indexed
13 - perl misc/search_tools/rebuild_elastic_search.pl -ai 92 -bn 92 -v
14 - 1 authority record and 1 biblio record indexed
Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Mark Tompsett [Fri, 12 Jul 2019 01:30:47 +0000 (01:30 +0000)]
Bug 23310: Reduce noise in Koha::Biblio
The use of uninitialized value flooding plack-error
can get rather distracting and annoying.
By using "// q{}" after each of the subfield() calls
this eliminates the problem
TEST PLAN
---------
vertical break where you stop your cut-and-paste.
This test should be repeatable with cut-and-paste
easily.
restart_all
kshell
prove t/db_dependent/Koha/Biblio.t
-- may strangely be quiet.
prove t/db_dependent/Koha/Biblios.t t/db_dependent/Koha/Biblio.t
-- should be noisy.
prove t/db_dependent/Koha/Biblio.t
-- will always be noisy now.
exit
git bz apply 23310
restart_all
kshell
prove t/db_dependent/Koha/Biblio.t
-- will be quiet.
prove t/db_dependent/Koha/Biblios.t t/db_dependent/Koha/Biblio.t
-- will be quiet.
prove t/db_dependent/Koha/Biblio.t
-- will be quiet.
qa -v 2 -c 1
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 23858: Make POST add the Location header on vendors endpoint
According to the coding guidelines, this endpoint should be adding the
Location header on POST actions.
To test:
1. Apply the tests patch
2. Run:
$ kshell
k$ prove t/db_dependent/api/v1/acquisitions_vendors.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat (1)
=> SUCCESS: Tests pass!
5. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Owen Leonard [Fri, 4 Oct 2019 15:00:19 +0000 (15:00 +0000)]
Bug 22114: Untranslatable "Patron note:" in checkout.js
This patch modifies JavaScript used in circulation, replacing an
untranslatable English string in the script with a variable defined in
strings.inc which can be translated.
To test you should have the AllowCheckoutNotes system preference
enabled.
- Apply the patch and log in to the OPAC as a user who has two or more
items checked out.
- From the list of checkouts on the "Your summary" page, add a note to
two or more checked-out items.
- Log in to the staff client and open the checkout page for that user.
- In the table of checkouts, check the "Check in" checkbox next to
one of the titles you added a note to.
- Click "Renew or check in selected items."
- A message should appear in that table row showing your note,
prefixed with the text "Patron note:"
To test translation, update and install the de-DE template:
- Go to Administration -> System preferences and enable the "Deutsch
(de-DE)" language under I18N/L10N preferences -> language.
- Switch to the "Deutsch" translation.
- Go to Ausleihe (Circulation) and check out to the same patron.
- In the table of checkouts, check the checkbox in the "Rückgabe"
column next to another title you added a note to.
- Click the "Markierte Exemplare zurückgeben oder verlängern" button.
- A message should appear in that table row showing your note
prefixed with the text "Benutzernotizen:"
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Alex Arnaud [Thu, 9 May 2019 12:39:51 +0000 (12:39 +0000)]
Bug 22874: Use false instead of 0 value for limiting on availability
Test plan
- Set up a elasticsearch 6 instance to work with Koha,
- you may need to make koha works with ES 6 (see bug 20589),
- make a search and limit it to available items only,
=> no result
- Apply this patch,
- make a search and limit it to available items only,
- you should get some results
- Do the same with ES 5.x
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Test plan is hard to provide for such a simple and obvious change. I
would recommend you to read the previous commit and confirm that the
change did not make sense.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Mon, 28 Oct 2019 12:18:04 +0000 (12:18 +0000)]
Bug 23382: (RM follow-up) Days of the week discrepancies
DateTime and C4::Calander have different notions of 'days of the week'.
DateTime days go from 1..7 (Mon..Sun) whilst C4::Calendar expects 0..6
(Sun..Sat). This patch adapts the holday setting in the tests to ensure
we work when testing Saturdays and Sundays.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Sat, 26 Oct 2019 10:58:18 +0000 (11:58 +0100)]
Bug 23655: Restore debian Jessie support
Bug 14570 inadveratntly introduced the use of selectall_array; A feature
that was introduced to DBI version 1.635 which is not available in
debian jessie at the time of writing.
This patch replaces the call with selectall_arrayref which is supported
and works with the rest of the existing code.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Jonathan Druart [Fri, 25 Oct 2019 13:28:49 +0000 (15:28 +0200)]
Bug 23382: Use floating time zone to prevent tests to fail because of DST
Today Friday Oct 25th, DST next Sunday => Date math are wrong, 96 hours
diff becomes 95.
To avoid that we use the floating timezone
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Fri, 25 Oct 2019 10:29:58 +0000 (11:29 +0100)]
Bug 23382: (follow-up) Ensure closed day is inside charge window
We're testing with an hourly loan of 96 hours to catch a closed day.
However, our closed day was hard coded to be a Wednesday so if you ran
the tests on a Friday the 96 hour loan would not catch a Wednesday.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Wed, 16 Oct 2019 12:10:43 +0000 (13:10 +0100)]
Bug 23382: hours_between should match the logic of days_between
The loops for subtraction holiday dates in hours_between and
days_between differed and as such their handling of start and end
boundaries for days also differed. This patch makes them handle the
boundary days consistently.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Wed, 16 Oct 2019 12:08:23 +0000 (13:08 +0100)]
Bug 23382: Truncate dates to minutes for comparison.
It's somewhat of a mess in C4::Circulation as to when dates are
truncated and when they are not and as such Koha::Charges::Fees could
not reliably assume that the dates passed in were consistent with each
other. As such, we take the approach of always truncating to the
greatest minute smaller than the passed in dates so we are comparing
like for like.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Wed, 16 Oct 2019 10:44:11 +0000 (11:44 +0100)]
Bug 23382: (follow-up) Further improve test coverage
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Wed, 2 Oct 2019 10:20:27 +0000 (11:20 +0100)]
Bug 23382: (follow-up) Ensure tests pass on Wednesdays
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Thu, 19 Sep 2019 13:48:45 +0000 (14:48 +0100)]
Bug 23382: (follow-up) Clarify variable names
This patch updates the variable name '$branch' to '$branchcode' in a
number of places to make it clearer what the variable contains.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Fri, 16 Aug 2019 07:32:55 +0000 (08:32 +0100)]
Bug 23382: Fix logic in C4::Circulation::CanBookBeIssued
It looks like over progressive rebases of bug 20912 a clause was lost
within CanBookBeIssued such that a fatal error may be triggered if an
item with no corresponding itemtype was passed into the routine.
Additionally the we were passing a Koha::Library object to CalcDateDue
rather than a branchcode which resulted in a different duedate being
used in 'CanBookBeIssued' when compared to 'AddIssue'.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Thu, 15 Aug 2019 13:57:08 +0000 (14:57 +0100)]
Bug 23382: Add hourly tests for Circulation
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Tue, 6 Aug 2019 14:23:39 +0000 (15:23 +0100)]
Bug 23382: Add tests for hourly calculations
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Martin Renvoize [Tue, 6 Aug 2019 13:38:28 +0000 (14:38 +0100)]
Bug 23382: Improve test coverage
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nick Clemens [Wed, 15 Feb 2017 16:34:04 +0000 (16:34 +0000)]
Bug 17168: Add a command line script for updating patron category based on status
This patch adds a new script update_patrons_category.pl which allows for
updating patron categories in a batch upon meeting provided criteria.
This script additionally can replace j2a.pl.
To test:
1 - perl update_patrons_category.pl -h
2 - Ensure help text makes sense and covers all options
3 - Test converting patrons supplying only fromcat and tocat
perl update_patrons_category.pl -f PT -t J -v --confirm
perl update_patrons_category.pl -f J -t PT -v --confirm
4 - All patrons should have been switched to and from Juveniles
5 - Try without --confirm switch
perl update_patrons_category.pl -f PT -t J -v
6 - Should list all patrons but not update
7 - Set the age for juvenile patrons to be outside the range provided in
categories (or set the upper age limit for juveniles to '2')
8 - Test with verbosity and with without --confirm
perl update_patrons_category.pl -f J -a -t PT -v
perl update_patrons_category.pl -f J -a -t PT -v --confirm
9 - Repeat above and verify linked/unlinked guarantors are removed in above scenario
10 - Test various fine and registration limits
11 - Test matching on specific fields i.e. --field surname=acosta
12 - Sign off
Sponsored by: Round Rock Public Library
(https://www.roundrocktexas.gov/departments/library/) Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>