From de62037ba51f7de09841208e8fa36703b863c711 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Jun 2020 12:58:10 +0200 Subject: [PATCH 1/2] Fix signed only in margin calculation of project --- htdocs/comm/propal/class/propal.class.php | 4 +++- htdocs/core/class/html.form.class.php | 2 +- htdocs/langs/en_US/propal.lang | 1 + htdocs/projet/element.php | 25 +++++++++++++++-------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3c7cfe0006c..0101805cd88 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1537,7 +1537,9 @@ class Propal extends CommonObject $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->statut = (int) $obj->fk_statut; + + $this->status = (int) $obj->fk_statut; + $this->statut = $this->status; // deprecated $this->statut_libelle = $obj->statut_label; $this->datec = $this->db->jdate($obj->datec); // TODO deprecated diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c38e69eaa50..447f9569517 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4264,7 +4264,7 @@ class Form elseif ($input['type'] == 'select') { $more .= '
'; - if (!empty($input['label'])) $more .= $input['label'].'
'; + if (!empty($input['label'])) $more .= $input['label'].'
'; $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); $more .= '
'."\n"; } diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 71d6857c909..273996ab1b1 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -84,3 +84,4 @@ DefaultModelPropalClosed=Default template when closing a business proposal (unbi ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by +SignedOnly=Signed only diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 2566dcb104d..c6932e34f45 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -635,10 +635,10 @@ foreach($listofreferent as $key => $value) if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'add') { if ($margin == 'add') { - $tooltiponprofitplus.=' + '.$name."
\n"; + $tooltiponprofitplus.=' > '.$name." (+)
\n"; } if ($margin == 'minus') { - $tooltiponprofitminus.=' - '.$name."
\n"; + $tooltiponprofitminus.=' > '.$name." (-)
\n"; } } } @@ -693,7 +693,7 @@ foreach ($listofreferent as $key => $value) } if ($key == 'propal') { - if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal = false; // Refused proposal must not be included in total + if ($element->status != Propal::STATUS_SIGNED && $element->status != Propal::STATUS_BILLED) $qualifiedfortotal = false; // Only signed proposal must not be included in total } if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty(); @@ -777,7 +777,8 @@ foreach ($listofreferent as $key => $value) // Each element with at least one line is output $qualifiedforfinalprofit = true; if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) $qualifiedforfinalprofit = false; - //var_dump($key); + if ($key == 'propal' && $element->status != Propal::STATUS_SIGNED && $element->status != Propal::STATUS_BILLED) $qualifiedforfinalprofit = false; + //var_dump($key.' '.$qualifiedforfinalprofit); // Calculate margin if ($qualifiedforfinalprofit) @@ -803,13 +804,19 @@ foreach ($listofreferent as $key => $value) print ''.$i.''; // Amount HT print ''; - if (!$qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; - else print price($total_ht); + if ($key == 'intervention' && !$qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; + else { + print price($total_ht); + if ($key == 'propal') print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; + } print ''; // Amount TTC print ''; - if (!$qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; - else print price($total_ttc); + if ($key == 'intervention' && !$qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; + else { + print price($total_ttc); + if ($key == 'propal') print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; + } print ''; print ''; } From 2865d6bd1592aab50301ed8763831694665fee6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Jun 2020 13:39:00 +0200 Subject: [PATCH 2/2] Fix set of free product --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 0fb1aff011d..2c54d4540b6 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -180,7 +180,7 @@ if ($nolinesbefore) { echo '