diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php
index ace00b77caa..f4902e4912e 100644
--- a/htdocs/core/class/html.formcontract.class.php
+++ b/htdocs/core/class/html.formcontract.class.php
@@ -66,6 +66,7 @@ class FormContract
//if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")";
if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)";
if ($socid > 0) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
+ $sql.= " ORDER BY c.ref ";
dol_syslog(get_class($this)."::select_contract", LOG_DEBUG);
$resql=$db->query($sql);
@@ -129,6 +130,14 @@ class FormContract
}
print '';
$db->free($resql);
+
+ if (!empty($conf->use_javascript_ajax))
+ {
+ // Make select dynamic
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
+ print ajax_combobox($htmlname);
+ }
+
return $num;
}
else