Example #1
0
 $data['multiplier'] = getRequestDecimal($_REQUEST['multiplier']);
 $data['value'] = getRequestDecimal($_REQUEST['edit_value']);
 $data['userID'] = $kga['user']['userID'];
 if (!is_numeric($data['multiplier']) || $data['multiplier'] <= 0) {
     $errors['multiplier'] = $kga['lang']['errorMessages']['multiplierNegative'];
 }
 // parse new day and time
 $edit_day = Kimai_Format::expand_date_shortcut($_REQUEST['edit_day']);
 $edit_time = Kimai_Format::expand_time_shortcut($_REQUEST['edit_time']);
 // validate day and time
 $new = "{$edit_day}-{$edit_time}";
 if (!Kimai_Format::check_time_format($new)) {
     $errors[''] = $kga['lang']['TimeDateInputError'];
 }
 // convert to internal time format
 $new_time = convert_time_strings($new, $new);
 $data['timestamp'] = $new_time['in'];
 expenseAccessAllowed($data, $action, $errors);
 if (count($errors) > 0) {
     echo json_encode(array('errors' => $errors));
     break;
 }
 $result = false;
 if ($id) {
     if (expense_edit($id, $data) === false) {
         $errors[''] = $kga['lang']['error'];
     }
 } else {
     if (expense_create($kga['user']['userID'], $data) === false) {
         $errors[''] = $kga['lang']['error'];
     }
Example #2
0
 // check if the posted time values are possible
 $setTimeValue = 0;
 // 0 means the values are incorrect. now we check if this is true ...
 $edit_in_day = expand_date_shortcut($_REQUEST['edit_in_day']);
 $edit_out_day = expand_date_shortcut($_REQUEST['edit_out_day']);
 $edit_in_time = expand_time_shortcut($_REQUEST['edit_in_time']);
 $edit_out_time = expand_time_shortcut($_REQUEST['edit_out_time']);
 $new_in = "{$edit_in_day}-{$edit_in_time}";
 $new_out = "{$edit_out_day}-{$edit_out_time}";
 if (check_time_format($new_in) && check_time_format($new_out)) {
     // if this is TRUE the values PASSED the test!
     $setTimeValue = 1;
 } else {
     break;
 }
 $new_time = convert_time_strings($new_in, $new_out);
 logfile("new_time: " . serialize($new_time));
 // if the difference between in and out value is zero or below this can't be correct ...
 // TIME WRONG - NEW ENTRY
 if (!$new_time['diff'] && !$id) {
     // if this is an ADD record dialog it makes no sense to create the record
     // when it doesn't have any TIME attached ... so this stops the processing.
     // TODO: throw a warning message when this happens ...
     break;
 }
 // TIME WRONG - EDIT ENTRY
 if (!$new_time['diff']) {
     // obviously this is an edit of an existing record. but still it contains no correct timespan.
     // here somebody didn't mean to change the timespace like that. so we leave the timespan as is.
     // TODO: throw a warning message when this happens ...
     $data['in'] = 0;