Bug 31981

Summary: Add classes to each NEEDSCONFIRM message for easier styling in circ/circulation.tt
Product: Koha Reporter: Donna <bwsdonna>
Component: Hold requestsAssignee: Lucas Gass (lukeg) <lucas>
Status: RESOLVED FIXED QA Contact: Kyle M Hall (khall) <kyle>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kebliss, kyle, lucas, philip.orr, sally.healey
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This patch adds a unique class to each "needs confirmation" message shown in circulation. Previously the only selector for any circulation message needing confirmation was #circ_needsconfirmation, so CSS or jQuery targeting only a single specific message was not easy to do. With this patch you can directly target the new unique class selector for the specific message found behind the class element .needsconfirm.
Version(s) released in:
24.05.00,23.11.06
Circulation function:
Attachments: warning box for example two
warning box for example 1
Bug 31981: Add classes to each NEEDSCONFIRM message in circ/circulation.tt
Bug 31981: Add classes to each NEEDSCONFIRM message in circ/circulation.tt
Bug 31981: Add classes to each NEEDSCONFIRM message in circ/circulation.tt
Bug 31981: (follow-up) Fix typo in class name

Description Donna 2022-10-25 21:47:15 UTC
Created attachment 142657 [details]
warning box for example two

There are potentially two yellow warning boxes staff can see when checking out an item that is on hold and the two boxes are VERY difficult to distinguish between.  It would be helpful to either change the wording, or change the color of one of them to help staff determine what action should be taken.

For instance, place a hold on an item for Patron A, do not trigger the hold, and check the item out to Patron B.  The message is:

Please confirm checkout
Item Toby goes bananas / (312824) has been on hold for Donna B (donnab) at Sparkly Unicorn Land since 10/25/2022
 Cancel hold
Yes, check out (Y)  
Don't check out and print slip (P)  
No, don't check out (N)  
Cancel checkout and place a hold for Jack Shepard (68)

Then check the item in, confirm the hold, then check the item out to Patron B.  The message is:

Please confirm checkout
Item Toby goes bananas / (312824) has been waiting for Donna B (donnab) at Sparkly Unicorn Land since 10/25/2022
Cancel hold 
Revert waiting status 

The first message is much more common - libraries typically see it when a patron has placed a hold on something, but another patron has taken it off the shelf to check out before staff were able to pull it for the other patron.  The second message is much less common - this is when an item is on the hold pick up shelf and a patron other than who it was triggered for is trying to check it out.
Comment 1 Donna 2022-10-25 21:47:41 UTC
Created attachment 142658 [details]
warning box for example 1
Comment 2 Lucas Gass (lukeg) 2023-11-08 18:02:28 UTC
These look the same because they are the same! ( #circ_needsconfirmation )

If something NEEDSCONFIRMATION Koha will then cycle through all the possible things. In your care I believe it is:

1. [% IF ( RESERVED ) %] Item has been on hold for X since...

2. [% IF ( RESERVE_WAITING ) %] Item has been waiting for...


I think we could add a ID/class to each of the NEEDSCONFIRMATION reasons. This would make it much easier to customize the dialog/alert boxes based on the reason. 


Would that work?
Comment 3 Donna 2023-11-08 22:18:33 UTC
Absolutely!  Anything that would make it easier for libraries to distinguish would work!
Comment 4 Lucas Gass (lukeg) 2024-03-21 16:49:29 UTC
Created attachment 163647 [details] [review]
Bug 31981: Add classes to each NEEDSCONFIRM message in circ/circulation.tt

This patch adds a 'needsconfirm' class and a unique class to each NEEDSCONFIRM message on circ/circulation.tt to make these easier to style individually.

To test:
1. APPLY patch
2. Review the diff to see each of the NEEDSCONFIRMATION messages.
3. Add some CSS to IntranetUserCSS like this:

.needsconfirm { padding: 1em; color: #fff; }

.reserved { background: blue; }
.debt { background: red; }
.reserve_waiting { background: orange; }
.rentalcharge { background: purple; }
.renew_issue { background: limegreen; }

4. Place a hold on an item for Patron A, do not trigger the hold, and check the item out to Patron B.  The message background is blue.
5. Then check the item in, confirm the hold, then check the item out to Patron B.  The message background is orange
6. Check something out that is already checked out to that patron, message background is lime green.
7. Have too much debt and check something out to a patron, message is red.

Note: There are plenty more NEEDSCONFIRMATION messages but I don't think we need to test every single one.
Note: These background colors are more testing purposes only.
Comment 5 ByWater Sandboxes 2024-03-21 20:46:54 UTC
Created attachment 163653 [details] [review]
Bug 31981: Add classes to each NEEDSCONFIRM message in circ/circulation.tt

This patch adds a 'needsconfirm' class and a unique class to each NEEDSCONFIRM message on circ/circulation.tt to make these easier to style individually.

To test:
1. APPLY patch
2. Review the diff to see each of the NEEDSCONFIRMATION messages.
3. Add some CSS to IntranetUserCSS like this:

.needsconfirm { padding: 1em; color: #fff; }

.reserved { background: blue; }
.debt { background: red; }
.reserve_waiting { background: orange; }
.rentalcharge { background: purple; }
.renew_issue { background: limegreen; }

4. Place a hold on an item for Patron A, do not trigger the hold, and check the item out to Patron B.  The message background is blue.
5. Then check the item in, confirm the hold, then check the item out to Patron B.  The message background is orange
6. Check something out that is already checked out to that patron, message background is lime green.
7. Have too much debt and check something out to a patron, message is red.

Note: There are plenty more NEEDSCONFIRMATION messages but I don't think we need to test every single one.
Note: These background colors are more testing purposes only.
Signed-off-by: Donna <donna@bywatersolutions.com>
Comment 6 Donna 2024-03-21 20:48:10 UTC
Beautiful! Works as expected, and if there are two notices, both color boxes show on the modal.
Comment 7 Katrin Fischer 2024-05-06 07:48:17 UTC
Only adds CSS classes, reviewed closely.
Comment 8 Kyle M Hall (khall) 2024-05-07 16:24:16 UTC
Created attachment 166307 [details] [review]
Bug 31981: Add classes to each NEEDSCONFIRM message in circ/circulation.tt

This patch adds a 'needsconfirm' class and a unique class to each NEEDSCONFIRM message on circ/circulation.tt to make these easier to style individually.

To test:
1. APPLY patch
2. Review the diff to see each of the NEEDSCONFIRMATION messages.
3. Add some CSS to IntranetUserCSS like this:

.needsconfirm { padding: 1em; color: #fff; }

.reserved { background: blue; }
.debt { background: red; }
.reserve_waiting { background: orange; }
.rentalcharge { background: purple; }
.renew_issue { background: limegreen; }

4. Place a hold on an item for Patron A, do not trigger the hold, and check the item out to Patron B.  The message background is blue.
5. Then check the item in, confirm the hold, then check the item out to Patron B.  The message background is orange
6. Check something out that is already checked out to that patron, message background is lime green.
7. Have too much debt and check something out to a patron, message is red.

Note: There are plenty more NEEDSCONFIRMATION messages but I don't think we need to test every single one.
Note: These background colors are more testing purposes only.
Signed-off-by: Donna <donna@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Katrin Fischer 2024-05-07 18:08:02 UTC
Sorry, it looks like I forgot to switch to PQA and then the script didn#t update it. This is pushed already. Did you change something in the patch or just a sign-off?

https://git.koha-community.org/Koha-community/Koha/commits/branch/main/search?q=31981
Comment 10 Fridolin Somers 2024-05-24 13:34:52 UTC
Very useful small enhancement,

Pushed to 23.11.x for 23.11.06
Comment 11 Philip Orr 2024-05-24 13:44:05 UTC
Only looked at the diff while writing release notes.
But:
.debt_gaurantors should be .debt_guarantors, right?
Comment 12 Philip Orr 2024-05-24 13:50:40 UTC
For me to reference if documentation is later needed.
The unique classes that were added are:
.additional_materials
.age_restriction
.already_issued
.booked_early
.booked_to_another
.borrower_not_same_branch
.reserved
.debt
.debt_guarantees
.debt_gaurantors
.highholds
.issued_to_another
.item_lost
.no_rule_defined
.not_for_loan_forcing
.patron_cant
.previssue
.processing
.recalled
.recalled2
.reserve_waiting
.reserved
.rentalcharge
.renew_issue
.too_many_checkouts
.too_many_onsite_checkouts
.transferred
.userblocked_overdue
Comment 13 Katrin Fischer 2024-05-24 13:51:58 UTC
(In reply to Philip Orr from comment #11)
> Only looked at the diff while writing release notes.
> But:
> .debt_gaurantors should be .debt_guarantors, right?

Might be a little nicer. I can provide a quick follow-up.
Comment 14 Katrin Fischer 2024-05-24 13:55:04 UTC
Created attachment 167167 [details] [review]
Bug 31981: (follow-up) Fix typo in class name

.debt_gaurantors > .debt_guarantors
Comment 15 Fridolin Somers 2024-05-24 14:44:28 UTC
follow-up applied on 23.11.x
Comment 16 Lucas Gass (lukeg) 2024-05-28 21:36:27 UTC
Enhancement will not be backported to 23.05.x