dolibarr  16.0.5
interface_20_modWorkflow_WorkflowManager.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
3  * Copyright (C) 2011-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2014 Marcos GarcĂ­a <marcosgdf@gmail.com>
5  * Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
28 
29 
35 {
41  public function __construct($db)
42  {
43  $this->db = $db;
44 
45  $this->name = preg_replace('/^Interface/i', '', get_class($this));
46  $this->family = "core";
47  $this->description = "Triggers of this module allows to manage workflows";
48  // 'development', 'experimental', 'dolibarr' or version
49  $this->version = self::VERSION_DOLIBARR;
50  $this->picto = 'technic';
51  }
52 
64  public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
65  {
66  if (empty($conf->workflow) || empty($conf->workflow->enabled)) {
67  return 0; // Module not active, we do nothing
68  }
69 
70  $ret = 0;
71 
72  // Proposals to order
73  if ($action == 'PROPAL_CLOSE_SIGNED') {
74  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
75  if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) {
76  $object->fetchObjectLinked();
77  if (!empty($object->linkedObjectsIds['commande'])) {
78  setEventMessages($langs->trans("OrderExists"), null, 'warnings');
79  return $ret;
80  } else {
81  include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
82  $newobject = new Commande($this->db);
83 
84  $newobject->context['createfrompropal'] = 'createfrompropal';
85  $newobject->context['origin'] = $object->element;
86  $newobject->context['origin_id'] = $object->id;
87 
88  $ret = $newobject->createFromProposal($object, $user);
89  if ($ret < 0) {
90  $this->error = $newobject->error;
91  $this->errors[] = $newobject->error;
92  }
93 
94  $object->clearObjectLinkedCache();
95 
96  return $ret;
97  }
98  }
99  }
100 
101  // Order to invoice
102  if ($action == 'ORDER_CLOSE') {
103  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
104  if (isModEnabled('facture') && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) {
105  include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
106  $newobject = new Facture($this->db);
107 
108  $newobject->context['createfromorder'] = 'createfromorder';
109  $newobject->context['origin'] = $object->element;
110  $newobject->context['origin_id'] = $object->id;
111 
112  $ret = $newobject->createFromOrder($object, $user);
113  if ($ret < 0) {
114  $this->error = $newobject->error;
115  $this->errors[] = $newobject->error;
116  }
117 
118  $object->clearObjectLinkedCache();
119 
120  return $ret;
121  }
122  }
123 
124  // Order classify billed proposal
125  if ($action == 'ORDER_CLASSIFY_BILLED') {
126  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
127  if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL)) {
128  $object->fetchObjectLinked('', 'propal', $object->id, $object->element);
129  if (!empty($object->linkedObjects)) {
130  $totalonlinkedelements = 0;
131  foreach ($object->linkedObjects['propal'] as $element) {
132  if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) {
133  $totalonlinkedelements += $element->total_ht;
134  }
135  }
136  dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
137  if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
138  foreach ($object->linkedObjects['propal'] as $element) {
139  $ret = $element->classifyBilled($user);
140  }
141  }
142  }
143  return $ret;
144  }
145  }
146 
147  // classify billed order & billed propososal
148  if ($action == 'BILL_VALIDATE') {
149  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
150 
151  // First classify billed the order to allow the proposal classify process
152  if (!empty($conf->commande->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) {
153  $object->fetchObjectLinked('', 'commande', $object->id, $object->element);
154  if (!empty($object->linkedObjects)) {
155  $totalonlinkedelements = 0;
156  foreach ($object->linkedObjects['commande'] as $element) {
157  if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) {
158  $totalonlinkedelements += $element->total_ht;
159  }
160  }
161  dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
162  if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
163  foreach ($object->linkedObjects['commande'] as $element) {
164  $ret = $element->classifyBilled($user);
165  }
166  }
167  }
168  }
169 
170  // Second classify billed the proposal.
171  if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL)) {
172  $object->fetchObjectLinked('', 'propal', $object->id, $object->element);
173  if (!empty($object->linkedObjects)) {
174  $totalonlinkedelements = 0;
175  foreach ($object->linkedObjects['propal'] as $element) {
176  if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) {
177  $totalonlinkedelements += $element->total_ht;
178  }
179  }
180  dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
181  if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
182  foreach ($object->linkedObjects['propal'] as $element) {
183  $ret = $element->classifyBilled($user);
184  }
185  }
186  }
187  }
188 
189  if (!empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE)) {
191  $object->fetchObjectLinked('', 'shipping', $object->id, $object->element);
192 
193  if (!empty($object->linkedObjects)) {
195  $shipment = array_shift($object->linkedObjects['shipping']);
196 
197  $ret = $shipment->setClosed();
198  }
199  }
200 
201  return $ret;
202  }
203 
204  // classify billed order & billed proposal
205  if ($action == 'BILL_SUPPLIER_VALIDATE') {
206  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
207 
208  // Firstly, we set to purchase order to "Billed" if WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER is set.
209  // After we will set proposals
210  if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) {
211  $object->fetchObjectLinked('', 'order_supplier', $object->id, $object->element);
212  if (!empty($object->linkedObjects)) {
213  $totalonlinkedelements = 0;
214  foreach ($object->linkedObjects['order_supplier'] as $element) {
216  $totalonlinkedelements += $element->total_ht;
217  }
218  }
219  dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
220  if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
221  foreach ($object->linkedObjects['order_supplier'] as $element) {
222  $ret = $element->classifyBilled($user);
223  if ($ret < 0) {
224  return $ret;
225  }
226  }
227  }
228  }
229  }
230 
231  // Secondly, we set to linked Proposal to "Billed" if WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL is set.
232  if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL)) {
233  $object->fetchObjectLinked('', 'supplier_proposal', $object->id, $object->element);
234  if (!empty($object->linkedObjects)) {
235  $totalonlinkedelements = 0;
236  foreach ($object->linkedObjects['supplier_proposal'] as $element) {
237  if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) {
238  $totalonlinkedelements += $element->total_ht;
239  }
240  }
241  dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
242  if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
243  foreach ($object->linkedObjects['supplier_proposal'] as $element) {
244  $ret = $element->classifyBilled($user);
245  if ($ret < 0) {
246  return $ret;
247  }
248  }
249  }
250  }
251  }
252 
253  // Then set reception to "Billed" if WORKFLOW_BILL_ON_RECEPTION is set
254  if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
255  $object->fetchObjectLinked('', 'reception', $object->id, $object->element);
256  if (!empty($object->linkedObjects)) {
257  $totalonlinkedelements = 0;
258  foreach ($object->linkedObjects['reception'] as $element) {
259  if ($element->statut == Reception::STATUS_VALIDATED) {
260  $totalonlinkedelements += $element->total_ht;
261  }
262  }
263  dol_syslog("Amount of linked reception = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
264  if ($totalonlinkedelements == $object->total_ht) {
265  foreach ($object->linkedObjects['reception'] as $element) {
266  $ret = $element->setBilled();
267  if ($ret < 0) {
268  return $ret;
269  }
270  }
271  }
272  }
273  }
274 
275  return $ret;
276  }
277 
278  // Invoice classify billed order
279  if ($action == 'BILL_PAYED') {
280  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
281 
282  if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) {
283  $object->fetchObjectLinked('', 'commande', $object->id, $object->element);
284  if (!empty($object->linkedObjects)) {
285  $totalonlinkedelements = 0;
286  foreach ($object->linkedObjects['commande'] as $element) {
287  if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) {
288  $totalonlinkedelements += $element->total_ht;
289  }
290  }
291  dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
292  if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) {
293  foreach ($object->linkedObjects['commande'] as $element) {
294  $ret = $element->classifyBilled($user);
295  }
296  }
297  }
298  return $ret;
299  }
300  }
301 
302  // If we validate or close a shipment
303  if (($action == 'SHIPPING_VALIDATE') || ($action == 'SHIPPING_CLOSED')) {
304  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
305 
306  if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) &&
307  (
308  (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING) && ($action == 'SHIPPING_VALIDATE')) ||
309  (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED) && ($action == 'SHIPPING_CLOSED'))
310  )
311  ) {
312  $qtyshipped = array();
313  $qtyordred = array();
314  require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
315 
316  // Find all shipments on order origin
317  $order = new Commande($this->db);
318  $ret = $order->fetch($object->origin_id);
319  if ($ret < 0) {
320  $this->error = $order->error;
321  $this->errors = $order->errors;
322  return $ret;
323  }
324  $ret = $order->fetchObjectLinked($order->id, 'commande', null, 'shipping');
325  if ($ret < 0) {
326  $this->error = $order->error;
327  $this->errors = $order->errors;
328  return $ret;
329  }
330  //Build array of quantity shipped by product for an order
331  if (is_array($order->linkedObjects) && count($order->linkedObjects) > 0) {
332  foreach ($order->linkedObjects as $type => $shipping_array) {
333  if ($type == 'shipping' && is_array($shipping_array) && count($shipping_array) > 0) {
334  foreach ($shipping_array as $shipping) {
335  if (is_array($shipping->lines) && count($shipping->lines) > 0) {
336  foreach ($shipping->lines as $shippingline) {
337  $qtyshipped[$shippingline->fk_product] += $shippingline->qty;
338  }
339  }
340  }
341  }
342  }
343  }
344 
345  //Build array of quantity ordered to be shipped
346  if (is_array($order->lines) && count($order->lines) > 0) {
347  foreach ($order->lines as $orderline) {
348  // Exclude lines not qualified for shipment, similar code is found into calcAndSetStatusDispatch() for vendors
349  if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) {
350  continue;
351  }
352  $qtyordred[$orderline->fk_product] += $orderline->qty;
353  }
354  }
355  //dol_syslog(var_export($qtyordred,true),LOG_DEBUG);
356  //dol_syslog(var_export($qtyshipped,true),LOG_DEBUG);
357  //Compare array
358  $diff_array = array_diff_assoc($qtyordred, $qtyshipped);
359  if (count($diff_array) == 0) {
360  //No diff => mean everythings is shipped
361  $ret = $order->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE');
362  if ($ret < 0) {
363  $this->error = $order->error;
364  $this->errors = $order->errors;
365  return $ret;
366  }
367  }
368  }
369  }
370 
371  // If we validate or close a shipment
372  if (($action == 'RECEPTION_VALIDATE') || ($action == 'RECEPTION_CLOSED')) {
373  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
374 
375  if ((!empty($conf->fournisseur->enabled) || !empty($conf->supplier_order->enabled)) && !empty($conf->reception->enabled) && !empty($conf->workflow->enabled) &&
376  (
377  (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION) && ($action == 'RECEPTION_VALIDATE')) ||
378  (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED) && ($action == 'RECEPTION_CLOSED'))
379  )
380  ) {
381  $qtyshipped = array();
382  $qtyordred = array();
383  require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
384 
385  // Find all reception on purchase order origin
386  $order = new CommandeFournisseur($this->db);
387  $ret = $order->fetch($object->origin_id);
388  if ($ret < 0) {
389  $this->error = $order->error;
390  $this->errors = $order->errors;
391  return $ret;
392  }
393  $ret = $order->fetchObjectLinked($order->id, 'supplier_order', null, 'reception');
394  if ($ret < 0) {
395  $this->error = $order->error;
396  $this->errors = $order->errors;
397  return $ret;
398  }
399  //Build array of quantity received by product for a purchase order
400  if (is_array($order->linkedObjects) && count($order->linkedObjects) > 0) {
401  foreach ($order->linkedObjects as $type => $shipping_array) {
402  if ($type == 'reception' && is_array($shipping_array) && count($shipping_array) > 0) {
403  foreach ($shipping_array as $shipping) {
404  if (is_array($shipping->lines) && count($shipping->lines) > 0) {
405  foreach ($shipping->lines as $shippingline) {
406  $qtyshipped[$shippingline->fk_product] += $shippingline->qty;
407  }
408  }
409  }
410  }
411  }
412  }
413 
414  //Build array of quantity ordered to be received
415  if (is_array($order->lines) && count($order->lines) > 0) {
416  foreach ($order->lines as $orderline) {
417  // Exclude lines not qualified for shipment, similar code is found into calcAndSetStatusDispatch() for vendors
418  if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) {
419  continue;
420  }
421  $qtyordred[$orderline->fk_product] += $orderline->qty;
422  }
423  }
424  //dol_syslog(var_export($qtyordred,true),LOG_DEBUG);
425  //dol_syslog(var_export($qtyshipped,true),LOG_DEBUG);
426  //Compare array
427  $diff_array = array_diff_assoc($qtyordred, $qtyshipped);
428  if (count($diff_array) == 0) {
429  //No diff => mean everythings is received
430  $ret = $order->setStatut(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY, $object->origin_id, $object->origin, 'SUPPLIER_ORDER_CLOSE');
431  if ($ret < 0) {
432  $this->error = $order->error;
433  $this->errors = $order->errors;
434  return $ret;
435  }
436  }
437  }
438  }
439 
440  if ($action == 'TICKET_CREATE') {
441  dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
442  // Auto link contract
443  if (!empty($conf->contract->enabled) && !empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_LINK_CONTRACT) && !empty($conf->global->TICKET_PRODUCT_CATEGORY) && !empty($object->fk_soc)) {
444  $societe = new Societe($this->db);
445  $company_ids = (empty($conf->global->WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS)) ? [$object->fk_soc] : $societe->getParentsForCompany($object->fk_soc, [$object->fk_soc]);
446 
447  $contrat = new Contrat($this->db);
448  $number_contracts_found = 0;
449  foreach ($company_ids as $company_id) {
450  $contrat->socid = $company_id;
451  $list = $contrat->getListOfContracts($option = 'all', $status = [Contrat::STATUS_DRAFT, Contrat::STATUS_VALIDATED], $product_categories = [$conf->global->TICKET_PRODUCT_CATEGORY], $line_status = [ContratLigne::STATUS_INITIAL, ContratLigne::STATUS_OPEN]);
452  if (is_array($list) && !empty($list)) {
453  $number_contracts_found = count($list);
454  if ($number_contracts_found == 1) {
455  foreach ($list as $linked_contract) {
456  $object->setContract($linked_contract->id);
457  }
458  break;
459  } elseif ($number_contracts_found > 1) {
460  foreach ($list as $linked_contract) {
461  $object->setContract($linked_contract->id);
462  // don't set '$contractid' so it is not used when creating an intervention.
463  }
464  if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings');
465  break;
466  }
467  }
468  }
469  if ($number_contracts_found == 0) {
470  if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs');
471  }
472  }
473  // Automatically create intervention
474  if (!empty($conf->ficheinter->enabled) && !empty($conf->ticket->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION)) {
475  $fichinter = new Fichinter($this->db);
476  $fichinter->socid = (int) $object->fk_soc;
477  $fichinter->fk_project = $projectid;
478  $fichinter->fk_contrat = (int) $object->fk_contract;
479  $fichinter->author = $user->id;
480  $fichinter->model_pdf = (!empty($conf->global->FICHEINTER_ADDON_PDF)) ? $conf->global->FICHEINTER_ADDON_PDF : 'soleil';
481  $fichinter->origin = $object->element;
482  $fichinter->origin_id = $object->id;
483 
484  // Extrafields
485  $extrafields = new ExtraFields($this->db);
486  $extrafields->fetch_name_optionals_label($fichinter->table_element);
487  $array_options = $extrafields->getOptionalsFromPost($fichinter->table_element);
488  $fichinter->array_options = $array_options;
489 
490  $id = $fichinter->create($user);
491  if ($id <= 0) {
492  setEventMessages($fichinter->error, null, 'errors');
493  }
494  }
495  }
496  return 0;
497  }
498 
509  private function shouldClassify($conf, $totalonlinkedelements, $object_total_ht)
510  {
511  // if the configuration allows unmatching amounts, allow classification anyway
512  if (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) {
513  return true;
514  }
515  // if the amount are same, allow classification, else deny
516  return (price2num($totalonlinkedelements, 'MT') == price2num($object_total_ht, 'MT'));
517  }
518 }
CommandeFournisseur\STATUS_ACCEPTED
const STATUS_ACCEPTED
Accepted.
Definition: fournisseur.commande.class.php:278
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
Propal\STATUS_SIGNED
const STATUS_SIGNED
Signed quote.
Definition: propal.class.php:360
db
$conf db
API class for accounts.
Definition: inc.php:41
description
print *****$script_file(".$version.") pid cd cd cd description as description
Definition: email_expire_services_to_customers.php:83
InterfaceWorkflowManager\__construct
__construct($db)
Constructor.
Definition: interface_20_modWorkflow_WorkflowManager.class.php:41
InterfaceWorkflowManager
Class of triggers for workflow module.
Definition: interface_20_modWorkflow_WorkflowManager.class.php:34
Commande\STATUS_CLOSED
const STATUS_CLOSED
Closed (Sent, billed or not)
Definition: commande.class.php:395
DolibarrTriggers\runTrigger
runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
Function called when a Dolibarrr business event is done.
Translate
Class to manage translations.
Definition: translate.class.php:30
Commande\STATUS_SHIPMENTONPROCESS
const STATUS_SHIPMENTONPROCESS
Shipment on process.
Definition: commande.class.php:389
name
$conf db name
Definition: repair.php:122
Facture
Class to manage invoices.
Definition: facture.class.php:60
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
Conf
Class to stock current configuration.
Definition: conf.class.php:33
Commande\STATUS_VALIDATED
const STATUS_VALIDATED
Validated status.
Definition: commande.class.php:385
CommandeFournisseur\STATUS_ORDERSENT
const STATUS_ORDERSENT
Order sent, shipment on process.
Definition: fournisseur.commande.class.php:283
Propal\STATUS_BILLED
const STATUS_BILLED
Billed or processed quote.
Definition: propal.class.php:368
Commande
Class to manage customers orders.
Definition: commande.class.php:46
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
setEventMessage
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
Definition: functions.lib.php:8108
InterfaceWorkflowManager\shouldClassify
shouldClassify($conf, $totalonlinkedelements, $object_total_ht)
Definition: interface_20_modWorkflow_WorkflowManager.class.php:509
CommandeFournisseur\STATUS_RECEIVED_COMPLETELY
const STATUS_RECEIVED_COMPLETELY
Received completely.
Definition: fournisseur.commande.class.php:293
Fichinter
Class to manage interventions.
Definition: fichinter.class.php:37
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
Contrat
Class to manage contracts.
Definition: contrat.class.php:43
CommandeFournisseur
Class to manage predefined suppliers products.
Definition: fournisseur.commande.class.php:47
User
Class to manage Dolibarr users.
Definition: user.class.php:44
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
DolibarrTriggers
Class that all the triggers must extend.
Definition: dolibarrtriggers.class.php:21
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
CommandeFournisseur\STATUS_RECEIVED_PARTIALLY
const STATUS_RECEIVED_PARTIALLY
Received partially.
Definition: fournisseur.commande.class.php:288
SupplierProposal\STATUS_SIGNED
const STATUS_SIGNED
Signed quote.
Definition: supplier_proposal.class.php:210