diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index a3c9a3d3bb4..3b79df6c5eb 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -202,7 +202,7 @@ if (!empty($triggers)) { print ''.$trigger['label'].''; print ''; $key = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; - $value = $conf->global->$key; + $value = getDolGlobalInt($key); print ''; print ''."\n"; } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 8389c7e0d82..8237911acaa 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -203,7 +203,7 @@ print ''.$langs->trans("AgendaExtSitesDesc")."\n"; -$selectedvalue=$conf->global->AGENDA_DISABLE_EXT; +$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT'); if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; print ""; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 3ed883bffa6..18797312ad8 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -333,7 +333,7 @@ print ''."\n"; print ''."\n"; // Manual or automatic @@ -395,7 +395,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltex print ' '."\n"; $tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); -print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); +print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW')); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; -$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); +$formactions->form_select_status_action('agenda', getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'), 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); print '
'; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 9ed5b5d0615..a3e9881516e 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -39,6 +39,23 @@ $langs->loadLangs(array("admin", "other", "agenda")); $def = array(); $actionsave = GETPOST('save', 'alpha'); +$MAIN_AGENDA_XCAL_EXPORTKEY = getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY'); +$MAIN_AGENDA_EXPORT_PAST_DELAY = getDolGlobalInt('MAIN_AGENDA_EXPORT_PAST_DELAY'); +$MAIN_AGENDA_EXPORT_CACHE = getDolGlobalInt('MAIN_AGENDA_EXPORT_CACHE'); +$AGENDA_EXPORT_FIX_TZ = getDolGlobalString('AGENDA_EXPORT_FIX_TZ'); + +if (GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) { + $MAIN_AGENDA_XCAL_EXPORTKEY = trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')); +} +if (GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) { + $MAIN_AGENDA_EXPORT_PAST_DELAY = intval(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'int')); +} +if (GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) { + $MAIN_AGENDA_EXPORT_CACHE = intval(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'int')); +} +if (GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) { + $AGENDA_EXPORT_FIX_TZ = trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')); +} // Sauvegardes parametres if ($actionsave) { @@ -46,10 +63,10 @@ if ($actionsave) { $db->begin(); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')), 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', $MAIN_AGENDA_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', $MAIN_AGENDA_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', $MAIN_AGENDA_EXPORT_CACHE, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', $AGENDA_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity); if ($i >= 4) { $db->commit(); @@ -98,7 +115,7 @@ print ""; print ''; print ''.$langs->trans("PasswordTogetVCalExport").""; -print ''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); } @@ -108,13 +125,13 @@ print ""; print ''; print "".$langs->trans("PastDelayVCalExport").""; -print "global->MAIN_AGENDA_EXPORT_PAST_DELAY)."\" size=\"10\"> ".$langs->trans("days").""; +print " ".$langs->trans("days").""; print " "; print ""; print ''; print "".$langs->trans("UseACacheDelay").""; -print "global->MAIN_AGENDA_EXPORT_CACHE)."\" size=\"10\">"; +print ""; print " "; print ""; @@ -131,7 +148,7 @@ print ""; print ''; print ''.$langs->trans("FixTZ").""; print ""; -print ''; +print ''; print '   '.$langs->trans("FillThisOnlyIfRequired"); print ""; print ""; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 895ce8c1b08..51de87d054e 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -64,9 +64,9 @@ if ($action == 'add' && GETPOST('update')) { // Click on button update must be u if ($action == 'add' && GETPOST('delete')) { // Click on button update must be used in priority before param $action $action = 'delete'; } -if ($action == 'update' && GETPOST('add')) { // Click on button add must be used in priority before param $action +/*if ($action == 'update' && GETPOST('add')) { // 'add' button is always clicked as it is the first in form. $action = 'add'; -} +}*/ if ($action == 'delete' && GETPOST('add')) { // Click on button add must be used in priority before param $action $action = 'add'; } @@ -234,7 +234,7 @@ if (isModEnabled('multicompany') && !$user->entity) { print ''; print ''; } -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index d0fd21c80a0..1b615ddeed1 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -43,7 +43,7 @@ $arrayofparameters = array( 'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), - 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) + 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>isModEnabled('ecm')) ); // To fix when dire does not exists @@ -124,6 +124,10 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $key => $val) { + if (isset($val['enabled']) && empty($val['enabled'])) { + continue; + } + print ''; $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); $label = $langs->trans($key); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 8b63c5842ba..2e87e76c7ce 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -513,7 +513,7 @@ $tabcond[25] = isModEnabled('website'); $tabcond[27] = isModEnabled("societe"); $tabcond[28] = isModEnabled('holiday'); $tabcond[29] = isModEnabled('project'); -$tabcond[30] = isModEnabled('label'); +$tabcond[30] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('adherent')); // stickers format dictionary //$tabcond[31]= isModEnabled('accounting'); $tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm')); $tabcond[33] = isModEnabled('hrm'); @@ -1571,7 +1571,6 @@ if ($id > 0) { unset($fieldlist[2]); // Remove field ??? if dictionary Regions } - if (empty($reshook)) { fieldList($fieldlist, $obj, $tabname[$id], 'add'); } @@ -2531,7 +2530,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') $classtd = 'right'; $class = 'maxwidth50 right'; } if (in_array($fieldlist[$field], array('pos', 'position'))) { - $classtd = 'center'; $class = 'maxwidth50 center'; + $classtd = 'right'; $class = 'maxwidth50 right'; } if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'use_default', 'affect', 'delay', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) { $class = 'maxwidth50 center'; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index a364b17cc4b..ec43ac75efc 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -364,7 +364,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -702,12 +702,14 @@ if (isModEnabled('banque')) { } print ""; +$FACTURE_CHQ_NUMBER = getDolGlobalInt('FACTURE_CHQ_NUMBER'); + print ''; print "".$langs->trans("SuggestPaymentByChequeToAddress").""; print ""; print ''; -if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && !isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) { +print ''; +if (getDolGlobalString('MAILING_EMAIL_ERRORSTO') && !isValidEmail(getDolGlobalString('MAILING_EMAIL_ERRORSTO'))) { print ' '.img_warning($langs->trans("BadEMail")); } print ''; @@ -160,7 +160,7 @@ print ''; print ''; print $form->textwithpicto($langs->trans("MailingDelay"), $langs->trans("IfDefinedUseAValueBeetween", '0.001', '10')).''; -print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 7b0d0acbf06..5e06ba4011f 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -190,7 +190,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -257,7 +257,7 @@ print "\n"; print ''; print $langs->trans("PaymentOnDifferentThirdBills"); print ''; -print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS, 1); +print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", getDolGlobalInt('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS'), 1); print ''; print "\n"; @@ -265,7 +265,7 @@ print "\n"; print ''; print $langs->trans("GroupPaymentsByModOnReports"); print ''; -print $form->selectyesno("PAYMENTS_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_REPORT_GROUP_BY_MOD, 1); +print $form->selectyesno("PAYMENTS_REPORT_GROUP_BY_MOD", getDolGlobalInt('PAYMENTS_REPORT_GROUP_BY_MOD'), 1); print ''; print "\n"; diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 05938e27d49..a1bf95d819f 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -329,7 +329,9 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ''; print ''; - // Create third-party with contact if email not linked to a contact + // Auto fill the contact found from email + // This option is a serious security hole. it allowe to any non looged perso, to get the database of contacts + /* print ''.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").''; print ''; if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) { @@ -342,6 +344,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help'); print ''; print ''; + */ /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 8d827ba09aa..50532de6e36 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -156,20 +156,31 @@ function mrpCollapseBomManagement() '."\n"; } + // Subject + if ($this->withtitletopic) { + print ''; + // Answer to a ticket : display of the thread title in readonly + if ($this->withtopicreadonly) { + print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; + } else { + if (isset($this->withreadid) && $this->withreadid > 0) { + $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.''; + } else { + $subject = GETPOST('subject', 'alpha'); + } + print 'withemail)?' autofocus':'').' />'; + } + print ''; + } + // MESSAGE $msg = GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ''; print ''; @@ -459,7 +465,7 @@ class FormTicket if (count($cate_arbo)) { // Categories print ''.$langs->trans("Categories").''; - print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } } @@ -854,6 +860,8 @@ class FormTicket print ' selected="selected"'; } elseif ($arraycategories['use_default'] == "1" && !$selected && !$empty) { print ' selected="selected"'; + } elseif (count($ticketstat->cache_category_tickets) == 1) { + print ' selected="selected"'; } print '>'; diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index b2b5e2c6e93..0408f9d3a3f 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -339,7 +339,7 @@ class Ldap * This method seems a duplicate/alias of unbind(). * * @return boolean true or false - * @deprecated ldap_close is an alias of ldap_unbind + * @deprecated ldap_close is an alias of ldap_unbind, so use unbind() instead. * @see unbind() */ public function close() @@ -401,7 +401,7 @@ class Ldap public function unbind() { $this->result = true; - if ($this->connection) { + if (is_resource($this->connection) || is_object($this->connection)) { $this->result = @ldap_unbind($this->connection); } if ($this->result) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 40fcbfbf12b..66b25f6740f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2324,14 +2324,12 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } $tmptxt = $object->getLibStatut(5); $morehtmlstatus .= $tmptxt; // No status on task - } else { // Generic case - if (isset($object->status)) { - $tmptxt = $object->getLibStatut(6); - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { - $tmptxt = $object->getLibStatut(5); - } - $morehtmlstatus .= $tmptxt; + } elseif (method_exists($object, 'getLibStatut')) { // Generic case + $tmptxt = $object->getLibStatut(6); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { + $tmptxt = $object->getLibStatut(5); } + $morehtmlstatus .= $tmptxt; } // Add if object was dispatched "into accountancy" @@ -2648,7 +2646,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $format = '%Y%m%d%H%M%S'; } elseif ($format == 'dayhourlogsmall') { // Format not sensitive to language - $format = '%Y%m%d%H%M'; + $format = '%y%m%d%H%M'; } elseif ($format == 'dayhourldap') { $format = '%Y%m%d%H%M%SZ'; } elseif ($format == 'dayhourxcard') { @@ -2731,8 +2729,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($timetouse); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', '%w', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', 'w', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4d9569a1cc4..e4f6b169e93 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2471,10 +2471,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); if (!empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / '; $linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['date_value'] = dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping, 'day', '', $outputlangs); } else { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); $linkedobjects[$objecttype]['ref_value'] .= ' / '.$outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['date_value'] = dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping, 'day', '', $outputlangs); } } } diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 273e7285273..64747c1bbf6 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -366,7 +366,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; print ''.$langs->trans("DefaultSkin").''; print ''.$conf->global->MAIN_THEME.''; - print ' '.$langs->trans("UsePersonalValue").''; + print ' '; print ' '; print ''; } else { diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 36d64132e40..27d84246a2d 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -53,7 +53,7 @@ class mod_facture_mercure extends ModeleNumRefFactures */ public function info() { - global $db, $conf, $langs; + global $db, $langs; $langs->load("bills"); @@ -137,35 +137,20 @@ class mod_facture_mercure extends ModeleNumRefFactures */ public function getNextValue($objsoc, $invoice, $mode = 'next') { - global $db, $conf; + global $db; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Get Mask value $mask = ''; if (is_object($invoice) && $invoice->type == 1) { - if (isset($conf->global->FACTURE_MERCURE_MASK_REPLACEMENT)) { - $mask = $conf->global->FACTURE_MERCURE_MASK_REPLACEMENT; - } - if (!$mask) { - if (isset($conf->global->FACTURE_MERCURE_MASK_INVOICE)) { - $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE; - } - } + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_REPLACEMENT', getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE')); } elseif (is_object($invoice) && $invoice->type == 2) { - if (isset($conf->global->FACTURE_MERCURE_MASK_CREDIT)) { - $mask = $conf->global->FACTURE_MERCURE_MASK_CREDIT; - } + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_CREDIT'); } elseif (is_object($invoice) && $invoice->type == 3) { - if (isset($conf->global->FACTURE_MERCURE_MASK_DEPOSIT)) { - $mask = $conf->global->FACTURE_MERCURE_MASK_DEPOSIT; - } + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_DEPOSIT'); } else { - if (isset($conf->global->FACTURE_MERCURE_MASK_INVOICE)) { - $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE; - } else { - $mask = ''; - } + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE'); } if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 03a6109bd67..6125053cbb4 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -61,7 +61,7 @@ class mod_payment_ant extends ModeleNumRefPayments */ public function info() { - global $db, $conf, $langs; + global $db, $langs; $langs->load("bills"); @@ -82,7 +82,7 @@ class mod_payment_ant extends ModeleNumRefPayments // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -128,7 +128,7 @@ class mod_payment_ant extends ModeleNumRefPayments require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->PAYMENT_ANT_MASK; + $mask = getDolGlobalString('PAYMENT_ANT_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index d1a64bcf039..8a35edc7968 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -117,13 +117,16 @@ class doc_generic_proposal_odt extends ModelePDFPropales $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('PROPALE_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= '
'; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -133,7 +136,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROPALE_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -159,7 +162,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -167,7 +170,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Scan directories $nbofiles = count($listoffiles); - if (!empty($conf->global->PROPALE_ADDON_PDF_ODT_PATH)) { + if (!empty($odtPath)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; $texte .= count($listoffiles); @@ -187,26 +190,26 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= '
'; // Set default template for different status of proposal - if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFPropales::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 116b6daf9be..6a8ecbc28c6 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -117,13 +117,16 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -133,7 +136,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -159,7 +162,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -167,7 +170,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // Scan directories $nbofiles = count($listoffiles); - if (!empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH)) { + if (!empty($odtPath)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; $texte .= count($listoffiles); @@ -185,26 +188,26 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } $texte .= '
'; - if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFSupplierProposal::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelSupplierProposalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelSupplierProposalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelSupplierProposalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index d4282eb80ec..063591e5486 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -64,7 +64,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal */ public function info() { - global $conf, $langs, $db; + global $langs, $db; $langs->load("bills"); @@ -83,9 +83,11 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); $tooltip .= $langs->trans("GenericMaskCodes5"); + $mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); + // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -131,7 +133,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // On defini critere recherche compteur - $mask = $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; + $mask = empty($conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK) ? '' : $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index e8a15b8f09a..81328821261 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -114,13 +114,16 @@ class doc_generic_user_odt extends ModelePDFUser $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('USER_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -130,7 +133,7 @@ class doc_generic_user_odt extends ModelePDFUser // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USER_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -156,7 +159,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -166,26 +169,26 @@ class doc_generic_user_odt extends ModelePDFUser if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { // Model for creation $list = ModelePDFUser::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->USER_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('USER_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->USER_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('USER_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->USER_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('USER_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 5700870444f..5ff9d4c8526 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -117,13 +117,16 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('USERGROUP_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -133,7 +136,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -159,7 +162,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -169,26 +172,26 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { // Model for creation $list = ModelePDFUserGroup::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index be24a555a3c..0f7dc25152b 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -187,10 +187,11 @@ if (($line->info_bits & 2) == 2) { if ($line->date_start || $line->date_end) { print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; } + if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test - if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { + if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'facture' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { $res = $line->fetch_product(); if ($res > 0 ) { if ($line->product->isService() && $line->product->isMandatoryPeriod()) { diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index ae53b01e19b..de46c09d3a2 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -1112,7 +1112,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $ret = $actioncomm->create($user); // User creating action if ($ret > 0 && !empty($conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)) { - if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { + if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { foreach ($object->attachedfiles['paths'] as $key => $filespath) { $srcfile = $filespath; $destdir = $conf->agenda->dir_output.'/'.$ret; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 089629234d6..99b8210644c 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -274,7 +274,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin = $langs->transnoentities($body, $object->track_id).'
'; $message_admin .= '