';
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index fac32e62e5e..1bc009491d1 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -259,7 +259,6 @@ class FormActions
}
$ref = $actioncomm->getNomUrl(1, -1);
- $label = $actioncomm->getNomUrl(0, 36);
print '
';
@@ -304,7 +303,7 @@ class FormActions
print '';
// Label
- print '| '.$label.' | ';
+ print ''.$actioncomm->getNomUrl(0, 36).' | ';
// Date
print ''.dol_print_date($actioncomm->datep, 'dayhour', 'tzuserrel');
diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php
index 9f9a096c0b9..1c4a18a9c1f 100644
--- a/htdocs/core/class/html.formadmin.class.php
+++ b/htdocs/core/class/html.formadmin.class.php
@@ -113,7 +113,7 @@ class FormAdmin
$out .= '>'.$langs->trans("AutoDetectLang").'';
}
- asort($langs_available);
+ asort($langs_available); // array('XX' => 'Language (Country)', ...)
foreach ($langs_available as $key => $value) {
$valuetoshow = $value;
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index f3b42a4789e..97f5eca5822 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1470,7 +1470,7 @@ class FormFile
print ' | ';
if ($useinecm == 1 || $useinecm == 5) { // ECM manual tree only
// $section is inside $param
- $newparam .= preg_replace('/&file=.*$/', '', $param); // We don't need param file=
+ $newparam = preg_replace('/&file=.*$/', '', $param); // We don't need param file=
$backtopage = DOL_URL_ROOT.'/ecm/index.php?§ion_dir='.urlencode($relativepath).$newparam;
print ''.img_edit('default', 0, 'class="paddingrightonly"').'';
}
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index cadcee37b8c..ad6a6c12508 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1697,4 +1697,9 @@ class ModelMail
public $content_lines;
public $lang;
public $joinfiles;
+
+ /**
+ * @var string Module the template is dedicated for
+ */
+ public $module;
}
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index 8682939f267..b085ce49db0 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -161,9 +161,10 @@ function versiondolibarrarray()
* @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0)
* @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value
* @param int $colspan 2=Add a colspan=2 on td
+ * @param int $onlysqltoimportwebsite Only sql resquests used to import a website template is allowed
* @return int <=0 if KO, >0 if OK
*/
-function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0)
+function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0, $onlysqltoimportwebsite = 0)
{
global $db, $conf, $langs, $user;
@@ -323,6 +324,52 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
$keyforsql = md5($sqlfile);
foreach ($arraysql as $i => $sql) {
if ($sql) {
+ // Test if sql is allowed
+ if ($onlysqltoimportwebsite) {
+ $newsql = str_replace(array("\'"), '__BACKSLASHQUOTE__', $sql);
+ // Remove all strings contents
+ $l = strlen($newsql);
+ $is = 0;
+ $quoteopen = 0;
+ $newsqlclean = '';
+ while ($is < $l) {
+ $char = $newsql[$is];
+ if ($char == "'") {
+ if ($quoteopen) {
+ $quoteopen--;
+ } else {
+ $quoteopen++;
+ }
+ } elseif (empty($quoteopen)) {
+ $newsqlclean .= $char;
+ }
+ $is++;
+ }
+ $newsqlclean = str_replace(array("null"), '__000__', $newsqlclean);
+ //print $newsqlclean." \n";
+
+ // A very small control. This can still by bypassed by adding a second SQL request concatenated
+ $qualified = 0;
+ if (preg_match('/^--/', $newsqlclean)) {
+ $qualified = 1;
+ } elseif (preg_match('/^UPDATE llx_website SET fk_default_home = \d+\+\d+ WHERE rowid = \d+;$/', $newsqlclean)) {
+ $qualified = 1;
+ } elseif (preg_match('/^INSERT INTO llx_website_page\([a-z0-9_\s,]+\) VALUES\([0-9_\s,\+]+\);$/', $newsqlclean)) {
+ // Insert must match
+ // INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, image, keywords, status, date_creation, tms, import_key, grabbed_from, type_container, htmlheader, content, author_alias) VALUES(1+123, null, 17, , , , , , , , , , , null, , , , , );
+ $qualified = 1;
+ }
+
+ if (!$qualified) {
+ $error++;
+ //print 'Request '.($i + 1)." contains non allowed instructions. \n";
+ //print "newsqlclean = ".$newsqlclean." \n";
+ dol_syslog('Admin.lib::run_sql Request '.($i + 1)." contains non allowed instructions.", LOG_DEBUG);
+ dol_syslog('$newsqlclean='.$newsqlclean, LOG_DEBUG);
+ break;
+ }
+ }
+
// Replace the prefix tables
if (MAIN_DB_PREFIX != 'llx_') {
$sql = preg_replace('/llx_/i', MAIN_DB_PREFIX, $sql);
@@ -365,7 +412,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
$sqlmodified++;
}
- // Replace __x__ with rowid of insert nb x
+ // Replace __x__ with the rowid of the result of the insert number x
while (preg_match('/__([0-9]+)__/', $newsql, $reg)) {
$cursor = $reg[1];
if (empty($listofinsertedrowid[$cursor])) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 84d3445442e..5940a0d58c4 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -342,7 +342,7 @@ function dol_shutdown()
$depth = $db->transaction_opened;
$disconnectdone = $db->close();
}
- dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ?LOG_WARNING:LOG_INFO));
+ dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
}
/**
@@ -3887,7 +3887,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building',
- 'card', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
+ 'card', 'calendarlist', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes',
'currency', 'multicurrency',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice',
@@ -3947,7 +3947,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter',
- 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
+ 'list-alt'=>'list-alt', 'calendarlist'=>'bars', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'currency'=>'dollar-sign', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
@@ -10045,7 +10045,7 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
- $dictvalues[$obj->{$rowidfield}] = $obj;
+ $dictvalues[$obj->{$rowidfield}] = $obj; // $obj is stdClass
}
} else {
dol_print_error($db);
@@ -10056,7 +10056,8 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi
if (!empty($dictvalues[$id])) {
// Found
- return $dictvalues[$id]->{$field};
+ $tmp = $dictvalues[$id];
+ return (property_exists($tmp, $field) ? $tmp->$field : '');
} else {
// Not found
return '';
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index ca94353ee19..709d6e5d404 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -2359,13 +2359,13 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) {
$object->note_public = dol_concatdesc($object->note_public, ' '.$outputlangs->transnoentities("RefOrder").' : ');
foreach ($objects as $elementobject) {
- $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '').($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : '').' ');
+ $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ? ' ('.$elementobject->ref_client.')' : '').(!empty($elementobject->ref_supplier) ? ' ('.$elementobject->ref_supplier.')' : '').' ');
$object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs).' ');
}
} elseif (count($objects) == 1) {
$elementobject = array_shift($objects);
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder");
- $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '').($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : '');
+ $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ? ' ('.$elementobject->ref_client.')' : '').(!empty($elementobject->ref_supplier) ? ' ('.$elementobject->ref_supplier.')' : '');
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date, 'day', '', $outputlangs);
}
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 56aa24a8523..14b25a517c6 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -2,7 +2,8 @@
/* Copyright (C) 2006-2015 Laurent Destailleur
* Copyright (C) 2010 Regis Houssin
* Copyright (C) 2011 Juanjo Menent
- * Copyright (C) 2018-2021 Frédéric France
+ * Copyright (C) 2018-2021 Frédéric France
+ * 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
@@ -208,7 +209,7 @@ function project_prepare_head(Project $project, $moreparam = '')
$h++;
}
- if ($conf->eventorganization->enabled && !empty($project->usage_organize_event)) {
+ if (!empty($conf->eventorganization->enabled) && !empty($project->usage_organize_event)) {
$langs->load('eventorganization');
$head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id;
$head[$h][1] = $langs->trans("EventOrganization");
@@ -635,7 +636,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = $lines[$i]->ref;
- $taskstatic->label = ($taskrole[$lines[$i]->id] ? $langs->trans("YourRole").': '.$taskrole[$lines[$i]->id] : '');
+ $taskstatic->label = (!empty($taskrole[$lines[$i]->id]) ? $langs->trans("YourRole").': '.$taskrole[$lines[$i]->id] : '');
$taskstatic->projectstatus = $lines[$i]->projectstatus;
$taskstatic->progress = $lines[$i]->progress;
$taskstatic->fk_statut = $lines[$i]->status;
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 3e0ac2d371d..0137a9bd67a 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -2003,7 +2003,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
$newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire);
}
if (!empty($conf->propal->enabled) || (!empty($conf->commande->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
- $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire);
+ $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire);
}
// Categories
@@ -2020,7 +2020,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
$newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer);
$newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire);
if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_oder->enabled) || !empty($conf->supplier_invoice->enabled)) {
- $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire || $user->rights->product->lire);
+ $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire);
}
// Categories
if (!empty($conf->categorie->enabled)) {
diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
index ef43bb57e05..23917c4b79c 100644
--- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
+++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
@@ -246,6 +246,7 @@ class doc_generic_bom_odt extends ModelePDFBom
}
$object->fetch_thirdparty();
+ $object->fetch_product();
$dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
$objectref = dol_sanitizeFileName($object->ref);
diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php
index 0cc9324ef16..8c9ef0385eb 100644
--- a/htdocs/core/modules/commande/mod_commande_marbre.php
+++ b/htdocs/core/modules/commande/mod_commande_marbre.php
@@ -48,6 +48,18 @@ class mod_commande_marbre extends ModeleNumRefCommandes
public $name = 'Marbre';
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ global $conf, $mysoc;
+
+ if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') {
+ $this->prefix = 'SO'; // We use correct standard code "SO = Sale Order"
+ }
+ }
+
/**
* Return description of numbering module
*
diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php
index ef34b145e52..9e0ff0d5b4e 100644
--- a/htdocs/core/modules/facture/mod_facture_mars.php
+++ b/htdocs/core/modules/facture/mod_facture_mars.php
@@ -55,7 +55,15 @@ class mod_facture_mars extends ModeleNumRefFactures
*/
public function __construct()
{
- global $conf;
+ global $conf, $mysoc;
+
+ if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') {
+ $this->prefixinvoice = 'IN'; // We use correct standard code "IN = Invoice"
+ $this->prefixreplacement = 'IR';
+ $this->prefixdeposit = 'ID';
+ $this->prefixcreditnote = 'IC';
+ }
+
if (!empty($conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX)) {
$this->prefixinvoice = $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX;
}
diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php
index 9660be93266..2b11ee3976f 100644
--- a/htdocs/core/modules/facture/mod_facture_terre.php
+++ b/htdocs/core/modules/facture/mod_facture_terre.php
@@ -42,6 +42,12 @@ class mod_facture_terre extends ModeleNumRefFactures
*/
public $prefixinvoice = 'FA';
+ /**
+ * Prefix for replacement invoices
+ * @var string
+ */
+ public $prefixreplacement = 'FA';
+
/**
* Prefix for credit note
* @var string
@@ -65,7 +71,15 @@ class mod_facture_terre extends ModeleNumRefFactures
*/
public function __construct()
{
- global $conf;
+ global $conf, $mysoc;
+
+ if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') {
+ $this->prefixinvoice = 'IN'; // We use correct standard code "IN = Invoice"
+ $this->prefixreplacement = 'IR';
+ $this->prefixdeposit = 'ID';
+ $this->prefixcreditnote = 'IC';
+ }
+
if (!empty($conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX)) {
$this->prefixinvoice = $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX;
}
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index 322988e7a7b..327262ce39f 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -832,8 +832,18 @@ class modSociete extends DolibarrModules
's.note_public' => "My public note"
);
$this->import_updatekeys_array[$r] = array(
- 's.rowid' => 'Id'
+ 's.rowid' => 'Id',
+ 's.lastname' => "Lastname",
);
+ if (!empty($conf->socialnetworks->enabled)) {
+ $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1";
+ $resql = $this->db->query($sql);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $fieldname = 's.socialnetworks_'.$obj->code;
+ $fieldlabel = ucfirst($obj->label);
+ $this->import_updatekeys_array[$r][$fieldname] = $fieldlabel;
+ }
+ }
// Import Bank Accounts
$r++;
diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php
index 955e9dd479a..ddcb23da891 100644
--- a/htdocs/core/tpl/filemanager.tpl.php
+++ b/htdocs/core/tpl/filemanager.tpl.php
@@ -94,9 +94,11 @@ if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage med
print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
print '';
} elseif ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm
- print '';
- print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
- print '';
+ if (getDolGlobalInt('ECM_SHOW_GENERATE_WEBP_BUTTON')) {
+ print '';
+ print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
+ print '';
+ }
}
print " |