diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index fe21b8577ef..4936fadd326 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -314,7 +314,7 @@ if (!empty($search_categ) || !empty($catid)) { } $sql .= " d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,"; $sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; -$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,"; +$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,"; $sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; $sql .= " d.note_private, d.note_public,"; $sql .= " s.nom,"; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 6580db4e8f3..e1e468b0cec 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -275,8 +275,7 @@ print '

'; /* * Document templates generators */ -//if (! empty($conf->global->MAIN_FEATURES_LEVEL)) -//{ + print load_fiche_titre($langs->trans("BankAccountModelModule"), '', ''); // Load array def with activated templates @@ -466,8 +465,7 @@ print '

'; /* * Document templates generators */ -//if (! empty($conf->global->MAIN_FEATURES_LEVEL)) -//{ + print load_fiche_titre($langs->trans("Other"), '', ''); print "\n"; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 9c2b91ec586..2cbb14bb2dd 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -542,7 +542,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { $moreforfilter .= '
'; $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1); $moreforfilter .= '
'; - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); if ($conf->global->MAIN_FEATURES_LEVEL < 0) { $array_version['deprecated'] = $langs->trans("Deprecated"); diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 207642fe8e3..88a02e90457 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -297,7 +297,7 @@ foreach ($dirmodels as $reldir) $module = new $classname($db); $modulequalified=1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; if ($modulequalified) { diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 10b3d1bd47b..2f272cd986f 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -187,8 +187,6 @@ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY) && $user->entity) { } -//print "conf->global->MAIN_FEATURES_LEVEL = ".$conf->global->MAIN_FEATURES_LEVEL."

\n"; - // Output mode print load_fiche_titre($langs->trans("SyslogOutput"), '', ''); @@ -207,7 +205,7 @@ foreach ($syslogModules as $moduleName) { $moduleactive = (int) $module->isActive(); //print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."
\n"; - if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) { + if (($moduleactive == -1) && getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0) { continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them) } diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index f07623ed5d0..e9a6eaeb390 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -556,7 +556,7 @@ if ($mode == 'searchkey') { print ''.img_edit_add($langs->trans("TranslationOverwriteKey")).''; } - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { $transifexlangfile = '$'; // $ means 'All' //$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key; $transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c046281f18e..896448d7b9a 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2679,7 +2679,7 @@ if ($action == 'create') { $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList); // Show online signature link - $useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok + $useonlinesignature = 1; // Replace this with 1 when feature to make online signature is ok if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) { print '
'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 503c125b59c..b0685b8b64b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1345,10 +1345,25 @@ if ($resql) { print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); } + $totalarray = array( + 'nbfield' => 0, + 'val' => array( + 'c.total_ht' => 0, + 'c.total_tva' => 0, + 'c.total_ttc' => 0, + ), + 'pos' => array(), + ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array( + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, + ); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['c.datec']['checked'])) { @@ -1388,7 +1403,6 @@ if ($resql) { $generic_product = new Product($db); $userstatic = new User($db); $i = 0; - $totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array()); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ba505f33d67..509ab85634d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4091,10 +4091,10 @@ if ($action == 'create') { } // Confirmation du classement paye - if ($action == 'paid' && $resteapayer <= 0) { + if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $resteapayer == $object->total_ttc))) { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1); } - if ($action == 'paid' && $resteapayer > 0) { + if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc)) { $close = array(); // Code $i = 0; @@ -5450,14 +5450,17 @@ if ($action == 'create') { } // Classify paid - if (($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0))) - || ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id)) + if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && ( + ($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) || + ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0) || + ($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) + ) ) { print ''.$langs->trans('ClassifyPaid').''; } // Classify 'closed not completely paid' (possible if validated and not yet filed paid) - if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && $usercanissuepayment) { + if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) { if ($totalpaye > 0 || $totalcreditnotes > 0) { // If one payment or one credit note was linked to this invoice print ''.$langs->trans('ClassifyPaidPartially').''; diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 6fd84f4eda3..10d25b2aa09 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -110,7 +110,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { } // Validation of fields values - if ($conf->global->MAIN_FEATURE_LEVEL >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) { if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) { if (!$object->validateField($object->fields, $key, $value)) { $error++; @@ -226,7 +226,7 @@ if ($action == 'update' && !empty($permissiontoadd)) { } // Validation of fields values - if ($conf->global->MAIN_FEATURE_LEVEL >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) { if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) { if (!$object->validateField($object->fields, $key, $value)) { $error++; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 40610ce5d6f..691c20e10f8 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -229,7 +229,8 @@ class HookManager 'showLinkToObjectBlock', 'setContentSecurityPolicy', 'setHtmlTitle', - 'completeTabsHead' + 'completeTabsHead', + 'formDolBanner' ) )) { $hooktype = 'addreplace'; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 13619fe5aa3..4196fb32b68 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -304,7 +304,7 @@ class FormAdmin if (preg_match('/\.lib/i', $filelib)) { continue; } - if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file, $expdevmenu)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0 && in_array($file, $expdevmenu)) { continue; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index ffa441c0527..6f0a79d9383 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1373,7 +1373,7 @@ class FormFile } // Preview link if (!$editline) { - print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity)); + print $this->showPreview($file, $modulepart, $filepath, 0, 'entity='.(!empty($object->entity) ? $object->entity : $conf->entity)); } print "\n"; diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index adde51c4974..0cd34e13193 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -37,7 +37,7 @@ class InfoBox { global $conf; - if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { return array( 0 => 'Home', 1 => 'UsersHome', diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index b535d2b3585..e741adc84b5 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -589,7 +589,7 @@ class Translate } /* Disabled. There is too many cases where translation of $newstr is not defined is normal (like when output with setEventMessage an already translated string) - if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { dol_syslog(__METHOD__." MAIN_FEATURES_LEVEL=DEVELOP: missing translation for key '".$newstr."' in ".$_SERVER["PHP_SELF"], LOG_DEBUG); }*/ diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php index 4927be6a005..ee21aac0de3 100644 --- a/htdocs/core/get_info.php +++ b/htdocs/core/get_info.php @@ -83,8 +83,8 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { $appli .= " ".DOL_VERSION; } -if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { - $appli .= "
".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; +if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { + $appli .= "
".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL'); } $logouttext = ''; diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 30a3d21de90..554d435c471 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2021 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,7 +67,7 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'graph'; $h++; - if ($object->courant != Account::TYPE_CASH) { + if ($object->courant != Account::TYPE_CASH || !empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) { $nbReceipts = 0; // List of all standing receipts diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 408a771e1ed..25dec3e47bb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1845,7 +1845,7 @@ function dol_get_fiche_end($notab = 0) */ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $onlybanner = 0, $morehtmlright = '') { - global $conf, $form, $user, $langs; + global $conf, $form, $user, $langs, $hookmanager; $error = 0; @@ -2116,6 +2116,17 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $morehtmlref .= ''; } + $parameters=array('morehtmlref'=>$morehtmlref); + $reshook = $hookmanager->executeHooks('formDolBanner', $parameters, $object, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } elseif (empty($reshook)) { + $morehtmlref .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $morehtmlref = $hookmanager->resPrint; + } + + print '
'; print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); print '
'; @@ -4526,7 +4537,7 @@ function dol_print_error($db = '', $error = '', $errors = null) if ($_SERVER['DOCUMENT_ROOT']) { // Mode web $out .= $langs->trans("DolibarrHasDetectedError").".
\n"; - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) { $out .= "You use an experimental or develop level of features, so please do NOT report any bugs or vulnerability, except if problem is confirmed after moving option MAIN_FEATURES_LEVEL back to 0.
\n"; } $out .= $langs->trans("InformationToHelpDiagnose").":
\n"; @@ -4534,7 +4545,7 @@ function dol_print_error($db = '', $error = '', $errors = null) $out .= "".$langs->trans("Date").": ".dol_print_date(time(), 'dayhourlog')."
\n"; $out .= "".$langs->trans("Dolibarr").": ".DOL_VERSION." - https://www.dolibarr.org
\n"; if (isset($conf->global->MAIN_FEATURES_LEVEL)) { - $out .= "".$langs->trans("LevelOfFeature").": ".dol_htmlentities($conf->global->MAIN_FEATURES_LEVEL, ENT_COMPAT)."
\n"; + $out .= "".$langs->trans("LevelOfFeature").": ".getDolGlobalInt('MAIN_FEATURES_LEVEL')."
\n"; } if (function_exists("phpversion")) { $out .= "".$langs->trans("PHP").": ".phpversion()."
\n"; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index c66bcdfc2d8..e9e06708f7c 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -471,14 +471,6 @@ function project_timesheet_prepare_head($mode, $fuser = null) $h++; } - /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2) - { - $head[$h][0] = DOL_URL_ROOT."/projet/activity/perline.php".($param?'?'.$param:''); - $head[$h][1] = $langs->trans("InputDetail"); - $head[$h][2] = 'inputperline'; - $h++; - }*/ - complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet'); complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet', 'remove'); @@ -517,7 +509,7 @@ function project_admin_prepare_head() $head[$h][2] = 'attributes_task'; $h++; - if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $langs->load("members"); $head[$h][0] = DOL_URL_ROOT.'/projet/admin/website.php'; diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index f290b2b4e90..02ba610961d 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2021 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -108,10 +108,10 @@ class printing_printipp extends PrintingDriver global $conf; $this->db = $db; - $this->host = $conf->global->PRINTIPP_HOST; - $this->port = $conf->global->PRINTIPP_PORT; - $this->user = $conf->global->PRINTIPP_USER; - $this->password = $conf->global->PRINTIPP_PASSWORD; + $this->host = getDolGlobalString('PRINTIPP_HOST'); + $this->port = getDolGlobalString('PRINTIPP_PORT'); + $this->user = getDolGlobalString('PRINTIPP_USER'); + $this->password = getDolGlobalString('PRINTIPP_PASSWORD'); $this->conf[] = array('varname'=>'PRINTIPP_HOST', 'required'=>1, 'example'=>'localhost', 'type'=>'text'); $this->conf[] = array('varname'=>'PRINTIPP_PORT', 'required'=>1, 'example'=>'631', 'type'=>'text'); $this->conf[] = array('varname'=>'PRINTIPP_USER', 'required'=>0, 'example'=>'', 'type'=>'text', 'moreattributes'=>'autocomplete="off"'); @@ -159,8 +159,8 @@ class printing_printipp extends PrintingDriver $ipp->setCopies($obj->copy); } else { if (!empty($conf->global->PRINTIPP_URI_DEFAULT)) { - dol_syslog("Will use default printer conf->global->PRINTIPP_URI_DEFAULT = ".$conf->global->PRINTIPP_URI_DEFAULT); - $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); + dol_syslog("Will use default printer conf->global->PRINTIPP_URI_DEFAULT = ".getDolGlobalString('PRINTIPP_URI_DEFAULT')); + $ipp->setPrinterURI(getDolGlobalString('PRINTIPP_URI_DEFAULT')); } else { $this->errors[] = 'NoDefaultPrinterDefined'; $error++; diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 5fc2737957f..e6838b9c4c4 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -104,7 +104,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices $texte .= '
'; $texte .= ''; - if ($conf->global->MAIN_FEATURE_LEVEL >= 2) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // Parametrage du prefix des replacement $texte .= ''; $texte .= ''; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index b711a65d25a..f15f8c74743 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -118,6 +118,7 @@ $permissiontoadd = $user->rights->expensereport->creer; // Used by the include o $upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); $projectRequired = $conf->projet->enabled && ! empty($conf->global->EXPENSEREPORT_PROJECT_IS_REQUIRED); +$fileRequired = !empty($conf->global->EXPENSEREPORT_FILE_IS_REQUIRED); if ($object->id > 0) { // Check current user can read this expense report @@ -1157,6 +1158,12 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors'); } + // If no file associated + if ($fileRequired && $fk_ecm_files == 0) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors'); + } + if (!$error) { $type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index c0a48b97222..93e20b06afe 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -151,7 +151,6 @@ $sqlusedforexport = ''; $head = array(); $upload_dir = $conf->export->dir_temp.'/'.$user->id; -//$usefilters=($conf->global->MAIN_FEATURES_LEVEL > 1); $usefilters = 1; // Security check diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php old mode 100644 new mode 100755 index ee1f768b60b..a6cf0cb232d --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1,4 +1,4 @@ - * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles @@ -2563,11 +2563,11 @@ if ($action == 'create') { } // Confirmation set paid - if ($action == 'paid' && $resteapayer <= 0) { + if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $resteapayer == $object->total_ttc))) { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1); } - if ($action == 'paid' && $resteapayer > 0) { + if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc)) { $close = array(); // Code $i = 0; @@ -2721,8 +2721,12 @@ if ($action == 'create') { } if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $facusing = new FactureFournisseur($db); - $facusing->fetch($object->fk_facture_source); - print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')'; + if ($object->fk_facture_source > 0) { + $facusing->fetch($object->fk_facture_source); + print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')'; + } else { + print ' ('.$langs->transnoentities("CorrectedInvoiceNotFound").')'; + } } $facidavoir = $object->getListIdAvoirFromInvoice(); @@ -3496,14 +3500,17 @@ if ($action == 'create') { } // Classify paid - if (($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && (($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $resteapayer >= 0))) - || ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && empty($discount->id)) + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && ( + ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) || + ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $resteapayer >= 0) || + ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) + ) ) { print ''.$langs->trans('ClassifyPaid').''; } // Classify 'closed not completely paid' (possible if validated and not yet filed paid) - if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0) { + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $object->total_ttc != $resteapayer)) { if ($totalpaye > 0 || $totalcreditnotes > 0) { // If one payment or one credit note was linked to this invoice print ''.$langs->trans('ClassifyPaidPartially').''; diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 6986d75d630..b11b795723c 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -349,7 +349,7 @@ if ($object->id) { $permissiontoadd = $user->rights->holiday->write; $permtoedit = $user->rights->holiday->write; $param = '&id='.$object->id; - $relativepathwithnofile = $modulepart.'/'.dol_sanitizeFileName($object->ref).'/'; + $relativepathwithnofile = dol_sanitizeFileName($object->ref).'/'; $savingdocmask = dol_sanitizeFileName($object->ref).'-__file__'; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index a268f1b30be..115571bb6ba 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -111,7 +111,7 @@ class Evaluationline extends CommonObject 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'fk_skill' => array('type'=>'integer:Skill:hrm/class/skill.class.php:1', 'label'=>'Skill', 'enabled'=>'1', 'position'=>3, 'notnull'=>1, 'visible'=>1, 'index'=>1,), 'fk_evaluation' => array('type'=>'integer:Evaluation:hrm/class/evaluation.class.php:1', 'label'=>'Evaluation', 'enabled'=>'1', 'position'=>3, 'notnull'=>1, 'visible'=>1, 'index'=>1,), - 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>'1', 'position'=>4, 'notnull'=>1, 'visible'=>1,), + 'rankorder' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>'1', 'position'=>4, 'notnull'=>1, 'visible'=>1,), 'required_rank' => array('type'=>'integer', 'label'=>'requiredRank', 'enabled'=>'1', 'position'=>5, 'notnull'=>1, 'visible'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), ); diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 1fb90b907db..c3acdd0982e 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -104,7 +104,7 @@ class Skilldet extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), - 'rank' => array('type'=>'integer', 'label'=>'rank', 'enabled'=>'1', 'position'=>2, 'notnull'=>0, 'visible'=>2,), + 'rankorder' => array('type'=>'integer', 'label'=>'rank', 'enabled'=>'1', 'position'=>2, 'notnull'=>0, 'visible'=>2,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>0,), diff --git a/htdocs/install/mysql/tables/llx_element_tag.key.sql b/htdocs/install/mysql/tables/llx_element_tag.key.sql new file mode 100644 index 00000000000..d3a0b38afa9 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_tag.key.sql @@ -0,0 +1,21 @@ +-- ============================================================================ +-- Copyright (C) 2021 Maxime Kohlhaas +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +ALTER TABLE llx_element_tag ADD UNIQUE INDEX idx_element_tag_uk (fk_categorie, fk_element); + +ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); diff --git a/htdocs/install/mysql/tables/llx_element_tag.sql b/htdocs/install/mysql/tables/llx_element_tag.sql new file mode 100644 index 00000000000..d43ced98130 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_tag.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2021 Maxime Kohlhaas +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +create table llx_element_tag +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_categorie integer NOT NULL, + fk_element integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c1f3231c737..25bc42046a9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -523,7 +523,6 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); //print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers. setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings'); - //if ($conf->global->MAIN_FEATURES_LEVEL >= 1) setEventMessages('Unset POST and GET params by CSRF protection in main.inc.php (Token provided was not generated by the previous page).'."
\n".'$_SERVER[REQUEST_URI] = '.$_SERVER['REQUEST_URI'].' $_SERVER[REQUEST_METHOD] = '.$_SERVER['REQUEST_METHOD'].' GETPOST(token) = '.GETPOST('token', 'alpha').' $_SESSION[token] = '.$_SESSION['token'], null, 'warnings'); if (isset($_POST['id'])) $savid = ((int) $_POST['id']); unset($_POST); //unset($_POST['action']); unset($_POST['massaction']); @@ -1437,8 +1436,8 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; // Do not index print ''."\n"; // Scale for mobile device print ''."\n"; - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { - print ''."\n"; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { + print ''."\n"; } // Favicon $favicon = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png'; @@ -1628,11 +1627,6 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } else { print ''."\n"; } - /*if (! empty($conf->global->MAIN_FEATURES_LEVEL) && ! defined('JS_JQUERY_MIGRATE_DISABLED')) - { - if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) print ''."\n"; - else print ''."\n"; - }*/ if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) { print ''."\n"; } else { @@ -1842,8 +1836,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $appli .= " ".DOL_VERSION; } - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { - $appli .= "
".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { + $appli .= "
".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL'); } $logouttext = ''; diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 536eb0546cc..2f272ceca1c 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -833,7 +833,7 @@ print ''; print '
'; if (!empty($conf->expedition->enabled)) { - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal) + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal) print ''; print ''; print ''; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index b278c7c6da3..ec8117d3b0e 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -850,7 +850,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } } - if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2) { + if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $stripesupplieracc = $stripe->getStripeAccount($service, $object->id); // Get Stripe OAuth connect account (no network access here) // Stripe customer key 'cu_....' stored into llx_societe_account diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 0bb351bf977..06f417e48df 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -356,7 +356,7 @@ print img_picto('', 'bank_account').' '; $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); print ''; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // What is this for ? +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // What is this for ? print ''; } -// Warehouse for automatic decrement -//if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment -//{ -// print ''; -//} - print '
'.$form->textwithpicto('', $tooltip, 1, 1).'
'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'.$form->textwithpicto('', $tooltip, 1, 1).'
'.$langs->trans("AskForPreferredShippingMethod").' 
'; print $langs->trans("BankAccountForBankTransfer").''; print img_picto('', 'bank_account').' '; @@ -446,15 +446,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code print '
'; -// print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; -// print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE, 'ONLINE_PAYMENT_WAREHOUSE', '', 1, $disabled); -// print '
'; print $langs->trans("CSSUrlForPaymentForm").''; print ''; diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index a9e5e80c009..f193af733c9 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -53,7 +53,7 @@ div.mainmenu.bank::before { content: "\f19c"; } -global->MAIN_FEATURES_LEVEL == 2) { ?> + /* TESTING USAGE OF SVG WITHOUT FONT */ div.mainmenu.cashdesk { line-height: 26px; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e3a72384050..0a36922aab2 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1932,7 +1932,7 @@ if ($action == 'create' || $action == 'adduserldap') { $exclude = array(); $usergroup = new UserGroup($db); - $groupslist = $usergroup->listGroupsForUser($object->id); + $groupslist = $usergroup->listGroupsForUser($object->id, false); if (!empty($groupslist)) { foreach ($groupslist as $groupforuser) { diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index b7fc3d620f5..e1fab396cb8 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -488,7 +488,13 @@ class ProductCombination $child->price_autogen = $parent->price_autogen; $child->weight = $parent->weight; - $child->status = $parent->status; + // Only when Parent Status are updated + if ($parent->oldcopy && ($parent->status != $parent->oldcopy->status)) { + $child->status = $parent->status; + } + if ($parent->oldcopy && ($parent->status_buy != $parent->oldcopy->status_buy)) { + $child->status_buy = $parent->status_buy; + } if ($this->variation_weight) { // If we must add a delta on weight $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight;