Summary: | Custom patron messages should have access to information about the logged-in library they were sent from | ||
---|---|---|---|
Product: | Koha | Reporter: | Emily Lamancusa (emlam) <emily.lamancusa> |
Component: | Notices | Assignee: | Emily Lamancusa (emlam) <emily.lamancusa> |
Status: | Pushed to main --- | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | anneli.osterman, januszop, lucas, m.de.rooy, pmis |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: |
This enhancement allows branch information to be included in predefined notices templates for the `Patrons (custom message)` module, which defines notices that can be sent to patrons by clicking the "Add Message" button on the patron account. These notices can now use the `branch` tag to access information about the branch the staff member is logged into at the time they send the message. For example: `[% branch.branchname %]` - the logged-in branch's name, `[% branch.branchaddress1 %]` - the logged-in branch's address, etc.
|
|
Version(s) released in: |
25.05.00
|
Circulation function: | |
Bug Depends on: | 29393 | ||
Bug Blocks: | |||
Attachments: |
Bug 38095: Include logged-in branch in custom patron message
Bug 38095: Include logged-in branch in custom patron message Bug 38095: Include logged-in branch in custom patron message |
Description
Emily Lamancusa (emlam)
2024-10-04 14:19:31 UTC
+1 I would need it too. It seems that for the branch it would be enough to do this: diff --git a/circ/add_message.pl b/circ/add_message.pl index 08cf1e4d9f..3e6eb498d7 100755 --- a/circ/add_message.pl +++ b/circ/add_message.pl @@ -81,7 +81,7 @@ if ( $op eq 'cud-edit_message' && $message_id ) { module => 'add_message', letter_code => $letter_code, lang => $patron->lang, - tables => { 'borrowers' => $borrowernumber }, + tables => { 'borrowers' => $borrowernumber, 'branches' => $branchcode }, ); } Will you prepare the patch, Emily (as assignee)? Created attachment 172668 [details] [review] Bug 38095: Include logged-in branch in custom patron message To test: 1. Create a new notice template for a custom patron message i. Go to Tools > Notices and Slips ii. Create a new notice and choose Patrons (custom message) module iii. Add the following text to the email notice: You have a new notification from [% branches.branchname %] iv. Fill in other fields and save 2. Find a patron and go to their details page 3. Send the custom notice you just created i. Click Add message ii. Under "add a message for", select the email option iii. Under "Patron notice", select the notice you just created iv. Click "Save" 4. Open the patron's notices tab and look at the notice that was sent --> The branch name is left blank 5. Apply patch and refresh the patron page 6. Repeat steps 3-4 --> The branch code is now included in the notice Created attachment 172669 [details] [review] Bug 38095: Include logged-in branch in custom patron message To test: 1. Create a new notice template for a custom patron message i. Go to Tools > Notices and Slips ii. Create a new notice and choose Patrons (custom message) module iii. Add the following text to the email notice: You have a new notification from [% branches.branchname %] iv. Fill in other fields and save 2. Find a patron and go to their details page 3. Send the custom notice you just created i. Click Add message ii. Under "add a message for", select the email option iii. Under "Patron notice", select the notice you just created iv. Click "Save" 4. Open the patron's notices tab and look at the notice that was sent --> The branch name is left blank 5. Apply patch and refresh the patron page 6. Repeat steps 3-4 --> The branch code is now included in the notice Signed-off-by: Janusz Kaczmarek <januszop@gmail.com> I tested this in sandbox and it kind of works but not with [% branches.branchname %] as instructed. If you want to add branch name, you had to use <<branches.branchname>> instead. Is that how it was intended to work? (In reply to Anneli Österman from comment #4) > I tested this in sandbox and it kind of works but not with [% > branches.branchname %] as instructed. If you want to add branch name, you > had to use <<branches.branchname>> instead. Is that how it was intended to > work? I can confirm, that's true. But this seems to be another issue. [% borrowers.firstname %] does not work as well--seems to be a be a more general problem with letter templates interpretation (at least for custom patron messages). (In reply to Janusz Kaczmarek from comment #5) > (In reply to Anneli Österman from comment #4) > > I tested this in sandbox and it kind of works but not with [% > > branches.branchname %] as instructed. If you want to add branch name, you > > had to use <<branches.branchname>> instead. Is that how it was intended to > > work? > > I can confirm, that's true. But this seems to be another issue. [% > borrowers.firstname %] does not work as well--seems to be a be a more > general problem with letter templates interpretation (at least for custom > patron messages). Problem explained: for [% %] placeholders singular form should be used--it should be: [% branch.branchname %] [% borrower.firstname %] etc. whereas for << >> form the table name (usually plural: branches.column, borrowers.column etc.) is to be used. Emily, would you correct the test plan please? (The patch itself is fine). And of course comment #6 applies to all letter templates, not only to patron custom messages. Ahh, yes. It works with [% branch.branchname %]. Created attachment 178469 [details] [review] Bug 38095: Include logged-in branch in custom patron message To test: 1. Create a new notice template for a custom patron message i. Go to Tools > Notices and Slips ii. Create a new notice and choose Patrons (custom message) module iii. Add the following text to the email notice: You have a new notification from [% branches.branchname %] iv. Fill in other fields and save 2. Find a patron and go to their details page 3. Send the custom notice you just created i. Click Add message ii. Under "add a message for", select the email option iii. Under "Patron notice", select the notice you just created iv. Click "Save" 4. Open the patron's notices tab and look at the notice that was sent --> The branch name is left blank 5. Apply patch and refresh the patron page 6. Repeat steps 3-4 --> The branch code is now included in the notice Signed-off-by: Janusz Kaczmarek <januszop@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Pushed for 25.05! Well done everyone, thank you! |