diff --git a/COPYRIGHT b/COPYRIGHT index 137682bc514..42241a47d37 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -41,7 +41,7 @@ Ace 1.4.8 BSD Yes ChartJS 2.9.3 MIT License Yes JS library for graph jQuery 3.4.1 MIT License Yes JS library jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI -jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect +jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles with responsive jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f1552cd7b39..10dcf49b426 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -496,7 +496,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); +// print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendPropalRef"; $modelmail = "proposal_send"; @@ -562,7 +562,8 @@ if ($resql) } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +/////////// +// $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; @@ -765,6 +766,7 @@ if ($resql) print ''; } // Extra fields +//////////// include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 914106ac49a..ee2ae092420 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6120,11 +6120,11 @@ class Form } if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow; } - else - { + else + { // For backward compatibility $objecttmp->fields['ref'] = array('type'=>'varchar(30)', 'label'=>'Ref', 'showoncombobox'=>1); - } + } if (empty($fieldstoshow)) { @@ -6146,107 +6146,100 @@ class Form // Search data $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t"; - if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) { - $tmparray = explode('@', $objecttmp->ismultientitymanaged); - $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0]; - } - if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') + if ($objecttmp->ismultientitymanaged == 2) if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE 1=1"; - if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; - if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) { - $sql .= ' AND parenttable.entity = t.'.$tmparray[0]; - } - if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { - if ($objecttmp->element == 'societe') $sql .= " AND t.rowid = ".$user->socid; - else $sql .= " AND t.fk_soc = ".$user->socid; - } - if ($searchkey != '') $sql .= natural_search(explode(',', $fieldstoshow), $searchkey); - if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { - if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; - } - if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - /*if (! DolibarrApi::_checkFilters($objecttmp->filter)) - { - throw new RestException(503, 'Error when validating parameter sqlfilters '.$objecttmp->filter); - }*/ - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; - $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")"; - } - $sql .= $this->db->order($fieldstoshow, "ASC"); - //$sql.=$this->db->plimit($limit, 0); - //print $sql; - - // Build output string - $resql = $this->db->query($sql); - if ($resql) - { - if (!$forcecombo) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname, null, $conf->global->$confkeyforautocompletemode); + $sql .= " WHERE 1=1"; + if (!empty($objecttmp->ismultientitymanaged)) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; + if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { + if ($objecttmp->element == 'societe') $sql .= " AND t.rowid = ".$user->socid; + else $sql .= " AND t.fk_soc = ".$user->socid; } - - // Construct $out and $outarray - $out .= ''."\n"; + + // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 + $textifempty = ' '; + + //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; + if (!empty($conf->global->$confkeyforautocompletemode)) + { + if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty); + else $textifempty .= $langs->trans("All"); + } + if ($showempty) $out .= ''."\n"; + + $num = $this->db->num_rows($resql); + $i = 0; + if ($num) + { + while ($i < $num) { - $val = preg_replace('/t\./', '', $val); - $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val; - } - if (empty($outputmode)) - { - if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) + $obj = $this->db->fetch_object($resql); + $label = ''; + $tmparray = explode(',', $fieldstoshow); + foreach ($tmparray as $key => $val) { - $out .= ''; + $val = preg_replace('/t\./', '', $val); + $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val; + } + if (empty($outputmode)) + { + if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) + { + $out .= ''; + } + else + { + $out .= ''; + } } else { - $out .= ''; + array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); } - } - else - { - array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); - } - $i++; - if (($i % 10) == 0) $out .= "\n"; + $i++; + if (($i % 10) == 0) $out .= "\n"; + } } + + $out .= ''."\n"; + } + else + { + dol_print_error($this->db); } - $out .= ''."\n"; - } - else - { - dol_print_error($this->db); - } + $this->result = array('nbofelement'=>$num); - $this->result = array('nbofelement'=>$num); - - if ($outputmode) return $outarray; - return $out; + if ($outputmode) return $outarray; + return $out; } diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index cfd15deb91c..d6ebb8b919f 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -1,5 +1,7 @@ '."\n"; + // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { diff --git a/htdocs/includes/jquery/plugins/select2/.editorconfig b/htdocs/includes/jquery/plugins/select2/.editorconfig deleted file mode 100644 index 54f4d3beedb..00000000000 --- a/htdocs/includes/jquery/plugins/select2/.editorconfig +++ /dev/null @@ -1,6 +0,0 @@ -[*] -indent_style = space -end_of_line = lf - -[*.js] -indent_size = 2 diff --git a/htdocs/includes/jquery/plugins/select2/.gitignore b/htdocs/includes/jquery/plugins/select2/.gitignore deleted file mode 100644 index aa970da6518..00000000000 --- a/htdocs/includes/jquery/plugins/select2/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -dist/js/i18n/build.txt -.sass-cache diff --git a/htdocs/includes/jquery/plugins/select2/.jshintignore b/htdocs/includes/jquery/plugins/select2/.jshintignore deleted file mode 100644 index ba5a30f8c38..00000000000 --- a/htdocs/includes/jquery/plugins/select2/.jshintignore +++ /dev/null @@ -1,4 +0,0 @@ -src/js/banner.*.js -src/js/wrapper.*.js -tests/vendor/*.js -tests/helpers.js diff --git a/htdocs/includes/jquery/plugins/select2/.jshintrc b/htdocs/includes/jquery/plugins/select2/.jshintrc deleted file mode 100644 index 94299268771..00000000000 --- a/htdocs/includes/jquery/plugins/select2/.jshintrc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "bitwise": true, - "camelcase": true, - "curly": true, - "es3": true, - "eqnull": true, - "freeze": true, - "globals": { - "console": false, - "define": false, - "document": false, - "MockContainer": false, - "module": false, - "QUnit": false, - "require": false, - "test": false, - "window": false - }, - "indent": 2, - "maxlen": 80, - "noarg": true, - "nonew": true, - "quotmark": "single", - "undef": true -} diff --git a/htdocs/includes/jquery/plugins/select2/CHANGELOG.md b/htdocs/includes/jquery/plugins/select2/CHANGELOG.md index d6b2a7587dd..3ae60aff255 100644 --- a/htdocs/includes/jquery/plugins/select2/CHANGELOG.md +++ b/htdocs/includes/jquery/plugins/select2/CHANGELOG.md @@ -1,178 +1,5 @@ # Change Log -## 4.0.13 - -### New features / improvements - -* Trigger `input` event before `change` events (#4649) -* Feed back the keypress code that was responsible for the 'close' event (#5513) -* Only trigger `selection:update` once on DOM change events (#5734) - -### Bug fixes - -* Prevent opening of disabled elements (#5751) - -### Documentation - -* Fix "edit this page" links in docs (#5689) - -### Miscellaneous - -* Registered Select2 on Open Collective (#5700, #5721, #5741) - -## 4.0.12 - -### Bug fixes - -* Fixes incorrect offset when using the Shadow DOM and styling the `` element (#5682) - -### Miscellaneous - -* Replace cdnjs with jsDelivr in the documentation (#5687) -* Fix incorrect provider for the automated NPM deployment (#5686) - -## 4.0.11 - -### Bug fixes - -* Fixes jQuery migrate error when getting offset when dropdownParent not in document (#5584) - -### Miscellaneous - -* Enable GitHub actions for CI (#5591) -* Documentation has been moved into and is deployed from the code repository (#5638) -* Remove Travis CI integration (#5665) - -## 4.0.10 - -### New features / improvements - -* Support passing in a selector for `dropdownParent` option (#5622) - -### Bug fixes - -* Fix bug where dropdowns pointing upwards were incorrectly positioned (#5621) - -## 4.0.9 - -### New features / improvements - -* Mirror disabled state through aria-disabled on selection (#5579) -* Select2 now clears the internal ID when it is destroyed (#5587) -* Set the main ARIA 1.1 roles and properties for comboboxes (#5582) -* The `language` option now has a clearly defined fallback chain (#5602) - -### Bug fixes - -* Do not propagate click when search box is not empty (#5580) -* Fix `maximumSelectionLength` being ignored by `closeOnSelect` (#5581) -* Fix generated options not receiving result IDs (#5586) -* Remove selection title attribute if text is empty (#5589) -* Reposition dropdown whenever items are selected (#5590) -* Fix dropdown positioning when displayed above with messages (#5592) -* Fix search box expanding width of container (#5595) -* `allowClear` no longer shifts selections to a new line (#5603) - -### Translations - -* Fix error in German translations (#5604) - -### Miscellaneous - -* Updated development grunt version so it no longer shows as vulnerable (#5597) -* Remove unused variables (#5554) - -## 4.0.8 - -### New features / improvements - -* Test against and fix compatibility with jQuery 3.4.1 (#5531) -* Results respect disabled state of `