Bugzilla – Attachment 98124 Details for
Bug 23590
Add the ability to change the manager of a suggestion and notify the new manager
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23590: Add the ability to notify a new manager
Bug-23590-Add-the-ability-to-notify-a-new-manager.patch (text/plain), 5.46 KB, created by
Jonathan Druart
on 2020-01-30 09:31:54 UTC
(
hide
)
Description:
Bug 23590: Add the ability to notify a new manager
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-01-30 09:31:54 UTC
Size:
5.46 KB
patch
obsolete
>From 753ec4cc10b0beb2db3513066c6b971e2a6aa6f0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 7 Nov 2019 14:42:12 +0100 >Subject: [PATCH] Bug 23590: Add the ability to notify a new manager >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Sponsored-by: BULAC - http://www.bulac.fr/ > >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> >--- > .../prog/en/modules/suggestion/suggestion.tt | 14 +++++++++ > suggestion/suggestion.pl | 35 +++++++++++++++++++++- > 2 files changed, 48 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index 8cca56f9c4..391b4feea9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -391,6 +391,10 @@ > <a id="restore_previous_manager" href="#"><i class="fa fa-trash"></i> Keep existing manager</a> > [% END %] > <input type="hidden" name="managedby" id="managedby" value="[% logged_in_user.borrowernumber | html %]" /> >+ >+ <br/> >+ <label for="notify">Notify manager:</label> >+ <input type="checkbox" id="notify" name="notify" value="notify" disabled="disabled" title="A TO_PROCESS notice will be generated and send to the manager if a valid email address is defined. This can be checked if a new manager has been selected." /> > </div> > </li> > </ol> >@@ -871,6 +875,15 @@ > $('#managedby_name').html(managerlink); > $('#managedby').val(borrowernumber); > } >+ >+ var notify = $('#notify'); >+ if ( notify.length ) { >+ if ( borrowernumber == [% logged_in_user.borrowernumber | html %] || borrowernumber == [% managedby_patron.borrowernumber | html %] ) { >+ $(notify).prop('checked', false).prop('disabled', true); >+ } else { >+ $(notify).prop('disabled', false); >+ } >+ } > } > > $(document).ready(function(){ >@@ -1057,6 +1070,7 @@ > + borrowername + '</a>'; > $('#managedby_name').html(managerlink); > $('#managedby').val([% managedby_patron.borrowernumber | html %]); >+ $('#notify').prop('checked', false).prop('disabled', true); > }); > > }); >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 0ff3c42750..de1f69d1fe 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -91,6 +91,7 @@ my $managedby = $input->param('managedby'); > my $displayby = $input->param('displayby') || ''; > my $tabcode = $input->param('tabcode'); > my $save_confirmed = $input->param('save_confirmed') || 0; >+my $notify = $input->param('notify'); > > my $reasonsloop = GetAuthorisedValues("SUGGEST"); > >@@ -103,7 +104,7 @@ my $columns = ' '.join(' ', $schema->source('Suggestion')->columns).' '; > my $suggestion_only = { map { $columns =~ / $_ / ? ($_ => $suggestion_ref->{$_}) : () } keys %$suggestion_ref }; > $suggestion_only->{STATUS} = $suggestion_ref->{STATUS}; > >-delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field ); >+delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field notify ); > foreach (keys %$suggestion_ref){ > delete $$suggestion_ref{$_} if (!$$suggestion_ref{$_} && ($op eq 'else' )); > } >@@ -163,7 +164,39 @@ if ( $op =~ /save/i ) { > } > > if ( $suggestion_only->{'suggestionid'} > 0 ) { >+ > &ModSuggestion($suggestion_only); >+ >+ if ( $notify ) { >+ my $patron = Koha::Patrons->find( $suggestion_only->{managedby} ); >+ my $email_address = $patron->notice_email_address; >+ if ($patron->notice_email_address) { >+ my $budget = C4::Budgets::GetBudget( $suggestion_only->{budgetid} ); >+ my $library = $patron->library; >+ my $admin_email_address = $library->branchemail >+ || C4::Context->preference('KohaAdminEmailAddress'); >+ >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'suggestions', >+ letter_code => 'TO_PROCESS', >+ branchcode => $patron->branchcode, >+ lang => $patron->lang, >+ tables => { >+ suggestions => $suggestion_only->{suggestionid}, >+ branches => $patron->branchcode, >+ borrowers => $patron->borrowernumber, >+ }, >+ ); >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $patron->borrowernumber, >+ message_transport_type => 'email', >+ from_address => $admin_email_address, >+ } >+ ); >+ } >+ } > } else { > ###FIXME:Search here if suggestion already exists. > my $suggestions_loop = >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23590
:
95162
|
95163
|
95164
|
95165
|
95166
|
95167
|
95168
|
95169
|
95317
|
95318
|
95319
|
95320
|
95321
|
95322
|
95323
|
95324
|
95398
|
95399
|
95407
|
95408
|
95420
|
95421
|
95422
|
95423
|
95424
|
95425
|
95426
|
95427
|
95428
|
95429
|
95430
|
95431
|
95487
|
95488
|
95489
|
95490
|
95491
|
95492
|
95493
|
95494
|
95495
|
95496
|
95497
|
95498
|
98119
|
98120
|
98121
|
98122
|
98123
|
98124
|
98126
|
98127
|
98128
|
98129
|
98130
|
98131
|
98240
|
98267
|
98268
|
98279
|
100788
|
100789
|
100790
|
100791
|
100792
|
100793
|
100794
|
100795
|
100796
|
100797
|
100798
|
100799
|
100800
|
100801
|
100802
|
100803
|
100804
|
100846
|
100847
|
100848
|
100849
|
100850
|
100851
|
100852
|
100853
|
101539
|
101548
|
101588
|
101589
|
101590
|
101591
|
101592
|
101593
|
101594
|
101595
|
101596
|
101597
|
101598
|
101599
|
101600
|
101601
|
101602
|
101603
|
101604
|
101605
|
101606
|
101695