From bf51e34382676d3b4180a8e5131466c75dafa7ed Mon Sep 17 00:00:00 2001 From: tiaris Date: Wed, 4 May 2011 13:36:38 +0000 Subject: [PATCH] Add trigger on order validate and cancel --- htdocs/commande/class/commande.class.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ad72928875f..c9c153293e8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4,9 +4,10 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2011 Jean Heimburger * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU *General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * @@ -458,6 +459,15 @@ class Commande extends CommonObject if ($this->db->query($sql)) { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('ORDER_CLOTURE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + return -1; + } + // Fin appel triggers return 1; } else @@ -506,7 +516,17 @@ class Commande extends CommonObject if ($result < 0) { $error++; } } } - + + if (! $error) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('ORDER_CANCEL',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + } + if (! $error) { $this->statut=-1;