Merge pull request #32163 from glu000/19.0-fix-32161
Fix #32161 - Payment terms are not taken from thirdparty when proposal is created from project
This commit is contained in:
commit
211d21306c
1 changed files with 15 additions and 4 deletions
|
|
@ -1778,6 +1778,14 @@ if ($action == 'create') {
|
|||
|
||||
if ($element == 'project') {
|
||||
$projectid = $originid;
|
||||
|
||||
// Fetch project and thirdparty
|
||||
$project = new Project($db);
|
||||
$project->fetch($projectid);
|
||||
if ($project->socid > 0) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($project->socid);
|
||||
}
|
||||
} else {
|
||||
// For compatibility
|
||||
if ($element == 'order' || $element == 'commande') {
|
||||
|
|
@ -1809,9 +1817,9 @@ if ($action == 'create') {
|
|||
|
||||
$soc = $objectsrc->thirdparty;
|
||||
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
|
||||
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
|
||||
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
|
||||
|
||||
// Replicate extrafields
|
||||
$objectsrc->fetch_optionals();
|
||||
|
|
@ -1826,7 +1834,10 @@ if ($action == 'create') {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
// Load default values from thirdparty
|
||||
if (!empty($soc)) {
|
||||
$cond_reglement_id = empty($soc->cond_reglement_id) ? $cond_reglement_id : $soc->cond_reglement_id;
|
||||
$deposit_percent = empty($soc->deposit_percent) ? $deposit_percent : $soc->deposit_percent;
|
||||
$mode_reglement_id = empty($soc->mode_reglement_id) ? $mode_reglement_id : $soc->mode_reglement_id;
|
||||
|
|
|
|||
Loading…
Reference in a new issue