Exemplo n.º 1
0
 /**
  * Adds the given employee as a admin to the given project.
  * If the employee is already an admin, the request is ignored.
  *
  * @param int $projectId The project ID
  * @param int $empNumber The employee number
  * @return true if successful
  */
 public function addAdmin($projectId, $empNumber)
 {
     if (!CommonFunctions::isValidId($projectId) || !CommonFunctions::isValidId($empNumber)) {
         throw new ProjectAdminException("Invalid parameters to addAdmin(): emp_number = {$empNumber} , " . "projectId = {$projectId}");
     }
     $result = true;
     if (!$this->isAdmin($empNumber, $projectId)) {
         $fields[0] = self::PROJECT_ADMIN_FIELD_PROJECT_ID;
         $fields[1] = self::PROJECT_ADMIN_FIELD_EMP_NUMBER;
         $values[0] = "'{$projectId}'";
         $values[1] = "'{$empNumber}'";
         $sqlBuilder = new SQLQBuilder();
         $sqlBuilder->table_name = self::TABLE_NAME;
         $sqlBuilder->flg_insert = 'true';
         $sqlBuilder->arr_insert = $values;
         $sqlBuilder->arr_insertfield = $fields;
         $sql = $sqlBuilder->addNewRecordFeature2();
         $conn = new DMLFunctions();
         $result = $conn->executeQuery($sql);
         if (!$result || mysql_affected_rows() != 1) {
             $result = false;
         } else {
             $this->id = mysql_insert_id();
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Sets the 'value' corresponding to 'key'
  * If the 'key' is already availabe, correponding 'value' would be updated.
  * If not, a new 'key', 'value' pair would be inserted.
  * @param string $key 'key' field corresponding to the value to be set
  * @param string $value 'value' that should be set
  */
 private static function _setValue($key, $value)
 {
     $updateFields[0] = "`" . self::DB_FIELD_KEY . "`";
     $updateFields[1] = "`" . self::DB_FIELD_VALUE . "`";
     $updateValues[0] = "'" . $key . "'";
     $updateValues[1] = "'" . $value . "'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::DB_TABLE_CONFIG;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $updateValues;
     $sqlBuilder->arr_insertfield = $updateFields;
     $query = $sqlBuilder->addNewRecordFeature2(true, true);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if (!$result) {
         throw new Exception("Value corresponding to {$key} was not updated");
     }
 }
 /**
  * Add new CustomExport object to database
  */
 private function _insert()
 {
     $fields[0] = self::DB_FIELDS_ID;
     $fields[1] = self::DB_FIELDS_NAME;
     $fields[2] = self::DB_FIELDS_FIELDS;
     $fields[3] = self::DB_FIELDS_HEADINGS;
     $this->id = UniqueIDGenerator::getInstance()->getNextID(self::TABLE_NAME, self::DB_FIELDS_ID);
     $values[0] = $this->id;
     $values[1] = "'{$this->name}'";
     $values[2] = "'" . implode(",", $this->assignedFields) . "'";
     $values[3] = empty($this->headings) ? "''" : "'" . implode(",", $this->headings) . "'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         throw new CustomExportException("Insert failed. {$sql}", CustomExportException::DB_EXCEPTION);
     }
 }
Exemplo n.º 4
0
 function addEmpLang()
 {
     $arrRecordsList[0] = "'" . $this->getEmpId() . "'";
     $arrRecordsList[1] = "'" . $this->getEmpLangCode() . "'";
     $arrRecordsList[2] = "'" . $this->getEmpLangType() . "'";
     $arrRecordsList[3] = "'" . $this->empLangRatGrd . "'";
     $arrFieldList[0] = 'EMP_NUMBER';
     $arrFieldList[1] = 'LANG_CODE';
     $arrFieldList[2] = 'ELANG_TYPE';
     $arrFieldList[3] = 'COMPETENCY';
     $tableName = 'HS_HR_EMP_LANGUAGE';
     $sql_builder = new SQLQBuilder();
     $sql_builder->table_name = $tableName;
     $sql_builder->flg_insert = 'true';
     $sql_builder->arr_insertfield = $arrFieldList;
     $sql_builder->arr_insert = $arrRecordsList;
     $sqlQString = $sql_builder->addNewRecordFeature2(true, true);
     $dbConnection = new DMLFunctions();
     $message2 = $dbConnection->executeQuery($sqlQString);
     //Calling the addData() function
     return $message2;
 }
Exemplo n.º 5
0
 private function _insert()
 {
     $fields[0] = self::DB_FIELD_WORKSHIFT_ID;
     $fields[1] = self::DB_FIELD_NAME;
     $fields[2] = self::DB_FIELD_HOURS;
     $this->workshiftId = UniqueIDGenerator::getInstance()->getNextID(self::WORKSHIFT_TABLE, self::DB_FIELD_WORKSHIFT_ID);
     $values[0] = $this->workshiftId;
     $values[1] = "'{$this->name}'";
     $values[2] = "'{$this->hoursPerDay}'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::WORKSHIFT_TABLE;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($sql);
     if (!$result) {
         throw new WorkshiftException("Workshift not inserted", WorkshiftException::ERROR_IN_DB_QUERY);
     }
     if (mysql_affected_rows() != 1) {
         throw new WorkshiftException("Workshift not inserted", WorkshiftException::INVALID_ROW_COUNT);
     }
     return mysql_affected_rows();
 }
 function addSalCurDet()
 {
     $arrFieldList[0] = 'SAL_GRD_CODE';
     $arrFieldList[1] = 'CURRENCY_ID';
     $arrFieldList[2] = 'SALCURR_DTL_MINSALARY';
     $arrFieldList[3] = 'SALCURR_DTL_MAXSALARY';
     $arrFieldList[4] = 'SALCURR_DTL_STEPSALARY';
     $arrRecordList[0] = "'" . $this->getSalGrdId() . "'";
     $arrRecordList[1] = "'" . $this->getCurrId() . "'";
     $minSal = $this->getMinSal() == '' ? 'null' : $this->getMinSal();
     $arrRecordList[2] = $minSal;
     $maxSal = $this->getMaxSal() == '' ? 'null' : $this->getMaxSal();
     $arrRecordList[3] = $maxSal;
     $stepSal = $this->getStepSal() == '' ? 'null' : $this->getStepSal();
     $arrRecordList[4] = $stepSal;
     $tableName = 'HS_PR_SALARY_CURRENCY_DETAIL';
     $sql_builder = new SQLQBuilder();
     $sql_builder->table_name = $tableName;
     $sql_builder->flg_insert = 'true';
     $sql_builder->arr_insert = $arrRecordList;
     $sql_builder->arr_insertfield = $arrFieldList;
     $sqlQString = $sql_builder->addNewRecordFeature2();
     $dbConnection = new DMLFunctions();
     $message2 = $dbConnection->executeQuery($sqlQString);
     //Calling the addData() function
     return $message2;
 }
 public function addProperty()
 {
     $dbConnection = new DMLFunctions();
     $sqlB->arr_insert = array($this->getPropName());
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = $this->TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = array($this->getPropName());
     $sqlBuilder->arr_insertfield = array("prop_name");
     $sql = $sqlBuilder->addNewRecordFeature2();
     $dbConnection->executeQuery($sql);
     return 1;
     //report success
 }
Exemplo n.º 8
0
 function addEmpBasSal()
 {
     $this->getEmpId();
     $arrFieldList[0] = "'" . $this->getEmpId() . "'";
     $arrFieldList[1] = "'" . $this->getEmpSalGrdCode() . "'";
     $arrFieldList[2] = "'" . $this->getEmpCurrCode() . "'";
     $arrFieldList[3] = "'" . $this->getEmpBasSal() . "'";
     $arrFieldList[4] = empty($this->payPeriod) ? "null" : "'" . $this->payPeriod . "'";
     $fields[0] = 'EMP_NUMBER';
     $fields[1] = 'SAL_GRD_CODE';
     $fields[2] = 'CURRENCY_ID';
     $fields[3] = 'EBSAL_BASIC_SALARY';
     $fields[4] = 'PAYPERIOD_CODE';
     $tableName = 'hs_hr_emp_basicsalary';
     $sql_builder = new SQLQBuilder();
     $sql_builder->table_name = $tableName;
     $sql_builder->flg_insert = 'true';
     $sql_builder->arr_insert = $arrFieldList;
     $sql_builder->arr_insertfield = $fields;
     $sqlQString = $sql_builder->addNewRecordFeature2();
     $dbConnection = new DMLFunctions();
     $message2 = $dbConnection->executeQuery($sqlQString);
     //Calling the addData() function
     return $message2;
 }
Exemplo n.º 9
0
 /**
  * Insert new object to database
  */
 private function _insert()
 {
     $fields[0] = self::DB_FIELD_ID;
     $fields[1] = self::DB_FIELD_NAME;
     $fields[2] = self::DB_FIELD_DESC;
     $fields[3] = self::DB_FIELD_DUTIES;
     $this->id = UniqueIDGenerator::getInstance()->getNextID(self::TABLE_NAME, self::DB_FIELD_ID);
     $values[0] = $this->id;
     $values[1] = "'{$this->name}'";
     $values[2] = "'{$this->desc}'";
     $values[3] = "'{$this->duties}'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         throw new JobSpecException("Insert failed. ", JobSpecException::DB_ERROR);
     }
     return $this->id;
 }
Exemplo n.º 10
0
 function addEmpRepTo()
 {
     $arrRecordsList[0] = "'" . $this->getEmpSupId() . "'";
     $arrRecordsList[1] = "'" . $this->getEmpSubId() . "'";
     $arrRecordsList[2] = "'" . $this->getEmpRepMod() . "'";
     $tableName = 'HS_HR_EMP_REPORTTO';
     $arrFieldList[0] = 'EREP_SUP_EMP_NUMBER';
     $arrFieldList[1] = 'EREP_SUB_EMP_NUMBER';
     $arrFieldList[2] = 'EREP_REPORTING_MODE';
     $sql_builder = new SQLQBuilder();
     $sql_builder->table_name = $tableName;
     $sql_builder->flg_insert = 'true';
     $sql_builder->arr_insertfield = $arrFieldList;
     $sql_builder->arr_insert = $arrRecordsList;
     $sqlQString = $sql_builder->addNewRecordFeature2(true, true);
     $dbConnection = new DMLFunctions();
     $message2 = $dbConnection->executeQuery($sqlQString);
     //Calling the addData() function
     return $message2;
 }
Exemplo n.º 11
0
 /**
  * Insert new object to database
  */
 private function _insert()
 {
     // Update name if not set.
     if (empty($this->name)) {
         $this->_updateName();
     }
     $fields[0] = self::DB_FIELD_EMP_NUMBER;
     $fields[1] = self::DB_FIELD_CODE;
     $fields[2] = self::DB_FIELD_NAME;
     $fields[3] = self::DB_FIELD_START_DATE;
     $fields[4] = self::DB_FIELD_END_DATE;
     $values[0] = $this->empNumber;
     $values[1] = $this->code;
     $values[2] = isset($this->name) ? $this->name : 'null';
     $values[3] = $this->startDate;
     $values[4] = isset($this->endDate) ? $this->endDate : 'null';
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = $this->tableName;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         throw new EmpHistoryException("Insert failed. ", EmpHistoryException::DB_ERROR);
     }
     $this->id = mysql_insert_id();
     return $this->id;
 }
Exemplo n.º 12
0
 /**
  * Insert new object to database
  */
 private function _insert()
 {
     $this->id = UniqueIDGenerator::getInstance()->getNextID(self::TABLE_NAME, self::DB_FIELD_VACANCY_ID);
     $fields[0] = self::DB_FIELD_VACANCY_ID;
     $fields[1] = self::DB_FIELD_JOBTITLE_CODE;
     $fields[2] = self::DB_FIELD_MANAGER_ID;
     $fields[3] = self::DB_FIELD_ACTIVE;
     $fields[4] = self::DB_FIELD_DESCRIPTION;
     $values[0] = $this->id;
     $values[1] = "'{$this->jobTitleCode}'";
     $values[2] = $this->managerId;
     $values[3] = $this->active ? self::STATUS_ACTIVE : self::STATUS_INACTIVE;
     $values[4] = "'{$this->description}'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         throw new JobVacancyException("Insert failed. ", JobVacancyException::DB_ERROR);
     }
     return $this->id;
 }
Exemplo n.º 13
0
 /**
  * Inserts or updates tax information to the employee tax table.
  * Note that the tax information is kept separate from the employee table
  * since it can be country specific.
  */
 function updateEmpTax()
 {
     $arrRecordsList[0] = "'" . $this->getEmpNumber() . "'";
     $arrRecordsList[1] = "'" . $this->getFederalTaxStatus() . "'";
     $arrRecordsList[2] = trim($this->getFederalTaxExceptions()) != '' ? "'" . $this->getFederalTaxExceptions() . "'" : "'0'";
     $arrRecordsList[3] = "'" . $this->getTaxState() . "'";
     $arrRecordsList[4] = "'" . $this->getStateTaxStatus() . "'";
     $arrRecordsList[5] = trim($this->getStateTaxExceptions()) != '' ? "'" . $this->getStateTaxExceptions() . "'" : "'0'";
     $arrRecordsList[6] = "'" . $this->getTaxUnemploymentState() . "'";
     $arrRecordsList[7] = "'" . $this->getTaxWorkState() . "'";
     $arrFieldList[0] = self::EMP_TAX_TABLE_EMP_NUMBER;
     $arrFieldList[1] = self::EMP_TAX_FEDERAL_STATUS;
     $arrFieldList[2] = self::EMP_TAX_FEDERAL_EXCEPTIONS;
     $arrFieldList[3] = self::EMP_TAX_STATE;
     $arrFieldList[4] = self::EMP_TAX_STATE_STATUS;
     $arrFieldList[5] = self::EMP_TAX_STATE_EXCEPTIONS;
     $arrFieldList[6] = self::EMP_TAX_UNEMP_STATE;
     $arrFieldList[7] = self::EMP_TAX_WORK_STATE;
     $sql_builder = new SQLQBuilder();
     $sql_builder->table_name = self::EMP_TAX_TABLE_NAME;
     $sql_builder->flg_insert = 'true';
     $sql_builder->arr_insert = $arrRecordsList;
     $sql_builder->arr_insertfield = $arrFieldList;
     $sqlQString = $sql_builder->addNewRecordFeature2(true, true);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($sqlQString);
     return $result;
 }
Exemplo n.º 14
0
 /**
  * Add a new custom field to the database
  */
 public function addCustomField()
 {
     if ($this->_isDuplicateName()) {
         throw new CustomFieldsException("Duplicate name", 1);
     }
     $conn = new DMLFunctions();
     $fields[0] = self::DB_FIELDS_NUM;
     $fields[1] = self::DB_FIELDS_NAME;
     $fields[2] = self::DB_FIELDS_TYPE;
     $fields[3] = self::DB_FIELDS_SCREEN;
     $fields[4] = self::DB_FIELDS_EXTRA_DATA;
     $values[0] = mysql_real_escape_string($this->fieldNumber);
     $values[1] = "'" . mysql_real_escape_string($this->name) . "'";
     $values[2] = "'" . mysql_real_escape_string($this->fieldType) . "'";
     $values[3] = "'" . mysql_real_escape_string($this->screen) . "'";
     $values[4] = "'" . mysql_real_escape_string($this->extraData) . "'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         throw new CustomFieldsException("Insert failed. ");
     }
 }
Exemplo n.º 15
0
 private function _insert()
 {
     $fields[0] = self::DB_FIELD_ACTIVITY_ID;
     $fields[1] = self::DB_FIELD_NAME;
     $fields[2] = self::DB_FIELD_PROJECT_ID;
     $fields[3] = self::DB_FIELD_DELETED;
     $this->id = UniqueIDGenerator::getInstance()->getNextID(self::TABLE_NAME, self::DB_FIELD_ACTIVITY_ID);
     $values[0] = $this->id;
     $values[1] = "'{$this->name}'";
     $values[2] = "'{$this->projectId}'";
     $values[3] = "'" . intval($this->deleted) . "'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         throw new ProjectActivityException("Insert failed. ");
     }
 }
Exemplo n.º 16
0
 function addJobTitles()
 {
     $tableName = 'HS_HR_JOB_TITLE';
     $this->jobId = UniqueIDGenerator::getInstance()->getNextID($tableName, 'JOBTIT_CODE', 'JOB');
     $arrRecordsList[0] = "'" . $this->getJobId() . "'";
     $arrRecordsList[1] = "'" . $this->getJobName() . "'";
     $arrRecordsList[2] = "'" . $this->getJobDesc() . "'";
     $arrRecordsList[3] = "'" . $this->getJobComm() . "'";
     $arrRecordsList[4] = "'" . $this->getJobSalGrd() . "'";
     $arrRecordsList[5] = isset($this->jobSpecId) ? $this->jobSpecId : 'null';
     $arrFieldList[0] = 'JOBTIT_CODE';
     $arrFieldList[1] = 'JOBTIT_NAME';
     $arrFieldList[2] = 'JOBTIT_DESC';
     $arrFieldList[3] = 'JOBTIT_COMM';
     $arrFieldList[4] = 'SAL_GRD_CODE';
     $arrFieldList[5] = self::DB_FIELD_JOBSPEC_ID;
     $sql_builder = new SQLQBuilder();
     $sql_builder->table_name = $tableName;
     $sql_builder->flg_insert = 'true';
     $sql_builder->arr_insert = $arrRecordsList;
     $sql_builder->arr_insertfield = $arrFieldList;
     $sqlQString = $sql_builder->addNewRecordFeature2();
     $dbConnection = new DMLFunctions();
     $message2 = $dbConnection->executeQuery($sqlQString);
     $jobTitleEmpStat = new JobTitEmpStat();
     $jobTitleEmpStat->setEmpStatId(EmploymentStatus::EMPLOYMENT_STATUS_ID_TERMINATED);
     $jobTitleEmpStat->setJobTitId($this->getJobId());
     $jobTitleEmpStat->addJobTitEmpStat();
     return $message2;
 }
 /**
  * Save a employee Location to the database.
  * If this location has already been assigned to the employee, no change is done.
  */
 public function save()
 {
     $this->_validateParams();
     $fields[0] = self::DB_FIELD_EMP_NUMBER;
     $fields[1] = self::DB_FIELD_LOC_CODE;
     $values[0] = $this->empNumber;
     $values[1] = "'{$this->location}'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2(true, false, true);
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result) {
         throw new EmpLocationException("Insert failed. ", EmpLocationException::DB_ERROR);
     }
 }
Exemplo n.º 18
0
 function addEmpMain()
 {
     $tableName = 'HS_HR_EMPLOYEE';
     $this->empId = UniqueIDGenerator::getInstance()->getNextID($tableName, 'EMP_NUMBER');
     $arrRecordsList[0] = "'" . $this->getEmpId() . "'";
     $arrRecordsList[1] = "'" . $this->getEmpLastName() . "'";
     $arrRecordsList[2] = "'" . $this->getEmpFirstName() . "'";
     $arrRecordsList[3] = "'" . $this->getEmpNickName() . "'";
     $arrRecordsList[4] = "'" . $this->getEmpMiddleName() . "'";
     $arrRecordsList[5] = "'" . $this->getEmployeeId() . "'";
     $arrFieldList[0] = 'EMP_NUMBER';
     $arrFieldList[1] = 'EMP_LASTNAME';
     $arrFieldList[2] = 'EMP_FIRSTNAME';
     $arrFieldList[3] = 'EMP_NICK_NAME';
     $arrFieldList[4] = 'EMP_MIDDLE_NAME';
     $arrFieldList[5] = 'EMPLOYEE_ID';
     $sql_builder = new SQLQBuilder();
     $sql_builder->table_name = $tableName;
     $sql_builder->flg_insert = 'true';
     $sql_builder->arr_insert = $arrRecordsList;
     $sql_builder->arr_insertfield = $arrFieldList;
     $sqlQString = $sql_builder->addNewRecordFeature2();
     //echo $sqlQString;
     $dbConnection = new DMLFunctions();
     $message2 = $dbConnection->executeQuery($sqlQString);
     //Calling the addData() function
     return $message2;
 }
Exemplo n.º 19
0
 /**
  * Add a new custom field to the database
  */
 public function addCustomField()
 {
     $fields[0] = self::DB_FIELDS_NUM;
     $fields[1] = self::DB_FIELDS_NAME;
     $fields[2] = self::DB_FIELDS_TYPE;
     $fields[3] = self::DB_FIELDS_EXTRA_DATA;
     $values[0] = $this->fieldNumber;
     $values[1] = "'{$this->name}'";
     $values[2] = "'{$this->fieldType}'";
     $values[3] = "'{$this->extraData}'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         throw new CustomFieldsException("Insert failed. ");
     }
 }
Exemplo n.º 20
0
 /**
  * Insert new object to database
  */
 private function _insert()
 {
     $this->id = UniqueIDGenerator::getInstance()->getNextID(self::TABLE_NAME, self::DB_FIELD_ID);
     if (empty($this->appliedDateTime)) {
         $this->appliedDateTime = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT);
     }
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $this->_getFieldValuesAsArray();
     $sqlBuilder->arr_insertfield = $this->dbFields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         throw new JobApplicationException("Insert failed. ", JobApplicationException::DB_ERROR);
     }
     return $this->id;
 }
Exemplo n.º 21
0
 /**
  * Add the direct debit information to the database
  */
 public function add()
 {
     $nextSeqNum = $this->getNextSeqNum($this->empNumber);
     $fields[0] = self::DB_FIELD_EMP_NUMBER;
     $fields[1] = self::DB_FIELD_SEQNO;
     $fields[2] = self::DB_FIELD_ROUTING_NUM;
     $fields[3] = self::DB_FIELD_ACCOUNT;
     $fields[4] = self::DB_FIELD_AMOUNT;
     $fields[5] = self::DB_FIELD_ACCOUNT_TYPE;
     $fields[6] = self::DB_FIELD_TRANSACTION_TYPE;
     $values[0] = "'{$this->empNumber}'";
     $values[1] = "'{$nextSeqNum}'";
     $values[2] = "'{$this->routingNumber}'";
     $values[3] = "'{$this->account}'";
     $values[4] = "'{$this->amount}'";
     $values[5] = "'{$this->accountType}'";
     $values[6] = "'{$this->transactionType}'";
     $sqlBuilder = new SQLQBuilder();
     $sqlBuilder->table_name = self::TABLE_NAME;
     $sqlBuilder->flg_insert = 'true';
     $sqlBuilder->arr_insert = $values;
     $sqlBuilder->arr_insertfield = $fields;
     $sql = $sqlBuilder->addNewRecordFeature2();
     $conn = new DMLFunctions();
     $result = $conn->executeQuery($sql);
     if (!$result || mysql_affected_rows() != 1) {
         return false;
     } else {
         return true;
     }
 }