Beispiel #1
0
 /**
  * Check the expiring orders.
  *
  * Only the orders where renewal option has been set as
  * false send an email to the client to inform him
  * that his order has been set as deleted.
  */
 public static function checkExpiringOrders()
 {
     $orders = Orders::find_all_expired_orders(date('Y-m-d'));
     foreach ($orders as $order) {
         $customer = Customers::getAllInfo($order['customer_id']);
         $ISP = ISP::getActiveIspById($customer['isp_id']);
         // Get the fastlink attached
         $link_exist = Fastlinks::findlinks($order['order_id'], $order['customer_id'], 'orders');
         if (count($link_exist) > 0) {
             $fastlink = $link_exist[0]['code'];
         } else {
             $fastlink = Fastlinks::CreateFastlink('orders', 'edit', json_encode(array('id' => $order['order_id'])), 'orders', $order['order_id'], $customer['customer_id']);
         }
         $customer_url = "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/{$fastlink}";
         Shineisp_Commons_Utilities::sendEmailTemplate($customer['email'], 'order_expired', array('orderid' => $order['order_number'], ':shineisp:' => $customer, 'url' => $customer_url), null, null, null, $ISP, $customer['language_id'], Settings::findbyParam('cron_notify'));
         // Set the order as deleted
         Orders::set_status($order['order_id'], Statuses::id('deleted', 'orders'));
     }
     return true;
 }