diff --git a/htdocs/core/actions_changeselectedfields.inc.php b/htdocs/core/actions_changeselectedfields.inc.php
new file mode 100644
index 00000000000..11884f81224
--- /dev/null
+++ b/htdocs/core/actions_changeselectedfields.inc.php
@@ -0,0 +1,48 @@
+
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see http://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/actions_changeselectedfields.inc.php
+ * \brief Code for actions when we change list of fields on a list page
+ */
+
+
+// $action must be defined
+// $db must be defined
+// $conf must be defined
+// $object must be defined (object is loaded in this file with fetch)
+
+// Save selection
+if (GETPOST('formfilteraction') == 'listafterchangingselectedfields')
+{
+ $tabparam=array();
+
+ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
+
+ if (GETPOST("selectedfields")) $tabparam["MAIN_SELECTEDFIELDS_".$varpage]=GETPOST("selectedfields");
+ else $tabparam["MAIN_SELECTEDFIELDS_".$varpage]='';
+
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+
+ $result=dol_set_user_param($db, $conf, $user, $tabparam);
+
+ //$action='list';
+ //var_dump($tabparam);exit;
+}
+
+
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 17771a56782..b7ea040fc17 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4671,37 +4671,51 @@ class Form
* Show a multiselect form from an array.
*
* @param string $htmlname Name of select
- * @param array $array Array with array to show
+ * @param array $array Array with array of fields we could show
+ * @param string $varpage Id of context for page. Can be set with $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
* @return string HTML multiselect string
* @see selectarray
*/
- static function multiSelectArrayWithCheckbox($htmlname, $array)
+ static function multiSelectArrayWithCheckbox($htmlname, $array, $varpage)
{
+ global $user;
+
+ $tmpvar="MAIN_SELECTEDFIELDS_".$varpage;
+ if (! empty($user->conf->$tmpvar))
+ {
+ $tmparray=explode(',', $user->conf->$tmpvar);
+ foreach($array as $key => $val)
+ {
+ //var_dump($key);
+ //var_dump($tmparray);
+ if (in_array($key, $tmparray)) $array[$key]['checked']=1;
+ else $array[$key]['checked']=0;
+ }
+ }
+ //var_dump($array);
+
$lis='';
- $liststring='';
+ $listcheckedstring='';
foreach($array as $key => $val)
{
if (isset($val['cond']) && ! $val['cond']) continue;
- if ($val['label'])
+ if ($val['label'])
{
- $lis.='
@@ -4730,9 +4744,9 @@ class Form
});
$(\'.multiselectcheckbox'.$htmlname.' input[type="checkbox"]\').on(\'click\', function () {
-
+ console.log("A new field was added/removed")
+ $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\')
var title = $(this).val() + ",";
-
if ($(this).is(\':checked\')) {
$(\'.'.$htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
}
diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
index d8b6ce12ea4..02f716633f5 100755
--- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
+++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
@@ -55,3 +55,5 @@ ALTER TABLE llx_adherent ADD COLUMN pass_crypted varchar(128) after pass;
ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid;
ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype;
+
+ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL;
diff --git a/htdocs/install/mysql/tables/llx_user_param.sql b/htdocs/install/mysql/tables/llx_user_param.sql
index dbf13610a5b..7194d73b4c4 100644
--- a/htdocs/install/mysql/tables/llx_user_param.sql
+++ b/htdocs/install/mysql/tables/llx_user_param.sql
@@ -23,7 +23,7 @@ create table llx_user_param
fk_user integer NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
param varchar(64) NOT NULL,
- value varchar(255) NOT NULL
+ value text NOT NULL
)ENGINE=innodb;
--
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index d973a3d41ef..650b248a88f 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -89,7 +89,7 @@ else $result=restrictedArea($user,'produit|service','','','','','',$objcanvas);
* Actions
*/
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$sref="";
$sbarcode="";
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 501e54cce11..097bbcc28ab 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -75,7 +75,8 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('thirdpartylist'));
+$contextpage='thirdpartylist';
+$hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db);
@@ -83,6 +84,8 @@ $extrafields = new ExtraFields($db);
* Actions
*/
+include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
+
// special search
if ($mode == 'search')
{
@@ -95,25 +98,25 @@ if ($mode == 'search')
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
- // For natural search
- $scrit = explode(' ', $socname);
+ // For natural search
+ $scrit = explode(' ', $socname);
- $fields = array(
- 's.nom',
- 's.code_client',
- 's.email',
- 's.url',
- 's.siren',
- 's.name_alias'
- );
+ $fields = array(
+ 's.nom',
+ 's.code_client',
+ 's.email',
+ 's.url',
+ 's.siren',
+ 's.name_alias'
+ );
- if (!empty($conf->barcode->enabled)) {
- $fields[] = 's.barcode';
- }
+ if (!empty($conf->barcode->enabled)) {
+ $fields[] = 's.barcode';
+ }
- foreach ($scrit as $crit) {
- $sql.= natural_search($fields, $crit);
- }
+ foreach ($scrit as $crit) {
+ $sql.= natural_search($fields, $crit);
+ }
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
@@ -168,7 +171,7 @@ llxHeader('',$langs->trans("ThirdParty"),$help_url);
// Do we click on purge search criteria ?
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_categ='';
$search_sale='';
@@ -197,12 +200,14 @@ if ($socname)
/*
* Mode List
*/
+
/*
- REM: Regle sur droits "Voir tous les clients"
- Utilisateur interne socid=0 + Droits voir tous clients => Voit toute societe
- Utilisateur interne socid=0 + Pas de droits voir tous clients => Ne voit que les societes liees comme commercial
- Utilisateur externe socid=x + Droits voir tous clients => Ne voit que lui meme
- Utilisateur externe socid=x + Pas de droits voir tous clients => Ne voit que lui meme
+ REM: Rules on permissions to see thirdparties
+ Internal or External user + No permission to see customers => See nothing
+ Internal user socid=0 + Permission to see ALL customers => See all thirdparties
+ Internal user socid=0 + No permission to see ALL customers => See only thirdparties linked to user that are sale representative
+ External user socid=x + Permission to see ALL customers => Can see only himself
+ External user socid=x + No permission to see ALL customers => Can see only himself
*/
$title=$langs->trans("ListOfThirdParties");
@@ -315,7 +320,8 @@ if ($resql)
print '