diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 26506360e668a8f739c21df649a518adb060d001..db88671f7ff3bdc665e9286fc37b94254d6739a4 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -1,6 +1,7 @@ <?php /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * * 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 @@ -173,7 +174,7 @@ class Notify // Check notification per third party $sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,"; - $sql.= " a.rowid as adid, a.label, a.code, n.rowid"; + $sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; @@ -292,8 +293,8 @@ class Notify if ($mailfile->sendfile()) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, objet_type, objet_id, email)"; - $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", ".$obj->cid.", '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)"; + $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')"; if (! $this->db->query($sql)) { dol_print_error($this->db); @@ -421,8 +422,8 @@ class Notify if ($mailfile->sendfile()) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, objet_type, objet_id, email)"; - $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", null, '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)"; + $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", null, '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')"; if (! $this->db->query($sql)) { dol_print_error($this->db); diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 4c31bef80557e0e0d99631eaa95821cf5e41091b..5e1119ed4b4a0c9eb058521114a03c3c25dde5b6 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -28,6 +28,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2); ALTER TABLE llx_notify ADD COLUMN fk_soc integer NULL after fk_action; +ALTER TABLE llx_notify ADD COLUMN type varchar(16) DEFAULT 'email' after fk_soc; ALTER TABLE llx_bank_account ADD COLUMN fk_user_author integer; diff --git a/htdocs/install/mysql/tables/llx_notify.sql b/htdocs/install/mysql/tables/llx_notify.sql index 21a7b833dec3e320b1af3be1c90867531fd6b690..1dcfe6af8e616b86f85780ca021e8e3e8ece05e5 100644 --- a/htdocs/install/mysql/tables/llx_notify.sql +++ b/htdocs/install/mysql/tables/llx_notify.sql @@ -1,6 +1,7 @@ -- =================================================================== -- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net> +-- Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> -- -- 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 @@ -26,6 +27,7 @@ create table llx_notify fk_soc integer NULL, fk_contact integer NULL, fk_user integer NULL, + type varchar(16) DEFAULT 'email', objet_type varchar(24) NOT NULL, objet_id integer NOT NULL, email varchar(255) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 542a2066e93220b2cabe7add1bd73f09bc7b5b9b..1845669dcfc8406ab11cae0a00e3eb395c20b674 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * * 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 @@ -376,7 +376,7 @@ if ($result > 0) print '</tr>'; // List - $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type, n.objet_id as object_id, n.type,"; + $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type as object_type, n.objet_id as object_id, n.type,"; $sql.= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail,"; $sql.= " a.code, a.label"; $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";