Remove warnings

This commit is contained in:
Laurent Destailleur 2018-04-13 17:54:27 +02:00
parent 300d6962d9
commit 6f91b8019f
3 changed files with 14 additions and 10 deletions

View File

@ -2730,14 +2730,15 @@ class Facture extends CommonInvoice
// Mise a jour informations denormalisees au niveau de la facture meme
$result=$this->update_price(1,'auto',0,$mysoc); // The addline method is designed to add line from user input so total calculation with update_price must be done using 'auto' mode.
if ($result > 0)
{
$this->db->commit();
return $this->line->rowid;
return $this->line->id;
}
else
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
@ -4482,11 +4483,11 @@ class FactureLigne extends CommonInvoiceLine
$resql=$this->db->query($sql);
if ($resql)
{
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet');
$this->rowid=$this->id; // For backward compatibility
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$this->id=$this->rowid;
$result=$this->insertExtraFields();
if ($result < 0)
{
@ -4558,12 +4559,12 @@ class FactureLigne extends CommonInvoiceLine
}
$this->db->commit();
return $this->rowid;
return $this->id;
}
else
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
$this->db->rollback();
return -2;
}

View File

@ -867,7 +867,7 @@ class FormFile
}
else
{
preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir).'$/', $filedir, $regs);
preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir,'/').'$/', $filedir, $regs);
$entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity);
}

View File

@ -132,7 +132,7 @@ foreach($object->fields as $key => $val)
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
}
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
@ -439,9 +439,12 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
{
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}
}