mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-20 08:21:29 +01:00
Work on modulebuilder
This commit is contained in:
@@ -310,6 +310,8 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
if (preg_match('/^.*Bytes$/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^NoteSomeFeaturesAreDisabled/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) $qualifiedforclean=0;
|
||||
// modulebuilder
|
||||
if (preg_match('/^ModuleBuilderDesc/', $value)) $qualifiedforclean=0;
|
||||
// orders
|
||||
if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TypeContact_/', $value)) $qualifiedforclean=0;
|
||||
|
||||
@@ -47,7 +47,6 @@ print load_fiche_titre($langs->trans("TriggersAvailable"),'','title_setup');
|
||||
print $langs->trans("TriggersDesc")."<br>";
|
||||
print "<br>\n";
|
||||
|
||||
$template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/';
|
||||
|
||||
$interfaces = new Interfaces($db);
|
||||
$triggers = $interfaces->getTriggersList();
|
||||
|
||||
@@ -226,9 +226,10 @@ class Interfaces
|
||||
* Return list of triggers. Function used by admin page htdoc/admin/triggers.
|
||||
* List is sorted by trigger filename so by priority to run.
|
||||
*
|
||||
* @param array $forcedirtriggers null=All default directories. This parameter is used by modulebuilder module only.
|
||||
* @return array Array list of triggers
|
||||
*/
|
||||
function getTriggersList()
|
||||
function getTriggersList($forcedirtriggers=null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -241,11 +242,15 @@ class Interfaces
|
||||
$i = 0;
|
||||
|
||||
$dirtriggers=array_merge(array('/core/triggers/'),$conf->modules_parts['triggers']);
|
||||
if (is_array($forcedirtriggers))
|
||||
{
|
||||
$dirtriggers=$forcedirtriggers;
|
||||
}
|
||||
|
||||
foreach($dirtriggers as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir,0);
|
||||
$newdir=dol_osencode($dir);
|
||||
//print "xx".$dir;exit;
|
||||
|
||||
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php at each call)
|
||||
if (! is_dir($newdir)) continue;
|
||||
|
||||
@@ -448,14 +448,15 @@ function dol_filemtime($pathoffile)
|
||||
* @param array $arrayreplacement Array with strings to replace
|
||||
* @param string $destfile Destination file (can't be a directory). If empty, will be same than source file.
|
||||
* @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK). Example: '0666'
|
||||
* @param int $indexdatabase Index new file into database.
|
||||
* @return int <0 if error, 0 if nothing done (dest file already exists), >0 if OK
|
||||
* @see dolCopyr
|
||||
*/
|
||||
function dolReplaceInFile($srcfile, $arrayreplacement, $destfile='', $newmask=0)
|
||||
function dolReplaceInFile($srcfile, $arrayreplacement, $destfile='', $newmask=0, $indexdatabase=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog("files.lib.php::dolReplaceInFile srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask);
|
||||
dol_syslog("files.lib.php::dolReplaceInFile srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." indexdatabase=".$indexdatabase);
|
||||
|
||||
if (empty($srcfile)) return -1;
|
||||
if (empty($destfile)) $destfile=$srcfile;
|
||||
@@ -484,12 +485,15 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile='', $newmask=0)
|
||||
dol_delete_file($tmpdestfile);
|
||||
|
||||
// Create $newpathoftmpdestfile from $newpathofsrcfile
|
||||
$content=file_get_contents($newpathofsrcfile, 'r');
|
||||
|
||||
$content = make_substitutions($content, $arrayreplacement, null);
|
||||
|
||||
|
||||
file_put_contents($newpathoftmpdestfile, $content);
|
||||
@chmod($newpathoftmpdestfile, octdec($newmask));
|
||||
|
||||
// Rename
|
||||
$result=dol_move($newpathoftmpdestfile, $newpathofdestfile, $newmask, (($destfile == $srcfile)?1:0));
|
||||
$result=dol_move($newpathoftmpdestfile, $newpathofdestfile, $newmask, (($destfile == $srcfile)?1:0), 0, $indexdatabase);
|
||||
if (! $result)
|
||||
{
|
||||
dol_syslog("files.lib.php::dolReplaceInFile failed to move tmp file to final dest", LOG_WARNING);
|
||||
@@ -569,10 +573,11 @@ function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
|
||||
* @param string $destfile Destination file (a directory)
|
||||
* @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK). Example: '0666'
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @return int <0 if error, 0 if nothing done (dest dir already exists and overwriteifexists=0), >0 if OK
|
||||
* @param array $arrayreplacement Array to use to replace filenames with another one during the copy (works only on file names, not on directory names).
|
||||
* @return int <0 if error, 0 if nothing done (all files already exists and overwriteifexists=0), >0 if OK
|
||||
* @see dol_copy
|
||||
*/
|
||||
function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
|
||||
function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -583,7 +588,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
|
||||
if (empty($srcfile) || empty($destfile)) return -1;
|
||||
|
||||
$destexists=dol_is_dir($destfile);
|
||||
if (! $overwriteifexists && $destexists) return 0;
|
||||
//if (! $overwriteifexists && $destexists) return 0; // The overwriteifexists is for files only, so propaated to dol_copy only.
|
||||
|
||||
if (! $destexists)
|
||||
{
|
||||
@@ -592,37 +597,37 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
|
||||
$dirmaskdec=octdec($newmask);
|
||||
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
|
||||
$dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files
|
||||
dol_mkdir($destfile."/".$file, '', decoct($dirmaskdec));
|
||||
dol_mkdir($destfile, '', decoct($dirmaskdec));
|
||||
}
|
||||
|
||||
$srcfile=dol_osencode($srcfile);
|
||||
$destfile=dol_osencode($destfile);
|
||||
$ossrcfile=dol_osencode($srcfile);
|
||||
$osdestfile=dol_osencode($destfile);
|
||||
|
||||
// recursive function to copy
|
||||
// all subdirectories and contents:
|
||||
if (is_dir($srcfile))
|
||||
// Recursive function to copy all subdirectories and contents:
|
||||
if (is_dir($ossrcfile))
|
||||
{
|
||||
$dir_handle=opendir($srcfile);
|
||||
$dir_handle=opendir($ossrcfile);
|
||||
while ($file=readdir($dir_handle))
|
||||
{
|
||||
if ($file!="." && $file!="..")
|
||||
{
|
||||
if (is_dir($srcfile."/".$file))
|
||||
if (is_dir($ossrcfile."/".$file))
|
||||
{
|
||||
if (!is_dir($destfile."/".$file))
|
||||
{
|
||||
// We must set mask just before creating dir, becaause it can be set differently by dol_copy
|
||||
umask(0);
|
||||
$dirmaskdec=octdec($newmask);
|
||||
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
|
||||
$dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files
|
||||
dol_mkdir($destfile."/".$file, '', decoct($dirmaskdec));
|
||||
}
|
||||
$tmpresult=dolCopyDir($srcfile."/".$file, $destfile."/".$file, $newmask, $overwriteifexists);
|
||||
//var_dump("xxx dolCopyDir $srcfile/$file, $destfile/$file, $newmask, $overwriteifexists");
|
||||
$tmpresult=dolCopyDir($srcfile."/".$file, $destfile."/".$file, $newmask, $overwriteifexists, $arrayreplacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpresult=dol_copy($srcfile."/".$file, $destfile."/".$file, $newmask, $overwriteifexists);
|
||||
$newfile = $file;
|
||||
// Replace destination filename with a new one
|
||||
if (is_array($arrayreplacement))
|
||||
{
|
||||
foreach($arrayreplacement as $key => $val)
|
||||
{
|
||||
$newfile = str_replace($key, $val, $newfile);
|
||||
}
|
||||
}
|
||||
$tmpresult=dol_copy($srcfile."/".$file, $destfile."/".$newfile, $newmask, $overwriteifexists);
|
||||
}
|
||||
// Set result
|
||||
if ($result > 0 && $tmpresult >= 0)
|
||||
@@ -641,7 +646,8 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=dol_copy($srcfile, $destfile, $newmask, $overwriteifexists);
|
||||
// Source directory does not exists
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -660,10 +666,11 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
|
||||
* @param integer $newmask Mask in octal string for new file (0 by default means $conf->global->MAIN_UMASK)
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @param int $testvirus Do an antivirus test. Move is canceled if a virus is found.
|
||||
* @param int $indexdatabase Index new file into database.
|
||||
* @return boolean True if OK, false if KO
|
||||
* @see dol_move_uploaded_file
|
||||
*/
|
||||
function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0)
|
||||
function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=1)
|
||||
{
|
||||
global $user, $db, $conf;
|
||||
$result=false;
|
||||
@@ -709,7 +716,7 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvi
|
||||
}
|
||||
|
||||
// Move ok
|
||||
if ($result)
|
||||
if ($result && $indexdatabase)
|
||||
{
|
||||
// Rename entry into ecm database
|
||||
$rel_filetorenamebefore = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $srcfile);
|
||||
|
||||
@@ -6,4 +6,12 @@ ModuleBuilderDesc3=Generated/editable modules found: <strong>%s</strong> (they a
|
||||
NewModule=New module
|
||||
ModuleKey=Key for new module
|
||||
ModuleInitialized=Module initialized
|
||||
|
||||
ModuleBuilderDescdescription=Enter here all general information that describe your module
|
||||
ModuleBuilderDescobjects=Define here the new objects you want to manage with our module. A page to list them and a page to create/edit/view a card 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 our module.
|
||||
ModuleBuilderDesctriggers=This is the view of triggers provided by your module. To include code executed when a triggered business event is launched, just edit this file with your IDE.
|
||||
ModuleBuilderDescbuildpackage=You can generate here a "ready to distribute" package file (a normalized .zip file) of your module. Just click on button to get your module package file.
|
||||
BuildPackage=Build package
|
||||
ModuleIsNotActive=This module was not activated yet (go into Home-Setup-Module to make it live)
|
||||
ModuleIsLive=This module has been activated. Any change on it may break a current active feature.
|
||||
@@ -29,9 +29,10 @@ $langs->load("admin");
|
||||
$langs->load("modulebuilder");
|
||||
$langs->load("other");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$module=GETPOST('module');
|
||||
$module=GETPOST('module','alpha');
|
||||
$tab=GETPOST('tab','aZ09');
|
||||
if (empty($module)) $module='initmodule';
|
||||
if (empty($tab)) $tab='description';
|
||||
|
||||
@@ -56,30 +57,36 @@ $FILEFLAG='modulebuilder.txt';
|
||||
if ($dircustom && $action == 'initmodule' && $modulename)
|
||||
{
|
||||
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||
$destdir = $dircustom.'/'.$modulename;
|
||||
$destdir = $dircustom.'/'.strtolower($modulename);
|
||||
|
||||
$arrayreplacement=array(
|
||||
'mymodule'=>strtolower($modulename),
|
||||
'MyModule'=>$modulename
|
||||
);
|
||||
|
||||
$result = dolCopyDir($srcdir, $destdir, 0, 0);
|
||||
$result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement);
|
||||
//dol_mkdir($destfile);
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFailToCopyDir", $srcdir, $destdir), null, 'errors');
|
||||
}
|
||||
else // $result == 0
|
||||
{
|
||||
setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
// Edit PHP files
|
||||
if (! $error)
|
||||
{
|
||||
$listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.php$', '', 'fullname', SORT_ASC, 0, 1);
|
||||
$listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js)$', '', 'fullname', SORT_ASC, 0, 1);
|
||||
foreach($listofphpfilestoedit as $phpfileval)
|
||||
{
|
||||
var_dump($phpfileval['fullname']);
|
||||
|
||||
//var_dump($phpfileval['fullname']);
|
||||
$arrayreplacement=array(
|
||||
'mymodule'=>strtolower($modulename),
|
||||
'MyModule'=>$modulename,
|
||||
@@ -106,6 +113,12 @@ if ($dircustom && $action == 'initmodule' && $modulename)
|
||||
}
|
||||
}
|
||||
|
||||
if ($dircustom && $action == 'generatepackage')
|
||||
{
|
||||
$dir = $dircustom.'/'.$modulename;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -138,7 +151,16 @@ if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // En
|
||||
$fullname = $dircustomcursor['fullname'];
|
||||
if (dol_is_file($fullname.'/'.$FILEFLAG))
|
||||
{
|
||||
$listofmodules[$dircustomcursor['name']]=$fullname;
|
||||
// Get real name of module (MyModule instead of mymodule)
|
||||
$descriptorfiles = dol_dir_list($fullname.'/core/modules/', 'files', 0, 'mod.*\.class\.php');
|
||||
$modulenamewithcase='';
|
||||
foreach($descriptorfiles as $descriptorcursor)
|
||||
{
|
||||
$modulenamewithcase=preg_replace('/^mod/', '', $descriptorcursor['name']);
|
||||
$modulenamewithcase=preg_replace('/\.class\.php$/', '', $modulenamewithcase);
|
||||
}
|
||||
if ($modulenamewithcase) $listofmodules[$dircustomcursor['name']]=$modulenamewithcase;
|
||||
//var_dump($listofmodules);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,11 +176,44 @@ if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // En
|
||||
print $langs->trans("ModuleBuilderDesc").'<br>';
|
||||
print $langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $dircustom).'<br>';
|
||||
print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'<br>';
|
||||
print '<br>';
|
||||
//print '<br>';
|
||||
|
||||
|
||||
// Load module descriptor
|
||||
$error=0;
|
||||
$moduleobj = null;
|
||||
|
||||
if (! empty($module) && $module != 'initmodule')
|
||||
{
|
||||
$modulelowercase=strtolower($module);
|
||||
|
||||
// Load module
|
||||
dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php');
|
||||
$class='mod'.$module;
|
||||
|
||||
if (class_exists($class))
|
||||
{
|
||||
try {
|
||||
$moduleobj = new $class($db);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$error++;
|
||||
print $e->getMessage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module);
|
||||
}
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Tabs for all modules
|
||||
$head = array();
|
||||
$h=0;
|
||||
|
||||
@@ -167,11 +222,11 @@ $head[$h][1] = $langs->trans("NewModule");
|
||||
$head[$h][2] = 'initmodule';
|
||||
$h++;
|
||||
|
||||
foreach($listofmodules as $tmpmodule => $fullname)
|
||||
foreach($listofmodules as $tmpmodule => $tmpmodulewithcase)
|
||||
{
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodule;
|
||||
$head[$h][1] = $tmpmodule;
|
||||
$head[$h][2] = $tmpmodule;
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase;
|
||||
$head[$h][1] = $tmpmodulewithcase;
|
||||
$head[$h][2] = $tmpmodulewithcase;
|
||||
$h++;
|
||||
}
|
||||
|
||||
@@ -195,73 +250,197 @@ if ($module == 'initmodule')
|
||||
}
|
||||
elseif (! empty($module))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
// Load module
|
||||
dol_include_once($module.'/core/modules/mod'.ucfirst($module).'.class.php');
|
||||
$class='mod'.ucfirst($module);
|
||||
if (class_exists($class))
|
||||
{
|
||||
try {
|
||||
$moduleobj = new $class($db);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$error++;
|
||||
print $e->getMessage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module);
|
||||
}
|
||||
|
||||
// Button to delete module
|
||||
|
||||
|
||||
// Tabs for module
|
||||
if (! $error)
|
||||
{
|
||||
$head2 = array();
|
||||
$h=0;
|
||||
|
||||
foreach($listofmodules as $tmpmodule => $fullname)
|
||||
$modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive");
|
||||
if (! empty($conf->$module->enabled))
|
||||
{
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description';
|
||||
$modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive");
|
||||
}
|
||||
|
||||
foreach($listofmodules as $tmpmodule => $tmpmodulewithcase)
|
||||
{
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$tmpmodulewithcase;
|
||||
$head2[$h][1] = $langs->trans("Description");
|
||||
$head2[$h][2] = 'description';
|
||||
$h++;
|
||||
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects';
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$tmpmodulewithcase;
|
||||
$head2[$h][1] = $langs->trans("Objects");
|
||||
$head2[$h][2] = 'objects';
|
||||
$h++;
|
||||
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab='.$tmpmodule;
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$tmpmodulewithcase;
|
||||
$head2[$h][1] = $langs->trans("Menus");
|
||||
$head2[$h][2] = 'menus';
|
||||
$h++;
|
||||
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab='.$tmpmodule;
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$tmpmodulewithcase;
|
||||
$head2[$h][1] = $langs->trans("Permissions");
|
||||
$head2[$h][2] = 'permissions';
|
||||
$h++;
|
||||
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab='.$tmpmodule;
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$tmpmodulewithcase;
|
||||
$head2[$h][1] = $langs->trans("Triggers");
|
||||
$head2[$h][2] = 'triggers';
|
||||
$h++;
|
||||
|
||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$tmpmodulewithcase;
|
||||
$head2[$h][1] = $langs->trans("BuildPackage");
|
||||
$head2[$h][2] = 'buildpackage';
|
||||
$h++;
|
||||
}
|
||||
|
||||
print $modulestatusinfo.'<br><br>';
|
||||
|
||||
dol_fiche_head($head2, $tab, '', -1, '');
|
||||
|
||||
print $langs->trans("ModuleBuilderDesc".$tab).'<br><br>';
|
||||
|
||||
if ($tab == 'description')
|
||||
{
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">';
|
||||
print $langs->trans("Parameter");
|
||||
print '</td><td>';
|
||||
print $langs->trans("Value");
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Numero");
|
||||
print '</td><td>';
|
||||
print $moduleobj->numero;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Name");
|
||||
print '</td><td>';
|
||||
print $moduleobj->getName();
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Version");
|
||||
print '</td><td>';
|
||||
print $moduleobj->getVersion();
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Family");
|
||||
print "<br>'crm','financial','hr','projects','products','ecm','technic','interface','other'";
|
||||
print '</td><td>';
|
||||
print $moduleobj->family;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("EditorName");
|
||||
print '</td><td>';
|
||||
print $moduleobj->editor_name;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("EditorUrl");
|
||||
print '</td><td>';
|
||||
print $moduleobj->editor_url;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Description");
|
||||
print '</td><td>';
|
||||
print $moduleobj->getDesc();
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans("LongDescription");
|
||||
print '</td><td>';
|
||||
print $moduleobj->getDescLong();
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
print '<form name="delete">';
|
||||
print '<input type="hidden" name="action" value="confirm_delete">';
|
||||
print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">';
|
||||
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
|
||||
print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'">';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
if ($tab == 'objects')
|
||||
{
|
||||
print $langs->trans("FeatureNotYetAvailable");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($tab == 'menus')
|
||||
{
|
||||
print $langs->trans("FeatureNotYetAvailable");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($tab == 'permissions')
|
||||
{
|
||||
print $langs->trans("FeatureNotYetAvailable");
|
||||
|
||||
}
|
||||
|
||||
if ($tab == 'triggers')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
||||
|
||||
$interfaces = new Interfaces($db);
|
||||
$triggers = $interfaces->getTriggersList(array('/'.strtolower($module).'/core/triggers'));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder">
|
||||
<tr class="liste_titre">
|
||||
<td colspan="2">'.$langs->trans("File").'</td>
|
||||
<td align="center">'.$langs->trans("Active").'</td>
|
||||
<td align="center"> </td>
|
||||
</tr>
|
||||
';
|
||||
|
||||
$var=True;
|
||||
foreach ($triggers as $trigger)
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td valign="top" width="14" align="center">'.$trigger['picto'].'</td>';
|
||||
print '<td class="tdtop">'.$trigger['file'].'</td>';
|
||||
print '<td valign="top" align="center">'.$trigger['status'].'</td>';
|
||||
print '<td class="tdtop">';
|
||||
$text=$trigger['info'];
|
||||
$text.="<br>\n<strong>".$langs->trans("File")."</strong>:<br>\n".$trigger['relpath'];
|
||||
//$text.="\n".$langs->trans("ExternalModule",$trigger['isocreorexternal']);
|
||||
print $form->textwithpicto('', $text);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($tab == 'buildpackage')
|
||||
{
|
||||
print '<form name="generatepackage">';
|
||||
print '<input type="hidden" name="action" value="generatepackage">';
|
||||
print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">';
|
||||
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Generate").'">';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
@@ -83,22 +83,19 @@ class modMyModule extends DolibarrModules
|
||||
// for default path (eg: /mymodule/core/xxxxx) (0=disable, 1=enable)
|
||||
// for specific path of parts (eg: /mymodule/core/modules/barcode)
|
||||
// for specific css file (eg: /mymodule/css/mymodule.css.php)
|
||||
//$this->module_parts = array(
|
||||
// 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
// 'login' => 0, // Set this to 1 if module has its own login method directory (core/login)
|
||||
// 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions)
|
||||
// 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus)
|
||||
// 'theme' => 0, // Set this to 1 if module has its own theme directory (theme)
|
||||
// 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
|
||||
// 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
|
||||
// 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
|
||||
// 'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file
|
||||
// 'js' => array('/mymodule/js/mymodule.js'), // Set this to relative path of js file if module must load a js on all pages
|
||||
// 'hooks' => array('hookcontext1','hookcontext2',...) // Set here all hooks context managed by module. You can also set hook context 'all'
|
||||
// 'dir' => array('output' => 'othermodulename'), // To force the default directories names
|
||||
// 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module
|
||||
// );
|
||||
$this->module_parts = array();
|
||||
$this->module_parts = array(
|
||||
'triggers' => 1, // Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
'login' => 0, // Set this to 1 if module has its own login method directory (core/login)
|
||||
'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions)
|
||||
'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus)
|
||||
'theme' => 0, // Set this to 1 if module has its own theme directory (theme)
|
||||
'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
|
||||
'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
|
||||
'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
|
||||
'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file
|
||||
'js' => array('/mymodule/js/mymodule.js'), // Set this to relative path of js file if module must load a js on all pages
|
||||
'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module. You can also set hook context 'all'
|
||||
);
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/mymodule/temp");
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file core/triggers/interface_99_modMyModule_Triggers.class.php
|
||||
* \file core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
|
||||
* \ingroup mymodule
|
||||
* \brief Example trigger.
|
||||
*
|
||||
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
/**
|
||||
* Class of triggers for MyModule module
|
||||
*/
|
||||
class InterfaceMyModuleTrigger extends DolibarrTriggers
|
||||
class InterfaceMyModuleTriggers extends DolibarrTriggers
|
||||
{
|
||||
/**
|
||||
* @var DoliDB Database handler
|
||||
@@ -1,2 +1,2 @@
|
||||
File to flag module build using official module template.
|
||||
File to flag module built using official module template.
|
||||
When this file is present into a module directory, you can edit it with the module builder tool.
|
||||
@@ -44,7 +44,7 @@ if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@inc
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
dol_include_once('/mymodule/class/myobject_class.class.php');
|
||||
dol_include_once('/mymodule/class/myobject.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("mymodule");
|
||||
|
||||
@@ -46,7 +46,7 @@ if (! $res) die("Include of main fails");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
dol_include_once('/mymodule/class/skeleton_class.class.php');
|
||||
dol_include_once('/mymodule/class/myobject.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("mymodule");
|
||||
|
||||
Reference in New Issue
Block a user