';
if ($possiblelink['label'] == 'LinkToContract') {
$form = new Form($this->db);
diff --git a/htdocs/core/commonfieldsinexport.inc.php b/htdocs/core/commonfieldsinexport.inc.php
index a02a21afdd6..3b201e4f10a 100644
--- a/htdocs/core/commonfieldsinexport.inc.php
+++ b/htdocs/core/commonfieldsinexport.inc.php
@@ -37,7 +37,7 @@ if (class_exists($keyforclass)) {
/*
* case 'sellist':
* $tmp='';
- * $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
+ * $tmpparam=jsonOrUnserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
* if ($tmpparam['options'] && is_array($tmpparam['options'])) {
* $tmpkeys=array_keys($tmpparam['options']);
* $tmp=array_shift($tmpkeys);
diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php
index 861ef142c25..70dd0077e57 100644
--- a/htdocs/core/extrafieldsinexport.inc.php
+++ b/htdocs/core/extrafieldsinexport.inc.php
@@ -39,7 +39,7 @@ if ($resql) { // This can fail when class is used on old database (during mig
case 'checkbox':
case 'select':
if (!empty($conf->global->EXPORT_LABEL_FOR_SELECT)) {
- $tmpparam = unserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...)
+ $tmpparam = jsonOrUnserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...)
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$typeFilter = "Select:".$obj->param;
}
@@ -47,7 +47,7 @@ if ($resql) { // This can fail when class is used on old database (during mig
break;
case 'sellist':
$tmp = '';
- $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
+ $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpkeys = array_keys($tmpparam['options']);
$tmp = array_shift($tmpkeys);
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 7e34eec5ecd..05d8c6c4ec5 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -377,7 +377,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
$ecmfile->fullpath_orig = $filearray[$key]['fullname'];
$ecmfile->gen_or_uploaded = 'unknown';
$ecmfile->description = ''; // indexed content
- $ecmfile->keyword = ''; // keyword content
+ $ecmfile->keywords = ''; // keyword content
$result = $ecmfile->create($user);
if ($result < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
@@ -933,7 +933,7 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
$ecmfile->fullpath_orig = $srcfile;
$ecmfile->gen_or_uploaded = 'unknown';
$ecmfile->description = ''; // indexed content
- $ecmfile->keyword = ''; // keyword content
+ $ecmfile->keywords = ''; // keyword content
$resultecm = $ecmfile->create($user);
if ($resultecm < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
@@ -1785,7 +1785,7 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
$ecmfile->fullpath_orig = $fullpathorig;
$ecmfile->gen_or_uploaded = $mode;
$ecmfile->description = ''; // indexed content
- $ecmfile->keyword = ''; // keyword content
+ $ecmfile->keywords = ''; // keyword content
if (is_object($object) && $object->id > 0) {
$ecmfile->src_object_id = $object->id;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index e3b288aff8e..28c553d747c 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -778,8 +778,12 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
do {
$oldstringtoclean = $out;
- // We replace chars encoded with numeric HTML entities with real char (to avoid to have numeric entities used for obfuscation of injections)
- $out = preg_replace_callback('/(x?[0-9][0-9a-f]+);/i', 'realCharForNumericEntities', $out);
+ // We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step.
+ // No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are
+ // using a non coventionnel way to be encoded, to not have them sanitized just after)
+ $out = preg_replace_callback('/(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $out);
+
+ // Now we remove all remaining HTML entities staring with a number. We don't want such entities.
$out = preg_replace('/?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'.
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
@@ -989,7 +993,7 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
function dol_clone($object, $native = 0)
{
if (empty($native)) {
- $myclone = unserialize(serialize($object));
+ $myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields
} else {
$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable)
}
@@ -10297,9 +10301,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
*/
function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '')
{
+ /*
global $conf;
- /*if (!empty($conf->dol_no_mouse_hover)) {
+ if (!empty($conf->dol_no_mouse_hover)) {
$showonlyonhover = 0;
}*/
@@ -10311,3 +10316,20 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex
return $result;
}
+
+
+/**
+ * Decode an encode string. The string can be encoded in json format (recommended) or with serialize (avoid this)
+ *
+ * @param string $stringtodecode String to decode (json or serialize coded)
+ * @return mixed The decoded object.
+ */
+function jsonOrUnserialize($stringtodecode)
+{
+ $result = json_decode($stringtodecode);
+ if ($result === null) {
+ $result = unserialize($stringtodecode);
+ }
+
+ return $result;
+}
diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php
index f87e7b7b4cd..3398189a771 100644
--- a/htdocs/core/lib/geturl.lib.php
+++ b/htdocs/core/lib/geturl.lib.php
@@ -223,7 +223,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
// Set CURLOPT_CONNECT_TO so curl will not try another resolution that may give a different result. Possible only on PHP v7+
if (defined('CURLOPT_CONNECT_TO')) {
- $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], $newUrlArray['port'], $iptocheck, $newUrlArray['port']));
+ $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], empty($newUrlArray['port'])?'':$newUrlArray['port'], $iptocheck, empty($newUrlArray['port'])?'':$newUrlArray['port']));
//var_dump($newUrlArray);
//var_dump($connect_to);
curl_setopt($ch, CURLOPT_CONNECT_TO, $connect_to);
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index d20a0348d3d..93c061310a5 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -849,7 +849,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Contacts of task
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
- print '
';
+ print '
';
foreach (array('internal', 'external') as $source) {
$tab = $lines[$i]->liste_contact(-1, $source);
$num = count($tab);
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index 9eb6a43f9b0..b032ba5beb4 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -76,8 +76,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Third parties
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&leftmenu=thirdparties', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index 1dc8ce74db0..83ccd391bd9 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -251,7 +251,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
} else {
- $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default
+ $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
}
diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
index a1c01002d2e..39ea743c5de 100644
--- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
+++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
@@ -240,7 +240,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
} else {
- $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default
+ $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
}
diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
index aed43ea40ac..f6f4b0b1a2a 100644
--- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
@@ -201,14 +201,13 @@ class pdf_espadon extends ModelePdfExpedition
continue;
}
- $objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir;
} else {
- $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
+ $pdir = get_exdir(0, 0, 0, 0, $objphoto, 'product');
$dir = $conf->product->dir_output.'/'.$pdir;
}
@@ -609,7 +608,7 @@ class pdf_espadon extends ModelePdfExpedition
$posYAfterDescription = $pdf->GetY();
}
- $nexY = $pdf->GetY();
+ $nexY = max($pdf->GetY(), $posYAfterImage);
$pageposafter = $pdf->getPage();
$pdf->setPage($pageposbefore);
diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php
index 2d15f3999d0..88ae937bb6d 100644
--- a/htdocs/core/modules/export/export_csv.modules.php
+++ b/htdocs/core/modules/export/export_csv.modules.php
@@ -277,8 +277,8 @@ class ExportCsv extends ModeleExports
$newvalue = $this->csvClean($newvalue, $outputlangs->charset_output);
- if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) {
- $array = unserialize($typefield);
+ if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) {
+ $array = json_decode($typefield, true);
$array = $array['options'];
$newvalue = $array[$newvalue];
}
diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php
index 370fc49df7e..54842ff8278 100644
--- a/htdocs/core/modules/export/export_excel2007.modules.php
+++ b/htdocs/core/modules/export/export_excel2007.modules.php
@@ -315,8 +315,8 @@ class ExportExcel2007 extends ModeleExports
$newvalue = $this->excel_clean($newvalue);
$typefield = isset($array_types[$code]) ? $array_types[$code] : '';
- if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) {
- $array = unserialize($typefield);
+ if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) {
+ $array = json_decode($typefield, true);
$array = $array['options'];
$newvalue = $array[$newvalue];
}
diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php
index c93787a762c..7718dd3e350 100644
--- a/htdocs/core/modules/export/export_tsv.modules.php
+++ b/htdocs/core/modules/export/export_tsv.modules.php
@@ -252,8 +252,8 @@ class ExportTsv extends ModeleExports
$newvalue = $this->tsv_clean($newvalue, $outputlangs->charset_output);
- if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) {
- $array = unserialize($typefield);
+ if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) {
+ $array = json_decode($typefield, true);
$array = $array['options'];
$newvalue = $array[$newvalue];
}
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index ad793d3d6b8..401309c22e5 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -257,7 +257,7 @@ class pdf_sponge extends ModelePDFFactures
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
} else {
- $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default
+ $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
}
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 1768029b97e..6bec94d6130 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -623,6 +623,12 @@ class ImportCsv extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
+ } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') {
+ if (empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
+ $newval = rtrim(trim($newval), "0");
+ } else {
+ $newval = trim($newval);
+ }
}
//print 'Val to use as insert is '.$newval.' ';
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index d90a52755e3..0378180475d 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -664,6 +664,12 @@ class ImportXlsx extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
+ } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') {
+ if (empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
+ $newval = rtrim(trim($newval), "0");
+ } else {
+ $newval = trim($newval);
+ }
}
//print 'Val to use as insert is '.$newval.' ';
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index 21618c56bc9..d6127f65b83 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -297,6 +297,10 @@ class modAccounting extends DolibarrModules
);
$this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
+ $this->import_convertvalue_array[$r] = array(
+ 'b.numero_compte' => array('rule' => 'accountingaccount'),
+ 'b.subledger_account' => array('rule' => 'accountingaccount')
+ );
$this->import_examplevalues_array[$r] = array(
'b.piece_num'=>'123 (!!! use next value not already used)',
'b.doc_date'=>dol_print_date(dol_now(), "%Y-%m-%d"),
@@ -350,6 +354,8 @@ class modAccounting extends DolibarrModules
'b.sens'=>'rule-computeSens'
); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r]=array(
+ 'b.numero_compte'=>array('rule'=>'accountingaccount'),
+ 'b.subledger_account'=>array('rule'=>'accountingaccount'),
'b.montant' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'),
'b.sens' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'),
);
@@ -395,6 +401,7 @@ class modAccounting extends DolibarrModules
$this->import_fields_array[$r] = array('aa.fk_pcg_version'=>"Chartofaccounts*", 'aa.account_number'=>"AccountAccounting*", 'aa.label'=>"Label*", 'aa.account_parent'=>"Accountparent", "aa.fk_accounting_category"=>"AccountingCategory", "aa.pcg_type"=>"Pcgtype*", 'aa.active'=>'Status*', 'aa.datec'=>"DateCreation");
$this->import_regex_array[$r] = array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system', 'aa.account_number'=>'^.{1,32}$', 'aa.label'=>'^.{1,255}$', 'aa.account_parent'=>'^.{0,32}$', 'aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category', 'aa.pcg_type'=>'^.{1,20}$', 'aa.active'=>'^0|1$', 'aa.datec'=>'^\d{4}-\d{2}-\d{2}$');
$this->import_convertvalue_array[$r] = array(
+ 'aa.account_number'=>array('rule'=>'accountingaccount'),
'aa.account_parent'=>array('rule'=>'fetchidfromref', 'classfile'=>'/accountancy/class/accountingaccount.class.php', 'class'=>'AccountingAccount', 'method'=>'fetch', 'element'=>'AccountingAccount'),
'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel', 'classfile'=>'/accountancy/class/accountancycategory.class.php', 'class'=>'AccountancyCategory', 'method'=>'fetch', 'dict'=>'DictionaryAccountancyCategory'),
);
diff --git a/htdocs/core/modules/modClickToDial.class.php b/htdocs/core/modules/modClickToDial.class.php
index f28659bbd5d..18f1e6befeb 100644
--- a/htdocs/core/modules/modClickToDial.class.php
+++ b/htdocs/core/modules/modClickToDial.class.php
@@ -18,7 +18,7 @@
/**
* \defgroup clicktodial Module clicktodial
- * \brief Module pour gerer l'appel automatique
+ * \brief Module to manage a ClickToDial system
* \file htdocs/core/modules/modClickToDial.class.php
* \ingroup clicktodial
* \brief Description and activation file for the module Click to Dial
@@ -46,7 +46,8 @@ class modClickToDial extends DolibarrModules
$this->family = "interface";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
- $this->description = "Gestion du Click To Dial";
+ $this->description = "Integration of a ClickToDial system (Asterisk, ...)";
+ $this->descriptionlong = "Support a Click To Dial feature with a SIP system. When clicking on a phone number, your phone system automatically call the callee.";
$this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version
diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php
index 41107d5c34a..5d71a5abdc8 100644
--- a/htdocs/core/modules/modFournisseur.class.php
+++ b/htdocs/core/modules/modFournisseur.class.php
@@ -285,7 +285,7 @@ class modFournisseur extends DolibarrModules
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'Vendor invoices and lines of invoices';
- $this->export_icon[$r] = 'bill';
+ $this->export_icon[$r] = 'invoice';
$this->export_permission[$r] = array(array("fournisseur", "facture", "export"));
$this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
@@ -328,81 +328,14 @@ class modFournisseur extends DolibarrModules
);
$this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object
- $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
- $resql = $this->db->query($sql);
- if ($resql) { // This can fail when class is used on old database (during migration for example)
- while ($obj = $this->db->fetch_object($resql)) {
- $fieldname = 'extra.'.$obj->name;
- $fieldlabel = ucfirst($obj->label);
- $typeFilter = "Text";
- switch ($obj->type) {
- case 'int':
- case 'double':
- case 'price':
- $typeFilter = "Numeric";
- break;
- case 'date':
- case 'datetime':
- $typeFilter = "Date";
- break;
- case 'boolean':
- $typeFilter = "Boolean";
- break;
- case 'sellist':
- $tmp = '';
- $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
- if ($tmpparam['options'] && is_array($tmpparam['options'])) {
- $var = array_keys($tmpparam['options']);
- $tmp = array_shift($var);
- }
- if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
- $typeFilter = "List:".$tmp;
- }
- break;
- }
- $this->export_fields_array[$r][$fieldname] = $fieldlabel;
- $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
- $this->export_entities_array[$r][$fieldname] = 'invoice';
- }
- }
- // End add extra fields
- // Add extra fields line
- $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
- $resql = $this->db->query($sql);
- if ($resql) { // This can fail when class is used on old database (during migration for example)
- while ($obj = $this->db->fetch_object($resql)) {
- $fieldname = 'extraline.'.$obj->name;
- $fieldlabel = ucfirst($obj->label);
- $typeFilter = "Text";
- switch ($obj->type) {
- case 'int':
- case 'double':
- case 'price':
- $typeFilter = "Numeric";
- break;
- case 'date':
- case 'datetime':
- $typeFilter = "Date";
- break;
- case 'boolean':
- $typeFilter = "Boolean";
- break;
- case 'sellist':
- $tmp = '';
- $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
- if ($tmpparam['options'] && is_array($tmpparam['options'])) {
- $tmp = array_shift(array_keys($tmpparam['options']));
- }
- if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
- $typeFilter = "List:".$tmp;
- }
- break;
- }
- $this->export_fields_array[$r][$fieldname] = $fieldlabel;
- $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
- $this->export_entities_array[$r][$fieldname] = 'invoice_line';
- }
- }
+ $keyforselect = 'facture_fourn';
+ $keyforelement = 'invoice';
+ $keyforaliasextra = 'extra';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+ $keyforselect = 'facture_fourn_det';
+ $keyforelement = 'invoice_line';
+ $keyforaliasextra = 'extraline';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields line
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
@@ -426,7 +359,7 @@ class modFournisseur extends DolibarrModules
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'Factures fournisseurs et reglements';
- $this->export_icon[$r] = 'bill';
+ $this->export_icon[$r] = 'invoice';
$this->export_permission[$r] = array(array("fournisseur", "facture", "export"));
$this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
@@ -465,43 +398,10 @@ class modFournisseur extends DolibarrModules
'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'p.fk_bank'=>'account', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project');
$this->export_dependencies_array[$r] = array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object
- $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
- $resql = $this->db->query($sql);
- if ($resql) { // This can fail when class is used on old database (during migration for example)
- while ($obj = $this->db->fetch_object($resql)) {
- $fieldname = 'extra.'.$obj->name;
- $fieldlabel = ucfirst($obj->label);
- $typeFilter = "Text";
- switch ($obj->type) {
- case 'int':
- case 'double':
- case 'price':
- $typeFilter = "Numeric";
- break;
- case 'date':
- case 'datetime':
- $typeFilter = "Date";
- break;
- case 'boolean':
- $typeFilter = "Boolean";
- break;
- case 'sellist':
- $tmp = '';
- $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
- if ($tmpparam['options'] && is_array($tmpparam['options'])) {
- $array_keys = array_keys($tmpparam['options']);
- $tmp = array_shift($array_keys);
- }
- if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
- $typeFilter = "List:".$tmp;
- }
- break;
- }
- $this->export_fields_array[$r][$fieldname] = $fieldlabel;
- $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
- $this->export_entities_array[$r][$fieldname] = 'invoice';
- }
- }
+ $keyforselect = 'facture_fourn';
+ $keyforelement = 'invoice';
+ $keyforaliasextra = 'extra';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields object
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
@@ -564,83 +464,16 @@ class modFournisseur extends DolibarrModules
);
$this->export_dependencies_array[$r] = array('order_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object
- $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")";
- $resql = $this->db->query($sql);
- if ($resql) { // This can fail when class is used on old database (during migration for example)
- while ($obj = $this->db->fetch_object($resql)) {
- $fieldname = 'extra.'.$obj->name;
- $fieldlabel = ucfirst($obj->label);
- $typeFilter = "Text";
- switch ($obj->type) {
- case 'int':
- case 'double':
- case 'price':
- $typeFilter = "Numeric";
- break;
- case 'date':
- case 'datetime':
- $typeFilter = "Date";
- break;
- case 'boolean':
- $typeFilter = "Boolean";
- break;
- case 'sellist':
- $tmp = '';
- $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
- $tmpkey = array_keys($tmpparam['options']);
- if ($tmpparam['options'] && is_array($tmpparam['options'])) {
- $tmp = array_shift($tmpkey);
- }
- if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
- $typeFilter = "List:".$tmp;
- }
- break;
- }
- $this->export_fields_array[$r][$fieldname] = $fieldlabel;
- $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
- $this->export_entities_array[$r][$fieldname] = 'order';
- }
- }
+ $keyforselect = 'commande_fournisseur';
+ $keyforelement = 'order';
+ $keyforaliasextra = 'extra';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields object
// Add extra fields line
- $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseurdet' AND entity IN (0, ".$conf->entity.")";
- $resql = $this->db->query($sql);
- if ($resql) { // This can fail when class is used on old database (during migration for example)
- while ($obj = $this->db->fetch_object($resql)) {
- $fieldname = 'extraline.'.$obj->name;
- $fieldlabel = ucfirst($obj->label);
- $typeFilter = "Text";
- switch ($obj->type) {
- case 'int':
- case 'double':
- case 'price':
- $typeFilter = "Numeric";
- break;
- case 'date':
- case 'datetime':
- $typeFilter = "Date";
- break;
- case 'boolean':
- $typeFilter = "Boolean";
- break;
- case 'sellist':
- $tmp = '';
- $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
-
- if ($tmpparam['options'] && is_array($tmpparam['options'])) {
- $tmpparam_param_key = array_keys($tmpparam['options']);
- $tmp = array_shift($tmpparam_param_key);
- }
- if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
- $typeFilter = "List:".$tmp;
- }
- break;
- }
- $this->export_fields_array[$r][$fieldname] = $fieldlabel;
- $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
- $this->export_entities_array[$r][$fieldname] = 'order_line';
- }
- }
+ $keyforselect = 'commande_fournisseurdet';
+ $keyforelement = 'order_line';
+ $keyforaliasextra = 'extraline';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
// End add extra fields line
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php
index 14e5aabb681..6d9bef40232 100644
--- a/htdocs/core/modules/modKnowledgeManagement.class.php
+++ b/htdocs/core/modules/modKnowledgeManagement.class.php
@@ -68,7 +68,7 @@ class modKnowledgeManagement extends DolibarrModules
$this->descriptionlong = "Manage a Knowledge Management (KM) or Help-Desk base";
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
- $this->version = 'development';
+ $this->version = 'experimental';
// Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 3459973a699..37cda4b7b30 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -572,7 +572,13 @@ class modProduct extends DolibarrModules
'class' => 'CProductNature',
'method' => 'fetch',
'dict' => 'DictionaryProductNature'
- ),
+ ),
+ 'p.accountancy_code_sell'=>array('rule'=>'accountingaccount'),
+ 'p.accountancy_code_sell_intra'=>array('rule'=>'accountingaccount'),
+ 'p.accountancy_code_sell_export'=>array('rule'=>'accountingaccount'),
+ 'p.accountancy_code_buy'=>array('rule'=>'accountingaccount'),
+ 'p.accountancy_code_buy_intra'=>array('rule'=>'accountingaccount'),
+ 'p.accountancy_code_buy_export'=>array('rule'=>'accountingaccount'),
);
$this->import_regex_array[$r] = array(
diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
index f7ba7a42842..68ceb87ba96 100644
--- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php
+++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
@@ -145,8 +145,13 @@ class pdf_squille extends ModelePdfReception
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
- $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
- $dir = $conf->product->dir_output.'/'.$pdir;
+ if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
+ $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
+ $dir = $conf->product->dir_output.'/'.$pdir;
+ } else {
+ $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product');
+ $dir = $conf->product->dir_output.'/'.$pdir;
+ }
$realpath = '';
@@ -446,7 +451,7 @@ class pdf_squille extends ModelePdfReception
}
$posYAfterDescription = $pdf->GetY();
- $nexY = $pdf->GetY();
+ $nexY = max($pdf->GetY(), $posYAfterImage);
$pageposafter = $pdf->getPage();
$pdf->setPage($pageposbefore);
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index 7c7813fbe14..374f381c098 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -383,7 +383,7 @@ if ($action == 'confirm_resize' && GETPOSTISSET("file") && GETPOSTISSET("sizex")
$ecmfile->fullpath_orig = $fullpath;
$ecmfile->gen_or_uploaded = 'unknown';
$ecmfile->description = ''; // indexed content
- $ecmfile->keyword = ''; // keyword content
+ $ecmfile->keywords = ''; // keyword content
$result = $ecmfile->create($user);
if ($result < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
@@ -448,7 +448,7 @@ if ($action == 'confirm_crop') {
$ecmfile->fullpath_orig = $fullpath;
$ecmfile->gen_or_uploaded = 'unknown';
$ecmfile->description = ''; // indexed content
- $ecmfile->keyword = ''; // keyword content
+ $ecmfile->keywords = ''; // keyword content
$result = $ecmfile->create($user);
if ($result < 0) {
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php
index 6d6df3a5408..88c643c641d 100644
--- a/htdocs/core/tpl/ajaxrow.tpl.php
+++ b/htdocs/core/tpl/ajaxrow.tpl.php
@@ -79,7 +79,6 @@ $(document).ready(function(){
function() {
console.log("tableDND end of ajax call");
if (reloadpage == 1) {
- //console.log('');
0) {
- if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
+ if (!empty($cannotApplyDiscount) || !$isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
$translationKey = !empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount';
$text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency".$conf->currency)).'.';
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index e181acd16e1..474b1a24957 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -128,7 +128,7 @@ if ($nolinesbefore) {
trans('ReductionShort'); ?>
situation_cycle_ref) {
+ if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
print '
info_bits & 2) != 2) {
- // I comment this because it shows info even when not required
+ // I comment warning of stock because it shows the info even when it should not.
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
print 'fk_prev_id != null) {
+ if ($situationinvoicelinewithparent) { // Do not allow editing during a situation cycle
print ' readonly';
}
print '>';
@@ -249,7 +257,7 @@ $coldisplay++;
info_bits & 2) != 2) {
print 'fk_prev_id != null) {
+ if ($situationinvoicelinewithparent) {
print ' readonly';
}
print '>%';
diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php
index b530f5215cc..e1f89b18937 100644
--- a/htdocs/core/tpl/objectline_title.tpl.php
+++ b/htdocs/core/tpl/objectline_title.tpl.php
@@ -105,7 +105,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '
';
diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php
index 14bc7e377f0..5ca1667ac9f 100644
--- a/htdocs/ecm/file_card.php
+++ b/htdocs/ecm/file_card.php
@@ -205,7 +205,7 @@ if ($action == 'update' && $permtoadd) {
$object->fullpath_orig = '';
$object->gen_or_uploaded = 'unknown';
$object->description = ''; // indexed content
- $object->keyword = ''; // keyword content
+ $object->keywords = ''; // keyword content
$result = $object->create($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'warnings');
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index b51823242f8..d7f7cdb8bb1 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -253,20 +253,6 @@ if ($projectid > 0) {
llxHeader('', $title, $help_url);
-// Example : Adding jquery code
-print '';
if ($projectid > 0) {
// To verify role of users
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index c644f9e35a5..bf8e53e8b82 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -610,7 +610,7 @@ $sql .= ' cf.fk_multicurrency, cf.multicurrency_code, cf.multicurrency_tx, cf.mu
$sql .= ' cf.date_creation as date_creation, cf.tms as date_update,';
$sql .= ' cf.note_public, cf.note_private,';
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_title,";
-$sql .= " u.firstname, u.lastname, u.photo, u.login, u.email as user_email";
+$sql .= " u.firstname, u.lastname, u.photo, u.login, u.email as user_email, u.statut as user_status";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@@ -1346,6 +1346,7 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->photo = $obj->photo;
$userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_status;
if (!empty($arrayfields['u.login']['checked'])) {
print '
';
if ($userstatic->id) {
diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
index f11fa826fac..fa8cb0197cc 100644
--- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
+++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
@@ -353,3 +353,6 @@ INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active)
INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,tracking,active) VALUES (14,'MAINFREIGHT', 'Mainfreight', NULL, 'https://www.mainfreight.com/track?{TRACKID}', 0);
+UPDATE llx_menu SET perms = '$user->rights->societe->creer' WHERE titre = 'MenuNewThirdParty' AND url = '/societe/card.php?mainmenu=companies&action=create';
+UPDATE llx_menu SET url = '/societe/list.php?mainmenu=companies&leftmenu=thirdparties' WHERE titre = 'List' AND url = '/societe/list.php?mainmenu=companies&action=create';
+
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 5dfeac1d222..1ebb8e380a7 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
@@ -580,6 +580,11 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
-- Removed no more used function
-- VPGSQL8.2 DROP FUNCTION IF EXISTS update_modified_column_date_m() CASCADE;
+-- VPGSQL8.2 DROP TRIGGER update_customer_modtime ON llx_ecm_directories;
+-- VPGSQL8.2 DROP TRIGGER update_customer_modtime ON llx_ecm_files;
+-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
+-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_files FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
+
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4);
diff --git a/htdocs/install/mysql/tables/llx_oauth_token.sql b/htdocs/install/mysql/tables/llx_oauth_token.sql
index 7674f7f3455..62542d13401 100644
--- a/htdocs/install/mysql/tables/llx_oauth_token.sql
+++ b/htdocs/install/mysql/tables/llx_oauth_token.sql
@@ -18,8 +18,8 @@
CREATE TABLE llx_oauth_token (
rowid integer AUTO_INCREMENT PRIMARY KEY,
service varchar(36), -- What king of key or token: 'Google', 'Stripe', 'auth-public-key', ...
- token text, -- token in serialize() format, of an object StdOAuth2Token of library phpoauth2
- tokenstring text, -- token in text or json format. Value depends on 'service'. For example for an OAUTH service: '{"access_token": "sk_test_cccc", "refresh_token": "rt_aaa", "token_type": "bearer", ..., "scope": "read_write"}
+ token text, -- token in serialize format, of an object StdOAuth2Token of library phpoauth2. Deprecated, use tokenstring instead.
+ tokenstring text, -- token in json or text format. Value depends on 'service'. For example for an OAUTH service: '{"access_token": "sk_test_cccc", "refresh_token": "rt_aaa", "token_type": "bearer", ..., "scope": "read_write"}
fk_soc integer, -- Id of thirdparty in llx_societe
fk_user integer, -- Id of user in llx_user
fk_adherent integer, -- Id of member in llx_adherent
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index a05c9e7ea97..0fef25c033a 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1778,7 +1778,7 @@ ClickToDialSetup=Click To Dial module setup
ClickToDialUrlDesc=Url called when a click on phone picto is done. In URL, you can use tags __PHONETO__ that will be replaced with the phone number of person to call __PHONEFROM__ that will be replaced with phone number of calling person (yours) __LOGIN__ that will be replaced with clicktodial login (defined on user card) __PASS__ that will be replaced with clicktodial password (defined on user card).
ClickToDialDesc=This module change phone numbers, when using a desktop computer, into clickable links. A click will call the number. This can be used to start the phone call when using a soft phone on your desktop or when using a CTI system based on SIP protocol for example. Note: When using a smartphone, phone numbers are always clickable.
ClickToDialUseTelLink=Use just a link "tel:" on phone numbers
-ClickToDialUseTelLinkDesc=Use this method if your users have a softphone or a software interface installed on the same computer as the browser, and called when you click on a link in your browser that starts with "tel:". If you need a full server solution (no need of local software installation), you must set this to "No" and fill next field.
+ClickToDialUseTelLinkDesc=Use this method if your users have a softphone or a software interface, installed on the same computer as the browser, and called when you click on a link starting with "tel:" in your browser. If you need link that start with "sip:" or a full server solution (no need of local software installation), you must set this to "No" and fill next field.
##### Point Of Sale (CashDesk) #####
CashDesk=Point of Sale
CashDeskSetup=Point of Sales module setup
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index c4e8a1d7226..3ed7441afa5 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -301,3 +301,4 @@ ErrorActionCommPropertyUserowneridNotDefined=User's owner is required
ErrorActionCommBadType=Selected event type (id: %n, code: %s) do not exist in Event Type dictionary
CheckVersionFail=Version check fail
ErrorWrongFileName=Name of the file cannot have __SOMETHING__ in it
+ErrorNotInDictionaryPaymentConditions=Not in Payment Terms Dictionary, please modify.
diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang
index bd23bd39a5c..cd1964ff383 100644
--- a/htdocs/langs/en_US/website.lang
+++ b/htdocs/langs/en_US/website.lang
@@ -31,7 +31,7 @@ AddWebsite=Add website
Webpage=Web page/container
AddPage=Add page/container
PageContainer=Page
-PreviewOfSiteNotYetAvailable=Preview of your website %s not yet available. You must first 'Import a full website template' or just 'Add a page/container'.
+PreviewOfSiteNotYetAvailable=The preview of your website %s is not yet available. You must first 'Import a full website template' or just 'Add a page/container'.
RequestedPageHasNoContentYet=Requested page with id %s has no content yet, or cache file .tpl.php was removed. Edit content of the page to solve this.
SiteDeleted=Web site '%s' deleted
PageContent=Page/Contenair
diff --git a/htdocs/langs/nl_NL/main.lang b/htdocs/langs/nl_NL/main.lang
index 4a0eb506398..9c0fcdfa791 100644
--- a/htdocs/langs/nl_NL/main.lang
+++ b/htdocs/langs/nl_NL/main.lang
@@ -10,10 +10,10 @@ SeparatorDecimal=,
SeparatorThousand=Space
FormatDateShort=%m/%d/%Y
FormatDateShortInput=%m/%d/%Y
-FormatDateShortJava=MM/dd/jjjj
-FormatDateShortJavaInput=MM/dd/jjjj
-FormatDateShortJQuery=mm/dd/jj
-FormatDateShortJQueryInput=mm/dd/jj
+FormatDateShortJava=MM/dd/yyyy
+FormatDateShortJavaInput=MM/dd/yyyy
+FormatDateShortJQuery=mm/dd/yy
+FormatDateShortJQueryInput=mm/dd/yy
FormatHourShortJQuery=HH:MI
FormatHourShort=%I:%M %p
FormatHourShortDuration=%H:%M
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 93388190275..bd0d77d3389 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -53,25 +53,26 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) {
/**
* Return the real char for a numeric entities.
- * This function is required by testSqlAndScriptInject().
+ * WARNING: This function is required by testSqlAndScriptInject() and the GETPOST 'restricthtml'. Regex calling must be similar.
*
* @param string $matches String of numeric entity
* @return string New value
*/
function realCharForNumericEntities($matches)
{
- $newstringnumentity = $matches[1];
+ $newstringnumentity = preg_replace('/;$/', '', $matches[1]);
+ //print ' $newstringnumentity='.$newstringnumentity;
if (preg_match('/^x/i', $newstringnumentity)) {
$newstringnumentity = hexdec(preg_replace('/^x/i', '', $newstringnumentity));
}
- // The numeric value we don't want as entities
+ // The numeric value we don't want as entities because they encode ascii char, and why using html entities on ascii except for haking ?
if (($newstringnumentity >= 65 && $newstringnumentity <= 90) || ($newstringnumentity >= 97 && $newstringnumentity <= 122)) {
return chr((int) $newstringnumentity);
}
- return ''.$matches[1];
+ return ''.$matches[1]; // Value will be unchanged because regex was /( )/
}
/**
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 ca3c925dd51..43457d6620d 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
@@ -240,14 +240,12 @@ class pdf_standard_myobject extends ModelePDFMyObject
{
if (empty($object->lines[$i]->fk_product)) continue;
- $objphoto->fetch($object->lines[$i]->fk_product);
//var_dump($objphoto->ref);exit;
- if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
- {
+ if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
$pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
$pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
} else {
- $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default
+ $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
$pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
}
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 9a689c79a08..cac59593950 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -212,19 +212,19 @@ $help_url = '';
llxHeader('', $title, $help_url);
// Example : Adding jquery code
-print '';
+// print '';
// Part to create
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index 41561a5a45b..abc8b879d33 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -386,19 +386,19 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
// Example : Adding jquery code
-print '';
+// print '';
$arrayofselected = is_array($toselect) ? $toselect : array();
diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php
index fad22645cd5..b6cc502bd60 100644
--- a/htdocs/mrp/mo_card.php
+++ b/htdocs/mrp/mo_card.php
@@ -201,20 +201,6 @@ $title = $langs->trans('Mo')." - ".$langs->trans("Card");
llxHeader('', $title, '');
-// Example : Adding jquery code
-print '';
// Part to create
diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php
index 1883517470c..731a7bcfc50 100644
--- a/htdocs/mrp/mo_list.php
+++ b/htdocs/mrp/mo_list.php
@@ -299,20 +299,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $title, $help_url);
-// Example : Adding jquery code
-print '';
$arrayofselected = is_array($toselect) ? $toselect : array();
diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php
index 79f51be6ca9..49d46c652fd 100644
--- a/htdocs/partnership/partnership_list.php
+++ b/htdocs/partnership/partnership_list.php
@@ -398,20 +398,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
-// Example : Adding jquery code
-print '';
$arrayofselected = is_array($toselect) ? $toselect : array();
diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php
index ac2e70e3287..77acafbbd55 100644
--- a/htdocs/product/ajax/products.php
+++ b/htdocs/product/ajax/products.php
@@ -235,7 +235,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) {
// When used from jQuery, the search term is added as GET param "term".
$searchkey = (($idprod && GETPOST($idprod, 'alpha')) ? GETPOST($idprod, 'alpha') : (GETPOST($htmlname, 'alpha') ? GETPOST($htmlname, 'alpha') : ''));
- if (!is_object($form)) {
+ if (!isset($form) || !is_object($form)) {
$form = new Form($db);
}
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index 6a29a414ed7..5ec359e5d8a 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -168,20 +168,6 @@ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks|DE:Modul_Best
llxHeader('', $title, $help_url);
-// Example : Adding jquery code
-print '';
// Part to create
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index a6e3af11979..7fcfe3bc92b 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -1030,7 +1030,7 @@ foreach ($listofreferent as $key => $value) {
$addform .= '';
$addform .= '