Bug 29393 added the ability to define custom notices that could be sent from the patron account page. It would be useful if these notices had access to information about the logged-in library from which the notice was triggered. For example, we'd like to use this feature to add an email template for notifying a patron that a lost library card was found and turned in to the library. That notice should include which branch found the card and triggered the notice, which may not be the patron's home library.
+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 %].