FIX last_main_doc var not saved

This commit is contained in:
Laurent Destailleur 2019-01-29 18:40:47 +01:00
parent f4ecf843ee
commit 9ef93bceca

View File

@ -310,6 +310,12 @@ abstract class CommonObject
*/
public $modelpdf;
/**
* @var string
* Contains relative path of last generated main file
*/
public $last_main_doc;
/**
* @var int Bank account ID
* @see SetBankAccount()
@ -4667,10 +4673,15 @@ abstract class CommonObject
if (! empty($obj->update_main_doc_field)) $update_main_doc_field=1;
if ($update_main_doc_field && ! empty($this->table_element))
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".($ecmfile->filepath.'/'.$ecmfile->filename)."'";
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".$this->db->escape($ecmfile->filepath.'/'.$ecmfile->filename)."'";
$sql.= ' WHERE rowid = '.$this->id;
$resql = $this->db->query($sql);
if (! $resql) dol_print_error($this->db);
else
{
$this->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename;
}
}
}
}
@ -4900,7 +4911,7 @@ abstract class CommonObject
//var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]);
}
}
// If field is a computed field, value must become result of compute
foreach ($tab as $key => $value) {
if (! empty($extrafields) && !empty($extrafields->attributes[$this->table_element]['computed'][$key]))