diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index 13f49552dc0743d46795ed29eb108a8c505d3a75..44b90d0d79bf316231770484306bdb27c52e8d09 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -115,20 +115,6 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
/**
* Edition des param�tres
*/
- if ($conf->use_javascript)
- {
- print '
- <script language="javascript" type="text/javascript">
- <!--
- function save_refresh()
- {
- document.form_index.action.value="updateedit";
- document.form_index.submit();
- }
- -->
- </script>
- ';
- }
print '<form enctype="multipart/form-data" method="post" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
print '<input type="hidden" name="action" value="update">';
@@ -155,7 +141,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("Country").'</td><td>';
- $form->select_pays($conf->global->MAIN_INFO_SOCIETE_PAYS,'pays_id',($conf->use_javascript?' onChange="save_refresh()"':''));
+ $form->select_pays($conf->global->MAIN_INFO_SOCIETE_PAYS,'pays_id',($conf->use_javascript?' onChange="company_save_refresh()"':''));
print '</td></tr>';
$var=!$var;
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 0ce30b18155ae37400ec1c1538f428fc3832be28..613da1f37ba613b2dad7641b98aa3cb88ef2425c 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -327,15 +327,21 @@ class Form
$pays_id = $obj->rowid?$obj->rowid:'';
// On applique un delai d'execution pour le bon fonctionnement
- $mode = substr($htmloption,-9,6);
- if ($mode == 'create')
+ $mode_create = substr($htmloption,-9,6);
+ $mode_edit = substr($htmloption,-7,4);
+ $mode_company = substr($htmloption,-10,7);
+ if ($mode_create == 'create')
{
$htmloption = 'onChange="ac_delay(\'autofilltownfromzip_save_refresh_create()\',\'500\')"';
}
- else
+ else if ($mode_edit == 'edit')
{
$htmloption = 'onChange="ac_delay(\'autofilltownfromzip_save_refresh_edit()\',\'500\')"';
}
+ else if ($mode_company == 'refresh')
+ {
+ $htmloption = 'onChange="ac_delay(\'company_save_refresh()\',\'500\')"';
+ }
print '<div>';
print '<input type="text" size="45" id="pays" name="pays" value="'.$obj->libelle.'" '.$htmloption.' />';
diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js
index c9296e110df3608f51f8b40130738db112e415f7..3a13eaa287422817bcf25f2eb78deb207b2592db 100644
--- a/htdocs/lib/lib_head.js
+++ b/htdocs/lib/lib_head.js
@@ -35,6 +35,12 @@ function autofilltownfromzip_save_refresh_create()
document.formsoc.submit();
}
+function company_save_refresh()
+{
+ document.form_index.action.value="updateedit";
+ document.form_index.submit();
+}
+
/*=================================================================