diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 3883ae11fb4..dac412f92a6 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -485,7 +485,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '
';
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);
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 08eb9a6f42d..8c3e5bfeab9 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -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)."'";
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index c3339a0a138..4740f7d3390 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -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) . "'";
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index a6d9b95d19c..322988e7a7b 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -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;
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index c4eb34ce1e5..05d1dd89a88 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -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'] ? '' : '';
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 73337ba0284..8e71dfcd06f 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -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;
|