Merge pull request #5585 from atm-florian/dev_NEW_workflow_ClassPropalBillOnBillValidation
NEW : Add workflow to classifed propal bill on invoice validation
This commit is contained in:
commit
c73f962b28
@ -76,6 +76,7 @@ $workflowcodes=array(
|
||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
||||
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||
@ -110,8 +111,8 @@ foreach($workflowcodes as $key => $params)
|
||||
print ' <td align="center">'.$langs->trans("Status").'</td>';
|
||||
print "</tr>\n";
|
||||
$oldfamily = $family;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
print "<td>".img_object('', $picto).$langs->trans('desc'.$key);
|
||||
|
||||
@ -64,7 +64,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
$newobject->context['createfrompropal'] = 'createfrompropal';
|
||||
$newobject->context['origin'] = $object->element;
|
||||
$newobject->context['origin_id'] = $object->id;
|
||||
|
||||
|
||||
$ret=$newobject->createFromProposal($object);
|
||||
if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; }
|
||||
return $ret;
|
||||
@ -83,7 +83,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
$newobject->context['createfromorder'] = 'createfromorder';
|
||||
$newobject->context['origin'] = $object->element;
|
||||
$newobject->context['origin_id'] = $object->id;
|
||||
|
||||
|
||||
$ret=$newobject->createFromOrder($object);
|
||||
if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; }
|
||||
return $ret;
|
||||
@ -144,6 +144,19 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if (! empty($conf->propal->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL))
|
||||
{
|
||||
$object->fetchObjectLinked('','propal',$object->id,$object->element);
|
||||
if (! empty($object->linkedObjects))
|
||||
{
|
||||
foreach($object->linkedObjects['propal'] as $element)
|
||||
{
|
||||
$ret=$element->classifyBilled($user);
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@ -9,3 +9,4 @@ descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice af
|
||||
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid
|
||||
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid
|
||||
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated
|
||||
descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer invoice is validated
|
||||
|
||||
Loading…
Reference in New Issue
Block a user