static function ChangeStatus($PlanID, $StepID, $ActDesc = "", $LogOnly = false, $pdo = null) { if (!$LogOnly) { $obj = new PLN_plans(); $obj->PlanID = $PlanID; $obj->StepID = $StepID; if (!$obj->EditPlan($pdo)) { return false; } } return WFM_FlowRows::AddOuterFlow(FLOWID, $PlanID, $StepID, $ActDesc, $pdo); }
function ChangeStatus() { $StepID = $_POST["StepID"]; $ActDesc = $_POST["ActDesc"]; $PlanID = $_REQUEST["PlanID"]; $obj = new PLN_plans($PlanID); //-------------------- control valid operation ----------------------- if ($_SESSION["USER"]["IsCustomer"] == "YES" && isset($_SESSION["USER"]["portal"]) && $obj->PersonID != $_SESSION["USER"]["PersonID"]) { Response::createObjectiveResponse(false, ""); die; } //--------------- check filling Mandatory groups --------------------- if ($obj->PersonID == $_SESSION["USER"]["PersonID"] && $StepID == STEPID_CUSTOMER_SEND) { $dt = PdoDataAccess::runquery("\r\n\t\t\tSELECT concat_ws(' / ',g1.GroupDesc,g2.GroupDesc,g3.GroupDesc ,g.GroupDesc) \r\n\t\t\tFROM PLN_groups g\r\n\t\t\tleft join PLN_groups g3 on(g3.GroupID=g.ParentID)\r\n\t\t\tleft join PLN_groups g2 on(g2.GroupID=g3.ParentID)\r\n\t\t\tleft join PLN_groups g1 on(g1.GroupID=g2.ParentID)\r\n\t\t\t\r\n\t\t\tjoin PLN_Elements e on(g.GroupID=e.GroupID)\r\n\t\t\tleft join PLN_PlanItems pe on(pe.PlanID=? AND pe.ElementID=e.ElementID)\r\n\t\t\twhere g.IsMandatory='YES' AND e.ParentID=0 AND pe.PlanID is null", array($PlanID)); if (count($dt) > 0) { $msg = array(); foreach ($dt as $row) { $msg[] = $row[0]; } Response::createObjectiveResponse(false, "جهت ارسال طرح تکمیل بخش های زیر الزامی است <br>" . implode("<br>", $msg)); die; } } //-------------------------------------------------------------------- if ($_SESSION["USER"]["IsCustomer"] == "YES" && isset($_SESSION["USER"]["portal"])) { $StepID = STEPID_CUSTOMER_SEND; } if (isset($_SESSION["USER"]["framework"]) && $StepID == STEPID_CONFIRM) { $dt = PdoDataAccess::runquery("\r\n\t\t\tselect p.GroupID,ActType from PLN_PlanSurvey p,\r\n\t\t\t\t(select GroupID,max(RowID) RowID from PLN_PlanSurvey where PlanID=2 AND GroupID>0\r\n\t\t\t\tgroup by GroupID)t\r\n\t\t\twhere PlanID=2 AND p.RowID =t.RowID AND p.GroupID=t.GroupID AND ActType='REJECT'\r\n\t\t\tgroup by GroupID", array(":p" => $PlanID)); if (count($dt) > 0) { echo Response::createObjectiveResponse(false, "بعضی از جداول رد شده اند و قادر به تایید طرح نمی باشید"); die; } } $result = PLN_plans::ChangeStatus($obj->PlanID, $StepID, $ActDesc); /*if($StepID == STEPID_CONFIRM) { $result = WFM_FlowRows::StartFlow(FLOWID, $obj->PlanID); }*/ echo Response::createObjectiveResponse($result, ""); die; }