public function createItem(EiScenario $ei_scenario, EiDelivery $ei_delivery, EiTicket $ei_ticket, sfGuardUser $guard_user, Doctrine_Connection $conn = null) { if ($conn == null) { $conn = Doctrine_Manager::connection(); } $stmt = $conn->prepare("INSERT INTO ei_package_scenario_conflict (ei_scenario_id,delivery_id,package_id, package_ref,resolved_date,resolved_author,created_at,updated_at) " . "VALUES (:ei_scenario_id,:delivery_id,:package_id, :package_ref,:resolved_date,:resolved_author,:created_at,:updated_at) " . "ON DUPLICATE KEY UPDATE ei_scenario_id=ei_scenario_id, delivery_id=delivery_id, package_id=:package_id,package_ref=:package_ref"); $stmt->bindValue("ei_scenario_id", $ei_scenario->getId()); $stmt->bindValue("delivery_id", $ei_delivery->getId()); $stmt->bindValue("package_id", $ei_ticket->getTicketId()); $stmt->bindValue("package_ref", $ei_ticket->getTicketRef()); $stmt->bindValue("resolved_date", date('Y-m-d H:i:s')); $stmt->bindValue("resolved_author", $guard_user->getId()); $stmt->bindValue("created_at", date('Y-m-d H:i:s')); $stmt->bindValue("updated_at", date('Y-m-d H:i:s')); $stmt->execute(array()); }
public static function getScriptUpdateResult(EiProjet $ei_project, EiProfil $kal_profil, EiTicket $ei_ticket, $json_string, KalFunction $kal_function, EiUser $ei_user, $script_id = 0, Doctrine_Connection $conn = null) { if ($conn == null) { $conn = Doctrine_Manager::connection(); } $ei_subject = Doctrine_Core::getTable("EiSubject")->findOneByPackageIdAndPackageRef($ei_ticket->getTicketId(), $ei_ticket->getTicketRef()); if ($ei_subject == null) { return array("success" => false, "message" => "Intervention not found ... "); } //Intervention non trouvée //Appel du webservice $result_update = MyFunction::loadResultOfWebServiceByPostJson(MyFunction::getPrefixPath(null) . "serviceweb/project/script/update.json", array('project_id' => $ei_project->getProjectId(), 'project_ref' => $ei_project->getRefId(), 'ticket_id' => $ei_ticket->getTicketId(), 'ticket_ref' => $ei_ticket->getTicketRef(), 'profile_id' => $kal_profil->getProfileId(), 'profile_ref' => $kal_profil->getProfileRef(), 'function_id' => $kal_function->getFunctionId(), 'function_ref' => $kal_function->getFunctionRef(), 'script_id' => $script_id, 'user_id' => $ei_user->getUserId(), 'user_ref' => $ei_user->getRefId(), 'package_name' => "Package_S" . $ei_subject->getId(), 'json_string' => rawurlencode($json_string))); //Récupération du projet pour traitement // if ($result_update == null) return null; // $result_file->loadXML($result_update); // $result_file->save('result_update.xml'); /* sauvegarde du fichier pour vérifier le bon fonctionnement du web service */ // $result_item=$result_file->documentElement; // if ($result_item->getElementsByTagName("error")->item(0)): // return -1; // endif; // if ($result_item->getElementsByTagName("process_error")->item(0)): // return 0; // endif; // if ($result_item->getElementsByTagName("process_ok")->item(0)): // return 1; // endif; try { $conn->beginTransaction(); //Récupération du ticket pour traitement $array_result = json_decode(html_entity_decode($result_update), true); //Récupération du projet pour traitement if (count($array_result) == 0) { return array("success" => false, "message" => "Error on transaction"); } if (array_key_exists("error", $array_result)) { return array("success" => false, "message" => $array_result["error"]); } if (array_key_exists("process_error", $array_result)) { return array("success" => false, "message" => $array_result["process_error"]); } if (!$array_result[0]) { return array("success" => false, "message" => "Empty result content"); } self::reload($array_result, $conn); $conn->commit(); return array("success" => true, "message" => "Transaction maded successfully"); } catch (Exception $e) { throw new Exception($e); $conn->rollback(); return array("success" => false, "message" => "Error on reload process ..."); } }
public function findVersionForPackage(EiTicket $ei_package, Doctrine_Connection $conn = null) { return $conn->createQuery()->from('EiVersion v')->leftJoin('v.EiVersionPackage sp')->where('sp.package_id=' . $ei_package->getTicketId() . ' And sp.package_ref=' . $ei_package->getTicketRef() . ' And sp.ei_scenario_id=' . $this->getId())->execute(); }
public function migrateBugFunction(EiTicket $ei_ticket, EiProjet $ei_project, EiProfil $ei_profile, KalFunction $ei_function, sfGuardUser $guard) { $result_file = new DOMDocument(); //Appel du webservice $result_update = self::loadResultOfWebServiceForMigration(MyFunction::getPrefixPath(null) . "/serviceweb/bug/migrateOne.xml", array('project_id' => $ei_project->getProjectId(), 'project_ref' => $ei_project->getRefId(), 'ticket_id' => $ei_ticket->getTicketId(), 'ticket_ref' => $ei_ticket->getTicketRef(), 'profile_id' => $ei_profile->getProfileId(), 'profile_ref' => $ei_profile->getProfileRef(), 'function_id' => $ei_function->getFunctionId(), 'function_ref' => $ei_function->getFunctionRef(), 'guard_id' => $guard->getId())); //Récupération du projet pour traitement if ($result_update == null) { return null; } $result_file->loadXML($result_update); $result_file->save('result_migrate_bug.xml'); /* sauvegarde du fichier pour vérifier le bon fonctionnement du web service */ $result_item = $result_file->documentElement; if ($result_item->getElementsByTagName("error")->item(0)) { return -1; } if ($result_item->getElementsByTagName("process_error")->item(0)) { return 0; } if ($result_item->getElementsByTagName("process_ok")->item(0)) { return true; } }