diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 31031791624..7ae8ea29740 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2085,7 +2085,7 @@ class Facture extends CommonInvoice * @param string $force_number Reference to force on invoice * @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK */ function validate($user, $force_number='', $idwarehouse=0, $notrigger=0) { @@ -3227,6 +3227,8 @@ class Facture extends CommonInvoice if (! empty($conf->global->FACTURE_ADDON)) { + dol_syslog("Call getNextNumRef with FACTURE_ADDON = ".$conf->global->FACTURE_ADDON); + $mybool=false; $file = $conf->global->FACTURE_ADDON.".php"; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index dce39a950aa..2f6d72fb64e 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -450,7 +450,7 @@ abstract class CommonInvoice extends CommonObject $sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; - $sqltemp.= " WHERE c.entity = " . getEntity('c_payment_term'); + $sqltemp.= " WHERE c.entity IN (" . getEntity('c_payment_term').")"; if (is_numeric($cond_reglement)) $sqltemp.= " AND c.rowid=".$cond_reglement; else $sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'"; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 3d4b7352dc3..d794c8e1eca 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -723,6 +723,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // but we should use local year and month of user // For debugging + dol_syslog("mask=".$mask); //include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); //$mask='FA{yy}{mm}-{0000@99}'; //$date=dol_mktime(12, 0, 0, 1, 1, 1900);