From 0fa4739d47e5f5e29190a4f9eec7a9ec6219cb92 Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Tue, 6 Aug 2013 16:57:40 +0200 Subject: [PATCH 1/4] T948-develop :Classify Billed when the price of bill is greater than command -In the workflow i've added on bouton which permitted to classify billed when the price of bills is greater than command,if her status is delivered /htdocs/admin/workflow.php --- htdocs/admin/workflow.php | 2 ++ ...e_20_modWorkflow_WorkflowManager.class.php | 19 +++++++++++++++++++ htdocs/langs/en_US/workflow.lang | 3 ++- htdocs/langs/fr_FR/workflow.lang | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) 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/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 From c0d3ed0d60e5797abe7703235d6f82fc4c9edcb2 Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Wed, 7 Aug 2013 10:17:18 +0200 Subject: [PATCH 2/4] T966-develop : Put the poste of the contact in the list In the list of contact when we send a mail,i added the post of person in () after the name htdocs/commande/fiche.php?id=481&action=presend&mode=init --- htdocs/societe/class/societe.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 6278b7bd8ab..aba3215820c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1576,7 +1576,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."'"; @@ -1592,7 +1592,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++; } } From 561d0ea46b2d63ef0f7dfa95db963dc9282f656e Mon Sep 17 00:00:00 2001 From: braito4 Date: Wed, 7 Aug 2013 20:48:50 +0200 Subject: [PATCH 3/4] Update fiche.php --- htdocs/fourn/facture/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 3a209afa940eb693e1bc1e7e98d9b7eccb0ed425 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Aug 2013 01:54:08 +0200 Subject: [PATCH 4/4] Update societe.class.php Add missing space --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5bb1fe7a915..a225276c3af 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1597,7 +1597,7 @@ class Societe extends CommonObject if ($mode == 'email') $property=$obj->email; else if ($mode == 'mobile') $property=$obj->phone_mobile; if(!empty($obj->poste)){ - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))."(".$obj->poste.")"." <".$property.">"; + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." (".$obj->poste.")"." <".$property.">"; } else {