diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 62251069c08..7f986e036c1 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -40,6 +40,7 @@ PathToModuleDocumentation=Path to file of module/application documentation
SpaceOrSpecialCharAreNotAllowed=Spaces or special characters are not allowed.
FileNotYetGenerated=File not yet generated
SpecificationFile=File with business rules
+LanguageFile=File for language
ConfirmDeleteProperty=Are you sure you want to delete the property %s ? This will change code in PHP class but also remove column from table definition of object.
NotNull=Not NULL
SearchAll=Used for 'search all'
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 0ba9bbaa071..4ef05cb6e2b 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -146,7 +146,10 @@ if ($dirins && $action == 'initmodule' && $modulename)
'MyModule'=>$modulename,
'MYMODULE'=>strtoupper($modulename),
'My module'=>$modulename,
- 'htdocs/modulebuilder/template/'=>strtolower($modulename),
+ 'my module'=>$modulename,
+ 'Mon module'=>$modulename,
+ 'mon module'=>$modulename,
+ 'htdocs/modulebuilder/template/'=>strtolower($modulename),
'---Put here your own copyright and developer email---'=>dol_print_date($now,'%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
);
@@ -293,7 +296,10 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
'MyModule'=>$module,
'MYMODULE'=>strtoupper($module),
'My module'=>$module,
- 'htdocs/modulebuilder/template/'=>strtolower($modulename),
+ 'my module'=>$module,
+ 'mon module'=>$module,
+ 'Mon module'=>$module,
+ 'htdocs/modulebuilder/template/'=>strtolower($modulename),
'myobject'=>strtolower($objectname),
'MyObject'=>$objectname
);
@@ -908,6 +914,11 @@ elseif (! empty($module))
$head2[$h][2] = 'specifications';
$h++;
+ $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:'');
+ $head2[$h][1] = $langs->trans("Languages");
+ $head2[$h][2] = 'languages';
+ $h++;
+
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'');
$head2[$h][1] = $langs->trans("Objects");
$head2[$h][2] = 'objects';
@@ -1151,6 +1162,51 @@ elseif (! empty($module))
}
}
+ if ($tab == 'languages')
+ {
+ if ($action != 'editfile' || empty($file))
+ {
+ $langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$');
+
+ foreach ($langfiles as $langfile)
+ {
+ $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename'];
+ print ' '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.'';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').'';
+ print ' ';
+ }
+ }
+ else
+ {
+ // Edit text language file
+
+ //print $langs->trans("UseAsciiDocFormat").' ';
+
+ $fullpathoffile=dol_buildpath($file, 0);
+
+ $content = file_get_contents($fullpathoffile);
+
+ // New module
+ print '
';
+ }
+ }
+
if ($tab == 'objects')
{
$head3 = array();
diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php
index b8b43f1359d..7b353113c00 100644
--- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php
+++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php
@@ -78,13 +78,9 @@ class ActionsMyModule
$error = 0; // Error counter
- /*
- print_r($parameters);
- print_r($object);
- echo "action: " . $action;
- */
-
- if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'
+ /* print_r($parameters); print_r($object); echo "action: " . $action; */
+ if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
+ {
}
@@ -115,14 +111,9 @@ class ActionsMyModule
$error = 0; // Error counter
- /*
- print_r($parameters);
- print_r($object);
- echo "action: " . $action;
- */
-
- if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'
-
+ /* print_r($parameters); print_r($object); echo "action: " . $action; */
+ if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
+ {
foreach($parameters['toselect'] as $objectid)
{
// Do action on each object id
@@ -156,7 +147,8 @@ class ActionsMyModule
$error = 0; // Error counter
- if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext'
+ /* print_r($parameters); print_r($object); echo "action: " . $action; */
+ if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
{
$this->resprints = '';
}
@@ -171,4 +163,64 @@ class ActionsMyModule
+ /**
+ * Execute action
+ *
+ * @param array $parameters Array of parameters
+ * @param Object $object Object output on PDF
+ * @param string $action 'add', 'update', 'view'
+ * @return int <0 if KO,
+ * =0 if OK but we want to process standard actions too,
+ * >0 if OK and we want to replace standard actions.
+ */
+ function beforePDFCreation($parameters, &$object, &$action)
+ {
+ global $langs,$conf;
+ global $hookmanager;
+
+ $outputlangs=$langs;
+
+ $ret=0; $deltemp=array();
+ dol_syslog(get_class($this).'::executeHooks action='.$action);
+
+ /* print_r($parameters); print_r($object); echo "action: " . $action; */
+ if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
+ {
+
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Execute action
+ *
+ * @param array $parameters Array of parameters
+ * @param Object $pdfhandler PDF builder handler
+ * @param string $action 'add', 'update', 'view'
+ * @return int <0 if KO,
+ * =0 if OK but we want to process standard actions too,
+ * >0 if OK and we want to replace standard actions.
+ */
+ function afterPDFCreation($parameters, &$pdfhandler, &$action)
+ {
+ global $langs,$conf;
+ global $hookmanager;
+
+ $outputlangs=$langs;
+
+ $ret=0; $deltemp=array();
+ dol_syslog(get_class($this).'::executeHooks action='.$action);
+
+ /* print_r($parameters); print_r($object); echo "action: " . $action; */
+ if (in_array($parameters['currentcontext'], array('somecontext1','somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
+ {
+
+ }
+
+ return $ret;
+ }
+
+ /* Add here any other hooked methods... */
+
}
diff --git a/htdocs/modulebuilder/template/core/boxes/README.md b/htdocs/modulebuilder/template/core/boxes/README.md
new file mode 100644
index 00000000000..b641e7136bc
--- /dev/null
+++ b/htdocs/modulebuilder/template/core/boxes/README.md
@@ -0,0 +1 @@
+Directory where widgets files are stored.
\ No newline at end of file
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 0806bcce8d9..a26f7148142 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -95,7 +95,7 @@ class modMyModule extends DolibarrModules
'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.php'), // 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'
+ 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
);
// Data directories to create when module is enabled.
@@ -305,15 +305,18 @@ class modMyModule extends DolibarrModules
*/
public function init($options='')
{
- $sql = array();
-
$this->_load_tables('/mymodule/sql/');
// Create extrafields
include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
+
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty');
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'string', 1, 10, 'project');
+ //$param=array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3'));
+ //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'select', 1, 3, 'thirdparty', 0, 1, '', $param, 1);
+
+ $sql = array();
return $this->_init($sql, $options);
}
diff --git a/htdocs/modulebuilder/template/core/triggers/README.md b/htdocs/modulebuilder/template/core/triggers/README.md
new file mode 100644
index 00000000000..38d1b1d8961
--- /dev/null
+++ b/htdocs/modulebuilder/template/core/triggers/README.md
@@ -0,0 +1 @@
+Directory where triggers files are stored.
\ No newline at end of file