Hello, my issue is that when I save a record with a blank date it gets the current date. I use fpdf to export a 'work order' file, whenever I put a specific date it works fine, but when I leave it blank it gets the current date (today's date). Anyone can shed some light on how to solve this?
https://ibb.co/eq0ddn
https://ibb.co/egQGW7
https://ibb.co/dmx24S
blank dates save as current date
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: blank dates save as current date
Hi,
are you using any hooks to check on the date? PHP or JS?
Can you check that in the form you are submitting the date is empty and in the DB the date is set to the current date?
are you using any hooks to check on the date? PHP or JS?
Can you check that in the form you are submitting the date is empty and in the DB the date is set to the current date?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: blank dates save as current date
i forgot to add the .php file that handles the fdpf, it think that might be it, I think checking the lenght first might solve the issue
Code: Select all
$date1 = $gwoid['gdatesched'];
$date =date_create($date1);
$pdf->SetY(29.2);
$pdf->SetX(137);
$pdf->Cell(90 ,5,date_format($date,"M/d"),0,1);
Re: blank dates save as current date
Hi,
ok, but now it would be necessary to understand what/how your $gwoid['gdatesched'] is filled. If it is empty, this is what I assume, date_create will create the date object as the current date. So you should check what is in there and apply your logic accordingly.
ok, but now it would be necessary to understand what/how your $gwoid['gdatesched'] is filled. If it is empty, this is what I assume, date_create will create the date object as the current date. So you should check what is in there and apply your logic accordingly.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: blank dates save as current date
thanks that worked
Code: Select all
$date1 = $gwoid['gdatesched'];
if (strlen($date1) > 2){
$date =date_create($date1);
$pdf->SetY(29.2);
$pdf->SetX(137);
$pdf->Cell(90 ,5,date_format($date,"M/d"),0,1);
}
else
{
//echo "should be blank.";
}