diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php
index 7d2bf379282..1a89373d507 100644
--- a/htdocs/admin/workflow.php
+++ b/htdocs/admin/workflow.php
@@ -88,8 +88,10 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', 'picto'=>'propal', 'warning'=>''),
// Automatic classification supplier order
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array('family'=>'classify_supplier_order', 'position'=>62, 'enabled'=>'!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)', 'picto'=>'order', 'warning'=>''),
- //Automatic classification reception
+ // Automatic classification reception
'WORKFLOW_BILL_ON_RECEPTION'=>array('family'=>'classify_reception', 'position'=>64, 'enabled'=>'! empty($conf->reception->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', 'picto'=>'bill'),
+ // Automatic classification of intervention
+ 'WORKFLOW_TICKET_CLOSE_INTERVENTION'=>array('family'=>'classify_intervention', 'position'=>100, 'enabled'=>'! empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled)', 'picto'=>'intervention'),
);
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow']))
@@ -131,8 +133,8 @@ foreach ($workflowcodes as $key => $params)
{
print '
'."\n";
print ' | ';
- if ($family == 'create')
- {
+ $reg = array();
+ if ($family == 'create') {
print $langs->trans("AutomaticCreation");
} elseif (preg_match('/classify_(.*)/', $family, $reg))
{
@@ -142,6 +144,7 @@ foreach ($workflowcodes as $key => $params)
if ($reg[1] == 'supplier_proposal') print ' - '.$langs->trans('SupplierProposal');
if ($reg[1] == 'supplier_order') print ' - '.$langs->trans('SupplierOrder');
if ($reg[1] == 'reception') print ' - '.$langs->trans('Reception');
+ if ($reg[1] == 'intervention') print ' - '.$langs->trans('Intervention');
} else {
print $langs->trans("Description");
}
@@ -152,7 +155,7 @@ foreach ($workflowcodes as $key => $params)
}
print " |
\n";
- print "| ".img_object('', $picto).$langs->trans('desc'.$key);
+ print " | ".img_object('', $picto, 'class="paddingright"').$langs->trans('desc'.$key);
if (!empty($params['warning']))
{
$langs->load("errors");
diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang
index be126eef0f4..646b97ec31d 100644
--- a/htdocs/langs/en_US/workflow.lang
+++ b/htdocs/langs/en_US/workflow.lang
@@ -16,5 +16,8 @@ descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classify linked source sales order
# Autoclassify purchase order
descWORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL=Classify linked source vendor proposal as billed when vendor invoice is validated (and if the amount of the invoice is the same as the total amount of the linked proposal)
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classify linked source purchase order as billed when vendor invoice is validated (and if the amount of the invoice is the same as the total amount of the linked order)
+descWORKFLOW_BILL_ON_RECEPTION=Classify receptions to "billed" when a linked supplier order is validated
+# Autoclose intervention
+descWORKFLOW_TICKET_CLOSE_INTERVENTION=Close all interventions linked to the ticket when a ticket is closed
AutomaticCreation=Automatic creation
AutomaticClassification=Automatic classification
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 4e62a92a4c9..7ed0bc9f4c4 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -1700,24 +1700,27 @@ class Ticket extends CommonObject
$error = 0;
// Valid and close fichinter linked
- $this->fetchObjectLinked($this->id, $this->element, null, 'fichinter');
- if ($this->linkedObjectsIds)
- {
- foreach ($this->linkedObjectsIds['fichinter'] as $fichinter_id) {
- $fichinter = new Fichinter($this->db);
- $fichinter->fetch($fichinter_id);
- if ($fichinter->statut == 0) {
- $result = $fichinter->setValid($user);
- if (!$result) {
- $this->errors[] = $fichinter->error;
- $error++;
+ if (!empty($conf->ficheinter->enabled) && ! empty($conf->global->WORKFLOW_TICKET_CLOSE_INTERVENTION)) {
+ dol_syslog("We have closed the ticket, so we close all linked interventions");
+ $this->fetchObjectLinked($this->id, $this->element, null, 'fichinter');
+ if ($this->linkedObjectsIds)
+ {
+ foreach ($this->linkedObjectsIds['fichinter'] as $fichinter_id) {
+ $fichinter = new Fichinter($this->db);
+ $fichinter->fetch($fichinter_id);
+ if ($fichinter->statut == 0) {
+ $result = $fichinter->setValid($user);
+ if (!$result) {
+ $this->errors[] = $fichinter->error;
+ $error++;
+ }
}
- }
- if ($fichinter->statut < 3) {
- $result = $fichinter->setStatut(3);
- if (!$result) {
- $this->errors[] = $fichinter->error;
- $error++;
+ if ($fichinter->statut < 3) {
+ $result = $fichinter->setStatut(3);
+ if (!$result) {
+ $this->errors[] = $fichinter->error;
+ $error++;
+ }
}
}
}
|