New: classify billed order if invoice billed (workflow

manager)

Conflicts:
	htdocs/core/class/commonobject.class.php
	htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
	htdocs/langs/en_US/workflow.lang
	htdocs/langs/fr_FR/workflow.lang
This commit is contained in:
Regis Houssin 2012-07-13 12:14:41 +02:00 committed by Laurent Destailleur
parent 1af4834f10
commit 20704d6a5c
5 changed files with 56 additions and 2 deletions

View File

@ -80,6 +80,7 @@ $workflowcodes=array();
$workflow=array( $workflow=array(
'order' => array( 'order' => array(
'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_ORDER') 'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_ORDER')
,'invoice' => array('WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER')
), ),
'invoice' => array ( 'invoice' => array (
'order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE') 'order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')

View File

@ -1654,8 +1654,21 @@ abstract class CommonObject
$sql.= " WHERE "; $sql.= " WHERE ";
if ($justsource || $justtarget) if ($justsource || $justtarget)
{ {
<<<<<<< OURS
if ($justsource) $sql.= "fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."'"; if ($justsource) $sql.= "fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."'";
if ($justtarget) $sql.= "fk_target = '".$targetid."' AND targettype = '".$targettype."'"; if ($justtarget) $sql.= "fk_target = '".$targetid."' AND targettype = '".$targettype."'";
=======
if ($justsource)
{
$sql.= "fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."'";
if ($withtargettype) $sql.= " AND targettype = '".$targettype."'";
}
else if ($justtarget)
{
$sql.= "fk_target = '".$targetid."' AND targettype = '".$targettype."'";
if ($withsourcetype) $sql.= " AND sourcetype = '".$sourcetype."'";
}
>>>>>>> THEIRS
} }
else else
{ {

View File

@ -130,6 +130,42 @@ class InterfaceWorkflowManager
} }
} }
// Order classify billed proposal
if ($action == 'ORDER_CLASSIFY_BILLED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->propal->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL))
{
$object->fetchObjectLinked('','propal',$object->id,$object->element);
if (! empty($object->linkedObjects))
{
foreach($object->linkedObjects['propal'] as $element)
{
$ret=$element->classifyBilled();
}
}
return $ret;
}
}
// Order classify billed proposal
if ($action == 'BILL_PAYED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER))
{
$object->fetchObjectLinked('','commande',$object->id,$object->element);
if (! empty($object->linkedObjects))
{
foreach($object->linkedObjects['commande'] as $element)
{
$ret=$element->classifyBilled();
}
}
return $ret;
}
}
return 0; return 0;
} }

View File

@ -7,3 +7,5 @@ descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Create a customer order automatically after
descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Create a customer invoice automatically after a commercial proposal is signed descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Create a customer invoice automatically after a commercial proposal is signed
descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Create a customer invoice automatically after a contract is validated descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Create a customer invoice automatically after a contract is validated
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Create a customer invoice automatically after a customer order is closed descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Create a customer invoice automatically after a customer order is closed
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify billed the original proposal along with a customer order
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify billed originals customer orders along with a customer invoice

View File

@ -7,3 +7,5 @@ descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Créer une commande client automatiquement
descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Créer une facture client automatiquement à la signature d'une proposition commerciale descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Créer une facture client automatiquement à la signature d'une proposition commerciale
descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Créer une facture client automatiquement à la validation d'un contrat descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Créer une facture client automatiquement à la validation d'un contrat
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Créer une facture client automatiquement à la cloture d'une commande client descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Créer une facture client automatiquement à la cloture d'une commande client
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classer facturée la proposition commerciale d'origine en même temps que la commande
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classer facturée la ou les commandes clients d'origine en même temps que la facture