Bugzilla – Attachment 83385 Details for
Bug 5770
Email librarian when purchase suggestion made
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5770: Notify for new suggestion
Bug-5770-Notify-for-new-suggestion.patch (text/plain), 3.60 KB, created by
Devinim
on 2018-12-19 12:01:41 UTC
(
hide
)
Description:
Bug 5770: Notify for new suggestion
Filename:
MIME Type:
Creator:
Devinim
Created:
2018-12-19 12:01:41 UTC
Size:
3.60 KB
patch
obsolete
>From 26b562c5f902b14ecc3c3cc3563d1680fb382dd1 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Nazl=C4=B1=20=C3=87etin?= <nazli@devinim.com.tr> >Date: Wed, 19 Dec 2018 11:37:54 +0000 >Subject: [PATCH] Bug 5770: Notify for new suggestion > >--- > C4/Suggestions.pm | 33 +++++++++++++++++++++- > .../data/mysql/atomicupdate/bug_5770_notice.sql | 26 +++++++++++++++++ > 2 files changed, 58 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_5770_notice.sql > >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 70b7b0de020..0aba6a6f831 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -454,7 +454,38 @@ sub NewSuggestion { > $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate}; > > my $rs = Koha::Database->new->schema->resultset('Suggestion'); >- return $rs->create($suggestion)->id; >+ my $new_id = $rs->create($suggestion)->id; >+ >+ my $full_suggestion = GetSuggestion( $new_id ); >+ if ( >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'suggestions', >+ letter_code => 'NEW_SUGGESTION', >+ tables => { >+ 'branches' => $full_suggestion->{branchcode}, >+ 'borrowers' => $full_suggestion->{suggestedby}, >+ 'suggestions' => $full_suggestion, >+ }, >+ ) >+ ){ >+ my $emailpurchasesuggestions = C4::Context->preference("EmailPurchaseSuggestions"); >+ >+ my $toaddress = ( $emailpurchasesuggestions eq "BranchEmailAddress" ) >+ ? Koha::Libraries->find($full_suggestion->{branchcode})->branchemail >+ : C4::Context->preference( $emailpurchasesuggestions ) ; >+ >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $full_suggestion->{suggestedby}, >+ suggestionid => $full_suggestion->{suggestionid}, >+ to_address => $toaddress, >+ message_transport_type => 'email', >+ } >+ ) or warn "can't enqueue letter $letter"; >+ } >+ >+ return $new_id; > } > > =head2 ModSuggestion >diff --git a/installer/data/mysql/atomicupdate/bug_5770_notice.sql b/installer/data/mysql/atomicupdate/bug_5770_notice.sql >new file mode 100644 >index 00000000000..c816fdfdc4c >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_5770_notice.sql >@@ -0,0 +1,26 @@ >+INSERT IGNORE INTO `letter` (module, code, name, title, content, is_html, message_transport_type) >+VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New Suggestion','<h3> Suggestion pending approval</h3> >+<p><h4>Suggested by</h4> >+ <ul> >+ <li><<borrowers.firstname>> <<borrowers.surname>></li> >+ <li><<borrowers.cardnumber>></li> >+ <li><<borrowers.phone>></li> >+ <li><<borrowers.email>></li> >+ </ul> >+</p> >+<p><h4>Item on suggestion</h4> >+ <ul> >+ <li><b>Library : </b> <<branches.branchname>></li> >+ <li><b>Title : </b> <<suggestions.title>></li> >+ <li><b>Author : </b> <<suggestions.author>></li> >+ <li><b>Copyright date : </b> <<suggestions.copyrightdate>></li> >+ <li><b>Standard number (ISBN, ISSN or other) : </b> <<suggestions.isbn>></li> >+ <li><b>Publisher : </b> <<suggestions.publishercode>></li> >+ <li><b>Collection title : </b> <<suggestions.collectiontitle>></li> >+ <li><b>Publication place : </b> <<suggestions.place>></li> >+ <li><b>Quantity : </b> <<suggestions.quantity>></li> >+ <li><b>Item type : </b> <<suggestions.itemtype>></li> >+ <li><b>Reason for suggestion : </b> <<suggestions.patronreason>></li> >+ <li><b>Notes : </b> <<suggestions.note>></li> >+ </ul> >+</p>',1, 'email'); >-- >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 5770
:
83384
|
83385
|
83386
|
83387
|
83388
|
83390
|
83615
|
83616
|
83617
|
84463
|
84812
|
89139
|
89140
|
89141
|
89142
|
89144
|
89145
|
89146
|
89147
|
89188
|
89189
|
89190
|
89191
|
89192
|
89193
|
89194
|
89195