Commit graph

52651 commits

Author SHA1 Message Date
526ceeb4fa
Bug 36084: svc - checkout_notes
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:49 +01:00
6a9ff124a5
Bug 36084: Fix is_ajax by setting X-Requested-With header
Some svc scripts (and controllers) are using using is_ajax to guess if
it's an AJAX request.
$.ajax is setting the (non standard) X-Requested-With header, but the
low level JS 'fetch' does not.

This patch set it in http-client.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:48 +01:00
50f383de75
Bug 36084: svc - checkin
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:47 +01:00
d322494ef6
Bug 36084: svc - config/systempreferences
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:46 +01:00
52d0005ae0
Bug 36084: svc - shelfbrowser.pl - Replace with GET
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:45 +01:00
40cfd29b83
Bug 36084: svc - authorised_values - APIClient now global
APIClient is not a global variable, which will make the next changes
much easier!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:44 +01:00
8b1871f5cf
Bug 36084: Do not allow absence of token
Well, this test was silly, I was focussed on propagating an error to the
UI, but we really need to explode in this case.

Note that this requires more work as login is now broken.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:44 +01:00
20528b5efc
Bug 36084: Add a global #messages div
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:43 +01:00
39843c2325
Bug 36084: Add a Dialog class
To display potential errors.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:42 +01:00
a9851c0d8b
Bug 36084: Bring fetch for everywhere
We are retrieving the awesome fetch modules from Vue, so that it can be
used in other areas. Here we will use it to inject the CSRF token to the
header of every POST request.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:41 +01:00
cb64ea0c54
Bug 36084: svc - article_request - POC
This is a proof of concept

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:40 +01:00
c6c8b66b74
Bug 36084: C4::Auth+plack.psgi for svc?
Suggestion to move the CSRF check to CGI->new so that we will check it
for every request, and it will cover svc scripts as well (they are not
using get_template_and_user).

The token will be retrieve from the param list *or the csrf_token
header* (do we want to name it x-koha-csrf-token instead?).

This will be done for *every* request that are not GET: CSRF token is now
required everywhere CGI is used (side-effects possible?).

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:39 +01:00
59ae5d7b6d
Bug 36102: (follow-up 2) Add cud-login to the login form - fix tests
Bug 36102: [TO SQUASH] (follow-up 2) Add cud-login to the login form - fix tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:38 +01:00
e345d34ae5
Bug 36102: Add cud-login to the login form (2FA)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:38 +01:00
2529a9d3a6
Bug 36102: (follow-up) Add cud-login to the login form
Previous patch missed opac-auth

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:37 +01:00
b2855e26d4
Bug 36102: Fix removal of cookie from the installer session on upgrades
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:36 +01:00
a44a01aaf3
Bug 36102: Fix expired session on the login page of the installer (?)
I *think* this change fixes a bug when starting the installer with an
expired session. I am no longer able to reproduce the problem however.

Just skip if it does not make sense.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:35 +01:00
59470197c2
Bug 36102: If CSRF check fails, try with anonymous
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:34 +01:00
591646d090
Bug 36102: Remove cookie from the installer session
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:33 +01:00
919d0d4c02
Bug 36102: Generate a new sessionID if the existing one is invalid
If the cookie contain an expired sessionID we need to create another
one to correctly generate the CSRF token.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:33 +01:00
e533d5745c
Bug 36102: Do not repeat op or csrf_token on the login form - staff
Needed for OPAC?

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:32 +01:00
5b82d61477
Bug 36102: (follow-up) Add cud-login to the login form
Hum this didn't make sense. We are not checking credentials after
checkauth.

This patch is suggesting to rename "userid" and "password" parameters
from login forms to "login_userid" and "login_password" to not interfere
with other parameters with the same name.

This looks quite correct, however I am seeing
  "The form submission failed (Wrong CSRF token)."
in the log after a successful login. Which feels wrong, what's
happening?

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:31 +01:00
8f5782cf70
Bug 36102: Do not keep op and csrf_token in param list after login - OPAC
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:30 +01:00
74511d87b5
Bug 36102: Fix 01-installation.t
Something very weird is happening here.

There is a FIXME already, but the trick does not seem to work anymore
(?)

This patch contains some debug statements and take some screenshots.
We are reaching the cud-selectframeworks step then we are expecting the
form to submit the form with op=cud-addframeworks

BUT it seems that "op" is empty, and there is an unexpected warning from
Starman:

==> /var/log/koha/kohadev/plack-error.log <==
""
Use of uninitialized value in string ne at /usr/share/perl5/Starman/Server.pm line 304.

==> /var/log/koha/kohadev/plack-intranet-error.log <==
[2024/02/15 13:09:34] [WARN] Warning: something's wrong at /kohadevbox/koha/installer/install.pl line 89.

What's going on here??

UPDATE: This is fixed by "Bug 34478: Manual fix - Make Koha::Token use
session id not userenv id"

Bug 36102: [TO SQUASH] Fix 01-installation.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:29 +01:00
fabbd8f940
Bug 36102: Use Koha::Session from C4::InstallAuth
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:28 +01:00
88797c54b0
Bug 36102: Add cud-login to the login form
TODO This needs to be covered by tests.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:27 +01:00
8a20c96b6f
Bug 34478: serials/routing-preview.pl
Not totally done, still need the "save and preview"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:27 +01:00
18b046598c
Bug 34478: (follow-up) Move resend link out of form for display reasons
This improves display. This only comes up when you try to reset your
password after you did already.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:26 +01:00
c9375e746b
Bug 34478: (follow-up) Manual fix - Make Koha::Token use session id not userenv id
See comment 174.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:25 +01:00
f859c30704
Bug 34478: Fix www/auth_values_input_www.t
See bug 36189, we need to rewrite this using Selenium.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:24 +01:00
bb54d3f1ce
Bug 34478: Manual fix - reopen basket - add cud- - basket.tt
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:23 +01:00
ff4b63d5c5
Bug 34478: Add cud to updatestructure
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:22 +01:00
74d7ae7672
Bug 34478: (follow-up) batchMod
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:22 +01:00
925eb73a27
Bug 34478: (follow-up) batch_record_modification
Fix Edit > Modify record using template

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:21 +01:00
bb7a181b61
Bug 34478: Fix delete from addbiblio
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:20 +01:00
f5681518f0
Bug 34478: Fix delallitems for additem
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:19 +01:00
cee85d7a5a
Bug 34478: Fix saveitem and delete for additem
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:18 +01:00
fe6c8e7aa0
Bug 34478: Manual fix - adjust op for acqui/cancelorder
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:17 +01:00
84da78796e
Bug 34478: Adjust 'op' on serials/subscription-renew
multi_renew now has a validation step
This patch also removes 2 variables that were not used ($mode and $done)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:16 +01:00
8c3a25bf1f
Bug 34478: Prevent renew if logged in user is not allowed to
This should be on its own bug. Feel free to do it if you have the
energy, I do not.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:16 +01:00
c706fc9e41
Bug 34478: Replace delete links with form - smart-rules
We can certainly do better here (too many duplicated code in on click
functions), but it's good enouh for now...

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:15 +01:00
f03b7ce0d0
Bug 34478: Manual fix - remove cud from members/search
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:14 +01:00
e1c6f70c77
Bug 34478: Move to get - reserve/request.tt:248
This form is never sent

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:13 +01:00
5c999b1241
Bug 34478: Move to get - acqui/uncertainprice
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:12 +01:00
099df862d3
Bug 34478: Convert form to link - sci-main
Nothing to POST, we could move to GET, but we do not have parameters. A
link is good here.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:11 +01:00
cb922721fd
Bug 34478: (follow-up) Fix circ/set-library
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:11 +01:00
f2394c8c09
Bug 34478: Corrections to some serials scripts
This patch updates the serials toolbar and related JS so that delete,
close, and reopen are all POST operations.

The patch also fixes an incorrect op check in the subscription search
popup.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:10 +01:00
63a51acc83
Bug 34478: Correct op name for list edit confirmation
The 'delete_confirm' op leads to a confirmation page, so it's GET.

The patch also consolidates JS for handling deletions, using the same
class for both the delete button in the toolbar and in the table of
lists.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:09 +01:00
882305704e
Bug 34478: OPAC problem reports template update for messages
The template uses checks on the op value to show messages, so those
checks have to be updated with the new values.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:08 +01:00
32b1d59568
Bug 34478: Correct op name in CSV profile deletion confirmation step
The 'delete_confirm' op leads to a confirmation page, so it's GET.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2024-03-01 11:00:07 +01:00