';
// Message of the day on home page
- $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object'));
+ $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
complete_substitutions_array($substitutionarray, $langs);
- $substitutionarray['__(AnyTranslationKey)__']=$langs->trans('TranslationKey');
print '
';
diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php
index 39f63683575..50b35392644 100644
--- a/htdocs/core/actions_setnotes.inc.php
+++ b/htdocs/core/actions_setnotes.inc.php
@@ -32,7 +32,7 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel
{
if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('','Include of actions_setnotes.inc.php was done but required variable was not set before');
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
- $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
+ $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public', 'none'), ENT_QUOTES),'_public');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
// Set public note
@@ -40,6 +40,6 @@ else if ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('
{
if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('','Include of actions_setnotes.inc.php was done but required variable was not set before');
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
- $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
+ $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private', 'none'), ENT_QUOTES),'_private');
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index 71a9a4e3125..d3059daba53 100644
--- a/htdocs/core/boxes/box_activity.php
+++ b/htdocs/core/boxes/box_activity.php
@@ -435,7 +435,7 @@ class box_activity extends ModeleBoxes
}
// Add the sum in the bottom of the boxes
- $this->info_box_contents[$line][0] = array('tr' => 'class="liste_total"');
+ $this->info_box_contents[$line][0] = array('tr' => 'class="liste_total_wrap"');
$this->info_box_contents[$line][1] = array('td' => 'align="left" class="liste_total" ', 'text' => $langs->trans("Total")." ".$textHead);
$this->info_box_contents[$line][2] = array('td' => 'align="right" class="liste_total" ', 'text' => $totalnb);
$this->info_box_contents[$line][3] = array('td' => 'align="right" class="liste_total" ', 'text' => '');
diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php
index 9c496964942..93b8fa3d9d2 100644
--- a/htdocs/core/boxes/modules_boxes.php
+++ b/htdocs/core/boxes/modules_boxes.php
@@ -286,7 +286,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
if (isset($contents[$i]))
{
// TR
- if (isset($contents[$i][0]['tr'])) $out.= '
';
+ if (isset($contents[$i][0]['tr'])) $out.= '
';
else $out.= '
';
// Loop on each TD
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index ed318bbd900..f2427056fb5 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -544,7 +544,7 @@ class Form
$disabled=0;
$ret='
';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 704653ade84..f5b4b755b8d 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -599,11 +599,12 @@ function dol_include_once($relpath, $classname='')
/**
* Return path of url or filesystem. Return alternate root if exists.
*
- * @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile
- * @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path using same host that current url), 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file)
- * @return string Full filesystem path (if mode=0), Full url path (if mode=1)
+ * @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile
+ * @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path using same host that current url), 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file)
+ * @param int $returnemptyifnotfound If path==0 and if file was not found, do not return default path but an empty string
+ * @return string Full filesystem path (if path=0), Full url path (if mode=1)
*/
-function dol_buildpath($path, $type=0)
+function dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
{
global $conf;
@@ -611,16 +612,20 @@ function dol_buildpath($path, $type=0)
if (empty($type)) // For a filesystem path
{
- $res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard value
+ $res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard default path
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
{
if ($key == 'main') continue;
if (file_exists($dirroot.'/'.$path))
{
$res=$dirroot.'/'.$path;
- break;
+ return $res;
}
}
+ if ($returnemptyifnotfound) // Not found, we return empty string
+ {
+ return '';
+ }
}
else // For an url path
{
@@ -1011,11 +1016,12 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
* @param int $notab -1 or 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required.
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
+ * @param string $morehtmlright Add more html content on right of tabs title
* @return void
*/
-function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0)
+function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
{
- print dol_get_fiche_head($links, $active, $title, $notab, $picto, $pictoisfullpath);
+ print dol_get_fiche_head($links, $active, $title, $notab, $picto, $pictoisfullpath, $morehtmlright);
}
/**
@@ -1027,14 +1033,17 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
* @param int $notab -1 or 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required.
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
+ * @param string $morehtmlright Add more html content on right of tabs title
* @return string
*/
-function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0)
+function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
{
global $conf, $langs, $hookmanager;
$out="\n".'
'."\n";
+ if ($morehtmlright) $out.='
'.$morehtmlright.'
'; // Output right area first so when space is missing, text is in front of tabs and not under.
+
// Show title
$showtitle=1;
if (! empty($conf->dol_optimize_smallscreen)) $showtitle=0;
@@ -1055,6 +1064,8 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
if (count($keys)) $maxkey=max($keys);
}
+ //$conf->global->MAIN_MAXTABS_IN_CARD=3;
+
// Show tabs
$bactive=false;
// if =0 we don't use the feature
@@ -1142,7 +1153,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
{
$tabsname=str_replace("@", "", $picto);
$out.='
product->enabled) || ! empty($conf->service->enabled)) { ?>
-
+
">
diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php
index 2f839e06281..de1649225ee 100644
--- a/htdocs/core/tpl/objectline_edit.tpl.php
+++ b/htdocs/core/tpl/objectline_edit.tpl.php
@@ -179,7 +179,7 @@ $coldisplay=-1; // We remove first td
product->enabled) || ! empty($conf->service->enabled)) { ?>
-
+
@@ -266,21 +266,21 @@ jQuery(document).ready(function()
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
- }
+ }
});
jQuery("#price_ttc").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
- }
+ }
});
jQuery("#multicurrency_subprice").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
- }
+ }
});
';
- print ' 0 ? 'checked':'').' /> ";
- print ' 0 ? 'checked':'').' /> ";
+ print ' 0 ? 'checked':'').' /> ";
+ print ' 0 ? 'checked':'').' /> ";
print '';
print '';
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 1b9b00a28d2..e5e662a7852 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -3,7 +3,8 @@ ModuleBuilderDesc=This tools must be used by experienced users or developers. It
EnterNameOfModuleDesc=Enter name of the module/application to create with no spaces. Use uppercase to separate words (For example: MyModule, EcommerceForShop, SyncWithMySystem...)
EnterNameOfObjectDesc=Enter name of the object to create with no spaces. Use uppercase to separate words (For example: MyObject, Student, Teacher...). The CRUD class file, but also API file, pages to list/add/edit/delete object and SQL files will be generated.
ModuleBuilderDesc2=Path where modules are generated/edited (first alternative directory defined into %s): %s
-ModuleBuilderDesc3=Generated/editable modules found: %s (they are detected as editable when the file %s exists in root of module directory).
+ModuleBuilderDesc3=Generated/editable modules found: %s
+ModuleBuilderDesc4=A module is detected as 'editable' when the file %s exists in root of module directory
NewModule=New module
NewObject=New object
ModuleKey=Module key
@@ -51,6 +52,8 @@ DatabaseIndex=Database index
FileAlreadyExists=File %s already exists
TriggersFile=File for triggers code
HooksFile=File for hooks code
+ArrayOfKeyValues=Array of key-val
+ArrayOfKeyValuesDesc=Array of keys and values if field is a combo list with fixed values
WidgetFile=Widget file
ReadmeFile=Readme file
ChangeLog=ChangeLog file
@@ -63,4 +66,16 @@ UseAsciiDocFormat=You can use Markdown format, but it is recommanded to use Asci
IsAMeasure=Is a measure
DirScanned=Directory scanned
NoTrigger=No trigger
-NoWidget=No widget
\ No newline at end of file
+NoWidget=No widget
+GoToApiExplorer=Go to API explorer
+ListOfPermissionsDefined=List of defined permissions
+EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
+VisibleDesc=Is the field visible into list ? (Examples: 0=not visible, 1=visible by default on list, -1=not shown by default on list but can be added into list to be viewed)
+IsAMeasureDesc=Can the value of field be cumulated to get a total into list ? (Examples: 1 or 0)
+SearchAllDesc=Is the field used to make a search from the quick search tool ? (Examples: 1 or 0)
+SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.
+LanguageDefDesc=Enter in this files, all the key and the translation for each language file.
+MenusDefDesc=Define here the menus provided by your module (once defined, they are visible into the menu editor %s)
+PermissionsDefDesc=Define here the new permissions provided by your module (once defined, they are visible into the default permissions setup %s)
+HooksDefDesc=Define in the module_parts['hooks'] property in the module descriptor the context of hooks you want to manage (list of contexts can be found by a search on 'initHooks(' in core code). Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on 'executeHooks' in core code).
+TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index dfd12354399..dade8847aa6 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -23,7 +23,7 @@
* \brief Home page for module builder module
*/
-if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
+if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti SQL+XSS injection attack test
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -337,13 +337,13 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
if (! $error)
{
// Edit the class file to write properties
- $result=rebuildObjectClass($destdir, $module, $objectname, $newmask);
- if ($result < 0) $error++;
+ $object=rebuildObjectClass($destdir, $module, $objectname, $newmask);
+ if (is_numeric($object) && $object < 0) $error++;
}
if (! $error)
{
// Edit sql with new properties
- $result=rebuildObjectSql($destdir, $module, $objectname, $newmask);
+ $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object);
if ($result < 0) $error++;
}
@@ -362,22 +362,32 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj))
dol_mkdir($destdir);
$addfieldentry = array(
- 'name'=>GETPOST('propname','aZ09'),'type'=>GETPOST('proptype','aZ09'),'label'=>GETPOST('proplabel','aZ09'),'visible'=>GETPOST('propvisible','int'),'enabled'=>GETPOST('propenabled','int'),
+ 'name'=>GETPOST('propname','aZ09'),'label'=>GETPOST('proplabel','alpha'),'type'=>GETPOST('proptype','alpha'),
+ 'arrayofkeyval'=>GETPOST('proparrayofkeyval','none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
+ 'visible'=>GETPOST('propvisible','int'),'enabled'=>GETPOST('propenabled','int'),
'position'=>GETPOST('propposition','int'),'notnull'=>GETPOST('propnotnull','int'),'index'=>GETPOST('propindex','int'),'searchall'=>GETPOST('propsearchall','int'),
'isameasure'=>GETPOST('propisameasure','int'), 'comment'=>GETPOST('propcomment','alpha'),'help'=>GETPOST('prophelp'));
+ if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval']))
+ {
+ $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true);
+ }
+
// Edit the class file to write properties
if (! $error)
{
- $result=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry);
- if ($result <= 0) $error++;
+ $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry);
+ if (is_numeric($result) && $result <= 0) $error++;
}
// Edit sql with new properties
if (! $error)
{
- $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir);
- if ($result <= 0) $error++;
+ $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
+ if ($result <= 0)
+ {
+ $error++;
+ }
}
if (! $error)
@@ -405,14 +415,14 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey)
// Edit the class file to write properties
if (! $error)
{
- $result=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey);
- if ($result <= 0) $error++;
+ $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey);
+ if (is_numeric($object) && $object <= 0) $error++;
}
// Edit sql with new properties
if (! $error)
{
- $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir);
+ $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
if ($result <= 0) $error++;
}
@@ -675,16 +685,26 @@ if ($action == 'savefile' && empty($cancel))
// Save old version
if (dol_is_file($pathoffile))
{
- dol_move($pathoffile, $pathoffilebackup, 0, 1, 0, 0);
+ dol_copy($pathoffile, $pathoffilebackup, 0, 1);
}
- $content = GETPOST('editfilecontent');
+ $content = GETPOST('editfilecontent','none');
// Save file on disk
- file_put_contents($pathoffile, $content);
- @chmod($pathoffile, octdec($newmask));
+ if ($content)
+ {
+ dol_delete_file($pathoffile);
+ file_put_contents($pathoffile, $content);
+ @chmod($pathoffile, octdec($newmask));
- setEventMessages($langs->trans("FileSaved"), null);
+ setEventMessages($langs->trans("FileSaved"), null);
+ }
+ else
+ {
+ setEventMessages($langs->trans("ContentCantBeEmpty"), null, 'errors');
+ //$action='editfile';
+ $error++;
+ }
}
}
@@ -831,7 +851,8 @@ if ($message)
print $message;
}
-print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).' ';
+//print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).' ';
+$infomodulesfound = '
';
diff --git a/htdocs/modulebuilder/template/ChangeLog.md b/htdocs/modulebuilder/template/ChangeLog.md
index 0f04e316f58..28f0d04e47d 100644
--- a/htdocs/modulebuilder/template/ChangeLog.md
+++ b/htdocs/modulebuilder/template/ChangeLog.md
@@ -1,4 +1,4 @@
-# CHANGELOG FOR DOLIBARR ERP CRM
+# CHANGELOG MYMODULE FOR DOLIBARR ERP CRM
## 1.0
Initial version
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 1ad33b502ad..259db698024 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -62,7 +62,7 @@ class MyObject extends CommonObject
* 'type' if the field format.
* 'label' the translation key.
* 'enabled' is a condition when the filed must be managed.
- * 'visible' says if field is visible in list (-1 means not shown by default but can be aded into list to be viewed).
+ * 'visible' says if field is visible in list (-1 means not shown by default but can be added into list to be viewed).
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
@@ -78,19 +78,19 @@ class MyObject extends CommonObject
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields=array(
- 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
- 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
- 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
+ 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
+ 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
+ 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
- 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>1000),
- 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
- 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
+ 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
+ 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
- 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
+ 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'position'=>500),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'index'=>1, 'position'=>1000),
+ 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
);
public $rowid;
@@ -144,7 +144,7 @@ class MyObject extends CommonObject
$this->db = $db;
- if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $fields['rowid']['visible']=0;
+ if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
}
/**
diff --git a/htdocs/modulebuilder/template/doc/Specifications.asciidoc b/htdocs/modulebuilder/template/doc/Specifications.asciidoc
index 7b1711cf514..adfaeb4e9b5 100644
--- a/htdocs/modulebuilder/template/doc/Specifications.asciidoc
+++ b/htdocs/modulebuilder/template/doc/Specifications.asciidoc
@@ -1 +1,127 @@
-# SPECIFICATIONS OF MODULE MYMODULE FOR DOLIBARR ERP CRM
\ No newline at end of file
+= MYMODULE =
+Copyright (C) ---Put here your own copyright and developer email---
+:subtitle: MYMODULE SPECIFICATIONS
+
+
+
+== Topic of document
+
+This document was build from following input:
+
+* Date 1
+...
+
+* Date 2
+...
+
+
+The document includes an introductory chapter of functional specifications, presenting the different actors involved in the rebuild of the definitions
+of business terms that will be used (some of which may be new or different).
+The main following chapter will present the entire process, also known as *uses cases*, according to a principle of a description, in chronological sequence if possible,
+to present the actor and the action performed, as in the following example:
+
+* *X* Actor realizes Action A.
+* *Y* Actor communicates Info B to Actor *Z*
+* *Automaton* performs update of data for...
+* Etc ...
+
+Functional requirements are complemented by a chapter of technical requirements.
+The chapter on data lists key information specific to Presto that were identified at the time of writing specification. It will be enriched as
+iterations occurs.
+
+Finally, in the Appendix, the documents known when writing this document are centralized to illustrate the existing document or inspire the new expected one.
+These documents have their content directly integrated in this specification or have a reference to
+external documents stored in the *Appendices* directory accompanying this document.
+
+
+
+*Log of versions*
+
+[options="header",format="csv"]
+|===
+Author, Date, Version
+John Doe, Date YYY-MM-DD, Version 1.0
+|===
+
+
+
+<<<
+
+
+== BUSINESS SPECIFICATIONS - INTRODUCTION
+
+=== List of actors [[actors]]
+
+Actors are physical people or moral entities working on at least one process.
+The following chart prensts list of actors or partners identified by the project for the defined scope of project. We will use then the name defined into first column to speak about roles in the rest of documents.
+
+[options="header",format="csv"]
+|===
+Actor/profil/role, Description of role, Access to system or not, Example of actor
+Customer Service, Receive and create Sales orders (SO), Yes, Mr Smith
+Purchase, Make puchase order (PO), Yes, 5 people
+Administrator - IT, Administration of users/groups and IT services, Yes, John Doe
+Automaton, Execute automatic data processing, Yes, NA
+|===
+
+
+=== Definitions [[definitions]]
+
+To understand the descriptions of the target process, it was necessary to define or redefine some vocabulary concepts. We must see these definitions as defined in the
+new system. Indeed, some terms are already being used but have either not a definition in line with standards, or even differs between services. To bring everyone,
+and to consolidate the process, these terms are redefined here, and with their definition in the target objective.
+
+*Definition ABC*
+
+...
+
+*Definition DEF*
+
+...
+
+
+[NOTE]
+==============
+Important information will be noticed with a notice like this one.
+
+* Main information 1
+* Main information 2
+==============
+
+
+
+== BUSINESS SPECIFICATION - PROCESS
+
+Specifications were cut into different business process. We call a business process a workflow with a starting situation and ending situation. Between start and end, we will find actions
+done by actors to bring the value of the company. This actions are described using the syntax rule:
+*Actor X* do action Y, *Actor Z* do action W.
+
+_Each process/use case is described into a separate chapter._
+
+
+=== Use case / Process 1 [[process_1]]
+
+==== Title and goals
+
+...
+
+==== Actors or roles
+
+* Members of group *...*
+
+==== Standard flow
+
+* Members of Groupe *...*: Do ...
+* Members of Groupe *...*: Do ...
+* Members of Groupe *...*: Do ...
+
+==== Alternative flow
+
+* A user without role *...*: Can't do ...
+
+==== Business rules
+
+* Business rule 1
+* Business rule 2
+
+
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 37354d854b0..515768b8011 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -27,8 +27,8 @@
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check anti CSRF attack test
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
+//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check anti CSRF attack test
+//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test done when option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
@@ -270,12 +270,32 @@ if ($action == 'create')
foreach($object->fields as $key => $val)
{
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
- print '