do not use '0000-00-00 00:00:00' as date anymore

use NULL instead because '0000-00-00 00:00:00' in certain sql_modes
This commit is contained in:
Uwe Steinmann 2016-08-08 12:49:59 +02:00
parent b3ec207213
commit 83dcd9da7b
3 changed files with 10 additions and 7 deletions

View File

@ -1639,8 +1639,10 @@ class SeedDMS_Core_DMS {
elseif($role == '') elseif($role == '')
$role = '0'; $role = '0';
if(trim($pwdexpiration) == '') if(trim($pwdexpiration) == '')
$pwdexpiration = '0000-00-00 00:00:00'; $pwdexpiration = 'NULL';
$queryStr = "INSERT INTO tblUsers (login, pwd, fullName, email, language, theme, comment, role, hidden, disabled, pwdExpiration, quota, homefolder) VALUES (".$db->qstr($login).", ".$db->qstr($pwd).", ".$db->qstr($fullName).", ".$db->qstr($email).", '".$language."', '".$theme."', ".$db->qstr($comment).", '".intval($role)."', '".intval($isHidden)."', '".intval($isDisabled)."', ".$db->qstr($pwdexpiration).", '".intval($quota)."', ".($homefolder ? intval($homefolder) : "NULL").")"; else
$pwdexpiration = $db->qstr($pwdexpiration);
$queryStr = "INSERT INTO tblUsers (login, pwd, fullName, email, language, theme, comment, role, hidden, disabled, pwdExpiration, quota, homefolder) VALUES (".$db->qstr($login).", ".$db->qstr($pwd).", ".$db->qstr($fullName).", ".$db->qstr($email).", '".$language."', '".$theme."', ".$db->qstr($comment).", '".intval($role)."', '".intval($isHidden)."', '".intval($isDisabled)."', ".$pwdexpiration.", '".intval($quota)."', ".($homefolder ? intval($homefolder) : "NULL").")";
$res = $this->db->getResult($queryStr); $res = $this->db->getResult($queryStr);
if (!$res) if (!$res)
return false; return false;

View File

@ -79,7 +79,7 @@ class SeedDMS_Core_Transmittal {
*/ */
var $_dms; var $_dms;
function SeedDMS_Core_Transmittal($id, $user, $name, $comment, $isPublic=0, $date='0000-00-00 00:00:00') { function SeedDMS_Core_Transmittal($id, $user, $name, $comment, $isPublic=0, $date='') {
$this->_id = $id; $this->_id = $id;
$this->_name = $name; $this->_name = $name;
$this->_comment = $comment; $this->_comment = $comment;
@ -312,7 +312,7 @@ class SeedDMS_Core_TransmittalItem {
*/ */
var $_date; var $_date;
function SeedDMS_Core_TransmittalItem($id, $transmittal, $content, $date='0000-00-00 00:00:00') { function SeedDMS_Core_TransmittalItem($id, $transmittal, $content, $date='') {
$this->_id = $id; $this->_id = $id;
$this->_transmittal = $transmittal; $this->_transmittal = $transmittal;
$this->_content = $content; $this->_content = $content;

View File

@ -372,7 +372,7 @@ class SeedDMS_Core_User { /* {{{ */
const role_admin = '1'; const role_admin = '1';
const role_guest = '2'; const role_guest = '2';
function __construct($id, $login, $pwd, $fullName, $email, $language, $theme, $comment, $role, $isHidden=0, $isDisabled=0, $pwdExpiration='0000-00-00 00:00:00', $loginFailures=0, $quota=0, $homeFolder=null, $secret='') { function __construct($id, $login, $pwd, $fullName, $email, $language, $theme, $comment, $role, $isHidden=0, $isDisabled=0, $pwdExpiration='', $loginFailures=0, $quota=0, $homeFolder=null, $secret='') {
$this->_id = $id; $this->_id = $id;
$this->_login = $login; $this->_login = $login;
$this->_pwd = $pwd; $this->_pwd = $pwd;
@ -529,7 +529,8 @@ class SeedDMS_Core_User { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
if(trim($newPwdExpiration) == '') if(trim($newPwdExpiration) == '')
$newPwdExpiration = '0000-00-00 00:00:00'; $queryStr = "UPDATE tblUsers SET pwdExpiration = NULL WHERE id = " . $this->_id;
else
$queryStr = "UPDATE tblUsers SET pwdExpiration =".$db->qstr($newPwdExpiration)." WHERE id = " . $this->_id; $queryStr = "UPDATE tblUsers SET pwdExpiration =".$db->qstr($newPwdExpiration)." WHERE id = " . $this->_id;
$res = $db->getResult($queryStr); $res = $db->getResult($queryStr);
if (!$res) if (!$res)