diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 60d2360956e..e8e92ebfada 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1304,7 +1304,8 @@ if (empty($reshook)) { $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'restricthtml')); $object->note_private = trim(GETPOST('note_private', 'restricthtml')); - $object->ref_client = GETPOST('ref_client'); + $object->ref_customer = GETPOST('ref_client'); + $object->ref_client = $object->ref_customer; $object->model_pdf = GETPOST('model'); $object->fk_project = GETPOST('projectid', 'int'); $object->cond_reglement_id = (GETPOST('type') == 3 ? 1 : GETPOST('cond_reglement_id')); diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 855ea5d8219..b59ea822731 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -98,10 +98,15 @@ class FormMargin } $pv = $line->total_ht; - $pa_ht = ($pv < 0 ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign - if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) - || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) { - $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); + $pa_ht = (($pv < 0 || ($pv == 0 && $object->type == $object::TYPE_CREDIT_NOTE)) ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign + if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Special case for old situation mode + if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) + || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) { + // We need a compensation relative to $line->situation_percent + $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); + } else { + $pa = $line->qty * $pa_ht; + } } else { $pa = $line->qty * $pa_ht; } @@ -213,7 +218,7 @@ class FormMargin $marginInfo = $this->getMarginInfosArray($object, $force_price); - $parameters=array('marginInfo'=>&$marginInfo); + $parameters=array('marginInfo' => &$marginInfo); $reshook = $hookmanager->executeHooks('displayMarginInfos', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -233,8 +238,8 @@ class FormMargin print '});'; } + print '' . "\n"; print '
'; - print '' . "\n"; print ''; print ''; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 36b9cf6d9f2..a89d4359f14 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -124,7 +124,7 @@ if ($nolinesbefore) { multicurrency_code != $conf->currency) { ?> - +
trans('PriceUHTCurrency'); ?> trans('PriceUTTC'); ?> trans('Qty'); ?>