2
0
forked from Wavyzz/dolibarr

NEW FEATURE PROPOSAL: on propale, order or invoice creation from

scratch, reload page after customer selection so its informations can be
loaded
This commit is contained in:
Christophe Battarel
2015-11-06 16:14:00 +01:00
parent 94534f1ed8
commit f52ae35dc6
3 changed files with 36 additions and 3 deletions

View File

@@ -1338,10 +1338,10 @@ if ($action == 'create' && $user->rights->commande->creer)
// Reference client
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">';
if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER))
if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && ! empty($origin) && ! empty($originid))
print '<input type="text" name="ref_client" value="'.$ref_client.'"></td>';
else
print '<input type="text" name="ref_client" value=""></td>';
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
print '</tr>';
// Client
@@ -1355,6 +1355,17 @@ if ($action == 'create' && $user->rights->commande->creer)
} else {
print '<td colspan="2">';
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1);
// reload page to retrieve customer informations
print '<script type="text/javascript">
$(document).ready(function() {';
print '
$("#socid").change(function() {
var socid = $(this).val();
// reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val();
});
});
</script>';
print '</td>';
}
print '</tr>' . "\n";