From bd7f6339ce4b1d56485d5fb7eb98ef00e6ec5f60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Dec 2014 12:59:34 +0100 Subject: [PATCH] Because this is a legal issue (OPCA), i added the hidden constant for 3.7: WORKFLOW_PROPAL_CAN_CLASSIFY_BILLED_WITHOUT_INVOICES => Button "Classified Billed" is visible on proposal even if there is no invoice linked to proposal. Fixed: Also fix get list of invoice that report too many data. --- htdocs/comm/propal.php | 8 +++++--- htdocs/comm/propal/class/propal.class.php | 9 ++++++--- htdocs/core/class/commonobject.class.php | 2 +- htdocs/langs/en_US/workflow.lang | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 5feb7769a43..6110186fcb4 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2110,12 +2110,14 @@ if ($action == 'create') // Create an invoice and classify billed if ($object->statut == 2) { - if (! empty($conf->facture->enabled) && $user->rights->facture->creer) { + if (! empty($conf->facture->enabled) && $user->rights->facture->creer) + { print '
' . $langs->trans("AddBill") . '
'; } - $arraypropal = $object->getInvoiceArrayList(); - if (is_array($arraypropal) && count($arraypropal) > 0) { + $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); + if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES)) + { print '
socid . '">' . $langs->trans("ClassifyBilled") . '
'; } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index fb9d5257d49..be22043e4b5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1987,16 +1987,19 @@ class Propal extends CommonObject { $linkedInvoices[] = $objectid[$i]; } - // Cas des factures liees via la commande + // Cas des factures liees par un autre objet (ex: commande) else - { + { $this->fetchObjectLinked($objectid[$i],$objecttype); foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid) { $numj=count($subobjectid); for ($j=0;$j<$numj;$j++) { - $linkedInvoices[] = $subobjectid[$j]; + if ($subobjecttype == 'facture') + { + $linkedInvoices[] = $subobjectid[$j]; + } } } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4cc8cd23672..6ab8c6c75f2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1851,7 +1851,7 @@ abstract class CommonObject } } else - { + { $sql.= "(fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."')"; $sql.= " ".$clause." (fk_target = '".$targetid."' AND targettype = '".$targettype."')"; } diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index d4ecf42b997..e08c88a9170 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - admin WorkflowSetup=Workflow module setup -WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is opened (you make thing in order you want). You can enabled automatic actions that you are interesting in. +WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is opened (you make thing in order you want). You can activate the automatic actions that you are interesting in. ThereIsNoWorkflowToModify=There is no workflow you can modify for module you have activated. descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Create a customer order automatically after a commercial proposal is signed descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Create a customer invoice automatically after a commercial proposal is signed