Works on ODT module.
This commit is contained in:
parent
1129856241
commit
c45bf06000
@ -264,12 +264,16 @@ class modSociete extends DolibarrModules
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
|
||||
|
||||
// Prevent pb of modules not correctly disabled
|
||||
//$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
create_exdir(DOL_DATA_ROOT.'/odttemplates/thirdparties');
|
||||
dol_copy(DOL_DOCUMENT_ROOT.'/install/odttemplates/thirdparties/template_thirdparty.odt',DOL_DATA_ROOT.'/odttemplates/thirdparties/template_thirdparty.odt',0,0);
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
}
|
||||
|
||||
|
||||
@ -304,20 +304,25 @@ function dol_is_file($pathoffile)
|
||||
|
||||
/**
|
||||
* Copy a file to another file
|
||||
* @param $srcfile Source file
|
||||
* @param $destfile Destination file
|
||||
* @param $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK)
|
||||
* @return boolean True if OK, false if KO
|
||||
* @param $srcfile Source file
|
||||
* @param $destfile Destination file
|
||||
* @param $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK)
|
||||
* @param $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @return boolean True if OK, false if KO
|
||||
*/
|
||||
function dol_copy($srcfile, $destfile, $newmask=0)
|
||||
function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
|
||||
{
|
||||
global $conf;
|
||||
$result=false;
|
||||
|
||||
dol_syslog("files.lib.php::dol_copy srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask);
|
||||
$result=@copy($srcfile, $destfile);
|
||||
if ($overwriteifexists || ! dol_is_file($destfile))
|
||||
{
|
||||
$result=@copy($srcfile, $destfile);
|
||||
|
||||
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($file, octdec($newmask));
|
||||
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($file, octdec($newmask));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user