diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php new file mode 100644 index 00000000000..f5f37ae91b1 --- /dev/null +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -0,0 +1,93 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/lib/memory.lib.php + * \brief Set of function for memory/cache management + */ + + +/** + * Save data into a memory area shared by all users, all sessions on server + * + * @param string $destdir Directory + * @param string $module Module name + * @param string $objectname Name of object + * @param string $newmask New mask + * @return int <0 if KO, >0 if OK + */ +function rebuildobjectsql($destdir, $module, $objectname, $newmask) +{ + global $db; + + if (empty($objectname)) return -1; + + dol_include_once(strtolower($module).'/class/'.strtolower($objectname).'.class.php'); + $object=new $objectname($db); + + // Edit sql files + $pathoffiletoedit=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.sql'); + + $contentsql = file_get_contents($pathoffiletoedit, 'r'); + + $i=0; + $texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n"; + foreach($object->fields as $key => $val) + { + $i++; + $texttoinsert.= "\t".$key." ".$val['type']; + if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; + if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; + $texttoinsert.= ($val['notnull']?' NOT NULL':''); + if ($i < count($object->fields)) $texttoinsert.=", "; + $texttoinsert.= "\n"; + } + $texttoinsert.= "\t".'-- END MODULEBUILDER FIELDS'; + + $contentsql = preg_replace('/-- BEGIN MODULEBUILDER FIELDS.*END MODULEBUILDER FIELDS/ims', $texttoinsert, $contentsql); + + file_put_contents($pathoffiletoedit, $contentsql); + @chmod($pathoffiletoedit, octdec($newmask)); + + + + // Edit sql files + $pathoffiletoedit=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'); + + $contentsql = file_get_contents($pathoffiletoedit, 'r'); + + $i=0; + $texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n"; + foreach($object->fields as $key => $val) + { + $i++; + if ($val['index']) + { + $texttoinsert.= "ALTER TABLE llx_".strtolower($objectname)." ADD INDEX idx_".strtolower($objectname)."_".$key." (".$key.");"; + $texttoinsert.= "\n"; + } + } + $texttoinsert.= '-- END MODULEBUILDER INDEXES'; + + $contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql); + + file_put_contents($pathoffiletoedit, $contentsql); + @chmod($pathoffiletoedit, octdec($newmask)); + + return 1; +} diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a58d177061a..9251db5311f 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -736,6 +736,7 @@ ShowTransaction=Show entry on bank account GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide. Deny=Deny Denied=Denied +ListOf=List of %s ListOfTemplates=List of templates Gender=Gender Genderman=Man diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 5a3470aebce..f73aa4a1eb8 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -9,7 +9,8 @@ NewObject=New object ModuleKey=Module key ObjectKey=Object key ModuleInitialized=Module initialized -FilesForObjectInitialized=Files for new object initialized +FilesForObjectInitialized=Files for new object '%s' initialized +FilesForObjectUpdated=Files for object '%s' updated 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). 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. @@ -39,4 +40,8 @@ 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 -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. \ No newline at end of file +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' +DatabaseIndex=Database index +FileAlreadyExists=File %s already exists \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index a1c30b7c94a..18d66187f16 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -24,6 +24,7 @@ if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/modulebuilder.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $langs->load("admin"); @@ -58,6 +59,12 @@ $dirins = $tmp[0]; $FILEFLAG='modulebuilder.txt'; $now=dol_now(); +$newmask = 0; +if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; +if (empty($newmask)) // This should no happen +{ + $newmask='0664'; +} /* @@ -158,14 +165,6 @@ if ($dirins && $action == 'initobject' && $module && $objectname) $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; $destdir = $dirins.'/'.strtolower($module); - $arrayreplacement=array( - 'mymodule'=>strtolower($module), - 'MyModule'=>$module, - 'myobject'=>strtolower($objectname), - 'MyObject'=>$objectname - ); - - // Delete some files $filetogenerate = array( 'myobject_card.php'=>strtolower($objectname).'_card.php', @@ -182,7 +181,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) foreach($filetogenerate as $srcfile => $destfile) { - $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile); + $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); if ($result <= 0) { if ($result < 0) @@ -193,7 +192,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) } else // $result == 0 { - setEventMessages($langs->trans("FileAlreadyExists", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'warnings'); + setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings'); } } else @@ -212,10 +211,10 @@ if ($dirins && $action == 'initobject' && $module && $objectname) //var_dump($phpfileval['fullname']); $arrayreplacement=array( - 'mymodule'=>strtolower($modulename), - 'MyModule'=>$modulename, - 'MYMODULE'=>strtoupper($modulename), - 'My module'=>$modulename, + 'mymodule'=>strtolower($module), + 'MyModule'=>$module, + 'MYMODULE'=>strtoupper($module), + 'My module'=>$module, 'htdocs/modulebuilder/template/'=>'', 'myobject'=>strtolower($objectname), 'MyObject'=>$objectname @@ -232,7 +231,32 @@ if ($dirins && $action == 'initobject' && $module && $objectname) if (! $error) { - setEventMessages('FilesForObjectInitialized', null); + // Edit sql with new properties + rebuildobjectsql($destdir, $module, $objectname, $newmask); + + // Edit the class file to write properties + + + } + + if (! $error) + { + setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); + } +} + +if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj)) +{ + $objectname = $tabobj; + + $destdir = $dirins.'/'.strtolower($module); + + // Edit sql with new properties + rebuildobjectsql($destdir, $module, $objectname, $newmask); + + if (! $error) + { + setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); } } @@ -426,15 +450,7 @@ if ($action == 'savefile' && empty($cancel)) $content = GETPOST('editfilecontent'); // Save file on disk - $newmask = 0; - file_put_contents($pathoffile, $content); - if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; - if (empty($newmask)) // This should no happen - { - $newmask='0664'; - } - @chmod($pathoffile, octdec($newmask)); setEventMessages($langs->trans("FileSaved"), null); @@ -939,18 +955,22 @@ elseif (! empty($module)) $pathtoapi = strtolower($module).'/class/api_'.strtolower($tabobj).'.class.php'; $pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php'; $pathtocard = strtolower($module).'/'.strtolower($tabobj).'_card.php'; + print '
'; print ' '.$langs->trans("ClassFile").' : '.$pathtoclass.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print ' '.$langs->trans("ApiClassFile").' : '.$pathtoapi.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print '
'; + print '
'; print ' '.$langs->trans("PageForList").' : '.$pathtolist.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; print ' '.$langs->trans("PageForCreateEditView").' : '.$pathtocard.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print '
'; + + print '


'; $result = dol_include_once($pathtoclass); $tmpobjet = new $tabobj($db); @@ -964,7 +984,7 @@ elseif (! empty($module)) print '
'; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -974,11 +994,15 @@ elseif (! empty($module)) print ''.$langs->trans("Property"); print ' ('.$langs->trans("Example").')'; print ''; - print ''.$langs->trans("Label").''; + print ''; + print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")); + print ''; print ''.$langs->trans("Type").''; - print ''.$langs->trans("Position").''; - print ''.$langs->trans("DefaultValue").''; - print ''.$langs->trans("Index").''; + print ''.$langs->trans("Position").''; + print ''.$langs->trans("NotNull").''; + print ''.$langs->trans("SearchAll").''; + //print ''.$langs->trans("DefaultValue").''; + print ''.$langs->trans("DatabaseIndex").''; print ''.$langs->trans("Comment").''; print ''; print ''; @@ -986,9 +1010,11 @@ elseif (! empty($module)) print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + //print ''; + print ''; print ''; print ''; print ''; @@ -1016,7 +1042,9 @@ elseif (! empty($module)) $proplabel=$propval['label']; $proptype=$propval['type']; $propposition=$propval['position']; - $propdefault=$propval['default']; + $propnotnull=$propval['notnull']; + $propsearchall=$propval['searchall']; + //$propdefault=$propval['default']; $propindex=$propval['index']; $propcomment=$propval['comment']; @@ -1031,14 +1059,20 @@ elseif (! empty($module)) print ''; print $proptype; print ''; - print ''; + print ''; print $propposition; print ''; - print ''; - print $propdefault; + print ''; + print $propnotnull?'X':''; print ''; - print ''; - print yn($propindex); + print ''; + print $propsearchall?'X':''; + print ''; + /*print ''; + print $propdefault; + print '';*/ + print ''; + print $propindex?'X':''; print ''; print ''; print $propcomment; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 4c85a6e5a86..7b0d83dfff0 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -47,7 +47,7 @@ class MyObject extends CommonObject /** * @var array Does this field is linked to a thirdparty ? */ - protected $isnolinkedbythird=1; + protected $isnolinkedbythird = 1; /** * @var array Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ @@ -58,18 +58,19 @@ class MyObject extends CommonObject public $picto = 'myobject'; - /* BEGIN PROPERTY FIELDS - Do not remove this comment */ + // BEGIN MODULEBUILDER PROPERTIES - Do not remove this comment /** * @var array Array with all fields and their property */ public $fields=array( - 'ref'=>array('type'=>'string','label'=>'Ref','position'=>10,'index'=>true,'comment'=>'Reference of object'), - 'entity'=>array('type'=>'integer','label'=>'Entity','index'=>true), - 'status'=>array('type'=>'integer','label'=>'Status','index'=>true), - 'date'=>array('type'=>'date','label'=>'Date','default'=>'__NOW__'), - 'title'=>array('type'=>'string','label'=>'Title'), + 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'position'=>10, 'notnull'=>true, 'index'=>true, 'searchall'=>1, 'comment'=>'Reference of object'), + 'entity'=>array('type'=>'integer', 'label'=>'Entity', 'notnull'=>true, 'index'=>true), + 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'searchall'=>1), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'notnull'=>true, 'position'=>500), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'notnull'=>true, 'position'=>500), + 'status'=>array('type'=>'integer', 'label'=>'Status', 'index'=>true, 'position'=>1000), ); - /* END PROPERTY FIELDS - Do not remove this comment */ + // Do not remove this comment - END MODULEBUILDER PROPERTIES diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 1d7fad81473..72fec670cb1 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -65,6 +65,7 @@ $massaction = GETPOST('massaction','alpha'); $show_files = GETPOST('show_files','int'); $confirm = GETPOST('confirm','alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // To manage different context of search $id = GETPOST('id','int'); $backtopage = GETPOST('backtopage'); @@ -80,32 +81,27 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield="t.rowid"; // Set here default search field +$object=new MyObject($db); + +// Default sort order (if not yet defined by previous GETPOST) +if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. if (! $sortorder) $sortorder="ASC"; // Protection if external user $socid=0; if ($user->societe_id > 0) { - $socid = $user->societe_id; - //accessforbidden(); + //$socid = $user->societe_id; + accessforbidden(); } // Initialize array of search criterias -$object=new MyModule($db); -$search_all=trim(GETPOST("search_all")); +$search_all=trim(GETPOST("search_all",'alpha')); $search=array(); -foreach($object->fields as $key) +foreach($object->fields as $key => $val) { if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); } -/*$search_field1=GETPOST("search_field1"); -$search_field2=GETPOST("search_field2"); -$search_myfield=GETPOST('search_myfield'); -*/ - -// Initialize technical object to manage context to save list fields -$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('myobjectlist')); @@ -116,21 +112,18 @@ $extralabels = $extrafields->fetch_name_optionals_label('myobject'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 't.ref'=>'Ref', - 't.note_public'=>'NotePublic', -); -if (empty($user->socid)) $fieldstosearchall["t.note_private"]="NotePrivate"; +$fieldstosearchall = array(); +foreach($object->fields as $key => $val) +{ + if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; +} // Definition of fields for list -$arrayfields=array( - 't.field1'=>array('label'=>"Field1", 'checked'=>1), - 't.field2'=>array('label'=>"Field2", 'checked'=>1), - //'t.entity'=>array('label'=>"Entity", 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))), - 't.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), - 't.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), - //'t.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), -); +$arrayfields=array(); +foreach($object->fields as $key => $val) +{ + $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>1); +} // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -143,11 +136,10 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab - /* * ACTIONS * - * Put here all code to do according to value of "action" parameter + * Put here all code to do according to value of "$action" parameter */ if (GETPOST('cancel')) { $action='list'; $massaction=''; } @@ -165,17 +157,17 @@ if (empty($reshook)) // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { - $search_field1=''; - $search_field2=''; - $search_date_creation=''; - $search_date_update=''; + foreach($object->fields as $key => $val) + { + $search[$key]=''; + } $toselect=''; $search_array_options=array(); } // Mass actions - $objectclass='MyModule'; - $objectlabel='MyModule'; + $objectclass='MyObject'; + $objectlabel='MyObject'; $permtoread = $user->rights->mymodule->read; $permtodelete = $user->rights->mymodule->delete; $uploaddir = $conf->mymodule->dir_output; @@ -196,7 +188,7 @@ $form=new Form($db); //$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url=''; -$title = $langs->trans('MyModuleListTitle'); +$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("MyObjects")); // Put here content of your page @@ -215,24 +207,26 @@ jQuery(document).ready(function() { }); '; - -$sql = "SELECT"; -$sql.= " t.rowid,"; -$sql.= " t.field1,"; -$sql.= " t.field2"; +$sql = 'SELECT '; +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; -$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (t.rowid = ef.fk_object)"; -$sql.= " WHERE 1 = 1"; -//$sql.= " WHERE u.entity IN (".getEntity('mytable').")"; -if ($search_field1) $sql.= natural_search("field1",$search_field1); -if ($search_field2) $sql.= natural_search("field2",$search_field2); -if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall); +$sql=preg_replace('/, $/','', $sql); +$sql.= " FROM ".MAIN_DB_PREFIX."myobject as t"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."myobject_extrafields as ef on (t.rowid = ef.fk_object)"; +$sql.= " WHERE t.entity IN (".getEntity('myobject').")"; +foreach($search as $key => $val) +{ + if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:($object->fields[$key]['type'] == 'integer'?1:0))); +} +if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); // Add where from extra fields foreach ($search_array_options as $key => $val) { @@ -394,7 +388,7 @@ if (! empty($arrayfields['t.tms']['checked'])) print ''; print ''; } -/*if (! empty($arrayfields['u.statut']['checked'])) +/*if (! empty($arrayfields['t.statut']['checked'])) { // Status print ''; @@ -507,7 +501,7 @@ while ($i < min($num, $limit)) } // Status /* - if (! empty($arrayfields['u.statut']['checked'])) + if (! empty($arrayfields['t.statut']['checked'])) { $userstatic->statut=$obj->statut; print ''.$userstatic->getLibStatut(3).''; diff --git a/htdocs/modulebuilder/template/sql/llx_myobject.key.sql b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql index 812a98090af..4822d7c3ac4 100644 --- a/htdocs/modulebuilder/template/sql/llx_myobject.key.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql @@ -14,6 +14,9 @@ -- along with this program. If not, see . -ALTER TABLE llx_myobject ADD UNIQUE INDEX uk_fk_othertable (fk_othertable); ---ALTER TABLE llx_myobject ADD CONSTRAINT llx_mytable_field_id FOREIGN KEY (fk_field) REFERENCES llx_myOthertable(rowid); +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_myobject ADD UNIQUE INDEX idx_fieldobject (fieldobject); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_myobject ADD CONSTRAINT llx_myobject_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid); diff --git a/htdocs/modulebuilder/template/sql/llx_myobject.sql b/htdocs/modulebuilder/template/sql/llx_myobject.sql index 8cba239766f..b5810f0f227 100644 --- a/htdocs/modulebuilder/template/sql/llx_myobject.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject.sql @@ -13,9 +13,14 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . + CREATE TABLE llx_myobject( rowid INTEGER AUTO_INCREMENT PRIMARY KEY, + -- BEGIN MODULEBUILDER FIELDS entity INTEGER DEFAULT 1 NOT NULL, - fk_othertable INTEGER NOT NULL, - name VARCHAR(189) -); + label VARCHAR(255), + datec DATETIME NOT NULL, + tms TIMESTAMP NOT NULL, + status INTEGER + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; \ No newline at end of file