]> _ Git - cubeextranet.git/commitdiff
Wait #5345 @1
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 31 Oct 2022 09:49:23 +0000 (09:49 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 31 Oct 2022 09:49:23 +0000 (09:49 +0000)
inc/ws/Controlleur/class.ws.services.php

index 2a61d1e4e2303379e06f97515a4fb113c63307cf..b217a49a4baf43308fe851a8d7f5eb26296fbc1d 100644 (file)
@@ -1606,22 +1606,32 @@ class wsServices extends cubeFlashGateway
         // The Fluidbook can pass on a parameter that overrides the default recipient
         $recipient_code = $_POST['recipient_code'] ?? '';
 
+        $default_bastide_address = 'web@hcm-medical.com'; // Fallback address + destination for all BCC messages
+
         switch(strtolower($recipient_code)) {
-            case 'guadeloupe':
-                $email_for_bastide = 'contact2@bastide-guadeloupe.com';
-                break;
-            case 'commercial':
+            case 'co-guadeloupe':
                 $email_for_bastide = 'commercial@bastide-guadeloupe.com';
                 break;
-            case 'martinique':
-                $email_for_bastide = 'commercial2@bastide-martinique.com';
+            case 'gp-guadeloupe':
+                $email_for_bastide = 'magasin@bastide-guadeloupe.com';
+                break;
+            case 'pro-guadeloupe':
+                $email_for_bastide = 'contact@bastide-guadeloupe.com';
+                break;
+            case 'gp-martinique':
+                $email_for_bastide = 'magasin@bastide-martinique.com';
                 break;
-            case 'réunion':
-            case 'reunion':
-                $email_for_bastide = 'info@bastide.re';
+            case 'pro-martinique':
+                $email_for_bastide = 'adv@bastide-martinique.com';
+                break;
+            case 'gp-réunion':
+            case 'gp-reunion':
+            case 'pro-réunion':
+            case 'pro-reunion':
+                $email_for_bastide = 'reseau@bastide.re';
                 break;
             default:
-                $email_for_bastide = 'ca@hcm-medical.fr';
+                $email_for_bastide = $default_bastide_address;
         }
 
         $return_address = 'postmaster@fluidbook.com';
@@ -1666,6 +1676,12 @@ class wsServices extends cubeFlashGateway
             $attachment_basename  . '.xlsx'
         );
 
+        // When the recipient isn't the default Bastide address, we add them in as a BCC so they can track the messages
+        // See: https://redmine.cubedesigners.com/issues/5345#note-36
+        if ($email_for_bastide !== $default_bastide_address) {
+            $mail_to_bastide->addBcc($default_bastide_address);
+        }
+
         //=== Send the e-mails
         try {
             $mail_to_bastide->send($transport);