Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into 6.0
Conflicts: build/makepack-dolibarr.pl htdocs/compta/bank/index.php
This commit is contained in:
commit
c108f11c01
@ -44,6 +44,8 @@ class Dolresource extends CommonObject
|
|||||||
public $type_label;
|
public $type_label;
|
||||||
public $tms='';
|
public $tms='';
|
||||||
|
|
||||||
|
var $oldcopy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -241,6 +243,13 @@ class Dolresource extends CommonObject
|
|||||||
if (isset($this->fk_code_type_resource)) $this->fk_code_type_resource=trim($this->fk_code_type_resource);
|
if (isset($this->fk_code_type_resource)) $this->fk_code_type_resource=trim($this->fk_code_type_resource);
|
||||||
if (isset($this->description)) $this->description=trim($this->description);
|
if (isset($this->description)) $this->description=trim($this->description);
|
||||||
|
|
||||||
|
if (empty($this->oldcopy))
|
||||||
|
{
|
||||||
|
$org=new self($this->db);
|
||||||
|
$org->fetch($this->id);
|
||||||
|
$this->oldcopy=$org;
|
||||||
|
}
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||||
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
||||||
@ -259,17 +268,33 @@ class Dolresource extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Call trigger
|
||||||
// want this action calls a trigger.
|
$result=$this->call_trigger('RESOURCE_MODIFY',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//// Call triggers
|
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref))
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
{
|
||||||
$interface=new Interfaces($this->db);
|
// We remove directory
|
||||||
$result=$interface->run_triggers('RESOURCE_MODIFY',$this,$user,$langs,$conf);
|
if (! empty($conf->resource->dir_output))
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
{
|
||||||
//// End call triggers
|
$olddir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($this->oldcopy->ref);
|
||||||
|
$newdir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($this->ref);
|
||||||
|
if (file_exists($olddir))
|
||||||
|
{
|
||||||
|
$res = @rename($olddir, $newdir);
|
||||||
|
if (! $res)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorFailToRenameDir',$olddir,$newdir);
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$action='update';
|
$action='update';
|
||||||
@ -424,6 +449,25 @@ class Dolresource extends CommonObject
|
|||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
// We remove directory
|
||||||
|
$ref = dol_sanitizeFileName($this->ref);
|
||||||
|
if (! empty($conf->resource->dir_output))
|
||||||
|
{
|
||||||
|
$dir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($this->ref);
|
||||||
|
if (file_exists($dir))
|
||||||
|
{
|
||||||
|
$res=@dol_delete_dir_recursive($dir);
|
||||||
|
if (! $res)
|
||||||
|
{
|
||||||
|
$this->errors[] = 'ErrorFailToDeleteDir';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user