diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index ba6e219a1ed..d927e8d8747 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -572,7 +572,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'ErrorDates must use same hours and must be GMT dates'; $i=0; - while ($timestampStart < $timestampEnd && ($i < 50000)) // Loop end when equals (Test on i is a security loop to avoid infinite loop) + while ($timestampStart <= $timestampEnd && ($i < 50000)) // Loop end when equals (Test on i is a security loop to avoid infinite loop) { $ferie=false; $countryfound=0; diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 9670d002be6..40c57d1563e 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -119,4 +119,5 @@ UseTypeFieldToChange=Use field Type to change OpenIDURL=OpenID URL LoginUsingOpenID=Use OpenID to login WeeklyHours=Weekly hours -ColorUser=Color of the user \ No newline at end of file +ColorUser=Color of the user +DisabledInMonoUserMode=Disabled in maintenance mode diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index b37384932cf..d89d50abc2d 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -451,7 +451,7 @@ class MouvementStock extends CommonObject * @param int $qty Quantity of product with batch number * @return int <0 if KO, else return productbatch id */ - function _create_batch($dluo, $qty ) { + function _create_batch($dluo, $qty) { $pdluo=New Productbatch($this->db); //Try to find an existing record with batch same batch number or id @@ -497,7 +497,15 @@ class MouvementStock extends CommonObject } - function get_origin($fk_origin, $origintype) { + /** + * Return Url link of origin object + * + * @param int $fk_origin Id origin + * @param int $origintype Type origin + * @return string + */ + function get_origin($fk_origin, $origintype) + { switch ($origintype) { case 'commande': require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -525,7 +533,10 @@ class MouvementStock extends CommonObject break; } - $origin->fetch($fk_origin); - return $origin->getNomUrl(1); + if ($origin->fetch($fk_origin) > 0) { + return $origin->getNomUrl(1); + } + + return ''; } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index fb99c05728c..7db25f78794 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2413,7 +2413,7 @@ class Societe extends CommonObject } //Verify duplicate entries - $sql = "SELECT COUNT(*) as idprof FROM ".MAIN_DB_PREFIX."societe WHERE ".$field." = '".$value."'"; + $sql = "SELECT COUNT(*) as idprof FROM ".MAIN_DB_PREFIX."societe WHERE ".$field." = '".$value."' AND entity IN (".getEntity('societe',1).")"; if($socid) $sql .= " AND rowid <> ".$socid; $resql = $this->db->query($sql); if ($resql)