示例#1
0
 public function insertStatus($newCustomer)
 {
     $status_data = Masterdata::where('type', '=', 'customer_activation_process')->get();
     foreach ($status_data as $key => $status) {
         $new_cust_status = new CustomerApplicationStatus();
         $new_cust_status->status_id = $status->id;
         $new_cust_status->customer_id = $this->id;
         $new_cust_status->done = 0;
         $new_cust_status->save();
     }
 }
 public static function statusSanityCheck($customer_id)
 {
     $message = "";
     $status_list = CustomerApplicationStatus::where('customer_id', '=', $customer_id)->where('done', '=', 1)->get();
     foreach ($status_list as $key => $current_status) {
         if ($current_status->statusName() == "fiber") {
             //check for splicing
             $splicing_check = CustomerApplicationStatus::where('customer_id', '=', $customer_id)->where('status_id', '=', Masterdata::getId("splicing", "customer_activation_process"))->first();
             if (!$splicing_check->done) {
                 $current_status->done = 0;
                 $current_status->save();
                 $message .= "Splicing Should be Done before proceed to Fiber!! ";
             }
         }
         //check the rest of the status and add the condition
         if ($current_status->statusName() == "configuration") {
             //check for all status the is done
             $all_status = CustomerApplicationStatus::where('customer_id', '=', $customer_id)->lists('done');
             if (in_array("0", $all_status)) {
                 $current_status->done = 0;
                 $current_status->save();
                 $message .= "All the steps has to be Done before proceed to configuration!! ";
             }
         }
     }
     if (empty($message)) {
         return array('status' => true);
     } else {
         return array('status' => false, 'message' => $message);
     }
 }