Merge pull request #22397 from aspangaro/17p6

Use isModEnabled
This commit is contained in:
Laurent Destailleur 2022-09-25 12:50:55 +02:00 committed by GitHub
commit a86aaff288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
129 changed files with 323 additions and 323 deletions

View File

@ -68,7 +68,7 @@ $conditions = array(
'USERSIGN' => 1, 'USERSIGN' => 1,
'MAILING' => isModEnabled('mailing'), 'MAILING' => isModEnabled('mailing'),
'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')), 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')),
'TICKET' => !empty($conf->ticket->enabled), 'TICKET' => isModEnabled('ticket'),
); );
// Picto // Picto
$picto = array( $picto = array(

View File

@ -207,7 +207,7 @@ if (isModEnabled("expedition")) {
if (isModEnabled("reception")) { if (isModEnabled("reception")) {
$elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendReception')); $elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendReception'));
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention')); $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
} }
if (isModEnabled('supplier_proposal')) { if (isModEnabled('supplier_proposal')) {
@ -222,7 +222,7 @@ if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->facture->
if (isModEnabled('contrat') && !empty($user->rights->contrat->lire)) { if (isModEnabled('contrat') && !empty($user->rights->contrat->lire)) {
$elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract')); $elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract'));
} }
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) { if (isModEnabled('ticket') && !empty($user->rights->ticket->read)) {
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket')); $elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket'));
} }
if (isModEnabled('expensereport') && !empty($user->rights->expensereport->lire)) { if (isModEnabled('expensereport') && !empty($user->rights->expensereport->lire)) {

View File

@ -75,7 +75,7 @@ $workflowcodes = array(
'WORKFLOW_TICKET_CREATE_INTERVENTION' => array ( 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array (
'family'=>'create', 'family'=>'create',
'position'=>25, 'position'=>25,
'enabled'=>(!empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled)), 'enabled'=>(isModEnabled('ticket') && isModEnabled('ficheinter')),
'picto'=>'ticket' 'picto'=>'ticket'
), ),
@ -133,7 +133,7 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array( 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array(
'family'=>'classify_supplier_order', 'family'=>'classify_supplier_order',
'position'=>63, 'position'=>63,
'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))), 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))),
'picto'=>'supplier_order', 'picto'=>'supplier_order',
'warning'=>'' 'warning'=>''
), ),
@ -141,7 +141,7 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array( 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array(
'family'=>'classify_supplier_order', 'family'=>'classify_supplier_order',
'position'=>64, 'position'=>64,
'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))), 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))),
'picto'=>'supplier_order', 'picto'=>'supplier_order',
'warning'=>'' 'warning'=>''
), ),
@ -174,13 +174,13 @@ $workflowcodes = array(
'WORKFLOW_TICKET_LINK_CONTRACT' => array( 'WORKFLOW_TICKET_LINK_CONTRACT' => array(
'family' => 'link_ticket', 'family' => 'link_ticket',
'position' => 75, 'position' => 75,
'enabled' => !empty($conf->ticket->enabled) && !empty($conf->contract->enabled), 'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled),
'picto' => 'ticket' 'picto' => 'ticket'
), ),
'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array( 'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
'family' => 'link_ticket', 'family' => 'link_ticket',
'position' => 76, 'position' => 76,
'enabled' => !empty($conf->ticket->enabled) && !empty($conf->contract->enabled), 'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled),
'picto' => 'ticket' 'picto' => 'ticket'
), ),
); );

View File

@ -128,7 +128,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En'; $help_url = 'EN:Module_Agenda_En';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = assetPrepareHead($object); $head = assetPrepareHead($object);

View File

@ -130,7 +130,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En'; $help_url = 'EN:Module_Agenda_En';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = assetModelPrepareHead($object); $head = assetModelPrepareHead($object);

View File

@ -165,7 +165,7 @@ class BlockedLog
*/ */
// Donation // Donation
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
$this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE'; $this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
$this->trackedevents['DON_DELETE'] = 'logDON_DELETE'; $this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
//$this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL'; //$this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';

View File

@ -130,7 +130,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Agenda'; $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Agenda';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = bomPrepareHead($object); $head = bomPrepareHead($object);

View File

@ -353,7 +353,7 @@ if (empty($reshook)) {
} }
$text = $langs->trans('ConfirmValidateBom', $numref); $text = $langs->trans('ConfirmValidateBom', $numref);
/*if (! empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
@ -362,7 +362,7 @@ if (empty($reshook)) {
}*/ }*/
$formquestion = array(); $formquestion = array();
if (!empty($conf->bom->enabled)) { if (isModEnabled('bom')) {
$langs->load("mrp"); $langs->load("mrp");
$forcecombo = 0; $forcecombo = 0;
if ($conf->browser->name == 'ie') { if ($conf->browser->name == 'ie') {
@ -381,7 +381,7 @@ if (empty($reshook)) {
// Confirmation of closing // Confirmation of closing
if ($action == 'close') { if ($action == 'close') {
$text = $langs->trans('ConfirmCloseBom', $object->ref); $text = $langs->trans('ConfirmCloseBom', $object->ref);
/*if (! empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
@ -390,7 +390,7 @@ if (empty($reshook)) {
}*/ }*/
$formquestion = array(); $formquestion = array();
if (!empty($conf->bom->enabled)) { if (isModEnabled('bom')) {
$langs->load("mrp"); $langs->load("mrp");
$forcecombo = 0; $forcecombo = 0;
if ($conf->browser->name == 'ie') { if ($conf->browser->name == 'ie') {
@ -409,7 +409,7 @@ if (empty($reshook)) {
// Confirmation of reopen // Confirmation of reopen
if ($action == 'reopen') { if ($action == 'reopen') {
$text = $langs->trans('ConfirmReopenBom', $object->ref); $text = $langs->trans('ConfirmReopenBom', $object->ref);
/*if (! empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
@ -418,7 +418,7 @@ if (empty($reshook)) {
}*/ }*/
$formquestion = array(); $formquestion = array();
if (!empty($conf->bom->enabled)) { if (isModEnabled('bom')) {
$langs->load("mrp"); $langs->load("mrp");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$forcecombo = 0; $forcecombo = 0;

View File

@ -60,7 +60,7 @@ if (isModEnabled('contrat')) {
if (isModEnabled('adherent')) { if (isModEnabled('adherent')) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
} }
@ -82,10 +82,10 @@ if (isModEnabled('facture')) {
if (isModEnabled('project')) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$langs->load("interventions"); $langs->load("interventions");
} }
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
@ -545,7 +545,7 @@ if ($object->id > 0) {
} }
// Warehouse // Warehouse
if (!empty($conf->stock->enabled) && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) { if (isModEnabled('stock') && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) {
$langs->load('stocks'); $langs->load('stocks');
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -1231,7 +1231,7 @@ if ($object->id > 0) {
/* /*
* Latest interventions * Latest interventions
*/ */
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) { if (isModEnabled('ficheinter') && $user->rights->ficheinter->lire) {
$sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate, f.entity"; $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate, f.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
$sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " WHERE f.fk_soc = s.rowid";
@ -1564,7 +1564,7 @@ if ($object->id > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddContract").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddContract").'</a></div>';
} }
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1) { if (isModEnabled('ficheinter') && $user->rights->ficheinter->creer && $object->status == 1) {
$langs->load("fichinter"); $langs->load("fichinter");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddIntervention").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddIntervention").'</a></div>';
} }

View File

@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
} }
@ -104,7 +104,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
$supplierorderstatic = new CommandeFournisseur($db); $supplierorderstatic = new CommandeFournisseur($db);
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$fichinterstatic = new Fichinter($db); $fichinterstatic = new Fichinter($db);
} }
@ -519,7 +519,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
/* /*
* Draft interventionals * Draft interventionals
*/ */
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut"; $sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";

View File

@ -55,7 +55,7 @@ if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
if (!empty($conf->variants->enabled)) { if (isModEnabled('variants')) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
} }
@ -976,7 +976,7 @@ if (empty($reshook)) {
$error++; $error++;
} }
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) { if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination //Check if there is a product with the given combination
$prodcomb = new ProductCombination($db); $prodcomb = new ProductCombination($db);
@ -1696,7 +1696,7 @@ if ($action == 'create') {
if ($soc->fk_warehouse > 0) { if ($soc->fk_warehouse > 0) {
$warehouse_id = $soc->fk_warehouse; $warehouse_id = $soc->fk_warehouse;
} }
if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (isModEnabled('stock') && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) {
$warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE;
} }
@ -1836,7 +1836,7 @@ if ($action == 'create') {
} }
// Warehouse // Warehouse
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
print '<tr class="field_warehouse_id"><td class="titlefieldcreate">'.$langs->trans('Warehouse').'</td><td class="valuefieldcreate">'; print '<tr class="field_warehouse_id"><td class="titlefieldcreate">'.$langs->trans('Warehouse').'</td><td class="valuefieldcreate">';
@ -2209,7 +2209,7 @@ if ($action == 'create') {
} }
} }
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$formquestion = array_merge($formquestion, array( $formquestion = array_merge($formquestion, array(
@ -2248,7 +2248,7 @@ if ($action == 'create') {
} }
$text = $langs->trans('ConfirmValidateProp', $numref); $text = $langs->trans('ConfirmValidateProp', $numref);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
@ -2520,7 +2520,7 @@ if ($action == 'create') {
} }
// Warehouse // Warehouse
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
$langs->load('stocks'); $langs->load('stocks');
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -2880,7 +2880,7 @@ if ($action == 'create') {
} }
// Create an intervention // Create an intervention
if (isModEnabled("service") && !empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) { if (isModEnabled("service") && isModEnabled('ficheinter') && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreateintervention) { if ($usercancreateintervention) {
$langs->load("interventions"); $langs->load("interventions");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddIntervention").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddIntervention").'</a>';

View File

@ -1095,7 +1095,7 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx')); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx'));
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';

View File

@ -58,7 +58,7 @@ if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
} }
if (!empty($conf->variants->enabled)) { if (isModEnabled('variants')) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
} }
@ -66,10 +66,10 @@ if (!empty($conf->variants->enabled)) {
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'products', 'other')); $langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'products', 'other'));
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$langs->load('incoterm'); $langs->load('incoterm');
} }
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
$langs->load('margins'); $langs->load('margins');
} }
if (isModEnabled('productbatch')) { if (isModEnabled('productbatch')) {
@ -603,7 +603,7 @@ if (empty($reshook)) {
$object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
} }
} elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) { } elseif ($action == 'set_incoterms' && isModEnabled('incoterm')) {
// Set incoterm // Set incoterm
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
if ($result < 0) { if ($result < 0) {
@ -724,7 +724,7 @@ if (empty($reshook)) {
$error++; $error++;
} }
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) { if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination //Check if there is a product with the given combination
$prodcomb = new ProductCombination($db); $prodcomb = new ProductCombination($db);
@ -1242,7 +1242,7 @@ if (empty($reshook)) {
} }
// Check parameters // Check parameters
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) {
if (!$idwarehouse || $idwarehouse == -1) { if (!$idwarehouse || $idwarehouse == -1) {
$error++; $error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
@ -1262,7 +1262,7 @@ if (empty($reshook)) {
if ( if (
GETPOST('generate_deposit', 'alpha') == 'on' && !empty($deposit_percent_from_payment_terms) GETPOST('generate_deposit', 'alpha') == 'on' && !empty($deposit_percent_from_payment_terms)
&& !empty($conf->facture->enabled) && !empty($user->rights->facture->creer) && isModEnabled('facture') && !empty($user->rights->facture->creer)
) { ) {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
@ -1336,7 +1336,7 @@ if (empty($reshook)) {
} }
// Check parameters // Check parameters
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) {
if (!$idwarehouse || $idwarehouse == -1) { if (!$idwarehouse || $idwarehouse == -1) {
$error++; $error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
@ -1384,7 +1384,7 @@ if (empty($reshook)) {
} }
// Check parameters // Check parameters
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) {
if (!$idwarehouse || $idwarehouse == -1) { if (!$idwarehouse || $idwarehouse == -1) {
$error++; $error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
@ -1705,7 +1705,7 @@ if ($action == 'create' && $usercancreate) {
if ($soc->fk_warehouse > 0) { if ($soc->fk_warehouse > 0) {
$warehouse_id = $soc->fk_warehouse; $warehouse_id = $soc->fk_warehouse;
} }
if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (isModEnabled('stock') && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) {
$warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE;
} }
@ -1838,7 +1838,7 @@ if ($action == 'create' && $usercancreate) {
} }
// Warehouse // Warehouse
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
print '<tr><td>'.$langs->trans('Warehouse').'</td><td>'; print '<tr><td>'.$langs->trans('Warehouse').'</td><td>';
@ -2062,7 +2062,7 @@ if ($action == 'create' && $usercancreate) {
} }
$text = $langs->trans('ConfirmValidateOrder', $numref); $text = $langs->trans('ConfirmValidateOrder', $numref);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
@ -2077,7 +2077,7 @@ if ($action == 'create' && $usercancreate) {
} }
$formquestion = array(); $formquestion = array();
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) {
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -2231,7 +2231,7 @@ if ($action == 'create' && $usercancreate) {
$text = $langs->trans('ConfirmUnvalidateOrder', $object->ref); $text = $langs->trans('ConfirmUnvalidateOrder', $object->ref);
$formquestion = array(); $formquestion = array();
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) {
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -2270,7 +2270,7 @@ if ($action == 'create' && $usercancreate) {
$text = $langs->trans('ConfirmCancelOrder', $object->ref); $text = $langs->trans('ConfirmCancelOrder', $object->ref);
$formquestion = array(); $formquestion = array();
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) {
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -2483,7 +2483,7 @@ if ($action == 'create' && $usercancreate) {
} }
// Warehouse // Warehouse
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
$langs->load('stocks'); $langs->load('stocks');
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -2827,7 +2827,7 @@ if ($action == 'create' && $usercancreate) {
} }
// Create intervention // Create intervention
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$langs->load("interventions"); $langs->load("interventions");
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {

View File

@ -514,7 +514,7 @@ class Commande extends CommonOrder
if (!$error) { if (!$error) {
// If stock is incremented on validate order, we must increment it // If stock is incremented on validate order, we must increment it
if ($result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { if ($result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -642,7 +642,7 @@ class Commande extends CommonOrder
} }
// If stock is decremented on validate order, we must reincrement it // If stock is decremented on validate order, we must reincrement it
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) {
$result = 0; $result = 0;
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
@ -827,7 +827,7 @@ class Commande extends CommonOrder
dol_syslog(get_class($this)."::cancel", LOG_DEBUG); dol_syslog(get_class($this)."::cancel", LOG_DEBUG);
if ($this->db->query($sql)) { if ($this->db->query($sql)) {
// If stock is decremented on validate order, we must reincrement it // If stock is decremented on validate order, we must reincrement it
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");

View File

@ -1305,7 +1305,7 @@ if ($resql) {
print $langs->trans('ValidateInvoices'); print $langs->trans('ValidateInvoices');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
print $form->selectyesno('validate_invoices', 0, 1, 1); print $form->selectyesno('validate_invoices', 0, 1, 1);
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
} else { } else {
@ -1371,7 +1371,7 @@ if ($resql) {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// If Stock is enabled // If Stock is enabled
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
@ -2385,7 +2385,7 @@ if ($resql) {
// Show shippable Icon (this creates subloops, so may be slow) // Show shippable Icon (this creates subloops, so may be slow)
if (!empty($arrayfields['shippable']['checked'])) { if (!empty($arrayfields['shippable']['checked'])) {
print '<td class="center">'; print '<td class="center">';
if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) { if (!empty($show_shippable_command) && isModEnabled('stock')) {
if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
$generic_commande->getLinesArray(); // Load array ->lines $generic_commande->getLinesArray(); // Load array ->lines
$generic_commande->loadExpeditions(); // Load array ->expeditions $generic_commande->loadExpeditions(); // Load array ->expeditions

View File

@ -601,7 +601,7 @@ if (isModEnabled('multicompany') && is_object($mc)) {
print '<br>'; print '<br>';
// Project filter // Project filter
if (!empty($conf->projet->enabled)) { if (isModEnabled('projet')) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
$langs->load('projects'); $langs->load('projects');
print '<span class="marginrightonly">'.$langs->trans('Project').":</span>"; print '<span class="marginrightonly">'.$langs->trans('Project').":</span>";

View File

@ -4119,7 +4119,7 @@ if ($action == 'create') {
} }
$text = $langs->trans('ConfirmValidateBill', $numref); $text = $langs->trans('ConfirmValidateBill', $numref);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';

View File

@ -1012,7 +1012,7 @@ class Facture extends CommonInvoice
// else we get the best supplier price // else we get the best supplier price
if ($conf->global->MARGIN_TYPE == 'costprice' && !empty($producttmp->cost_price)) { if ($conf->global->MARGIN_TYPE == 'costprice' && !empty($producttmp->cost_price)) {
$buyprice = $producttmp->cost_price; $buyprice = $producttmp->cost_price;
} elseif (!empty($conf->stock->enabled) && ($conf->global->MARGIN_TYPE == 'costprice' || $conf->global->MARGIN_TYPE == 'pmp') && !empty($producttmp->pmp)) { } elseif (isModEnabled('stock') && ($conf->global->MARGIN_TYPE == 'costprice' || $conf->global->MARGIN_TYPE == 'pmp') && !empty($producttmp->pmp)) {
$buyprice = $producttmp->pmp; $buyprice = $producttmp->pmp;
} else { } else {
if ($producttmp->find_min_price_product_fournisseur($_facrec->lines[$i]->fk_product) > 0) { if ($producttmp->find_min_price_product_fournisseur($_facrec->lines[$i]->fk_product) > 0) {
@ -2655,7 +2655,7 @@ class Facture extends CommonInvoice
} }
// If we decrease stock on invoice validation, we increase back if a warehouse id was provided // If we decrease stock on invoice validation, we increase back if a warehouse id was provided
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) { if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -3162,7 +3162,7 @@ class Facture extends CommonInvoice
$result = $this->thirdparty->set_as_client(); $result = $this->thirdparty->set_as_client();
// If active we decrement the main product and its components at invoice validation // If active we decrement the main product and its components at invoice validation
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) { if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -3475,7 +3475,7 @@ class Facture extends CommonInvoice
} }
// If we decrease stock on invoice validation, we increase back // If we decrease stock on invoice validation, we increase back
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");

View File

@ -170,7 +170,7 @@ if ($object->thirdparty->client) {
} }
} }
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) { if (isModEnabled('ficheinter') && $user->rights->ficheinter->lire) {
$elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions'); $elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions');
} }

View File

@ -87,7 +87,7 @@ if ($id > 0) {
/* /*
* Affichage onglets * Affichage onglets
*/ */
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }

View File

@ -68,7 +68,7 @@ if ($id) {
} }
llxHeader('', $title); llxHeader('', $title);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = contact_prepare_head($object); $head = contact_prepare_head($object);

View File

@ -138,7 +138,7 @@ if ($id > 0) {
} }
llxHeader('', $title); llxHeader('', $title);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = contract_prepare_head($object); $head = contract_prepare_head($object);

View File

@ -912,12 +912,12 @@ if ($action == 'remove_file') {
if (!$error && $massaction == 'validate' && $permissiontoadd) { if (!$error && $massaction == 'validate' && $permissiontoadd) {
$objecttmp = new $objectclass($db); $objecttmp = new $objectclass($db);
if (($objecttmp->element == 'facture' || $objecttmp->element == 'invoice') && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { if (($objecttmp->element == 'facture' || $objecttmp->element == 'invoice') && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors');
$error++; $error++;
} }
if ($objecttmp->element == 'invoice_supplier' && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { if ($objecttmp->element == 'invoice_supplier' && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors');
$error++; $error++;

View File

@ -64,7 +64,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$this->db = $db; $this->db = $db;
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tmpentry = array('enabled'=>((isModEnabled("product") || isModEnabled("service")) && !empty($conf->stock->enabled)), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock'); $tmpentry = array('enabled'=>((isModEnabled("product") || isModEnabled("service")) && isModEnabled('stock')), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock');
$showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden = ($showmode != 1); $this->hidden = ($showmode != 1);
} }

View File

@ -2313,7 +2313,7 @@ class Form
} }
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (!empty($conf->variants->enabled) && is_array($selected_combinations)) { if (isModEnabled('variants') && is_array($selected_combinations)) {
// Code to automatically insert with javascript the select of attributes under the select of product // Code to automatically insert with javascript the select of attributes under the select of product
// when a parent of variant has been selected. // when a parent of variant has been selected.
$out .= ' $out .= '
@ -2944,7 +2944,7 @@ class Form
if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
$opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"';
} }
if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
if (!empty($user->rights->stock->lire)) { if (!empty($user->rights->stock->lire)) {
if ($objp->stock > 0) { if ($objp->stock > 0) {
$opt .= ' class="product_line_stock_ok"'; $opt .= ' class="product_line_stock_ok"';
@ -3101,7 +3101,7 @@ class Form
$outdefault_vat_code = $objp->default_vat_code; $outdefault_vat_code = $objp->default_vat_code;
} }
if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
if (!empty($user->rights->stock->lire)) { if (!empty($user->rights->stock->lire)) {
$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); $opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
@ -3486,7 +3486,7 @@ class Form
} }
} }
if (!empty($conf->stock->enabled) && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
$novirtualstock = ($showstockinlist == 2); $novirtualstock = ($showstockinlist == 2);
if (!empty($user->rights->stock->lire)) { if (!empty($user->rights->stock->lire)) {
@ -8614,7 +8614,7 @@ class Form
} }
} elseif ($objecttype == 'ficheinter') { } elseif ($objecttype == 'ficheinter') {
$tplpath = 'fichinter'; $tplpath = 'fichinter';
if (empty($conf->ficheinter->enabled)) { if (!isModEnabled('ficheinter')) {
continue; // Do not show if module disabled continue; // Do not show if module disabled
} }
} elseif ($objecttype == 'invoice_supplier') { } elseif ($objecttype == 'invoice_supplier') {

View File

@ -1026,7 +1026,7 @@ class FormCompany extends Form
public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '', $allowempty = '') public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '', $allowempty = '')
{ {
global $conf, $langs; global $conf, $langs;
if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->fournisseur->enabled)) { if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && !isModEnabled('fournisseur')) {
return '' ; return '' ;
} }

View File

@ -1634,7 +1634,7 @@ class FormMail extends Form
if (isModEnabled('adherent')) { if (isModEnabled('adherent')) {
$tmparray['__SECUREKEYPAYMENT_MEMBER__'] = 'SecureKeyPAYMENTUniquePerMember'; $tmparray['__SECUREKEYPAYMENT_MEMBER__'] = 'SecureKeyPAYMENTUniquePerMember';
} }
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
$tmparray['__SECUREKEYPAYMENT_DONATION__'] = 'SecureKeyPAYMENTUniquePerDonation'; $tmparray['__SECUREKEYPAYMENT_DONATION__'] = 'SecureKeyPAYMENTUniquePerDonation';
} }
if (isModEnabled('facture')) { if (isModEnabled('facture')) {
@ -1651,7 +1651,7 @@ class FormMail extends Form
if (isModEnabled('adherent')) { if (isModEnabled('adherent')) {
$tmparray['__ONLINEPAYMENTLINK_MEMBER__'] = 'OnlinePaymentLinkUniquePerMember'; $tmparray['__ONLINEPAYMENTLINK_MEMBER__'] = 'OnlinePaymentLinkUniquePerMember';
} }
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
$tmparray['__ONLINEPAYMENTLINK_DONATION__'] = 'OnlinePaymentLinkUniquePerDonation'; $tmparray['__ONLINEPAYMENTLINK_DONATION__'] = 'OnlinePaymentLinkUniquePerDonation';
} }
if (isModEnabled('facture')) { if (isModEnabled('facture')) {

View File

@ -92,7 +92,7 @@ function contact_prepare_head(Contact $object)
} }
// Related items // Related items
if (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || !empty($conf->ficheinter->enabled) || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || isModEnabled('ficheinter') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
$head[$tab][0] = DOL_URL_ROOT.'/contact/consumption.php?id='.$object->id; $head[$tab][0] = DOL_URL_ROOT.'/contact/consumption.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Referers"); $head[$tab][1] = $langs->trans("Referers");
$head[$tab][2] = 'consumption'; $head[$tab][2] = 'consumption';

View File

@ -2948,7 +2948,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if (($fuser->rights->stock->{$lire} || $fuser->rights->stock->movement->{$lire} || $fuser->rights->stock->mouvement->{$lire}) || preg_match('/^specimen/i', $original_file)) { if (($fuser->rights->stock->{$lire} || $fuser->rights->stock->movement->{$lire} || $fuser->rights->stock->mouvement->{$lire}) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1; $accessallowed = 1;
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file; $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file;
} }
} elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { } elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) {

View File

@ -157,7 +157,7 @@ function ordersupplier_prepare_head(CommandeFournisseur $object)
$h++; $h++;
} }
if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { if (isModEnabled('stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
$langs->load("stocks"); $langs->load("stocks");
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id;
$head[$h][1] = $langs->trans("OrderDispatch"); $head[$h][1] = $langs->trans("OrderDispatch");

View File

@ -7404,7 +7404,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/ $substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/
} }
// add variables subtitutions ticket // add variables subtitutions ticket
if (!empty($conf->ticket->enabled) && (!is_object($object) || $object->element == 'ticket')) { if (isModEnabled('ticket') && (!is_object($object) || $object->element == 'ticket')) {
$substitutionarray['__TICKET_TRACKID__'] = '__TICKET_TRACKID__'; $substitutionarray['__TICKET_TRACKID__'] = '__TICKET_TRACKID__';
$substitutionarray['__TICKET_SUBJECT__'] = '__TICKET_SUBJECT__'; $substitutionarray['__TICKET_SUBJECT__'] = '__TICKET_SUBJECT__';
$substitutionarray['__TICKET_TYPE__'] = '__TICKET_TYPE__'; $substitutionarray['__TICKET_TYPE__'] = '__TICKET_TYPE__';

View File

@ -94,7 +94,7 @@ function product_prepare_head($object)
$h++; $h++;
} }
if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) { if (isModEnabled('variants') && ($object->isProduct() || $object->isService())) {
global $db; global $db;
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
@ -115,7 +115,7 @@ function product_prepare_head($object)
} }
if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { // If physical product we can stock (or service with option) if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { // If physical product we can stock (or service with option)
if (!empty($conf->stock->enabled) && $user->rights->stock->lire) { if (isModEnabled('stock') && $user->rights->stock->lire) {
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id; $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id;
$head[$h][1] = $langs->trans("Stock"); $head[$h][1] = $langs->trans("Stock");
$head[$h][2] = 'stock'; $head[$h][2] = 'stock';
@ -547,7 +547,7 @@ function show_stats_for_company($product, $socid)
} }
// BOM // BOM
if (!empty($conf->bom->enabled) && $user->rights->bom->read) { if (isModEnabled('bom') && $user->rights->bom->read) {
$nblines++; $nblines++;
$ret = $product->load_stats_bom($socid); $ret = $product->load_stats_bom($socid);
if ($ret < 0) { if ($ret < 0) {

View File

@ -127,7 +127,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))
|| isModEnabled("propal") || isModEnabled('commande') || isModEnabled("propal") || isModEnabled('commande')
|| isModEnabled('facture') || isModEnabled('contrat') || isModEnabled('facture') || isModEnabled('contrat')
|| !empty($conf->ficheinter->enabled) || isModEnabled('agenda') || isModEnabled('deplacement') || !empty($conf->stock->enabled)) { || isModEnabled('ficheinter') || isModEnabled('agenda') || isModEnabled('deplacement') || isModEnabled('stock')) {
$nbElements = 0; $nbElements = 0;
// Enable caching of thirdrparty count Contacts // Enable caching of thirdrparty count Contacts
$cachekey = 'count_elements_project_'.$project->id; $cachekey = 'count_elements_project_'.$project->id;
@ -135,7 +135,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (!is_null($dataretrieved)) { if (!is_null($dataretrieved)) {
$nbElements = $dataretrieved; $nbElements = $dataretrieved;
} else { } else {
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project'); $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project');
} }
if (isModEnabled("propal")) { if (isModEnabled("propal")) {
@ -162,7 +162,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (isModEnabled('contrat')) { if (isModEnabled('contrat')) {
$nbElements += $project->getElementCount('contract', 'contrat'); $nbElements += $project->getElementCount('contract', 'contrat');
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$nbElements += $project->getElementCount('intervention', 'fichinter'); $nbElements += $project->getElementCount('intervention', 'fichinter');
} }
if (isModEnabled("expedition")) { if (isModEnabled("expedition")) {
@ -177,7 +177,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (isModEnabled('expensereport')) { if (isModEnabled('expensereport')) {
$nbElements += $project->getElementCount('expensereport', 'expensereport'); $nbElements += $project->getElementCount('expensereport', 'expensereport');
} }
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
$nbElements += $project->getElementCount('donation', 'don'); $nbElements += $project->getElementCount('donation', 'don');
} }
if (!empty($conf->loan->enabled)) { if (!empty($conf->loan->enabled)) {
@ -189,7 +189,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (isModEnabled('project')) { if (isModEnabled('project')) {
$nbElements += $project->getElementCount('project_task', 'projet_task'); $nbElements += $project->getElementCount('project_task', 'projet_task');
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$nbElements += $project->getElementCount('stock_mouvement', 'stock'); $nbElements += $project->getElementCount('stock_mouvement', 'stock');
} }
if (!empty($conf->salaries->enabled)) { if (!empty($conf->salaries->enabled)) {

View File

@ -276,7 +276,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
print '<td class="center">'.$langs->trans("DateCreation").'</td>'; print '<td class="center">'.$langs->trans("DateCreation").'</td>';
print '<td class="center">'.$langs->trans("DateDeliveryPlanned").'</td>'; print '<td class="center">'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td class="center">'.$langs->trans("QtyPreparedOrShipped").'</td>'; print '<td class="center">'.$langs->trans("QtyPreparedOrShipped").'</td>';
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td>'.$langs->trans("Warehouse").'</td>'; print '<td>'.$langs->trans("Warehouse").'</td>';
} }
/*TODO Add link to expeditiondet_batch /*TODO Add link to expeditiondet_batch
@ -385,7 +385,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
print '<td class="center">'.$objp->qty_shipped.'</td>'; print '<td class="center">'.$objp->qty_shipped.'</td>';
// Warehouse // Warehouse
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td>'; print '<td>';
if ($objp->warehouse_id > 0) { if ($objp->warehouse_id > 0) {
$warehousestatic->fetch($objp->warehouse_id); $warehousestatic->fetch($objp->warehouse_id);

View File

@ -107,7 +107,7 @@ function user_prepare_head(User $object)
} }
// Notifications // Notifications
if ($user->socid == 0 && !empty($conf->notification->enabled)) { if ($user->socid == 0 && isModEnabled('notification')) {
$nbNote = 0; $nbNote = 0;
$sql = "SELECT COUNT(n.rowid) as nb"; $sql = "SELECT COUNT(n.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n"; $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";

View File

@ -162,7 +162,7 @@ class modBanque extends DolibarrModules
"s.nom"=>"company", "s.code_compta"=>"company", "s.code_compta_fournisseur"=>"company" "s.nom"=>"company", "s.code_compta"=>"company", "s.code_compta_fournisseur"=>"company"
); );
$this->export_special_array[$r] = array('-b.amount'=>'NULLIFNEG', 'b.amount'=>'NULLIFNEG'); $this->export_special_array[$r] = array('-b.amount'=>'NULLIFNEG', 'b.amount'=>'NULLIFNEG');
if ((empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled) || empty($conf->supplier_invoice->enabled)) { if ((!isModEnabled('fournisseur') && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order') || !isModEnabled('supplier_invoice')) {
unset($this->export_fields_array[$r]['s.code_compta_fournisseur']); unset($this->export_fields_array[$r]['s.code_compta_fournisseur']);
unset($this->export_entities_array[$r]['s.code_compta_fournisseur']); unset($this->export_entities_array[$r]['s.code_compta_fournisseur']);
} }

View File

@ -154,7 +154,7 @@ class modCategorie extends DolibarrModules
if (!empty($conf->bank->enabled)) { if (!empty($conf->bank->enabled)) {
$typeexample .= ($typeexample ? " / " : "")."8=Bank line"; $typeexample .= ($typeexample ? " / " : "")."8=Bank line";
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$typeexample .= ($typeexample ? " / " : "")."9=Warehouse"; $typeexample .= ($typeexample ? " / " : "")."9=Warehouse";
} }
if (isModEnabled('agenda')) { if (isModEnabled('agenda')) {
@ -180,7 +180,7 @@ class modCategorie extends DolibarrModules
$this->export_code[$r] = $this->rights_class.'_0_'.Categorie::$MAP_ID_TO_CODE[0]; $this->export_code[$r] = $this->rights_class.'_0_'.Categorie::$MAP_ID_TO_CODE[0];
$this->export_label[$r] = 'CatProdList'; $this->export_label[$r] = 'CatProdList';
$this->export_icon[$r] = $this->picto; $this->export_icon[$r] = $this->picto;
$this->export_enabled[$r] = 'isModEnabled("product") || !empty($conf->service->enabled)'; $this->export_enabled[$r] = 'isModEnabled("product") || isModEnabled("service")';
$this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export")); $this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export"));
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label'); $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label');
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.label'=>'Text'); $this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.label'=>'Text');

View File

@ -214,7 +214,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") || !empty($conf->margin->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('e.ref'=>'DefaultWarehouse', 'p.tobatch'=>'ManageLotSerial', 'p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('e.ref'=>'DefaultWarehouse', 'p.tobatch'=>'ManageLotSerial', 'p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -252,7 +252,7 @@ class modProduct extends DolibarrModules
'p.tva_tx'=>'Numeric', 'p.tva_tx'=>'Numeric',
'p.datec'=>'Date', 'p.tms'=>'Date' 'p.datec'=>'Date', 'p.tms'=>'Date'
); );
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('e.ref'=>'Text', 'p.tobatch'=>'Numeric', 'p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('e.ref'=>'Text', 'p.tobatch'=>'Numeric', 'p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -271,7 +271,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category')); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -286,7 +286,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
$this->export_dependencies_array[$r] = array('category'=>'p.rowid'); $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -316,7 +316,7 @@ class modProduct extends DolibarrModules
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON e.rowid = p.fk_default_warehouse'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON e.rowid = p.fk_default_warehouse';
} }
$this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')'; $this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
@ -409,7 +409,7 @@ class modProduct extends DolibarrModules
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell", 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' 'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
); );
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -425,7 +425,7 @@ class modProduct extends DolibarrModules
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
'p.datec'=>'Date', 'p.tms'=>'Date' 'p.datec'=>'Date', 'p.tms'=>'Date'
); );
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -441,7 +441,7 @@ class modProduct extends DolibarrModules
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct", 'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct" 'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
); );
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct')); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -601,7 +601,7 @@ class modProduct extends DolibarrModules
'p.recuperableonly' => '^[0|1]$', 'p.recuperableonly' => '^[0|1]$',
); );
if (!empty($conf->stock->enabled)) {//if Stock module enabled if (isModEnabled('stock')) {//if Stock module enabled
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.fk_default_warehouse'=>'DefaultWarehouse', 'p.fk_default_warehouse'=>'DefaultWarehouse',
'p.tobatch'=>'ManageLotSerial', 'p.tobatch'=>'ManageLotSerial',
@ -710,7 +710,7 @@ class modProduct extends DolibarrModules
'p.finished' => '0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.'c_product_nature"' 'p.finished' => '0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.'c_product_nature"'
); );
//clauses copied from import_fields_array //clauses copied from import_fields_array
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$import_sample = array_merge($import_sample, array( $import_sample = array_merge($import_sample, array(
'p.tobatch'=>"0 (don't use) / 1 (use batch) / 2 (use serial number)", 'p.tobatch'=>"0 (don't use) / 1 (use batch) / 2 (use serial number)",
'p.seuil_stock_alerte' => '', 'p.seuil_stock_alerte' => '',

View File

@ -179,7 +179,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") || !empty($conf->margin->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -215,7 +215,7 @@ class modService extends DolibarrModules
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric',
'p.datec'=>'Date', 'p.tms'=>'Date' 'p.datec'=>'Date', 'p.tms'=>'Date'
); );
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -234,7 +234,7 @@ class modService extends DolibarrModules
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category')); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -249,7 +249,7 @@ class modService extends DolibarrModules
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
$this->export_dependencies_array[$r] = array('category'=>'p.rowid'); $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -368,7 +368,7 @@ class modService extends DolibarrModules
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell", 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' 'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
); );
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -384,7 +384,7 @@ class modService extends DolibarrModules
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
'p.datec'=>'Date', 'p.tms'=>'Date' 'p.datec'=>'Date', 'p.tms'=>'Date'
); );
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -400,7 +400,7 @@ class modService extends DolibarrModules
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct", 'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct" 'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
); );
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct')); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
} }
if (isModEnabled('barcode')) { if (isModEnabled('barcode')) {
@ -548,7 +548,7 @@ class modService extends DolibarrModules
'p.recuperableonly' => '^[0|1]$', 'p.recuperableonly' => '^[0|1]$',
); );
if (!empty($conf->stock->enabled)) {//if Stock module enabled if (isModEnabled('stock')) {//if Stock module enabled
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.fk_default_warehouse'=>'DefaultWarehouse', 'p.fk_default_warehouse'=>'DefaultWarehouse',
'p.tobatch'=>'ManageLotSerial', 'p.tobatch'=>'ManageLotSerial',
@ -656,7 +656,7 @@ class modService extends DolibarrModules
'p.finished' => '0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.'c_product_nature"' 'p.finished' => '0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.'c_product_nature"'
); );
//clauses copied from import_fields_array //clauses copied from import_fields_array
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$import_sample = array_merge($import_sample, array( $import_sample = array_merge($import_sample, array(
'p.seuil_stock_alerte' => '', 'p.seuil_stock_alerte' => '',
'p.pmp' => '0', 'p.pmp' => '0',

View File

@ -413,7 +413,7 @@ class modSociete extends DolibarrModules
't.libelle'=>"company", 't.libelle'=>"company",
's.entity'=>'company', 's.entity'=>'company',
); // We define here only fields that use another picto ); // We define here only fields that use another picto
if (empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if (!isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
unset($this->export_fields_array[$r]['s.code_fournisseur']); unset($this->export_fields_array[$r]['s.code_fournisseur']);
unset($this->export_entities_array[$r]['s.code_fournisseur']); unset($this->export_entities_array[$r]['s.code_fournisseur']);
} }

View File

@ -58,7 +58,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
if (isModEnabled('contrat')) { if (isModEnabled('contrat')) {
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
} }
if (isModEnabled('deplacement')) { if (isModEnabled('deplacement')) {

View File

@ -59,7 +59,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
if (isModEnabled('contrat')) { if (isModEnabled('contrat')) {
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
} }
if (isModEnabled('deplacement')) { if (isModEnabled('deplacement')) {

View File

@ -41,7 +41,7 @@ if (empty($object) || !is_object($object)) {
exit; exit;
} }
$usemargins = 0; $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; $usemargins = 1;
} }
if (!isset($dateSelector)) { if (!isset($dateSelector)) {
@ -184,7 +184,7 @@ if ($nolinesbefore) {
$freelines = true; $freelines = true;
$forceall = 1; // We always force all type for free lines (module product or service means we use predefined product or service) $forceall = 1; // We always force all type for free lines (module product or service means we use predefined product or service)
if ($object->element == 'contrat') { if ($object->element == 'contrat') {
if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { if (!isModEnabled('product') && !isModEnabled('service') && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
$forceall = -1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set $forceall = -1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set
} elseif (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { } elseif (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
$forceall = 3; $forceall = 3;
@ -196,7 +196,7 @@ if ($nolinesbefore) {
if ($forceall >= 0 && (isModEnabled("product") || isModEnabled("service"))) { if ($forceall >= 0 && (isModEnabled("product") || isModEnabled("service"))) {
echo '<label for="prod_entry_mode_free">'; echo '<label for="prod_entry_mode_free">';
echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"'; echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') ); //echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (!isModEnabled('product') || !isModEnabled('service')))?' checked':'') );
echo ((GETPOST('prod_entry_mode', 'alpha') == 'free' || !empty($conf->global->MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT)) ? ' checked' : ''); echo ((GETPOST('prod_entry_mode', 'alpha') == 'free' || !empty($conf->global->MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT)) ? ' checked' : '');
echo '> '; echo '> ';
// Show type selector // Show type selector
@ -207,7 +207,7 @@ if ($nolinesbefore) {
echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">'; echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
// Show type selector // Show type selector
if ($forceall >= 0) { if ($forceall >= 0) {
if (empty($conf->product->enabled) || empty($conf->service->enabled)) { if (!isModEnabled('product') || !isModEnabled('service')) {
echo $langs->trans("Type"); echo $langs->trans("Type");
} else { } else {
echo $langs->trans("FreeLineOfType"); echo $langs->trans("FreeLineOfType");
@ -230,17 +230,17 @@ if ($nolinesbefore) {
$labelforradio = ''; $labelforradio = '';
if (empty($conf->dol_optimize_smallscreen)) { if (empty($conf->dol_optimize_smallscreen)) {
if (empty($senderissupplier)) { if (empty($senderissupplier)) {
if (isModEnabled("product") && empty($conf->service->enabled)) { if (isModEnabled("product") && !isModEnabled('service')) {
$labelforradio = $langs->trans('PredefinedProductsToSell'); $labelforradio = $langs->trans('PredefinedProductsToSell');
} elseif ((empty($conf->product->enabled) && isModEnabled("service")) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) { } elseif ((!isModEnabled('product') && isModEnabled('service')) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) {
$labelforradio = $langs->trans('PredefinedServicesToSell'); $labelforradio = $langs->trans('PredefinedServicesToSell');
} else { } else {
$labelforradio = $langs->trans('PredefinedProductsAndServicesToSell'); $labelforradio = $langs->trans('PredefinedProductsAndServicesToSell');
} }
} else { } else {
if (isModEnabled("product") && empty($conf->service->enabled)) { if (isModEnabled("product") && !isModEnabled('service')) {
$labelforradio = $langs->trans('PredefinedProductsToPurchase'); $labelforradio = $langs->trans('PredefinedProductsToPurchase');
} elseif (empty($conf->product->enabled) && isModEnabled("service")) { } elseif (!isModEnabled('product') && isModEnabled('service')) {
$labelforradio = $langs->trans('PredefinedServicesToPurchase'); $labelforradio = $langs->trans('PredefinedServicesToPurchase');
} else { } else {
$labelforradio = $langs->trans('PredefinedProductsAndServicesToPurchase'); $labelforradio = $langs->trans('PredefinedProductsAndServicesToPurchase');
@ -338,7 +338,7 @@ if ($nolinesbefore) {
} }
if (isModEnabled("product") || isModEnabled("service")) { if (isModEnabled("product") || isModEnabled("service")) {
echo '<br>'; echo '<br>';
if (!empty($conf->variants->enabled)) { if (isModEnabled('variants')) {
echo '<div id="attributes_box"></div>'; echo '<div id="attributes_box"></div>';
} }
} }

View File

@ -118,7 +118,7 @@ if (isModEnabled('adherent')) {
} }
print '<br>'; print '<br>';
} }
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
print '<div id="donation"></div>'; print '<div id="donation"></div>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>'; print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n"; print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n";

View File

@ -433,7 +433,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($action == 'TICKET_CREATE') { if ($action == 'TICKET_CREATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Auto link contract // Auto link contract
if (!empty($conf->contract->enabled) && !empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_LINK_CONTRACT) && !empty($conf->global->TICKET_PRODUCT_CATEGORY) && !empty($object->fk_soc)) { if (!empty($conf->contract->enabled) && isModEnabled('ticket') && isModEnabled('ficheinter') && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_LINK_CONTRACT) && !empty($conf->global->TICKET_PRODUCT_CATEGORY) && !empty($object->fk_soc)) {
$societe = new Societe($this->db); $societe = new Societe($this->db);
$company_ids = (empty($conf->global->WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS)) ? [$object->fk_soc] : $societe->getParentsForCompany($object->fk_soc, [$object->fk_soc]); $company_ids = (empty($conf->global->WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS)) ? [$object->fk_soc] : $societe->getParentsForCompany($object->fk_soc, [$object->fk_soc]);
@ -463,7 +463,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
} }
} }
// Automatically create intervention // Automatically create intervention
if (!empty($conf->ficheinter->enabled) && !empty($conf->ticket->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION)) { if (isModEnabled('ficheinter') && isModEnabled('ticket') && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION)) {
$fichinter = new Fichinter($this->db); $fichinter = new Fichinter($this->db);
$fichinter->socid = (int) $object->fk_soc; $fichinter->socid = (int) $object->fk_soc;
$fichinter->fk_project = $projectid; $fichinter->fk_project = $projectid;

View File

@ -66,7 +66,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) || empty($conf->notification->enabled)) { if (empty($conf->notification) || !isModEnabled('notification')) {
return 0; // Module not active, we do nothing return 0; // Module not active, we do nothing
} }
@ -135,9 +135,9 @@ class InterfaceNotification extends DolibarrTriggers
$element = $obj->elementtype; $element = $obj->elementtype;
// Exclude events if related module is disabled // Exclude events if related module is disabled
if ($element == 'order_supplier' && ((empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))) { if ($element == 'order_supplier' && ((!isModEnabled('fournisseur') && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))) {
$qualified = 0; $qualified = 0;
} elseif ($element == 'invoice_supplier' && ((empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_invoice->enabled))) { } elseif ($element == 'invoice_supplier' && ((!isModEnabled('fournisseur') && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_invoice'))) {
$qualified = 0; $qualified = 0;
} elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) { } elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) {
$qualified = 0; $qualified = 0;

View File

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

View File

@ -41,7 +41,7 @@ if (isModEnabled("product") || isModEnabled("service")) {
if (!empty($conf->expedition_bon->enabled)) { if (!empty($conf->expedition_bon->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
} }
if (isModEnabled('project')) { if (isModEnabled('project')) {
@ -104,7 +104,7 @@ if ($action == 'add') {
$object->commande_id = GETPOST("commande_id", 'int'); $object->commande_id = GETPOST("commande_id", 'int');
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled)) { if (!$conf->expedition_bon->enabled && isModEnabled('stock')) {
$expedition->entrepot_id = GETPOST('entrepot_id', 'int'); $expedition->entrepot_id = GETPOST('entrepot_id', 'int');
} }
@ -491,7 +491,7 @@ if ($action == 'create') {
print '<td colspan="3">'.$object->getLibStatut(4)."</td>\n"; print '<td colspan="3">'.$object->getLibStatut(4)."</td>\n";
print '</tr>';*/ print '</tr>';*/
if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled)) { if (!$conf->expedition_bon->enabled && isModEnabled('stock')) {
// Entrepot // Entrepot
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
$entrepot->fetch($object->entrepot_id); $entrepot->fetch($object->entrepot_id);

View File

@ -91,7 +91,7 @@ print load_fiche_titre($langs->trans("DonationsArea"), '', 'object_donation');
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // TODO Add a search into global search combo so we can remove this if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // TODO Add a search into global search combo so we can remove this
if (!empty($conf->don->enabled) && $user->rights->don->lire) { if (isModEnabled('don') && $user->rights->don->lire) {
$listofsearchfields['search_donation'] = array('text'=>'Donation'); $listofsearchfields['search_donation'] = array('text'=>'Donation');
} }

View File

@ -352,7 +352,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
$rowspan++; $sectionauto[] = array('position'=>130, 'level'=>1, 'module'=>'project', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); $rowspan++; $sectionauto[] = array('position'=>130, 'level'=>1, 'module'=>'project', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
$rowspan++; $sectionauto[] = array('position'=>140, 'level'=>1, 'module'=>'project_task', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks"))); $rowspan++; $sectionauto[] = array('position'=>140, 'level'=>1, 'module'=>'project_task', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$langs->load("interventions"); $langs->load("interventions");
$rowspan++; $sectionauto[] = array('position'=>150, 'level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); $rowspan++; $sectionauto[] = array('position'=>150, 'level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
} }

View File

@ -147,7 +147,7 @@ if (isModEnabled('tax')) {
if (isModEnabled('project')) { if (isModEnabled('project')) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
} }
if (isModEnabled('expensereport')) { if (isModEnabled('expensereport')) {

View File

@ -391,7 +391,7 @@ if (empty($reshook)) {
} }
} elseif (!$error) { } elseif (!$error) {
$labelfieldmissing = $langs->transnoentitiesnoconv("QtyToShip"); $labelfieldmissing = $langs->transnoentitiesnoconv("QtyToShip");
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$labelfieldmissing .= '/'.$langs->transnoentitiesnoconv("Warehouse"); $labelfieldmissing .= '/'.$langs->transnoentitiesnoconv("Warehouse");
} }
setEventMessages($langs->trans("ErrorFieldRequired", $labelfieldmissing), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $labelfieldmissing), null, 'errors');
@ -739,7 +739,7 @@ if (empty($reshook)) {
unset($_POST[$qty]); unset($_POST[$qty]);
} }
} }
} elseif (empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. } elseif (!isModEnabled('stock') && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated.
$qty = "qtyl".$line_id; $qty = "qtyl".$line_id;
$line->id = $line_id; $line->id = $line_id;
$line->qty = GETPOST($qty, 'int'); $line->qty = GETPOST($qty, 'int');
@ -865,7 +865,7 @@ if ($action == 'create') {
$author = new User($db); $author = new User($db);
$author->fetch($object->user_author_id); $author->fetch($object->user_author_id);
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
} }
@ -1077,7 +1077,7 @@ if ($action == 'create') {
} }
print '<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans("Reset"), 'eraser').'</span>'; print '<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans("Reset"), 'eraser').'</span>';
print '</td>'; print '</td>';
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
if (empty($conf->productbatch->enabled)) { if (empty($conf->productbatch->enabled)) {
print '<td class="left">'.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')</td>'; print '<td class="left">'.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')</td>';
} else { } else {
@ -1212,7 +1212,7 @@ if ($action == 'create') {
} }
$warehouseObject = null; $warehouseObject = null;
if (count($warehousePicking) == 1 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !isModEnabled('stock')) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
print '<!-- Case warehouse already known or product not a predefined product -->'; print '<!-- Case warehouse already known or product not a predefined product -->';
//ship from preselected location //ship from preselected location
$stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0); // Convert to number $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0); // Convert to number
@ -1240,7 +1240,7 @@ if ($action == 'create') {
print '</td>'; print '</td>';
// Stock // Stock
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="left">'; print '<td class="left">';
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Type of product need stock change ? if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Type of product need stock change ?
// Show warehouse combo list // Show warehouse combo list
@ -1423,7 +1423,7 @@ if ($action == 'create') {
print '</td>'; print '</td>';
// Stock // Stock
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="left">'; print '<td class="left">';
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
print $tmpwarehouseObject->getNomUrl(0).' '; print $tmpwarehouseObject->getNomUrl(0).' ';
@ -1693,7 +1693,7 @@ if ($action == 'create') {
$text = $langs->trans("ConfirmValidateSending", $numref); $text = $langs->trans("ConfirmValidateSending", $numref);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
@ -2045,7 +2045,7 @@ if ($action == 'create') {
} }
if ($action == 'editline') { if ($action == 'editline') {
$editColspan = 3; $editColspan = 3;
if (empty($conf->stock->enabled)) { if (!isModEnabled('stock')) {
$editColspan--; $editColspan--;
} }
if (empty($conf->productbatch->enabled)) { if (empty($conf->productbatch->enabled)) {
@ -2057,7 +2057,7 @@ if ($action == 'create') {
} else { } else {
print $langs->trans("QtyShipped").' - '; print $langs->trans("QtyShipped").' - ';
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print $langs->trans("WarehouseSource").' - '; print $langs->trans("WarehouseSource").' - ';
} }
if (isModEnabled('productbatch')) { if (isModEnabled('productbatch')) {
@ -2070,7 +2070,7 @@ if ($action == 'create') {
} else { } else {
print '<td class="center linecolqtyshipped">'.$langs->trans("QtyShipped").'</td>'; print '<td class="center linecolqtyshipped">'.$langs->trans("QtyShipped").'</td>';
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="left linecolwarehousesource">'.$langs->trans("WarehouseSource").'</td>'; print '<td class="left linecolwarehousesource">'.$langs->trans("WarehouseSource").'</td>';
} }
@ -2255,7 +2255,7 @@ if ($action == 'create') {
print $shipment_static->getNomUrl(1); print $shipment_static->getNomUrl(1);
print ' - '.$shipmentline_var['qty_shipped']; print ' - '.$shipmentline_var['qty_shipped'];
$htmltext = $langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($shipmentline_var['date_valid'], 'dayhour')); $htmltext = $langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($shipmentline_var['date_valid'], 'dayhour'));
if (!empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0) { if (isModEnabled('stock') && $shipmentline_var['warehouse'] > 0) {
$warehousestatic->fetch($shipmentline_var['warehouse']); $warehousestatic->fetch($shipmentline_var['warehouse']);
$htmltext .= '<br>'.$langs->trans("FromLocation").' : '.$warehousestatic->getNomUrl(1, '', 0, 1); $htmltext .= '<br>'.$langs->trans("FromLocation").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
} }
@ -2292,7 +2292,7 @@ if ($action == 'create') {
// Batch number managment // Batch number managment
print '<td>'.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).'</td>'; print '<td>'.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).'</td>';
print '</tr>'; print '</tr>';
} elseif (!empty($conf->stock->enabled)) { } elseif (isModEnabled('stock')) {
if ($lines[$i]->fk_product > 0) { if ($lines[$i]->fk_product > 0) {
if ($lines[$i]->entrepot_id > 0) { if ($lines[$i]->entrepot_id > 0) {
print '<!-- case edit 2 -->'; print '<!-- case edit 2 -->';
@ -2331,7 +2331,7 @@ if ($action == 'create') {
print '<td></td>'; print '<td></td>';
print '</tr>'; print '</tr>';
} }
} elseif (empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. } elseif (!isModEnabled('stock') && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated.
print '<!-- case edit 6 -->'; print '<!-- case edit 6 -->';
print '<tr>'; print '<tr>';
// Qty to ship or shipped // Qty to ship or shipped
@ -2349,7 +2349,7 @@ if ($action == 'create') {
print '<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.' '.$unit_order.'</td>'; print '<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.' '.$unit_order.'</td>';
// Warehouse source // Warehouse source
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="linecolwarehousesource left">'; print '<td class="linecolwarehousesource left">';
if ($lines[$i]->entrepot_id > 0) { if ($lines[$i]->entrepot_id > 0) {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
@ -2452,7 +2452,7 @@ if ($action == 'create') {
if (isModEnabled('productbatch')) { if (isModEnabled('productbatch')) {
$colspan++; $colspan++;
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$colspan++; $colspan++;
} }

View File

@ -707,7 +707,7 @@ class Expedition extends CommonObject
} }
// If stock increment is done on sending (recommanded choice) // If stock increment is done on sending (recommanded choice)
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -913,7 +913,7 @@ class Expedition extends CommonObject
$line->rang = $orderline->rang; $line->rang = $orderline->rang;
$line->product_type = $orderline->product_type; $line->product_type = $orderline->product_type;
if (!empty($conf->stock->enabled) && !empty($orderline->fk_product)) { if (isModEnabled('stock') && !empty($orderline->fk_product)) {
$fk_product = $orderline->fk_product; $fk_product = $orderline->fk_product;
if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) { if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) {
@ -2150,7 +2150,7 @@ class Expedition extends CommonObject
$this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback $this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback
// If stock increment is done on closing // If stock increment is done on closing
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -2327,7 +2327,7 @@ class Expedition extends CommonObject
$this->billed = 0; $this->billed = 0;
// If stock increment is done on closing // If stock increment is done on closing
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");

View File

@ -38,7 +38,7 @@ if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
} }
if (isModEnabled("propal")) { if (isModEnabled("propal")) {
@ -431,7 +431,7 @@ if ($id > 0 || !empty($ref)) {
print '</tr>'; print '</tr>';
// Warehouse // Warehouse
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
print '<tr><td>'; print '<tr><td>';
@ -642,7 +642,7 @@ if ($id > 0 || !empty($ref)) {
print '<th class="center">'.$langs->trans("QtyOrdered").'</th>'; print '<th class="center">'.$langs->trans("QtyOrdered").'</th>';
print '<th class="center">'.$langs->trans("QtyShipped").'</th>'; print '<th class="center">'.$langs->trans("QtyShipped").'</th>';
print '<th class="center">'.$langs->trans("KeepToShip").'</th>'; print '<th class="center">'.$langs->trans("KeepToShip").'</th>';
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<th class="center">'.$langs->trans("RealStock").'</th>'; print '<th class="center">'.$langs->trans("RealStock").'</th>';
} else { } else {
print '<th>&nbsp;</th>'; print '<th>&nbsp;</th>';
@ -794,7 +794,7 @@ if ($id > 0 || !empty($ref)) {
$product->load_stock('warehouseopen'); $product->load_stock('warehouseopen');
} }
if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && !empty($conf->stock->enabled)) { if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && isModEnabled('stock')) {
print '<td class="center">'; print '<td class="center">';
print $product->stock_reel; print $product->stock_reel;
if ($product->stock_reel < $toBeShipped[$objp->fk_product]) { if ($product->stock_reel < $toBeShipped[$objp->fk_product]) {
@ -858,7 +858,7 @@ if ($id > 0 || !empty($ref)) {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Bouton expedier sans gestion des stocks // Bouton expedier sans gestion des stocks
if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) { if (!isModEnabled('stock') && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
if ($user->rights->expedition->creer) { if ($user->rights->expedition->creer) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create&amp;origin=commande&amp;object_id='.$id.'">'.$langs->trans("CreateShipment").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create&amp;origin=commande&amp;object_id='.$id.'">'.$langs->trans("CreateShipment").'</a>';
if ($toBeShippedTotal <= 0) { if ($toBeShippedTotal <= 0) {
@ -874,11 +874,11 @@ if ($id > 0 || !empty($ref)) {
// Bouton expedier avec gestion des stocks // Bouton expedier avec gestion des stocks
if (!empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT) { if (isModEnabled('stock') && $object->statut == Commande::STATUS_DRAFT) {
print $langs->trans("ValidateOrderFirstBeforeShipment"); print $langs->trans("ValidateOrderFirstBeforeShipment");
} }
if (!empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) { if (isModEnabled('stock') && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
if ($user->rights->expedition->creer) { if ($user->rights->expedition->creer) {
//print load_fiche_titre($langs->trans("CreateShipment")); //print load_fiche_titre($langs->trans("CreateShipment"));
print '<div class="tabsAction">'; print '<div class="tabsAction">';
@ -896,7 +896,7 @@ if ($id > 0 || !empty($ref)) {
//print '<tr>'; //print '<tr>';
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
//print '<td>'; //print '<td>';
print $langs->trans("WarehouseSource"); print $langs->trans("WarehouseSource");
//print '</td>'; //print '</td>';

View File

@ -170,7 +170,7 @@ if ($resql) {
/* /*
* Draft orders * Draft orders
*/ */
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$sql = "SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid"; $sql = "SELECT f.rowid, f.ref, s.nom as name, s.rowid as socid";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe as s";
@ -293,7 +293,7 @@ if ($resql) {
* interventions to process * interventions to process
*/ */
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$sql = "SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid"; $sql = "SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe as s";

View File

@ -93,7 +93,7 @@ if ($idprod > 0) {
} }
// After best supplier prices and before costprice // After best supplier prices and before costprice
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
// Add price for pmp // Add price for pmp
$price = $producttmp->pmp; $price = $producttmp->pmp;
if (empty($price) && !empty($conf->global->PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY)) { if (empty($price) && !empty($conf->global->PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY)) {

View File

@ -1097,7 +1097,7 @@ class CommandeFournisseur extends CommonOrder
} }
// If stock is incremented on validate order, we must increment it // If stock is incremented on validate order, we must increment it
if (!$error && $movetoapprovestatus && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) { if (!$error && $movetoapprovestatus && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -2085,7 +2085,7 @@ class CommandeFournisseur extends CommonOrder
} }
// If module stock is enabled and the stock increase is done on purchase order dispatching // If module stock is enabled and the stock increase is done on purchase order dispatching
if (!$error && $entrepot > 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { if (!$error && $entrepot > 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
$mouv = new MouvementStock($this->db); $mouv = new MouvementStock($this->db);
if ($product > 0) { if ($product > 0) {
// $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on) // $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on)

View File

@ -762,7 +762,7 @@ class FactureFournisseur extends CommonInvoice
// else we get the best supplier price // else we get the best supplier price
if ($conf->global->MARGIN_TYPE == 'costprice' && !empty($producttmp->cost_price)) { if ($conf->global->MARGIN_TYPE == 'costprice' && !empty($producttmp->cost_price)) {
$buyprice = $producttmp->cost_price; $buyprice = $producttmp->cost_price;
} elseif (!empty($conf->stock->enabled) && ($conf->global->MARGIN_TYPE == 'costprice' || $conf->global->MARGIN_TYPE == 'pmp') && !empty($producttmp->pmp)) { } elseif (isModEnabled('stock') && ($conf->global->MARGIN_TYPE == 'costprice' || $conf->global->MARGIN_TYPE == 'pmp') && !empty($producttmp->pmp)) {
$buyprice = $producttmp->pmp; $buyprice = $producttmp->pmp;
} else { } else {
if ($producttmp->find_min_price_product_fournisseur($_facrec->lines[$i]->fk_product) > 0) { if ($producttmp->find_min_price_product_fournisseur($_facrec->lines[$i]->fk_product) > 0) {
@ -1812,7 +1812,7 @@ class FactureFournisseur extends CommonInvoice
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
// Si on incrémente le produit principal et ses composants à la validation de facture fournisseur // Si on incrémente le produit principal et ses composants à la validation de facture fournisseur
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -1943,7 +1943,7 @@ class FactureFournisseur extends CommonInvoice
} }
// Si on incremente le produit principal et ses composants a la validation de facture fournisseur, on decremente // Si on incremente le produit principal et ses composants a la validation de facture fournisseur, on decremente
if ($result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { if ($result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");

View File

@ -58,7 +58,7 @@ if (isModEnabled('project')) {
} }
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
if (!empty($conf->variants->enabled)) { if (isModEnabled('variants')) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
} }
@ -485,7 +485,7 @@ if (empty($reshook)) {
$error++; $error++;
} }
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) { if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination //Check if there is a product with the given combination
$prodcomb = new ProductCombination($db); $prodcomb = new ProductCombination($db);
@ -990,7 +990,7 @@ if (empty($reshook)) {
} }
// Check parameters // Check parameters
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) { // warning name of option should be STOCK_CALCULATE_ON_SUPPLIER_APPROVE_ORDER if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) { // warning name of option should be STOCK_CALCULATE_ON_SUPPLIER_APPROVE_ORDER
if (!$idwarehouse || $idwarehouse == -1) { if (!$idwarehouse || $idwarehouse == -1) {
$error++; $error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
@ -1926,7 +1926,7 @@ if ($action == 'create') {
$action = ''; $action = '';
} else { } else {
$text = $langs->trans('ConfirmValidateOrder', $newref); $text = $langs->trans('ConfirmValidateOrder', $newref);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
@ -1947,7 +1947,7 @@ if ($action == 'create') {
} }
$formquestion = array(); $formquestion = array();
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $qualified_for_stock_change) {
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -1963,7 +1963,7 @@ if ($action == 'create') {
); );
} }
$text = $langs->trans("ConfirmApproveThisOrder", $object->ref); $text = $langs->trans("ConfirmApproveThisOrder", $object->ref);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
@ -2561,7 +2561,7 @@ if ($action == 'create') {
// Ship // Ship
$hasreception = 0; $hasreception = 0;
if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { if (isModEnabled('stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
$labelofbutton = $langs->trans('ReceiveProducts'); $labelofbutton = $langs->trans('ReceiveProducts');
if ($conf->reception->enabled) { if ($conf->reception->enabled) {
$labelofbutton = $langs->trans("CreateReception"); $labelofbutton = $langs->trans("CreateReception");

View File

@ -96,7 +96,7 @@ if (empty($conf->reception->enabled)) {
// $id is id of a purchase order. // $id is id of a purchase order.
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande'); $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
if (empty($conf->stock->enabled)) { if (!isModEnabled('stock')) {
accessforbidden(); accessforbidden();
} }
@ -408,7 +408,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive
$error++; $error++;
} else { } else {
// If module stock is enabled and the stock increase is done on purchase order dispatching // If module stock is enabled and the stock increase is done on purchase order dispatching
if ($entrepot > 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) && empty($supplierorderdispatch->fk_reception)) { if ($entrepot > 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) && empty($supplierorderdispatch->fk_reception)) {
$mouv = new MouvementStock($db); $mouv = new MouvementStock($db);
if ($product > 0) { if ($product > 0) {
$mouv->origin = &$object; $mouv->origin = &$object;
@ -455,7 +455,7 @@ if ($action == 'updateline' && $permissiontoreceive) {
$errors = $supplierorderdispatch->errors; $errors = $supplierorderdispatch->errors;
} else { } else {
// If module stock is enabled and the stock increase is done on purchase order dispatching // If module stock is enabled and the stock increase is done on purchase order dispatching
if ($entrepot > 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { if ($entrepot > 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
$mouv = new MouvementStock($db); $mouv = new MouvementStock($db);
if ($product > 0) { if ($product > 0) {
$mouv->origin = &$object; $mouv->origin = &$object;

View File

@ -55,7 +55,7 @@ if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
if (!empty($conf->variants->enabled)) { if (isModEnabled('variants')) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
} }
if (isModEnabled('accounting')) { if (isModEnabled('accounting')) {
@ -212,7 +212,7 @@ if (empty($reshook)) {
} }
// Check parameters // Check parameters
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) {
$langs->load("stocks"); $langs->load("stocks");
if (!$idwarehouse || $idwarehouse == -1) { if (!$idwarehouse || $idwarehouse == -1) {
$error++; $error++;
@ -1465,7 +1465,7 @@ if (empty($reshook)) {
$error++; $error++;
} }
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) { if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination //Check if there is a product with the given combination
$prodcomb = new ProductCombination($db); $prodcomb = new ProductCombination($db);
@ -1743,7 +1743,7 @@ if (empty($reshook)) {
} }
// Check parameters // Check parameters
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) {
$langs->load("stocks"); $langs->load("stocks");
if (!$idwarehouse || $idwarehouse == -1) { if (!$idwarehouse || $idwarehouse == -1) {
$error++; $error++;
@ -2704,7 +2704,7 @@ if ($action == 'create') {
$action = ''; $action = '';
} else { } else {
$text = $langs->trans('ConfirmValidateBill', $numref); $text = $langs->trans('ConfirmValidateBill', $numref);
/*if (!empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
$notify=new Notify($db); $notify=new Notify($db);
@ -2720,7 +2720,7 @@ if ($action == 'create') {
$qualified_for_stock_change = $object->hasProductsOrServices(1); $qualified_for_stock_change = $object->hasProductsOrServices(1);
} }
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) {
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -2752,7 +2752,7 @@ if ($action == 'create') {
} else { } else {
$qualified_for_stock_change = $object->hasProductsOrServices(1); $qualified_for_stock_change = $object->hasProductsOrServices(1);
} }
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) {
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);

View File

@ -213,8 +213,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position');
if ((empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) if ((!isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))
|| (empty($conf->supplier_invoice->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) { || (!isModEnabled('supplier_invoice') && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) {
accessforbidden(); accessforbidden();
} }
if ((empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) if ((empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))

View File

@ -124,8 +124,8 @@ if ($user->socid) {
// require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; // require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
// $object = new PaiementFourn($db); // $object = new PaiementFourn($db);
// restrictedArea($user, $object->element); // restrictedArea($user, $object->element);
if ((empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) if ((!isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))
|| (empty($conf->supplier_invoice->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) { || (!isModEnabled('supplier_invoice') && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) {
accessforbidden(); accessforbidden();
} }
if ((empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) if ((empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))

View File

@ -128,7 +128,7 @@ if ($object->id > 0) {
$help_url = ''; $help_url = '';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = establishment_prepare_head($object); $head = establishment_prepare_head($object);

View File

@ -138,7 +138,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En'; $help_url = 'EN:Module_Agenda_En';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = evaluationPrepareHead($object); $head = evaluationPrepareHead($object);

View File

@ -353,7 +353,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
$text = $langs->trans('ConfirmValidateEvaluation', $numref); $text = $langs->trans('ConfirmValidateEvaluation', $numref);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';

View File

@ -138,7 +138,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En'; $help_url = 'EN:Module_Agenda_En';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = jobPrepareHead($object); $head = jobPrepareHead($object);

View File

@ -140,7 +140,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En'; $help_url = 'EN:Module_Agenda_En';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = positionCardPrepareHead($object); $head = positionCardPrepareHead($object);

View File

@ -139,7 +139,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En'; $help_url = 'EN:Module_Agenda_En';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = skillPrepareHead($object); $head = skillPrepareHead($object);

View File

@ -130,7 +130,7 @@ if ($object->id > 0) {
$help_url = ''; $help_url = '';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = knowledgerecordPrepareHead($object); $head = knowledgerecordPrepareHead($object);

View File

@ -294,7 +294,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...)
if ($action == 'close') { if ($action == 'close') {
$text = $langs->trans('ConfirmCloseKM', $object->ref); $text = $langs->trans('ConfirmCloseKM', $object->ref);
/*if (!empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
@ -319,7 +319,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...)
if ($action == 'reopen') { if ($action == 'reopen') {
$text = $langs->trans('ConfirmReopenKM', $object->ref); $text = $langs->trans('ConfirmReopenKM', $object->ref);
/*if (!empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);

View File

@ -190,7 +190,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En'; $help_url = 'EN:Module_Agenda_En';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = myobjectPrepareHead($object); $head = myobjectPrepareHead($object);

View File

@ -347,7 +347,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...)
if ($action == 'xxx') { if ($action == 'xxx') {
$text = $langs->trans('ConfirmActionMyObject', $object->ref); $text = $langs->trans('ConfirmActionMyObject', $object->ref);
/*if (!empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);

View File

@ -134,7 +134,7 @@ if ($object->id > 0) {
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Agenda'; $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Agenda';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = moPrepareHead($object); $head = moPrepareHead($object);

View File

@ -427,7 +427,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
$text = $langs->trans('ConfirmValidateMo', $numref); $text = $langs->trans('ConfirmValidateMo', $numref);
/*if (!empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);

View File

@ -473,7 +473,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
$text = $langs->trans('ConfirmValidateMo', $numref); $text = $langs->trans('ConfirmValidateMo', $numref);
/*if (!empty($conf->notification->enabled)) /*if (isModEnabled('notification'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);

View File

@ -130,7 +130,7 @@ if ($object->id > 0) {
$help_url = ''; $help_url = '';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = partnershipPrepareHead($object); $head = partnershipPrepareHead($object);

View File

@ -370,7 +370,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel minwidth400', 'value' => '') // Field to complete private note (not replace) array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel minwidth400', 'value' => '') // Field to complete private note (not replace)
); );
// if (!empty($conf->notification->enabled)) { // if (isModEnabled('notification')) {
// require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; // require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
// $notify = new Notify($db); // $notify = new Notify($db);
// $formquestion = array_merge($formquestion, array( // $formquestion = array_merge($formquestion, array(

View File

@ -545,7 +545,7 @@ print '<td>'.$langs->trans("VariantsAbility").'</td>';
print '<td class="right">'; print '<td class="right">';
//print ajax_constantonoff("PRODUIT_SOUSPRODUITS", array(), $conf->entity, 0, 0, 1, 0); //print ajax_constantonoff("PRODUIT_SOUSPRODUITS", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno("PRODUIT_SOUSPRODUITS", $conf->global->PRODUIT_SOUSPRODUITS, 1); //print $form->selectyesno("PRODUIT_SOUSPRODUITS", $conf->global->PRODUIT_SOUSPRODUITS, 1);
if (empty($conf->variants->enabled)) { if (!isModEnabled('variants')) {
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabled", $langs->transnoentitiesnoconv("Module610Name")).'</span>'; print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabled", $langs->transnoentitiesnoconv("Module610Name")).'</span>';
} else { } else {
print yn(1).' <span class="opacitymedium">('.$langs->trans("ModuleIsEnabled", $langs->transnoentitiesnoconv("Module610Name")).')</span>'; print yn(1).' <span class="opacitymedium">('.$langs->trans("ModuleIsEnabled", $langs->transnoentitiesnoconv("Module610Name")).')</span>';

View File

@ -144,7 +144,7 @@ if ($id > 0 || $ref) {
} }
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$type = $langs->trans('Product'); $type = $langs->trans('Product');

View File

@ -43,7 +43,7 @@ print dol_get_fiche_head('');
<input type="hidden" name="action" value="add"> <input type="hidden" name="action" value="add">
<input type="hidden" name="type" value="0"> <input type="hidden" name="type" value="0">
<input type="hidden" name="canvas" value="<?php echo $canvas; ?>"> <input type="hidden" name="canvas" value="<?php echo $canvas; ?>">
<?php if (empty($conf->stock->enabled)) { ?> <?php if (!isModEnabled('stock')) { ?>
<input name="seuil_stock_alerte" type="hidden" value="0"> <input name="seuil_stock_alerte" type="hidden" value="0">
<?php } ?> <?php } ?>
@ -72,7 +72,7 @@ print dol_get_fiche_head('');
<td><?php echo $form->selectarray('statut_buy', $statutarray, $object->status_buy); ?></td> <td><?php echo $form->selectarray('statut_buy', $statutarray, $object->status_buy); ?></td>
</tr> </tr>
<?php if (!empty($conf->stock->enabled)) { ?> <?php if (isModEnabled('stock')) { ?>
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td> <tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
<input name="seuil_stock_alerte" size="4" value="<?php echo $object->seuil_stock_alerte; ?>"> <input name="seuil_stock_alerte" size="4" value="<?php echo $object->seuil_stock_alerte; ?>">
</td></tr> </td></tr>

View File

@ -42,7 +42,7 @@ dol_htmloutput_errors($object->error, $object->errors);
<input type="hidden" name="action" value="update"> <input type="hidden" name="action" value="update">
<input type="hidden" name="id" value="<?php echo $object->id; ?>"> <input type="hidden" name="id" value="<?php echo $object->id; ?>">
<input type="hidden" name="canvas" value="<?php echo $object->canvas; ?>"> <input type="hidden" name="canvas" value="<?php echo $object->canvas; ?>">
<?php if (empty($conf->stock->enabled)) { ?> <?php if (!isModEnabled('stock')) { ?>
<input name="seuil_stock_alerte" type="hidden" value="0"> <input name="seuil_stock_alerte" type="hidden" value="0">
<?php } ?> <?php } ?>
@ -69,7 +69,7 @@ dol_htmloutput_errors($object->error, $object->errors);
<td><?php echo $form->selectarray('statut_buy', $statutarray, $object->status_buy); ?></td> <td><?php echo $form->selectarray('statut_buy', $statutarray, $object->status_buy); ?></td>
</tr> </tr>
<?php if (!empty($conf->stock->enabled)) { ?> <?php if (isModEnabled('stock')) { ?>
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td> <tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
<input name="seuil_stock_alerte" size="4" value="<?php echo $object->seuil_stock_alerte; ?>"> <input name="seuil_stock_alerte" size="4" value="<?php echo $object->seuil_stock_alerte; ?>">
</td></tr> </td></tr>

View File

@ -71,13 +71,13 @@ if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
} }
if (!empty($conf->bom->enabled)) { if (isModEnabled('bom')) {
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
} }
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('products', 'other')); $langs->loadLangs(array('products', 'other'));
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$langs->load("stocks"); $langs->load("stocks");
} }
if (isModEnabled('facture')) { if (isModEnabled('facture')) {
@ -1457,7 +1457,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>'; print '</td></tr>';
} }
if ($type != 1 && !empty($conf->stock->enabled)) { if ($type != 1 && isModEnabled('stock')) {
// Default warehouse // Default warehouse
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>'; print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
@ -2017,7 +2017,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
// Stock // Stock
if ($object->isProduct() && !empty($conf->stock->enabled)) { if ($object->isProduct() && isModEnabled('stock')) {
// Default warehouse // Default warehouse
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>'; print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
@ -2074,7 +2074,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
} }
if (!$object->isService() && !empty($conf->bom->enabled)) { if (!$object->isService() && isModEnabled('bom')) {
print '<tr><td>'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).'</td><td>'; print '<tr><td>'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).'</td><td>';
$bomkey = "Bom:bom/class/bom.class.php:0:t.status=1 AND t.fk_product=".((int) $object->id); $bomkey = "Bom:bom/class/bom.class.php:0:t.status=1 AND t.fk_product=".((int) $object->id);
print $form->selectForForms($bomkey, 'fk_default_bom', $object->fk_default_bom, 1); print $form->selectForForms($bomkey, 'fk_default_bom', $object->fk_default_bom, 1);
@ -2515,7 +2515,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
// Default warehouse // Default warehouse
if ($object->isProduct() && !empty($conf->stock->enabled)) { if ($object->isProduct() && isModEnabled('stock')) {
$warehouse = new Entrepot($db); $warehouse = new Entrepot($db);
$warehouse->fetch($object->fk_default_warehouse); $warehouse->fetch($object->fk_default_warehouse);
@ -2534,7 +2534,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
// Parent product. // Parent product.
if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) { if (isModEnabled('variants') && ($object->isProduct() || $object->isService())) {
$combination = new ProductCombination($db); $combination = new ProductCombination($db);
if ($combination->fetchByFkProductChild($object->id) > 0) { if ($combination->fetchByFkProductChild($object->id) > 0) {
@ -2584,7 +2584,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
} }
if (!$object->isService() && !empty($conf->bom->enabled) && $object->finished) { if (!$object->isService() && isModEnabled('bom') && $object->finished) {
print '<tr><td class="titlefield">'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).'</td><td>'; print '<tr><td class="titlefield">'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).'</td><td>';
if ($object->fk_default_bom) { if ($object->fk_default_bom) {
$bom_static = new BOM($db); $bom_static = new BOM($db);

View File

@ -1279,7 +1279,7 @@ class Product extends CommonObject
} }
if (!$error) { if (!$error) {
if (!empty($conf->variants->enabled)) { if (isModEnabled('variants')) {
include_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; include_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
$comb = new ProductCombination($this->db); $comb = new ProductCombination($this->db);
@ -4762,7 +4762,7 @@ class Product extends CommonObject
public function isVariant() public function isVariant()
{ {
global $conf; global $conf;
if (!empty($conf->variants->enabled)) { if (isModEnabled('variants')) {
$sql = "SELECT rowid FROM ".$this->db->prefix()."product_attribute_combination WHERE fk_product_child = ".((int) $this->id)." AND entity IN (".getEntity('product').")"; $sql = "SELECT rowid FROM ".$this->db->prefix()."product_attribute_combination WHERE fk_product_child = ".((int) $this->id)." AND entity IN (".getEntity('product').")";
$query = $this->db->query($sql); $query = $this->db->query($sql);

View File

@ -369,7 +369,7 @@ if ($id > 0 || !empty($ref)) {
// Min customer price // Min customer price
print '<td class="right" colspan="2">'.$langs->trans('MinCustomerPrice').'</td>'; print '<td class="right" colspan="2">'.$langs->trans('MinCustomerPrice').'</td>';
// Stock // Stock
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="right">'.$langs->trans('Stock').'</td>'; print '<td class="right">'.$langs->trans('Stock').'</td>';
} }
// Qty in kit // Qty in kit
@ -444,7 +444,7 @@ if ($id > 0 || !empty($ref)) {
print '</td>'; print '</td>';
// Stock // Stock
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="right">'.$value['stock'].'</td>'; // Real stock print '<td class="right">'.$value['stock'].'</td>'; // Real stock
} }
@ -493,7 +493,7 @@ if ($id > 0 || !empty($ref)) {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
// Stock // Stock
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td></td>'; // Real stock print '<td></td>'; // Real stock
} }
@ -549,7 +549,7 @@ if ($id > 0 || !empty($ref)) {
print '</td>'; print '</td>';
// Stock // Stock
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="liste_total right">&nbsp;</td>'; print '<td class="liste_total right">&nbsp;</td>';
} }
@ -566,7 +566,7 @@ if ($id > 0 || !empty($ref)) {
print '</tr>'."\n"; print '</tr>'."\n";
} else { } else {
$colspan = 10; $colspan = 10;
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$colspan++; $colspan++;
} }

View File

@ -95,7 +95,7 @@ $optioncss = GETPOST('optioncss', 'alpha');
$type = GETPOST("type", "int"); $type = GETPOST("type", "int");
//Show/hide child products //Show/hide child products
if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$show_childproducts = GETPOST('search_show_childproducts'); $show_childproducts = GETPOST('search_show_childproducts');
} else { } else {
$show_childproducts = ''; $show_childproducts = '';
@ -234,10 +234,10 @@ $arrayfields = array(
'p.numbuyprice'=>array('label'=>"BuyingPriceNumShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43), 'p.numbuyprice'=>array('label'=>"BuyingPriceNumShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>43),
'p.pmp'=>array('label'=>"PMPValueShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44), 'p.pmp'=>array('label'=>"PMPValueShort", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>44),
'p.cost_price'=>array('label'=>"CostPrice", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>45), 'p.cost_price'=>array('label'=>"CostPrice", 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire)), 'position'=>45),
'p.seuil_stock_alerte'=>array('label'=>"StockLimit", 'checked'=>0, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>50), 'p.seuil_stock_alerte'=>array('label'=>"StockLimit", 'checked'=>0, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>50),
'p.desiredstock'=>array('label'=>"DesiredStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>51), 'p.desiredstock'=>array('label'=>"DesiredStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>51),
'p.stock'=>array('label'=>"PhysicalStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>52), 'p.stock'=>array('label'=>"PhysicalStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>52),
'stock_virtual'=>array('label'=>"VirtualStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $virtualdiffersfromphysical), 'position'=>53), 'stock_virtual'=>array('label'=>"VirtualStock", 'checked'=>1, 'enabled'=>(isModEnabled('stock') && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $virtualdiffersfromphysical), 'position'=>53),
'p.tobatch'=>array('label'=>"ManageLotSerial", 'checked'=>0, 'enabled'=>(isModEnabled('productbatch')), 'position'=>60), 'p.tobatch'=>array('label'=>"ManageLotSerial", 'checked'=>0, 'enabled'=>(isModEnabled('productbatch')), 'position'=>60),
'p.fk_country'=>array('label'=>"Country", 'checked'=>0, 'position'=>100), 'p.fk_country'=>array('label'=>"Country", 'checked'=>0, 'position'=>100),
'p.fk_state'=>array('label'=>"State", 'checked'=>0, 'position'=>101), 'p.fk_state'=>array('label'=>"State", 'checked'=>0, 'position'=>101),
@ -419,7 +419,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ' p.fk_unit, cu.label as cu_label,'; $sql .= ' p.fk_unit, cu.label as cu_label,';
} }
$sql .= ' MIN(pfp.unitprice) as minsellprice'; $sql .= ' MIN(pfp.unitprice) as minsellprice';
if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= ', pac.rowid prod_comb_id'; $sql .= ', pac.rowid prod_comb_id';
} }
// Add fields from extrafields // Add fields from extrafields
@ -448,7 +448,7 @@ if (getDolGlobalInt('MAIN_MULTILANGS')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$db->escape($langs->getDefaultLang())."'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$db->escape($langs->getDefaultLang())."'";
} }
if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
} }
if (!empty($conf->global->PRODUCT_USE_UNITS)) { if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -469,7 +469,7 @@ if (dol_strlen($search_type) && $search_type != '-1') {
} }
} }
if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= " AND pac.rowid IS NULL"; $sql .= " AND pac.rowid IS NULL";
} }
@ -580,7 +580,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ', p.fk_unit, cu.label'; $sql .= ', p.fk_unit, cu.label';
} }
if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= ', pac.rowid'; $sql .= ', pac.rowid';
} }
// Add fields from extrafields // Add fields from extrafields
@ -837,7 +837,7 @@ if ($resql) {
} }
//Show/hide child products. Hidden by default //Show/hide child products. Hidden by default
if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>'; $moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>'; $moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';
@ -1360,7 +1360,7 @@ if ($resql) {
} }
// STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock. // STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
if ((!empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
if ($obj->fk_product_type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service if ($obj->fk_product_type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service
$option = 'nobatch'; $option = 'nobatch';
if (empty($arrayfields['stock_virtual']['checked'])) { if (empty($arrayfields['stock_virtual']['checked'])) {

View File

@ -110,7 +110,7 @@ if ($id > 0 || !empty($ref)) {
/* /*
* Affichage onglets * Affichage onglets
*/ */
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }

View File

@ -48,7 +48,7 @@ if (!empty($conf->project->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
} }
if (!empty($conf->variants->enabled)) { if (isModEnabled('variants')) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';

View File

@ -116,7 +116,7 @@ if ($object->id > 0) {
$help_url = ''; $help_url = '';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
if (!empty($conf->notification->enabled)) $langs->load("mails"); if (isModEnabled('notification')) $langs->load("mails");
$head = stocktransferPrepareHead($object); $head = stocktransferPrepareHead($object);

View File

@ -1276,7 +1276,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
if (empty($reshook)) { if (empty($reshook)) {
if ($action != "edit" && $action != 'presend') { if ($action != "edit" && $action != 'presend') {
// Create event // Create event
/*if ($conf->agenda->enabled && !empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a /*if (isModEnabled('agenda') && !empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
// "workflow" action so should appears somewhere else on // "workflow" action so should appears somewhere else on
// page. // page.
{ {
@ -1292,7 +1292,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
// Accounting Report // Accounting Report
/* /*
$accouting_module_activated = !empty($conf->comptabilite->enabled) || isModEnabled('accounting'); $accouting_module_activated = isModEnabled('comptabilite') || isModEnabled('accounting');
if ($accouting_module_activated && $object->statut != Project::STATUS_DRAFT) { if ($accouting_module_activated && $object->statut != Project::STATUS_DRAFT) {
$start = dol_getdate((int) $object->date_start); $start = dol_getdate((int) $object->date_start);
$end = dol_getdate((int) $object->date_end); $end = dol_getdate((int) $object->date_end);
@ -1369,7 +1369,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
$langs->load("suppliers"); $langs->load("suppliers");
print dolGetButtonAction('', $langs->trans('AddSupplierInvoice'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true)); print dolGetButtonAction('', $langs->trans('AddSupplierInvoice'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
} }
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) { if (isModEnabled('ficheinter') && $user->rights->ficheinter->creer) {
$langs->load("interventions"); $langs->load("interventions");
print dolGetButtonAction('', $langs->trans('AddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true)); print dolGetButtonAction('', $langs->trans('AddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
} }
@ -1381,7 +1381,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
$langs->load("trips"); $langs->load("trips");
print dolGetButtonAction('', $langs->trans('AddTrip'), 'default', DOL_URL_ROOT.'/expensereport/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true)); print dolGetButtonAction('', $langs->trans('AddTrip'), 'default', DOL_URL_ROOT.'/expensereport/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
} }
if (!empty($conf->don->enabled) && $user->rights->don->creer) { if (isModEnabled('don') && $user->rights->don->creer) {
$langs->load("donations"); $langs->load("donations");
print dolGetButtonAction('', $langs->trans('AddDonation'), 'default', DOL_URL_ROOT.'/don/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true)); print dolGetButtonAction('', $langs->trans('AddDonation'), 'default', DOL_URL_ROOT.'/don/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid, '', 1, array('isDropDown' => true));
} }

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
} }
if (isModEnabled("propal")) { if (isModEnabled("propal")) {
@ -62,7 +62,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
if (isModEnabled('contrat')) { if (isModEnabled('contrat')) {
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
} }
if (isModEnabled("expedition")) { if (isModEnabled("expedition")) {
@ -77,14 +77,14 @@ if (isModEnabled('expensereport')) {
if (isModEnabled('agenda')) { if (isModEnabled('agenda')) {
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
} }
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
} }
if (!empty($conf->loan->enabled)) { if (!empty($conf->loan->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
} }
if (isModEnabled('tax')) { if (isModEnabled('tax')) {
@ -114,7 +114,7 @@ if (isModEnabled('commande')) {
if (isModEnabled("propal")) { if (isModEnabled("propal")) {
$langs->load("propal"); $langs->load("propal");
} }
if (!empty($conf->ficheinter->enabled)) { if (isModEnabled('ficheinter')) {
$langs->load("interventions"); $langs->load("interventions");
} }
if (isModEnabled('deplacement')) { if (isModEnabled('deplacement')) {
@ -123,7 +123,7 @@ if (isModEnabled('deplacement')) {
if (isModEnabled('expensereport')) { if (isModEnabled('expensereport')) {
$langs->load("trips"); $langs->load("trips");
} }
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
$langs->load("donations"); $langs->load("donations");
} }
if (!empty($conf->loan->enabled)) { if (!empty($conf->loan->enabled)) {
@ -716,7 +716,7 @@ if (!$showdatefilter) {
$langs->loadLangs(array("suppliers", "bills", "orders", "proposals", "margins")); $langs->loadLangs(array("suppliers", "bills", "orders", "proposals", "margins"));
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$langs->load('stocks'); $langs->load('stocks');
} }

View File

@ -1060,7 +1060,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
} }
if ( !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer) { if ( isModEnabled('ficheinter') && $user->rights->ficheinter->creer) {
$langs->load("interventions"); $langs->load("interventions");
$arrayofmassactions['generateinter'] = $langs->trans("GenerateInter"); $arrayofmassactions['generateinter'] = $langs->trans("GenerateInter");
} }

View File

@ -57,7 +57,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
// Security check // Security check
if (empty($conf->don->enabled)) { if (!isModEnabled('don')) {
httponly_accessforbidden('Module Donation not enabled'); httponly_accessforbidden('Module Donation not enabled');
} }

View File

@ -91,7 +91,7 @@ if (!empty($conf->global->TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST))
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
if (empty($conf->ticket->enabled)) { if (!isModEnabled('ticket')) {
httponly_accessforbidden('Module Ticket not enabled'); httponly_accessforbidden('Module Ticket not enabled');
} }

View File

@ -59,7 +59,7 @@ $track_id = GETPOST('track_id', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$suffix = ""; $suffix = "";
if (empty($conf->ticket->enabled)) { if (!isModEnabled('ticket')) {
httponly_accessforbidden('Module Ticket not enabled'); httponly_accessforbidden('Module Ticket not enabled');
} }

View File

@ -79,7 +79,7 @@ $object = new Ticket($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('ticketpubliclist', 'globalcard')); $hookmanager->initHooks(array('ticketpubliclist', 'globalcard'));
if (empty($conf->ticket->enabled)) { if (!isModEnabled('ticket')) {
httponly_accessforbidden('Module Ticket not enabled'); httponly_accessforbidden('Module Ticket not enabled');
} }

View File

@ -73,7 +73,7 @@ if (isset($_SESSION['email_customer'])) {
$object = new ActionsTicket($db); $object = new ActionsTicket($db);
if (empty($conf->ticket->enabled)) { if (!isModEnabled('ticket')) {
httponly_accessforbidden('Module Ticket not enabled'); httponly_accessforbidden('Module Ticket not enabled');
} }

View File

@ -752,7 +752,7 @@ if ($action == 'create') {
$author = new User($db); $author = new User($db);
$author->fetch($objectsrc->user_author_id); $author->fetch($objectsrc->user_author_id);
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
} }
@ -1039,7 +1039,7 @@ if ($action == 'create') {
print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)'; print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)';
} }
print '</td>'; print '</td>';
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="left">'.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')</td>'; print '<td class="left">'.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')</td>';
} }
if (isModEnabled('productbatch')) { if (isModEnabled('productbatch')) {
@ -1173,7 +1173,7 @@ if ($action == 'create') {
$warehouseObject = null; $warehouseObject = null;
if (!empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection if (isModEnabled('stock')) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
print '<!-- Case warehouse already known or product not a predefined product -->'; print '<!-- Case warehouse already known or product not a predefined product -->';
$stock = + $product->stock_warehouse[$dispatchLines[$indiceAsked]['ent']]->real; // Convert to number $stock = + $product->stock_warehouse[$dispatchLines[$indiceAsked]['ent']]->real; // Convert to number
@ -1200,7 +1200,7 @@ if ($action == 'create') {
} }
// Stock // Stock
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="left">'; print '<td class="left">';
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Type of product need stock change ? if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Type of product need stock change ?
// Show warehouse combo list // Show warehouse combo list
@ -1323,7 +1323,7 @@ if ($action == 'create') {
$text = $langs->trans("ConfirmValidateReception", $numref); $text = $langs->trans("ConfirmValidateReception", $numref);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
$notify = new Notify($db); $notify = new Notify($db);
$text .= '<br>'; $text .= '<br>';
@ -1686,7 +1686,7 @@ if ($action == 'create') {
} }
if ($action == 'editline') { if ($action == 'editline') {
$editColspan = 3; $editColspan = 3;
if (empty($conf->stock->enabled)) { if (!isModEnabled('stock')) {
$editColspan--; $editColspan--;
} }
if (empty($conf->productbatch->enabled)) { if (empty($conf->productbatch->enabled)) {
@ -1698,7 +1698,7 @@ if ($action == 'create') {
} else { } else {
print $langs->trans("QtyReceived").' - '; print $langs->trans("QtyReceived").' - ';
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print $langs->trans("WarehouseSource").' - '; print $langs->trans("WarehouseSource").' - ';
} }
if (isModEnabled('productbatch')) { if (isModEnabled('productbatch')) {
@ -1718,7 +1718,7 @@ if ($action == 'create') {
} else { } else {
print '<td class="center">'.$langs->trans("QtyReceived").'</td>'; print '<td class="center">'.$langs->trans("QtyReceived").'</td>';
} }
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
print '<td class="left">'.$langs->trans("WarehouseSource").'</td>'; print '<td class="left">'.$langs->trans("WarehouseSource").'</td>';
} }
@ -1889,7 +1889,7 @@ if ($action == 'create') {
print ' - '.$receptionline_var['qty']; print ' - '.$receptionline_var['qty'];
$htmltext = $langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($receptionline_var['date_valid'], 'dayhour')); $htmltext = $langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($receptionline_var['date_valid'], 'dayhour'));
if (!empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0) { if (isModEnabled('stock') && $receptionline_var['warehouse'] > 0) {
$warehousestatic->fetch($receptionline_var['warehouse']); $warehousestatic->fetch($receptionline_var['warehouse']);
$htmltext .= '<br>'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1, '', 0, 1); $htmltext .= '<br>'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
} }
@ -1904,7 +1904,7 @@ if ($action == 'create') {
if ($action == 'editline' && $lines[$i]->id == $line_id) { if ($action == 'editline' && $lines[$i]->id == $line_id) {
// edit mode // edit mode
print '<td colspan="'.$editColspan.'" class="center"><table class="nobordernopadding">'; print '<td colspan="'.$editColspan.'" class="center"><table class="nobordernopadding">';
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
if ($lines[$i]->fk_product > 0) { if ($lines[$i]->fk_product > 0) {
print '<!-- case edit 1 -->'; print '<!-- case edit 1 -->';
print '<tr>'; print '<tr>';
@ -1944,7 +1944,7 @@ if ($action == 'create') {
print '<td class="center linecolqtytoreceive">'.$lines[$i]->qty.'</td>'; print '<td class="center linecolqtytoreceive">'.$lines[$i]->qty.'</td>';
// Warehouse source // Warehouse source
if (!empty($conf->stock->enabled)) { if (isModEnabled('stock')) {
if ($lines[$i]->fk_entrepot > 0) { if ($lines[$i]->fk_entrepot > 0) {
$entrepot = new Entrepot($db); $entrepot = new Entrepot($db);
$entrepot->fetch($lines[$i]->fk_entrepot); $entrepot->fetch($lines[$i]->fk_entrepot);

View File

@ -546,7 +546,7 @@ class Reception extends CommonObject
} }
// If stock increment is done on reception (recommanded choice) // If stock increment is done on reception (recommanded choice)
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)) { if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -824,7 +824,7 @@ class Reception extends CommonObject
} }
$fk_product = 0; $fk_product = 0;
if (!empty($conf->stock->enabled) && !empty($supplierorderline->fk_product)) { if (isModEnabled('stock') && !empty($supplierorderline->fk_product)) {
$fk_product = $supplierorderline->fk_product; $fk_product = $supplierorderline->fk_product;
if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_RECEPTIONS)) { if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_RECEPTIONS)) {
@ -1554,7 +1554,7 @@ class Reception extends CommonObject
// If stock increment is done on closing // If stock increment is done on closing
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");
@ -1719,7 +1719,7 @@ class Reception extends CommonObject
$this->billed = 0; $this->billed = 0;
// If stock increment is done on closing // If stock increment is done on closing
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$numref = $this->ref; $numref = $this->ref;
$langs->load("agenda"); $langs->load("agenda");
@ -1851,7 +1851,7 @@ class Reception extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
if ($this->db->query($sql)) { if ($this->db->query($sql)) {
// If stock increment is done on closing // If stock increment is done on closing
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)) { if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda"); $langs->load("agenda");

View File

@ -716,7 +716,7 @@ if ($massaction == 'createbills') {
print $langs->trans('ValidateInvoices'); print $langs->trans('ValidateInvoices');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
print $form->selectyesno('validate_invoices', 0, 1, 1); print $form->selectyesno('validate_invoices', 0, 1, 1);
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
} else { } else {

Some files were not shown because too many files have changed in this diff Show More