From f29c03c9223592bfb7b6869b54f919d12a36577e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Oct 2015 16:35:14 +0200 Subject: [PATCH] Start to work on a multiselect component to select which fields to show into dolibarr lists. --- htdocs/core/class/html.form.class.php | 96 +++++++++++++++++++++++--- htdocs/societe/list.php | 48 +++++++++---- htdocs/theme/eldy/img/list.png | Bin 0 -> 83 bytes htdocs/theme/eldy/style.css.php | 55 +++++++++++++++ htdocs/theme/md/img/list.png | Bin 0 -> 83 bytes 5 files changed, 177 insertions(+), 22 deletions(-) create mode 100644 htdocs/theme/eldy/img/list.png create mode 100644 htdocs/theme/md/img/list.png diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 61afec22569..52b4290e83d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4591,34 +4591,36 @@ class Form { global $conf, $langs; + $out = ''; + // Add code for jquery to use multiselect if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; - print ' + $out.=' + + '; + return $out; + } /** * Render list of categories linked to object with id $id and type $type diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 80e4c553dc1..501e54cce11 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -208,9 +208,9 @@ $title=$langs->trans("ListOfThirdParties"); $sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.datec, s.code_client, s.code_fournisseur, "; $sql.= " st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; -$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4"; -$sql.= ",s.fk_pays"; -$sql.= ",typent.code as typent_code"; +$sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4,"; +$sql.= " s.fk_pays, s.tms as date_update, s.datec as date_creation,"; +$sql.= " typent.code as typent_code"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We'll need these fields in order to filter by categ @@ -345,10 +345,29 @@ if ($resql) print ''; } + // Define list of fields to show into list + $arrayfields=array( + 's.nom'=>array('label'=>$langs->trans("Company"), 'checked'=>1), + 's.barcode'=>array('label'=>$langs->trans("BarCode"), 'checked'=>1, 'cond'=>(! empty($conf->barcode->enabled))), + 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), + 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>1), + 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>1), + 's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>1), + 's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>1), + 's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>1), + 's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>1), + 's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>200), + 's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + ); + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + { + $selectotherfields=$form->multiSelectArrayWithCheckbox('selectotherfields', $arrayfields); + } + print ''; - - // Lines of titles - print ''; + + print ''; print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); if (! empty($conf->barcode->enabled)) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); @@ -363,7 +382,7 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre($selectotherfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; // Fields title search @@ -372,18 +391,19 @@ if ($resql) print ''; print ''; if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; - print ''; + + print ''; print ''; // Barcode if (! empty($conf->barcode->enabled)) { print ''; } // Town print ''; //Country print ''; // IdProf1 print ''; // IdProf2 print ''; // IdProf3 print ''; // IdProf4 print ''; // Type (customer/prospect/supplier) print '
'; - print ''; + print ''; print ''; - print ''; + print ''; print ''; @@ -395,19 +415,19 @@ if ($resql) print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; diff --git a/htdocs/theme/eldy/img/list.png b/htdocs/theme/eldy/img/list.png new file mode 100644 index 0000000000000000000000000000000000000000..f5df34a3bc9f8393c23f35e25fb7b18b4b51654b GIT binary patch literal 83 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|mq&!_5Ln;`PC2l1!2{fHxmMCBf f>~dQxy@i3{%~LbRV2?L>KvfK$u6{1-oD!M<+N2cH literal 0 HcmV?d00001 diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9f5376947da..2eddc0eba23 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3487,6 +3487,61 @@ a span.select2-chosen } +/* ============================================================================== */ +/* Multiselect with checkbox */ +/* ============================================================================== */ + +dl.dropdown { + margin:0px; + padding:0px; +} +.dropdown dd, .dropdown dt { + margin:0px; + padding:0px; +} +.dropdown ul { + margin: -1px 0 0 0; + text-align: left; +} +.dropdown dd { + position:relative; +} +.dropdown dt a { + display:block; + overflow: hidden; + border:0; +} +.dropdown dt a span, .multiSel span { + cursor:pointer; + display:inline-block; + padding: 0 3px 2px 0; +} +.dropdown dd ul { + background-color: #FFF; + border: 1px solid #888; + display:none; + right:0px; /* pop is align on right */ + padding: 2px 15px 2px 5px; + position:absolute; + top:2px; + list-style:none; + max-height: 200px; + overflow: auto; +} +.dropdown span.value { + display:none; +} +.dropdown dd ul li { + white-space: nowrap; +} +.dropdown dd ul li a { + padding:5px; + display:block; +} +.dropdown dd ul li a:hover { + background-color:#fff; +} + /* ============================================================================== */ /* JMobile */ diff --git a/htdocs/theme/md/img/list.png b/htdocs/theme/md/img/list.png new file mode 100644 index 0000000000000000000000000000000000000000..f5df34a3bc9f8393c23f35e25fb7b18b4b51654b GIT binary patch literal 83 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|mq&!_5Ln;`PC2l1!2{fHxmMCBf f>~dQxy@i3{%~LbRV2?L>KvfK$u6{1-oD!M<+N2cH literal 0 HcmV?d00001