Bug 32485

Summary: Add itemtype checkout message
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: CirculationAssignee: Sam Lau <samalau>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, hebah, kyle.m.hall, roman.dolny, samalau, sbrown
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 32485: Schema Updates (DO NOT PUSH)
Bug 32485: DB Updates
Bug 32485: Add itemtype checkout message
Bug 32485: Unit tests
Bug 32485: Add checkout message to item types table and fix display location of checkout message

Description Lucas Gass (lukeg) 2022-12-16 16:24:28 UTC
For itemtypes we have checkinmsg. Some libraries would be interested in also having a checkout message that could be configured at the item type level.
Comment 1 Sara Brown 2022-12-16 16:26:15 UTC
+1

This would be really helpful when the message is the same for all items of the type vs. having to manually add a materials specified note to each applicable item!
Comment 2 Sam Lau 2024-08-06 20:12:39 UTC
Created attachment 170113 [details] [review]
Bug 32485: Schema Updates (DO NOT PUSH)
Comment 3 Sam Lau 2024-08-06 20:12:41 UTC
Created attachment 170114 [details] [review]
Bug 32485: DB Updates

Add new 'checkoutmsg' and 'checkoutmsgtype' columns to 'itemtypes'
Comment 4 Sam Lau 2024-08-06 20:12:43 UTC
Created attachment 170115 [details] [review]
Bug 32485: Add itemtype checkout message

These patches add new "Checkout message: " and "Checkout message type:" options for item types. When checking out an item, a dialog box appears with the desired message for that item type.

To test:
1) Apply patch, updatedatabase, dbic (for schema), restart_all
2) Visit Administration->Item types
3) Edit the book item type and enter a checkout message. Save your changes.
4) Checkout an item of type book to a patron
5) Your checkout message should be displayed
6) Go back to Admin->Item types, edit book, and then switch the 'Checkout message type:' to 'Alert'
7) Checkout another book item and note the dialog box is now an alert.
8) Checkout item of another type -> the message should not show
Comment 5 Sam Lau 2024-08-06 20:12:45 UTC
Created attachment 170116 [details] [review]
Bug 32485: Unit tests

prove t/Koha/ItemType.t
Comment 6 Roman Dolny 2024-08-10 09:30:45 UTC
Two notes after testing:
1. there is no "Checkout message" column in item types table (Administration->Item types),
2. probably checkout messages should be placed in messages section (id="messages") not in mainform (id="mainform").

QA script:
WARN   Koha/Schema/Result/Itemtype.pm
  WARN   tidiness
  The file is less tidy than before (bad/messy lines before: 77, now: 86)

WARN   admin/itemtypes.pl
  WARN   tidiness
  The file is less tidy than before (bad/messy lines before: 62, now: 66)

WARN   circ/circulation.pl
  WARN   tidiness
  The file is less tidy than before (bad/messy lines before: 285, now: 290)

WARN   t/Koha/ItemType.t
  WARN   tidiness
  The file is less tidy than before (bad/messy lines before: 0, now: 7)
Comment 7 Sam Lau 2024-08-20 17:59:33 UTC
Created attachment 170503 [details] [review]
Bug 32485: Add checkout message to item types table and fix display location of checkout message
Comment 8 Sam Lau 2024-08-20 18:01:21 UTC
(In reply to Roman Dolny from comment #6)

> 1. there is no "Checkout message" column in item types table
> (Administration->Item types),

Fixed this. 

> 2. probably checkout messages should be placed in messages section
> (id="messages") not in mainform (id="mainform").

Not exactly, that's included in messages.inc which is used in a lot of different places. However, I moved the dialog message/alert to the top of the screen, around where the messages div resides. 

> QA script:
> WARN   
These are all unrelated to my changes. 

However, still not ready for testing... noticed that checkin_message is utilized in SIP, thus, checkout message should probably be there too, so still some work to be done here.