mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Fix: Notifications events are a small part of triggered events.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
*
|
||||
* 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
|
||||
@@ -20,12 +20,13 @@
|
||||
/**
|
||||
* \file htdocs/admin/notification.php
|
||||
* \ingroup notification
|
||||
* \brief Page d'administration/configuration du module notification
|
||||
* \brief Page to setup notification module
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/triggers/interface_modNotification_Notification.class.php");
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
@@ -34,6 +35,10 @@ if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'setvalue' && $user->admin)
|
||||
{
|
||||
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM",$_POST["email_from"],'chaine',0,'',$conf->entity);
|
||||
@@ -85,6 +90,33 @@ print '<br>';
|
||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td>'.$langs->trans("Code").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Load array of available notifications
|
||||
$notificationtrigger=new InterfaceNotification($db);
|
||||
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
$var=!$var;
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code'])!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$notifiedevent['elementtype'].'</td>';
|
||||
print '<td>'.$notifiedevent['code'].'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@@ -31,7 +32,7 @@
|
||||
class InterfaceNotification
|
||||
{
|
||||
var $db;
|
||||
var $listofnotifiedevents=array('BILL_VALIDATE','ORDER_VALIDATE','PROPAL_VALIDATE',
|
||||
var $listofmanagedevents=array('BILL_VALIDATE','ORDER_VALIDATE','PROPAL_VALIDATE',
|
||||
'FICHEINTER_VALIDATE','ORDER_SUPPLIER_APPROVE','ORDER_SUPPLIER_REFUSE');
|
||||
|
||||
/**
|
||||
@@ -228,7 +229,7 @@ class InterfaceNotification
|
||||
|
||||
$qualified=0;
|
||||
// Check is this event is supported by notification module
|
||||
if (in_array($obj->code,$this->listofnotifiedevents)) $qualified=1;
|
||||
if (in_array($obj->code,$this->listofmanagedevents)) $qualified=1;
|
||||
// Check if module for this event is active
|
||||
if ($qualified)
|
||||
{
|
||||
|
||||
@@ -1131,6 +1131,7 @@ MailingEMailError=Return EMail (Errors-to) for emails with errors
|
||||
##### Notification #####
|
||||
NotificationSetup=Notification bu email module setup
|
||||
NotificationEMailFrom=Sender EMail (From) for emails sent for notifications
|
||||
ListOfAvailableNotifications=List of available notifications (This list depends on activated modules)
|
||||
##### Sendings #####
|
||||
SendingsSetup=Sending module setup
|
||||
SendingsReceiptModel=Sending receipt model
|
||||
|
||||
@@ -1142,6 +1142,7 @@ MailingEMailError= EMail retour (Errors-to) pour les réponses lors des envois p
|
||||
##### Notification #####
|
||||
NotificationSetup= Configuration du module Notification
|
||||
NotificationEMailFrom= Email émetteur (From) des mails envoyés lors des notifications
|
||||
ListOfAvailableNotifications=Liste des notifications disponibles (cette liste dépend des modules actifs)
|
||||
##### Sendings #####
|
||||
SendingsSetup= Configuration du module Expédition/Livraison
|
||||
SendingsReceiptModel= Modèle du bordereau d'expédition
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -28,6 +28,7 @@
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/triggers/interface_modNotification_Notification.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("mails");
|
||||
@@ -54,6 +55,7 @@ if (! $sortfield) $sortfield="c.name";
|
||||
* Action
|
||||
*/
|
||||
|
||||
// Add a notification
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
|
||||
@@ -78,9 +80,7 @@ if ($_POST["action"] == 'add')
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Action suppression notification
|
||||
*/
|
||||
// Remove a notification
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";";
|
||||
@@ -169,37 +169,23 @@ if ( $soc->fetch($soc->id) )
|
||||
$var=false;
|
||||
if (count($soc->thirdparty_and_contact_email_array()) > 0)
|
||||
{
|
||||
// Load array of notifications type available
|
||||
$sql = "SELECT a.rowid, a.code, a.label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a";
|
||||
$sql.= " ORDER BY a.rang ASC";
|
||||
$actions=array();
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label);
|
||||
$actions[$obj->rowid] = $label;
|
||||
// Load array of available notifications
|
||||
$notificationtrigger=new InterfaceNotification($db);
|
||||
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
dol_print_error($db);
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code'])!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
$actions[$notifiedevent['rowid']]=$label;
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $html->selectarray("contactid",$soc->thirdparty_and_contact_email_array());
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $html->selectarray("actionid",$actions);
|
||||
print $html->selectarray("actionid",$actions,'',1);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$type=array('email'=>$langs->trans("EMail"));
|
||||
|
||||
Reference in New Issue
Block a user