diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index d520c82bf35..9f86922aa5c 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.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.'/product/class/product.class.php'; -if (!empty($conf->categorie->enabled)) { +if (isModEnabled('categorie')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } @@ -42,7 +42,7 @@ if (!empty($conf->categorie->enabled)) { $langs->loadLangs(array("companies", "compta", "accountancy", "products")); // Security check -if (empty($conf->accounting->enabled)) { +if (!isModEnabled('accounting')) { accessforbidden(); } if (empty($user->rights->accounting->bind->write)) { @@ -522,7 +522,7 @@ if ($resql) { // Filter on categories $moreforfilter = ''; - if (!empty($conf->categorie->enabled) && $user->hasRight('categorie', 'lire')) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
| '.$langs->trans("Categories").' | '; print ''; print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); @@ -1813,7 +1813,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Third party Dolibarr - if (!empty($conf->societe->enabled)) { + if (isModEnabled('societe')) { print ' | |
| ';
$editenable = $user->rights->adherent->creer;
print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable);
@@ -1951,7 +1951,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Create third party
- if (!empty($conf->societe->enabled) && !$object->socid) {
+ if (isModEnabled('societe') && !$object->socid) {
if ($user->rights->societe->creer) {
if (Adherent::STATUS_DRAFT != $object->statut) {
print 'id.'&action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").''."\n";
@@ -1977,7 +1977,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Action SPIP
- if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) {
+ if (isModEnabled('mailmanspip') && !empty($conf->global->ADHERENT_USE_SPIP)) {
$isinspip = $mailmanspip->is_in_spip($object);
if ($isinspip == 1) {
@@ -2034,7 +2034,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
*/
// Show online payment link
- $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
+ $useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));
if ($useonlinepayment) {
print ' '; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 3fa4c4b3e7f..c19fa40c2bc 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -89,7 +89,7 @@ $arrayfields = array( 'd.firstname'=>array('label'=>"Firstname", 'checked'=>1), 'd.login'=>array('label'=>"Login", 'checked'=>1), 't.libelle'=>array('label'=>"Label", 'checked'=>1), - 'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))), + 'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(isModEnabled('banque'))), /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0), 'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/ 'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100), diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 52926cf1b19..3221738bcd3 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -184,7 +184,7 @@ if (!empty($triggers)) { } //print 'module='.$module.' code='.$trigger['code'].' '; - if (!empty($conf->$module->enabled)) { + if (isModEnabled('module')) { // Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { continue; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 79aa081ddef..166c24f2188 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -206,7 +206,7 @@ $job->fetch(0, 'ActionComm', 'sendEmailsReminder'); // AGENDA REMINDER EMAIL print ' | ||
| '.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")); -if (!empty($conf->cron->enabled)) { +if (isModEnabled('cron')) { if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) { if ($job->id > 0) { if ($job->status == $job::STATUS_ENABLED) { @@ -219,7 +219,7 @@ print ' | '."\n"; print ''."\n"; print ' | '."\n"; -if (empty($conf->cron->enabled)) { +if (!isModEnabled('cron')) { print ''.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module2300Name")).''; } else { if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 3ff36b356da..87fc937429c 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -835,7 +835,11 @@ class FormSetupItem } elseif ($this->type== 'color') { $out.= $this->generateInputFieldColor(); } elseif ($this->type == 'yesno') { - $out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1); + if (!empty($conf->use_javascript_ajax)) { + $out.= ajax_constantonoff($this->confKey); + } else { + $out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1); + } } elseif (preg_match('/emailtemplate:/', $this->type)) { $out.= $this->generateInputFieldEmailTemplate(); } elseif (preg_match('/category:/', $this->type)) { @@ -1032,7 +1036,7 @@ class FormSetupItem */ public function generateOutputField() { - global $conf, $user; + global $conf, $user, $langs; if (!empty($this->fieldOverride)) { return $this->fieldOverride; @@ -1057,7 +1061,15 @@ class FormSetupItem } elseif ($this->type== 'color') { $out.= $this->generateOutputFieldColor(); } elseif ($this->type == 'yesno') { - $out.= ajax_constantonoff($this->confKey); + if (!empty($conf->use_javascript_ajax)) { + $out.= ajax_constantonoff($this->confKey); + } else { + if ($this->fieldValue == 1) { + $out.= $langs->trans('yes'); + } else { + $out.= $langs->trans('no'); + } + } } elseif (preg_match('/emailtemplate:/', $this->type)) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($this->db); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index ac051fd92e0..cad97108733 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -416,7 +416,7 @@ function dol_print_object_info($object, $usetable = 0) } else { print ': '; } - if (is_object($object->user_approve)) { + if (!empty($object->user_approve) && is_object($object->user_approve)) { if ($object->user_approve->id) { print $object->user_approve->getNomUrl(-1, '', 0, 0, 0); } else { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c226ba927be..52b78aa1e5c 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1315,10 +1315,10 @@ if ($action == 'create') { $detail = ''; $detail .= $langs->trans("Batch").': '.$dbatch->batch; - if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + if (empty($conf->global->PRODUCT_DISABLE_SELLBY) && !empty($dbatch->sellby)) { $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); } - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + if (empty($conf->global->PRODUCT_DISABLE_EATBY) && !empty($dbatch->eatby)) { $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); } $detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty; @@ -1526,6 +1526,12 @@ if ($action == 'create') { } else { print 'TableLotIncompleteRunRepairWithParamStandardEqualConfirmed'; } + if (empty($conf->global->PRODUCT_DISABLE_SELLBY) && !empty($dbatch->sellby)) { + print ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY) && !empty($dbatch->eatby)) { + print ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day"); + } print ' ('.$dbatch->qty.')'; $quantityToBeDelivered -= $deliverableQty; if ($quantityToBeDelivered < 0) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c352faef1fc..8ac65f6cac3 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2084,6 +2084,10 @@ if ($action == 'create') { // Date if ($object->methode_commande_id > 0) { + $usehourmin = 0; + if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) { + $usehourmin = 1; + } print ' |
| '.$langs->trans("Date").' | '; print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin ? 'dayhour' : 'day') : ''; if ($object->hasDelay() && !empty($object->date_delivery) && !empty($object->date_commande)) { diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 08a66d1b8c6..40181167baa 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -41,6 +41,19 @@ if (empty($id)) { $id = $object->id; } +$pdluoid = GETPOST('pdluoid', 'int'); + +$pdluo = new Productbatch($db); + +if ($pdluoid > 0) { + $result = $pdluo->fetch($pdluoid); + if ($result > 0) { + $pdluoid = $pdluo->id; + } else { + dol_print_error($db, $pdluo->error, $pdluo->errors); + } +} + print ' | |