2
0
forked from Wavyzz/dolibarr

Compare commits

...

12 Commits
6.0.0 ... 5.0.6

Author SHA1 Message Date
Laurent Destailleur
a158f5ab9d Doc 2017-09-04 12:01:51 +02:00
Laurent Destailleur
61ee071f43 Fix regression 2017-09-04 10:17:51 +02:00
Laurent Destailleur
2c3a696b78 Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 5.0 2017-09-04 10:16:02 +02:00
Laurent Destailleur
65b6b142bd Tag only whe publishing on sf 2017-09-04 09:29:44 +02:00
Laurent Destailleur
f92129dcdb Fix packager to avoid symlinks into custom 2017-09-03 00:55:49 +02:00
Laurent Destailleur
9fe1d8462a Merge pull request #7318 from atm-maxime/fix_extrafieldsline_insert
Fix extrafieldsline insert
2017-09-02 00:07:00 +02:00
Laurent Destailleur
ffb408f440 Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into 5.0 2017-09-01 15:20:48 +02:00
Laurent Destailleur
ac08dec2c3 Avoid warnings 2017-09-01 15:20:29 +02:00
Maxime Kohlhaas
cf49c274a6 Better fix 2017-09-01 10:38:50 +02:00
Maxime Kohlhaas
1a956cce9a Fix : insert line extrafield 2017-09-01 10:31:22 +02:00
Laurent Destailleur
5a81073cd8 Merge pull request #7308 from hregis/5.0_bug2
Fix: documents dir not rename and delete
2017-08-30 16:41:17 +02:00
Regis Houssin
45136de664 Fix: documents dir not rename and delete 2017-08-30 11:26:48 +02:00
4 changed files with 195 additions and 146 deletions

View File

@@ -2,6 +2,9 @@
English Dolibarr ChangeLog 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 ***** ***** ChangeLog for 5.0.5 compared to 5.0.4 *****
FIX: #7075 : bad path for document FIX: #7075 : bad path for document

View File

@@ -334,7 +334,7 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
} }
foreach my $target (sort keys %CHOOSEDPUBLISH) { foreach my $target (sort keys %CHOOSEDPUBLISH) {
if ($CHOOSEDPUBLISH{$target} < 0) { next; } if ($CHOOSEDPUBLISH{$target} < 0) { next; }
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; } if ($target eq 'ASSO') { $nbofpublishneedchangelog++; }
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; } if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
$nboftargetok++; $nboftargetok++;
} }
@@ -594,7 +594,9 @@ if ($nboftargetok) {
print "Remove subdir of custom dir\n"; print "Remove subdir of custom dir\n";
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\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 # Build package for each target

View File

@@ -57,7 +57,7 @@ $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $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; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@@ -43,6 +43,8 @@ class Dolresource extends CommonObject
var $type_label; var $type_label;
var $tms=''; var $tms='';
var $oldcopy;
/** /**
* Constructor * 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->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").",";
@@ -258,17 +267,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';
@@ -423,6 +448,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();