Bug 39781: Allow limiting of custom message notices by library
To test The following should work with either email or SMS notices sent from the Add Message button in a patron record 1 - create a notice in module Patrons (custom message) for all libraries 2 - create a notice in module Patrons (custom message) for Centerville 3 - while logged in at Centerville, confirm you can see and enqueue your all libraries message 4 - while logged in at Centerville, confirm you can see but cannot successfully enqueue your Centerville message 5 - while logged in at Fairfield, confirm you can see but cannot successfully enqueue your Centerville message 6 - apply patch, restart_all 7 - while logged in at Fairfield, confirm you can see and enqueue your all libraries message 8 - while logged in at Fairfield, confirm you cannot see your Centerville message 9 - while logged in at Centervielle, confirm you can see and enqueue your Centerville message Signed-off-by: Juliet Heltibridle <jheltibridle@rcplib.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
parent
ea5936b15a
commit
3a1bd59197
|
|
@ -23,6 +23,8 @@ use Template::Plugin;
|
||||||
use base qw( Template::Plugin );
|
use base qw( Template::Plugin );
|
||||||
|
|
||||||
use Koha::Notice::Templates;
|
use Koha::Notice::Templates;
|
||||||
|
use C4::Context;
|
||||||
|
use C4::Letters qw( GetLettersAvailableForALibrary );
|
||||||
|
|
||||||
sub GetByModule {
|
sub GetByModule {
|
||||||
my ( $self, $module ) = @_;
|
my ( $self, $module ) = @_;
|
||||||
|
|
@ -37,6 +39,24 @@ sub GetByModule {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub GetByModuleForLibrary {
|
||||||
|
my ( $self, $module ) = @_;
|
||||||
|
my $userenv = C4::Context->userenv;
|
||||||
|
my $branchcode = $userenv->{'branch'} // '';
|
||||||
|
|
||||||
|
return C4::Letters::GetLettersAvailableForALibrary(
|
||||||
|
{
|
||||||
|
branchcode => $branchcode,
|
||||||
|
module => $module,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group_by => [ 'code', 'name' ],
|
||||||
|
columns => [ 'code', 'name' ],
|
||||||
|
order_by => ['name']
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
Koha::Template::Plugin::NoticeTemplates - TT Plugin for notice templates
|
Koha::Template::Plugin::NoticeTemplates - TT Plugin for notice templates
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ if ( $op eq 'cud-edit_message' && $message_id ) {
|
||||||
letter_code => $letter_code,
|
letter_code => $letter_code,
|
||||||
lang => $patron->lang,
|
lang => $patron->lang,
|
||||||
message_transport_type => $message_transport_type,
|
message_transport_type => $message_transport_type,
|
||||||
|
branchcode => $branchcode,
|
||||||
tables => {
|
tables => {
|
||||||
'borrowers' => $borrowernumber,
|
'borrowers' => $borrowernumber,
|
||||||
'branches' => $branchcode,
|
'branches' => $branchcode,
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@
|
||||||
</li>
|
</li>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
[% patron_letters = NoticeTemplates.GetByModule( 'add_message' ) %]
|
[% patron_letters = NoticeTemplates.GetByModuleForLibrary( 'add_message' ) %]
|
||||||
[% IF patron_letters %]
|
[% IF patron_letters %]
|
||||||
<li class="form-group form-row">
|
<li class="form-group form-row">
|
||||||
<label for="select_patron_notice" class="col-form-lable" style="display:none;">Patron notice: </label>
|
<label for="select_patron_notice" class="col-form-lable" style="display:none;">Patron notice: </label>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue