Merge pull request #6065 from atm-florian/3.9
FIX : delete contract extrafields on contract deletion
This commit is contained in:
commit
ad467989bf
@ -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
|
||||||
|
|||||||
@ -15,36 +15,38 @@ 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))
|
||||||
{
|
{
|
||||||
$fieldname=$keyforaliasextra.'.'.$obj->name;
|
if ($obj->type!='separate') {
|
||||||
$fieldlabel=ucfirst($obj->label);
|
$fieldname=$keyforaliasextra.'.'.$obj->name;
|
||||||
$typeFilter="Text";
|
$fieldlabel=ucfirst($obj->label);
|
||||||
switch($obj->type)
|
$typeFilter="Text";
|
||||||
{
|
switch($obj->type)
|
||||||
case 'int':
|
{
|
||||||
case 'double':
|
case 'int':
|
||||||
case 'price':
|
case 'double':
|
||||||
$typeFilter="Numeric";
|
case 'price':
|
||||||
break;
|
$typeFilter="Numeric";
|
||||||
case 'date':
|
break;
|
||||||
case 'datetime':
|
case 'date':
|
||||||
$typeFilter="Date";
|
case 'datetime':
|
||||||
break;
|
$typeFilter="Date";
|
||||||
case 'boolean':
|
break;
|
||||||
$typeFilter="Boolean";
|
case 'boolean':
|
||||||
break;
|
$typeFilter="Boolean";
|
||||||
case 'sellist':
|
break;
|
||||||
$tmp='';
|
case 'sellist':
|
||||||
$tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
|
$tmp='';
|
||||||
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
|
$tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
|
||||||
$tmpkeys=array_keys($tmpparam['options']);
|
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
|
||||||
$tmp=array_shift($tmpkeys);
|
$tmpkeys=array_keys($tmpparam['options']);
|
||||||
}
|
$tmp=array_shift($tmpkeys);
|
||||||
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
|
}
|
||||||
break;
|
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
||||||
|
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
||||||
|
$this->export_entities_array[$r][$fieldname]=$keyforelement;
|
||||||
}
|
}
|
||||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
|
||||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
|
||||||
$this->export_entities_array[$r][$fieldname]=$keyforelement;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End add axtra fields
|
// End add axtra fields
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user