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));
 }