diff --git a/htdocs/includes/modules/propale/mod_propale_marbre.php b/htdocs/includes/modules/propale/mod_propale_marbre.php index 04c133be70f..61ed3f6d9fc 100644 --- a/htdocs/includes/modules/propale/mod_propale_marbre.php +++ b/htdocs/includes/modules/propale/mod_propale_marbre.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005 Regis Houssin + * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,7 +102,7 @@ class mod_propale_marbre extends ModeleNumRefPropales $posindice=8; $sql = "SELECT MAX(SUBSTRING(ref,".$posindice.")) as max"; $sql.= " FROM ".MAIN_DB_PREFIX."propal"; - $sql.= " WHERE ref like '".$this->prefix."%'"; + $sql.= " WHERE ref LIKE '".$this->prefix."%'"; $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); @@ -118,8 +118,7 @@ class mod_propale_marbre extends ModeleNumRefPropales return -1; } - $date=$propal->datep; - //$yymm = strftime("%y%m",time()); + $date = (!empty($propal->datep)?$propal->datep:dol_now('tzserver')); $yymm = strftime("%y%m",$date); $num = sprintf("%04s",$max+1);