fix errors during cherry picking

This commit is contained in:
atm-quentin 2018-11-16 11:31:23 +01:00
parent 4cc3fa1006
commit 7571760fdd
4 changed files with 12 additions and 5 deletions

View File

@ -164,7 +164,8 @@ class mod_facture_mars extends ModeleNumRefFactures
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
$resql=$db->query($sql);
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
if ($resql)
@ -187,7 +188,8 @@ class mod_facture_mars extends ModeleNumRefFactures
$sql = "SELECT facnumber as ref";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)

View File

@ -194,6 +194,9 @@ class mod_facture_mercure extends ModeleNumRefFactures
$where='';
//if ($facture->type == 2) $where.= " AND type = 2";
//else $where.=" AND type != 2";
// Get entities
$entity = getEntity('invoicenumber', 1, $invoice);
$numFinal=get_next_value($db,$mask,'facture','facnumber',$where,$objsoc,$invoice->date,$mode,false,null,$entity);
if (! preg_match('/([0-9])+/',$numFinal)) $this->error = $numFinal;

View File

@ -179,7 +179,8 @@ class mod_facture_terre extends ModeleNumRefFactures
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
$resql=$db->query($sql);
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
if ($resql)
@ -202,7 +203,8 @@ class mod_facture_terre extends ModeleNumRefFactures
$sql = "SELECT facnumber as ref";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
$sql.= " AND entity IN (".getEntity('invoicenumber').")";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)

View File

@ -2053,7 +2053,7 @@ if ($action != 'create' && $action != 'edit')
* All the "Add to" areas
*/
if ( $object->id && ($action == '' || $action == 'view') && $object->status)
if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == '' || $action == 'view') && $object->status)
{
//Variable used to check if any text is going to be printed
$html = '';