I’m having an issue, when i update the staff’s weekly shift in my timekeeper, some records do not get updated at all. Here’s my function which gets the args and updates the shift.
For all the forms that i fill, i see the record updated JS popup in the bottom left.
function update_staff_shift($arg1, $arg2, $arg3, $arg4, $arg5)
{
$model = new Staff_shiftController;
$args = array($arg1, $arg2, $arg3, $arg4, $arg5);
foreach ($args as $argkey => $argitem){
if (isset($argitem)) {
$args[$argkey] = rawurldecode(rawurldecode($argitem));
}
}
$data = call_user_func_array(array($model, 'auto_update_staff_shift_edit'), $args);
render_json($data);
}
But to me it looks like the problem is in my javascript code. For some reason when i set the shifts,
the ones that don’t get updated, don’t connect to the javascript at all. I can see this in the network inspector, the request url is the same but the response header is different :
(HTTP/1.1 200 OK
Date: Sat, 22 Jul 2023 07:40:02 GMT
Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/7.4.33
X-Powered-By: PHP/7.4.33
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
X-Frame-Options: SAMEORIGIN
Content-Length: 2268
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8).
The shifts that do get updated always it shows this:
(HTTP/1.1 200 OK
Date: Sat, 22 Jul 2023 07:40:00 GMT
Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/7.4.33
X-Powered-By: PHP/7.4.33
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
X-Frame-Options: SAMEORIGIN
Content-Length: 67
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8).
The records get updated as i’m setting the shifts, at the end when i click submit
$(document).on("click", "#manager_submit", function() {
$('#staff_shift_content').submit();
});
the ones that are active(content-type application/json) are going to get updated. The other ones just get archived(i can see this in mysql database) and don’t get updated.
I tried debugging the code from the start, but the project is huge and this will take ages since we are just 2 developers. I tried to make the records get updated and submitted when you only click submit and not when you select a form to automatically get updated, but no luck.
I tried to explain as briefly as i can since there is a lot of code.