Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-06-01 20:08:45 +02:00
commit 2cc4dd30fc
6 changed files with 68 additions and 25 deletions

View File

@ -485,7 +485,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
//print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1);
print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, $conf->global->THEME_TOPMENU_DISABLE_IMAGE);
print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, isset($conf->global->THEME_TOPMENU_DISABLE_IMAGE)?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:0);
} else {
$listoftopmenumodes[$conf->global->THEME_TOPMENU_DISABLE_IMAGE];
//print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);

View File

@ -750,13 +750,6 @@ class ImportCsv extends ModeleImports
$i++;
}
// We db escape social network field because he isn't in field creation
if (in_array("socialnetworks", $listfields)) {
$socialkey = array_search("socialnetworks", $listfields);
$tmpsql = $listvalues[$socialkey];
$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
}
// We add hidden fields (but only if there is at least one field to add into table)
// We process here all the fields that were declared into the array $this->import_fieldshidden_array of the descriptor file.
// Previously we processed the ->import_fields_array.
@ -838,8 +831,18 @@ class ImportCsv extends ModeleImports
foreach ($updatekeys as $key) {
$col = $objimport->array_import_updatekeys[0][$key];
$key = preg_replace('/^.*\./i', '', $key);
$where[] = $key.' = '.$data[$key];
$filters[] = $col.' = '.$data[$key];
if ($conf->socialnetworks->enabled && strpos($key, "socialnetworks") !== false) {
$tmp = explode("_", $key);
$key = $tmp[0];
$socialnetwork = $tmp[1];
$jsondata = $data[$key];
$json = json_decode($jsondata);
$where[] = $key." LIKE '%\"".$socialnetwork."\":\"".$this->db->escape($json->$socialnetwork)."\"%'";
$filters[] = $col." LIKE '%\"".$socialnetwork."\":\"".$this->db->escape($json->$socialnetwork)."\"%'";
} else {
$where[] = $key.' = '.$data[$key];
$filters[] = $col.' = '.$data[$key];
}
}
$sqlSelect .= " WHERE ".implode(' AND ', $where);
@ -896,6 +899,13 @@ class ImportCsv extends ModeleImports
}
if (!empty($lastinsertid)) {
// We db escape social network field because he isn't in field creation
if (in_array("socialnetworks", $listfields)) {
$socialkey = array_search("socialnetworks", $listfields);
$tmpsql = $listvalues[$socialkey];
$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
}
// Build SQL UPDATE request
$sqlstart = "UPDATE ".$tablename;
@ -933,6 +943,13 @@ class ImportCsv extends ModeleImports
// Update not done, we do insert
if (!$error && !$updatedone) {
// We db escape social network field because he isn't in field creation
if (in_array("socialnetworks", $listfields)) {
$socialkey = array_search("socialnetworks", $listfields);
$tmpsql = $listvalues[$socialkey];
$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
}
// Build SQL INSERT request
$sqlstart = "INSERT INTO ".$tablename."(".implode(", ", $listfields).", import_key";
$sqlend = ") VALUES(".implode(', ', $listvalues).", '".$this->db->escape($importid)."'";

View File

@ -795,13 +795,6 @@ class ImportXlsx extends ModeleImports
$i++;
}
// We db escape social network field because he isn't in field creation
if (in_array("socialnetworks", $listfields)) {
$socialkey = array_search("socialnetworks", $listfields);
$tmpsql = $listvalues[$socialkey];
$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
}
// We add hidden fields (but only if there is at least one field to add into table)
// We process here all the fields that were declared into the array $this->import_fieldshidden_array of the descriptor file.
// Previously we processed the ->import_fields_array.
@ -883,8 +876,18 @@ class ImportXlsx extends ModeleImports
foreach ($updatekeys as $key) {
$col = $objimport->array_import_updatekeys[0][$key];
$key = preg_replace('/^.*\./i', '', $key);
$where[] = $key . ' = ' . $data[$key];
$filters[] = $col . ' = ' . $data[$key];
if ($conf->socialnetworks->enabled && strpos($key, "socialnetworks") !== false) {
$tmp = explode("_", $key);
$key = $tmp[0];
$socialnetwork = $tmp[1];
$jsondata = $data[$key];
$json = json_decode($jsondata);
$where[] = $key." LIKE '%\"".$socialnetwork."\":\"".$this->db->escape($json->$socialnetwork)."\"%'";
$filters[] = $col." LIKE '%\"".$socialnetwork."\":\"".$this->db->escape($json->$socialnetwork)."\"%'";
} else {
$where[] = $key.' = '.$data[$key];
$filters[] = $col.' = '.$data[$key];
}
}
$sqlSelect .= " WHERE " . implode(' AND ', $where);
@ -920,7 +923,7 @@ class ImportXlsx extends ModeleImports
if (empty($keyfield)) {
$keyfield = 'rowid';
}
$sqlSelect .= "WHERE ".$keyfield." = ".((int) $lastinsertid);
$sqlSelect .= " WHERE ".$keyfield." = ".((int) $lastinsertid);
$resql = $this->db->query($sqlSelect);
if ($resql) {
@ -941,6 +944,13 @@ class ImportXlsx extends ModeleImports
}
if (!empty($lastinsertid)) {
// We db escape social network field because he isn't in field creation
if (in_array("socialnetworks", $listfields)) {
$socialkey = array_search("socialnetworks", $listfields);
$tmpsql = $listvalues[$socialkey];
$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
}
// Build SQL UPDATE request
$sqlstart = "UPDATE " . $tablename;
@ -978,6 +988,13 @@ class ImportXlsx extends ModeleImports
// Update not done, we do insert
if (!$error && !$updatedone) {
// We db escape social network field because he isn't in field creation
if (in_array("socialnetworks", $listfields)) {
$socialkey = array_search("socialnetworks", $listfields);
$tmpsql = $listvalues[$socialkey];
$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
}
// Build SQL INSERT request
$sqlstart = "INSERT INTO " . $tablename . "(" . implode(", ", $listfields) . ", import_key";
$sqlend = ") VALUES(" . implode(', ', $listvalues) . ", '" . $this->db->escape($importid) . "'";

View File

@ -693,6 +693,15 @@ class modSociete extends DolibarrModules
's.code_compta' => 'CustomerAccountancyCode',
's.code_compta_fournisseur' => 'SupplierAccountancyCode'
);
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;
}
}
// Add profids as criteria to search duplicates
$langs->load("companies");
$i=1;

View File

@ -1120,7 +1120,7 @@ if ($step == 4 && $datatoimport) {
$j = 0;
foreach ($optionsall as $tmpcode => $tmpval) { // Loop on each entry to add into each combo list.
$label = '';
if ($tmpval['picto']) {
if (!empty($tmpval['picto'])) {
$label .= img_picto('', $tmpval['picto'], 'class="pictofixedwidth"');
}
$label .= $tmpval['required'] ? '<strong>' : '';

View File

@ -488,7 +488,7 @@ section.setupsection {
border-radius: 5px;
}
.field-error-icon { color: #ea1212; !important; }
.field-error-icon { color: #ea1212 !important; }
textarea {
border-radius: 0;
@ -3570,7 +3570,7 @@ td.border, div.tagtable div div.border {
left: 0;
top: 0;
max-width: 150px !important;
//background-color: inherit;
/*background-color: inherit;*/
background-color: gainsboro;
z-index: 2;
}
@ -3583,7 +3583,7 @@ td.border, div.tagtable div div.border {
right: 0;
top: 0;
max-width: 150px !important;
//background-color: inherit;
/*background-color: inherit;*/
background-color: gainsboro;
z-index: 2;
}
@ -4164,7 +4164,7 @@ tr.liste_sub_total, tr.liste_sub_total td {
}
.paymenttable tr td:first-child, .margintable tr td:first-child
{
//padding-left: 2px;
/*padding-left: 2px;*/
}
.paymenttable, .margintable tr td {
height: 22px;