Debug modulebuilder

This commit is contained in:
Laurent Destailleur 2018-11-05 18:10:38 +01:00
parent c0f4ec5a3e
commit 763f3cd518
5 changed files with 9 additions and 15 deletions

View File

@ -6816,21 +6816,15 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id
function verifCond($strRights)
{
global $user,$conf,$langs;
global $action,$leftmenu;
global $leftmenu;
global $rights; // To export to dol_eval function
//print $strRights."<br>\n";
$rights = true;
if ($strRights != '')
{
$action = preg_replace('/[a-zA-Z0-9_')
//$tab_rights = explode('&&', $strRights);
//$i = 0;
//while (($i < count($tab_rights)) && ($rights == true)) {
$str = 'if(!(' . $strRights . ')) { $rights = false; }';
dol_eval($str);
// $i++;
//}
dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition
}
return $rights;
}
@ -6847,8 +6841,8 @@ function verifCond($strRights)
function dol_eval($s, $returnvalue=0, $hideerrors=1)
{
// Only global variables can be changed by eval function and returned to caller
global $db, $langs, $user, $conf;
global $mainmenu, $leftmenu;
global $db, $langs, $user, $conf, $website, $websitepage;
global $action, $mainmenu, $leftmenu;
global $rights;
global $object;
global $mysoc;

View File

@ -41,7 +41,7 @@ foreach($object->fields as $key => $val)
if (abs($val['visible']) != 1) continue;
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field
var_dump($val['enabled']);
print '<tr id="field_'.$key.'">';
print '<td';
print ' class="titlefieldcreate';

View File

@ -40,7 +40,7 @@ foreach($object->fields as $key => $val)
// Discard if extrafield is a hidden field on form
if (abs($val['visible']) != 1) continue;
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field
print '<tr><td';
print ' class="titlefieldcreate';

View File

@ -42,7 +42,7 @@ foreach($object->fields as $key => $val)
// Discard if extrafield is a hidden field on form
if (abs($val['visible']) != 1) continue;
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field
if (in_array($key, array('ref','status'))) continue; // Ref and status are already in dol_banner
$value=$object->$key;

View File

@ -89,8 +89,8 @@ class EmailCollector extends CommonObject
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
//'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'comment'=>"Where to store messages once processed"),
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastResult', 'visible'=>1, 'enabled'=>'$action != "create"', 'position'=>121, 'notnull'=>-1,),
'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create"', 'position'=>122, 'notnull'=>-1,),
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1,),
'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),