forked from Wavyzz/dolibarr
Debug modulebuilder
This commit is contained in:
@@ -314,7 +314,7 @@ class FormFile
|
||||
|
||||
if (preg_match('/massfilesarea_/', $modulepart))
|
||||
{
|
||||
$out.='<div id="show_files"><br></div>';
|
||||
$out.='<div id="show_files"><br></div>'."\n";
|
||||
$title=$langs->trans("MassFilesArea").' <a href="" id="togglemassfilesarea" ref="shown">('.$langs->trans("Hide").')</a>';
|
||||
$title.='<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
@@ -788,14 +788,14 @@ class FormFile
|
||||
$out.=dol_print_date($file->datea,'dayhour');
|
||||
$out.='</td>';
|
||||
if ($delallowed || $printer || $morepicto) $out.='<td></td>';
|
||||
$out.='</tr>';
|
||||
$out.='</tr>'."\n";
|
||||
}
|
||||
$this->numoffiles++;
|
||||
}
|
||||
|
||||
if (count($file_list) == 0 && count($link_list) == 0 && $headershown)
|
||||
{
|
||||
$out.='<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
$out.='<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>'."\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save data into a memory area shared by all users, all sessions on server
|
||||
*
|
||||
@@ -31,22 +33,126 @@
|
||||
* @param string $newmask New mask
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function rebuildobjectsql($destdir, $module, $objectname, $newmask)
|
||||
function rebuildObjectClass($destdir, $module, $objectname, $newmask)
|
||||
{
|
||||
global $db;
|
||||
global $db, $langs;
|
||||
|
||||
if (empty($objectname)) return -1;
|
||||
|
||||
$pathoffiletoeditsrc=$destdir.'/class/'.strtolower($objectname).'.class.php';
|
||||
$pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php';
|
||||
if (! dol_is_file($pathoffiletoeditsrc))
|
||||
{
|
||||
//$pathoffiletoeditsrc=DOL_DOCUMENT_ROOT.'/modulebuilder/template/class/myobject.class.php';
|
||||
setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
|
||||
return -1;
|
||||
}
|
||||
|
||||
//$pathoffiletoedittmp=$destdir.'/class/'.strtolower($objectname).'.class.php.tmp';
|
||||
//dol_delete_file($pathoffiletoedittmp, 0, 1, 1);
|
||||
|
||||
try
|
||||
{
|
||||
include_once $pathoffiletoeditsrc;
|
||||
if (class_exists($objectname)) $object=new $objectname($db);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
print $e->getMessage();
|
||||
}
|
||||
|
||||
// Edit class files
|
||||
|
||||
$contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
|
||||
|
||||
$i=0;
|
||||
$texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
|
||||
$texttoinsert.= "\t".'/**'."\n";
|
||||
$texttoinsert.= "\t".' * @var array Array with all fields and their property'."\n";
|
||||
$texttoinsert.= "\t".' */'."\n";
|
||||
$texttoinsert.= "\t".'public $fields=array('."\n";
|
||||
|
||||
if (count($object->fields))
|
||||
{
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
$typephp='';
|
||||
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||
if ($val['position']) $texttoinsert.= " 'position'=>".$val['position'].",";
|
||||
if ($val['notnull']) $texttoinsert.= " 'notnull'=>".$val['notnull'].",";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',";
|
||||
$texttoinsert.= "),\n";
|
||||
}
|
||||
}
|
||||
$texttoinsert.= "\t".');'."\n";
|
||||
|
||||
$texttoinsert.= "\n";
|
||||
|
||||
if (count($object->fields))
|
||||
{
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
$typephp='';
|
||||
$texttoinsert.= "\t".'public $'.$key.$typephp.";";
|
||||
//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 PROPERTIES';
|
||||
|
||||
$contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass);
|
||||
|
||||
//file_put_contents($pathoffiletoedittmp, $contentclass);
|
||||
file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass);
|
||||
@chmod($pathoffiletoedit, octdec($newmask));
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, $langs;
|
||||
|
||||
if (empty($objectname)) return -1;
|
||||
|
||||
try
|
||||
{
|
||||
dol_include_once(strtolower($module).'/class/'.strtolower($objectname).'.class.php');
|
||||
$object=new $objectname($db);
|
||||
if (class_exists($objectname)) $object=new $objectname($db);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
print $e->getMessage();
|
||||
}
|
||||
|
||||
// Edit sql files
|
||||
$pathoffiletoedit=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.sql');
|
||||
// Edit .sql file
|
||||
$pathoffiletoeditsrc=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.sql');
|
||||
$pathoffiletoedittarget=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.sql');
|
||||
|
||||
$contentsql = file_get_contents($pathoffiletoedit, 'r');
|
||||
$contentsql = file_get_contents($pathoffiletoeditsrc, 'r');
|
||||
|
||||
$i=0;
|
||||
$texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n";
|
||||
if (count($object->fields))
|
||||
{
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
@@ -57,22 +163,25 @@ function rebuildobjectsql($destdir, $module, $objectname, $newmask)
|
||||
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);
|
||||
file_put_contents($pathoffiletoedittarget, $contentsql);
|
||||
@chmod($pathoffiletoedit, octdec($newmask));
|
||||
|
||||
|
||||
// Edit .key.sql file
|
||||
$pathoffiletoeditsrc=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.key.sql');
|
||||
$pathoffiletoedittarget=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.key.sql');
|
||||
|
||||
// Edit sql files
|
||||
$pathoffiletoedit=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.key.sql');
|
||||
|
||||
$contentsql = file_get_contents($pathoffiletoedit, 'r');
|
||||
$contentsql = file_get_contents($pathoffiletoeditsrc, 'r');
|
||||
|
||||
$i=0;
|
||||
$texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n";
|
||||
if (count($object->fields))
|
||||
{
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
@@ -82,12 +191,15 @@ function rebuildobjectsql($destdir, $module, $objectname, $newmask)
|
||||
$texttoinsert.= "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$texttoinsert.= '-- END MODULEBUILDER INDEXES';
|
||||
|
||||
$contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql);
|
||||
|
||||
file_put_contents($pathoffiletoedit, $contentsql);
|
||||
file_put_contents($pathoffiletoedittarget, $contentsql);
|
||||
@chmod($pathoffiletoedit, octdec($newmask));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ ModuleKey=Module key
|
||||
ObjectKey=Object key
|
||||
ModuleInitialized=Module initialized
|
||||
FilesForObjectInitialized=Files for new object '%s' initialized
|
||||
FilesForObjectUpdated=Files for object '%s' updated
|
||||
FilesForObjectUpdated=Files for object '%s' updated (.sql files and .class.php file)
|
||||
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.
|
||||
|
||||
@@ -231,12 +231,11 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Edit sql with new properties
|
||||
rebuildobjectsql($destdir, $module, $objectname, $newmask);
|
||||
|
||||
// Edit the class file to write properties
|
||||
rebuildObjectClass($destdir, $module, $objectname, $newmask);
|
||||
|
||||
|
||||
// Edit sql with new properties
|
||||
rebuildObjectSql($destdir, $module, $objectname, $newmask);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@@ -251,8 +250,13 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj))
|
||||
|
||||
$destdir = $dirins.'/'.strtolower($module);
|
||||
|
||||
// TODO Complete list of fields with new one
|
||||
|
||||
// Edit the class file to write properties
|
||||
rebuildObjectClass($destdir, $module, $objectname, $newmask);
|
||||
|
||||
// Edit sql with new properties
|
||||
rebuildobjectsql($destdir, $module, $objectname, $newmask);
|
||||
rebuildObjectSql($destdir, $module, $objectname, $newmask);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@@ -973,7 +977,7 @@ elseif (! empty($module))
|
||||
print '<br><br><br>';
|
||||
|
||||
$result = dol_include_once($pathtoclass);
|
||||
$tmpobjet = new $tabobj($db);
|
||||
if (class_exists($tabobj)) $tmpobjet = new $tabobj($db);
|
||||
|
||||
$reflector = new ReflectionClass($tabobj);
|
||||
$properties = $reflector->getProperties(); // Can also use get_object_vars
|
||||
|
||||
@@ -58,7 +58,7 @@ class MyObject extends CommonObject
|
||||
public $picto = 'myobject';
|
||||
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES - Do not remove this comment
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ class MyObject extends CommonObject
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'notnull'=>true, 'position'=>500),
|
||||
'status'=>array('type'=>'integer', 'label'=>'Status', 'index'=>true, 'position'=>1000),
|
||||
);
|
||||
// Do not remove this comment - END MODULEBUILDER PROPERTIES
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$object=new MyObject($db);
|
||||
$diroutputmassaction=$conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
// 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.
|
||||
@@ -106,8 +107,7 @@ foreach($object->fields as $key => $val)
|
||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||
$hookmanager->initHooks(array('myobjectlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
// Fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('myobject');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
@@ -182,31 +182,17 @@ if (empty($reshook))
|
||||
* Put here all code to build page
|
||||
*/
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||
$now=dol_now();
|
||||
|
||||
//$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
|
||||
$help_url='';
|
||||
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("MyObjects"));
|
||||
|
||||
// Put here content of your page
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
@@ -275,15 +261,36 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_field1 != '') $param.= '&search_field1='.urlencode($search_field1);
|
||||
if ($search_field2 != '') $param.= '&search_field2='.urlencode($search_field2);
|
||||
foreach($search as $key => $val)
|
||||
{
|
||||
$param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
@@ -345,10 +352,16 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
||||
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
// LIST_OF_TD_TITLE_SEARCH
|
||||
//if (! empty($arrayfields['t.field1']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_field1" value="'.$search_field1.'" size="10"></td>';
|
||||
//if (! empty($arrayfields['t.field2']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_field2" value="'.$search_field2.'" size="10"></td>';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('datec','tms','status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@@ -376,25 +389,15 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['t.datec']['checked']))
|
||||
// Rest of fields search
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
// Date creation
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
if (! in_array($key, array('datec','tms','status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
// Date modification
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
/*if (! empty($arrayfields['t.statut']['checked']))
|
||||
{
|
||||
// Status
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut);
|
||||
print '</td>';
|
||||
}*/
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@@ -402,11 +405,18 @@ print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Fields title
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
// LIST_OF_TD_TITLE_FIELDS
|
||||
//if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||
//if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (in_array($key, array('datec','tms','status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@@ -417,7 +427,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$sortonfield = "ef.".$key;
|
||||
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
||||
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -425,10 +435,16 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
// Rest of fields title
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (! in_array($key, array('datec','tms','status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
|
||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||
}
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
@@ -440,6 +456,8 @@ foreach ($extrafields->attribute_computed as $key => $val)
|
||||
}
|
||||
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
@@ -449,18 +467,22 @@ while ($i < min($num, $limit))
|
||||
{
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
// LIST_OF_TD_FIELDS_LIST
|
||||
/*
|
||||
if (! empty($arrayfields['t.field1']['checked']))
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
print '<td>'.$obj->field1.'</td>';
|
||||
if (in_array($key, array('datec','tms','status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td'.($align?' class="'.$align.'"':'').'>';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
|
||||
elseif ($key == 'status') print '<td align="center">'.$object->getLibStatut(3).'</td>';
|
||||
else print $obj->$key;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['t.field2']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->field2.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}*/
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@@ -483,30 +505,23 @@ while ($i < min($num, $limit))
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['t.datec']['checked']))
|
||||
// Rest of fields
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
if (! in_array($key, array('datec','tms','status'))) continue;
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td'.($align?' class="'.$align.'"':'').'>';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
|
||||
elseif ($key == 'status') print '<td align="center">'.$object->getLibStatut(3).'</td>';
|
||||
else print $obj->$key;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
/*
|
||||
if (! empty($arrayfields['t.statut']['checked']))
|
||||
{
|
||||
$userstatic->statut=$obj->statut;
|
||||
print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
|
||||
}*/
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
@@ -567,13 +582,16 @@ print '</form>'."\n";
|
||||
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
// Show list of available documents
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->facture->lire;
|
||||
$delallowed=$user->rights->facture->lire;
|
||||
$genallowed=$user->rights->mymodule->read;
|
||||
$delallowed=$user->rights->mymodule->read;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user