Fix reload of page

This commit is contained in:
Laurent Destailleur
2023-02-16 22:01:05 +01:00
parent 3c3d221370
commit b021721b10
2 changed files with 12 additions and 12 deletions

View File

@@ -1700,14 +1700,14 @@ if ($action == 'create') {
} else {
print img_picto('', 'company').$form->select_company((empty($socid) ? '' : $socid), 'socid', '(s.fournisseur=1 AND s.status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
if (empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE_DISABLED)) {
print '<script>
$(document).ready(function() {
$("#socid").change(function() {
var socid = $(this).val();
var prjid = $("#projectid").val();
console.log("We have changed the company - Reload page");
// reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&projectid="+prjid
$("input[name=action]").val("create");
$("form[name=add]").submit();
});
});
</script>';