From c6cb7a9ab29e4222fe0d3c519ebbb864a0e81700 Mon Sep 17 00:00:00 2001
From: Maxime Pelletier <maxime.pelletier@libeo.com>
Date: Tue, 30 Apr 2013 14:55:29 -0400
Subject: [PATCH] Bug 10076 Add Bcc syspref for claimacquisition and
 clamissues

Added syspref "ClaimsBccCopy" in Acquisitions.
Test by activating the preference and then go to Acquisitions -> Late Orders. Choose en order and click CLaim Order.
You should receive at your user email a copy in BCC of the mail you sent to the vendor.
---
 C4/Letters.pm                                                   |    3 +++
 .../prog/en/modules/admin/preferences/acquisitions.pref         |    7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/C4/Letters.pm b/C4/Letters.pm
index b8e2722..76430d7 100644
--- a/C4/Letters.pm
+++ b/C4/Letters.pm
@@ -370,6 +370,9 @@ sub SendAlerts {
             Message        => Encode::encode( "utf8", "" . $letter->{content} ),
             'Content-Type' => 'text/plain; charset="utf8"',
         );
+        if (C4::Context->preference("ClaimsBccCopy")) {
+            $mail{'Bcc'} = $userenv->{emailaddress};
+        }
         sendmail(%mail) or carp $Mail::Sendmail::error;
 
         logaction(
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
index 1ec49ff..51e5ee6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref
@@ -35,6 +35,13 @@ Acquisitions:
             - Default tax rates are
             - pref: gist
             - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |)
+        -
+            - Send a copy in bcc of the claimacquisition and claimissues letters to the active user
+            - pref: ClaimsBccCopy
+              default: no
+              choices:
+                yes: Send
+                no: Don't send
 
     Printing:
         -
-- 
1.7.10.4