From 25887e31848d3da9bf2762cb8f39c22d7b1ea014 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Fri, 13 Aug 2010 09:42:08 +1200 Subject: [PATCH] Bug 4211: This patch should provide a working way to send out mail from suggestions Your suggestion notices template needs to contain things like <> <> etc Squashed commit of the following: commit 3f4278bbe8d4c68be9f72d50e1eef6a411dc873d Author: Chris Cormack Date: Fri Aug 13 09:41:34 2010 +1200 bug 4211 parsing the letter before we enqueue it commit ecdc0ff34c1aa9b96b68d541423ca693e2d63e67 Author: Chris Cormack Date: Fri Aug 13 09:32:09 2010 +1200 Changing the query to fetch suggestions data, this is needed for suggestion mail to be sent commit ece11d015b945ce119cf7cbc5e2563f4bc8aecf9 Author: Owen Leonard Date: Thu Aug 12 12:36:26 2010 -0400 Fix for Bug 4211, Acquisitions actions on suggestions don't generate email Assuming 1) The patch for Bug 5126 is approved and 2) Suggestions notices are added by hand (or from default sql--see Bug 5127) this correction should get suggestions notices properly enqueued. Signed-off-by: Chris Cormack commit 5c3bbe7d557b1994be72518746217fc6fc4e5b83 Author: Owen Leonard Date: Thu Aug 12 12:27:33 2010 -0400 Fix for Bug 5126 - Suggestions module missing from "add notice" form - Adding "suggestions" entry - Re-ordering options in alphabetical order Signed-off-by: Chris Cormack --- C4/Letters.pm | 3 +- C4/Suggestions.pm | 11 ++++++--- .../prog/en/modules/tools/letter.tmpl | 23 ++++++++++++------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 885ed5f..592fa73 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -483,11 +483,10 @@ sub parseletter_sth { ($table eq 'biblio' ) ? "SELECT * FROM $table WHERE biblionumber = ?" : ($table eq 'biblioitems' ) ? "SELECT * FROM $table WHERE biblionumber = ?" : ($table eq 'items' ) ? "SELECT * FROM $table WHERE itemnumber = ?" : - ($table eq 'suggestions' ) ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?" : ($table eq 'reserves' ) ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?" : ($table eq 'borrowers' ) ? "SELECT * FROM $table WHERE borrowernumber = ?" : ($table eq 'branches' ) ? "SELECT * FROM $table WHERE branchcode = ?" : - ($table eq 'suggestions' ) ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?" : + ($table eq 'suggestions' ) ? "SELECT * FROM $table WHERE suggestionid = ?" : ($table eq 'aqbooksellers') ? "SELECT * FROM $table WHERE id = ?" : undef ; unless ($query) { warn "ERROR: No parseletter_sth query for table '$table'"; diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index b5eb7a4..87a71e4 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -379,18 +379,21 @@ Note that there is no function to modify a suggestion. sub ModSuggestion { my ($suggestion)=@_; my $status_update_table=UpdateInTable("suggestions", $suggestion); - # check mail sending. +# check mail sending. if ($$suggestion{STATUS}){ my $letter=C4::Letters::getletter('suggestions',$suggestion->{STATUS}); if ($letter){ - my $enqueued = C4::Letters::EnqueueLetter({ + C4::Letters::parseletter($letter, 'borrowers', $suggestion->{suggestedby}); + C4::Letters::parseletter($letter, 'suggestions', $suggestion->{suggestionid}); + C4::Letters::parseletter($letter, 'biblio', $suggestion->{biblionumber}); + my $enqueued = C4::Letters::EnqueueLetter({ letter=>$letter, borrowernumber=>$suggestion->{suggestedby}, suggestionid=>$suggestion->{suggestionid}, LibraryName => C4::Context->preference("LibraryName"), - msg_transport_type=>'email' + message_transport_type=>'email' }); - if (!$enqueued){warn "can't enqueue letter $letter";} + if (!$enqueued){warn "can't enqueue letter $letter";} } } return $status_update_table; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tmpl index 8f52903..b2b2789 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tmpl @@ -190,10 +190,10 @@ $(document).ready(function() { - - + + - + @@ -205,20 +205,25 @@ $(document).ready(function() { - - + + - + - - + + - + + + + + + -- 1.7.0.4