Fix sellby without hour check

This commit is contained in:
fappels 2016-08-11 20:59:56 +02:00
parent 8c63d68083
commit f9a9d4d2d8

View File

@ -149,7 +149,6 @@ class MouvementStock extends CommonObject
{ {
if ($eatby) if ($eatby)
{ {
$eatbywithouthour=$eatby;
$tmparray=dol_getdate($eatby, true); $tmparray=dol_getdate($eatby, true);
$eatbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); $eatbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility
@ -187,9 +186,8 @@ class MouvementStock extends CommonObject
{ {
if ($sellby) if ($sellby)
{ {
$sellbywithouthour=$sellby; $tmparray=dol_getdate($sellby, true);
$tmparray=dol_getdate($eatby, true); $sellbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
$eatbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
if ($this->db->jdate($obj->sellby) != $sellby && $this->db->jdate($obj->sellby) != $sellbywithouthour) // We test date without hours and with hours for backward compatibility if ($this->db->jdate($obj->sellby) != $sellby && $this->db->jdate($obj->sellby) != $sellbywithouthour) // We test date without hours and with hours for backward compatibility
{ {
// If found and eatby/sellby defined into table and provided and differs, return error // If found and eatby/sellby defined into table and provided and differs, return error