From a6a027f5c4cfca409031070c7e422260ab993829 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 20 Jun 2015 17:24:34 +0200 Subject: [PATCH] Fix several pb with javascript --- COPYRIGHT | 1 + build/makepack-dolibarr.pl | 1 + htdocs/core/class/html.form.class.php | 3 ++- htdocs/core/class/html.formcompany.class.php | 13 +++++++++---- htdocs/societe/soc.php | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index b7778986e35..a961a442507 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -24,6 +24,7 @@ odtPHP 1.0.1 GPL-2+ b Yes PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests +Restler 3.0 LGPL-3+ Yes Library to develop REST Web services TCPDF 6.2.6 LGPL-3+ Yes PDF generation JS libraries: diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index bdfc9d8972a..62ce7345217 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -489,6 +489,7 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 51582886af2..82a448e0c38 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3216,7 +3216,7 @@ class Form $formconfirm.= "\n<!-- begin ajax form_confirm page=".$page." -->\n"; $formconfirm.= '<script type="text/javascript">'."\n"; - $formconfirm.=' + $formconfirm.= 'jQuery(document).ready(function() { $(function() { $( "#'.$dialogconfirm.'" ).dialog({ autoOpen: '.($autoOpen ? "true" : "false").','; @@ -3281,6 +3281,7 @@ class Form }); } }); + }); </script>'; $formconfirm.= "<!-- end ajax form_confirm -->\n"; } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a005fb2b228..e91184ede12 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -718,10 +718,11 @@ class FormCompany * @param string $htmlname HTML select name * @param string $fields Fields * @param int $fieldsize Field size - * @param int $disableautocomplete 1 To disable autocomplete features + * @param int $disableautocomplete 1 To disable ajax autocomplete features (browser autocomplete may still occurs) + * @param string $moreattrib Add more attribute on HTML input field * @return string */ - function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0) + function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0, $moreattrib='') { global $conf; @@ -730,8 +731,12 @@ class FormCompany $size=''; if (!empty($fieldsize)) $size='size="'.$fieldsize.'"'; - if ($conf->use_javascript_ajax && empty($disableautocomplete)) $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n"; - $out.= '<input id="'.$htmlname.'" type="text" name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n"; + if ($conf->use_javascript_ajax && empty($disableautocomplete)) + { + $out.= ajax_multiautocompleter($htmlname,$fields,DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n"; + $moreattrib.=' autocomplete="off"'; + } + $out.= '<input id="'.$htmlname.'" type="text"'.($moreattrib?' '.$moreattrib:'').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n"; return $out; } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 654b5aa7b4b..b46bec9201c 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1582,9 +1582,9 @@ else // Zip / Town print '<tr><td>'.fieldLabel('Zip','zipcode').'</td><td>'; - print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6); + print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); print '</td><td>'.fieldLabel('Town','town').'</td><td>'; - print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id')); + print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); print '</td></tr>'; // Country -- GitLab