Commit graph

52204 commits

Author SHA1 Message Date
de4f54b3fa Bug 36103: Remove the "Cancel hold" link for item level holds
This link is broken and doesn't make sense from a UI/UX perspective
and thus should be removed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c91a43ca1f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:29:27 +01:00
ea66e6bf5b Bug 35950: Adjust tests
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 85f316f9c8)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:20:33 +01:00
9b2d032d1e Bug 35950: Move AddReturn call into circulation.pl
There should be no change in beahavior. Following the test plan from Bug 35840.

To test:
1. APPLY PATCH, restart_all
2. Turn on RecordLocalUseOnReturn
3. Create a Statistical patron.
4. Check an item out to a regular patron.
5. Check the item out to a Statistical patron.
6. This should trigger a return and you will see 2 entries in the statistics table, one for localuse and one for a return.
7. Try checking out an item to the Stats patron that is NOT checked out.
8. You should only see 1 entry, localuse, in the statistics table.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 834bff6317)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:20:33 +01:00
c2f992e7a0 Bug 35840: (QA follow-up) Tidy and critic fix
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e0554260c7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:19:07 +01:00
a2848e9ee8 Bug 35840: Add unit tests
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8b14aca56c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:19:07 +01:00
fb1a9b949a Bug 35840: Add option to AddReturn to skip recording of localuse
To test:
1. APPLY PATCH, restart_all
2. Turn on RecordLocalUseOnReturn
3. Create a Statistical patron.
4. Check an item out to a regular patron.
5. Check the item out to a Statistical patron.
6. This should trigger a return and you will see 2 entries in the statistics table, one for localuse and one for a return.
7. Try checking out an item to the Stats patron that is NOT checked out.
8. You should only see 1 entry, localuse, in the statistics table.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ffc722554e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:19:07 +01:00
Shi Yao Wang
d35481b1ab Bug 35911: Make archived suggestions not show in patron's account
Remove archived suggestions in patron's account page

Test plan:
1. Go to a patron's account in the staff interface
2. Go to the Suggestions tab
3. Click New purchase suggestion and create a suggestion
4. In another browser tab, go to Acquisitions > Suggestions
5. Click the small arrow next to the edit button to the right of the suggestion, and choose Archive (alternatively, check the suggestion's box and click Archive selected)
   --> Suggestion disappears from the suggestions management page (OK)
6. Go back to the tab with the patron's account and refresh
   --> Suggestion is still visible
7. Apply the patch
8. Redo step 6 and notice the suggestion is not visible anymore
9. Redo step 4 and 5 but this time, unarchiving the suggestion
10. Redo step 6 and notice the suggestion is back

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ac71adbd23)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:16:17 +01:00
b8bc451938 Bug 35718: Remove ES6 warnings branches.tt
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6a0db6c1c4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:13:54 +01:00
f3733ae8d6 Bug 35718: Remove ES6 warns from JS system preferences
To test:
1. Add some JS like this to any of the UserJS system preferences:

$(document).ready( function() {
    let something = 1;
    const another_thing = 2;

    let an_arrow_function = (a, b) => a + b;
    console.log( an_arrow_function(something, another_thing) );
});

2. Notice the icons and warnings to the left of the line numbers:

let is available in ES6
const is available in ES6
arrow_function_syntax is available in ES6

3. APPLY PATCH
4. Try steps 1 and 2 again, the warnings should be gone.
5. Check that the JavaScript still works, in my example it should console.log 3.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5e3ae14aa0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:13:54 +01:00
Laura Escamilla
17ba879fec Bug 36004: Fixed typo in successfully
To test:

1. Turn on the syspref 'OpacCatalogConcerns'

2. Go to view a record in the OPAC and click on "Report a concern" in
   the column located on the right-hand side.

3. Fill out the title on the form and leave everything else the same.
   Click on submit and notice that the message on the screen says "Your
   concern was sucessfully submitted."

4. Apply the patch.

5. Submit a new concern. Notice that the text now has "successfully"
   spelled correctly.

6. Sign off and have a great day! :D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6bf839d892)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:11:14 +01:00
Laura Escamilla
72dd84251e Bug 36005: Fixed typo in "Your concern was successfully submitted." text
To test:

1. Turn on the syspref 'CatalogConcerns'

2. Go to view a record in the staff intranet and click on "New catalog concern" which is located in the "+New" dropdown.

3. Fill out the title on the form and leave everything else the same. Click on submit and notice that the message on the screen says "Your concern was sucessfully submitted."

4. Apply the patch.

5. Refresh the page and submit a new concern. Notice that the message now has "successfully" spelled correctly.

6. Sign off and have a wonderful day! :D

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0fcf48c55f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 15:10:24 +01:00
f552f23d93 Bug 36070: Fix CSS class
1) Enable UseRecalls
2) Checkout an item to a patron:
   Top INTRA search bar: pick 'check out' and paste a patron
   cardnumber:
   23529000035676
   press enter
3) Enter an item barcode:
   39999000003154
   Press checkout
4) As user koha/koha, visit OPAC page for this biblio:
   opac-url/cgi-bin/koha/opac-detail.pl?biblionumber=76
5) Notice all sidebar actions on the right have hover effect except for
   'Place recall'

Apply patch, repeat test plan.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0bdd12ea22)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:41:06 +01:00
Raphael Straub
0e511dffcf Bug 36032: Use a single angle in the "Next" button
The "Next" pagination button in the OPAC result list has a double angle
whereas the "Previous" button only has a single angle. This patch fixes
that error.

To test:
1) Do a search in the OPAC with more than one page of results.
2) Observe that the "Next" button has a double angle whereas the
   "Previous" button has only a single angle.
3) Apply the patch.
4) Repeat steps 1 and 2.
5) Verify that the "Next" button now has a single angle.

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c1ce64593)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:30:42 +01:00
e37c7d27e1 Bug 35538: Sort OPAC self registration library list by library name
This patch modifies opac-memberentry.pl so that the list of libraries is
sorted by library name instead of library code.

To test, apply the patch and restart services.

- If using the default testing data you'll have to go to Administration
  -> Libraries and edit one or more libraries so that the library name
  is alphabetically different than the library code. e.g. Centerville ->
  Zanzibar.
- Go the OPAC and click "Create an account" (requires the
  PatronSelfRegistration system preference).
- Under "Home library," the dropdown of libraries should be ordered by
  library name.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5998fe93f5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:29:25 +01:00
fa4ce83a9d Bug 35357: Enhance unit tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Fixed typo in test output.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 285a0fc74d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:25:23 +01:00
b91c1d6005 Bug 35357: Remove item from holds queue when it is checked out
Test Plan:
1) Place a hold on an item
2) Build the holds queue
3) Check out the item to a different patron than the one
   targeted in the holds queue
4) Verify the holds queue viewer still shows that item and patron
5) Apply this patch
6) Repeat stepts 1 through 3
7) Verify the holds queue viewer no longer shows that patron and item!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0eced80866)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:25:23 +01:00
29fd20e068 Bug 35357: Add unit test
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0e11bc0de5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:25:23 +01:00
26ba5fba8b Bug 36056: Clarify subpermissions AND behavior
Working on bug 31791, I found myself wondering if our current recursive
code in C4::Auth::haspermission() would allow checking AND on
subpermissions.

As it is not documented in the POD or tested, I decided to write some
unit tests for it.

It turned out it was well supported, so I decided to submit the tests,
and a small tweak in the POD to reflect that.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Auth/haspermission.t
=> SUCCESS: Tests pass! The code supports AND on subpermissions!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit aa1049fdd3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:23:45 +01:00
118012dcd8 Bug 35469: Add 'manage_bookings' permission to biblios/checkouts
This patch adds the manage_bookings subpermission check to the
biblios/{biblio_id}/checkouts endpoint and updates the corresponding
unit test too.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5e0afb772a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:22:54 +01:00
0d028159e5 Bug 35469: Add 'manage_bookings' subpermission to /checkouts
This patch adds the 'manage_bookings' permission to allow fetching of
checkouts on the API should the user have 'manage_bookings' but not have
'circulate_remaining_permissions'

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 30b3a8c382)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:22:54 +01:00
9e50622d26 Bug 35773: Add manage_bookings subpermission to patron searching
This quickly fixes the issue to allowing those who have the
manage_bookings subpermission to also search for users.

It's deliberately bare as I'm keen to subsequently remove it again in
bug 29509 where we will deal with this properly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 52fbb93cda)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:22:07 +01:00
fe6569208d Bug 35924: (QA follow-up): Comment magic number (patron.privacy < 2)
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0233c1d93f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:20:57 +01:00
d75da0473a Bug 35924: Hide the print checkins button on the checkin screen for patron's who always anonymize
Test Plan:
1) Set a patron's privacy to "Never"
2) Check out a few items to a patron
3) Check in one item
4) Note the "Print checkin slip" diplays
3) Apply this patch
4) Check in an  item
5) Note the option is now missing
6) Set the patron's privacy to "Forever" or "Default"
7) Check in an item
8) Note the print checkins option is back!

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 19f38a286d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:20:57 +01:00
8ab2cc8960 Bug 35924: Hide the print checkins button on the patron screens for patron's who always anonymize
If a patron anonymizes their checkins, the checkin slip cannot retrieve any info to print the checkin slip. We should not show the button in this scenario

Test Plan:
1) Set a patron's privacy to "Never"
2) Note the "Print checkin slip" option in the Print button on the
   patrons toolbar displays
3) Apply this patch
4) Reload the page
5) Note the option is now missing
6) Set the patron's privacy to "Forever" or "Default"
7) Reload the page
8) Note the print checkins option is back!

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7253c38b8a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:20:57 +01:00
Lari Taskula
e70bc2d20f Bug 36134: Read complete Elasticsearch configuration in about.pl
When enabling Elasticsearch authentication in Koha using userinfo
parameter of Search::Elasticsearch, about.pl breaks and gives an
internal server error.

This patch reads the complete Elasticsearch configuration for
about.pl including userinfo causing about.pl to recover.

To test:
1. In Elasticsearch 7 settings, set "xpack.security.enabled: true"
2. Add <userinfo>elastic:password</userinfo> to KOHA_CONF elasticsearch
   settings
3. Restart plack and navigate to about.pl
4. Observe internal server error
5. Apply patch
6. Refresh about.pl
7. Observe it working again

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5511482951)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:20:07 +01:00
246566b7d1 Bug 36212: Add check on barcode before searching items
Test plan:
Add an item to your database that has no barcode.
Run t/db_dependent/Circulation.t
It will fail without this patch, pass with this patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8413b37679)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:18:34 +01:00
b0660d11f5 Bug 36010: Fix Items/AutomaticItemModificationByAge.t failing since Bug 32029
UT is failing in jenkins.
Change to use biblio.copyrightdate instead of bilio.medium

Run prove t/db_dependent/Items/AutomaticItemModificationByAge.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2e6a2c3b5b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:16:47 +01:00
badba61f00 Bug 32029: Automatic item modifications by age add biblio table
In automatic item modifications by age missing,
conditions can be on columns of tables items or biblioitems.
Table biblio is missing.

Test plan :
1) Create an automatic item modifications by age with a condition on a column of biblio table
2) Create a record and item matching the rule
3) Run misc/cronjobs/automatic_item_modification_by_age.pl -c -v
=> Check only matching items are impacted

Signed-off-by: Philip Orr <philip.orr@lmscloud.de>

Bug 32029: (follow-up) unit test

Signed-off-by: matthias le gac <matthias.le-gac@inlibro.com>

Bug 32029: (follow-up) tidy

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4e480d48f6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:16:47 +01:00
f49a9e1a4d Bug 36170: Wrong error variable in memberentry
It is hidding an important error.

$@ is never set here, we need $_ (inside a try-catch)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit cd9de702e2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:12:08 +01:00
9308e3d519 Bug 34234: Respect display_order in additem.tt and detail.tt
1. APPLY PATCH
2. EnableItemGroups
3. Find a record and add some new item groups with display orders that are different from the order in which the groups were added
4. Check the checkbox next to one or more items and click the link to "Add/move to item group"
5. Ensure display order is correct
6. Now add a new item to the record and scroll down to the dropdown underneath "+ Add to item group"
7. Display order should be correct.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit bcfc786f17)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:06:32 +01:00
781f34e504 Bug 35892: Populate order price using GetMarcPrice if no price specified
Previously this happened after the fact, automagically, if no price was included in the order record. We should
rather load the Marc price into the order form if we don't have a price form the '...ToOrder' system preferences

To test:

Setup -- Set systempreferences below

MarcFieldsToOrder:
price: 949$g
quantity: 949$k
budget_code: 949$l
discount: 949$m
sort1: 949$n
sort2: 949$q

MarcItemFieldsToOrder:
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l

Stage the attached bib-303.marcxml file
Add to basket from the staged file
Note that item prices are populated as '6.50' from 949$g
Cancel
Update MarcFieldsToOrder and map price to "020$c"
Add to basket from the staged file
Note the price is not populated, because 020$c contains a dollar sign
Cancel
Apply patch, restart all
Add to basket from the staged file
Note the price is now correctly populated from fallback to GetMarcPrice

Note: GetMarcPrice does some automatic munging, that's why 020$c on it's own doesn't work - this could be done to fields in MarcFieldsToOrder/MarcItemFieldsToOrder but this would be an enhancement.
This bug simply restores the previous behavious, but does it on the front end and is more obvious to the user

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c3035f7e1b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:05:16 +01:00
2e8a517865 Bug 31427: Remove a few refs to CanBookBeRenewed
Actually, the module is not even needed anymore here.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3b8a3c7b86)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:02:52 +01:00
8a62aa688a Bug 31427: (follow-up) Unit tests
This patch adds a unit test for error precidence where autorenewals is
involved.

It is not comprehensive however, and I'm a little confused by the logic
around cron vs non-cron handling...

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a71c21d2ff)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:02:52 +01:00
b14fe345dc Bug 31427: Get auto renewal errors before other renewal errors
This patch changes CanBookBeRenewed so that automatic renewal
errors pop up before other renewal errors. This means that a book
will be considered "auto_too_soon" before things like "too_many" or
"restricted". (Otherwise, you'll get an email saying you can't renew
a book the day after using your last auto renewal, even though the
earliest renewal isn't available until later.)

Test plan:
0. Apply patch
1. prove t/db_dependent/Circulation.t
2. prove t/db_dependent/Holds.t
3. prove t/db_dependent/Koha/Account/Line.t
4. prove t/db_dependent/Koha/Account.t

Additional tests:
5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RestrictionBlockRenewing
6. Change to "block"
7. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=AutoRenewalNotices
8. Change to "according to patron messaging preferences"
9. Go to http://localhost:8081/cgi-bin/koha/admin/smart-rules.pl
10. Set "Automatic renewal" to "Yes" and "No renewal before" to 4
11. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
12. Checkout 39999000001310 with a due date 4 days in the future
13. Add a manual restriction
14. Run `perl ./misc/cronjobs/automatic_renewals.pl`
15. Note that it says something like the following:
Issue id: 1237 for borrower: 51 and item: 73 would not be renewed. (auto_too_soon)

Instead of something like the following:
Issue id: 1237 for borrower: 51 and item: 73 would not be renewed. (restriction)

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5d7a9395fb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:02:52 +01:00
6e0e84bc9e Bug 36100: (QA follow-up) Move 400 to 409
Duplicate exceptions tend to generate a 409 in our REST API.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 3e164d200a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:00:23 +01:00
733546cf5f Bug 36100: Update unit tests for add
This patch updates the unit tests for booking add to confirm that
without readOnly we still return an error should a user attempt to
submit a booking with a booking_id that would clash.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d810b3663b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:00:23 +01:00
b051e53bc9 Bug 36100: Remove readOnly from bookings definition.
Whilst readOnly feels correct here, swagger doesn't work that way at our
version. It must be removed to restore the ability to edit exising
bookings.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e8a2f4df73)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 11:00:23 +01:00
Julian Maurice
16d3402cfe Bug 36047: Remove jQuery selector from conditional
This prevents the jQuery from breaking if the reason contains an
apostrophe character.

1. Create a suggestion
   1.1. Go to Acquisitions > Suggestions
   1.2. Click New purchase suggestion
   1.3. Enter a title
   1.4. Click Submit your suggestion

2. Update the suggestion to accepted and add a reason with an apostrophe
   2.1. In the suggestions list, check the box next to the suggestion
   2.2. At the bottom of the screen, choose Mark selected as: Accepted
   2.3. In With this reason, choose Others...
   2.4. Enter a reason with an apostrophe (my case was in French :
        Disponible en impression à la demande (POD). S'attendre à un
        long temps d'attente)
   2.5. Click Submit

3. Order the suggestion
   3.1. Go to Acquisitions
   3.2. Search for a vendor
   3.3. Click New > Basket
   3.4. Enter a basket name
        (Optional: for testing I like to change Create items when:
        cataloging the record)
   3.5. Click Save
   3.6. Click Add to basket
   3.7. Click From a suggestion
   3.8. Click Order next to the suggestion
   3.9. Enter order details
   3.10. Click Save
   3.11. Click Close basket
   3.12. Click Yes, close

4. Receive the order
   4.1. Click Receive shipments
   4.2. Enter a Vendor invoice number
   4.3. Click Next
   4.4. Click Receive next to the order
        --> Page stays In processing forever

Apply patch. Repeat. Notice the page now renders correctly.
Extra: Add an entry containg an apostrophe to the SUGGEST authorized
values category and repeat test plan. Confirm everything works as
expected.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4515581eff)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:57:57 +01:00
e154184b7a Bug 35913: Restore price fall back to MarcFieldsToOrder if not set by MarcItemFieldsToOrder
To test:
Setup -- Set systempreferences below

MarcFieldsToOrder:
price: 949$g
quantity: 949$k
budget_code: 949$l
discount: 949$m
sort1: 949$n
sort2: 949$q

MarcItemFieldsToOrder:
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l

Stage the attached bib-303.marcxml file
Add to basket from the staged file
Select the biblio
Note items have prices
Cancel
Remove 'price' mapping from MarcItemFieldsToOrder
Apply patch
Add to basket from file again
Note item prices, and other fields, come through as expected

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 649e1de190)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:57:10 +01:00
17032f89a3 Bug 35819: (QA follow-up) Prevent warning on uninitialized retries count
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c86e6ee82d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:52:34 +01:00
febc2570de Bug 35819: Adjust es_indexer_daemon
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Add forgotten module
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7c1d4716be)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:52:34 +01:00
f8af6d5028 Bug 35819: Improve logging
Log (warn) if the job will be processed later, but add a debug however.

Have a specific log for bad status

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 30e69ebc56)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:52:34 +01:00
87e3d35e84 Bug 35819: nack and not requeue if frame is invalid
If a frame cannot be correctly processed (most probably because the body
is not valid JSON) then we are not acking or nacking the frame and the
worker is stuck.

In this specific case we should nack without requeuing the frame.

NOTE that requeue must be 'true' or 'false', not 1 or 0, or the default
'true' will be used.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8394092568)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:52:34 +01:00
b1efcf3d15 Bug 35819: Add simple delay
Here I add 500 ms. In my testing with the 1s sleep from the test
plan, I might see one or two 'not found' lines. Obviously things
depend on the time needed before the txn commits. But it will
reduce a flood of these messages.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 0feb10df7f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:52:34 +01:00
83fb050b2f Bug 35819: Notify NACK and requeue when Job ID not found
This patch makes the worker reject the incoming frame for putting the
message back in the queue, in the event the job id doesn't exist yet.
Which is the case when some actions are being triggered inside a
transaction which hasn't been commited to the DB yet.

To test you will need 3 KTD shells
(a) mysql:
   $ ktd --shell
  k$ sudo koha-mysql kohadev

(b) logs:
   $ ktd --shell
   # for restarting the worker and looking at the logs
  k$ sudo koha-worker --restart kohadev  ; tail -f /var/log/koha/kohadev/worker-*.log
(c) running the test:
   $ ktd --shell

1. Have (a), (b) and (c) terminals ready
2. On (c), run:
   $ perl -MKoha::Database -MKoha::BackgroundJob::BatchUpdateBiblioHoldsQueue -e 'Koha::Database->schema->txn_do( sub { Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue({ biblio_ids => [ 1 ] }); sleep 1;  } );'
=> FAIL:
   * (b) shows (once) an error about a job not existing
3. On (a) run:
   > SELECT * FROM background_jobs;
=> FAIL: Notice the job ID mentioned on 2 stands as 'new'.
4. Apply this patch
5. Ctrl+c on (b), and re-run to launch the worker with the patch applied
6. Repeat 2
=> SUCCESS (partial): The error about the job not existing is displayed
many times
7. Repeat 3
=> SUCCESS: The job ID mentioned on 6 stands as 'finished'.
8. Sign off :-D

Discussion:

* The `requeue` header I added is correct, but it is the default
  behavior anyway. I prefered to make it explicit, though.

* To avoid that bunch of retries, we should requeue with some delay. I
  didn't manage to make it work (yet) but there's a 'delay' plugin for
  rabbit [1]. We already install the 'stomp' plugin in
  koha-common.postinst. But this plugin requires downloading it. Which
  would require further investigation.

* As Nick and Marcel pointed, we need to revisit the whole architecture,
  the need of a MQ (DB polling wouldn't have this problem), etc. But
  that's for another place.

[1] https://hevodata.com/learn/rabbitmq-delayed-message/#:~:text=To%20delay%20a%20message%2C%20the,to%20queues%20or%20other%20exchanges.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1a51c2e973)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:52:34 +01:00
94a261e3db Bug 36175: Corrections to reduced due for booked items
This patch fixes a mistake in the circulation controller such that the
proper reduceddue date is passed to the template when a checkout would
overlap with a booking.

I also take the oportunity to enhance the functionality to allow
librarians to set their own reduceddue date between now and the hard
reduceddue as required for the existing booking.

Test plan
1) Set an item to 'bookable'
2) Add a booking to that item for user A for a few days time.
3) Attempt to checkout the item to user B and note the warning that
   the item is booked for another user.
4) With the patch applied, a reduced due date of 1 day prior to the
   booking should be defaulted to in the displayed date picker.
5) You should be able to select any date between today and the day
   before the booking starts
6) Confirm you can checkout with the reduceddue date set.
7) Bonus point, confirm the field is required, so if you try to wipe it
   and then checkout, you will be blocked.

Signed-off-by: Kelly <kelly@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6e56e4a0d1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:49:12 +01:00
d6bdada36d Bug 36140: Correct label for attribute invoice.tt
To test:
1. Go to /cgi-bin/koha/acqui/invoice.pl?invoiceid=X  where X is the invoice number.
2. Look at the Invoice number with your dev tools, the for attribute is wrong. ( shippingdate )
3. Apply patch and look again, the attribute should correctly be invoicenumber.

Alternatively, just look at the diff of this trivial change. :)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 214fc675cf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:44:11 +01:00
c3a12820e3 Bug 36076: paycollect.tt add permission checks for manual credit and invoice
In members/pay.tt one can see permission checks for manual credit and invoice :
CAN_user_updatecharges_manual_invoice
CAN_user_updatecharges_manual_credit

This is missing from members/paycollect.tt.
HTML is also missing classes manualcredit and manualinvoice.

Test plan :
1) Create a user with permissions to manage accounting
   (remaining_permissions under updatecharges) but without
   manual_invoice and manual_credit
2) Go to a patron account with an invoice
3) Click on "Make a payment", you dont see tabs manual credit/invoice
4) Click on "Pay" in "Actions" column
=> Without patch you see tabs manual credit/invoice
=> With patch you do not see them

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 52e7c8acf4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:43:31 +01:00
0126eeda78 Bug 35963: (QA follow-up): tidy up code and fix exec permission
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 9b8cbf5c83)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:42:34 +01:00
Julian Maurice
05742ec900 Bug 35963: Fix bundled items table ordering and filtering
Using the many-to-many relationship results in the table alias `me` to
be used for table `item_bundles` instead of the expected table `items`.
This causes ordering and filtering to fail for columns Callnumber and
Barcode.
Using Koha::Items->search does not have this problem.

This patch also disables ordering by status because it does not work
(error message is: "Cannot find Koha::Object class for return_claim'")

Test plan:
1. Create an item bundle
   https://koha-community.org/manual/23.11/en/html/circulation.html#circulating-bundles
2. Add at least 2 items to this bundle
3. Verify that ordering/filtering by callnumber or barcode works
4. Run `prove t/db_dependent/api/v1/items/bundled_items.t`

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 2753eec1ce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2024-03-11 10:42:34 +01:00