Egocentralis
Member
Hi,
We have some view tables what are created by a query in php my admin. In the elements we have elements containing the tables names and showing the content of the database. Normally this is working great.
We have a fabrik scheduled task what is looking into the view table and checks if a employee has submitted his working hours of last week. If not, an email will be generated and in the email there is some data from the view table. This works good. After adding some fields to te view table and creating the elements in the list the tables in the database get populated. However the date fields in the list/form are empty but the dates are visible in the table.
First i was thinking it was a mysql error but i couldnt find a sollution. Now, i think its something with fabrikar. Or a combination of things. It would be really nice if someone can point me in the good direction, or understands what or why this is happening. I will post info about the old situation with working view and date elements and then the new situation.
Old view situation.
The Query:
In the show details of administrator it looks like:
Its about the "van" and "tot" fields.
in the database it looks like this:
In the scheduled task/plan I have an email plugin enabled. To grab the info we use:
I have shortened the message. This is returning week 19 (03-05-2021 -09-05-2021) So thats good.
New view situation:
The query:
I have added all extra elements in the list/form. The elements are populated in the database correctly. But, when the email got sended its retuning: week 01 (01-01-1970 - 01-01-1970) This is caused by strtotime is getting a NULL value. This is strange since in the database the dates are in the tables.
In the database it looks like this:
As you can see the dates are in "van" and "tot". The rest of the fields are also populated correctly.
But, when I go to show details in the administrator section of this list/form there is something strange.
Its not giving the date values, so thats why strtotime can only see NULL.
All other extra fields are populated:
So I tried to give the "van" and "tot" tables another name, i did create different ones, changed elements to the new tables.. but all without luck.
I tried left join, right join, inner join, etc.. to see if this would solve the issue.. unfortunately with no luck.
I checked all settings from the date elements, but they are exactly the same as the date element settings of the old view table situation.
I gave "van" and "tot" different positions.. in the database and later also as element.. but with no luck.
So what do I miss, why is it that the date fields cannot grab the dates from the tables in the database and keep empty. In the database the fields are populated .. but in details of the list/form .. empty.
Its driving me nuts.. been looking for a sollution for the whole week, but I cannot think of something different anymore.
Please, can someone tell me why this is happening.
My thanks would be forever and very big.
We have some view tables what are created by a query in php my admin. In the elements we have elements containing the tables names and showing the content of the database. Normally this is working great.
We have a fabrik scheduled task what is looking into the view table and checks if a employee has submitted his working hours of last week. If not, an email will be generated and in the email there is some data from the view table. This works good. After adding some fields to te view table and creating the elements in the list the tables in the database get populated. However the date fields in the list/form are empty but the dates are visible in the table.
First i was thinking it was a mysql error but i couldnt find a sollution. Now, i think its something with fabrikar. Or a combination of things. It would be really nice if someone can point me in the good direction, or understands what or why this is happening. I will post info about the old situation with working view and date elements and then the new situation.
Old view situation.
The Query:
Code:
select `p`.`id` AS `id`,`p`.`persid` AS `persid`,`p`.`roepnaam` AS `roepnaam`,`p`.`email` AS `email`,(curdate() - interval (dayofweek(curdate()) + 5) day) AS `van`,(curdate() - interval (dayofweek(curdate()) - 1) day) AS `tot` from `dbummbqh72uvyy`.`g4e_orakel_personeel` `p` where ((`p`.`status` = '1') and (not((`p`.`ac` like '%"Uren"%'))) and (cast(`p`.`in_dienst_sinds` as date) <= (curdate() - interval (dayofweek(curdate()) + 5) day)) and (not(exists(select `z`.`persid` from `dbummbqh72uvyy`.`g4e_orakel_personeel_ziekteuren` `z` where ((`z`.`persid` = `p`.`persid`) and (`z`.`van` <> '0000-00-00 00:00:00') and (cast(`z`.`van` as date) <= (curdate() - interval (dayofweek(curdate()) - 1) day)) and ((cast(`z`.`tot` as date) >= (curdate() - interval (dayofweek(curdate()) + 5) day)) or (`z`.`tot` = '0000-00-00 00:00:00')))))) and (not(exists(select `v`.`parent_id` from `dbummbqh72uvyy`.`g4e_orakel_personeel_verlof` `v` where ((`v`.`parent_id` = `p`.`id`) and (`v`.`van` <> '0000-00-00 00:00:00') and (cast(`v`.`van` as date) <= (curdate() - interval (dayofweek(curdate()) - 1) day)) and ((cast(`v`.`tot` as date) >= (curdate() - interval (dayofweek(curdate()) + 5) day)) or (`v`.`tot` = '0000-00-00 00:00:00')))))) and (not(exists(select `u`.`persid` from `dbummbqh72uvyy`.`g4e_orakel_urenreg` `u` where ((`u`.`persid` = `p`.`persid`) and (cast(`u`.`datum` as date) >= (curdate() - interval (dayofweek(curdate()) + 5) day)) and (cast(`u`.`datum` as date) <= (curdate() - interval (dayofweek(curdate()) - 1) day)))))))
In the show details of administrator it looks like:
Its about the "van" and "tot" fields.
in the database it looks like this:
In the scheduled task/plan I have an email plugin enabled. To grab the info we use:
Code:
$eind_dat = strtotime("{g4e_orakel_urenlijst_1w___tot}");
$beg_dat = strtotime("{g4e_orakel_urenlijst_1w___van}");
$week = date("W", $beg_dat);
$beg_dat = date("d-m-Y", $beg_dat);
$eind_dat = date("d-m-Y", $eind_dat);
$bericht = 'Beste {g4e_orakel_urenlijst_1w___roepnaam}, <br /><br />';
$bericht .= 'blabla ' . $week . ' (' . $beg_dat . ' - ' . $eind_dat . ') blabla<br /><br />';
return $bericht;
I have shortened the message. This is returning week 19 (03-05-2021 -09-05-2021) So thats good.
New view situation:
The query:
Code:
select `p`.`id` AS `id`,`p`.`persid` AS `persid`,`p`.`roepnaam` AS `roepnaam`,`p`.`email` AS `email`,(curdate() - interval (dayofweek(curdate()) + 5) day) AS `van`,(curdate() - interval (dayofweek(curdate()) - 1) day) AS `tot`,`b`.`email_adres_bedrijf` AS `bedrijfemail`,`b`.`vol_naam` AS `cp_vol_naam`,`b`.`bedrijfsnaam` AS `bedrijfsnaam`,`q`.`te_gebruiken_email` AS `gebruikemail`,`q`.`te_gebruiken_bedrijfsnaam` AS `tegebrbedrijfsn`,`m`.`vol_naam_ontv_meld` AS `ontvangermelding`,`m`.`email_ontv_meld` AS `ontvangmeldemail` from (((`dbrqdg58wpf72x`.`g4e_orakel_personeel` `p` left join `dbrqdg58wpf72x`.`egocentralis_bedrijven` `b` on((`p`.`bedrijf_id` = `b`.`bedrijf_id`))) left join `dbrqdg58wpf72x`.`contactpers_bedrijven` `m` on((`p`.`bedrijf_id` = `m`.`bedrijf_id`))) left join `dbrqdg58wpf72x`.`bedrijf_variabelen` `q` on((`p`.`bedrijf_id` = `q`.`bedrijf_id`))) where ((`p`.`status` = '1') and (not((`p`.`ac` like '%"Uren"%'))) and (cast(`p`.`in_dienst_sinds` as date) <= (curdate() - interval (dayofweek(curdate()) + 5) day)) and (not(exists(select `z`.`persid` from `dbrqdg58wpf72x`.`g4e_orakel_personeel_ziekteuren` `z` where ((`z`.`persid` = `p`.`persid`) and (`z`.`van` <> '0000-00-00 00:00:00') and (cast(`z`.`van` as date) <= (curdate() - interval (dayofweek(curdate()) - 1) day)) and ((cast(`z`.`tot` as date) >= (curdate() - interval (dayofweek(curdate()) + 5) day)) or (`z`.`tot` = '0000-00-00 00:00:00')))))) and (not(exists(select `v`.`parent_id` from `dbrqdg58wpf72x`.`g4e_orakel_personeel_verlof` `v` where ((`v`.`parent_id` = `p`.`id`) and (`v`.`van` <> '0000-00-00 00:00:00') and (cast(`v`.`van` as date) <= (curdate() - interval (dayofweek(curdate()) - 1) day)) and ((cast(`v`.`tot` as date) >= (curdate() - interval (dayofweek(curdate()) + 5) day)) or (`v`.`tot` = '0000-00-00 00:00:00')))))) and (not(exists(select `u`.`persid` from `dbrqdg58wpf72x`.`g4e_orakel_urenreg` `u` where ((`u`.`persid` = `p`.`persid`) and (cast(`u`.`datum` as date) >= (curdate() - interval (dayofweek(curdate()) + 5) day)) and (cast(`u`.`datum` as date) <= (curdate() - interval (dayofweek(curdate()) - 1) day)))))))
I have added all extra elements in the list/form. The elements are populated in the database correctly. But, when the email got sended its retuning: week 01 (01-01-1970 - 01-01-1970) This is caused by strtotime is getting a NULL value. This is strange since in the database the dates are in the tables.
In the database it looks like this:
As you can see the dates are in "van" and "tot". The rest of the fields are also populated correctly.
But, when I go to show details in the administrator section of this list/form there is something strange.
Its not giving the date values, so thats why strtotime can only see NULL.
All other extra fields are populated:
So I tried to give the "van" and "tot" tables another name, i did create different ones, changed elements to the new tables.. but all without luck.
I tried left join, right join, inner join, etc.. to see if this would solve the issue.. unfortunately with no luck.
I checked all settings from the date elements, but they are exactly the same as the date element settings of the old view table situation.
I gave "van" and "tot" different positions.. in the database and later also as element.. but with no luck.
So what do I miss, why is it that the date fields cannot grab the dates from the tables in the database and keep empty. In the database the fields are populated .. but in details of the list/form .. empty.
Its driving me nuts.. been looking for a sollution for the whole week, but I cannot think of something different anymore.
Please, can someone tell me why this is happening.
My thanks would be forever and very big.