Merge pull request #6065 from atm-florian/3.9

FIX : delete contract extrafields on contract deletion
This commit is contained in:
Laurent Destailleur 2016-12-07 11:54:04 +01:00 committed by GitHub
commit ad467989bf
3 changed files with 51 additions and 39 deletions

View File

@ -1134,6 +1134,16 @@ class Contrat extends CommonObject
} }
} }
// Removed extrafields
if (! $error) {
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR);
}
}
if (! $error) if (! $error)
{ {
// We remove directory // We remove directory

View File

@ -15,6 +15,7 @@ if ($resql) // This can fail when class is used on old database (during migra
{ {
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
if ($obj->type!='separate') {
$fieldname=$keyforaliasextra.'.'.$obj->name; $fieldname=$keyforaliasextra.'.'.$obj->name;
$fieldlabel=ucfirst($obj->label); $fieldlabel=ucfirst($obj->label);
$typeFilter="Text"; $typeFilter="Text";
@ -47,4 +48,5 @@ if ($resql) // This can fail when class is used on old database (during migra
$this->export_entities_array[$r][$fieldname]=$keyforelement; $this->export_entities_array[$r][$fieldname]=$keyforelement;
} }
} }
}
// End add axtra fields // End add axtra fields

View File

@ -1202,7 +1202,7 @@ class FichinterLigne extends CommonObjectLine
// Mise a jour ligne en base // Mise a jour ligne en base
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET";
$sql.= " description='".$this->db->escape($this->desc)."'"; $sql.= " description='".$this->db->escape($this->desc)."'";
$sql.= ",date=".$this->db->idate($this->datei); $sql.= ",date='".$this->db->idate($this->datei)."'";
$sql.= ",duree=".$this->duration; $sql.= ",duree=".$this->duration;
$sql.= ",rang='".$this->rang."'"; $sql.= ",rang='".$this->rang."'";
$sql.= " WHERE rowid = ".$this->rowid; $sql.= " WHERE rowid = ".$this->rowid;