diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 3bdf969c24c..842352475ad 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -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 '';
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 246f65c19f9..15e959b9736 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -2099,13 +2099,14 @@ if ($action == 'create') {
} else {
print img_picto('', 'company').$form->select_company(empty($societe->id) ? 0 : $societe->id, 'socid', '(s.fournisseur = 1 AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500');
// reload page to retrieve supplier informations
- if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
+ if (empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE_DISABLED)) {
print '';
@@ -2168,10 +2169,9 @@ if ($action == 'create') {
$(document).ready(function() {
$("#fac_rec").change(function() {
console.log("We have changed the template invoice - Reload page");
- var fac_rec = $(this).val();
- var socid = $(\'#socid\').val();
- // For template invoice change, we must reuse data of template, not input already done, so we call a GET with action=create, not a POST submit.
- window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&fac_rec="+fac_rec;
+ // reload page
+ $("input[name=action]").val("create");
+ $("form[name=add]").submit();
});
});
';