Merge pull request #18562 from vincentjdc/bill-supplier-validate
Bill supplier validate
This commit is contained in:
commit
46a38506a5
@ -206,11 +206,13 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
|||||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||||
foreach ($object->linkedObjects['order_supplier'] as $element) {
|
foreach ($object->linkedObjects['order_supplier'] as $element) {
|
||||||
$ret = $element->classifyBilled($user);
|
$ret = $element->classifyBilled($user);
|
||||||
}
|
if ($ret < 0) {
|
||||||
}
|
|
||||||
}
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Second classify billed the proposal.
|
// Second classify billed the proposal.
|
||||||
if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) {
|
if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) {
|
||||||
@ -226,12 +228,35 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
|||||||
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
|
||||||
foreach ($object->linkedObjects['supplier_proposal'] as $element) {
|
foreach ($object->linkedObjects['supplier_proposal'] as $element) {
|
||||||
$ret = $element->classifyBilled($user);
|
$ret = $element->classifyBilled($user);
|
||||||
|
if ($ret < 0) {
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// classify billed reception
|
||||||
|
if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
|
||||||
|
$object->fetchObjectLinked('', 'reception', $object->id, $object->element);
|
||||||
|
if (!empty($object->linkedObjects)) {
|
||||||
|
$totalonlinkedelements = 0;
|
||||||
|
foreach ($object->linkedObjects['reception'] as $element) {
|
||||||
|
if ($element->statut == Reception::STATUS_VALIDATED) $totalonlinkedelements += $element->total_ht;
|
||||||
|
}
|
||||||
|
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
||||||
|
if ($totalonlinkedelements == $object->total_ht) {
|
||||||
|
foreach ($object->linkedObjects['reception'] as $element) {
|
||||||
|
$ret = $element->set_billed();
|
||||||
|
if ($ret < 0) {
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Invoice classify billed order
|
// Invoice classify billed order
|
||||||
if ($action == 'BILL_PAYED') {
|
if ($action == 'BILL_PAYED') {
|
||||||
@ -325,30 +350,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// classify billed reception
|
|
||||||
if ($action == 'BILL_SUPPLIER_VALIDATE') {
|
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
|
|
||||||
|
|
||||||
if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
|
|
||||||
$object->fetchObjectLinked('', 'reception', $object->id, $object->element);
|
|
||||||
if (!empty($object->linkedObjects)) {
|
|
||||||
$totalonlinkedelements = 0;
|
|
||||||
foreach ($object->linkedObjects['reception'] as $element) {
|
|
||||||
if ($element->statut == Reception::STATUS_VALIDATED) {
|
|
||||||
$totalonlinkedelements += $element->total_ht;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
|
|
||||||
if ($totalonlinkedelements == $object->total_ht) {
|
|
||||||
foreach ($object->linkedObjects['reception'] as $element) {
|
|
||||||
$ret = $element->setBilled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user