Beispiel #1
0
 /**
  * Send the email profile to the user
  */
 public function sendMail($task)
 {
     $ISP = ISP::getByCustomerId($task['customer_id']);
     if (!$ISP || !isset($ISP['isp_id']) || !is_numeric($ISP['isp_id'])) {
         // ISP not found, can't send mail
         return false;
     }
     // Get the service details
     $service = OrdersItems::getAllInfo($task['orderitem_id']);
     // If the setup has been written by the task action then ...
     if (!empty($service['setup'])) {
         $setup = json_decode($service['setup'], true);
         // Get the service/product name
         $productname = !empty($service['Products']['ProductsData'][0]['name']) ? $service['Products']['ProductsData'][0]['name'] : "";
         $welcome_mail = !empty($service['Products']['welcome_mail_id']) && intval($service['Products']['welcome_mail_id']) > 0 ? intval($service['Products']['welcome_mail_id']) : 'new_hosting';
         // new_hosting = fallback to old method if no template is set
         // Check if the customer is present in the service and if there is a welcome_mail set for the bought product
         if (!empty($service['Orders']['Customers'])) {
             // Getting the customer
             $customer = $service['Orders']['Customers'];
             $strSetup = "";
             foreach ($setup as $section => $details) {
                 $strSetup .= strtoupper($section) . "<hr/>";
                 foreach ($details as $label => $detail) {
                     $strSetup .= "{$label}: " . $detail . "<br/>";
                 }
                 $strSetup .= "<br/>";
             }
             Shineisp_Commons_Utilities::sendEmailTemplate($ISP['email'], $welcome_mail, array('setup' => $strSetup, 'fullname' => $customer['firstname'] . " " . $customer['lastname'], 'hostingplan' => $productname, 'controlpanel' => $ISP['website'] . ":8080", 'signature' => $ISP['company']), null, null, null, $ISP, $customer['language_id']);
         }
     }
 }