Bug 40933: Add the ability to send custom SMS messages to a patron
To test: 1. Make sure SMSSendDriver system preference is enabled 2. In staff client, navigate to patron details of any patron 3. From the members menu toolbar, click "Add Message" 4. Under "Add a message for", select "SMS - sms number of patron" 5. Write a custom message 6. Click "Save" 7. Navigate to patron's Notices tab 8. Observe a new notice titled "SMS added by a librarian" 9. Click it 10. Observe the content you wrote in step 5 11. Repeat steps 2-4 12. Select predefined patron notice. If you don't have one, navigate to Tools > Notices and slips > New notice > Patrons (custom message) and add content under sms delivery option 13. Repeat steps 6-7 14. Observe your custom message in the notices table 15. Observe your custom message content when you click the notice Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Charlie Arthur <carthur@slolibrary.org> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
4ddbf50529
commit
bee9d8da78
|
|
@ -63,8 +63,9 @@ if ( $op eq 'cud-edit_message' && $message_id ) {
|
|||
)->store;
|
||||
}
|
||||
|
||||
if ( $message_type eq 'E' ) {
|
||||
my $logged_in_patron = Koha::Patrons->find($loggedinuser);
|
||||
if ( $message_type eq 'E' or $message_type eq 'SMS' ) {
|
||||
my $message_transport_type = $message_type eq 'SMS' ? 'sms' : 'email';
|
||||
my $logged_in_patron = Koha::Patrons->find($loggedinuser);
|
||||
if ( !$logged_in_patron->has_permission( { borrowers => 'send_messages_to_borrowers' } ) ) {
|
||||
C4::Output::output_and_exit( $input, $cookie, $template, 'insufficient_permission' );
|
||||
}
|
||||
|
|
@ -78,10 +79,11 @@ if ( $op eq 'cud-edit_message' && $message_id ) {
|
|||
|
||||
if ($letter_code) {
|
||||
$letter = C4::Letters::GetPreparedLetter(
|
||||
module => 'add_message',
|
||||
letter_code => $letter_code,
|
||||
lang => $patron->lang,
|
||||
tables => {
|
||||
module => 'add_message',
|
||||
letter_code => $letter_code,
|
||||
lang => $patron->lang,
|
||||
message_transport_type => $message_transport_type,
|
||||
tables => {
|
||||
'borrowers' => $borrowernumber,
|
||||
'branches' => $branchcode,
|
||||
},
|
||||
|
|
@ -92,7 +94,7 @@ if ( $op eq 'cud-edit_message' && $message_id ) {
|
|||
{
|
||||
letter => $letter,
|
||||
borrowernumber => $borrowernumber,
|
||||
message_transport_type => 'email',
|
||||
message_transport_type => $message_transport_type,
|
||||
}
|
||||
) or warn "can't enqueue letter";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,6 +188,9 @@
|
|||
<option value="B">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option>
|
||||
[% IF CAN_user_borrowers_send_messages_to_borrowers %]
|
||||
<option value="E">Email - email addresses of patron</option>
|
||||
[% IF Koha.Preference("SMSSendDriver") %]
|
||||
<option value="SMS">SMS - sms number of patron</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ $(document).ready(function () {
|
|||
});
|
||||
|
||||
$("#message_type").on("change", function () {
|
||||
if ($(this).val() == "E") {
|
||||
if ($(this).val() == "E" || $(this).val() == "SMS") {
|
||||
$("label[for='borrower_message']").show();
|
||||
$("#subject_form").show();
|
||||
$("label[for='select_patron_notice']").show();
|
||||
|
|
@ -114,6 +114,16 @@ $(document).ready(function () {
|
|||
$("#borrower_message").prop("disabled", false);
|
||||
$("#select_patron_messages").val("");
|
||||
}
|
||||
if ($(this).val() == "SMS") {
|
||||
$("#borrower_subject").val(__("SMS added by a librarian"));
|
||||
$("#subject_form").hide();
|
||||
} else {
|
||||
if (
|
||||
$("#borrower_subject").val() == __("SMS added by a librarian")
|
||||
) {
|
||||
$("#borrower_subject").val("");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#select_patron_notice").on("change", function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue