forked from Wavyzz/dolibarr
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a158f5ab9d | ||
|
|
61ee071f43 | ||
|
|
2c3a696b78 | ||
|
|
65b6b142bd | ||
|
|
f92129dcdb | ||
|
|
9fe1d8462a | ||
|
|
ffb408f440 | ||
|
|
ac08dec2c3 | ||
|
|
cf49c274a6 | ||
|
|
1a956cce9a | ||
|
|
5a81073cd8 | ||
|
|
45136de664 |
@@ -2,6 +2,9 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
|
||||
FIX: Removed a bad symbolic link into custom directory.
|
||||
FIX: Renaming a resouce ref rename also the directory of attached files.
|
||||
|
||||
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
|
||||
FIX: #7075 : bad path for document
|
||||
|
||||
@@ -334,7 +334,7 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
|
||||
}
|
||||
foreach my $target (sort keys %CHOOSEDPUBLISH) {
|
||||
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
||||
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
||||
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; }
|
||||
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
|
||||
$nboftargetok++;
|
||||
}
|
||||
@@ -594,7 +594,9 @@ if ($nboftargetok) {
|
||||
|
||||
print "Remove subdir of custom dir\n";
|
||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
|
||||
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to keep dir
|
||||
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to keep files only
|
||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n";
|
||||
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to keep files only
|
||||
}
|
||||
|
||||
# Build package for each target
|
||||
|
||||
@@ -57,7 +57,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@@ -43,6 +43,8 @@ class Dolresource extends CommonObject
|
||||
var $type_label;
|
||||
var $tms='';
|
||||
|
||||
var $oldcopy;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -240,6 +242,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->description)) $this->description=trim($this->description);
|
||||
|
||||
if (empty($this->oldcopy))
|
||||
{
|
||||
$org=new self($this->db);
|
||||
$org->fetch($this->id);
|
||||
$this->oldcopy=$org;
|
||||
}
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
||||
@@ -258,17 +267,33 @@ class Dolresource extends CommonObject
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('RESOURCE_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
//// Call triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('RESOURCE_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref))
|
||||
{
|
||||
// We remove directory
|
||||
if (! empty($conf->resource->dir_output))
|
||||
{
|
||||
$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)
|
||||
{
|
||||
$action='update';
|
||||
@@ -423,6 +448,25 @@ class Dolresource extends CommonObject
|
||||
// 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)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
Reference in New Issue
Block a user