Bug 34768 - Can't pay fines on OPAC if patron has a guarantee and they can see their fines
Summary: Can't pay fines on OPAC if patron has a guarantee and they can see their fines
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Nick Clemens (kidclamp)
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-12 15:17 UTC by Nick Clemens (kidclamp)
Modified: 2024-07-04 20:40 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04,22.11.11
Circulation function:


Attachments
Bug 34768: Remove checkbox column from relatives fines on OPAC (4.04 KB, patch)
2023-09-12 15:34 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34768: Remove checkbox column from relatives fines on OPAC (4.11 KB, patch)
2023-09-12 15:59 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 34768: Remove checkbox column from relatives fines on OPAC (4.21 KB, patch)
2023-09-15 06:23 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2023-09-12 15:17:38 UTC
This requires having an OPAC payment system setup, but it doesn't need to be functional for testing

To recreate:
1 - Set system preference: AllowStaffToSetFinesVisibilityForGuarantor to allow
2 - Find a patron
3 - Add some fines to their account
4 - Install and enable an opac payment plugin (https://github.com/bywatersolutions/koha-plugin-pay-via-govolution for example)
5 - Sign in to OPAC as borrower
6 - Go to 'Charges' tab
7 - Select a fee
8 - Confirm 'Make payment' button enabled and 'amount to pay' is updated
9 - Add a guarantee to patron in staff interface
10 - Set 'Show charges to guarantors' to 'Yes'
11 - Add and pay a fine for the child
12 - View guarantor account on the OPAC
13 - Confirm you now see child's charges
14 - Confirm selecting your own fees does not enable the button or update amount to pay
Comment 1 Nick Clemens (kidclamp) 2023-09-12 15:34:00 UTC
Created attachment 155558 [details] [review]
Bug 34768: Remove checkbox column from relatives fines on OPAC

When a patron has a guarantee and can see their fines on the opac and an opac payment plugin is enabled there is an error on the 'Charges' tab.

The table uses a 'COLSPAN' variable which is set to 5 or 6 depending on if OPAC payments are enabled. The guarantees table has one less column than the patron's however, so it is going out of range and causing a JS error. Additionally, we are adding a column to the child's table which is not used as their fines cannot be selected for payment at this time.

This patch removes the checkbox column and sets the colspan directly to 4

I also fix an issue where the table is not being set as we need to reference the patron object in the guarantor info to obtain the id.

To test:
1 - Set system preference: AllowStaffToSetFinesVisibilityForGuarantor to allow
2 - Find a patron
3 - Add some fines to their account
4 - Install and enable an opac payment plugin (https://github.com/bywatersolutions/koha-plugin-pay-via-govolution for example)
5 - Sign in to OPAC as borrower
6 - Go to 'Charges' tab
7 - Select a fee
8 - Confirm 'Make payment' button enabled and 'amount to pay' is updated
9 - Add a guarantee to patron in staff interface
10 - Set 'Show charges to guarantors' to 'Yes'
11 - Add and pay a fine for the child
12 - View guarantor account on the OPAC
13 - Confirm you now see child's charges
14 - Confirm selecting your own fees does not enable the button or update amount to pay
15 - Note JS error in console
16 - Apply patch
17 - Reload patrons page
18 - Confirm the table loads correctly (no JS error)
19 - Confirm selecting a fine updates the total and enables button
20 - Disable the payment plugin
21 - Confirm the display is still correct, no errors
Comment 2 Owen Leonard 2023-09-12 15:36:47 UTC
(In reply to Nick Clemens from comment #1)
> 4 - Install and enable an opac payment plugin
> (https://github.com/bywatersolutions/koha-plugin-pay-via-govolution for
> example)

That's a 404
Comment 3 Nick Clemens (kidclamp) 2023-09-12 15:42:02 UTC
(In reply to Owen Leonard from comment #2)
> (In reply to Nick Clemens from comment #1)
> > 4 - Install and enable an opac payment plugin
> > (https://github.com/bywatersolutions/koha-plugin-pay-via-govolution for
> > example)
> 
> That's a 404

Try it now, I hadn't made the repo public
Comment 4 Owen Leonard 2023-09-12 15:59:57 UTC
Created attachment 155562 [details] [review]
Bug 34768: Remove checkbox column from relatives fines on OPAC

When a patron has a guarantee and can see their fines on the opac and
an opac payment plugin is enabled there is an error on the 'Charges'
tab.

The table uses a 'COLSPAN' variable which is set to 5 or 6 depending on
if OPAC payments are enabled. The guarantees table has one less column
than the patron's however, so it is going out of range and causing a JS
error. Additionally, we are adding a column to the child's table which
is not used as their fines cannot be selected for payment at this time.

This patch removes the checkbox column and sets the colspan directly to
4

I also fix an issue where the table is not being set as we need to
reference the patron object in the guarantor info to obtain the id.

To test:
1 - Set system preference: AllowStaffToSetFinesVisibilityForGuarantor to
    allow
2 - Find a patron
3 - Add some fines to their account
4 - Install and enable an opac payment plugin
    (https://github.com/bywatersolutions/koha-plugin-pay-via-govolution
    for example)
5 - Sign in to OPAC as borrower
6 - Go to 'Charges' tab
7 - Select a fee
8 - Confirm 'Make payment' button enabled and 'amount to pay' is
    updated
9 - Add a guarantee to patron in staff interface
10 - Set 'Show charges to guarantors' to 'Yes'
11 - Add and pay a fine for the child
12 - View guarantor account on the OPAC
13 - Confirm you now see child's charges
14 - Confirm selecting your own fees does not enable the button or
     update amount to pay
15 - Note JS error in console
16 - Apply patch
17 - Reload patrons page
18 - Confirm the table loads correctly (no JS error)
19 - Confirm selecting a fine updates the total and enables button
20 - Disable the payment plugin
21 - Confirm the display is still correct, no errors

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Marcel de Rooy 2023-09-15 06:23:10 UTC
Created attachment 155635 [details] [review]
Bug 34768: Remove checkbox column from relatives fines on OPAC

When a patron has a guarantee and can see their fines on the opac and
an opac payment plugin is enabled there is an error on the 'Charges'
tab.

The table uses a 'COLSPAN' variable which is set to 5 or 6 depending on
if OPAC payments are enabled. The guarantees table has one less column
than the patron's however, so it is going out of range and causing a JS
error. Additionally, we are adding a column to the child's table which
is not used as their fines cannot be selected for payment at this time.

This patch removes the checkbox column and sets the colspan directly to
4

I also fix an issue where the table is not being set as we need to
reference the patron object in the guarantor info to obtain the id.

To test:
1 - Set system preference: AllowStaffToSetFinesVisibilityForGuarantor to
    allow
2 - Find a patron
3 - Add some fines to their account
4 - Install and enable an opac payment plugin
    (https://github.com/bywatersolutions/koha-plugin-pay-via-govolution
    for example)
5 - Sign in to OPAC as borrower
6 - Go to 'Charges' tab
7 - Select a fee
8 - Confirm 'Make payment' button enabled and 'amount to pay' is
    updated
9 - Add a guarantee to patron in staff interface
10 - Set 'Show charges to guarantors' to 'Yes'
11 - Add and pay a fine for the child
12 - View guarantor account on the OPAC
13 - Confirm you now see child's charges
14 - Confirm selecting your own fees does not enable the button or
     update amount to pay
15 - Note JS error in console
16 - Apply patch
17 - Reload patrons page
18 - Confirm the table loads correctly (no JS error)
19 - Confirm selecting a fine updates the total and enables button
20 - Disable the payment plugin
21 - Confirm the display is still correct, no errors

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Tomás Cohen Arazi (tcohen) 2023-09-15 14:59:17 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 7 Fridolin Somers 2023-09-18 07:51:41 UTC
Pushed to 23.05.x for 23.05.04
Comment 8 Matt Blenkinsop 2023-10-12 15:32:35 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x