Recriture gestion des notifications pour tre gres par un module indpendant et via le mcanisme des triggers.
Ceci afin de simplifier le code et de permettre le notifications sur n'importe quel vennement Dolibarr.
This commit is contained in:
parent
11d7faa44e
commit
d1358b1d2c
@ -65,19 +65,6 @@ if ($_GET["action"] == 'setcodecompta')
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'setdisablenotifications')
|
||||
{
|
||||
if (dolibarr_set_const($db, "SOCIETE_DISABLE_NOTIFICATIONS",! $_POST["constvalue"]))
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page configuration module societe
|
||||
@ -213,8 +200,8 @@ print "</table>\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Choix du module de gestion des codes compta
|
||||
|
||||
// Autres options
|
||||
/*
|
||||
print_titre($langs->trans("OtherOptions"));
|
||||
|
||||
$var=true;
|
||||
@ -228,16 +215,16 @@ print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<form action="'.$_SERVER["societe.php"].'" method="POST">';
|
||||
print '<input type="hidden" name="action" value="setdisablenotifications">';
|
||||
print '<input type="hidden" name="constname" value="SOCIETE_DISABLE_NOTIFICATIONS">';
|
||||
print '<input type="hidden" name="action" value="setxxx">';
|
||||
print '<input type="hidden" name="constname" value="XXX">';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].' class="value">';
|
||||
print '<td nowrap="nowrap">'.$langs->trans("UseNotifications")."</td>\n";
|
||||
print '<td nowrap="nowrap">'.$langs->trans("UseXXX")."</td>\n";
|
||||
print '<td>';
|
||||
$form->selectyesnonum('constvalue',! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS);
|
||||
$form->selectyesnonum('constvalue',! $conf->global->XXX);
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("NotificationsDesc").'</td>';
|
||||
print '<td>'.$langs->trans("XXXDesc").'</td>';
|
||||
print '<td align="right">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans('Modify').'" name="button"> ';
|
||||
print '</td>';
|
||||
@ -246,7 +233,7 @@ print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
*/
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -69,82 +69,27 @@ if ($user->societe_id > 0)
|
||||
*********************************************************************************/
|
||||
if ($_socid > 0)
|
||||
{
|
||||
// On recupere les donnees societes par l'objet
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->id=$_socid;
|
||||
$objsoc->fetch($_socid,$to);
|
||||
|
||||
$dac = strftime("%Y-%m-%d %H:%M", time());
|
||||
if ($errmesg)
|
||||
{
|
||||
print '<div class="error">'.$errmesg.'</div><br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Company");
|
||||
$h++;
|
||||
|
||||
if ($objsoc->client==1)
|
||||
{
|
||||
$hselected=$h;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Customer");
|
||||
$h++;
|
||||
}
|
||||
if ($objsoc->client==2)
|
||||
{
|
||||
$hselected=$h;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid;
|
||||
$head[$h][1] = $langs->trans("Prospect");
|
||||
$h++;
|
||||
}
|
||||
if ($objsoc->fournisseur)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Supplier");
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($conf->compta->enabled || $conf->comptaexpert->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Accountancy");
|
||||
$h++;
|
||||
}
|
||||
// On recupere les donnees societes par l'objet
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->id=$_socid;
|
||||
$objsoc->fetch($_socid,$to);
|
||||
|
||||
$dac = strftime("%Y-%m-%d %H:%M", time());
|
||||
if ($errmesg)
|
||||
{
|
||||
print '<div class="error">'.$errmesg.'</div><br>';
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
$h++;
|
||||
}
|
||||
$head = societe_prepare_head($objsoc);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Notifications");
|
||||
$h++;
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/index.php?socidp=$objsoc->id&action=add_bookmark";
|
||||
$head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark');
|
||||
$head[$h][2] = 'image';
|
||||
}
|
||||
dolibarr_fiche_head($head, 'notify', $objsoc->nom);
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $objsoc->nom);
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print '<form method="POST" action="multiprix.php?id='.$objsoc->id.'">';
|
||||
print '<input type="hidden" name="action" value="setpricelevel">';
|
||||
print '<table width="100%" border="0">';
|
||||
|
||||
@ -1422,7 +1422,8 @@ else
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
{
|
||||
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$langs->trans('ConfirmDeleteBill'),'confirm_delete');
|
||||
$text=$langs->trans('ConfirmDeleteBill');
|
||||
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$text,'confirm_delete');
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
@ -1433,7 +1434,7 @@ else
|
||||
{
|
||||
// on vérifie si la facture est en numérotation provisoire
|
||||
$facref = substr($fac->ref, 1, 4);
|
||||
if ($facref == PROV)
|
||||
if ($facref == 'PROV')
|
||||
{
|
||||
$numfa = $fac->getNextNumRef($soc);
|
||||
}
|
||||
@ -1441,7 +1442,17 @@ else
|
||||
{
|
||||
$numfa = $fac->ref;
|
||||
}
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$langs->trans('ConfirmValidateBill',$numfa),'confirm_valid');
|
||||
|
||||
$text=$langs->trans('ConfirmValidateBill',$numfa);
|
||||
if ($conf->notification->enabled)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
|
||||
$notify=new Notify($db);
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage(2,$fac->socidp);
|
||||
}
|
||||
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$text,'confirm_valid');
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +105,6 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
|
||||
$paramlist=($_GET["orphelins"]?"&orphelins=1":"");
|
||||
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num);
|
||||
@ -135,7 +134,7 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
|
||||
$var=true;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
@ -134,12 +134,19 @@ class Conf
|
||||
// Module bookmark4u
|
||||
$this->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0;
|
||||
$this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0;
|
||||
|
||||
// Module deplacement
|
||||
$this->deplacement->enabled=defined("MAIN_MODULE_DEPLACEMENT")?MAIN_MODULE_DEPLACEMENT:0;
|
||||
|
||||
// Module mailing
|
||||
$this->mailing->enabled=defined("MAIN_MODULE_MAILING")?MAIN_MODULE_MAILING:0;
|
||||
|
||||
// Module notification
|
||||
$this->notification->enabled=defined("MAIN_MODULE_NOTIFICATION")?MAIN_MODULE_NOTIFICATION:0;
|
||||
|
||||
// Module externalrss
|
||||
$this->externalrss->enabled=defined("MAIN_MODULE_EXTERNALRSS")?MAIN_MODULE_EXTERNALRSS:0;
|
||||
|
||||
// Module commande client
|
||||
$this->commande->enabled=defined("MAIN_MODULE_COMMANDE")?MAIN_MODULE_COMMANDE:0;
|
||||
$this->commande->dir_output=DOL_DATA_ROOT."/commande";
|
||||
@ -340,12 +347,13 @@ class Conf
|
||||
$this->css = "theme/".$this->theme."/".$this->theme.".css";
|
||||
|
||||
// $this->email_from = email pour envoi par Dolibarr des mails auto (notifications, ...)
|
||||
// $this->mailing->email_from = email pour envoi par Dolibarr des mailings
|
||||
$this->email_from="dolibarr-robot@domain.com";
|
||||
if (defined('MAIN_EMAIL_FROM'))
|
||||
$this->notification->email_from="dolibarr-robot@domain.com";
|
||||
if (defined('NOTIFICATION_EMAIL_FROM'))
|
||||
{
|
||||
$this->email_from=MAIN_EMAIL_FROM;
|
||||
$this->notification->email_from=NOTIFICATION_EMAIL_FROM;
|
||||
}
|
||||
|
||||
// $this->mailing->email_from = email pour envoi par Dolibarr des mailings
|
||||
if (defined('MAILING_EMAIL_FROM'))
|
||||
{
|
||||
$this->mailing->email_from=MAILING_EMAIL_FROM;
|
||||
|
||||
@ -748,6 +748,31 @@ class Contact
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
* \param withpicto Inclut le picto dans le lien
|
||||
* \param option Sur quoi pointe le lien
|
||||
* \return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
if ($option == 'xxx')
|
||||
{
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
}
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowContact"),'contact').$lienfin.' ');
|
||||
$result.=$lien.$this->name.' '.$this->firstname.$lienfin;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT .'/notify.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT ."/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/client.class.php");
|
||||
|
||||
@ -837,12 +836,11 @@ class Facture extends CommonObject
|
||||
// on vérifie si la facture est en numérotation provisoire
|
||||
$facref = substr($this->ref, 1, 4);
|
||||
|
||||
$action_notify = 2; // ne pas modifier cette valeur
|
||||
if ($force_number)
|
||||
{
|
||||
$numfa = $force_number;
|
||||
}
|
||||
else if ($facref == PROV)
|
||||
else if ($facref == 'PROV')
|
||||
{
|
||||
$numfa = $this->getNextNumRef($soc);
|
||||
}
|
||||
@ -880,7 +878,7 @@ class Facture extends CommonObject
|
||||
|
||||
|
||||
// On vérifie si la facture était une provisoire
|
||||
if ($facref == PROV)
|
||||
if ($facref == 'PROV')
|
||||
{
|
||||
// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
|
||||
// afin de ne pas perdre les fichiers attachés
|
||||
@ -947,35 +945,35 @@ class Facture extends CommonObject
|
||||
}
|
||||
*/
|
||||
|
||||
// On vérifie si la facture était une provisoire
|
||||
if ($facref == PROV)
|
||||
// On vérifie si la facture était une provisoire
|
||||
if ($facref == 'PROV')
|
||||
{
|
||||
/*
|
||||
* Pour chaque produit, on met a jour indicateur nbvente
|
||||
* On crée ici une dénormalisation des données pas forcément utilisée.
|
||||
*/
|
||||
$sql = 'SELECT fk_product FROM '.MAIN_DB_PREFIX.'facturedet';
|
||||
$sql.= ' WHERE fk_facture = '.$this->id;
|
||||
$sql.= ' AND fk_product > 0';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'product SET nbvente=nbvente+1 WHERE rowid = '.$obj->fk_product;
|
||||
$resql2 = $this->db->query($sql);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Pour chaque produit, on met a jour indicateur nbvente
|
||||
* On crée ici une dénormalisation des données pas forcément utilisée.
|
||||
*/
|
||||
$sql = 'SELECT fk_product FROM '.MAIN_DB_PREFIX.'facturedet';
|
||||
$sql.= ' WHERE fk_facture = '.$this->id;
|
||||
$sql.= ' AND fk_product > 0';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'product SET nbvente=nbvente+1 WHERE rowid = '.$obj->fk_product;
|
||||
$resql2 = $this->db->query($sql);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error == 0)
|
||||
{
|
||||
@ -989,17 +987,6 @@ class Facture extends CommonObject
|
||||
$result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf);
|
||||
// Fin appel triggers
|
||||
|
||||
/*
|
||||
* Notify
|
||||
* \todo Mettre notifications dans triggers
|
||||
*/
|
||||
$facref = sanitize_string($this->ref);
|
||||
$filepdf = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf';
|
||||
$mesg = 'La facture '.$this->ref." a été validée.\n";
|
||||
|
||||
$notify = New Notify($this->db);
|
||||
$notify->send($action_notify, $this->socidp, $mesg, 'facture', $rowid, $filepdf);
|
||||
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
|
||||
|
||||
|
||||
/** \class Ficheinter
|
||||
@ -227,57 +226,32 @@ class Fichinter extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
/**
|
||||
* \brief Valide une fiche intervention
|
||||
* \param user User qui valide
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function valid($userid, $outputdir)
|
||||
function valid($user, $outputdir)
|
||||
{
|
||||
$action_notify = 1; // ne pas modifier cette valeur
|
||||
|
||||
$this->fetch($this->id);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid";
|
||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
|
||||
$sql.= " SET fk_statut = 1, date_valid=now(), fk_user_valid=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
/*
|
||||
* Set generates files readonly
|
||||
*/
|
||||
umask(0);
|
||||
$file = $outputdir . "/$this->ref/$this->ref.tex";
|
||||
if (is_writeable($file))
|
||||
{
|
||||
chmod($file, 0444);
|
||||
}
|
||||
$file = $outputdir . "/$this->ref/$this->ref.ps";
|
||||
if (is_writeable($file))
|
||||
{
|
||||
chmod($file, 0444);
|
||||
}
|
||||
$filepdf = $conf->fichinter->dir_output . "/$this->ref/$this->ref.pdf";
|
||||
if (is_writeable($filepdf))
|
||||
{
|
||||
chmod($filepdf, 0444);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify
|
||||
*/
|
||||
$mesg = "La fiche d'intervention ".$this->ref." a été validée.\n";
|
||||
|
||||
$notify = New Notify($this->db);
|
||||
$notify->send($action_notify, $this->societe_id, $mesg, "ficheinter", $this->id, $filepdf);
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('FICHEINTER_VALIDATE',$this,$user,$langs,$conf);
|
||||
// Fin appel triggers
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 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
|
||||
@ -54,7 +54,9 @@ class modBookmark4u extends DolibarrModules
|
||||
$this->family = "technic";
|
||||
$this->name = "Bookmark4u";
|
||||
$this->description = "Ajoute fonction pour générer un compte Bookmark4u depuis un compte Dolibarr";
|
||||
$this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
|
||||
|
||||
$this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version
|
||||
|
||||
$this->const_name = 'MAIN_MODULE_BOOKMARK4U';
|
||||
$this->special = 1;
|
||||
$this->picto='user';
|
||||
|
||||
@ -55,8 +55,7 @@ class modClickToDial extends DolibarrModules
|
||||
$this->name = "ClickToDial";
|
||||
$this->description = "Gestion du Click To Dial";
|
||||
|
||||
$this->revision = explode(' ','$Revision$');
|
||||
$this->version = $this->revision[1];
|
||||
$this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version
|
||||
|
||||
$this->const_name = 'MAIN_MODULE_CLICKTODIAL';
|
||||
$this->special = 1;
|
||||
|
||||
@ -55,7 +55,7 @@ class modOSCOmmerce2 extends DolibarrModules
|
||||
$this->family = "products";
|
||||
$this->name = "OSCommerce 2";
|
||||
$this->description = "Interface de visualisation d'une boutique OSCommerce via des Web services.\nCe module requiert d'installer les composants dans /oscommerce_ws/ws_server sur OSCommerce. Voir fichier README dans /oscommerce_ws/ws_server";
|
||||
$this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
|
||||
$this->version = 'experimental'; // 'development' or 'experimental' or 'dolibarr' or version
|
||||
$this->const_name = 'MAIN_MODULE_OSCOMMERCEWS';
|
||||
$this->special = 1;
|
||||
|
||||
|
||||
@ -118,6 +118,7 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||
}
|
||||
|
||||
// Companies
|
||||
elseif ($action == 'COMPANY_CREATE')
|
||||
{
|
||||
@ -131,6 +132,7 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||
}
|
||||
|
||||
// Products
|
||||
elseif ($action == 'PRODUCT_CREATE')
|
||||
{
|
||||
@ -144,6 +146,7 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// Customer orders
|
||||
elseif ($action == 'ORDER_CREATE')
|
||||
{
|
||||
@ -157,6 +160,7 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// Supplier orders
|
||||
elseif ($action == 'ORDER_SUPPLIER_CREATE')
|
||||
{
|
||||
@ -166,6 +170,7 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// Proposals
|
||||
elseif ($action == 'PROPAL_CREATE')
|
||||
{
|
||||
@ -187,6 +192,7 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// Contracts
|
||||
elseif ($action == 'CONTRACT_CREATE')
|
||||
{
|
||||
@ -212,6 +218,7 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// Bills
|
||||
elseif ($action == 'BILL_CREATE')
|
||||
{
|
||||
@ -233,6 +240,7 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// Payments
|
||||
elseif ($action == 'PAYMENT_CUSTOMER_CREATE')
|
||||
{
|
||||
@ -242,6 +250,13 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// Interventions
|
||||
elseif ($action == 'FICHEINTER_VALIDATE')
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// Members
|
||||
elseif ($action == 'MEMBER_CREATE')
|
||||
{
|
||||
@ -267,6 +282,8 @@ class InterfaceDemo
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
|
||||
}
|
||||
|
||||
// If not found
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action.");
|
||||
|
||||
132
htdocs/includes/triggers/interface_notification.class.php
Normal file
132
htdocs/includes/triggers/interface_notification.class.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/triggers/interface_notification.class.php
|
||||
\ingroup notification
|
||||
\brief Fichier de gestion des notifications sur evenement Dolibarr
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\class InterfaceNotification
|
||||
\brief Classe des fonctions triggers des actions personalisées du workflow
|
||||
*/
|
||||
|
||||
class InterfaceNotification
|
||||
{
|
||||
var $db;
|
||||
|
||||
/**
|
||||
* \brief Constructeur.
|
||||
* \param DB Handler d'accès base
|
||||
*/
|
||||
function InterfaceNotification($DB)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
|
||||
$this->name = "Notification";
|
||||
$this->family = "notification";
|
||||
$this->description = "Les triggers de ce composant sont les fonctions qui gèrent les notifications du module Notification";
|
||||
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi nom du lot de triggers
|
||||
* \return string Nom du lot de triggers
|
||||
*/
|
||||
function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi descriptif du lot de triggers
|
||||
* \return string Descriptif du lot de triggers
|
||||
*/
|
||||
function getDesc()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi version du lot de triggers
|
||||
* \return string Version du lot de triggers
|
||||
*/
|
||||
function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($this->version == 'experimental') return $langs->trans("Experimental");
|
||||
elseif ($this->version == 'dolibarr') return DOL_VERSION;
|
||||
elseif ($this->version) return $this->version;
|
||||
else return $langs->trans("Unknown");
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr.
|
||||
* D'autres fonctions run_trigger peuvent etre présentes dans includes/triggers
|
||||
* \param action Code de l'evenement
|
||||
* \param object Objet concerné
|
||||
* \param user Objet user
|
||||
* \param lang Objet lang
|
||||
* \param conf Objet conf
|
||||
* \return int <0 si ko, 0 si aucune action faite, >0 si ok
|
||||
*/
|
||||
function run_trigger($action,$object,$user,$langs,$conf)
|
||||
{
|
||||
// Si module notification non actif, on ne fait rien
|
||||
if (! $conf->notification->enabled) return 0;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT .'/notify.class.php');
|
||||
|
||||
if ($action == 'BILL_VALIDATE')
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||
|
||||
$action_notify = 2;
|
||||
$ref = sanitize_string($object->ref);
|
||||
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||
$mesg = 'La facture '.$object->ref." a été validée.\n";
|
||||
|
||||
$notify = new Notify($this->db);
|
||||
$notify->send($action_notify, $object->socidp, $mesg, 'facture', $object->id, $filepdf);
|
||||
}
|
||||
|
||||
if ($action == 'FICHEINTER_VALIDATE')
|
||||
{
|
||||
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
|
||||
|
||||
$action_notify = 1;
|
||||
$ref = sanitize_string($object->ref);
|
||||
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||
$mesg = 'La fiche intervention '.$object->ref." a été validée.\n";
|
||||
|
||||
$notify = new Notify($this->db);
|
||||
$notify->send($action_notify, $object->socidp, $mesg, 'ficheinter', $object->id, $filepdf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -137,6 +137,8 @@ Module410Name=Webcalendar
|
||||
Module410Desc=Webcalendar integration
|
||||
Module500Name=Taxes and social contributions
|
||||
Module500Desc=Taxes and social contributions' management
|
||||
Module600Name=Notification
|
||||
Module600Desc=Send notifications (by email) on Dolibarr business events
|
||||
Module700Name=Donations
|
||||
Module700Desc=Donations' management
|
||||
Module800Name=OSCommerce 1
|
||||
@ -525,6 +527,9 @@ NewRSS=New RSS
|
||||
##### Mailing #####
|
||||
MailingSetup=Mailing module setup
|
||||
MailingEMailFrom=Sender EMail (From) for emails sent by emailing module
|
||||
##### Notification #####
|
||||
NotificationSetup=Mailing module setup
|
||||
NotificationEMailFrom=Sender EMail (From) for emails sent for notifications
|
||||
##### Sendings #####
|
||||
SendingsSetup=Sending module setup
|
||||
SendingsReceiptModel=Sending receipt model
|
||||
|
||||
@ -73,4 +73,10 @@ ToClearAllRecipientsClickHere=To clear recipients' list for this emailing, click
|
||||
ToAddRecipientsChooseHere=To add recipients, choose in those lists
|
||||
NbOfEMailingsReceived=Mass emailings received
|
||||
IdRecord=ID record
|
||||
DeliveryReceipt=Delivery Receipt
|
||||
DeliveryReceipt=Delivery Receipt
|
||||
|
||||
# Module Notifications
|
||||
Notifications=Notifications
|
||||
NoNotificationsWillBeSent=No email notifications are planned for this event and company
|
||||
ANotificationsWillBeSent=1 notification will be sent by email
|
||||
SomeNotificationsWillBeSent=%s notifications will be sent by email
|
||||
@ -137,6 +137,8 @@ Module410Name=Webcalendar
|
||||
Module410Desc=Interface avec le calendrier Webcalendar
|
||||
Module500Name=Taxes et charges sociales
|
||||
Module500Desc=Gestion des taxes et charges sociales
|
||||
Module600Name=Notification
|
||||
Module600Desc=Envoi de notifications (par mail) sur les évênements métiers Dolibarr
|
||||
Module700Name=Dons
|
||||
Module700Desc=Gestion des dons
|
||||
Module800Name=OSCommerce 1
|
||||
@ -525,6 +527,9 @@ NewRSS=Syndication d'un nouveau flux RSS
|
||||
##### Mailing #####
|
||||
MailingSetup=Configuration du module EMailing
|
||||
MailingEMailFrom=Email emetteur (From) des mails envoyés par EMailing
|
||||
##### Notification #####
|
||||
NotificationSetup=Configuration du module Notification
|
||||
NotificationEMailFrom=Email emetteur (From) des mails envoyés lors des notifications
|
||||
##### Sendings #####
|
||||
SendingsSetup=Configuration du module Expéditions/Livraisons
|
||||
SendingsReceiptModel=Modèle du bordereau d'expédition
|
||||
|
||||
@ -73,4 +73,10 @@ ToClearAllRecipientsClickHere=Pour effacer la liste des destinataires de ce mail
|
||||
ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous
|
||||
NbOfEMailingsReceived=Mailings de masse reçus
|
||||
IdRecord=ID enregistrement
|
||||
DeliveryReceipt=Accusé de réception
|
||||
DeliveryReceipt=Accusé de réception
|
||||
|
||||
# Module Notifications
|
||||
Notifications=Notifications
|
||||
NoNotificationsWillBeSent=Aucune notification par email n'est prévue pour cet évenement et société
|
||||
ANotificationsWillBeSent=1 notification va être envoyée par mail
|
||||
SomeNotificationsWillBeSent=%s notifications vont être envoyées par mail
|
||||
@ -87,7 +87,7 @@ function societe_prepare_head($objsoc)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS && $user->societe_id == 0)
|
||||
if ($conf->notification->enabled && $user->societe_id == 0)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Notifications");
|
||||
@ -95,13 +95,13 @@ function societe_prepare_head($objsoc)
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
}
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($conf->bookmark->enabled && $user->rights->bookmark->creer)
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -25,6 +25,7 @@
|
||||
\brief Fichier de la classe de gestion des notifications
|
||||
\version $Revision$
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT ."/lib/CMailFile.class.php");
|
||||
|
||||
|
||||
/**
|
||||
@ -45,7 +46,10 @@ class Notify
|
||||
var $note;
|
||||
var $projet_id;
|
||||
|
||||
|
||||
// Les codes actions sont définis dans la table llx_notify_def
|
||||
// \todo utiliser des codes texte plutot que numérique
|
||||
// 1 = Validation fiche inter
|
||||
// 2 = Validation facture
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
@ -54,13 +58,59 @@ class Notify
|
||||
function Notify($DB)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Envoi mail et sauve trace
|
||||
*
|
||||
* \brief Renvoie le message signalant les notifications qui auront lieu sur
|
||||
* un evenement pour affichage dans texte de confirmation evenement.
|
||||
* \return string Message
|
||||
*/
|
||||
function confirmMessage($action,$socid)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("mails");
|
||||
|
||||
$nb=$this->countDefinedNotifications($action,$socid);
|
||||
if ($nb <= 0) $texte=$langs->trans("NoNotificationsWillBeSent");
|
||||
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
|
||||
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
|
||||
return $texte;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoie le nombre de notifications configurés pour l'action et la société donnée
|
||||
* \return int <0 si ko, sinon nombre de notifications définies
|
||||
*/
|
||||
function countDefinedNotifications($action,$socid)
|
||||
{
|
||||
$num=-1;
|
||||
|
||||
$sql = "SELECT s.nom, c.email, c.idp, c.name, c.firstname, a.titre,n.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action";
|
||||
$sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action;
|
||||
$sql .= " AND s.idp = ".$socid;
|
||||
|
||||
dolibarr_syslog("Notify.class::countDefinedNotifications $action, $socid");
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error.' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Vérifie si notification actice. Si oui, envoi mail et sauve trace
|
||||
* \return int <0 si ko, sinon nombre de notifications faites
|
||||
*/
|
||||
function send($action, $socid, $texte, $objet_type, $objet_id, $file="")
|
||||
{
|
||||
@ -72,6 +122,8 @@ class Notify
|
||||
$sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action;
|
||||
$sql .= " AND s.idp = ".$socid;
|
||||
|
||||
dolibarr_syslog("Notify.class::send $action, $socid, $texte, $objet_type, $objet_id, $file");
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -85,19 +137,20 @@ class Notify
|
||||
|
||||
if (strlen($sendto))
|
||||
{
|
||||
$subject = $langs->trans("DolibarrNotififcation");
|
||||
$subject = $langs->trans("DolibarrNotification");
|
||||
$message = $texte;
|
||||
$filename = split("/",$file);
|
||||
$replyto = $conf->email_from;
|
||||
|
||||
$replyto = $conf->notification->email_from;
|
||||
|
||||
$mailfile = new CMailFile($subject,
|
||||
$sendto,
|
||||
$replyto,
|
||||
$message,
|
||||
array($file),
|
||||
array("application/pdf"),
|
||||
array($filename[sizeof($filename)-1])
|
||||
);
|
||||
$sendto,
|
||||
$replyto,
|
||||
$message,
|
||||
array($file),
|
||||
array("application/pdf"),
|
||||
array($filename[sizeof($filename)-1])
|
||||
);
|
||||
|
||||
if ( $mailfile->sendfile() )
|
||||
{
|
||||
@ -109,7 +162,6 @@ class Notify
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -118,10 +170,12 @@ class Notify
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $i;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -22,13 +22,14 @@
|
||||
|
||||
/**
|
||||
\file htdocs/societe/notify/fiche.php
|
||||
\ingroup societe
|
||||
\ingroup societe, notification
|
||||
\brief Onglet notifications pour une societe
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
@ -151,11 +152,16 @@ if ( $soc->fetch($soc->id) )
|
||||
|
||||
print "\n";
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("AddNewNotification"));
|
||||
|
||||
print '<form action="fiche.php?socid='.$socid.'" method="post">';
|
||||
|
||||
// Ligne de titres
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name","","&socid=$socid",'',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre","","&socid=$socid",'',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',"&socid=$socid",'"width="45%"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'"width="45%"',$sortfield);
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -184,7 +190,6 @@ if ( $soc->fetch($soc->id) )
|
||||
}
|
||||
|
||||
$var=false;
|
||||
print '<form action="fiche.php?socid='.$socid.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$html->select_array("contactid",$soc->contact_email_array());
|
||||
@ -194,11 +199,25 @@ if ( $soc->fetch($soc->id) )
|
||||
print '</td>';
|
||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("ListOfActiveNotifications"));
|
||||
$var=true;
|
||||
|
||||
// Ligne de titres
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',"&socid=$socid",'"width="45%"',$sortfield);
|
||||
print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'"width="45%"',$sortfield);
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Liste
|
||||
$sql = "SELECT c.name, c.firstname, a.titre,n.rowid";
|
||||
$sql = "SELECT c.idp as id, c.name, c.firstname, a.titre, n.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n";
|
||||
$sql.= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action AND n.fk_soc = ".$soc->id;
|
||||
|
||||
@ -207,13 +226,19 @@ if ( $soc->fetch($soc->id) )
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr '.$bc[$var].'><td>'.$obj->firstname . " ".$obj->name.'</td>';
|
||||
$contactstatic->id=$obj->id;
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
print '<tr '.$bc[$var].'><td>'.$contactstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$obj->titre.'</td>';
|
||||
print'<td align="center"><a href="fiche.php?socid='.$socid.'&action=delete&actid='.$obj->rowid.'">'.img_delete().'</a>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -19,22 +19,25 @@
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/societe/notify.index.php
|
||||
\ingroup notification
|
||||
\brief Liste des notifications réalisées
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
$langs->load("companies");
|
||||
$langs->load("banks");
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortorder == "")
|
||||
{
|
||||
$sortorder="ASC";
|
||||
@ -50,60 +53,62 @@ $offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print_barre_liste("Liste des societes", $page, "index.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sql = "SELECT s.nom, s.idp, c.name, c.firstname, a.titre,n.rowid FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action";
|
||||
$sql .= " AND n.fk_soc = s.idp";
|
||||
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND s.idp = " . $user->societe_id;
|
||||
if ($socid > 0)
|
||||
{
|
||||
$sql .= " AND s.idp = " . $user->societe_id;
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
|
||||
print "<table class=\noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign=\"center\"');
|
||||
print_liste_field_titre($langs->trans("Contact"),"index.php","c.name");
|
||||
print_liste_field_titre($langs->trans("Action"),"index.php","a.titre");
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"fiche.php?socid=$obj->idp\">$obj->nom</A></td>\n";
|
||||
print "<td>".$obj->firstname." ".$obj->name."</td>\n";
|
||||
print "<td>".$obj->titre."</td>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free();
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$paramlist='';
|
||||
print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, "index.php", $paramlist, $sortfield,$sortorder,'',$num);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign=\"center\"');
|
||||
print_liste_field_titre($langs->trans("Contact"),"index.php","c.name");
|
||||
print_liste_field_titre($langs->trans("Action"),"index.php","a.titre");
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"fiche.php?socid=$obj->idp\">$obj->nom</A></td>\n";
|
||||
print "<td>".$obj->firstname." ".$obj->name."</td>\n";
|
||||
print "<td>".$obj->titre."</td>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error() . ' ' . $sql;
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -18,34 +18,39 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/societe/notify/pre.inc.php
|
||||
\ingroup product,service
|
||||
\brief Fichier gestionnaire du menu gauche des notifications
|
||||
\version $Revision$
|
||||
*/
|
||||
require ("../../main.inc.php");
|
||||
|
||||
function llxHeader($head = "")
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company");
|
||||
|
||||
if ($conf->rights->societe->creer)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany"));
|
||||
}
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts"));
|
||||
|
||||
$menu->add_submenu("index.php", $langs->trans("Notifications"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
global $langs, $user, $conf;
|
||||
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company");
|
||||
|
||||
if ($conf->rights->societe->creer)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany"));
|
||||
}
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts"));
|
||||
|
||||
$menu->add_submenu("index.php", $langs->trans("Notifications"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -18,34 +18,40 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/societe/notify/pre.inc.php
|
||||
\ingroup product,service
|
||||
\brief Fichier gestionnaire du menu gauche des notifications
|
||||
\version $Revision$
|
||||
*/
|
||||
require ("../main.inc.php");
|
||||
|
||||
|
||||
function llxHeader($head = "")
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
global $langs, $user, $conf;
|
||||
|
||||
top_menu($head);
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
$menu = new Menu();
|
||||
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company");
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company");
|
||||
|
||||
if ($conf->rights->societe->creer)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany"));
|
||||
}
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts"));
|
||||
if ($conf->rights->societe->creer)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany"));
|
||||
}
|
||||
|
||||
$menu->add_submenu("notify/index.php", $langs->trans("Notifications"));
|
||||
}
|
||||
$menu->add_submenu(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts"));
|
||||
|
||||
left_menu($menu->liste);
|
||||
$menu->add_submenu("notify/index.php", $langs->trans("Notifications"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -60,7 +60,6 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_NOT_INSTA
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_UPLOAD_DOC','1','chaine','Autorise l\'upload de documents',0);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_MONNAIE','EUR','chaine','Monnaie',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_EMAIL_FROM','dolibarr-robot@domain.com','chaine','EMail emetteur pour les envois automatiques Dolibarr (Notifications, ...)',1);
|
||||
|
||||
insert into llx_const(name,value,type,visible,note) values('MAIN_FASTSEARCH_COMPANY','1','yesno',0,'Show form for quick company search');
|
||||
insert into llx_const(name,value,type,visible,note) values('MAIN_FASTSEARCH_CONTACT','1','yesno',0,'Show form for quick contact search');
|
||||
@ -152,11 +151,14 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_TEXT','%TYPE% n° %ID%\r\n%PRENOM% %NOM%\r\n<%EMAIL%>\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%','texte','Texte imprime sur la carte adherent',0);
|
||||
|
||||
--
|
||||
-- OsCommerce
|
||||
-- OsCommerce 1
|
||||
--
|
||||
insert into llx_const (name, value, type) values ('OSC_DB_NAME','catalog','chaine');
|
||||
insert into llx_const (name, value, type) values ('OSC_LANGUAGE_ID','1','chaine');
|
||||
insert into llx_const (name, value, type) values ('OSC_CATALOG_URL','http://osc.lafrere.lan/','chaine');
|
||||
insert into llx_const (name, value, type) values ('OSC_DB_HOST','localhost','chaine');
|
||||
|
||||
--
|
||||
-- Notification
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('NOTIFICATION_EMAIL_FROM','dolibarr-robot@domain.com','chaine','EMail emetteur pour les notifications automatiques Dolibarr',1);
|
||||
|
||||
--
|
||||
-- Modeles de numerotation et generation document
|
||||
|
||||
@ -155,9 +155,12 @@ update llx_const set name='MAIN_SIZE_LISTE_LIMIT' where name='SIZE_LISTE_LIMIT';
|
||||
update llx_const set name='SOCIETE_FISCAL_MONTH_START' where name='FISCAL_MONTH_START';
|
||||
update llx_const set visible=0 where name='FACTURE_DISABLE_RECUR';
|
||||
update llx_const set visible=0 where name='MAILING_EMAIL_FROM';
|
||||
update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_MAIL_FROM';
|
||||
update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_EMAIL_FROM';
|
||||
|
||||
insert into llx_const(name,value,type,visible,note) values('MAIN_SHOW_DEVELOPMENT_MODULES','0','yesno',1,'Make development modules visible');
|
||||
|
||||
delete from llx_const where name in ('OSC_CATALOG_URL','OSC_LANGUAGE_ID');
|
||||
|
||||
alter table llx_paiementfourn add statut smallint(6) NOT NULL DEFAULT 0;
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_MONNAIE',
|
||||
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_UPLOAD_DOC','1','chaine','Autorise l\'upload de document',1);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_NOT_INSTALLED','1','chaine','Test d\'installation',1);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_MAIL_FROM','dolibarr-robot@domain.com','chaine','EMail emetteur pour les notifications automatiques Dolibarr',1);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_TITLE','Dolibarr','chaine','Titre des pages',0);
|
||||
|
||||
@ -124,11 +123,14 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_
|
||||
insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_TEXT','%TYPE% n° %ID%\r\n%PRENOM% %NOM%\r\n<%EMAIL%>\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%','texte','Texte imprime sur la carte adherent',0);
|
||||
|
||||
--
|
||||
-- OsCommerce
|
||||
-- OsCommerce 1
|
||||
--
|
||||
insert into llx_const (name, value, type) values ('DB_NAME_OSC','catalog','chaine');
|
||||
insert into llx_const (name, value, type) values ('OSC_LANGUAGE_ID','1','chaine');
|
||||
insert into llx_const (name, value, type) values ('OSC_CATALOG_URL','http://osc.lafrere.lan/','chaine');
|
||||
insert into llx_const (name, value, type) values ('OSC_DB_HOST','localhost','chaine');
|
||||
|
||||
--
|
||||
-- Notification
|
||||
--
|
||||
insert into llx_const (name, value, type, note, visible) values ('NOTIFICATION_EMAIL_FROM','dolibarr-robot@domain.com','chaine','EMail emetteur pour les notifications automatiques Dolibarr',1);
|
||||
|
||||
--
|
||||
--
|
||||
|
||||
Loading…
Reference in New Issue
Block a user