Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated compat of PHP modules #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion class/actions_fraisdeport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function getCmdWeight($object)

$poidscmd = 0;
/*
if(!$conf->shippableorder->enabled)
if(!isModEnabled('shippableorder'))
{*/
if(!defined('INC_FROM_DOLIBARR')) define('INC_FROM_DOLIBARR',true);
dol_include_once('/fraisdeport/config.php');
Expand Down
28 changes: 14 additions & 14 deletions core/modules/modFraisdeport.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public function __construct($db)
// Example:
$this->tabs = array(
// // To add a new tab identified by code tabname1
// 'objecttype:+tabname1:Title1:langfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__',
// 'objecttype:+tabname1:Title1:langfile@mymodule:$user->hasRight('mymodule', 'read'):/mymodule/mynewtab1.php?id=__ID__',
// // To add another new tab identified by code tabname2
// 'objecttype:+tabname2:Title2:langfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__',
// 'objecttype:+tabname2:Title2:langfile@mymodule:$user->hasRight('othermodule', 'read'):/mymodule/mynewtab2.php?id=__ID__',
// // To remove an existing tab identified by code tabname
// 'objecttype:-tabname'
);
Expand All @@ -157,7 +157,7 @@ public function __construct($db)
// 'categories_x' to add a tab in category view
// (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
// Dictionnaries
if (! isset($conf->fraisdeport->enabled)) {
if (! isModEnabled('fraisdeport')) {
$conf->fraisdeport=new stdClass();
$conf->fraisdeport->enabled = 0;
}
Expand Down Expand Up @@ -190,10 +190,10 @@ public function __construct($db)
//// Permission by default for new user (0/1)
//$this->rights[$r][3] = 1;
//// In php code, permission will be checked by test
//// if ($user->rights->permkey->level1->level2)
//// if ($user->hasRight('permkey', 'level1', 'level2'))
//$this->rights[$r][4] = 'level1';
//// In php code, permission will be checked by test
//// if ($user->rights->permkey->level1->level2)
//// if ($user->hasRight('permkey', 'level1', 'level2'))
//$this->rights[$r][5] = 'level2';
//$r++;
// Main menu entries
Expand All @@ -217,9 +217,9 @@ public function __construct($db)
// 'langs'=>'mylangfile',
// 'position'=>100,
// // Define condition to show or hide menu entry.
// // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
// 'enabled'=>'$conf->mymodule->enabled',
// // Use 'perms'=>'$user->rights->mymodule->level1->level2'
// // Use 'isModEnabled('mymodule')' if entry must be visible if module is enabled.
// 'enabled'=>'isModEnabled('mymodule')',
// // Use 'perms'=>'$user->hasRight('mymodule', 'level1', 'level2')'
// // if you want your menu with a permission rules
// 'perms'=>'1',
// 'target'=>'',
Expand All @@ -242,9 +242,9 @@ public function __construct($db)
// 'langs'=>'mylangfile',
// 'position'=>100,
// // Define condition to show or hide menu entry.
// // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
// 'enabled'=>'$conf->mymodule->enabled',
// // Use 'perms'=>'$user->rights->mymodule->level1->level2'
// // Use 'isModEnabled('mymodule')' if entry must be visible if module is enabled.
// 'enabled'=>'isModEnabled('mymodule')',
// // Use 'perms'=>'$user->hasRight('mymodule', 'level1', 'level2')'
// // if you want your menu with a permission rules
// 'perms'=>'1',
// 'target'=>'',
Expand All @@ -268,10 +268,10 @@ public function __construct($db)
// 'langs'=>'mylangfile',
// 'position'=>100,
// // Define condition to show or hide menu entry.
// // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
// // Use 'isModEnabled('mymodule')' if entry must be visible if module is enabled.
// // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
// 'enabled'=>'$conf->mymodule->enabled',
// // Use 'perms'=>'$user->rights->mymodule->level1->level2'
// 'enabled'=>'isModEnabled('mymodule')',
// // Use 'perms'=>'$user->hasRight('mymodule', 'level1', 'level2')'
// // if you want your menu with a permission rules
// 'perms'=>'1',
// 'target'=>'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action
// Users
if (($action == 'ORDER_VALIDATE' || $action == 'PROPAL_VALIDATE') && !empty($conf->fraisdeport) && $conf->fraisdeport->enabled) {
if (($action == 'ORDER_VALIDATE' || $action == 'PROPAL_VALIDATE') && !empty($conf->fraisdeport) && isModEnabled('fraisdeport')) {

global $db,$conf;

Expand Down