Fix due date for supplier invoice not correctly set on clone
This commit is contained in:
parent
3a561d78b9
commit
a64c41c4ba
@ -663,7 +663,7 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
* conditions and billing date.
|
* conditions and billing date.
|
||||||
*
|
*
|
||||||
* @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
|
* @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
|
||||||
* @return integer Date limite de reglement si ok, <0 si ko
|
* @return integer Date limit of payment if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function calculate_date_lim_reglement($cond_reglement = 0)
|
public function calculate_date_lim_reglement($cond_reglement = 0)
|
||||||
{
|
{
|
||||||
@ -674,6 +674,9 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
if (!$cond_reglement) {
|
if (!$cond_reglement) {
|
||||||
$cond_reglement = $this->cond_reglement_id;
|
$cond_reglement = $this->cond_reglement_id;
|
||||||
}
|
}
|
||||||
|
if (!$cond_reglement) {
|
||||||
|
return $this->date;
|
||||||
|
}
|
||||||
|
|
||||||
$cdr_nbjour = 0;
|
$cdr_nbjour = 0;
|
||||||
$cdr_type = 0;
|
$cdr_type = 0;
|
||||||
|
|||||||
@ -3069,16 +3069,17 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$object->fk_facture_source = 0;
|
$object->fk_facture_source = 0;
|
||||||
$object->date_creation = '';
|
$object->date_creation = '';
|
||||||
$object->date_validation = '';
|
$object->date_validation = '';
|
||||||
$object->date = (empty($this->date) ? '' : $this->date);
|
$object->date = (empty($this->date) ? dol_now() : $this->date);
|
||||||
$object->date_echeance = '';
|
|
||||||
$object->ref_client = '';
|
$object->ref_client = '';
|
||||||
$object->close_code = '';
|
$object->close_code = '';
|
||||||
$object->close_note = '';
|
$object->close_note = '';
|
||||||
if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING == 1) {
|
if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) {
|
||||||
$object->note_private = '';
|
$object->note_private = '';
|
||||||
$object->note_public = '';
|
$object->note_public = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$object->date_echeance = $object->calculate_date_lim_reglement();
|
||||||
|
|
||||||
// Loop on each line of new invoice
|
// Loop on each line of new invoice
|
||||||
foreach ($object->lines as $i => $line) {
|
foreach ($object->lines as $i => $line) {
|
||||||
if (isset($object->lines[$i]->info_bits) && ($object->lines[$i]->info_bits & 0x02) == 0x02) { // We do not clone line of discounts
|
if (isset($object->lines[$i]->info_bits) && ($object->lines[$i]->info_bits & 0x02) == 0x02) { // We do not clone line of discounts
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user