diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index b46f7b39cc3..e948bc1be79 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -81,6 +81,8 @@ $workflowcodes=array( 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'), 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), + ); if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index c40654efc54..73a348302f1 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -166,6 +166,25 @@ class InterfaceWorkflowManager return $ret; } } + + // classify billed order + if ($action == 'BILL_VALIDATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_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; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index a45df719b7d..aaf36409b81 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -155,7 +155,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fourn $result=$object->delete($id); if ($result > 0) { - header('Location: index.php'); + header('Location: list.php'); exit; } else diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index c3e56ba9785..390692f2643 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -8,4 +8,5 @@ descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Create a customer invoice automatically a 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_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 to billed when customer invoice is set to paid \ No newline at end of file +descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order to billed when customer invoice is set to paid +descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify the customer's order as invoiced when the bill(s) are higher than the order diff --git a/htdocs/langs/fr_FR/workflow.lang b/htdocs/langs/fr_FR/workflow.lang index 238ff540ef4..37b4aff492e 100644 --- a/htdocs/langs/fr_FR/workflow.lang +++ b/htdocs/langs/fr_FR/workflow.lang @@ -9,3 +9,4 @@ descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Créer une facture client automatiqueme descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Créer une facture client automatiquement à la clôture d'une commande client descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classer facturée la proposition commerciale source quand la commande client dérivée est classée payée descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classer facturée la ou les commandes clients source quand la facture client dérivée est classée payée +descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classer facturée la commande client source lorsque la facture ou les factures sont supérieures à la commande diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 60e4a1461ad..a225276c3af 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1580,7 +1580,7 @@ class Societe extends CommonObject { $contact_property = array(); - $sql = "SELECT rowid, email, phone_mobile, lastname, firstname"; + $sql = "SELECT rowid, email, phone_mobile, lastname, poste, firstname"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople"; $sql.= " WHERE fk_soc = '".$this->id."'"; @@ -1596,7 +1596,13 @@ class Societe extends CommonObject $obj = $this->db->fetch_object($resql); if ($mode == 'email') $property=$obj->email; else if ($mode == 'mobile') $property=$obj->phone_mobile; - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; + if(!empty($obj->poste)){ + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." (".$obj->poste.")"." <".$property.">"; + } + else + { + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; + } $i++; } }