2
0
forked from Wavyzz/dolibarr

Debug ModuleBuilder

This commit is contained in:
Laurent Destailleur
2022-03-11 10:55:28 +01:00
parent 6100bc86f8
commit f2d5221784
8 changed files with 104 additions and 41 deletions

View File

@@ -101,23 +101,35 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->mymodule->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write;
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
$permissionnote = 1;
}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
if (empty($conf->mymodule->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*
* Actions
*/
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
@@ -141,7 +153,7 @@ if ($id > 0 || !empty($ref)) {
$head = myobjectPrepareHead($object);
print dol_get_fiche_head($head, 'note', '', -1, $object->picto);
print dol_get_fiche_head($head, 'note', $langs->trans("MyObject"), -1, $object->picto);
// Object card
// ------------------------------------------------------------