Skip to content

Commit

Permalink
Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 17, 2017
2 parents b7a6c7d + 1ef70b3 commit b6c9823
Show file tree
Hide file tree
Showing 12 changed files with 589 additions and 79 deletions.
2 changes: 1 addition & 1 deletion htdocs/admin/websites.php
Expand Up @@ -362,7 +362,7 @@
$sql.=" ORDER BY ";
}
$sql.=$tabsqlsort[$id];
$sql.=$db->plimit($listlimit+1,$offset);
$sql.=$db->plimit($limit+1, $offset);
//print $sql;

$fieldlist=explode(',',$tabfield[$id]);
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/lib/admin.lib.php
Expand Up @@ -931,7 +931,8 @@ function unActivateModule($value, $requiredby=1)
{
//print $dir.$modFile;
// TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded
$genericMod = new DolibarrModules($db);
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
$genericMod = new DolibarrModules($db);
$genericMod->name=preg_replace('/^mod/i','',$modName);
$genericMod->rights_class=strtolower(preg_replace('/^mod/i','',$modName));
$genericMod->const_name='MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',$modName));
Expand Down
26 changes: 21 additions & 5 deletions htdocs/core/lib/files.lib.php
Expand Up @@ -47,14 +47,15 @@ function dol_basename($pathfile)
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
* but must not contains the start and end '/'. Filter is checked into basename only.
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked into fullpath.
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortcriteria Sort criteria ("","fullname","relativename","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @param int $nohook Disable all hooks
* @param string $relativename For recursive purpose only. Must be "" at first call.
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
* @see dol_dir_list_indatabase
*/
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0)
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
{
global $db, $hookmanager;
global $object;
Expand Down Expand Up @@ -144,6 +145,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
"name" => $file,
"path" => $path,
"level1name" => $level1name,
"relativename" => ($relativename?$relativename.'/':'').$file,
"fullname" => $path.'/'.$file,
"date" => $filedate,
"size" => $filesize,
Expand All @@ -155,7 +157,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
// if we're in a directory and we want recursive behavior, call this function again
if ($recursive)
{
$file_list = array_merge($file_list,dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook));
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename?$relativename.'/':'').$file));
}
}
else if (! $isdir && (($types == "files") || ($types == "all")))
Expand All @@ -172,6 +174,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
"name" => $file,
"path" => $path,
"level1name" => $level1name,
"relativename" => ($relativename?$relativename.'/':'').$file,
"fullname" => $path.'/'.$file,
"date" => $filedate,
"size" => $filesize,
Expand Down Expand Up @@ -1689,7 +1692,7 @@ function dol_uncompress($inputfile,$outputdir)
* Compress a directory and subdirectories into a package file.
*
* @param string $inputdir Source dir name
* @param string $outputfile Target file name
* @param string $outputfile Target file name (output directory must exists and be writable)
* @param string $mode 'zip'
* @return int <0 if KO, >0 if OK
*/
Expand All @@ -1698,6 +1701,15 @@ function dol_compress_dir($inputdir, $outputfile, $mode="zip")
$foundhandler=0;

dol_syslog("Try to zip dir ".$inputdir." into ".$outputdir." mode=".$mode);

if (! dol_is_dir(dirname($outputfile)) || ! is_writable(dirname($outputfile)))
{
global $langs, $errormsg;
$langs->load("errors");
$errormsg=$langs->trans("ErrorFailedToWriteInDir",$outputfile);
return -3;
}

try
{
if ($mode == 'gz') { $foundhandler=0; }
Expand All @@ -1721,7 +1733,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode="zip")

// Initialize archive object
$zip = new ZipArchive();
$zip->open($outputfile, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$result = $zip->open($outputfile, ZipArchive::CREATE | ZipArchive::OVERWRITE);

// Create recursive directory iterator
/** @var SplFileInfo[] $files */
Expand Down Expand Up @@ -1756,6 +1768,10 @@ function dol_compress_dir($inputdir, $outputfile, $mode="zip")
dol_syslog("Try to zip with format ".$mode." with no handler for this format",LOG_ERR);
return -2;
}
else
{
return 0;
}
}
catch (Exception $e)
{
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/modules/modModuleBuilder.class.php
Expand Up @@ -47,7 +47,7 @@ function __construct($db)
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "A tool to help developers to build their own module.";
$this->version = 'development'; // 'development', 'experimental' or 'dolibarr' or version
$this->version = 'experimental'; // 'development', 'experimental' or 'dolibarr' or version
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
Expand Down Expand Up @@ -85,7 +85,7 @@ function __construct($db)
// Main menu entries
//------------------
$this->menu = array();

$this->menu[$r]=array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools',
'type'=>'left',
'titre'=>'ModuleBuilder',
Expand All @@ -98,6 +98,6 @@ function __construct($db)
'enabled'=>'$conf->modulebuilder->enabled && preg_match(\'/^admintools/\',$leftmenu) && ($user->admin || $conf->global->MODULEBUILDER_FOREVERYONE)',
'target'=>'_modulebuilder',
'user'=>0);

}
}
4 changes: 2 additions & 2 deletions htdocs/langs/en_US/install.lang
Expand Up @@ -53,10 +53,10 @@ AdminLogin=Login for Dolibarr database owner.
PasswordAgain=Retype password a second time
AdminPassword=Password for Dolibarr database owner.
CreateDatabase=Create database
CreateUser=Create owner
CreateUser=Create owner or grant him permission on database
DatabaseSuperUserAccess=Database server - Superuser access
CheckToCreateDatabase=Check box if database does not exist and must be created.<br>In this case, you must fill the login/password for superuser account at the bottom of this page.
CheckToCreateUser=Check box if database owner does not exist and must be created.<br>In this case, you must choose its login and password and also fill the login/password for the superuser account at the bottom of this page. If this box is unchecked, owner database and its passwords must exists.
CheckToCreateUser=Check box if database owner does not exist and must be created, or if it exists but database does not exists and permissions must be granted.<br>In this case, you must choose its login and password and also fill the login/password for the superuser account at the bottom of this page. If this box is unchecked, owner database and its passwords must exists.
DatabaseRootLoginDescription=Login of the user allowed to create new databases or new users, mandatory if your database or its owner does not already exists.
KeepEmptyIfNoPassword=Leave empty if user has no password (avoid this)
SaveConfigurationFile=Save values
Expand Down
8 changes: 5 additions & 3 deletions htdocs/langs/en_US/modulebuilder.lang
Expand Up @@ -12,7 +12,7 @@ ModuleInitialized=Module initialized
FilesForObjectInitialized=Files for new object '%s' initialized
FilesForObjectUpdated=Files for object '%s' updated (.sql files and .class.php file)
ModuleBuilderDescdescription=Enter here all general information that describe your module
ModuleBuilderDescspecifications=You can enter here a long text to describe the specifications of your module that is not already structured into other tabs. So you have on hand the rules to develop. Also this text content will be included into the generated documentation (see last tab).
ModuleBuilderDescspecifications=You can enter here a long text to describe the specifications of your module that is not already structured into other tabs. So you have within easy reach all the rules to develop. Also this text content will be included into the generated documentation (see last tab). You can use Markdown format, but it is recommanded to use Asciidoc format (Comparison between .md and .asciidoc: http://asciidoctor.org/docs/user-manual/#compared-to-markdown)
ModuleBuilderDescobjects=Define here the objects you want to manage with your module. A sql file, a page to list them, to create/edit/view a card and an API will be generated.
ModuleBuilderDescmenus=This tab is dedicated to define menu entries provided by your module.
ModuleBuilderDescpermissions=This tab is dedicated to define the new permissions you want to provide with your module.
Expand All @@ -25,7 +25,7 @@ EnterNameOfObjectToDeleteDesc=You can delete an object. WARNING: All files relat
DangerZone=Danger zone
BuildPackage=Build package/documentation
BuildDocumentation=Build documentation
ModuleIsNotActive=This module was not activated yet (go into %s to make it live)
ModuleIsNotActive=This module was not activated yet. Ggo into %s to make it live or click here:
ModuleIsLive=This module has been activated. Any change on it may break a current active feature.
DescriptionLong=Long description
EditorName=Name of editor
Expand All @@ -51,4 +51,6 @@ WidgetFile=Widget file
ReadmeFile=Readme file
ChangeLog=ChangeLog file
SqlFile=Sql file
SqlFileKey=Sql file for keys
SqlFileKey=Sql file for keys
AnObjectAlreadyExistWithThisNameAndDiffCase=An object already exists with this name and a different case
UseAsciiDocFormat=You can use Markdown format, but it is recommanded to use Asciidoc format (Comparison between .md and .asciidoc: http://asciidoctor.org/docs/user-manual/#compared-to-markdown)
1 change: 1 addition & 0 deletions htdocs/langs/en_US/other.lang
Expand Up @@ -17,6 +17,7 @@ TextPreviousMonthOfInvoice=Previous month (text) of invoice date
NextMonthOfInvoice=Following month (number 1-12) of invoice date
TextNextMonthOfInvoice=Following month (text) of invoice date
ZipFileGeneratedInto=Zip file generated into <b>%s</b>.
DocFileGeneratedInto=Doc file generated into <b>%s</b>.

YearOfInvoice=Year of invoice date
PreviousYearOfInvoice=Previous year of invoice date
Expand Down

0 comments on commit b6c9823

Please sign in to comment.