Merge pull request #22756 from OPEN-DSI/14.0_fix_reload_page_on_supplier_change

FIX: Reload page on supplier change and keeping the values
This commit is contained in:
Laurent Destailleur 2023-01-08 14:25:46 +01:00 committed by GitHub
commit 010014b4ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 16 deletions

View File

@ -1695,13 +1695,13 @@ if ($action == 'create') {
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'); 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 // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
print '<script> print '<script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
var socid = $(this).val(); console.log("We have changed the company - Reload page");
var prjid = $("#projectid").val();
// 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>'; </script>';

View File

@ -2103,9 +2103,10 @@ if ($action == 'create') {
print '<script type="text/javascript"> print '<script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("#socid").change(function() { $("#socid").change(function() {
var socid = $(this).val(); console.log("We have changed the company - Reload page");
var fac_rec = $(\'#fac_rec\').val(); // reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&fac_rec="+fac_rec; $("input[name=action]").val("create");
$("form[name=add]").submit();
}); });
}); });
</script>'; </script>';