diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index df4901c4bf3..606037cc33b 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -56,7 +56,7 @@ if ($_GET["action"] == "set") if ($_GET["action"] == "addnotif") { $bon = new BonPrelevement($db); - $bon->AddNotification($_POST["user"],$_POST["action"]); + $bon->AddNotification($db,$_POST["user"],$_POST["action"]); Header("Location: prelevement.php"); exit; @@ -173,21 +173,33 @@ if ($conf->global->MAIN_MODULE_NOTIFICATION) { $langs->load("mails"); print_titre($langs->trans("Notifications")); - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - print ''; - print ''; + + + print ''; + print ''; + print '
'.$langs->trans("User").''.$langs->trans("Value").''.$langs->trans("Action").'
'; - print $html->select_users(0,'user',0); - print ''; - print '
'; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + print ''; + + print ''; + print ''; } // List of current notifications for objet_type='withdraw' @@ -212,7 +244,7 @@ $sql.= ", nd.rowid, ad.code, ad.titre"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= ", ".MAIN_DB_PREFIX."notify_def as nd"; $sql.= ", ".MAIN_DB_PREFIX."action_def as ad"; -$sql.= " WHERE u.rowid = nd.fk_soc AND nd.fk_action = ad.rowid"; +$sql.= " WHERE u.rowid = nd.fk_user AND nd.fk_action = ad.rowid"; $sql.= " AND ad.objet_type = 'withdraw'"; $sql.= " AND u.entity IN (0,".$conf->entity.")"; $resql = $db->query($sql); @@ -228,7 +260,8 @@ if ($resql) print ""; print ''; - print ''; + $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->titre); + print ''; print ''; print ''; $i++; diff --git a/htdocs/compta/prelevement/class/bon-prelevement.class.php b/htdocs/compta/prelevement/class/bon-prelevement.class.php index cc4ec01f4ee..02adf6ee79c 100644 --- a/htdocs/compta/prelevement/class/bon-prelevement.class.php +++ b/htdocs/compta/prelevement/class/bon-prelevement.class.php @@ -1145,7 +1145,7 @@ class BonPrelevement extends CommonObject $result = 0; $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; - $sql .= " WHERE fk_soc=".$user." AND AND fk_action=".$action; + $sql .= " WHERE fk_user=".$user." AND fk_action=".$action; if ($this->db->query($sql)) { @@ -1163,15 +1163,16 @@ class BonPrelevement extends CommonObject * @param action notification action * @return int 0 if OK, <0 if KO */ - function AddNotification($user, $action) + function AddNotification($db, $user, $action) { $result = 0; if ($this->DeleteNotification($user, $action) == 0) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; - $sql .= " VALUES (".$db->idate(mktime()).",".$user.", '',".$action.")"; - + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)"; + $sql .= " VALUES (".$db->idate(mktime()).",".$user.", 'NULL', 'NULL', ".$action.")"; + + dol_syslog("adnotiff: ".$sql); if ($this->db->query($sql)) { $result = 0; diff --git a/htdocs/install/mysql/data/llx_action_def.sql b/htdocs/install/mysql/data/llx_action_def.sql index dcb4d6241f8..403c69f9ac2 100644 --- a/htdocs/install/mysql/data/llx_action_def.sql +++ b/htdocs/install/mysql/data/llx_action_def.sql @@ -5,7 +5,7 @@ -- Copyright (C) 2004 Guillaume Delecourt -- Copyright (C) 2005-2009 Regis Houssin -- Copyright (C) 2007 Patrick Raguin --- Copyright (C) 2010 Juanjo Menentn +-- Copyright (C) 2010 Juanjo Menent -- -- 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 @@ -41,3 +41,4 @@ insert into llx_action_def (rowid,code,titre,description,objet_type) values (5,' insert into llx_action_def (rowid,code,titre,description,objet_type) values (6,'NOTIFY_VAL_PROPAL','Validation proposition client','Executed when a commercial proposal is validated','propal'); insert into llx_action_def (rowid,code,titre,description,objet_type) values (7,'NOTIFY_TRN_WITHDRAW','Transmission prélèvement','Executed when a withdrawal is transmited','withdraw'); insert into llx_action_def (rowid,code,titre,description,objet_type) values (8,'NOTIFY_CRD_WITHDRAW','Créditer prélèvement','Executed when a withdrawal is credited','withdraw'); +insert into llx_action_def (rowid,code,titre,description,objet_type) values (9,'NOTIFY_EMT_WITHDRAW','Emission prélèvement','Executed when a withdrawal is emited','withdraw'); diff --git a/htdocs/langs/ca_ES/other.lang b/htdocs/langs/ca_ES/other.lang index 4721d5d2fb8..47329259166 100644 --- a/htdocs/langs/ca_ES/other.lang +++ b/htdocs/langs/ca_ES/other.lang @@ -31,6 +31,9 @@ Notify_NOTIFY_APP_ORDER_SUPPLIER=Aprovació comanda a proveïdor Notify_NOTIFY_REF_ORDER_SUPPLIER=Rebuig comanda a proveïdor Notify_NOTIFY_VAL_ORDER=Validació comanda client Notify_NOTIFY_VAL_PROPAL=Validació pressupost client +Notify_NOTIFY_TRN_WITHDRAW=Transmissió domiciliació +Notify_NOTIFY_CRD_WITHDRAW=Abonament domiciliació +Notify_NOTIFY_EMT_WITHDRAW=Emissió domiciliació NbOfAttachedFiles=Número arxius/documents adjunts TotalSizeOfAttachedFiles=Mida total dels arxius/documents adjunts MaxSize=Tamany màxim diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 51d6dc469f5..9c507f334e8 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -31,6 +31,9 @@ Notify_NOTIFY_APP_ORDER_SUPPLIER=Supplier order approved Notify_NOTIFY_REF_ORDER_SUPPLIER=Supplier order refused Notify_NOTIFY_VAL_ORDER=Customer order validated Notify_NOTIFY_VAL_PROPAL=Customer proposal validated +Notify_NOTIFY_TRN_WITHDRAW=Transmission withdrawal +Notify_NOTIFY_CRD_WITHDRAW=Credit withdrawal +Notify_NOTIFY_EMT_WITHDRAW=Isue withdrawal NbOfAttachedFiles=Number of attached files/documents TotalSizeOfAttachedFiles=Total size of attached files/documents MaxSize=Maximum size diff --git a/htdocs/langs/es_AR/other.lang b/htdocs/langs/es_AR/other.lang index baf643fbee0..d26ac0af5b5 100755 --- a/htdocs/langs/es_AR/other.lang +++ b/htdocs/langs/es_AR/other.lang @@ -31,6 +31,9 @@ Notify_NOTIFY_APP_ORDER_SUPPLIER=Aprobación pedido a proveedor Notify_NOTIFY_REF_ORDER_SUPPLIER=Rechazo pedido a proveedor Notify_NOTIFY_VAL_ORDER=Validación pedido cliente Notify_NOTIFY_VAL_PROPAL=Validación presupuesto cliente +Notify_NOTIFY_TRN_WITHDRAW=Transmisión domiciliación +Notify_NOTIFY_CRD_WITHDRAW=Abono domiciliación +Notify_NOTIFY_EMT_WITHDRAW=Emisión domiciliación NbOfAttachedFiles=Número archivos/documentos adjuntos TotalSizeOfAttachedFiles=Tamaño total de los archivos/documentos adjuntos MaxSize=Tamaño máximo diff --git a/htdocs/langs/es_ES/other.lang b/htdocs/langs/es_ES/other.lang index 50050232afd..90848c97467 100644 --- a/htdocs/langs/es_ES/other.lang +++ b/htdocs/langs/es_ES/other.lang @@ -31,6 +31,9 @@ Notify_NOTIFY_APP_ORDER_SUPPLIER=Aprobación pedido a proveedor Notify_NOTIFY_REF_ORDER_SUPPLIER=Rechazo pedido a proveedor Notify_NOTIFY_VAL_ORDER=Validación pedido cliente Notify_NOTIFY_VAL_PROPAL=Validación presupuesto cliente +Notify_NOTIFY_TRN_WITHDRAW=Transmisión domiciliación +Notify_NOTIFY_CRD_WITHDRAW=Abono domiciliación +Notify_NOTIFY_EMT_WITHDRAW=Emisión domiciliación NbOfAttachedFiles=Número archivos/documentos adjuntos TotalSizeOfAttachedFiles=Tamaño total de los archivos/documentos adjuntos MaxSize=Tamaño máximo diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index c8d739ff471..b2cfe350d36 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -31,6 +31,9 @@ Notify_NOTIFY_APP_ORDER_SUPPLIER=Approbation commande fournisseur Notify_NOTIFY_REF_ORDER_SUPPLIER=Refus commande fournisseur Notify_NOTIFY_VAL_ORDER=Validation commande client Notify_NOTIFY_VAL_PROPAL=Validation proposition commerciale client +Notify_NOTIFY_TRN_WITHDRAW=Transmission prélèvement +Notify_NOTIFY_CRD_WITHDRAW=Créditer prélèvement +Notify_NOTIFY_EMT_WITHDRAW=Emission prélèvement NbOfAttachedFiles=Nombre de fichiers/documents liés TotalSizeOfAttachedFiles=Taille total fichiers/documents liés MaxSize=Taille maximum
'.$langs->trans("User").''.$langs->trans("Value").''.$langs->trans("Action").'
'; + print $html->selectarray('user',$internalusers);// select_users(0,'user',0); + print ''; + print $html->selectarray('action',$actions);// select_users(0,'user',0); + print '
'.$obj->firstname." ".$obj->name.''.$obj->titre.''.$label.'rowid.'">'.img_delete().'