Exemple #1
0
 /**
  * Action on 'Save' button
  *
  * @param ServiceContract $contract
  */
 private function updateServiceContractInfo($contract)
 {
     // TODO check sc_teamid in grantedTeams
     $sc_teamid = Tools::getSecurePOSTIntValue('sc_teamid');
     if ($sc_teamid != $this->teamid) {
         // switch team (because you won't find the SC in current team's contract list)
         $_SESSION['teamid'] = $sc_teamid;
         $this->updateTeamSelector();
     }
     $contract->setTeamid($sc_teamid);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractName');
     $contract->setName($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractReference', '');
     $contract->setReference($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractVersion', '');
     $contract->setVersion($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractReporter', '');
     $contract->setReporter($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('servicecontractDesc', '');
     $contract->setDesc($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('serviceContractStartDate', '');
     if ('' != $formattedValue) {
         $contract->setStartDate(Tools::date2timestamp($formattedValue));
     }
     $formattedValue = Tools::getSecurePOSTStringValue('serviceContractEndDate', '');
     if ('' != $formattedValue) {
         $contract->setEndDate(Tools::date2timestamp($formattedValue));
     }
     $contract->setState(SmartyTools::checkNumericValue($_POST['servicecontractState'], true));
 }
Exemple #2
0
 /**
  * @param Command $cmd
  */
 private function updateCmdInfo(Command $cmd)
 {
     // TODO check cmd_teamid in grantedTeams
     $cmd_teamid = Tools::getSecurePOSTIntValue('cmd_teamid');
     if ($cmd_teamid != $this->teamid) {
         // switch team (because you won't find the cmd in current team's contract list)
         $_SESSION['teamid'] = $cmd_teamid;
         $this->updateTeamSelector();
     }
     $cmd->setTeamid($cmd_teamid);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdName');
     // TODO UGLY WORKAROUND: command name cannot contain commas (,) because it is used as field separator in FilterManager
     $formattedValue = str_replace(",", ' ', $formattedValue);
     $cmd->setName($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdReference', '');
     $cmd->setReference($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdVersion', '');
     $cmd->setVersion($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdReporter', '');
     $cmd->setReporter($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdDesc', '');
     $cmd->setDesc($formattedValue);
     $formattedValue = Tools::getSecurePOSTStringValue('cmdStartDate', '');
     if ('' != $formattedValue) {
         $cmd->setStartDate(Tools::date2timestamp($formattedValue));
     }
     $formattedValue = Tools::getSecurePOSTStringValue('cmdDeadline', '');
     if ('' != $formattedValue) {
         $cmd->setDeadline(Tools::date2timestamp($formattedValue));
     }
     $cmd->setState(SmartyTools::checkNumericValue($_POST['cmdState'], true));
     $cmd->setAverageDailyRate(SmartyTools::checkNumericValue($_POST['cmdAverageDailyRate'], true));
     $cmd->setTotalSoldDays(SmartyTools::checkNumericValue($_POST['cmdTotalSoldDays'], true));
 }
Exemple #3
0
 /**
  * Action on 'Save' button
  *
  * @param CommandSet $cmdset
  */
 private function updateCommandSetInfo($cmdset)
 {
     // TODO check sc_teamid in grantedTeams
     $cset_teamid = Tools::getSecurePOSTIntValue('cset_teamid');
     if ($cset_teamid != $this->teamid) {
         // switch team (because you won't find the SC in current team's contract list)
         $_SESSION['teamid'] = $cset_teamid;
         $this->updateTeamSelector();
     }
     $cmdset->setTeamid($cset_teamid);
     $formattedValue = Tools::escape_string($_POST['commandsetName']);
     $cmdset->setName($formattedValue);
     $formattedValue = Tools::escape_string($_POST['commandsetReference']);
     $cmdset->setReference($formattedValue);
     $formattedValue = Tools::escape_string($_POST['commandsetDesc']);
     $cmdset->setDesc($formattedValue);
     $formattedValue = Tools::escape_string($_POST['commandsetDate']);
     if ('' != $formattedValue) {
         $cmdset->setDate(Tools::date2timestamp($formattedValue));
     }
     $cmdset->setCost(SmartyTools::checkNumericValue($_POST['commandsetCost'], true));
     $cmdset->setBudgetDays(SmartyTools::checkNumericValue($_POST['commandsetBudget'], true));
 }