function doUpdate(&$argsObj, &$buildMgr, &$tplanMgr, $dateFormat) { $op = new stdClass(); $op->operation_descr = ''; $op->user_feedback = ''; $op->template = "buildEdit.tpl"; $op->notes = $argsObj->notes; $op->status_ok = 0; $op->buttonCfg = null; $oldObjData = $buildMgr->get_by_id($argsObj->build_id); $oldname = $oldObjData['name']; $check = crossChecks($argsObj, $tplanMgr, $dateFormat); if ($check->status_ok) { $user_feedback = lang_get("cannot_update_build"); if ($buildMgr->update($argsObj->build_id, $argsObj->build_name, $argsObj->notes, $argsObj->is_active, $argsObj->is_open, $argsObj->release_date)) { if ($argsObj->closed_on_date == '') { $argsObj->closed_on_date = mktime(0, 0, 0, date("m"), date("d"), date("Y")); } if ($argsObj->is_open == 1) { $targetDate = null; } else { $targetDate = date("Y-m-d", $argsObj->closed_on_date); } $buildMgr->setClosedOnDate($argsObj->build_id, $targetDate); $op->user_feedback = ''; $op->notes = ''; $op->template = null; $op->status_ok = 1; logAuditEvent(TLS("audit_build_saved", $argsObj->tproject_name, $argsObj->tplan_name, $argsObj->build_name), "SAVE", $argsObj->build_id, "builds"); } } if (!$op->status_ok) { $op->operation_descr = lang_get('title_build_edit') . TITLE_SEP_TYPE3 . $oldname; $op->buttonCfg = new stdClass(); $op->buttonCfg->name = "do_update"; $op->buttonCfg->value = lang_get('btn_save'); $op->user_feedback = $check->user_feedback; } return $op; }
function doUpdate($argsObj, &$tprojectMgr, $sessionTprojectID) { $key2get = array('status_ok', 'msg'); $op = new stdClass(); $op->ui = new stdClass(); $op->status_ok = 0; $op->msg = ''; $op->template = null; $op->reloadType = 'none'; $oldObjData = $tprojectMgr->get_by_id($argsObj->tprojectID); $op->oldName = $oldObjData['name']; $check_op = crossChecks($argsObj, $tprojectMgr); foreach ($key2get as $key) { $op->{$key} = $check_op[$key]; } if ($op->status_ok) { $options = prepareOptions($argsObj); if ($tprojectMgr->update($argsObj->tprojectID, trim($argsObj->tprojectName), $argsObj->color, $argsObj->notes, $options, $argsObj->active, $argsObj->tcasePrefix, $argsObj->is_public)) { $op->msg = ''; $tprojectMgr->activate($argsObj->tprojectID, $argsObj->active); $tprojectMgr->setIssueTrackerEnabled($argsObj->tprojectID, $argsObj->issue_tracker_enabled); $itMgr = new tlIssueTracker($tprojectMgr->db); if ($doLink = $argsObj->issue_tracker_id > 0) { $itMgr->link($argsObj->issue_tracker_id, $argsObj->tprojectID); } else { $issueT = $itMgr->getLinkedTo($argsObj->tprojectID); if (!is_null($issueT)) { $itMgr->unlink($issueT['issuetracker_id'], $issueT['testproject_id']); } } $tprojectMgr->setReqMgrIntegrationEnabled($argsObj->tprojectID, $argsObj->reqmgr_integration_enabled); $mgr = new tlReqMgrSystem($tprojectMgr->db); if ($doLink = $argsObj->reqmgrsystem_id > 0) { $mgr->link($argsObj->reqmgrsystem_id, $argsObj->tprojectID); } else { $et = $mgr->getLinkedTo($argsObj->tprojectID); if (!is_null($et)) { $mgr->unlink($et['reqmgrsystem_id'], $et['testproject_id']); } } if (!$argsObj->is_public) { // does user have an SPECIFIC role on Test Project ? // if answer is yes => do nothing if (!tlUser::hasRoleOnTestProject($tprojectMgr->db, $argsObj->userID, $argsObj->tprojectID)) { $tprojectMgr->addUserRole($argsObj->userID, $argsObj->tprojectID, $argsObj->user->globalRole->dbID); } } $event = new stdClass(); $event->message = TLS("audit_testproject_saved", $argsObj->tprojectName); $event->logLevel = "AUDIT"; $event->source = "GUI"; $event->objectID = $argsObj->tprojectID; $event->objectType = "testprojects"; $event->code = "UPDATE"; logEvent($event); } else { $op->status_ok = 0; } } if ($op->status_ok) { if ($sessionTprojectID == $argsObj->tprojectID) { $op->reloadType = 'reloadNavBar'; } } else { $op->ui->doActionValue = 'doUpdate'; $op->ui->buttonValue = lang_get('btn_save'); $op->ui->caption = sprintf(lang_get('caption_edit_tproject'), $op->oldName); } return $op; }
function doUpdate($argsObj, &$tprojectMgr, $contextTprojectID) { $key2get = array('status_ok', 'msg'); $op = new stdClass(); $op->ui = new stdClass(); $op->status_ok = 0; $op->msg = ''; $op->template = null; $op->reloadType = 'none'; $oldObjData = $tprojectMgr->get_by_id($argsObj->tprojectID); $op->oldName = $oldObjData['name']; $check_op = crossChecks($argsObj, $tprojectMgr); foreach ($key2get as $key) { $op->{$key} = $check_op[$key]; } if ($op->status_ok) { $options = prepareOptions($argsObj); if ($tprojectMgr->update($argsObj->tprojectID, trim($argsObj->tprojectName), $argsObj->color, $argsObj->notes, $options, $argsObj->active, $argsObj->tcasePrefix, $argsObj->is_public)) { $op->msg = ''; $tprojectMgr->activate($argsObj->tprojectID, $argsObj->active); logAuditEvent(TLS("audit_testproject_saved", $argsObj->tprojectName), "UPDATE", $argsObj->tprojectID, "testprojects"); } else { $op->status_ok = 0; } } if ($op->status_ok) { if ($contextTprojectID == $argsObj->tprojectID) { $op->reloadType = 'reloadNavBar'; } } else { $op->ui->doActionValue = 'doUpdate'; $op->ui->buttonValue = lang_get('btn_save'); $op->ui->caption = sprintf(lang_get('caption_edit_tproject'), $op->oldName); } return $op; }