Skip to content
Snippets Groups Projects
Commit 11cc1f04 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Work on modulebuilder

parent b016b1ca
No related branches found
No related tags found
No related merge requests found
<?php
/* Copyright (C) 2009-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 <http://www.gnu.org/licenses/>.
* 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;
}
......@@ -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
......
......@@ -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 <strong>%s</strong> ? 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 <strong>%s</strong> ? 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
......@@ -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 '<div class="fichehalfleft">';
print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.$pathtoclass.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("ApiClassFile").' : <strong>'.$pathtoapi.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '</div>';
print '<div class="fichehalfleft">';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForList").' : <strong>'.$pathtolist.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForCreateEditView").' : <strong>'.$pathtocard.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '</div>';
print '<br><br><br>';
$result = dol_include_once($pathtoclass);
$tmpobjet = new $tabobj($db);
......@@ -964,7 +984,7 @@ elseif (! empty($module))
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="initobject">';
print '<input type="hidden" name="action" value="addproperty">';
print '<input type="hidden" name="tab" value="objects">';
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">';
......@@ -974,11 +994,15 @@ elseif (! empty($module))
print '<td>'.$langs->trans("Property");
print ' (<a href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank">'.$langs->trans("Example").'</a>)';
print '</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>';
print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey"));
print '</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("DefaultValue").'</td>';
print '<td>'.$langs->trans("Index").'</td>';
print '<td class="right">'.$langs->trans("Position").'</td>';
print '<td class="center">'.$langs->trans("NotNull").'</td>';
print '<td class="center">'.$langs->trans("SearchAll").'</td>';
//print '<td>'.$langs->trans("DefaultValue").'</td>';
print '<td class="center">'.$langs->trans("DatabaseIndex").'</td>';
print '<td>'.$langs->trans("Comment").'</td>';
print '<td></td>';
print '</tr>';
......@@ -986,9 +1010,11 @@ elseif (! empty($module))
print '<td><input class="text" name="propname" value=""></td>';
print '<td><input class="text" name="proplabel" value=""></td>';
print '<td><input class="text" name="proptype" value=""></td>';
print '<td><input class="text" name="propposition" value=""></td>';
print '<td><input class="text" name="propdefault" value=""></td>';
print '<td><input class="text" name="propindex" value=""></td>';
print '<td class="right"><input class="text right" size="2" name="propposition" value=""></td>';
print '<td class="center"><input class="text" size="2" name="propnotnull" value=""></td>';
print '<td class="center"><input class="text" size="2" name="propsearchall" value=""></td>';
//print '<td><input class="text" name="propdefault" value=""></td>';
print '<td class="center"><input class="text" size="2" name="propindex" value=""></td>';
print '<td><input class="text" name="propcomment" value=""></td>';
print '<td align="center">';
print '<input class="button" type="submit" name="add" value="'.$langs->trans("Add").'">';
......@@ -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 '<td>';
print $proptype;
print '</td>';
print '<td>';
print '<td align="right">';
print $propposition;
print '</td>';
print '<td>';
print $propdefault;
print '<td class="center">';
print $propnotnull?'X':'';
print '</td>';
print '<td>';
print yn($propindex);
print '<td class="center">';
print $propsearchall?'X':'';
print '</td>';
/*print '<td>';
print $propdefault;
print '</td>';*/
print '<td class="center">';
print $propindex?'X':'';
print '</td>';
print '<td>';
print $propcomment;
......
......@@ -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
......
......@@ -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() {
});
</script>';
$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 '<td class="liste_titre">';
print '</td>';
}
/*if (! empty($arrayfields['u.statut']['checked']))
/*if (! empty($arrayfields['t.statut']['checked']))
{
// Status
print '<td class="liste_titre" align="center">';
......@@ -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 '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
......
......@@ -14,6 +14,9 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
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);
......@@ -13,9 +13,14 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment