Clean code

This commit is contained in:
Laurent Destailleur 2021-03-15 00:01:55 +01:00
parent 4ca0942229
commit 1d2929e3f5
11 changed files with 15 additions and 14 deletions

View File

@ -62,7 +62,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->workflow->enabled)) { if (empty($conf->workflow) || empty($conf->workflow->enabled)) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }

View File

@ -75,7 +75,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->agenda->enabled)) { if (empty($conf->agenda) || empty($conf->agenda->enabled)) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }

View File

@ -59,7 +59,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->blockedlog->enabled)) { if (empty($conf->blockedlog) || empty($conf->blockedlog->enabled)) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }

View File

@ -71,7 +71,7 @@ class InterfaceEventOrganization extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->eventorganization->enabled)) { if (empty($conf->eventorganization) || empty($conf->eventorganization->enabled)) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }

View File

@ -61,7 +61,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->ldap->enabled)) { if (empty($conf->ldap) || empty($conf->ldap->enabled)) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }
if (defined('DISABLE_LDAP_SYNCHRO')) { if (defined('DISABLE_LDAP_SYNCHRO')) {

View File

@ -59,7 +59,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->mailmanspip->enabled)) { if (empty($conf->mailmanspip) || empty($conf->mailmanspip->enabled)) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }

View File

@ -80,7 +80,7 @@ class InterfaceNotification extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->notification->enabled)) { if (empty($conf->notification) || empty($conf->notification->enabled)) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }

View File

@ -61,7 +61,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
{ {
$ok = 0; $ok = 0;
if (empty($conf->ticket->enabled)) { if (empty($conf->ticket) || empty($conf->ticket->enabled)) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }

View File

@ -69,13 +69,13 @@ class InterfaceStripe extends DolibarrTriggers
// Data and type of action are stored into $object and $action // Data and type of action are stored into $object and $action
global $langs, $db, $conf; global $langs, $db, $conf;
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; if (empty($conf->stripe) || empty($conf->stripe->enabled)) {
$stripe = new Stripe($db);
if (empty($conf->stripe->enabled)) {
return 0; return 0;
} }
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
$stripe = new Stripe($db);
$ok = 1; $ok = 1;
$service = 'StripeTest'; $service = 'StripeTest';

View File

@ -70,10 +70,11 @@ class InterfaceZapierTriggers extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->zapier->enabled)) { if (empty($conf->zapier) || empty($conf->zapier->enabled)) {
// Module not active, we do nothing // Module not active, we do nothing
return 0; return 0;
} }
$logtriggeraction = false; $logtriggeraction = false;
$sql = ''; $sql = '';
if ($action != '') { if ($action != '') {

View File

@ -92,7 +92,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
*/ */
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
if (empty($conf->mymodule->enabled)) { if (empty($conf->mymodule) || empty($conf->mymodule->enabled)) {
return 0; // If module is not enabled, we do nothing return 0; // If module is not enabled, we do nothing
} }