diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index fd0ff2e72da..9f873195465 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -674,7 +674,7 @@ if ($id) { // Can an entry be erased or disabled ? $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + $url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); if ($param) { $url .= '&'.$param; } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 90adc84dfd5..bc229dd69f7 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -197,7 +197,7 @@ $arrayfields = array( 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1), + 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), ); @@ -769,16 +769,18 @@ if ($action == 'export_file') { $form_question['separator'] = array('name'=>'separator', 'type'=>'separator'); - // If 0 or not set, we NOT check by default. - $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE)); - $form_question['notifiedvalidationdate'] = array( - 'name' => 'notifiedvalidationdate', - 'type' => 'checkbox', - 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")), - 'value' => $checked, - ); + if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { + // If 0 or not set, we NOT check by default. + $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE)); + $form_question['notifiedvalidationdate'] = array( + 'name' => 'notifiedvalidationdate', + 'type' => 'checkbox', + 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")), + 'value' => $checked, + ); - $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); + $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); + } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600); } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index d638a7c0c84..bb864fc39e3 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -166,7 +166,7 @@ $arrayfields = array( 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), + 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), ); diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index f02eda61bf6..a1d75440b56 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -112,6 +112,7 @@ if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting- } } + /* * View */ @@ -178,20 +179,40 @@ for ($i = 1; $i <= 12; $i++) { } print ''.$langs->trans("Total").''; -$sql = "SELECT COUNT(b.rowid) as detail,"; -for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; - if ($j > 12) { - $j -= 12; +if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { + // TODO Analyse is done by finding record not into a closed period + $sql = "SELECT COUNT(b.rowid) as detail,"; + for ($i = 1; $i <= 12; $i++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + if ($j > 12) { + $j -= 12; + } + $sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).","; } - $sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).","; + $sql .= " COUNT(b.rowid) as total"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; + $sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'"; + $sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'"; + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy + // Loop on each closed period + $sql .= " AND b.doc_date BETWEEN 0 AND 0"; +} else { + // Analyse closed record using the unitary flag/date on each record + $sql = "SELECT COUNT(b.rowid) as detail,"; + for ($i = 1; $i <= 12; $i++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + if ($j > 12) { + $j -= 12; + } + $sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).","; + } + $sql .= " COUNT(b.rowid) as total"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; + $sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'"; + $sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'"; + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy + $sql .= " AND date_validated IS NULL"; } -$sql .= " COUNT(b.rowid) as total"; -$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; -$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'"; -$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'"; -$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy -$sql .= " AND date_validated IS NULL"; dol_syslog('htdocs/accountancy/closure/index.php', LOG_DEBUG); $resql = $db->query($sql); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index c80586fa3d0..dbd1c892086 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -328,7 +328,7 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { - $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label $account_label = $accountingaccount->label; // get compte id and label diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 7c0a8b90f7d..e4c292d2670 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -457,7 +457,7 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { - $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label $label_account = $accountingaccount->label; $bookkeeping = new BookKeeping($db); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 426bc6d7795..599eeb627b5 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -479,7 +479,7 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { - $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label $label_account = $accountingaccount->label; $bookkeeping = new BookKeeping($db); diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index 49b4fc2c98c..af32b85d8fa 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -236,7 +236,7 @@ if ($some_mandatory_steps_of_setup_were_not_done) { print ' : ' . $langs->trans("AccountancyAreaDescMisc", 4, '' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . ''); print ''; } -print '
'; +print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; } diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 6199991f29c..884c6e67be2 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -178,14 +178,14 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { print ''; print ''.$langs->trans("Parameter").''; - print ''.$langs->trans("Value").''; + print ''.$langs->trans("Value").''; print "\n"; // Force Type $adht = new AdherentType($db); print ''; print $langs->trans("ForceMemberType"); - print ''; + print ''; $listofval = array(); $listofval += $adht->liste_array(1); $forcetype = empty($conf->global->MEMBER_NEWFORM_FORCETYPE) ? -1 : $conf->global->MEMBER_NEWFORM_FORCETYPE; @@ -197,7 +197,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { $morphys["mor"] = $langs->trans("Moral"); print ''; print $langs->trans("ForceMemberNature"); - print ''; + print ''; $forcenature = empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY) ? 0 : $conf->global->MEMBER_NEWFORM_FORCEMORPHY; print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1); print "\n"; @@ -205,21 +205,21 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { // Amount print ''; print $langs->trans("DefaultAmount"); - print ''; - print ''; + print ''; + print ''; print "\n"; // Can edit print ''; print $langs->trans("CanEditAmount"); - print ''; + print ''; print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); print "\n"; // Jump to an online payment page print ''; print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); - print ''; + print ''; $listofval = array(); $listofval['-1'] = $langs->trans('No'); $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')'; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 03d3c1f3d06..2e04a29b69f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1227,12 +1227,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''.$langs->trans("Password").'pass).'">'; } - // Morphy - $morphys["phy"] = $langs->trans("Physical"); - $morphys["mor"] = $langs->trans("Moral"); - print ''.$langs->trans("MemberNature").''; - print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy") ? GETPOST("morphy", 'alpha') : $object->morphy), 0, 0, 0, '', 0, 0, 0, '', '', 1); - print ""; // Type print ''.$langs->trans("Type").''; @@ -1244,6 +1238,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print ""; + // Morphy + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Moral"); + print ''.$langs->trans("MemberNature").''; + print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy") ? GETPOST("morphy", 'alpha') : $object->morphy), 0, 0, 0, '', 0, 0, 0, '', '', 1); + print ""; + // Company print ''.$langs->trans("Company").'company).'">'; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 6056e1320f0..3fa4c4b3e7f 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -598,7 +598,11 @@ while ($i < min($num, $limit)) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'd.amount'; } - $totalarray['val']['d.amount'] += $obj->subscription; + if (empty($totalarray['val']['d.amount'])) { + $totalarray['val']['d.amount'] = $obj->subscription; + } else { + $totalarray['val']['d.amount'] += $obj->subscription; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 459d9c47227..b19db5a3d5e 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -466,13 +466,13 @@ print ''; //Use draft Watermark -print "
"; +print ''; print ''; -print ""; +print ''; print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/admin/bom_extrafields.php b/htdocs/admin/bom_extrafields.php index c8ebafd4be8..0691f91b592 100644 --- a/htdocs/admin/bom_extrafields.php +++ b/htdocs/admin/bom_extrafields.php @@ -64,7 +64,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ - +$help_url = ''; llxHeader('', $langs->trans("BOMsSetup"), $help_url); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 1369c5667a8..a2aa663f189 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -625,13 +625,13 @@ print '
'; //Use draft Watermark -print "
"; +print ''; print ''; -print ""; +print ''; print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 1426c323c01..a5a68a0bb49 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -220,7 +220,7 @@ if (!empty($conf->multicompany->enabled) && !$user->entity) { print ''; print ''; } -print ''; +print ''; print "\n"; print ''; @@ -273,7 +273,7 @@ if ($result) { print ''; // Date last change - print ''; + print ''; print dol_print_date($db->jdate($obj->tms), 'dayhour'); print ''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index e8a1fc85790..a2db7bf8fcf 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -458,7 +458,7 @@ print ''."\n"; print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''."\n"; print ''; diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 521a24f490d..de6210ba531 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -206,7 +206,7 @@ class PrestaShopWebservice */ public function printDebug($title, $content) { - echo '
'.$title.'
'.htmlentities($content).'
'; + echo '
'.dol_escape_htmltag($title).'
'.dol_escape_htmltag($content).'
'; } /** diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index cb49404a8b9..0a9009889f8 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -451,7 +451,7 @@ print "\n"; print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 0c54eade6da..64cf24ca6fa 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -468,7 +468,7 @@ print ''."\n"; print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; -print ''; +print ''; print ''."\n"; if (!empty($conf->project->enabled)) { diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index accb3d850a0..f866eef7802 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -761,7 +761,7 @@ print ' print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 36a55be9a95..79896d0ed74 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -525,7 +525,7 @@ print "'; print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index f208e2a658a..c3c58984dc0 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -551,7 +551,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; - print ''; + print ''; print ''."\n"; } diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index f5bbb5c648f..b1b74189d35 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -57,7 +57,7 @@ $type = 'myobject'; $arrayofparameters = array( 'HRM_MAXRANK'=>array('type'=>'integer','enabled'=>1), - 'HRM_DEFAULT_SKILL_DESCRIPTION'=>array('type'=>'textarea','enabled'=>1), + 'HRM_DEFAULT_SKILL_DESCRIPTION'=>array('type'=>'varchar','enabled'=>1), ); $error = 0; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index f065760f62d..67bf775bdd9 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -870,7 +870,7 @@ if ($action == 'edit') { if (!empty($dnsinfo) && is_array($dnsinfo)) { foreach ($dnsinfo as $info) { if (strpos($info['txt'], 'v=spf') !== false) { - $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']); + $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $companyemail, $info['txt']); } } } diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 0c53bebfc52..16500c62d59 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Regis Houssin + * Copyright (C) 2022 Charlene Benke * * 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 @@ -505,7 +506,7 @@ if ($mode == 'feature') { $text .= '
'; $text .= '
'.$langs->trans("AddHooks").': '; - if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) { + if (isset($objMod->module_parts) && isset($objMod->module_parts['hooks']) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) { $i = 0; foreach ($objMod->module_parts['hooks'] as $key => $val) { if ($key === 'entity') { diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index f4283373b95..2d543cb1faa 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -465,7 +465,7 @@ print "'; print $form->textwithpicto($langs->trans("WatermarkOnDraftMOs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index fe8db9818f7..c324f33ba92 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -693,7 +693,7 @@ print "'; print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 1ca874c69b5..5479b43f6ca 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -467,7 +467,7 @@ print "\n"; print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext).'
'; -print ''; +print ''; print "\n"; */ print ''; diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 67c6914f1cf..62b91ad55b3 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -128,7 +128,7 @@ if (isset($max)) { } print ''; print ''; -print ' '.$langs->trans("Kb"); +print ' '.$langs->trans("Kb"); print ''; print ''; @@ -138,7 +138,7 @@ print ''.$langs->trans("UMask").''; print $form->textwithpicto('', $langs->trans("UMaskExplanation")); print ''; print ''; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index a3d54e2a132..79190725c16 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -61,8 +61,13 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { dol_print_error($db); } } elseif ($action == 'updateform') { - $res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - $res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + $res1 = 1; $res2 = 1; + if (GETPOSTISSET('MAIN_APPLICATION_TITLE')) { + $res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + } + if (GETPOSTISSET('MAIN_SESSION_TIMEOUT')) { + $res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + } if ($res1 && $res2) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } @@ -165,11 +170,11 @@ if (ini_get("session.gc_probability") == 0) { } print ''; print ''; -print ' '.strtolower($langs->trans("Seconds")); +print ' '.strtolower($langs->trans("Seconds")); print ''; print ''; - +/* if (empty($conf->global->MAIN_APPLICATION_TITLE)) { $conf->global->MAIN_APPLICATION_TITLE = ""; } @@ -177,9 +182,10 @@ print ''; print ''.$langs->trans("MAIN_APPLICATION_TITLE").''; print ''; print ''; -print ' '; +print ' '; print ''; print ''; +*/ print ''; diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index bb0617c6700..76a881f9415 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -492,7 +492,7 @@ print "'; print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 2f272cd986f..8e80a13673e 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -295,7 +295,7 @@ print ''; if (!empty($conf->loghandlers['mod_syslog_file']) && !empty($conf->cron->enabled)) { print ''.$langs->trans("SyslogFileNumberOfSaves").''; - print ''; + print ''; print ' ('.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').')'; } diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 72e8db6bb4e..457d71d98d9 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -106,6 +106,14 @@ if (!$base) { print 'Collation'; print "\n"; + $arrayoffilesrich = dol_dir_list(DOL_DOCUMENT_ROOT.'/install/mysql/tables/', 'files', 0, '\.sql$'); + $arrayoffiles = array(); + foreach ($arrayoffilesrich as $value) { + //print $shortsqlfilename.' '; + $shortsqlfilename = preg_replace('/\-[a-z]+\./', '.', $value['name']); + $arrayoffiles[] = $shortsqlfilename; + } + $sql = "SHOW TABLE STATUS"; $resql = $db->query($sql); @@ -119,7 +127,8 @@ if (!$base) { print ''.($i+1).''; print ''.$obj->Name.''; $tablename = preg_replace('/^'.MAIN_DB_PREFIX.'/', 'llx_', $obj->Name); - if (dol_is_file(DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$tablename.'.sql')) { + + if (in_array($tablename.'.sql', $arrayoffiles)) { $img = "info"; //print img_picto($langs->trans("ExternalModule"), $img); } else { diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 0fd654b5d28..fdb3117423b 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -183,7 +183,8 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') { } // enable captcha by default - $res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA', 1, 'chaine', 0, '', $conf->entity); + // TODO Add a visible option in this setup page for this + $res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA_TICKET', 1, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; $errors[] = $db->lasterror(); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 7d12f571c06..238329a3486 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1047,7 +1047,7 @@ if ($type == Categorie::TYPE_USER) { print ''; print ''; print ''; print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index e543b7e6bd1..989c909487b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1903,13 +1903,22 @@ if ($id > 0) { } else { print dol_get_fiche_head($head, 'card', $langs->trans("Action"), -1, 'action'); + $formconfirm = ''; + // Clone event if ($action == 'clone') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.GETPOST('id'), $langs->trans('ToClone'), $langs->trans('ConfirmCloneEvent', $object->label), 'confirm_clone', $formquestion, 'yes', 1); - - print $formconfirm; + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.GETPOST('id'), $langs->trans('ToClone'), $langs->trans('ConfirmCloneEvent', $object->label), 'confirm_clone', array(), 'yes', 1); } + // Call Hook formConfirm + $parameters = array(); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + + // Print form confirm + print $formconfirm; + $linkback = ''; // Link to other agenda views $linkback .= ''; diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 62dd24aaaf7..ea6ec241b16 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -41,7 +41,7 @@ class AdvanceTargetingMailing extends CommonObject /** * @var string Name of table without prefix where object is stored */ - public $table_element = 'advtargetemailing'; + public $table_element = 'mailing_advtarget'; /** * @var int ID @@ -159,7 +159,7 @@ class AdvanceTargetingMailing extends CommonObject // Put here code to add control on parameters values // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX."advtargetemailing("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_advtarget("; $sql .= "name,"; $sql .= "entity,"; $sql .= "fk_element,"; @@ -188,7 +188,7 @@ class AdvanceTargetingMailing extends CommonObject } if (!$error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."advtargetemailing"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."mailing_advtarget"); } // Commit or rollback @@ -227,7 +227,7 @@ class AdvanceTargetingMailing extends CommonObject $sql .= " t.fk_user_mod,"; $sql .= " t.tms"; - $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t"; + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_advtarget as t"; $sql .= " WHERE t.rowid = ".((int) $id); dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -282,7 +282,7 @@ class AdvanceTargetingMailing extends CommonObject $sql .= " t.fk_user_mod,"; $sql .= " t.tms"; - $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t"; + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_advtarget as t"; if (!empty($id)) { $sql .= " WHERE t.fk_element = ".((int) $id)." AND type_element = 'mailing'"; } else { @@ -345,7 +345,7 @@ class AdvanceTargetingMailing extends CommonObject $sql .= " t.fk_user_mod,"; $sql .= " t.tms"; - $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t"; + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_advtarget as t"; if (!empty($id)) { $sql .= " WHERE t.fk_element = ".((int) $id)." AND type_element = '".$this->db->escape($type_element)."'"; } else { @@ -410,7 +410,7 @@ class AdvanceTargetingMailing extends CommonObject // Put here code to add a control on parameters values // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."advtargetemailing SET"; + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_advtarget SET"; $sql .= " name=".(isset($this->name) ? "'".$this->db->escape($this->name)."'" : "''").","; $sql .= " entity=".$conf->entity.","; @@ -458,7 +458,7 @@ class AdvanceTargetingMailing extends CommonObject $this->db->begin(); if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."advtargetemailing"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_advtarget"; $sql .= " WHERE rowid=".((int) $this->id); dol_syslog(get_class($this)."::delete sql=".$sql); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ee25ea86eff..dbb99d0f993 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1217,7 +1217,7 @@ if ($resql) { if ($permissiontocancel) { $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); } - if ($user->rights->facture->creer) { + if (!empty($conf->invoice->enabled) && $user->rights->facture->creer) { $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); } if ($permissiontoclose) { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index a864168d161..285d9d366f7 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -668,6 +668,8 @@ class Invoices extends DolibarrApi $result = $this->invoice->delete(DolibarrApiAccess::$user); if ($result < 0) { throw new RestException(500, 'Error when deleting invoice'); + } elseif ($result == 0) { + throw new RestException(403, 'Invoice not erasable'); } return array( diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index ae92286dfec..d9cb6f6fb7d 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -1,8 +1,9 @@ - * Copyright (C) 2005-2016 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2018 Juanjo Menent +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2018 Juanjo Menent + * Copyright (C) 2022 Alexandre Spangaro * * 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,7 +109,7 @@ llxHeader('', $langs->trans("WithdrawalsLines")); $sql = "SELECT p.rowid, p.ref, p.statut as status, p.datec"; $sql .= " , f.rowid as facid, f.ref as invoiceref, f.total_ttc"; -$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.email"; +$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.email"; $sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -139,7 +140,7 @@ if ($search_bon) { } if ($type == 'bank-transfer') { if ($search_code) { - $sql .= natural_search("s.code_fourn", $search_code); + $sql .= natural_search("s.code_fournisseur", $search_code); } } else { if ($search_code) { @@ -172,6 +173,9 @@ if ($result) { $param = "&statut=".urlencode($statut); $param .= "&search_bon=".urlencode($search_bon); + if ($type == 'bank-transfer') { + $param .= '&type=bank-transfer'; + } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } @@ -204,7 +208,7 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; $columntitle = "WithdrawalsReceipts"; + $columntitlethirdparty = "CustomerCode"; + $columncodethirdparty = "s.code_client"; if ($type == 'bank-transfer') { $columntitle = "BankTransferReceipts"; + $columntitlethirdparty = "SupplierCode"; + $columncodethirdparty = "s.code_fournisseur"; } print ''; @@ -223,7 +231,7 @@ if ($result) { print_liste_field_titre("Line", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Bill", $_SERVER["PHP_SELF"], "f.ref", '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($columntitlethirdparty, $_SERVER["PHP_SELF"], $columncodethirdparty, '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); @@ -256,9 +264,17 @@ if ($result) { print ''; print '\n"; + $link_to_bill = '/compta/facture/card.php?facid='; + $link_title = 'Invoice'; + $link_picto = 'bill'; + if ($type == 'bank-transfer') { + $link_to_bill = '/fourn/facture/card.php?facid='; + $link_title = 'SupplierInvoice'; + $link_picto = 'supplier_invoice'; + } + print ''; + print img_object($langs->trans($link_title), $link_picto); + print ' '.$obj->invoiceref."\n"; print ''; print ''; @@ -266,7 +282,15 @@ if ($result) { print $company->getNomUrl(1); print "\n"; - print '\n"; + + print '\n"; print '\n"; diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index c80acb39f8e..ee370b9532e 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -132,6 +132,9 @@ if ($result) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } + if ($type == 'bank-transfer') { + $param .= '&type=bank-transfer'; + } if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 317aebecfd1..eb3a29bb3e9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1263,9 +1263,9 @@ if ($action == 'create') { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("CloseAContract"), $langs->trans("ConfirmCloseContract"), "confirm_close", '', 0, 1); } elseif ($action == 'activate') { $formquestion = array( - array('type' => 'date', 'name' => 'd_start', 'label' => $langs->trans("DateServiceActivate"), /*'value' => $form->selectDate('', '', $usehm, $usehm, '', "active", 1, 0),*/ /*'socid', '(s.client=1 OR s.client=2 OR s.client=3)'*/), + array('type' => 'date', 'name' => 'd_start', 'label' => $langs->trans("DateServiceActivate"), 'value' => dol_now()), array('type' => 'date', 'name' => 'd_end', 'label' => $langs->trans("DateEndPlanned"), /*'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0),*/ '', ''), - array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300') + array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300', 'moreattr'=>'autofocus') ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", $formquestion, 'yes', 1, 280); } elseif ($action == 'clone') { diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 506a1465fdc..39dba81976f 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -61,7 +61,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { continue; // The field was not submited to be saved } } else { - if (!GETPOSTISSET($key)) { + if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) { continue; // The field was not submited to be saved } } @@ -91,6 +91,12 @@ if ($action == 'add' && !empty($permissiontoadd)) { } elseif ($object->fields[$key]['type'] == 'reference') { $tmparraykey = array_keys($object->param_list); $value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2'); + } elseif (preg_match('/^chkbxlst:(.*)/', $object->fields[$key]['type'])) { + $value = ''; + $values_arr = GETPOST($key, 'array'); + if (!empty($values_arr)) { + $value = implode(',', $values_arr); + } } else { if ($key == 'lang') { $value = GETPOST($key, 'aZ09') ?GETPOST($key, 'aZ09') : ""; @@ -134,6 +140,8 @@ if ($action == 'add' && !empty($permissiontoadd)) { } if (!$error) { + $db->begin(); + $result = $object->create($user); if ($result > 0) { // Creation OK @@ -141,14 +149,19 @@ if ($action == 'add' && !empty($permissiontoadd)) { $categories = GETPOST('categories', 'array:int'); $object->setCategories($categories); } + $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation + $db->commit(); + if (empty($noback)) { header("Location: " . $urltogo); exit; } } else { + $db->rollback(); + $error++; // Creation KO if (!empty($object->errors)) { @@ -177,7 +190,7 @@ if ($action == 'update' && !empty($permissiontoadd)) { continue; } } else { - if (!GETPOSTISSET($key)) { + if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) { continue; // The field was not submited to be saved } } @@ -215,6 +228,12 @@ if ($action == 'update' && !empty($permissiontoadd)) { $value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0); } elseif ($object->fields[$key]['type'] == 'reference') { $value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2'); + } elseif (preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) { + $value = ''; + $values_arr = GETPOST($key, 'array'); + if (!empty($values_arr)) { + $value = implode(',', $values_arr); + } } else { if ($key == 'lang') { $value = GETPOST($key, 'aZ09'); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index bee63613bca..d0b64fdca77 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -895,7 +895,12 @@ abstract class CommonDocGenerator //Add value to store price with currency $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency'])); } elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select') { - $object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]]; + $valueofselectkey = $object->array_options['options_'.$key]; + if (array_key_exists($valueofselectkey, $extrafields->attributes[$object->table_element]['param'][$key]['options'])) { + $object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$valueofselectkey]; + } else { + $object->array_options['options_'.$key] = ''; + } } elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') { $valArray = explode(',', $object->array_options['options_'.$key]); $output = array(); @@ -945,7 +950,11 @@ abstract class CommonDocGenerator } } - $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key])); + if (array_key_exists('option_'.$key, $object->array_options)) { + $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key])); + } else { + $array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => '')); + } } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b0ea04adb3e..ad31e42a625 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6763,6 +6763,9 @@ abstract class CommonObject } elseif (preg_match('/^(sellist):(.*):(.*)/i', $val['type'], $reg)) { $param['options'] = array($reg[2].':'.$reg[3] => 'N'); $type = 'sellist'; + } elseif (preg_match('/^chkbxlst:(.*)/i', $val['type'], $reg)) { + $param['options'] = array($reg[1] => 'N'); + $type = 'chkbxlst'; } elseif (preg_match('/varchar\((\d+)\)/', $val['type'], $reg)) { $param['options'] = array(); $type = 'varchar'; @@ -6865,7 +6868,7 @@ abstract class CommonObject $out = ''; } elseif (preg_match('/varchar/', $type)) { $out = ' 0 ? ' maxlength="'.$size.'"' : '').' value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>'; - } elseif (in_array($type, array('mail', 'phone', 'url'))) { + } elseif (in_array($type, array('mail', 'phone', 'url', 'ip'))) { $out = ''; } elseif (preg_match('/^text/', $type)) { if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field @@ -6916,7 +6919,9 @@ abstract class CommonObject if ((string) $keyb == '') { continue; } - if (strpos($valb, "|") !== false) list($valb, $parent) = explode('|', $valb); + if (strpos($valb, "|") !== false) { + list($valb, $parent) = explode('|', $valb); + } $out .= ''; - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $labeltoshow = ''; - $obj = $this->db->fetch_object($resql); - - // Several field into label (eq table:code|libelle:rowid) - $notrans = false; - $fields_label = explode('|', $InfoFieldList[1]); - if (count($fields_label) > 1) { - $notrans = true; - foreach ($fields_label as $field_toshow) { - $labeltoshow .= $obj->$field_toshow.' '; - } - } else { - $labeltoshow = $obj->{$InfoFieldList[1]}; + $sqlwhere = ''; + $sql = "SELECT " . $keyList; + $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; + if (!empty($InfoFieldList[4])) { + // can use SELECT request + if (strpos($InfoFieldList[4], '$SEL$') !== false) { + $InfoFieldList[4] = str_replace('$SEL$', 'SELECT', $InfoFieldList[4]); } - $labeltoshow = dol_trunc($labeltoshow, 45); - if ($value == $obj->rowid) { - foreach ($fields_label as $field_toshow) { - $translabel = $langs->trans($obj->$field_toshow); - if ($translabel != $obj->$field_toshow) { - $labeltoshow = dol_trunc($translabel).' '; - } else { - $labeltoshow = dol_trunc($obj->$field_toshow).' '; - } - } - $out .= ''; + // current object id can be use into filter + if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) { + $InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]); } else { - if (!$notrans) { - $translabel = $langs->trans($obj->{$InfoFieldList[1]}); - if ($translabel != $obj->{$InfoFieldList[1]}) { - $labeltoshow = dol_trunc($translabel, 18); - } else { - $labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}); + $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); + } + + //We have to join on extrafield table + if (strpos($InfoFieldList[4], 'extra') !== false) { + $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; + $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; + } else { + $sqlwhere .= " WHERE " . $InfoFieldList[4]; + } + } else { + $sqlwhere .= ' WHERE 1=1'; + } + // Some tables may have field, some other not. For the moment we disable it. + if (in_array($InfoFieldList[0], array('tablewithentity'))) { + $sqlwhere .= " AND entity = " . ((int) $conf->entity); + } + $sql .= $sqlwhere; + //print $sql; + + $sql .= ' ORDER BY ' . implode(', ', $fields_label); + + dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $out .= ''; + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $labeltoshow = ''; + $obj = $this->db->fetch_object($resql); + + // Several field into label (eq table:code|libelle:rowid) + $notrans = false; + $fields_label = explode('|', $InfoFieldList[1]); + if (count($fields_label) > 1) { + $notrans = true; + foreach ($fields_label as $field_toshow) { + $labeltoshow .= $obj->$field_toshow . ' '; } + } else { + $labeltoshow = $obj->{$InfoFieldList[1]}; } - if (empty($labeltoshow)) { - $labeltoshow = '(not defined)'; - } + $labeltoshow = dol_trunc($labeltoshow, 45); + if ($value == $obj->rowid) { - $out .= ''; + foreach ($fields_label as $field_toshow) { + $translabel = $langs->trans($obj->$field_toshow); + if ($translabel != $obj->$field_toshow) { + $labeltoshow = dol_trunc($translabel) . ' '; + } else { + $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; + } + } + $out .= ''; + } else { + if (!$notrans) { + $translabel = $langs->trans($obj->{$InfoFieldList[1]}); + if ($translabel != $obj->{$InfoFieldList[1]}) { + $labeltoshow = dol_trunc($translabel, 18); + } else { + $labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}); + } + } + if (empty($labeltoshow)) { + $labeltoshow = '(not defined)'; + } + if ($value == $obj->rowid) { + $out .= ''; + } + + if (!empty($InfoFieldList[3]) && $parentField) { + $parent = $parentName . ':' . $obj->{$parentField}; + $isDependList = 1; + } + + $out .= ''; } - if (!empty($InfoFieldList[3]) && $parentField) { - $parent = $parentName.':'.$obj->{$parentField}; - $isDependList = 1; - } - - $out .= ''; + $i++; } - - $i++; + $this->db->free($resql); + } else { + print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.
'; } - $this->db->free($resql); } else { - print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.
'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); + $out .= ''; + foreach ($data as $data_key => $data_value) { + $out .= ''; diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 4d62f9139b3..66e9241d9f5 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -51,6 +51,12 @@ class RssParser private $current_namespace; + private $initem; + private $intextinput; + private $incontent; + private $inimage; + private $inchannel; + // For parsing with xmlparser public $stack = array(); // parser stack private $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); @@ -254,21 +260,26 @@ class RssParser return -1; } - $xmlparser = xml_parser_create(''); + try { + $xmlparser = xml_parser_create(null); - if (!is_resource($xmlparser) && !is_object($xmlparser)) { - $this->error = "ErrorFailedToCreateParser"; - return -1; + if (!is_resource($xmlparser) && !is_object($xmlparser)) { + $this->error = "ErrorFailedToCreateParser"; + return -1; + } + + xml_set_object($xmlparser, $this); + xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); + xml_set_character_data_handler($xmlparser, 'feed_cdata'); + + $status = xml_parse($xmlparser, $str, false); + + xml_parser_free($xmlparser); + $rss = $this; + //var_dump($status.' '.$rss->_format);exit; + } catch (Exception $e) { + $rss = null; } - - xml_set_object($xmlparser, $this); - xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); - xml_set_character_data_handler($xmlparser, 'feed_cdata'); - - $status = xml_parse($xmlparser, $str); - xml_parser_free($xmlparser); - $rss = $this; - //var_dump($status.' '.$rss->_format);exit; } } @@ -443,7 +454,7 @@ class RssParser // Loop on each category $itemCategory = array(); - if (is_array($item->category)) { + if (!empty($item->category) && is_array($item->category)) { foreach ($item->category as $cat) { $itemCategory[] = (string) $cat; } @@ -514,7 +525,7 @@ class RssParser * @param array $attrs Attributes of tags * @return void */ - public function feed_start_element($p, $element, &$attrs) + public function feed_start_element($p, $element, $attrs) { // phpcs:enable $el = $element = strtolower($element); @@ -681,9 +692,9 @@ class RssParser public function append_content($text) { // phpcs:enable - if ($this->initem) { + if (!empty($this->initem)) { $this->concat($this->current_item[$this->incontent], $text); - } elseif ($this->inchannel) { + } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$this->incontent], $text); } } @@ -700,24 +711,24 @@ class RssParser if (!$el) { return; } - if ($this->current_namespace) { - if ($this->initem) { + if (!empty($this->current_namespace)) { + if (!empty($this->initem)) { $this->concat($this->current_item[$this->current_namespace][$el], $text); - } elseif ($this->inchannel) { + } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$this->current_namespace][$el], $text); - } elseif ($this->intextinput) { + } elseif (!empty($this->intextinput)) { $this->concat($this->textinput[$this->current_namespace][$el], $text); - } elseif ($this->inimage) { + } elseif (!empty($this->inimage)) { $this->concat($this->image[$this->current_namespace][$el], $text); } } else { - if ($this->initem) { + if (!empty($this->initem)) { $this->concat($this->current_item[$el], $text); - } elseif ($this->intextinput) { + } elseif (!empty($this->intextinput)) { $this->concat($this->textinput[$el], $text); - } elseif ($this->inimage) { + } elseif (!empty($this->inimage)) { $this->concat($this->image[$el], $text); - } elseif ($this->inchannel) { + } elseif (!empty($this->inchannel)) { $this->concat($this->channel[$el], $text); } } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 94bd36799fc..c11f94fa047 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -904,11 +904,11 @@ class Translate * This function need module "numberwords" to be installed. If not it will return * same number (this module is not provided by default as it use non GPL source code). * - * @param int $number Number to encode in full text - * @param string $isamount ''=it's just a number, '1'=It's an amount (default currency), 'currencycode'=It's an amount (foreign currency) - * @return string Label translated in UTF8 (but without entities) - * 10 if setDefaultLang was en_US => ten - * 123 if setDefaultLang was fr_FR => cent vingt trois + * @param int|string $number Number to encode in full text + * @param string $isamount ''=it's just a number, '1'=It's an amount (default currency), 'currencycode'=It's an amount (foreign currency) + * @return string Label translated in UTF8 (but without entities) + * 10 if setDefaultLang was en_US => ten + * 123 if setDefaultLang was fr_FR => cent vingt trois */ public function getLabelFromNumber($number, $isamount = '') { diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index c55d78b0caf..9a330c7aba5 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -952,7 +952,7 @@ class Utils dol_include_once('/core/lib/files.lib.php'); - $nbSaves = empty($conf->global->SYSLOG_FILE_SAVES) ? 10 : intval($conf->global->SYSLOG_FILE_SAVES); + $nbSaves = intval(getDolGlobalString('SYSLOG_FILE_SAVES', 10)); if (empty($conf->global->SYSLOG_FILE)) { $mainlogdir = DOL_DATA_ROOT; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 5847d88f026..9b1d78f1694 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -471,7 +471,7 @@ class DoliDBMysqli extends DoliDB */ public function escape($stringtoencode) { - return $this->db->real_escape_string($stringtoencode); + return $this->db->real_escape_string((string) $stringtoencode); } /** @@ -482,7 +482,7 @@ class DoliDBMysqli extends DoliDB */ public function escapeunderscore($stringtoencode) { - return str_replace('_', '\_', $stringtoencode); + return str_replace('_', '\_', (string) $stringtoencode); } /** diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 9167e08e599..3310554e530 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -231,33 +231,41 @@ print ' ); jQuery(\'.clipboardCPValue, .clipboardCPButton, .clipboardCPValueToPrint\').click(function() { - /* console.log(this.parentNode); */ console.log("We click on a clipboardCPButton or clipboardCPValueToPrint class and we want to copy content of clipboardCPValue class"); if (window.getSelection) { - range = document.createRange(); - - /* We select value to print using the parent. */ - /* We should use the class clipboardCPValue but it may have several element with copy/paste so class to select is not enough */ - range.selectNodeContents(this.parentNode.firstChild); + jqobj=$(this).parent().children(".clipboardCPValue"); + console.log(jqobj.html()); selection = window.getSelection(); /* get the object used for selection */ selection.removeAllRanges(); /* clear current selection */ + + /* We select the value to print using the parentNode.firstChild */ + /* We should use the class clipboardCPValue but it may have several element with copy/paste so class to select is not enough */ + range = document.createRange(); + range.selectNodeContents(this.parentNode.firstChild); selection.addRange(range); /* make the new selection with the value to copy */ + + /* copy selection into clipboard */ + var succeed; + try { + console.log("We set the style display to unset for the span so the copy will work"); + jqobj.css("display", "unset"); /* Because copy does not work on "block" object */ + + succeed = document.execCommand(\'copy\'); + + console.log("We set the style display back to inline-block"); + jqobj.css("display", "inline-block"); + } catch(e) { + succeed = false; + } + + /* Remove the selection to avoid to see the hidden field to copy selected */ + window.getSelection().removeAllRanges(); } - /* copy selection into clipboard */ - var succeed; - try { - succeed = document.execCommand(\'copy\'); - } catch(e) { - succeed = false; - } - - /* Remove the selection to avoid to see the hidden field to copy selected */ - window.getSelection().removeAllRanges(); - /* Show message */ + /* TODO Show message into a top left corner or center of screen */ var lastchild = this.parentNode.lastChild; /* .parentNode is clipboardCP and last child is clipboardCPText */ var tmp = lastchild.innerHTML if (succeed) { diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index b4c728fd611..7078d7488ad 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -100,13 +100,22 @@ function dol_print_cron_urls() print '
'; print $langs->trans("URLToLaunchCronJobs").':
'; $url = $urlwithroot.'/public/cron/cron_run_jobs_by_url.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login; - print img_picto('', 'globe').' '.$url."
\n"; - print ' '.$langs->trans("OrToLaunchASpecificJob").'
'; + print ''; + print '
'.$langs->trans("OrToLaunchASpecificJob").'
'; $url = $urlwithroot.'/public/cron/cron_run_jobs_by_url.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid'; - print img_picto('', 'globe').' '.$url."
\n"; + print ''; print '
'; print '
'; + print ajax_autoselect("publicurlmember"); + print ajax_autoselect("publicurlmemberall"); + $logintouse = 'firstadmin'; if ($user->admin) { $logintouse = $user->login; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 2fd4ce3799a..59a16164f97 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -222,7 +222,7 @@ function ordersupplier_prepare_head(CommandeFournisseur $object) $h++; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/info.php?id='.$object->id; - $head[$h][1] .= $langs->trans("Events"); + $head[$h][1] = $langs->trans("Events"); if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { $head[$h][1] .= '/'; $head[$h][1] .= $langs->trans("Agenda"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9250251de11..10866b4f24b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3948,7 +3948,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'off', 'on', 'order', 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'puce', 'stock', 'resize', 'service', 'stats', 'trip', - 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', + 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'user-tie', 'vcard', 'wrench', 'github', 'google', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', @@ -6583,10 +6583,10 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = ' * * @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir') * @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used) - * @param string|null $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444' + * @param string $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444' * @return int < 0 if KO, 0 = already exists, > 0 if OK */ -function dol_mkdir($dir, $dataroot = '', $newmask = null) +function dol_mkdir($dir, $dataroot = '', $newmask = '') { global $conf; @@ -6627,7 +6627,7 @@ function dol_mkdir($dir, $dataroot = '', $newmask = null) dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG); umask(0); - $dirmaskdec = octdec($newmask); + $dirmaskdec = octdec((string) $newmask); if (empty($newmask)) { $dirmaskdec = empty($conf->global->MAIN_UMASK) ? octdec('0755') : octdec($conf->global->MAIN_UMASK); } @@ -7319,6 +7319,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__ID__'] = '__ID__'; $substitutionarray['__REF__'] = '__REF__'; $substitutionarray['__NEWREF__'] = '__NEWREF__'; + $substitutionarray['__LABEL__'] = '__LABEL__'; $substitutionarray['__REF_CLIENT__'] = '__REF_CLIENT__'; $substitutionarray['__REF_SUPPLIER__'] = '__REF_SUPPLIER__'; $substitutionarray['__NOTE_PUBLIC__'] = '__NOTE_PUBLIC__'; @@ -7413,6 +7414,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__ID__'] = $object->id; $substitutionarray['__REF__'] = $object->ref; $substitutionarray['__NEWREF__'] = $object->newref; + $substitutionarray['__LABEL__'] = (isset($object->label) ? $object->label : (isset($object->title) ? $object->title : null)); $substitutionarray['__REF_CLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null); @@ -8215,7 +8217,6 @@ function get_htmloutput_mesg($mesgstring = '', $mesgarray = '', $style = 'ok', $ } } if ($mesgstring) { - $langs->load("errors"); $ret++; $out .= $langs->trans($mesgstring); } @@ -8612,7 +8613,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' } } elseif ($onlysimplestring == '2') { // We must accept: (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found" - if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/;[]', '/').']/i', $s)) { + if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@;[]', '/').']/i', $s)) { if ($returnvalue) { return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s; } else { @@ -9021,7 +9022,6 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, if ($values[0] != $type) { continue; } - //var_dump(verifCond($values[4])); if (verifCond($values[4])) { if ($values[3]) { @@ -11045,12 +11045,12 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) } /** - * Create a button to copy $valuetocopy in the clipboard. - * Code that handle the click is inside lib_foot.jsp.php. + * Create a button to copy $valuetocopy in the clipboard (for copy and paste feature). + * Code that handle the click is inside core/js/lib_foot.js.php. * * @param string $valuetocopy The value to print * @param int $showonlyonhover Show the copy-paste button only on hover - * @param string $texttoshow Replace the value to show with this text + * @param string $texttoshow Replace the value to show with this text. Use 'none' to show no text (only the copy-paste picto) * @return string The string to print for the button */ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '') @@ -11062,8 +11062,10 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex $showonlyonhover = 0; }*/ - $tag = 'span'; // Using div does not work when using the js copy code. - if ($texttoshow) { + $tag = 'span'; // Using div (like any style of type 'block') does not work when using the js copy code. + if ($texttoshow === 'none') { + $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''; + } elseif ($texttoshow) { $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''.dol_escape_htmltag($texttoshow, 1, 1).''; } else { $result = '<'.$tag.' class="clipboardCPValue">'.dol_escape_htmltag($valuetocopy, 1, 1).''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 95b57356b65..fa2482e3b84 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2240,7 +2240,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->user->user->creer); $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->user->user->lire); - $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"')); + $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="pictofixedwidth"')); // Skills $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Skills"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="pictofixedwidth"')); diff --git a/htdocs/core/modules/asset/mod_asset_advanced.php b/htdocs/core/modules/asset/mod_asset_advanced.php index 0942604466c..34780c3423f 100644 --- a/htdocs/core/modules/asset/mod_asset_advanced.php +++ b/htdocs/core/modules/asset/mod_asset_advanced.php @@ -78,7 +78,7 @@ class mod_asset_advanced extends ModeleNumRefAsset // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -131,7 +131,7 @@ class mod_asset_advanced extends ModeleNumRefAsset require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->ASSET_ASSET_ADVANCED_MASK; + $mask = getDolGlobalString('ASSET_ASSET_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index 09faf05d7d6..2228d643434 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -79,7 +79,7 @@ class mod_bom_advanced extends ModeleNumRefboms // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -128,7 +128,7 @@ class mod_bom_advanced extends ModeleNumRefboms require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->BOM_ADVANCED_MASK; + $mask = getDolGlobalString('BOM_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/hrm/mod_evaluation_advanced.php b/htdocs/core/modules/hrm/mod_evaluation_advanced.php index 0468c9ebb30..cdb1cc20109 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_advanced.php +++ b/htdocs/core/modules/hrm/mod_evaluation_advanced.php @@ -79,9 +79,9 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -132,7 +132,7 @@ class mod_evaluation_advanced extends ModeleNumRefEvaluation require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->HRM_EVALUATION_ADVANCED_MASK; + $mask = getDolGlobalString('HRM_EVALUATION_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 0b64203798f..c2ccff58ed7 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -125,7 +125,7 @@ class doc_generic_member_odt extends ModelePDFMember // List of directories area $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -129,7 +129,7 @@ class mod_mo_advanced extends ModeleNumRefMos require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->MRP_MO_ADVANCED_MASK; + $mask = getDolGlobalString('MRP_MO_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index fa86d832b73..26268e7c183 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -67,7 +67,11 @@ class PrintingDriver $list = array(); $listoffiles = array(); - $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + if (!empty($conf->modules_parts['printing'])) { + $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + } else { + $dirmodels = array('/core/modules/printing/'); + } foreach ($dirmodels as $dir) { $tmpfiles = dol_dir_list(dol_buildpath($dir, 0), 'all', 0, '\.modules.php', '', 'name', SORT_ASC, 0); if (!empty($tmpfiles)) { diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 226ed6c43cd..964558de8df 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -116,8 +116,8 @@ class printing_printgcp extends PrintingDriver 'type'=>'info', ); } else { - $this->google_id = $conf->global->OAUTH_GOOGLE_ID; - $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET; + $this->google_id = getDolGlobalString('OAUTH_GOOGLE_ID'); + $this->google_secret = getDolGlobalString('OAUTH_GOOGLE_SECRET'); // Token storage $storage = new DoliStorage($this->db, $this->conf); //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 0865ebc9a66..0e108b6b021 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -66,7 +66,7 @@ class mod_lot_advanced extends ModeleNumRefBatch $form = new Form($db); // We get cursor rule - $mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : ''; + $mask = getDolGlobalString('LOT_ADVANCED_MASK'); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte .= ''; @@ -142,7 +142,7 @@ class mod_lot_advanced extends ModeleNumRefBatch require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = isset($conf->global->LOT_ADVANCED_MASK) ? $conf->global->LOT_ADVANCED_MASK : ''; + $mask = getDolGlobalString('LOT_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index 46f803cb20f..f8d61c43c61 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -66,7 +66,7 @@ class mod_sn_advanced extends ModeleNumRefBatch $form = new Form($db); // We get cursor rule - $mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : ''; + $mask = getDolGlobalString('SN_ADVANCED_MASK'); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte .= ''; @@ -142,7 +142,7 @@ class mod_sn_advanced extends ModeleNumRefBatch require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = isset($conf->global->SN_ADVANCED_MASK) ? $conf->global->SN_ADVANCED_MASK : ''; + $mask = getDolGlobalString('SN_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php index fab0952e894..dd29e48d0b8 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php @@ -80,7 +80,7 @@ class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -133,7 +133,7 @@ class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->STOCKTRANSFER_STOCKTRANSFER_ADVANCED_MASK; + $mask = getDolGlobalString('STOCKTRANSFER_STOCKTRANSFER_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/workstation/mod_workstation_advanced.php b/htdocs/core/modules/workstation/mod_workstation_advanced.php index 6611f8d926e..125aa0f7c53 100644 --- a/htdocs/core/modules/workstation/mod_workstation_advanced.php +++ b/htdocs/core/modules/workstation/mod_workstation_advanced.php @@ -80,7 +80,7 @@ class mod_workstation_advanced extends ModeleNumRefWorkstation // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -133,7 +133,7 @@ class mod_workstation_advanced extends ModeleNumRefWorkstation require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->WORKSTATION_WORKSTATION_ADVANCED_MASK; + $mask = getDolGlobalString('WORKSTATION_WORKSTATION_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 369f60ea201..da1d2d58558 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -38,7 +38,7 @@ $langs->load("modulebuilder"); '.$langs->trans("DefineHereComplementaryAttributes", $textobject).'
'."\n"; +print ''.$langs->trans("DefineHereComplementaryAttributes", empty($textobject) ? '': $textobject).'
'."\n"; print '
'; // Load $extrafields->attributes diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 47eefb01be9..c714ad452c1 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -263,7 +263,7 @@ if (empty($reshook)) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) { $error++; - setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors'); + setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); } if (!$error) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)) { diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 24432cb7cf1..38f85c6c006 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -482,7 +482,7 @@ if ($resql) { if ($canedit) { print ''.$langs->trans("AddTrip").''; } else { - print ''.$langs->trans("AddTrip").''; + print ''.$langs->trans("AddTrip").''; } print ''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3212766a573..d4a0d587f68 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1432,7 +1432,7 @@ class CommandeFournisseur extends CommonOrder } - $this->special_code = $line->special_code; // TODO : remove this in 9.0 and add special_code param to addline() + //$this->special_code = $line->special_code; // TODO : remove this in 9.0 and add special_code param to addline() // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set $result = $this->addline( @@ -1454,7 +1454,8 @@ class CommandeFournisseur extends CommonOrder $line->date_start, $line->date_end, $line->array_options, - $line->fk_unit + $line->fk_unit, + $line->special_code ); if ($result < 0) { dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functionnal error @@ -1745,9 +1746,10 @@ class CommandeFournisseur extends CommonOrder * @param string $origin 'order', ... * @param int $origin_id Id of origin object * @param int $rang Rank + * @param int $special_code Special code * @return int <=0 if KO, >0 if OK */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $fk_prod_fourn_price = 0, $ref_supplier = '', $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $type = 0, $info_bits = 0, $notrigger = false, $date_start = null, $date_end = null, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $origin = '', $origin_id = 0, $rang = -1) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $fk_prod_fourn_price = 0, $ref_supplier = '', $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $type = 0, $info_bits = 0, $notrigger = false, $date_start = null, $date_end = null, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $origin = '', $origin_id = 0, $rang = -1, $special_code = 0) { global $langs, $mysoc, $conf; @@ -1871,7 +1873,7 @@ class CommandeFournisseur extends CommonOrder // Predefine quantity according to packaging if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $prod = new Product($this->db, $fk_product); + $prod = new Product($this->db); $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); if ($qty < $prod->packaging) { @@ -1880,9 +1882,9 @@ class CommandeFournisseur extends CommonOrder if (!empty($prod->packaging) && ($qty % $prod->packaging) > 0) { $coeff = intval($qty / $prod->packaging) + 1; $qty = $prod->packaging * $coeff; + setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); } } - setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); } } @@ -1957,7 +1959,7 @@ class CommandeFournisseur extends CommonOrder $this->line->total_localtax2 = $total_localtax2; $this->line->total_ttc = $total_ttc; $this->line->product_type = $type; - $this->line->special_code = $this->special_code; + $this->line->special_code = $special_code; $this->line->origin = $origin; $this->line->origin_id = $origin_id; $this->line->fk_unit = $fk_unit; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 5c6db6ce34d..2135c66dfee 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2074,7 +2074,7 @@ class FactureFournisseur extends CommonInvoice if (!empty($conf->global->SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY)) { // Check quantity is enough dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." qty=".$qty." ref_supplier=".$ref_supplier); - $prod = new Product($this->db, $fk_product); + $prod = new Product($this->db); if ($prod->fetch($fk_product) > 0) { $product_type = $prod->type; $label = $prod->label; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 67b8eb75fb4..c352faef1fc 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -555,13 +555,15 @@ if (empty($reshook)) { $ref_supplier = $productsupplier->ref_supplier; // Get vat rate + $tva_npr = 0; if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority) $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); + if (empty($tva_tx)) { + $tva_npr = 0; + } } - if (empty($tva_tx)) { - $tva_npr = 0; - } + $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); @@ -597,7 +599,7 @@ if (empty($reshook)) { $localtax1_tx, $localtax2_tx, $idprod, - 0, // We already have the $idprod always defined + $productsupplier->product_fourn_price_id, $ref_supplier, $remise_percent, $price_base_type, @@ -667,10 +669,10 @@ if (empty($reshook)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { @@ -2681,7 +2683,7 @@ if ($action == 'create') { $delallowed = $usercancreate; $modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF) ? '' : $conf->global->COMMANDE_SUPPLIER_ADDON_PDF)); - print $formfile->showdocuments('commande_fournisseur', $objref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 0, 0, '', '', '', $object->thirdparty->default_lang); + print $formfile->showdocuments('commande_fournisseur', $objref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 0, 0, '', '', '', $object->thirdparty->default_lang, '', $object); $somethingshown = $formfile->numoffiles; // Show links to link elements diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 68454c6772e..566864c765a 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -923,7 +923,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $errors[] = $langs->trans('ErrorEndDateCP'); break; case 'SQL_Create': - $errors[] = $langs->trans('ErrorSQLCreateCP').' '.htmlentities($_GET['msg']).''; + $errors[] = $langs->trans('ErrorSQLCreateCP'); break; case 'CantCreate': $errors[] = $langs->trans('CantCreateCP'); diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index c2e8833955b..d9f4073e11e 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -76,7 +76,7 @@ class Skill extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; const STATUS_CANCELED = 9; - const DEFAULT_MAX_RANK_PER_SKILL = 5; + const DEFAULT_MAX_RANK_PER_SKILL = 3; /** * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') @@ -251,7 +251,7 @@ class Skill extends CommonObject global $conf, $user, $langs; $MaxNumberSkill = isset($conf->global->HRM_MAXRANK) ? $conf->global->HRM_MAXRANK : self::DEFAULT_MAX_RANK_PER_SKILL; - $defaultSkillDesc = !empty($conf->global->HRM_DEFAULT_SKILL_DESCRIPTION) ? $conf->global->HRM_DEFAULT_SKILL_DESCRIPTION : 'no Description'; + $defaultSkillDesc = !empty($conf->global->HRM_DEFAULT_SKILL_DESCRIPTION) ? $conf->global->HRM_DEFAULT_SKILL_DESCRIPTION : $langs->trans("NoDescription"); $error = 0; diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 3a27d5898c0..9093766d3ed 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -123,11 +123,11 @@ if (empty($reshook)) { // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; + $noback = 1; + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; // action update on Skilldet - - $skilldetArray = GETPOST("descriptionline", "array"); + $skilldetArray = GETPOST("descriptionline", "array:alphanohtml"); if (!$error) { if (is_array($skilldetArray) && count($skilldetArray) > 0) { diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index 8bd15b7602e..48b0b78f381 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -141,14 +141,18 @@ class DoliStorage implements TokenStorageInterface dol_syslog("hasAccessToken service=".$service); $sql = "SELECT token FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql .= " WHERE service = '".$this->db->escape($service.($this->keyforprovider?'-'.$this->keyforprovider:''))."'"; + $sql .= " WHERE service = '".$this->db->escape($service.(empty($this->keyforprovider) ? '' : '-'.$this->keyforprovider))."'"; $sql .= " AND entity IN (".getEntity('oauth_token').")"; $resql = $this->db->query($sql); if (! $resql) { dol_print_error($this->db); } $result = $this->db->fetch_array($resql); - $token = unserialize($result['token']); + if ($result) { + $token = unserialize($result['token']); + } else { + $token = ''; + } $this->tokens[$service] = $token; diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 7ba761ce8f9..c35824fa235 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -109,7 +109,7 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '228', 'VO insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '229', 'VS0 - Vennootschap met sociaal oogmerk'); --- France: Extrait de http://www.insee.fr/fr/nom_def_met/nomenclatures/cj/cjniveau2.htm +-- France: Extrait de https://www.insee.fr/fr/information/2028129 insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'11','Artisan Commerçant (EI)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'12','Commerçant (EI)'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'13','Artisan (EI)'); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index a632a32271b..4a48e8b97fd 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -568,6 +568,7 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL; ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price ALTER COLUMN packaging DROP DEFAULT; ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL; diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 2ec43548bb6..b335cf7f3f6 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -85,7 +85,9 @@ UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'c DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo'); ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL; -ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL; +-- VMYSQL4.3 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL USING packaging::real; +-- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price ALTER COLUMN packaging DROP DEFAULT; -- For v14 diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index a945f078bbb..7eb3403e3ed 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -38,6 +38,7 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL; -- VMYSQL4.3 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL; -- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL USING packaging::real; +-- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price ALTER COLUMN packaging DROP DEFAULT; ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL; diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 8e2b004efda..0e2bde5c784 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -137,6 +137,10 @@ ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL; -- v16 +DROP TABLE llx_payment_salary_extrafields; +DROP TABLE llx_asset_model_extrafields; +DROP TABLE llx_asset_type_extrafields; + ALTER TABLE llx_projet_task_time ADD COLUMN intervention_id integer DEFAULT NULL; ALTER TABLE llx_projet_task_time ADD COLUMN intervention_line_id integer DEFAULT NULL; diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index fa61ba725de..2362036c93a 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -53,5 +53,11 @@ ALTER TABLE llx_facture ADD COLUMN close_missing_amount double(24, 8) after clos ALTER TABLE llx_facture_fourn ADD COLUMN close_missing_amount double(24, 8) after close_code; --- Allow users to make subscriptions of any amount during membership subscription +-- Allow users to make subscriptions of any amount during membership subscription ALTER TABLE llx_adherent_type ADD COLUMN caneditamount integer DEFAULT 0 AFTER amount; + +ALTER TABLE llx_inventory ADD COLUMN categories_product VARCHAR(255) DEFAULT NULL AFTER fk_product; + +ALTER TABLE llx_ticket ADD COLUMN ip varchar(250); + + diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 4add688b880..1cf808d9dd9 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -270,7 +270,7 @@ update llx_product set barcode = null where barcode in ('', '-1', '0'); update llx_societe set barcode = null where barcode in ('', '-1', '0'); --- Sequence to removed duplicated values of llx_links. Use several times if you still have duplicate. +-- Sequence to removed duplicated values of llx_links. Run several times if you still have duplicate. drop table tmp_links_double; --select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2; create table tmp_links_double as (select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2); @@ -279,7 +279,7 @@ delete from llx_links where (rowid, label) in (select max_rowid, label from tmp_ drop table tmp_links_double; --- Sequence to removed duplicated values of barcode in llx_product. Use several times if you still have duplicate. +-- Sequence to removed duplicated values of barcode in llx_product. Run several times if you still have duplicate. drop table tmp_product_double; --select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2; create table tmp_product_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2); @@ -288,7 +288,7 @@ update llx_product set barcode = null where (rowid, barcode) in (select max_rowi drop table tmp_product_double; --- Sequence to removed duplicated values of barcode in llx_societe. Use several times if you still have duplicate. +-- Sequence to removed duplicated values of barcode in llx_societe. Run several times if you still have duplicate. drop table tmp_societe_double; --select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2; create table tmp_societe_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2); @@ -297,7 +297,7 @@ update llx_societe set barcode = null where (rowid, barcode) in (select max_rowi drop table tmp_societe_double; --- Sequence to removed duplicated values of llx_accounting_account. Use several times if you still have duplicate. +-- Sequence to removed duplicated values of llx_accounting_account. Run several times if you still have duplicate. drop table tmp_accounting_account_double; --select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2; create table tmp_accounting_account_double as (select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2); @@ -415,6 +415,11 @@ ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); +UPDATE llx_facturedet SET fk_code_ventilation = 0 WHERE fk_code_ventilation > 0 AND fk_code_ventilation NOT IN (select rowid FROM llx_accounting_account); +UPDATE llx_facture_fourn_det SET fk_code_ventilation = 0 WHERE fk_code_ventilation > 0 AND fk_code_ventilation NOT IN (select rowid FROM llx_accounting_account); +UPDATE llx_expensereport_det SET fk_code_ventilation = 0 WHERE fk_code_ventilation > 0 AND fk_code_ventilation NOT IN (select rowid FROM llx_accounting_account); + + -- VMYSQL4.1 update llx_projet_task_time set task_datehour = task_date where task_datehour < task_date or task_datehour > DATE_ADD(task_date, interval 1 day); diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det_rec.extrafields.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det_rec_extrafields.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_facture_fourn_det_rec.extrafields.key.sql rename to htdocs/install/mysql/tables/llx_facture_fourn_det_rec_extrafields.key.sql diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det_rec.extrafields.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det_rec_extrafields.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_facture_fourn_det_rec.extrafields.sql rename to htdocs/install/mysql/tables/llx_facture_fourn_det_rec_extrafields.sql diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_rec.extrafields.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_rec_extrafields.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_facture_fourn_rec.extrafields.key.sql rename to htdocs/install/mysql/tables/llx_facture_fourn_rec_extrafields.key.sql diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_rec.extrafields.sql b/htdocs/install/mysql/tables/llx_facture_fourn_rec_extrafields.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_facture_fourn_rec.extrafields.sql rename to htdocs/install/mysql/tables/llx_facture_fourn_rec_extrafields.sql diff --git a/htdocs/install/mysql/tables/llx_inventory-stock.sql b/htdocs/install/mysql/tables/llx_inventory-stock.sql index c25ccb9767b..0c7a6d2eb49 100644 --- a/htdocs/install/mysql/tables/llx_inventory-stock.sql +++ b/htdocs/install/mysql/tables/llx_inventory-stock.sql @@ -28,8 +28,9 @@ CREATE TABLE llx_inventory fk_user_modif integer, -- user making last change fk_user_valid integer, -- valideur de la fiche fk_warehouse integer DEFAULT NULL, - fk_product integer DEFAULT NULL, - status integer DEFAULT 0, + fk_product integer DEFAULT NULL, + categories_product varchar(255) DEFAULT NULL, -- product categories id separated by comma + status integer DEFAULT 0, title varchar(255) NOT NULL, date_inventory datetime DEFAULT NULL, date_validation datetime DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql index d079fdf3964..1f60cb3e6f8 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.sql @@ -40,6 +40,7 @@ CREATE TABLE llx_ticket date_close datetime, notify_tiers_at_create tinyint, email_msgid varchar(255), -- if ticket is created by email collector, we store here MSG ID + ip varchar(250), tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php index 8cdbee53395..ba0cf9818dc 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php @@ -79,7 +79,7 @@ class mod_knowledgerecord_advanced extends ModeleNumRefKnowledgeRecord // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -132,7 +132,7 @@ class mod_knowledgerecord_advanced extends ModeleNumRefKnowledgeRecord require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADVANCED_MASK; + $mask = getDolGlobalString('KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 2ee700e5af0..5d256c4c80f 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -280,7 +280,7 @@ DescVentilExpenseReportMore=If you setup accounting account on type of expense r DescVentilDoneExpenseReport=Consult here the list of the lines of expenses reports and their fees accounting account Closure=Annual closure -DescClosure=Consult here the number of movements by month who are not yet validated & locked +DescClosure=Consult here the number of movements by month not yet validated & locked OverviewOfMovementsNotValidated=Overview of movements not validated and locked AllMovementsWereRecordedAsValidated=All movements were recorded as validated and locked NotAllMovementsCouldBeRecordedAsValidated=Not all movements could be recorded as validated and locked diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9de9cd23ef4..16c39de46b9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -109,7 +109,7 @@ NextValueForReplacements=Next value (replacements) MustBeLowerThanPHPLimit=Note: your PHP configuration currently limits the maximum filesize for upload to %s %s, irrespective of the value of this parameter NoMaxSizeByPHPLimit=Note: No limit is set in your PHP configuration MaxSizeForUploadedFiles=Maximum size for uploaded files (0 to disallow any upload) -UseCaptchaCode=Use graphical code (CAPTCHA) on login page +UseCaptchaCode=Use graphical code (CAPTCHA) on login page and some public pages AntiVirusCommand=Full path to antivirus command AntiVirusCommandExample=Example for ClamAv Daemon (require clamav-daemon): /usr/bin/clamdscan
Example for ClamWin (very very slow): c:\\Progra~1\\ClamWin\\bin\\clamscan.exe AntiVirusParam= More parameters on command line @@ -504,7 +504,7 @@ WarningPHPMailC=- Using the SMTP server of your own Email Service Provider to se WarningPHPMailD=Also, it is therefore recommended to change the sending method of e-mails to the value "SMTP". If you really want to keep the default "PHP" method to send emails, just ignore this warning, or remove it by setting the MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP constant to 1 in Home - Setup - Other. WarningPHPMail2=If your email SMTP provider need to restrict email client to some IP addresses (very rare), this is the IP address of the mail user agent (MUA) for your ERP CRM application: %s. WarningPHPMailSPF=If the domain name in your sender email address is protected by a SPF record (ask your domain name registar), you must add the following IPs in the SPF record of the DNS of your domain: %s. -ActualMailSPFRecordFound=Actual SPF record found : %s +ActualMailSPFRecordFound=Actual SPF record found (for email %s) : %s ClickToShowDescription=Click to show description DependsOn=This module needs the module(s) RequiredBy=This module is required by module(s) diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 62c2752ff9f..1b39825d4ac 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -100,3 +100,4 @@ ActionCommCategoriesArea=Event Categories WebsitePagesCategoriesArea=Page-Container Categories KnowledgemanagementsCategoriesArea=KM article Categories UseOrOperatorForCategories=Use 'OR' operator for categories +AddObjectIntoCategory=Add object into category diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 1cac73d2394..cbd3dc91663 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -88,4 +88,5 @@ DeleteSkill = Skill removed SkillsExtraFields=Attributs supplémentaires (Compétences) JobsExtraFields=Attributs supplémentaires (Emplois) EvaluationsExtraFields=Attributs supplémentaires (Evaluations) -NeedBusinessTravels=Need business travels \ No newline at end of file +NeedBusinessTravels=Need business travels +NoDescription=No description \ No newline at end of file diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 6aee82bacec..135cb51a01b 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -213,3 +213,5 @@ ClickHereToGoToApp=Click here to go to your application ClickOnLinkOrRemoveManualy=If an upgrade is in progress, please wait. If not, click on the following link. If you always see this same page, you must remove/rename the file install.lock in the documents directory. Loaded=Loaded FunctionTest=Function test +NodoUpgradeAfterDB=No action requested by external modules after upgrade of database +NodoUpgradeAfterFiles=No action requested by external modules after upgrade of files or directories \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index bfab238dc27..317897e7426 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -345,7 +345,7 @@ KiloBytes=Kilobytes MegaBytes=Megabytes GigaBytes=Gigabytes TeraBytes=Terabytes -UserAuthor=Ceated by +UserAuthor=Created by UserModif=Updated by b=b. Kb=Kb @@ -712,6 +712,7 @@ FeatureDisabled=Feature disabled MoveBox=Move widget Offered=Offered NotEnoughPermissions=You don't have permission for this action +UserNotInHierachy=This action is reserved to the supervisors of this user SessionName=Session name Method=Method Receive=Receive diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 94d77315217..46766dcafb4 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -427,3 +427,4 @@ RealValuation=Real Valuation ConfirmEditExtrafield = Select the extrafield you want modify ConfirmEditExtrafieldQuestion = Are you sure you want to modify this extrafield? ModifyValueExtrafields = Modify value of an extrafield +OrProductsWithCategories=Or products with tags/categories diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 8ff20570316..f34f338c931 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -90,8 +90,8 @@ TicketPublicAccess=A public interface requiring no identification is available a TicketSetupDictionaries=The type of ticket, severity and analytic codes are configurable from dictionaries TicketParamModule=Module variable setup TicketParamMail=Email setup -TicketEmailNotificationFrom=Sender e-mail for ticket answers -TicketEmailNotificationFromHelp=Sender e-mail for ticket answers sent from Dolibarr +TicketEmailNotificationFrom=Sender e-mail for notification on answers +TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification email when an answer is provided inside the backoffice. For example noreply@example.com TicketEmailNotificationTo=Notify ticket creation to this e-mail address TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation TicketNewEmailBodyLabel=Text message sent after creating a ticket diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 0c6672998b4..47c717d114d 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -279,7 +279,7 @@ DescVentilExpenseReportMore=Si vous avez défini des comptes comptables au nivea DescVentilDoneExpenseReport=Consultez ici la liste des lignes des notes de frais et leur compte comptable Closure=Clôture annuelle -DescClosure=Consulter le nombre de mouvements par mois non validés et les périodes fiscales déjà ouvertes +DescClosure=Consulter le nombre de mouvements par mois non validés et vérrouillés OverviewOfMovementsNotValidated=Aperçu des mouvements non validés et verrouillés AllMovementsWereRecordedAsValidated=Tous les mouvements ont été enregistrés comme validés et ont été verrouillés NotAllMovementsCouldBeRecordedAsValidated=Certains mouvements n'ont pas pu être enregistrés comme validés et n'ont pas été verrouillés diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index b0073665fc2..18df6512558 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -412,3 +412,4 @@ SwitchOnSaleStatus=Basculer le statut En vente SwitchOnPurchaseStatus=Basculer le statut En achat StockMouvementExtraFields= Champs supplémentaires (mouvement de stock) PuttingPricesUpToDate=Mettre à jour les prix +OrProductsWithCategories=Ou produits avec tags/categories diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9b2beafe8a4..c1ce8b4cf59 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -210,7 +210,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) } else { // Get remote IP: PS: We do not use getRemoteIP(), function is not yet loaded and we need a value that can't be spoofed $ip = (empty($_SERVER['REMOTE_ADDR']) ? 'unknown' : $_SERVER['REMOTE_ADDR']); - $errormessage = 'Access refused to '.$ip.' by SQL or Script injection protection in main.inc.php - GETPOST type='.htmlentities($type).' paramkey='.htmlentities($key).' paramvalue='.htmlentities($value).' page='.htmlentities($_SERVER["REQUEST_URI"]); + $errormessage = 'Access refused to '.htmlentities($ip, ENT_COMPAT, 'UTF-8').' by SQL or Script injection protection in main.inc.php - GETPOST type='.htmlentities($type, ENT_COMPAT, 'UTF-8').' paramkey='.htmlentities($key, ENT_COMPAT, 'UTF-8').' paramvalue='.htmlentities($value, ENT_COMPAT, 'UTF-8').' page='.htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8'); print $errormessage; // Add entry into error log if (function_exists('error_log')) { diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index eedb4de0b13..767cb1105fc 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -70,8 +70,18 @@ class MyObject extends CommonObject /** - * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') - * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'type' field format: + * 'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', + * 'select' (list of values are in 'options'), + * 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', + * 'chkbxlst:...', + * 'varchar(x)', + * 'text', 'text:none', 'html', + * 'double(24,8)', 'real', 'price', + * 'date', 'datetime', 'timestamp', 'duration', + * 'boolean', 'checkbox', 'radio', 'array', + * 'mail', 'phone', 'url', 'password', 'ip' + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 8ea8a575eca..edf0c7647de 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -221,9 +221,9 @@ class modMyModule extends DolibarrModules // Name of columns with primary key (try to always name it 'rowid') 'tabrowid'=>array("rowid", "rowid", "rowid"), // Condition to show each dictionary - 'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled) - // Help tooltip for each fields of the dictionary - 'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp'))) + 'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled), + // Tooltip for every fields of dictionaries: DO NOT PUT AN EMPTY ARRAY + 'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), ...), ); */ diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 561a705dc4b..561c09f88d6 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -898,8 +898,8 @@ class pdf_standard_myobject extends ModelePDFMyObject pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK))) { - pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); + if ($object->statut == $object::STATUS_DRAFT && getDolGlobalString('MYMODULE_DRAFT_WATERMARK')) { + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', dol_escape_htmltag(getDolGlobalString('MYMODULE_DRAFT_WATERMARK'))); } $pdf->SetTextColor(0, 0, 60); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php index 0573edc6b2a..61186a3b4f3 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php @@ -79,7 +79,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; @@ -130,7 +130,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->MYMODULE_MYOBJECT_ADVANCED_MASK; + $mask = getDolGlobalString('MYMODULE_MYOBJECT_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 09f4ad8d268..0a953ea869c 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -25,6 +25,7 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index d726152eaa4..610d690944b 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -471,7 +471,7 @@ print ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -132,7 +132,7 @@ class mod_partnership_advanced extends ModeleNumRefPartnership require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->PARTNERSHIP_ADVANCED_MASK; + $mask = getDolGlobalString('PARTNERSHIP_ADVANCED_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index a0849f082e8..cc85407d391 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -135,7 +135,12 @@ if ($mode == 'setup' && $user->admin) { $submit_enabled = 0; if (!empty($driver)) { - $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + if (!empty($conf->modules_parts['printing'])) { + $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + } else { + $dirmodels = array('/core/modules/printing/'); + } + foreach ($dirmodels as $dir) { if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) { $classfile = dol_buildpath($dir, 0).$driver.'.modules.php'; @@ -253,7 +258,13 @@ if ($mode == 'config' && $user->admin) { $object = new PrintingDriver($db); $result = $object->listDrivers($db, 10); - $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + + if (!empty($conf->modules_parts['printing'])) { + $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + } else { + $dirmodels = array('/core/modules/printing/'); + } + foreach ($result as $driver) { foreach ($dirmodels as $dir) { if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) { @@ -296,7 +307,12 @@ if ($mode == 'test' && $user->admin) { print '
'; - print $langs->trans("AddProjectIntoCategory").'  '; + print $langs->trans("AddObjectIntoCategory").'  '; print $form->select_dolusers('', 'elemid'); print '
   '; @@ -214,8 +218,12 @@ if ($result) { print '
'; - print ''; - print img_object($langs->trans("ShowBill"), "bill"); - print ' '.$obj->invoiceref."'.$obj->code_client."'; + $link_to_tab = '/comm/card.php?socid='; + $link_code = $obj->code_client; + if ($type == 'bank-transfer') { + $link_to_tab = '/fourn/card.php?socid='; + $link_code = $obj->code_fournisseur; + } + print ''.$link_code."'.dol_print_date($db->jdate($obj->datec), 'day')."
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).'   
'; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MEMBER_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString('MEMBER_ADDON_PDF_ODT_PATH')))); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -151,7 +151,7 @@ class doc_generic_member_odt extends ModelePDFMember $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php index ffbd14a88fb..110afe442c2 100644 --- a/htdocs/core/modules/modIncoterm.class.php +++ b/htdocs/core/modules/modIncoterm.class.php @@ -93,7 +93,8 @@ class modIncoterm extends DolibarrModules 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array($conf->incoterm->enabled) + 'tabcond'=>array($conf->incoterm->enabled), + 'tabhelp' => array(array()) ); $this->boxes = array(); // List of boxes diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php index ba518159dbf..5588d1cae16 100644 --- a/htdocs/core/modules/mrp/mod_mo_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -80,7 +80,7 @@ class mod_mo_advanced extends ModeleNumRefMos // Parametrage du prefix $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'; $adresseadmin = $object->mail_admin; print $langs->trans("Title").''; if ($action == 'edit') { - print ''; + print ''; } else { print dol_htmlentities($object->title); } diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php index 5d348843941..d717bdc49bf 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php @@ -79,7 +79,7 @@ class mod_partnership_advanced extends ModeleNumRefPartnership // Parametrage du prefix $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'; if (!empty($driver)) { - $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + if (!empty($conf->modules_parts['printing'])) { + $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + } else { + $dirmodels = array('/core/modules/printing/'); + } + foreach ($dirmodels as $dir) { if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) { $classfile = dol_buildpath($dir, 0).$driver.'.modules.php'; diff --git a/htdocs/printing/index.php b/htdocs/printing/index.php index 2d20db4ddf7..7ce4399501b 100644 --- a/htdocs/printing/index.php +++ b/htdocs/printing/index.php @@ -59,7 +59,7 @@ foreach ($result as $driver) { $langs->load($driver); $printer = new $classname($db); $keyforprinteractive = $printer->active; - if ($keyforprinteractive && $conf->global->$keyforprinteractive) { + if ($keyforprinteractive && getDolGlobalString($keyforprinteractive)) { //$printer->listJobs('commande'); $result = $printer->listJobs(); print $printer->resprint; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 75e539bf9c8..1681ef45387 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1352,8 +1352,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ((!empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') || (!empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced')) { print ''; - $inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK; - $inherited_mask_sn = $conf->global->SN_ADVANCED_MASK; + $inherited_mask_lot = getDolGlobalString('LOT_ADVANCED_MASK'); + $inherited_mask_sn = getDolGlobalString('SN_ADVANCED_MASK'); print '
'.$langs->trans("ManageLotMask").''; print $form->textwithpicto('', $tooltip, 1, 1); print '