示例#1
0
 /**
  * Editing time event
  *
  * All except time event id is editable
  */
 public function editTimeEvent()
 {
     if ($this->_isOverlapping()) {
         return false;
     }
     $sqlBuilder = new SQLQBuilder();
     $updateTable = "`" . self::TIME_EVENT_DB_TABLE_TIME_EVENT . "`";
     if ($this->getProjectId() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_PROJECT_ID . "`";
         $updateValues[] = $this->getProjectId();
     }
     if ($this->getEmployeeId() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_EMPLOYEE_ID . "`";
         $updateValues[] = $this->getEmployeeId();
     }
     if ($this->getActivityId() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_ACTIVITY_ID . "`";
         $updateValues[] = $this->getActivityId();
     }
     if ($this->getTimesheetId() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_TIMESHEET_ID . "`";
         $updateValues[] = $this->getTimesheetId();
     }
     if ($this->getStartTime() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_START_TIME . "`";
         $updateValues[] = "'" . $this->getStartTime() . "'";
     } else {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_START_TIME . "`";
         $updateValues[] = "null";
     }
     if ($this->getEndTime() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_END_TIME . "`";
         $updateValues[] = "'" . $this->getEndTime() . "'";
     } else {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_END_TIME . "`";
         $updateValues[] = "null";
     }
     if ($this->getReportedDate() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_REPORTED_DATE . "`";
         $updateValues[] = "'" . $this->getReportedDate() . "'";
     }
     if ($this->getDuration() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_DURATION . "`";
         $updateValues[] = $this->getDuration();
     }
     if ($this->getDescription() != null) {
         $updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_DESCRIPTION . "`";
         $updateValues[] = "'" . $this->getDescription() . "'";
     }
     $updateConditions[] = "`" . self::TIME_EVENT_DB_FIELD_TIME_EVENT_ID . "` = {$this->getTimeEventId()}";
     $query = $sqlBuilder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result) {
         if (mysql_affected_rows() > 0) {
             return true;
         } else {
             return 2;
         }
     }
     return false;
 }
 /**
  * Update project information
  */
 public function updateProject()
 {
     if ($this->_isDuplicateName(true)) {
         throw new ProjectsException("Duplicate name", 1);
     }
     $sql_builder = new SQLQBuilder();
     $updateTable = self::TABLE_NAME;
     if ($this->getCustomerId() != null) {
         $updateFields[] = "`" . self::PROJECT_DB_FIELD_CUSTOMER_ID . "`";
         $updateValues[] = "'" . $this->getCustomerId() . "'";
     }
     if ($this->getProjectName() != null) {
         $updateFields[] = "`" . self::PROJECT_DB_FIELD_NAME . "`";
         $updateValues[] = "'" . $this->getProjectName() . "'";
     }
     if ($this->getProjectDescription() != null) {
         $updateFields[] = "`" . self::PROJECT_DB_FIELD_DESCRIPTION . "`";
         $updateValues[] = "'" . $this->getProjectDescription() . "'";
     }
     if ($this->getDeleted() != null) {
         $updateFields[] = "`" . self::PROJECT_DB_FIELD_DELETED . "`";
         $updateValues[] = $this->getDeleted();
     }
     $updateConditions[] = "`" . self::PROJECT_DB_FIELD_PROJECT_ID . "` = {$this->getProjectId()}";
     if (is_array($updateFields)) {
         $updateValues = $sql_builder->quoteCorrect($updateValues);
         $sqlQString = $sql_builder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
         $dbConnection = new DMLFunctions();
         $message2 = $dbConnection->executeQuery($sqlQString);
         //Calling the addData() function
         // We don't check mysql_affected_rows here since the update may not have changed any
         // of the database fields.
         if ($message2) {
             return true;
         }
     }
     return false;
 }
示例#3
0
 /**
  * Change the status of the filled timesheet
  */
 private function _changeTimesheetStatus()
 {
     $sql_builder = new SQLQBuilder();
     $updateTable = self::TIMESHEET_DB_TABLE_TIMESHEET;
     $updateFields[0] = "`" . self::TIMESHEET_DB_FIELD_STATUS . "`";
     $updateValues[0] = $this->getStatus();
     if ($this->getComment() != null) {
         $updateFields[] = "`" . self::TIMESHEET_DB_FIELD_COMMENT . "`";
         $updateValues[] = "'" . $this->getComment() . "'";
     }
     $updateConditions[] = "`" . self::TIMESHEET_DB_FIELD_TIMESHEET_ID . "` = {$this->getTimesheetId()}";
     $query = $sql_builder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result) {
         return true;
     }
     return false;
 }
 public function updateNotificationStatus()
 {
     $userObj = new Users();
     $userObj->updateUserEmail($this->getUserId(), $this->getEmail());
     if (!$this->_notificationConfigurationExsist()) {
         return $this->_addNotificationStatus();
     }
     $sqlQBuilder = new SQLQBuilder();
     $arrFields[0] = '`status`';
     $changeValues[0] = $this->getNotificationStatus();
     $arrTable = "`hs_hr_mailnotifications`";
     $updateConditions[1] = "`user_id` = '{$this->getUserId()}'";
     $updateConditions[2] = "`notification_type_id` = '{$this->getNotifcationTypeId()}'";
     $query = $sqlQBuilder->simpleUpdate($arrTable, $arrFields, $changeValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     return $result;
 }
示例#5
0
 private function _update()
 {
     $updateTable = self::WORKSHIFT_TABLE;
     $fields[0] = self::DB_FIELD_NAME;
     $fields[1] = self::DB_FIELD_HOURS;
     $updateValues[0] = "'" . $this->name . "'";
     $updateValues[1] = $this->hoursPerDay;
     $updateConditions[0] = self::DB_FIELD_WORKSHIFT_ID . " = " . $this->workshiftId;
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($updateTable, $fields, $updateValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result === false) {
         throw new WorkshiftException("Error in update", WorkshiftException::ERROR_IN_DB_QUERY);
     }
     return mysql_affected_rows();
 }
 public function undeleteLeaveType()
 {
     $sql_builder = new SQLQBuilder();
     $selectTable = "`hs_hr_leavetype` ";
     $changeFields[0] = "`available_flag`";
     $changeValues[0] = "'" . $this->availableStatusFlag . "'";
     $updateConditions[0] = "`leave_type_id` = '" . $this->getLeaveTypeId() . "'";
     $query = $sql_builder->simpleUpdate($selectTable, $changeFields, $changeValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if (isset($result) && mysql_affected_rows() > 0) {
         return true;
     }
     return false;
 }
示例#7
0
 /**
  * Updates the day
  *
  * requires a filled object
  *
  * @access pubic
  */
 public function editDay()
 {
     $arrFieldList[0] = "`" . self::WEEKENDS_TABLE_LENGTH . "`";
     $arrRecordsList[0] = $this->getLength();
     $updateConditions[0] = "`" . self::WEEKENDS_TABLE_DAY . '` = ' . $this->getDay();
     $updateTable = "`" . self::WEEKENDS_TABLE . "`";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($updateTable, $arrFieldList, $arrRecordsList, $updateConditions);
     //echo  $query;
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if (mysql_affected_rows() == 0) {
         return $this->_addDay();
     }
     return $result;
 }
示例#8
0
文件: Users.php 项目: noikiy/owaspbwa
 public function updateUserEmail($userId, $email)
 {
     $sqlQBuilder = new SQLQBuilder();
     $arrFields[0] = '`email1`';
     $changeValues[0] = $email;
     $arrTable = "`hs_hr_users`";
     $updateConditions[1] = "`id` = '{$userId}'";
     $query = $sqlQBuilder->simpleUpdate($arrTable, $arrFields, $changeValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     return true;
 }
 /**
  * Edits holiday
  *
  * The object needs to be filled.
  *
  * @access public
  */
 public function edit()
 {
     $arrFieldList[0] = "`" . self::HOLIDAYS_TABLE_DESCRIPTION . "`";
     $arrFieldList[1] = "`" . self::HOLIDAYS_TABLE_DATE . "`";
     $arrFieldList[2] = "`" . self::HOLIDAYS_TABLE_RECURRING . "`";
     $arrFieldList[3] = "`" . self::HOLIDAYS_TABLE_LENGTH . "`";
     $arrRecordsList[0] = "'" . $this->getDescription() . "'";
     $arrRecordsList[1] = "'" . $this->getDate() . "'";
     $arrRecordsList[2] = $this->getRecurring();
     $arrRecordsList[3] = $this->getLength();
     $updateConditions[0] = "`" . self::HOLIDAYS_TABLE_HOLIDAY_ID . '` = ' . $this->getHolidayId();
     $arrTable = "`" . self::HOLIDAYS_TABLE . "`";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($arrTable, $arrFieldList, $arrRecordsList, $updateConditions);
     //echo  $query;
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
 }
示例#10
0
文件: Leave.php 项目: noikiy/owaspbwa
 /**
  * This function will delete leave records for the given date. This will only for leave status other than 'taken'
  * @param $date - string date for delete records
  */
 public static function updateLeavesForDate($date, $length)
 {
     $sql_builder = new SQLQBuilder();
     $updateTable = "`hs_hr_leave`";
     $changeFields[] = "`leave_length_days`";
     $changeFields[] = "`leave_length_hours`";
     $changeValues[] = "(`leave_length_days` - ({$length} / " . self::LEAVE_LENGTH_FULL_DAY . "))";
     $changeValues[] = "`leave_length_hours` - {$length}";
     $updateConditions[] = "`leave_date` = '" . $date . "'";
     $updateConditions[] = "`leave_status` <> '" . self::LEAVE_STATUS_LEAVE_TAKEN . "'";
     $query = $sql_builder->simpleUpdate($updateTable, $changeFields, $changeValues, $updateConditions, false);
     //echo $query."\n";
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
 }
示例#11
0
 /**
  * Update leave quota of an employee
  *
  * @return boolean
  * @access public
  */
 private function updateLeaveQuota()
 {
     $sqlBuilder = new SQLQBuilder();
     $updateTable = "`" . self::LEAVEQUOTA_DB_TABLE_EMPLOYEE_LEAVE_QUOTA . "`";
     $updateFileds[0] = "`" . self::LEAVEQUOTA_DB_FIELD_NO_OF_DAYS_ALLOTED . "`";
     $updateValues[0] = "'" . $this->getNoOfDaysAllotted() . "'";
     $updateConditions[0] = "`" . self::LEAVEQUOTA_DB_FIELD_YEAR . "` = '" . $this->getYear() . "'";
     $updateConditions[1] = "`" . self::LEAVEQUOTA_DB_FIELD_LEAVE_TYPE_ID . "` = '" . $this->getLeaveTypeId() . "'";
     $updateConditions[2] = "`" . self::LEAVEQUOTA_DB_FIELD_EMPLOYEE_ID . "` = '" . $this->getEmployeeId() . "'";
     $query = $sqlBuilder->simpleUpdate($updateTable, $updateFileds, $updateValues, $updateConditions);
     //echo $query."\n";
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result) {
         return true;
     }
     return false;
 }
示例#12
0
 public function update()
 {
     if (!CommonFunctions::isValidId($this->id)) {
         throw new HspPayPeriodException("Invalid id", HspPayPeriodException::INVALID_ID);
     }
     $updateTable = '`' . self::PAY_PERIOD_DB_TABLE . '`';
     $changeFields[0] = '`' . self::PAY_PERIOD_DB_FIELD_START_DATE . '`';
     $changeFields[1] = '`' . self::PAY_PERIOD_DB_FIELD_END_DATE . '`';
     $changeFields[2] = '`' . self::PAY_PERIOD_DB_FIELD_CLOSE_DATE . '`';
     $changeFields[3] = '`' . self::PAY_PERIOD_DB_FIELD_CHECK_DATE . '`';
     $changeFields[4] = '`' . self::PAY_PERIOD_DB_FIELD_TIMESHEET_APROVAL_DUE_DATE . '`';
     $changeValues[0] = "'" . $this->startDate . "'";
     $changeValues[1] = "'" . $this->endDate . "'";
     $changeValues[2] = "'" . $this->closeDate . "'";
     $changeValues[3] = "'" . $this->checkDate . "'";
     $changeValues[4] = "'" . $this->timesheetAprovalDueDate . "'";
     $updateConditions[0] = "`" . self::PAY_PERIOD_DB_FIELD_ID . "` = '" . $this->id . "'";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($updateTable, $changeFields, $changeValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     return $result;
 }
示例#13
0
 private function _update()
 {
     if (!CommonFunctions::isValidId($this->id)) {
         throw new HspPaymentRequest("Invalid id", HspPaymentRequest::INVALID_ID);
     }
     $arrTable = '`' . self::HSP_PAYMENT_REQUEST_DB_TABLE . '`';
     if ($this->dateIncurred != null) {
         $updateFields[] = '`' . self::DB_FIELD_DATE_INCURRED . '`';
         $arrRecordsList[] = "'" . $this->dateIncurred . "'";
     }
     if ($this->providerName != null) {
         $updateFields[] = '`' . self::DB_FIELD_PROVIDER_NAME . '`';
         $arrRecordsList[] = "'" . $this->providerName . "'";
     }
     if ($this->personIncurringExpense != null) {
         $updateFields[] = '`' . self::DB_FIELD_PERSON_INCURRING_EXPENSE . '`';
         $arrRecordsList[] = "'" . $this->personIncurringExpense . "'";
     }
     if ($this->expenseDescription != null) {
         $updateFields[] = '`' . self::DB_FIELD_EXPENSE_DESCRIPTION . '`';
         $arrRecordsList[] = "'" . $this->expenseDescription . "'";
     }
     if ($this->expenseAmount != null) {
         $updateFields[] = '`' . self::DB_FIELD_EXPENSE_AMOUNT . '`';
         $arrRecordsList[] = "'" . $this->expenseAmount . "'";
     }
     if ($this->paymentMadeTo != null) {
         $updateFields[] = '`' . self::DB_FIELD_PAYMENT_MADE_TO . '`';
         $arrRecordsList[] = "'" . $this->paymentMadeTo . "'";
     }
     if ($this->thirdPartyAccountNumber != null) {
         $updateFields[] = '`' . self::DB_FIELD_THIRD_PARTY_ACCOUNT_NUMBER . '`';
         $arrRecordsList[] = "'" . $this->thirdPartyAccountNumber . "'";
     }
     if ($this->mailAddress != null) {
         $updateFields[] = '`' . self::DB_FIELD_MAIL_ADDRESS . '`';
         $arrRecordsList[] = "'" . $this->mailAddress . "'";
     }
     if ($this->comments != null) {
         $updateFields[] = '`' . self::DB_FIELD_COMMENTS . '`';
         $arrRecordsList[] = "'" . $this->comments . "'";
     }
     if ($this->status != null) {
         $updateFields[] = '`' . self::DB_FIELD_STATUS . '`';
         $arrRecordsList[] = "'" . $this->status . "'";
     }
     if ($this->datePaid != null) {
         $updateFields[] = '`' . self::DB_FIELD_DATE_PAID . '`';
         $arrRecordsList[] = "'" . $this->datePaid . "'";
     }
     if ($this->checkNumber != null) {
         $updateFields[] = '`' . self::DB_FIELD_CHECK_NUMBER . '`';
         $arrRecordsList[] = "'" . $this->checkNumber . "'";
     }
     if ($this->hrNotes != null) {
         $updateFields[] = '`' . self::DB_FIELD_HR_NOTES . '`';
         $arrRecordsList[] = "'" . $this->hrNotes . "'";
     }
     $updateConditions[0] = "`" . self::DB_FIELD_ID . "` = '" . $this->id . "'";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($arrTable, $updateFields, $arrRecordsList, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result === false) {
         throw new HspPaymentRequestException("Error in update", HspPaymentRequestException::ERROR_IN_DB_QUERY);
     }
     return mysql_affected_rows();
 }
示例#14
0
 public function cancelLeaveTaken($obj)
 {
     $sqlBuilder = new SQLQBuilder();
     $updateTable = "`hs_hr_leave`";
     $updateFileds[0] = "`leave_status`";
     $updateFileds[1] = "`leave_comments`";
     $updateValues[0] = "'" . $obj->getLeaveStatus() . "'";
     $updateValues[1] = "'" . $obj->getLeaveComments() . "'";
     $updateConditions[0] = "`leave_id` = '" . $obj->getLeaveId() . "'";
     $query = $sqlBuilder->simpleUpdate($updateTable, $updateFileds, $updateValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result) {
         return true;
     } else {
         return false;
     }
 }
示例#15
0
 function delJobTitles($arrList)
 {
     $updateTable = "`hs_hr_job_title`";
     $changeFields[0] = "`" . self::DB_FIELD_IS_ACTIVE . "`";
     $changeValues[0] = self::DELETED_JOB_TITLE;
     $updateConditions[0] = self::DB_FIELD_CODE . " IN('" . implode("','", $arrList[0]) . "')";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($updateTable, $changeFields, $changeValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result) {
         return true;
     }
     return false;
 }
 public function saveTimesheetSubmissionPeriod()
 {
     $this->_findEndDay();
     $sql_builder = new SQLQBuilder();
     $updateTable = self::TIMESHEET_SUBMISSION_PERIOD_DB_TABLE_TIMESHEET_SUBMISSION_PERIOD;
     if ($this->getName() != null) {
         $updateFields[] = "`" . self::TIMESHEET_SUBMISSION_PERIOD_DB_FIELD_NAME . "`";
         $updateValues[] = "'{$this->getName()}'";
     }
     if ($this->getFrequency() != null) {
         $updateFields[] = "`" . self::TIMESHEET_SUBMISSION_PERIOD_DB_FIELD_FREQUENCY . "`";
         $updateValues[] = $this->getFrequency();
     }
     if ($this->getPeriod() != null) {
         $updateFields[] = "`" . self::TIMESHEET_SUBMISSION_PERIOD_DB_FIELD_PERIOD . "`";
         $updateValues[] = $this->getPeriod();
     }
     if ($this->getStartDay() != null) {
         $updateFields[] = "`" . self::TIMESHEET_SUBMISSION_PERIOD_DB_FIELD_START_DAY . "`";
         $updateValues[] = $this->getStartDay();
     }
     if ($this->getEndDay() != null) {
         $updateFields[] = "`" . self::TIMESHEET_SUBMISSION_PERIOD_DB_FIELD_END_DAY . "`";
         $updateValues[] = $this->getEndDay();
     }
     if ($this->getDescription() != null) {
         $updateFields[] = "`" . self::TIMESHEET_SUBMISSION_PERIOD_DB_FIELD_DESCRIPTION . "`";
         $updateValues[] = "'{$this->getDescription()}'";
     }
     $updateConditions[] = "`" . self::TIMESHEET_SUBMISSION_PERIOD_DB_FIELD_TIMESHEET_PERIOD_ID . "` = {$this->getTimesheetPeriodId()}";
     $query = $sql_builder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result) {
         if (mysql_affected_rows() > 0) {
             return true;
         }
     }
     return false;
 }
示例#17
0
 function updateEmpBasSal($object = null)
 {
     $tableName = 'hs_hr_emp_basicsalary';
     $sql_builder = new SQLQBuilder();
     if (is_array($object)) {
         $fields[0] = 'emp_number';
         $fields[1] = 'sal_grd_code';
         $fields[2] = 'currency_id';
         $fields[3] = 'ebsal_basic_salary';
         $fields[4] = 'payperiod_code';
         $newObject = $object['new'];
         $values[0] = $newObject->getEmpId();
         $values[1] = "'" . $newObject->getEmpSalGrdCode() . "'";
         $values[2] = "'" . $newObject->getEmpCurrCode() . "'";
         $values[3] = "'" . $newObject->getEmpBasSal() . "'";
         $values[4] = empty($newObject->payPeriod) ? "null" : $newObject->payPeriod;
         $oldObject = $object['old'];
         $updateCondition[] = "SAL_GRD_CODE = '" . $oldObject->getEmpSalGrdCode() . "'";
         $updateCondition[] = "CURRENCY_ID = '" . $oldObject->getEmpCurrCode() . "'";
         $sqlQString = $sql_builder->simpleUpdate($tableName, $fields, $values, $updateCondition, false);
     } else {
         $sql_builder->table_name = $tableName;
         $arrRecordsList[0] = "'" . $this->getEmpId() . "'";
         $arrRecordsList[1] = "'" . $this->getEmpSalGrdCode() . "'";
         $arrRecordsList[2] = "'" . $this->getEmpCurrCode() . "'";
         $arrRecordsList[3] = "'" . $this->getEmpBasSal() . "'";
         $arrRecordsList[4] = empty($this->payPeriod) ? "null" : "'" . $this->payPeriod . "'";
         $sql_builder->flg_update = 'true';
         $sql_builder->arr_update = $arrFieldList;
         $sql_builder->arr_updateRecList = $arrRecordsList;
         $sqlQString = $sql_builder->addUpdateRecord1(2);
     }
     $dbConnection = new DMLFunctions();
     $message2 = $dbConnection->executeQuery($sqlQString);
     //Calling the addData() function
     return $message2;
 }
 /**
  *
  * function _changeLeaveStatus, access is private, will not be documented
  *
  * @access private
  */
 protected function _changeLeaveStatus()
 {
     $sqlBuilder = new SQLQBuilder();
     $table = "`hs_hr_leave`";
     $changeFields[0] = "`leave_status`";
     $changeFields[1] = "`leave_comments`";
     $changeValues[0] = $this->getLeaveStatus();
     $changeValues[1] = "'" . $this->getLeaveComments() . "'";
     $updateConditions[0] = "`leave_request_id` = " . $this->getLeaveRequestId();
     $query = $sqlBuilder->simpleUpdate($table, $changeFields, $changeValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if (isset($result) && mysql_affected_rows() > 0) {
         return true;
     }
     return false;
 }
示例#19
0
文件: Hsp.php 项目: noikiy/owaspbwa
 public static function updateUsedPerPayment($year, $hspPlanId, $employeeId, $amount)
 {
     $updateTable = "`" . self::DB_TABLE_HSP_SUMMARY . "`";
     $updateFields[0] = "`" . self::DB_FIELD_TOTAL_USED . "`";
     $updateValues[0] = "`" . self::DB_FIELD_TOTAL_USED . "` + " . $amount;
     $updateConditions[0] = "`" . self::DB_FIELD_HSP_PLAN_YEAR . "` = '" . $year . "'";
     $updateConditions[1] = "`" . self::DB_FIELD_HSP_PLAN_ID . "` = '" . $hspPlanId . "'";
     $updateConditions[2] = "`" . self::DB_FIELD_EMPLOYEE_ID . "` = '" . $employeeId . "'";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions, false);
     $dbConnection = new DMLFunctions();
     $dbConnection->executeQuery($query);
 }
示例#20
0
 /**
  * This functions brings forward last year balance for HSA and HRA
  */
 private static function _broughtForwardHspBalance()
 {
     $yearStart = date('Y') . "-01-01";
     $currentDate = date('Y-m-d');
     if ($currentDate >= $yearStart && self::recordsExist(date('Y') - 1) && !Config::getHspBroughtForwadYear("HspBroughtForward" . date('Y'))) {
         $selectTable = "`" . parent::DB_TABLE_HSP_SUMMARY . "`";
         $selectFields[0] = "`" . parent::DB_FIELD_EMPLOYEE_ID . "`";
         $selectFields[1] = "`" . parent::DB_FIELD_HSP_PLAN_ID . "`";
         $selectFields[2] = "`" . parent::DB_FIELD_TOTAL_ACCRUED . "`";
         $selectFields[3] = "`" . parent::DB_FIELD_TOTAL_USED . "`";
         $year = date('Y') - 1;
         $selectConditions[0] = "`" . parent::DB_FIELD_HSP_PLAN_YEAR . "` = '{$year}'";
         $selectConditions[1] = "`" . parent::DB_FIELD_HSP_PLAN_ID . "` != '3'";
         $sqlBuilder = new SQLQBuilder();
         $query = $sqlBuilder->simpleSelect($selectTable, $selectFields, $selectConditions);
         $dbConnection = new DMLFunctions();
         $result = $dbConnection->executeQuery($query);
         if ($dbConnection->dbObject->numberOfRows($result) > 0) {
             while ($row = $dbConnection->dbObject->getArray($result)) {
                 $updateTable = "`" . self::DB_TABLE_HSP_SUMMARY . "`";
                 $updateFields[0] = "`" . parent::DB_FIELD_TOTAL_ACCRUED . "`";
                 $updateValues[0] = "`" . parent::DB_FIELD_TOTAL_ACCRUED . "`" + ($row[2] - $row[3]);
                 $updateConditions[0] = "`" . parent::DB_FIELD_EMPLOYEE_ID . "` = '" . $row[0] . "'";
                 $updateConditions[1] = "`" . parent::DB_FIELD_HSP_PLAN_ID . "` = '" . $row[1] . "'";
                 $updateConditions[2] = "`" . parent::DB_FIELD_HSP_PLAN_YEAR . "` = '" . date('Y') . "'";
                 $sqlBuilder2 = new SQLQBuilder();
                 $query2 = $sqlBuilder2->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
                 $dbConnection2 = new DMLFunctions();
                 $dbConnection2->executeQuery($query2);
             }
         }
         Config::setHspBroughtForwadYear("set", "HspBroughtForward" . date('Y'));
     }
 }
 public function editPropertyList()
 {
     $sql_builder = new SQLQBuilder();
     $sql_builder->table_name = $this->TABLE_NAME;
     $sql_builder->flg_update = 'true';
     $dbConnection = new DMLFunctions();
     $i = 0;
     foreach ($this->editPropIds as $id) {
         $sqlQString = $sql_builder->simpleUpdate($this->TABLE_NAME, array('emp_id'), array($this->editEmpIds[$i]), array("`prop_id`='{$id}'"));
         $message2 = $dbConnection->executeQuery($sqlQString);
         $i++;
     }
     return $message2;
 }
 /**
  *
  */
 public function updateRecord()
 {
     if (!isset($this->attendanceId)) {
         throw new AttendanceRecordException('Attendance ID is not set', AttendanceRecordException::ERROR_ID_NOT_SET);
     }
     $updateTable = "`" . self::DB_TABLE . "`";
     if (isset($this->inDate) && isset($this->inTime)) {
         $updateFields[] = "`" . self::DB_FIELD_PUNCHIN_TIME . "`";
         $updateValues[] = "{$this->inDate} {$this->inTime}";
     }
     if (isset($this->outDate) && isset($this->outTime)) {
         $updateFields[] = "`" . self::DB_FIELD_PUNCHOUT_TIME . "`";
         $updateValues[] = "{$this->outDate} {$this->outTime}";
     }
     if (isset($this->inNote)) {
         $updateFields[] = "`" . self::DB_FIELD_IN_NOTE . "`";
         $updateValues[] = "'" . $this->inNote . "'";
     }
     if (isset($this->outNote)) {
         $updateFields[] = "`" . self::DB_FIELD_OUT_NOTE . "`";
         $updateValues[] = "'" . $this->outNote . "'";
     }
     if (isset($this->status)) {
         $updateFields[] = "`" . self::DB_FIELD_STATUS . "`";
         $updateValues[] = "'" . $this->status . "'";
     }
     $updateConditions[] = "`" . self::DB_FIELD_ATTENDANCE_ID . "` = {$this->attendanceId}";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     if ($result) {
         return true;
     } else {
         return false;
     }
 }