-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lost task time entry when changing assigned task from overview #32791
Comments
@mdeweerd I can't reproduce the error, the project module is used in conjunction with the "Event Organization" module? |
@mdeweerd how do you get this? ![]() |
@mdeweerd ah ok, this is the "salaries" module |
I'll check how I get that, however, 'obj_thm_user' seems to be null in this code according to the error.log from apache: // Update hourly rate of this time spent entry
$resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user));
if (!empty($resql_thm_user)) {
$obj_thm_user = $this->db->fetch_object($resql_thm_user);
$timespent->thm = $obj_thm_user->thm;
}
$res_update = $timespent->update($user); Is the key to fetch_object correct as this is thm ? Seems to not return a value in my case (not tested)? |
The column before the value is the product column - I can see code for that in time.php . The html code is (darkreader is inserted by a browser extension): <td class="nowraponall"><span class="fas fa-concierge-bell" style="color: rgb(166, 153, 68); --darkreader-inline-color: #fffd7a;" data-darkreader-inline-color=""></span><input type="hidden" name="fk_product" id="fk_product" value="0"><!-- Javascript code for autocomplete of field fk_product -->
<script>
XXX;</script><input type="text" class="minwidth100 maxwidth500 ui-autocomplete-input" name="search_fk_product" id="search_fk_product" value="" autocomplete="off"></td> |
@mdeweerd and "thm" field are empty in llx_user for the user ? |
That's probably linked to how the value is determined. But there is an average daily rate on a user which is likely used and for which the fetch seems to be failing (user/card.php?id=1): Is there a way to use database transactions in dolibarr? It could help to secure the database in case of fatal errors such as a property or method access on null. |
# FIX Dolibarr#32791 Lost user and THM when updating task time The task time was assigned the user '0' when updating, which resulted in an error where a NULL object was used. This resulted in a partially replaced record with no user and empty THM. The correction adds the use of a DB transaction to avoid inconsistency in case of an error. The correction uses the fields from the original record if no new fields are provided in the POST arguments
Bug
I edited 2 time items spent on tasks on "projet/tasks/time.php" to change their task and they are no longer available in the time spent list (same page).
The following error messages could be related:
apache error.log:
I have multiple entires in dolibarr.log that may be related:
I checked the database and found the items in llx_element_time. I notided that "fk_user" was '0' which was not the case for the other items, so I change that back to 1 and the items were listed again.
I also notice that the value for thm is now null while this is not the case for the other items.
Dolibarr Version
20.0.3
Environment PHP
No response
Environment Database
No response
Steps to reproduce the behavior and expected behavior
This happened when I edited an existing entry on projet/tasks/time.php (for a project) and changed the task, then validated ("Enregistrer").
Attached files
No response
The text was updated successfully, but these errors were encountered: