function deleteAction() { $id = AF::get($_POST, 'id', 0); $modelsID = explode(',', $id); $errors = FALSE; foreach ($modelsID as $id) { $model = new Prospect(); $model->model_uset_id = $this->user->user_id; if ($model->fillFromDbPk($id)) { $model->delete($id); } else { $errors = TRUE; } if ($model->getErrors()) { $errors = TRUE; } unset($model); } if (isset($_POST['ajax'])) { AF::setJsonHeaders('json'); if ($errors) { Message::echoJsonError(__('prospect_no_deleted')); } else { Message::echoJsonSuccess(__('prospect_deleted')); } } $this->redirect(); }
public static function deleteProspectOkOrder($order_id) { if (!$order_id) { return false; } $o = Order::model()->fillFromDbPk($order_id); $p = new Prospect(); $p->prospectExists($o->customer_id, $o->campaign_id); // update silver pop record to 'is customer' and delete if ($p->prospect_id) { $p->updateSilverpopCustomer(); $p->delete(); } unset($p); unset($o); }