Generate table for extrafields

This commit is contained in:
Laurent Destailleur 2017-07-22 20:12:00 +02:00
parent 9e6666e511
commit 2a133f4a3f
3 changed files with 37 additions and 5 deletions

View File

@ -51,6 +51,7 @@ WidgetFile=Widget file
ReadmeFile=Readme file
ChangeLog=ChangeLog file
SqlFile=Sql file
SqlFileExtraFields=Sql file for complementary attributes
SqlFileKey=Sql file for keys
AnObjectAlreadyExistWithThisNameAndDiffCase=An object already exists with this name and a different case
UseAsciiDocFormat=You can use Markdown format, but it is recommanded to use Asciidoc format (Comparison between .md and .asciidoc: http://asciidoctor.org/docs/user-manual/#compared-to-markdown)

View File

@ -110,8 +110,9 @@ if ($dirins && $action == 'initmodule' && $modulename)
dol_delete_file($destdir.'/myobject_card.php');
dol_delete_file($destdir.'/myobject_list.php');
dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php');
dol_delete_file($destdir.'/sql/llx_myobject.key.sql');
dol_delete_file($destdir.'/sql/llx_myobject.sql');
dol_delete_file($destdir.'/sql/llx_myobject_extrafields.sql');
dol_delete_file($destdir.'/sql/llx_myobject.key.sql');
dol_delete_file($destdir.'/scripts/myobject.php');
dol_delete_file($destdir.'/img/object_myobject.png');
dol_delete_file($destdir.'/class/myobject.class.php');
@ -189,9 +190,10 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
'myobject_card.php'=>strtolower($objectname).'_card.php',
'myobject_list.php'=>strtolower($objectname).'_list.php',
'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php',
'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql',
'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql',
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql',
'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql',
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php',
@ -377,9 +379,10 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
'myobject_card.php'=>strtolower($objectname).'_card.php',
'myobject_list.php'=>strtolower($objectname).'_list.php',
'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php',
'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql',
'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql',
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql',
'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.key.sql',
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php',
@ -423,6 +426,7 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey)
// File of sql
$fileforsql = $dirins.'/'.$modulelowercase.'/sql/'.$objectlowercase.'.sql';
$fileforsqlextra = $dirins.'/'.$modulelowercase.'/sql/'.$objectlowercase.'_extrafields.sql';
$fileforsqlkey = $dirins.'/'.$modulelowercase.'/sql/'.$objectlowercase.'.key.sql';
@ -1179,6 +1183,7 @@ elseif (! empty($module))
$pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php';
$pathtocard = strtolower($module).'/'.strtolower($tabobj).'_card.php';
$pathtosql = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.sql';
$pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($tabobj).'_extrafields.sql';
$pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.key.sql';
print '<div class="fichehalfleft">';
print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.$pathtoclass.'</strong>';
@ -1190,6 +1195,9 @@ elseif (! empty($module))
print '<span class="fa fa-file"></span> '.$langs->trans("SqlFile").' : <strong>'.$pathtosql.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.$pathtosqlextra.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileKey").' : <strong>'.$pathtosqlkey.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '</div>';

View File

@ -0,0 +1,23 @@
-- Copyright (C) ---Put here your own copyright and developer email---
--
-- 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/>.
create table llx_myobject_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;