Merge pull request #22406 from aspangaro/17p6

Use isModEnabled
This commit is contained in:
Laurent Destailleur 2022-10-04 18:01:59 +02:00 committed by GitHub
commit 395312737b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 185 additions and 185 deletions

View File

@ -445,7 +445,7 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled)) {
|| isModEnabled('mrp')) {
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}

View File

@ -227,13 +227,13 @@ if (empty($reshook)) {
$substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid;
$onlinepaymentenabled = 0;
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$onlinepaymentenabled++;
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
$onlinepaymentenabled++;
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$onlinepaymentenabled++;
}
if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
@ -263,7 +263,7 @@ if (empty($reshook)) {
$substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = '<a target="_blank" rel="noopener noreferrer" href="'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : '').'">'.$langs->trans('BlankSubscriptionForm'). '</a>';
}
/* For backward compatibility, deprecated */
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) {
if (isModEnabled('paypal') && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) {
$substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) {

View File

@ -61,10 +61,10 @@ if (isModEnabled('variants')) {
// Load translation files required by the page
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings', 'other'));
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$langs->load('incoterm');
}
if (!empty($conf->margin->enabled)) {
if (isModEnabled('margin')) {
$langs->load('margins');
}
@ -375,7 +375,7 @@ if (empty($reshook)) {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) {
} elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) {
// Set incoterm
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} elseif ($action == 'add' && $usercancreate) {
@ -1870,7 +1870,7 @@ if ($action == 'create') {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr class="field_incoterm_id">';
print '<td class="titlefieldcreate"><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->label_incoterms, 1).'</label></td>';
print '<td class="valuefieldcreate maxwidthonsmartphone">';
@ -2655,7 +2655,7 @@ if ($action == 'create') {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
@ -2737,7 +2737,7 @@ if ($action == 'create') {
print '</table>';
// Margin Infos
if (!empty($conf->margin->enabled)) {
if (isModEnabled('margin')) {
$formmargin->displayMarginInfos($object);
}

View File

@ -312,7 +312,7 @@ if (isModEnabled("propal") && $user->rights->propale->lire) {
*/
/*
if (!empty($conf->propal->enabled))
if (isModEnabled('propal'))
{
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as name, s.rowid as socid";
$sql.=" FROM ".MAIN_DB_PREFIX."propal as c";
@ -387,7 +387,7 @@ if (!empty($conf->propal->enabled))
*/
/*
if (!empty($conf->propal->enabled))
if (isModEnabled('propal'))
{
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";

View File

@ -536,7 +536,7 @@ $formother = new FormOther($db);
$formfile = new FormFile($db);
$formpropal = new FormPropal($db);
$formmargin = null;
if (!empty($conf->margin->enabled)) {
if (isModEnabled('margin')) {
$formmargin = new FormMargin($db);
}
$companystatic = new Societe($db);
@ -1573,7 +1573,7 @@ if ($resql) {
$typenArray = null;
$with_margin_info = false;
if (!empty($conf->margin->enabled) && (
if (isModEnabled('margin') && (
!empty($arrayfields['total_pa']['checked'])
|| !empty($arrayfields['total_margin']['checked'])
|| !empty($arrayfields['total_margin_rate']['checked'])

View File

@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
if (!empty($conf->margin->enabled)) {
if (isModEnabled('margin')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
}
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -201,10 +201,10 @@ $arrayfields = array(
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
@ -781,7 +781,7 @@ $form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
$formmargin = null;
if (!empty($conf->margin->enabled)) {
if (isModEnabled('margin')) {
$formmargin = new FormMargin($db);
}
$companystatic = new Societe($db);
@ -1872,7 +1872,7 @@ if ($resql) {
$i = 0;
$with_margin_info = false;
if (!empty($conf->margin->enabled) && (
if (isModEnabled('margin') && (
!empty($arrayfields['total_pa']['checked'])
|| !empty($arrayfields['total_margin']['checked'])
|| !empty($arrayfields['total_margin_rate']['checked'])

View File

@ -5802,7 +5802,7 @@ if ($action == 'create') {
// Show online payment link
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));
if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
print '<br><!-- Link to pay -->'."\n";

View File

@ -245,10 +245,10 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>296), // Not enabled by default because slow
'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502),
'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))),

View File

@ -1476,7 +1476,7 @@ if ($action == 'create') {
$productstatic = new Product($db);
$usemargins = 0;
if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'propal', 'commande'))) {
if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'propal', 'commande'))) {
$usemargins = 1;
}
@ -1522,7 +1522,7 @@ if ($action == 'create') {
print '<td width="30" class="left">'.$langs->trans("Unit").'</td>';
}
print '<td width="50" class="right">'.$langs->trans("ReductionShort").'</td>';
if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
print '<td width="50" class="right">'.$langs->trans("BuyingPrice").'</td>';
}
print '<td width="30">&nbsp;</td>';
@ -1592,7 +1592,7 @@ if ($action == 'create') {
}
// Margin
if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
print '<td class="right nowraponall">'.price($objp->pa_ht).'</td>';
}
@ -1749,7 +1749,7 @@ if ($action == 'create') {
print '</tr>';
$colspan = 6;
if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
$colspan++;
}
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -2246,7 +2246,7 @@ $db->close();
?>
<?php
if (!empty($conf->margin->enabled) && $action == 'editline') {
if (isModEnabled('margin') && $action == 'editline') {
// TODO Why this ? To manage margin on contracts ?
?>
<script type="text/javascript">

View File

@ -110,10 +110,10 @@ class box_graph_product_distribution extends ModeleBoxes
if (!isModEnabled('facture') || empty($user->rights->facture->lire)) {
$showinvoicenb = 0;
}
if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) {
if (isModEnabled('propal') || empty($user->rights->propale->lire)) {
$showpropalnb = 0;
}
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) {
if (!isModEnabled('commande') || empty($user->rights->commande->lire)) {
$showordernb = 0;
}

View File

@ -1276,7 +1276,7 @@ abstract class CommonInvoice extends CommonObject
dol_syslog("The payment has been created for invoice id " . $this->id);
}
if (!$errorforinvoice && !empty($conf->banque->enabled)) {
if (!$errorforinvoice && isModEnabled('banque')) {
dol_syslog('* Add payment to bank');
$bankaccountid = 0;

View File

@ -3550,7 +3550,7 @@ abstract class CommonObject
if (!empty($conf->global->$MODULE)) {
$modsactivated = explode(',', $conf->global->$MODULE);
foreach ($modsactivated as $mod) {
if ($conf->$mod->enabled) {
if (isModEnabled($mod)) {
return 1; // update was disabled by specific setup
}
}
@ -4105,7 +4105,7 @@ abstract class CommonObject
}
// Here $module, $classfile and $classname are set, we can use them.
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) {
if (isModEnabled($module) && (($element != $this->element) || $alsosametype)) {
if ($loadalsoobjects && (is_numeric($loadalsoobjects) || ($loadalsoobjects === $objecttype))) {
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
//print '/'.$classpath.'/'.$classfile.'.class.php '.class_exists($classname);
@ -4883,7 +4883,7 @@ abstract class CommonObject
// Define usemargins
$usemargins = 0;
if (!empty($conf->margin->enabled) && !empty($this->element) && in_array($this->element, array('facture', 'facturerec', 'propal', 'commande'))) {
if (isModEnabled('margin') && !empty($this->element) && in_array($this->element, array('facture', 'facturerec', 'propal', 'commande'))) {
$usemargins = 1;
}

View File

@ -9439,7 +9439,7 @@ class Form
}
}
if (!empty($conf->gravatar->enabled) && $email && empty($noexternsourceoverwrite)) {
if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
// see https://gravatar.com/site/implement/images/php/
$ret .= '<!-- Put link to gravatar -->';
$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.md5(strtolower(trim($email))).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash

View File

@ -1620,13 +1620,13 @@ class FormMail extends Form
//,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing
$onlinepaymentenabled = 0;
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$onlinepaymentenabled++;
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
$onlinepaymentenabled++;
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$onlinepaymentenabled++;
}
if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {

View File

@ -164,7 +164,7 @@ class Utils
}
// Update cachenbofdoc
if (!empty($conf->ecm->enabled) && $choice == 'allfiles') {
if (isModEnabled('ecm') && $choice == 'allfiles') {
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
$ecmdirstatic = new EcmDirectory($this->db);
$result = $ecmdirstatic->refreshcachenboffile(1);

View File

@ -962,7 +962,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$sortfield = "t.lastname";
}
if (!empty($conf->clicktodial->enabled)) {
if (isModEnabled('clicktodial')) {
$user->fetch_clicktodial(); // lecture des infos de clicktodial du user
}

View File

@ -3385,11 +3385,11 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
}
}
if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
if ($conf->browser->layout == 'phone' || (!empty($conf->clicktodial->enabled) && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
if ($conf->browser->layout == 'phone' || (isModEnabled('clicktodial') && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
$newphoneform = $newphone;
$newphone = '<a href="tel:'.$phone.'"';
$newphone .= '>'.$newphoneform.'</a>';
} elseif (!empty($conf->clicktodial->enabled) && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url
} elseif (isModEnabled('clicktodial') && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url
if (empty($user->clicktodial_loaded)) {
$user->fetch_clicktodial();
}

View File

@ -2236,7 +2236,7 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
$module='facture';
}
if (!empty($conf->$module->enabled)) {
if (isModEnabled($module)) {
$res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
if ($res) {
if (class_exists($classname)) {

View File

@ -27,7 +27,7 @@
$supportedoauth2array = array(
'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/', 'availablescopes'=> 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print,admin_directory_user,gmail_full'),
);
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'', 'availablescopes'=>'read_write');
$supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'availablescopes'=>'read_write');
}

View File

@ -150,15 +150,15 @@ function getValidOnlinePaymentMethods($paymentmethod = '')
$validpaymentmethod = array();
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) {
$langs->load("paypal");
$validpaymentmethod['paypal'] = 'valid';
}
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && isModEnabled('paybox')) {
$langs->load("paybox");
$validpaymentmethod['paybox'] = 'valid';
}
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && isModEnabled('stripe')) {
$langs->load("stripe");
$validpaymentmethod['stripe'] = 'valid';
}

View File

@ -60,9 +60,9 @@ function product_prepare_head($object)
$h++;
}
if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase
if (!empty($object->status_buy) || (isModEnabled('margin') && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase
if ((((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->rights->fournisseur->lire)
|| (!empty($conf->margin->enabled) && $user->hasRight("margin", "liretous"))
|| (isModEnabled('margin') && $user->hasRight("margin", "liretous"))
) {
if ($usercancreadprice) {
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
@ -570,7 +570,7 @@ function show_stats_for_company($product, $socid)
}
// MO
if (!empty($conf->mrp->enabled) && !empty($user->rights->mrp->read)) {
if (isModEnabled('mrp') && !empty($user->rights->mrp->read)) {
$nblines++;
$ret = $product->load_stats_mo($socid);
if ($ret < 0) {

View File

@ -168,7 +168,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (isModEnabled("expedition")) {
$nbElements += $project->getElementCount('shipping', 'expedition');
}
if (!empty($conf->mrp->enabled)) {
if (isModEnabled('mrp')) {
$nbElements += $project->getElementCount('mrp', 'mrp_mo', 'fk_project');
}
if (isModEnabled('deplacement')) {

View File

@ -181,7 +181,7 @@ function getCustomerProposalPieChart($socid = 0)
$result= '';
if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) {
if (!isModEnabled('propal') || empty($user->rights->propal->lire)) {
return '';
}

View File

@ -99,7 +99,7 @@ function user_prepare_head(User $object)
$h++;
}
if (!empty($conf->clicktodial->enabled)) {
if (isModEnabled('clicktodial')) {
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
$head[$h][1] = $langs->trans("ClickToDial");
$head[$h][2] = 'clicktodial';

View File

@ -363,7 +363,7 @@ class pdf_einstein extends ModelePDFCommandes
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -398,7 +398,7 @@ class pdf_eratosthene extends ModelePDFCommandes
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -351,7 +351,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -328,7 +328,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -338,7 +338,7 @@ class pdf_espadon extends ModelePdfExpedition
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -361,7 +361,7 @@ class pdf_rouget extends ModelePdfExpedition
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -491,7 +491,7 @@ class pdf_crabe extends ModelePDFFactures
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;
@ -1180,13 +1180,13 @@ class pdf_crabe extends ModelePDFFactures
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') {
$useonlinepayment = 0;
if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) {
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$useonlinepayment++;
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$useonlinepayment++;
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
$useonlinepayment++;
}
}

View File

@ -506,7 +506,7 @@ class pdf_sponge extends ModelePDFFactures
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$this->tab_top -= 2;
@ -1290,13 +1290,13 @@ class pdf_sponge extends ModelePDFFactures
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') {
$useonlinepayment = 0;
if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) {
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$useonlinepayment++;
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$useonlinepayment++;
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
$useonlinepayment++;
}
}

View File

@ -211,7 +211,7 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
}
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) {
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
}
if (isModEnabled('stock')) {
@ -625,7 +625,7 @@ class modProduct extends DolibarrModules
));
}
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) {
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
}
if (is_object($mysoc) && $usenpr) {
@ -718,7 +718,7 @@ class modProduct extends DolibarrModules
'p.desiredstock' => ''
));
}
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) {
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$import_sample = array_merge($import_sample, array('p.cost_price'=>'90'));
}
if (is_object($mysoc) && $usenpr) {

View File

@ -176,7 +176,7 @@ class modService extends DolibarrModules
if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
}
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) {
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
}
if (isModEnabled('stock')) {
@ -572,7 +572,7 @@ class modService extends DolibarrModules
));
}
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) {
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
}
if (is_object($mysoc) && $usenpr) {
@ -663,7 +663,7 @@ class modService extends DolibarrModules
'p.desiredstock' => ''
));
}
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) {
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) {
$import_sample = array_merge($import_sample, array('p.cost_price'=>'90'));
}
if (is_object($mysoc) && $usenpr) {

View File

@ -423,7 +423,7 @@ class pdf_azur extends ModelePDFPropales
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -399,7 +399,7 @@ class pdf_cyan extends ModelePDFPropales
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -275,7 +275,7 @@ class pdf_squille extends ModelePdfReception
// Incoterm
$height_incoterms = 0;
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -345,7 +345,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
// Incoterm
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -366,7 +366,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
// Incoterm
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -388,7 +388,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
// Incoterm
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms) {
$tab_top -= 2;

View File

@ -41,7 +41,7 @@ if (empty($object) || !is_object($object)) {
$usemargins = 0;
if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
$usemargins = 1;
}
@ -492,7 +492,7 @@ jQuery(document).ready(function()
<?php
}
if (!empty($conf->margin->enabled)) {
if (isModEnabled('margin')) {
?>
/* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */
jQuery("#tva_tx").click(function() { /* somtimes field is a text, sometimes a combo */

View File

@ -131,7 +131,7 @@ if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
}
// Purchase price
if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) {
if ($usemargins && isModEnabled('margin') && empty($user->socid)) {
if (!empty($user->rights->margins->creer)) {
if ($conf->global->MARGIN_TYPE == "1") {
print '<td class="linecolmargin1 margininfos right" style="width: 80px">'.$langs->trans('BuyingPrice').'</td>';

View File

@ -49,7 +49,7 @@ global $mysoc;
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
$usemargins = 0;
if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
$usemargins = 1;
}
@ -333,7 +333,7 @@ if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
print '<td align="right" class="linecolcycleref2 nowrap">'.price($sign * $tmp[0]).'</td>';
}
if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) {
if ($usemargins && isModEnabled('margin') && empty($user->socid)) {
if (!empty($user->rights->margins->creer)) { ?>
<td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php print price($line->pa_ht); ?></td>
<?php }

View File

@ -157,7 +157,7 @@ if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) {
// Private dir
$nodes[] = new \Sabre\DAV\FS\Directory($privateDir);
// ECM dir
if (!empty($conf->ecm->enabled) && !empty($conf->global->DAV_ALLOW_ECM_DIR)) {
if (isModEnabled('ecm') && !empty($conf->global->DAV_ALLOW_ECM_DIR)) {
$nodes[] = new \Sabre\DAV\FS\Directory($ecmDir);
}

View File

@ -52,7 +52,7 @@ if (isModEnabled('project')) {
// Load translation files required by the page
$langs->loadLangs(array('bills', 'deliveries', 'orders', 'sendings'));
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$langs->load('incoterm');
}
@ -186,7 +186,7 @@ if ($action == 'setdate_delivery' && $user->rights->expedition->delivery->creer)
if ($result < 0) {
$mesg = '<div class="error">'.$object->error.'</div>';
}
} elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
} elseif ($action == 'set_incoterms' && isModEnabled('incoterm')) {
// Set incoterm
$result = $object->setIncoterms((int) GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
}
@ -451,7 +451,7 @@ if ($action == 'create') {
print '</tr>';
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');

View File

@ -919,7 +919,7 @@ if (!empty($id) && $action != 'edit') {
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show online payment link
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));
if ($useonlinepayment) { //$object->statut != Facture::STATUS_DRAFT &&
print '<br><!-- Link to pay -->'."\n";

View File

@ -159,7 +159,7 @@ if (isModEnabled('holiday')) {
if (isModEnabled("banque")) {
$langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>isModEnabled('banque'), 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
}
if (!empty($conf->mrp->enabled)) {
if (isModEnabled('mrp')) {
$langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>isModEnabled('mrp'), 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
}
if (isModEnabled('recruitment')) {

View File

@ -65,7 +65,7 @@ if (isModEnabled('project')) {
// Load translation files required by the page
$langs->loadLangs(array("sendings", "companies", "bills", 'deliveries', 'orders', 'stocks', 'other', 'propal'));
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$langs->load('incoterm');
}
if (isModEnabled('productbatch')) {
@ -164,7 +164,7 @@ if (empty($reshook)) {
}
// Set incoterm
if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
if ($action == 'set_incoterms' && isModEnabled('incoterm')) {
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
}
@ -1009,7 +1009,7 @@ if ($action == 'create') {
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $object->label_incoterms, 1).'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
@ -1982,7 +1982,7 @@ if ($action == 'create') {
print '</td></tr>';
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');

View File

@ -161,7 +161,7 @@ if (empty($reshook)) {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
} elseif ($action == 'set_incoterms' && isModEnabled('incoterm')) {
// Set incoterm
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
if ($result < 0) {
@ -523,7 +523,7 @@ if ($id > 0 || !empty($ref)) {
// TODO How record was recorded OrderMode (llx_c_input_method)
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');

View File

@ -65,7 +65,7 @@ if (isModEnabled('variants')) {
// Load translation files required by the page
$langs->loadLangs(array('admin', 'orders', 'sendings', 'companies', 'bills', 'propal', 'receptions', 'supplier_proposal', 'deliveries', 'products', 'stocks', 'productbatch'));
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$langs->load('incoterm');
}
@ -1777,7 +1777,7 @@ if ($action == 'create') {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$fkincoterms = (!empty($object->fk_incoterms) ? $object->fk_incoterms : ($socid > 0 ? $societe->fk_incoterms : ''));
$locincoterms = (!empty($object->location_incoterms) ? $object->location_incoterms : ($socid > 0 ? $societe->location_incoterms : ''));
print '<tr>';
@ -2290,7 +2290,7 @@ if ($action == 'create') {
print '</td></tr>';
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('IncotermLabel');
@ -2373,7 +2373,7 @@ if ($action == 'create') {
print '</table>';
// Margin Infos
/*if (!empty($conf->margin->enabled)) {
/*if (isModEnabled('margin')) {
$formmargin->displayMarginInfos($object);
}*/

View File

@ -64,7 +64,7 @@ if (isModEnabled('accounting')) {
$langs->loadLangs(array('bills', 'compta', 'suppliers', 'companies', 'products', 'banks', 'admin'));
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$langs->load('incoterm');
}
@ -399,7 +399,7 @@ if (empty($reshook)) {
} else {
$db->commit();
}
} elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
} elseif ($action == 'set_incoterms' && isModEnabled('incoterm')) {
// Set incoterm
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} elseif ($action == 'setmode' && $usercancreate) {
@ -2429,7 +2429,7 @@ if ($action == 'create') {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->label_incoterms) ? $objectsrc->label_incoterms : '', 1).'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
@ -3127,7 +3127,7 @@ if ($action == 'create') {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
@ -3265,7 +3265,7 @@ if ($action == 'create') {
if (isModEnabled("banque")) {
$nbrows++; $nbcols++;
}
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$nbrows++;
}
if (isModEnabled("multicurrency")) {

View File

@ -189,13 +189,13 @@ if (!empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
$listofval = array();
$listofval['-1'] = $langs->trans('No');
$listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
$listofval['paybox'] = 'Paybox';
}
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$listofval['paypal'] = 'PayPal';
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$listofval['stripe'] = 'Stripe';
}
print $form->selectarray("PARTNERSHIP_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->PARTNERSHIP_NEWFORM_PAYONLINE) ? $conf->global->PARTNERSHIP_NEWFORM_PAYONLINE : ''), 0);

View File

@ -5535,7 +5535,7 @@ class Product extends CommonObject
}
$stock_reception_fournisseur = $this->stats_reception['qty'];
}
if (!empty($conf->mrp->enabled)) {
if (isModEnabled('mrp')) {
$result = $this->load_stats_inproduction(0, '1,2', 1, $dateofvirtualstock);
if ($result < 0) {
dol_print_error($this->db, $this->error);

View File

@ -91,7 +91,7 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled)) {
|| isModEnabled('mrp')) {
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}

View File

@ -821,7 +821,7 @@ if ($id > 0 || $ref) {
}
// Number of product in production
if (!empty($conf->mrp->enabled)) {
if (isModEnabled('mrp')) {
if ($found) {
$helpondiff .= '<br>';
} else {

View File

@ -111,7 +111,7 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled)) {
|| isModEnabled('mrp')) {
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}
@ -459,7 +459,7 @@ if ($usevirtualstock) {
$sqlReceptionFourn = '0';
}
if (!empty($conf->mrp->enabled)) {
if (isModEnabled('mrp')) {
$sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlProductionToConsume .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,";
$sqlProductionToConsume .= " ".MAIN_DB_PREFIX."mrp_production as mp5";

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/stocktransfer/modules_stocktransfe
// Load translation files required by the page
$langs->loadLangs(array("stocks", "other", "productbatch", "companies"));
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
if (isModEnabled('incoterm')) $langs->load('incoterm');
// Get parameters
$id = GETPOST('id', 'int');
@ -336,7 +336,7 @@ if (empty($reshook)) {
}
// Set incoterm
if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $permissiontoadd) {
if ($action == 'set_incoterms' && isModEnabled('incoterm') && $permissiontoadd) {
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
}
// Actions to send emails
@ -399,7 +399,7 @@ if ($action == 'create') {
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->label_incoterms, 1).'</label></td>';
print '<td class="maxwidthonsmartphone">';
@ -611,7 +611,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');

View File

@ -99,7 +99,7 @@ if (!empty($conf->salaries->enabled)) {
if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
if (!empty($conf->mrp->enabled)) {
if (isModEnabled('mrp')) {
require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
}
@ -132,7 +132,7 @@ if (!empty($conf->loan->enabled)) {
if (!empty($conf->salaries->enabled)) {
$langs->load("salaries");
}
if (!empty($conf->mrp->enabled)) {
if (isModEnabled('mrp')) {
$langs->load("mrp");
}
if (isModEnabled('eventorganization')) {

View File

@ -53,7 +53,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
}

View File

@ -247,7 +247,7 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last &
// Make special controls
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) {
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
@ -273,10 +273,10 @@ if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypa
return -1;
}
}
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && isModEnabled('paybox')) {
// No specific test for the moment
}
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && isModEnabled('stripe')) {
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php'; // This include also /stripe/lib/stripe.lib.php, /includes/stripe/stripe-php/init.php, ...
}
@ -481,7 +481,7 @@ if ($action == 'dopayment') {
// Called when choosing Stripe mode.
// When using the old Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture.
// When using the PaymentIntent API architecture, the Stripe customer was already created when creating PaymentIntent when showing payment page, and the payment is already ok when action=charge.
if ($action == 'charge' && !empty($conf->stripe->enabled)) {
if ($action == 'charge' && isModEnabled('stripe')) {
$amountstripe = $amount;
// Correct the amount according to unit of currency
@ -844,10 +844,10 @@ if ($source && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_r
// Show sandbox warning
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled) && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'int'))) { // We can force sand box with param 'forcesandbox'
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal') && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'int'))) { // We can force sand box with param 'forcesandbox'
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Paypal'), '', 'warning');
}
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'int'))) {
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && isModEnabled('stripe') && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'int'))) {
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
}
@ -911,14 +911,14 @@ if (!empty($conf->global->MAIN_IMAGE_PUBLIC_PAYMENT)) {
print '<!-- Form to send a payment -->'."\n";
print '<!-- creditor = '.dol_escape_htmltag($creditor).' -->'."\n";
// Additionnal information for each payment system
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
print '<!-- PAYPAL_API_SANDBOX = '.getDolGlobalString('PAYPAL_API_SANDBOX').' -->'."\n";
print '<!-- PAYPAL_API_INTEGRAL_OR_PAYPALONLY = '.getDolGlobalString('PAYPAL_API_INTEGRAL_OR_PAYPALONLY').' -->'."\n";
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
print '<!-- PAYBOX_CGI_URL = '.getDolGlobalString('PAYBOX_CGI_URL_V2').' -->'."\n";
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
print '<!-- STRIPE_LIVE = '.getDolGlobalString('STRIPE_LIVE').' -->'."\n";
}
print '<!-- urlok = '.$urlok.' -->'."\n";
@ -2043,7 +2043,7 @@ if ($action != 'dopayment') {
'paymentmethod' => $paymentmethod
];
$reshook = $hookmanager->executeHooks('doAddButton', $parameters, $object, $action);
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && isModEnabled('paybox')) {
print '<div class="button buttonpayment" id="div_dopayment_paybox"><span class="fa fa-credit-card"></span> <input class="" type="submit" id="dopayment_paybox" name="dopayment_paybox" value="'.$langs->trans("PayBoxDoPayment").'">';
print '<br>';
print '<span class="buttonpaymentsmall">'.$langs->trans("CreditOrDebitCard").'</span>';
@ -2062,7 +2062,7 @@ if ($action != 'dopayment') {
';
}
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && isModEnabled('stripe')) {
print '<div class="button buttonpayment" id="div_dopayment_stripe"><span class="fa fa-credit-card"></span> <input class="" type="submit" id="dopayment_stripe" name="dopayment_stripe" value="'.$langs->trans("StripeDoPayment").'">';
print '<input type="hidden" name="noidempotency" value="'.GETPOST('noidempotency', 'int').'">';
print '<br>';
@ -2083,7 +2083,7 @@ if ($action != 'dopayment') {
';
}
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled)) {
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) {
if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) {
$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY = 'integral';
}

View File

@ -51,14 +51,14 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
}
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe"));
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$PAYPALTOKEN = GETPOST('TOKEN');
if (empty($PAYPALTOKEN)) {
$PAYPALTOKEN = GETPOST('token');
@ -68,9 +68,9 @@ if (!empty($conf->paypal->enabled)) {
$PAYPALPAYERID = GETPOST('PayerID');
}
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
}
$FULLTAG = GETPOST('FULLTAG');
@ -96,13 +96,13 @@ if (empty($paymentmethod)) {
$validpaymentmethod = array();
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$validpaymentmethod['paypal'] = 'paypal';
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
$validpaymentmethod['paybox'] = 'paybox';
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$validpaymentmethod['stripe'] = 'stripe';
}

View File

@ -57,7 +57,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
}
@ -65,7 +65,7 @@ if (!empty($conf->paypal->enabled)) {
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal"));
// Clean parameters
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$PAYPAL_API_USER = "";
if (!empty($conf->global->PAYPAL_API_USER)) {
$PAYPAL_API_USER = $conf->global->PAYPAL_API_USER;
@ -127,13 +127,13 @@ dol_syslog("***** paymentok.php is called paymentmethod=".$paymentmethod." FULLT
$validpaymentmethod = array();
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$validpaymentmethod['paypal'] = 'paypal';
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
$validpaymentmethod['paybox'] = 'paybox';
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$validpaymentmethod['stripe'] = 'stripe';
}
@ -236,7 +236,7 @@ if (!empty($conf->global->MAIN_IMAGE_PUBLIC_PAYMENT)) {
print '<br><br><br>';
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
if ($paymentmethod == 'paypal') { // We call this page only if payment is ok on payment system
if ($PAYPALTOKEN) {
// Get on url call
@ -316,14 +316,14 @@ if (!empty($conf->paypal->enabled)) {
}
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
if ($paymentmethod == 'paybox') {
// TODO Add a check to validate that payment is ok.
$ispaymentok = true; // We call this page only if payment is ok on payment system
}
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
if ($paymentmethod == 'stripe') {
// TODO Add a check to validate that payment is ok. We can request Stripe with payment_intent and payment_intent_client_secret
$ispaymentok = true; // We call this page only if payment is ok on payment system

View File

@ -65,7 +65,7 @@ if (!empty($conf->project->enabled)) {
$langs->loadLangs(array("receptions", "companies", "bills", 'deliveries', 'orders', 'stocks', 'other', 'propal', 'sendings'));
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$langs->load('incoterm');
}
if (isModEnabled('productbatch')) {
@ -219,7 +219,7 @@ if (empty($reshook)) {
}
// Set incoterm
if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $permissiontoadd) {
if ($action == 'set_incoterms' && isModEnabled('incoterm') && $permissiontoadd) {
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
}
@ -893,7 +893,7 @@ if ($action == 'create') {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->label_incoterms, 1).'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
@ -1628,7 +1628,7 @@ if ($action == 'create') {
print '</td></tr>';
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');

View File

@ -74,7 +74,7 @@ if (isModEnabled('adherent')) {
if (isModEnabled('categorie')) {
$langs->load("categories");
}
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$langs->load("incoterm");
}
if (isModEnabled('notification')) {
@ -537,7 +537,7 @@ if (empty($reshook)) {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
}
@ -938,7 +938,7 @@ if (empty($reshook)) {
}
// Set incoterm
if ($action == 'set_incoterms' && $user->rights->societe->creer && !empty($conf->incoterm->enabled)) {
if ($action == 'set_incoterms' && $user->rights->societe->creer && isModEnabled('incoterm')) {
$object->fetch($socid);
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
}
@ -1812,7 +1812,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr>';
print '<td>'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
@ -2042,7 +2042,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
//Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha');
}
@ -2562,7 +2562,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr>';
print '<td>'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
@ -3084,7 +3084,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans('IncotermLabel').'</td>';
if ($action != 'editincoterm' && $user->rights->societe->creer) {

View File

@ -53,7 +53,7 @@ $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users"));
if (isModEnabled('categorie')) {
$langs->load("categories");
}
if (!empty($conf->incoterm->enabled)) {
if (isModEnabled('incoterm')) {
$langs->load("incoterm");
}
if (isModEnabled('notification')) {

View File

@ -84,7 +84,7 @@ $permissiontoadd = $user->rights->societe->creer; // Used by the include of acti
$permissiontoaddupdatepaymentinformation = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $permissiontoadd) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->societe->thirdparty_paymentinformation_advance->write)));
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$service = 'StripeTest';
$servicestatus = 0;
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
@ -493,7 +493,7 @@ if (empty($reshook)) {
$id = $savid;
// Action for stripe
if (!empty($conf->stripe->enabled) && class_exists('Stripe')) {
if (isModEnabled('stripe') && class_exists('Stripe')) {
if ($action == 'synccustomertostripe') {
if ($object->client == 0) {
$error++;
@ -782,11 +782,11 @@ llxHeader('', $title, $help_url);
$head = societe_prepare_head($object);
// Show sandbox warning
/*if (!empty($conf->paypal->enabled) && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))) // We can force sand box with param 'forcesandbox'
/*if (isModEnabled('paypal') && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))) // We can force sand box with param 'forcesandbox'
{
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning');
}*/
if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
if (isModEnabled('stripe') && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
}
@ -885,13 +885,13 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
// Stripe customer key 'cu_....' stored into llx_societe_account
print '<tr><td class="titlefield">';
print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontoaddupdatepaymentinformation, 'string', '', 0, 2, 'socid');
print '</td><td>';
print $form->editfieldval("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontoaddupdatepaymentinformation, 'string', '', null, null, '', 2, '', 'socid');
if (!empty($conf->stripe->enabled) && $stripecu && $action != 'editkey_account') {
if (isModEnabled('stripe') && $stripecu && $action != 'editkey_account') {
$connect = '';
if (!empty($stripeacc)) {
$connect = $stripeacc.'/';
@ -947,7 +947,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
}
}
if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
if (isModEnabled('stripe') && !empty($conf->stripeconnect->enabled) && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$stripesupplieracc = $stripe->getStripeAccount($service, $object->id); // Get Stripe OAuth connect account (no network access here)
// Stripe customer key 'cu_....' stored into llx_societe_account
@ -955,7 +955,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print $form->editfieldkey("StripeConnectAccount", 'key_account_supplier', $stripesupplieracc, $object, $permissiontoaddupdatepaymentinformation, 'string', '', 0, 2, 'socid');
print '</td><td>';
print $form->editfieldval("StripeConnectAccount", 'key_account_supplier', $stripesupplieracc, $object, $permissiontoaddupdatepaymentinformation, 'string', '', null, null, '', 2, '', 'socid');
if (!empty($conf->stripe->enabled) && $stripesupplieracc && $action != 'editkey_account_supplier') {
if (isModEnabled('stripe') && $stripesupplieracc && $action != 'editkey_account_supplier') {
$connect = '';
$url = 'https://dashboard.stripe.com/test/connect/accounts/'.$stripesupplieracc;
@ -1338,7 +1338,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
}
// List of Stripe connect accounts
if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && !empty($stripesupplieracc)) {
if (isModEnabled('stripe') && !empty($conf->stripeconnect->enabled) && !empty($stripesupplieracc)) {
print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc ? ' (Stripe connection with StripeConnect account '.$stripesupplieracc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, 'stripe-s');
$balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc));
print '<table class="liste centpercent">'."\n";

View File

@ -399,7 +399,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
if (!empty($site_account)) {
\Stripe\Stripe::setApiKey($site_account);
}
if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
if (isModEnabled('stripe') && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
$service = 'StripeTest';
$servicestatus = '0';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');

View File

@ -68,7 +68,7 @@ $stripe = new Stripe($db);
llxHeader('', $langs->trans("StripeChargeList"));
if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
if (isModEnabled('stripe') && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
$service = 'StripeTest';
$servicestatus = '0';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
@ -225,7 +225,7 @@ if (!$rowid) {
// Stripe customer
print "<td>";
if (!empty($conf->stripe->enabled) && !empty($stripeacc)) {
if (isModEnabled('stripe') && !empty($stripeacc)) {
$connect = $stripeacc.'/';
}
$url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer;

View File

@ -71,7 +71,7 @@ class ActionsStripeconnect
{
global $db, $conf, $user, $langs, $form;
if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
if (isModEnabled('stripe') && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
$service = 'StripeTest';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
} else {

View File

@ -72,7 +72,7 @@ $stripe = new Stripe($db);
llxHeader('', $langs->trans("StripePayoutList"));
if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
if (isModEnabled('stripe') && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
$service = 'StripeTest';
$servicestatus = '0';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');

View File

@ -71,7 +71,7 @@ $stripe = new Stripe($db);
llxHeader('', $langs->trans("StripeTransactionList"));
if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
if (isModEnabled('stripe') && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
$service = 'StripeTest';
$servicestatus = '0';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');

View File

@ -79,7 +79,7 @@ if (GETPOST('action', 'alpha') == 'set') {
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
if (isModEnabled('stripe') && !empty($conf->global->STRIPE_CARD_PRESENT)) {
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$terminaltouse, GETPOST('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
}
if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) {
@ -189,7 +189,7 @@ if (isModEnabled("banque")) {
}
print '</td></tr>';
if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
if (isModEnabled('stripe') && !empty($conf->global->STRIPE_CARD_PRESENT)) {
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForStripeTerminal").'</td>'; // Force Stripe Terminal
print '<td>';
$service = 'StripeTest';
@ -201,7 +201,7 @@ if (isModEnabled("banque")) {
global $stripearrayofkeysbyenv;
$site_account = $stripearrayofkeysbyenv[$servicestatus]['secret_key'];
\Stripe\Stripe::setApiKey($site_account);
if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
if (isModEnabled('stripe') && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
$service = 'StripeTest';
$servicestatus = '0';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');

View File

@ -80,7 +80,7 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
<body>
<?php
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$service = 'StripeTest';
$servicestatus = 0;
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
@ -130,7 +130,7 @@ function fetchConnectionToken() {
</script>
<?php }
if (!empty($conf->stripe->enabled) && isset($keyforstripeterminalbank) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning', 1);
}
@ -535,7 +535,7 @@ $action_buttons = array(
),
);
$numpad = $conf->global->TAKEPOS_NUMPAD;
if (!empty($conf->stripe->enabled) && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
print '<span id="card-present-alert">';
dol_htmloutput_mesg($langs->trans('ConnectingToStripeTerminal', 'Stripe'), '', 'warning', 1);
print '</span>';
@ -646,7 +646,7 @@ while ($i < count($arrayOfValidPaymentModes)) {
$i = $i + 1;
}
if (!empty($conf->stripe->enabled) && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) {
$keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$_SESSION["takeposterminal"];
print '<span id="StripeTerminal"></span>';
if (!empty($conf->global->$keyforstripeterminalbank)) {