mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-22 09:21:30 +01:00
Fix template to use v19 dev rules
This commit is contained in:
@@ -603,8 +603,8 @@ class MyObject extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','write'))
|
/* if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule', 'myobject', 'write'))
|
||||||
|| (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->mymodule->myobject->myobject_advance->validate))))
|
|| (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule', 'myobject_advance', 'validate')))
|
||||||
{
|
{
|
||||||
$this->error='NotEnoughPermissions';
|
$this->error='NotEnoughPermissions';
|
||||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||||
|
|||||||
@@ -177,8 +177,8 @@ class modMyModule extends DolibarrModules
|
|||||||
// Array to add new pages in new tabs
|
// Array to add new pages in new tabs
|
||||||
$this->tabs = array();
|
$this->tabs = array();
|
||||||
// Example:
|
// Example:
|
||||||
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
|
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mymodule:$user->hasRight('mymodule', 'read'):/mymodule/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
|
||||||
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
|
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->hasRight('othermodule', 'read'):/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
|
||||||
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
|
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
|
||||||
//
|
//
|
||||||
// Where objecttype can be
|
// Where objecttype can be
|
||||||
@@ -290,7 +290,7 @@ class modMyModule extends DolibarrModules
|
|||||||
$this->rights[$r][0] = $this->numero . sprintf("%02d", ($o * 10) + 3); // Permission id (must not be already used)
|
$this->rights[$r][0] = $this->numero . sprintf("%02d", ($o * 10) + 3); // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label
|
$this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label
|
||||||
$this->rights[$r][4] = 'myobject';
|
$this->rights[$r][4] = 'myobject';
|
||||||
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->myobject->delete)
|
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->hasRight('mymodule', 'myobject', 'delete'))
|
||||||
$r++;
|
$r++;
|
||||||
*/
|
*/
|
||||||
/* END MODULEBUILDER PERMISSIONS */
|
/* END MODULEBUILDER PERMISSIONS */
|
||||||
|
|||||||
@@ -111,19 +111,16 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
|||||||
|
|
||||||
/* BEGIN MODULEBUILDER DRAFT MYOBJECT
|
/* BEGIN MODULEBUILDER DRAFT MYOBJECT
|
||||||
// Draft MyObject
|
// Draft MyObject
|
||||||
if (isModEnabled('mymodule') && $user->rights->mymodule->read)
|
if (isModEnabled('mymodule') && $user->hasRight('mymodule', 'read')) {
|
||||||
{
|
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
|
|
||||||
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||||
$sql.= ", s.code_client";
|
$sql.= ", s.code_client";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
||||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||||
$sql.= " AND c.fk_statut = 0";
|
$sql.= " AND c.fk_statut = 0";
|
||||||
$sql.= " AND c.entity IN (".getEntity('commande').")";
|
$sql.= " AND c.entity IN (".getEntity('commande').")";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
||||||
if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
|
if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@@ -192,13 +189,10 @@ $max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
|
|||||||
|
|
||||||
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
|
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
|
||||||
// Last modified myobject
|
// Last modified myobject
|
||||||
if (isModEnabled('mymodule') && $user->rights->mymodule->read)
|
if (isModEnabled('mymodule') && $user->hasRight('mymodule', 'read')) {
|
||||||
{
|
|
||||||
$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
|
$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject as s";
|
||||||
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
||||||
$sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
|
$sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
|
||||||
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
||||||
//if ($socid) $sql.= " AND s.rowid = $socid";
|
//if ($socid) $sql.= " AND s.rowid = $socid";
|
||||||
$sql .= " ORDER BY s.tms DESC";
|
$sql .= " ORDER BY s.tms DESC";
|
||||||
$sql .= $db->plimit($max, 0);
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||||
$enablepermissioncheck = 0;
|
$enablepermissioncheck = 0;
|
||||||
if ($enablepermissioncheck) {
|
if ($enablepermissioncheck) {
|
||||||
$permissiontoread = $user->rights->mymodule->myobject->read;
|
$permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
|
||||||
$permissiontoadd = $user->rights->mymodule->myobject->write;
|
$permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write');
|
||||||
} else {
|
} else {
|
||||||
$permissiontoread = 1;
|
$permissiontoread = 1;
|
||||||
$permissiontoadd = 1;
|
$permissiontoadd = 1;
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
|
|||||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||||
$enablepermissioncheck = 0;
|
$enablepermissioncheck = 0;
|
||||||
if ($enablepermissioncheck) {
|
if ($enablepermissioncheck) {
|
||||||
$permissiontoread = $user->rights->mymodule->myobject->read;
|
$permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
|
||||||
$permissiontoadd = $user->rights->mymodule->myobject->write;
|
$permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write');
|
||||||
} else {
|
} else {
|
||||||
$permissiontoread = 1;
|
$permissiontoread = 1;
|
||||||
$permissiontoadd = 1;
|
$permissiontoadd = 1;
|
||||||
|
|||||||
@@ -130,8 +130,8 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||||
$enablepermissioncheck = 0;
|
$enablepermissioncheck = 0;
|
||||||
if ($enablepermissioncheck) {
|
if ($enablepermissioncheck) {
|
||||||
$permissiontoread = $user->rights->mymodule->myobject->read;
|
$permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
|
||||||
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
$permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
|
||||||
} else {
|
} else {
|
||||||
$permissiontoread = 1;
|
$permissiontoread = 1;
|
||||||
$permissiontoadd = 1;
|
$permissiontoadd = 1;
|
||||||
@@ -251,9 +251,9 @@ print '</div>';
|
|||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
$modulepart = 'mymodule';
|
$modulepart = 'mymodule';
|
||||||
//$permissiontoadd = $user->rights->mymodule->myobject->write;
|
//$permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write');
|
||||||
$permissiontoadd = 1;
|
$permissiontoadd = 1;
|
||||||
//$permtoedit = $user->rights->mymodule->myobject->write;
|
//$permtoedit = $user->hasRight('mymodule', 'myobject', 'write');
|
||||||
$permtoedit = 1;
|
$permtoedit = 1;
|
||||||
$param = '&id='.$object->id;
|
$param = '&id='.$object->id;
|
||||||
|
|
||||||
|
|||||||
@@ -108,9 +108,9 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
|
||||||
$enablepermissioncheck = 0;
|
$enablepermissioncheck = 0;
|
||||||
if ($enablepermissioncheck) {
|
if ($enablepermissioncheck) {
|
||||||
$permissiontoread = $user->rights->mymodule->myobject->read;
|
$permissiontoread = $user->hasRight('mymodule', 'myobject', 'read');
|
||||||
$permissiontoadd = $user->rights->mymodule->myobject->write;
|
$permissiontoadd = $user->hasRight('mymodule', 'myobject', 'write');
|
||||||
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
|
$permissionnote = $user->hasRight('mymodule', 'myobject', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||||
} else {
|
} else {
|
||||||
$permissiontoread = 1;
|
$permissiontoread = 1;
|
||||||
$permissiontoadd = 1;
|
$permissiontoadd = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user