forked from Wavyzz/dolibarr
Enhance modulebuilder
This commit is contained in:
@@ -128,17 +128,19 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
$i++;
|
||||
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
|
||||
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
||||
$texttoinsert.= " 'notnull'=>".(empty($val['notnull'])?0:$val['notnull']).",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
if ($val['noteditable']) $texttoinsert.= " 'noteditable'=>'".$val['noteditable']."',";
|
||||
if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||
if ($val['css']) $texttoinsert.= " 'css'=>'".$val['css']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\",";
|
||||
if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',";
|
||||
if ($val['disabled']) $texttoinsert.= " 'disabled'=>'".$val['disabled']."',";
|
||||
if ($val['arrayofkeyval'])
|
||||
{
|
||||
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
||||
@@ -149,8 +151,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
$texttoinsert.="'".$key2."'=>'".$val2."'";
|
||||
$i++;
|
||||
}
|
||||
$texttoinsert.= ")";
|
||||
$texttoinsert.= "),";
|
||||
}
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
|
||||
|
||||
$texttoinsert.= "),\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,3 +129,9 @@ IncludeRefGeneration=The reference of object must be generated automatically
|
||||
IncludeRefGenerationHelp=Check this if you want to include code to manage the generation automatically of the reference
|
||||
IncludeDocGeneration=I want to generate some documents from the object
|
||||
IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record.
|
||||
ShowOnCombobox=Show value into combobox
|
||||
KeyForTooltip=Key for tooltip
|
||||
CSSClass=CSS Class
|
||||
NotEditable=Not editable
|
||||
ForeignKey=Foreign key
|
||||
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php:1 (1 means we add a + button after the combo to create the record)
|
||||
@@ -810,18 +810,23 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
//'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php',
|
||||
);
|
||||
|
||||
if (GETPOST('includerefgeneration', 'int'))
|
||||
if (GETPOST('includerefgeneration', 'aZ09'))
|
||||
{
|
||||
dol_mkdir($destdir.'/core/modules/'.strtolower($module));
|
||||
|
||||
$filetogenerate += array(
|
||||
'core/modules/myobject/mod_myobject_advanced.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php',
|
||||
'core/modules/myobject/mod_myobject_standard.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_standard.php',
|
||||
'core/modules/myobject/modules_myobject.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php',
|
||||
'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php',
|
||||
'core/modules/mymodule/mod_myobject_standard.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_standard.php',
|
||||
'core/modules/mymodule/modules_myobject.php'=>'core/modules/'.strtolower($module).'/modules_'.strtolower($objectname).'.php',
|
||||
);
|
||||
}
|
||||
if (GETPOST('includedocgeneration', 'int'))
|
||||
if (GETPOST('includedocgeneration', 'aZ09'))
|
||||
{
|
||||
dol_mkdir($destdir.'/core/modules/'.strtolower($module));
|
||||
dol_mkdir($destdir.'/core/modules/'.strtolower($module).'/doc');
|
||||
|
||||
$filetogenerate += array(
|
||||
'core/modules/myobject/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($objectname).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
|
||||
'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($module).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -843,8 +848,21 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
}
|
||||
}
|
||||
|
||||
//if (! $error) // If there is error copying 1 file, we still have to make the replacement
|
||||
//{
|
||||
// Edit the class 'class/'.strtolower($objectname).'.class.php'
|
||||
if (GETPOST('includerefgeneration', 'aZ09')) {
|
||||
// Replace 'visible'=>1, 'noteditable'=>0, 'default'=>''
|
||||
$arrayreplacement = array('/\'visible\'=>1,\s*\'noteditable\'=>0,\s*\'default\'=>\'\'/' => "'visible'=>4, 'noteditable'=>1, 'default'=>'(PROV)'");
|
||||
//var_dump($arrayreplacement);exit;
|
||||
//var_dump($destdir.'/class/'.strtolower($objectname).'.class.php');exit;
|
||||
dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1);
|
||||
}
|
||||
|
||||
// Edit the setup file and the card page
|
||||
if (GETPOST('includedocgeneration', 'aZ09')) {
|
||||
// TODO
|
||||
// dolReplaceInFile();
|
||||
}
|
||||
|
||||
// Scan for object class files
|
||||
$listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$');
|
||||
|
||||
@@ -917,15 +935,12 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
|
||||
// Add module descriptor to list of files to replace "MyObject' string with real name of object.
|
||||
$filetogenerate[]='core/modules/mod'.$module.'.class.php';
|
||||
|
||||
// TODO
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Edit PHP files
|
||||
// Edit PHP files to make replacement
|
||||
foreach($filetogenerate as $destfile)
|
||||
{
|
||||
$phpfileval['fullname'] = $destdir.'/'.$destfile;
|
||||
@@ -970,6 +985,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null);
|
||||
$tabobj = $objectname;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1198,14 +1214,15 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
|
||||
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
|
||||
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
|
||||
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
|
||||
'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.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($module).'.class.php',
|
||||
'core/modules/myobject/mod_myobject_advanced.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php',
|
||||
'core/modules/myobject/mod_myobject_standard.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_standard.php',
|
||||
'core/modules/myobject/modules_myobject.php'=>'core/modules/'.strtolower($objectname).'/mod_'.strtolower($objectname).'_advanced.php',
|
||||
'core/modules/myobject/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($objectname).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
|
||||
'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php',
|
||||
'core/modules/mymodule/mod_myobject_standard.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_standard.php',
|
||||
'core/modules/mymodule/modules_myobject.php'=>'core/modules/'.strtolower($module).'/modules_'.strtolower($objectname).'.php',
|
||||
'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>'core/modules/'.strtolower($module).'/doc/doc_generic_'.strtolower($objectname).'_odt.modules.php'
|
||||
);
|
||||
|
||||
$resultko = 0;
|
||||
@@ -2460,7 +2477,7 @@ elseif (! empty($module))
|
||||
|
||||
print load_fiche_titre($langs->trans("ObjectProperties"), '', '');
|
||||
|
||||
|
||||
print '<!-- Table with properties of object -->'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -2470,16 +2487,22 @@ elseif (! empty($module))
|
||||
print '<th>';
|
||||
print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey"));
|
||||
print '</th>';
|
||||
print '<th>'.$langs->trans("Type").'</td>';
|
||||
print '<th>'.$form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelp")).'</th>';
|
||||
print '<th>'.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("NotNull"), $langs->trans("NotNullDesc")).'</th>';
|
||||
print '<th class="center">'.$langs->trans("DefaultValue").'</th>';
|
||||
print '<th class="center">'.$langs->trans("DatabaseIndex").'</th>';
|
||||
print '<th class="center">'.$langs->trans("ForeignKey").'</th>';
|
||||
print '<th class="right">'.$langs->trans("Position").'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).'</th>';
|
||||
print '<th class="center">'.$langs->trans("NotEditable").'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).'</th>';
|
||||
print '<th class="center">'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).'</th>';
|
||||
print '<th class="center">'.$langs->trans("CSSClass").'</th>';
|
||||
print '<th class="center">'.$langs->trans("KeyForTooltip").'</th>';
|
||||
print '<th class="center">'.$langs->trans("ShowOnCombobox").'</th>';
|
||||
//print '<th class="center">'.$langs->trans("Disabled").'</th>';
|
||||
print '<th>'.$langs->trans("Comment").'</th>';
|
||||
print '<th></th>';
|
||||
print '</tr>';
|
||||
@@ -2500,11 +2523,17 @@ elseif (! empty($module))
|
||||
print '<td class="center"><input class="text" size="2" name="propnotnull" value="'.dol_escape_htmltag(GETPOST('propnotnull', 'alpha')).'"></td>';
|
||||
print '<td><input class="text maxwidth50" name="propdefault" value="'.dol_escape_htmltag(GETPOST('propdefault', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propindex" value="'.dol_escape_htmltag(GETPOST('propindex', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propforeignkey" value="'.dol_escape_htmltag(GETPOST('propforeignkey', 'alpha')).'"></td>';
|
||||
print '<td class="right"><input class="text right" size="2" name="propposition" value="'.dol_escape_htmltag(GETPOST('propposition', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propnoteditable" value="'.dol_escape_htmltag(GETPOST('propnoteditable', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propcss" value="'.dol_escape_htmltag(GETPOST('propcss', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="prophelp" value="'.dol_escape_htmltag(GETPOST('prophelp', 'alpha')).'"></td>';
|
||||
print '<td class="center"><input class="text" size="2" name="propshowoncombobox" value="'.dol_escape_htmltag(GETPOST('propshowoncombobox', 'alpha')).'"></td>';
|
||||
//print '<td class="center"><input class="text" size="2" name="propdisabled" value="'.dol_escape_htmltag(GETPOST('propdisabled', 'alpha')).'"></td>';
|
||||
print '<td><input class="text maxwidth100" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment', 'alpha')).'"></td>';
|
||||
print '<td class="center">';
|
||||
print '<input class="button" type="submit" name="add" value="'.$langs->trans("Add").'">';
|
||||
@@ -2531,13 +2560,19 @@ elseif (! empty($module))
|
||||
$proptype=$propval['type'];
|
||||
$proparrayofkeyval=$propval['arrayofkeyval'];
|
||||
$propnotnull=$propval['notnull'];
|
||||
$propsearchall=$propval['searchall'];
|
||||
$propdefault=$propval['default'];
|
||||
$propindex=$propval['index'];
|
||||
$propforeignkey=$propval['foreignkey'];
|
||||
$propposition=$propval['position'];
|
||||
$propenabled=$propval['enabled'];
|
||||
$propvisible=$propval['visible'];
|
||||
$propnoteditable=$propval['noteditable'];
|
||||
$propsearchall=$propval['searchall'];
|
||||
$propisameasure=$propval['isameasure'];
|
||||
$propcss=$propval['css'];
|
||||
$prophelp=$propval['help'];
|
||||
$propshowoncombobox=$propval['showoncombobox'];
|
||||
//$propdisabled=$propval['disabled'];
|
||||
$propcomment=$propval['comment'];
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@@ -2548,7 +2583,7 @@ elseif (! empty($module))
|
||||
print '<td>';
|
||||
print $proplabel;
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="wordbreak">';
|
||||
print $proptype;
|
||||
print '</td>';
|
||||
print '<td class="wordbreak">';
|
||||
@@ -2565,6 +2600,9 @@ elseif (! empty($module))
|
||||
print '<td class="center">';
|
||||
print $propindex?'1':'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propforeignkey?$propforeignkey:'';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print $propposition;
|
||||
print '</td>';
|
||||
@@ -2575,16 +2613,34 @@ elseif (! empty($module))
|
||||
print $propvisible?$propvisible:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propisameasure?$propisameasure:'';
|
||||
print $propnoteditable?$propnoteditable:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propsearchall?'1':'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propisameasure?$propisameasure:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propcss?$propcss:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $prophelp?$prophelp:'';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $propshowoncombobox?$propshowoncombobox:'';
|
||||
print '</td>';
|
||||
/*print '<td class="center">';
|
||||
print $propdisabled?$propdisabled:'';
|
||||
print '</td>';*/
|
||||
print '<td>';
|
||||
print $propcomment;
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&propertykey='.urlencode($propname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
|
||||
if ($propname != 'rowid')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&propertykey='.urlencode($propname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@@ -68,21 +68,21 @@ class MyObject extends CommonObject
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'position' is the sort order of field.
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||
* '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_...).
|
||||
* 'position' is the sort order of field.
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
@@ -91,13 +91,13 @@ class MyObject extends CommonObject
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'notnull'=> 1, 'default'=>'(PROV)', 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
|
||||
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
||||
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
|
||||
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1),
|
||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60),
|
||||
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/* Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE -->\n";
|
||||
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("mymodule");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass='oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("MyObject"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
|
||||
<td class="right"><?php echo ''; ?></td>
|
||||
<td class="right"><?php echo $objectlink->getLibStatut(7); ?></td>
|
||||
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
print "<!-- END PHP TEMPLATE -->\n";
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file core/tpl/mytemplate.tpl.php
|
||||
* \ingroup mymodule
|
||||
* \brief Example template.
|
||||
*
|
||||
* Put detailed description here.
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/** Your code here. */
|
||||
echo "Hello world!";
|
||||
Reference in New Issue
Block a user