[Koha-patches] [PATCH] Bug 4211: This patch should provide a working way to send out mail from suggestions

Chris Cormack chrisc at catalyst.net.nz
Thu Aug 12 23:44:46 CEST 2010


Your suggestion notices template needs to contain things like
<<suggestions.title>>
<<suggestions.author>>
etc

Squashed commit of the following:

commit 3f4278bbe8d4c68be9f72d50e1eef6a411dc873d
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Fri Aug 13 09:41:34 2010 +1200

    bug 4211 parsing the letter before we enqueue it

commit ecdc0ff34c1aa9b96b68d541423ca693e2d63e67
Author: Chris Cormack <chrisc at catalyst.net.nz>
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 <oleonard at myacpl.org>
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 <chrisc at catalyst.net.nz>

commit 5c3bbe7d557b1994be72518746217fc6fc4e5b83
Author: Owen Leonard <oleonard at myacpl.org>
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 <chrisc at catalyst.net.nz>
---
 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() {
                                     <!--TMPL_ELSE-->
                                     <option value="catalogue" >Catalog</option>
                                     <!--/TMPL_IF-->
-                                    <!--TMPL_IF Name="serial"-->
-                                    <option value="serial" selected="selected">Serials (Routing List)</option>
+                                    <!--TMPL_IF Name="circulation"-->
+                                    <option value="circulation" selected="selected">Circulation</option>
                                     <!--TMPL_ELSE-->
-                                    <option value="serial">Serials (Routing List)</option>
+                                    <option value="circulation">Circulation</option>
                                     <!--/TMPL_IF-->
                                     <!--TMPL_IF Name="claimacquisition"-->
                                     <option value="claimacquisition" selected="selected">Claim Acquisition</option>
@@ -205,20 +205,25 @@ $(document).ready(function() {
                                     <!--TMPL_ELSE-->
                                     <option value="claimissues">Claim Serial Issue</option>
                                     <!--/TMPL_IF-->
-                                    <!--TMPL_IF Name="circulation"-->
-                                    <option value="circulation" selected="selected">Circulation</option>
+                                    <!--TMPL_IF Name="reserves"-->
+                                    <option value="reserves" selected="selected">Holds</option>
                                     <!--TMPL_ELSE-->
-                                    <option value="circulation">Circulation</option>
+                                    <option value="reserves">Holds</option>
                                     <!--/TMPL_IF-->
                                     <!--TMPL_IF Name="members"-->
                                     <option value="members" selected="selected">Members</option>
                                     <!--TMPL_ELSE-->
                                     <option value="members">Members</option>
                                     <!--/TMPL_IF-->
-                                    <!--TMPL_IF Name="reserves"-->
-                                    <option value="reserves" selected="selected">Holds</option>
+                                    <!--TMPL_IF Name="serial"-->
+                                    <option value="serial" selected="selected">Serials (Routing List)</option>
                                     <!--TMPL_ELSE-->
-                                    <option value="reserves">Holds</option>
+                                    <option value="serial">Serials (Routing List)</option>
+                                    <!--/TMPL_IF-->
+                                    <!--TMPL_IF Name="suggestions"-->
+                                    <option value="suggestions" selected="selected">Suggestions</option>
+                                    <!--TMPL_ELSE-->
+                                    <option value="suggestions">Suggestions</option>
                                     <!--/TMPL_IF-->
 				</select>
 			</li>
-- 
1.7.0.4



More information about the Koha-patches mailing list