Commit graph

43874 commits

Author SHA1 Message Date
Andreas Roussos
3d1556dafa Bug 29571: (follow-up) Fix display of pending suggestions in acqui-home.tt
In addition to the Staff Client's home page, the number of pending
suggestions is also displayed in Home > Acquisitions. Currently,
these are only displayed if there are pending suggestions at the
logged in library. However, suggestions should always be displayed.

This follow-up patch fixes that, and also removes a template variable
(`suggestion`) that is no longer in use (removed as part of Bug 4331,
commit 70af459372).

Test plan:
1) Create a suggestion for Library A.
2) Go to Home > Acquisitions while logged in at Library B.
   Without this patch, nothing is displayed regarding suggestions.
3) Apply this patch. Notice how suggestion information is shown, like:
   "Manage suggestions: Library B: 0 / All libraries: 1"
   If you change the library to Library A, you should get:
   "Manage suggestions: Library A: 1"

Signed-off-by: Florian Bontemps <florian.bontemps@biblibre.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-03 20:58:36 -10:00
c4c2aa2e33 Bug 29571: Display all pending suggestions even if none from logged in library
The number of pending suggestions was only displayed if there are pending
suggestions at the logged in library.

Test plan:
Login at CPL
Create a suggestion (ASKED) for another library
=> Without this patch there is nothing on the mainpage
=> With this patch applied you will see info about pending suggestions:

"Suggestions pending approval: Centerville: 0 / All libraries: 1"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: ThibaudGLT <thibaud.guillot@biblibre.com>
Signed-off-by: Andreas Roussos <a.roussos@dataly.gr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-03 20:58:36 -10:00
ebb544dd91 Bug 29591: Add autorenew_checkouts column to preferences json
Bug 24476 added autorenew_checkouts as a borrower column, intending it to be able to be
hidden if a library was not using the feature.

When the column chooser was added, this column was not included.

To test:
1 - Search system preferences for "BorrowerUnwantedFields"
2 - Click the box to change the value
3 - "autorenew_checkouts" is not an option
4 - Confirm that you see the option to opt patron out of autorenewal when editing patron on staff side
5 - Apply patch and restart everythign
6 - Search for the syspref again
7 - Note that now you can select "autorenew_checkouts"
8 - Check the box and save
9 - Confirm the opt out option is no longer visible during patron editing

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-03 20:54:31 -10:00
55e16bef7f Bug 29729: Build a tr for each subscription
To test:
1 To to Reports > Serials > Serials subscriptions and run the report while selecting a branch without subscriptions.
2 Notice console error
3 If you run the report for a branch WITH subscriptions it works just fine.
4 Apply patch
5 Do 1 again, no console error and show no see 'No entries to show'
6 Make sure it also works when you have a few subscriptions for a branch as well

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-03 20:53:17 -10:00
319f80c457 Bug 29604: Compiled CSS
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-03 20:42:56 -10:00
71ea7b8ae7 Bug 29604: Dont add psuedo content to highlighted terms
To test:
1. Do a search for something where the search terms will be in the 505
   note.
2. Visit the OPAC detail page of the record.
3. The first occurance of the term highlighting will include the CSS
   pseduo element "→ ";
4. Apply patch
5. Do the stuff to regenerate the CSS
   (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface)
6. Do 1 & 2 again.
7. No weird psuedo element in the term highlighting

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-01-03 20:42:56 -10:00
ae7dff6546 Bug 29588: (bug 29478 follow-up) Make strings translatable
"or", "Yesterday", "Today" and "Tomorrow" are not translatable, we are
using __ when _ should be used (__ is for .js files only).

Test plan:
0. Apply the patch
1. cd misc/translator && perl translate update fr-FR
2. Edit misc/translator/po/fr-FR-staff-prog.po
Search for "or", "Yesterday", "Today" and "Tomorrow" and translate them
3. cd misc/translator && perl translate install fr-FR
4. Enable fr-FR (syspref 'language')
5. Edit a patron and an item and confirm that the flatpickr widget has
the strings correctly translated

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: ThibaudGLT <thibaud.guillot@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 21:10:07 -10:00
c9263fe32e Bug 29289: 'Show fines to guarantor' should have its own id on patron detail page
This patch adds an id attribute to the list item containing the "Show
fines to guarantor" information on the patron detail page in the staff
interface. This makes it consistent with the markup for the similar
"Show checkouts to guarantor" list item.

To test, apply the patch and view a patron's details in the staff
client. Inspect the source to confirm that the "Show fines to guarantor"
line has an id, "patron-privacy_guarantor_fines".

Alternatively, add this to the IntranetUserCSS system preference: #patron-privacy_guarantor_fines { background-color: pink; }

The line on the patron details page should be highlighted in pink.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 21:10:07 -10:00
fe6e054c59 Bug 29696: Preserve link to biblio when creating a suggestion
Caused by
  commit 586bed1319
  Bug 28941: Filter suggestion inputs at the OPAC

We are loosing the link with the biblio (suggestion.biblionumber)

Test plan:
At the OPAC, go to the detail page of a bibliographic record, click
"Suggest for purchase" and submit the form.
Without this patch the suggestion is created but the link to the
bibliographic record is lost
With this patch applied you should see that suggestions.biblionumber has
correctly been preserved

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 21:10:07 -10:00
e214d5e976 Bug 29696: Add tests
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 21:10:07 -10:00
401ce06ffe Bug 29436: ES mappings not saved if zebra is configured
The mappings must be editable even if ES is not turned on yet.

Using a separate array to store the errors as we are testing for $@ ||
@messages.

There is still something wrong that should be improve, but this patch
should be safe for backport.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 20:49:53 -10:00
fc690e8f84 Bug 29457: DBRev 21.12.00.003
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 20:44:15 -10:00
5004462377 Bug 29457: Generic warning at upgrade
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: Adding exec flag and two dots.
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 20:44:15 -10:00
f6d6aa3f65 Bug 29457: Pass context borrowernumber
This patch updates the call to cancel such that we pass the currently
logged in users borrowernumber instead of their userid.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 20:44:15 -10:00
8140017f8f Bug 26587: Use Koha::Cache::Memory::Lite
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 20:37:39 -10:00
Björn Nylén
0b31eef144 Bug 26587: Cache libraries in Koha/Template/Plugins/Branches.pm to improve performance
This patch caches the Koha::Library object in a hashmap in the Branches object (GetName, GetURL)
to avoid multiple database lookups while looping many items.

To test:
1. Have a biblio with many items (1000's).
2. View in staff (detail.pl) and opac (opac-detail.pl). Note how long it takes to load.
3. Apply patch.
4. Repeat 2. Note that pages load faster.

Sponsored-by: Lund University Library
JK: replaced tab indendation with spaces
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-21 20:37:39 -10:00
7bfba3740b Revert "Bug 29403: Fix api/v1/patrons.t"
This reverts commit bf9107074d.
2021-12-16 14:27:03 -10:00
a11ccd2d28 Revert "Bug 29403: Match the whole string"
This reverts commit 62652115dc.
2021-12-16 14:27:02 -10:00
dda19c7811 Revert "Bug 29403: Unit tests"
This reverts commit b09e3e99b7.
2021-12-16 14:26:53 -10:00
7c1b21de3e Bug 28377: (QA follow-up) .js files should use __()
As noted by QA, this bug contained uses of _() which is not correct in
include .js files [1].

[1] https://wiki.koha-community.org/wiki/Coding_Guidelines#JS5:_Enabling_translation_of_language_strings_in_linked_JavaScript

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
111f4af2e9 Bug 28377: (QA follow-up) Fallback error handling
The code only dealt with 404, this patch makes it have a fallback
message for failure codes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
ea8a246225 Bug 28377: (28937 follow-up) Flatpickr change
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
d9c0c85cf9 Bug 28377: (follow-up) Remove svc/hold/{resume|suspend}
This files are no longer used and thus removed. Their functionality is
already present on the API

POST   /holds/:hold_id/suspension
DELETE /holds/:hold_id/suspension

To test:
1. Apply this patch
2. Run:
   $ git grep 'hold/suspend'
   $ git grep 'hold/resume'
=> SUCCESS: No references to the scripts
3. 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: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
fab3f92cd0 Bug 28377: Use the API to suspend/resume holds
This patch makes the patron page (detail and circulation) use the API to
suspend/resume holds on the holds tab.

It previously used the old svc/ scripts we plan to replace.

To test
1. Have a patron with some holds
2. Play with suspending/resuming holds. Include the indefinite
   suspension.
=> SUCCESS: Everything works as usual
3. Apply this patch
4. Repeat 2
=> SUCCESS: Nothing changed, a soft breeze surprises you
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
65915fedff Bug 28481: (RM follow-up) formatting
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
e600418c6d Bug 28481: (QA follow-up) Set date to 23:59:59
This patch changes the fix from adding a day to setting the time to
23:59:59.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
7974ecbeab Bug 28481: Make 'to' date inclusive.
Test Plan:
1) Sell an item
2) Cash up to make the sale historical
3) Search "Older transactions" with both dates being the current date,
   click "Display" to search
4) Note you get no results
5) Apply the patch
6) You should now see your transaction

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
5bfe34a375 Bug 29575: (RM follow-up) remove HTML comments
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
29e3d3d7fe Bug 29575: (QA follow-up) Patron fields can be empty strings
We need to account for empty strings as well as 'null' values in the
patron data structure.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
0d35f38466 Bug 29575: (QA follow-up) Add JSDoc documentation
This patch adds some basic documentation for the $patron_to_html
function the patchset introduces.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
633d6d3e67 Bug 29575: Add $patron_to_html to render patron information in JS
This patch adds a re-usable javascript render function that accepts a
Koha REST api Patron object and outputs the HTML representation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
Petro Vashchuk
81bb6761a2 Bug 29669: fix uninitialized value warnings when XSLTParse4Display is called
Wrong key 'xsl_filename' is present in opac-tags.pl and shelves.pl
(the only places where it is used in the code even) instead of
'xsl_syspref' that is actually used and this is the cause of those
warnings.

Also added honeypot to check if other calls in same way happens.
Honeypot probably not needed, review when QA in the Community.

To reproduce (shelves.pl):
1) Prepare some test list with items or use existing one.
2) Go to the lists page (koha/virtualshelves/shelves.pl),
notice multitude of new warnings in the "intranet-error.log" log file
that mostly have to do with "Use of uninitialized value $xslsyspref".
3) Apply the patch.
4) Go back to same page and check it again, warns like that should not
appear in the log file anymore.

To reproduce (opac-tags.pl):
1) Go to the "my tags" page in OPAC and open "tag cloud".
2) Notice a bunch of new warnings in the log file that mostly have to
do with "Use of uninitialized value $xslsyspref".
3) Apply the patch.
4) Reload the page and check the log file again.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
de487dac12 Bug 29679: Remove redundant divider element from reports menu
The SQL report batch operations dropdown menu has divider list items
which add a border between sections (Bibliographic records, item
records, etc.). This element is redundant because the sections have
"headers" which also add a border.

This patch removes them.

To test, apply the patch and run an SQL report which will return results
that trigger the batch modification menu:

SELECT biblio.biblionumber , biblio.title, items.itemnumber,
items.itemcallnumber, items.barcode, borrowers.firstname,
borrowers.surname, borrowers.borrowernumber, borrowers.cardnumber
FROM issues
LEFT JOIN borrowers ON borrowers.borrowernumber=issues.borrowernumber
LEFT JOIN items ON issues.itemnumber=items.itemnumber
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
ORDER BY RAND()

There should be no double border in the menu.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-16 12:13:51 -10:00
1573424236 Bug 27266: (QA follow-up) Remove GetBiblioData from sendshelf too
Applies to opac and intranet script.

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

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:16:10 -10:00
b3dc62180b Bug 27266: (QA follow-up) Indentation in opac-sendshelf
Minimal fix to improve bad indentation a bit, moving to 2 spaces.

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

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:15:15 -10:00
441f57184d Bug 27266: (QA follow-up) Remove GetBiblioData from basket scripts
We are adding (or already doing) a Koha::Biblios->find, so we should
get rid of GetBiblioData, fetching the same data.
It returned a few extra columns, but unused here:
    $dat->{bnotes}, $dat->{bi_notforloan}

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:15:14 -10:00
Aleisha Amohia
bb03282189 Bug 27266: (follow-up) Remove get_marc_authors from opac-detail
There's no way to use 'no' XSLT now, so don't need to use this to show
authors on the detail page.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:15:12 -10:00
Aleisha Amohia
dfed3e842f Bug 27266: (follow-up) Using biblio frameworkcode to get rid of FIXME
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:15:10 -10:00
Aleisha Amohia
241cbea691 Bug 27266: (follow-up) Remove instances of GetMarcAuthors
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:15:08 -10:00
Aleisha Amohia
903b024452 Bug 27266: (QA follow-up) Rename to get_marc_authors
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:15:06 -10:00
Aleisha Amohia
d5621ce951 Bug 27266: Move GetMarcAuthors to Koha namespace
This patch moves C4::Biblio::GetMarcAuthors to
Koha::Biblio->get_authors_from_MARC. This is so the method can be
used in templates and notices.

To test:
1. Find a record that has an author in the added entry field (700-720).
2. Add the record to the cart and a list.
3. View your cart and click 'more details'. Confirm authors show as
normal.
4. Click 'send' and confirm the email sent shows the authors as normal.
5. Go to the list you added the record to and click 'send list'. Confirm
the email sent shows the authors as normal.
xslt)
6. Log in to the OPAC. Find the record and add it to the cart and a list
7. View the cart and click 'more details'. Confirm authors show as
normal.
8. Click 'send' and confirm the email sent shows the authors as normal.
9. Go to the list you added the record to and click 'send list'.
Confirm the email sent shows the authors as normal.
10. Confirm tests pass:
- t/Biblio.t
- t/db_dependent/Koha/Biblio.t

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:15:03 -10:00
bcf8cff857 Bug 27801: Fix javascript price calculations
This patch ensures we're formatting the price values consistently for
the table total and the amount to pay input field.

Test plan
1) Add an item to charge at 0.10.
2) Add this same item 8 or 9 times (Do not use the 'quantity')
3) Note that the table total and the 'Amount paid' values do not match
4) Apply the patch and repeat the above steps.. the values should now
   match.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:15:00 -10:00
f4e62d25e0 Bug 29349: (follow-up) Fix width of item level dropdowns
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:14:58 -10:00
b62723ce5a Bug 29349: Do not assume holding branch is a valid pickup location
The original code for pickup locations when placing item-level holds
picked the currently logged-in library.

We made things more robust, as the logged-in library might not be a
valid pickup location for the patron and item. But it was wrongly chosen
to use the holding branch as the default.

A more robust approach is needed, and this precedence is picked this
time (it could be configuration-driven in the future):

    - Logged-in library
    - Empty

To test:
1. Pick a biblio with various valid pickup locations, some not including
   the logged-in library.
2. Pick a patron for placing the hold
=> FAIL: Notice that (when valid pickup location) the holding branch is
always chosen
3. Apply this patch
4. Repeat 2
=> SUCCESS: If valid pickup location, the logged-in branch is picked as
default for item-type level. When it is not, an empty dropdown is used
as a fallback.
5. Sign off :-D

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:14:56 -10:00
Marion Durand
a3c9b57141 Bug 28855: (follow-up) adapt specific test
Adapt the test of function DelSuggestionsOlderThan to match the new behaviour of the function.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:14:53 -10:00
Marion Durand
9aa9608013 Bug 28855: Purging suggestions test should not be on timestamp
DelSuggestionsOlderThan is on "date", a timestamp. It can be a problem
because "date" is updated when we update the database, in consequences
all the suggestions take the same date.

This patch use 'manageddate' instead.

In order to test this patch, you will need to have some suggestions
where "Managed on" (suggestions.manageddate in the database) is older
from "Last updated" (suggestions.date in the database). This can append
during some specific update. If you don't have such data, you will have
to add them via SQL request.

Example of sql for insertion (ID is the patron id of a librarian which
can manage suggestions):
INSERT INTO suggestions (suggestedby, suggesteddate, managedby,
manageddate, acceptedby, accepteddate, STATUS, title) VALUES (1,
'2020-10-13', 1, '2020-10-26', 1, '2020-10-26', 'ACCEPTED', 'title');

Test plan:
1- Choose a date and find (or add) a suggestion where:
    - "Last updated" is not older than this date
    - "Managed on" is older than this date
    - "Status" is different from "Pending" ("ASKED" in database)
Calculate number_days = today's date - chosen date
Example: (Today's date 28/10/2021, chosen date : 28/10/2020,
number_days=365)
Suggestion | .. | Managed on | .. | Last updated | .. | Status
title      | .. | 10/26/2020 | .. | 05/15/2021   | .. | Accepted

2- Run cron job
/home/koha/src/misc/cronjobs/purge_suggestions.pl --confirm --days number_days

3- Check that this suggestion has not been deleted

4- Apply the patch

5- Repeat steps 1 and 2

6- Check that this suggestion has been deleted

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:14:47 -10:00
bf9107074d Bug 29403: Fix api/v1/patrons.t
t::lib::Dates::compare expects either correct DateTime objects, or a
system formatted datetime strings to be passed.. but as we're testing
the API, we are consistently using RFC3339 strings for date-times and
ISO8601 strings for dates.  We need to therefore pre-process the strings
into DateTime objects for the comparison.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:14:45 -10:00
62652115dc Bug 29403: Match the whole string
This patch wraps the constructed regex such that we expect the entire
regex to match and don't allow leading or trailing garbage.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:14:41 -10:00
b09e3e99b7 Bug 29403: Unit tests
Add a unit test for proper iso date handling

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:14:38 -10:00
a3594f160a Bug 29040: Remove warning from the itemtype edit view
Use of uninitialized value $interface in concatenation (.) or string at /kohadevbox/koha/C4/Languages.pm line 121.

We are expecting "intranet" or "opac, here we sent undef which raises a
warning.
For no change in behaviour we can send "both" (or whatever different
than "intranet" and "opac").

Test plan:
Hit /cgi-bin/koha/admin/itemtypes.pl?op=add_form&itemtype=BK
Notice that the warning does no longer appear in the logs with the patch
applied.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2021-12-15 12:14:26 -10:00