Réecriture gestion des notifications pour être gérées par un module indépendant et via le mécanisme des triggers.

Ceci afin de simplifier le code et de permettre le notifications sur n'importe quel évennement Dolibarr.
This commit is contained in:
Laurent Destailleur 2006-08-05 16:44:43 +00:00
parent 11d7faa44e
commit d1358b1d2c
26 changed files with 532 additions and 322 deletions

View File

@ -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 * Affichage page configuration module societe
@ -213,8 +200,8 @@ print "</table>\n";
print '<br>'; print '<br>';
// Choix du module de gestion des codes compta // Autres options
/*
print_titre($langs->trans("OtherOptions")); print_titre($langs->trans("OtherOptions"));
$var=true; $var=true;
@ -228,16 +215,16 @@ print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
print '<form action="'.$_SERVER["societe.php"].'" method="POST">'; print '<form action="'.$_SERVER["societe.php"].'" method="POST">';
print '<input type="hidden" name="action" value="setdisablenotifications">'; print '<input type="hidden" name="action" value="setxxx">';
print '<input type="hidden" name="constname" value="SOCIETE_DISABLE_NOTIFICATIONS">'; print '<input type="hidden" name="constname" value="XXX">';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].' class="value">'; 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>'; print '<td>';
$form->selectyesnonum('constvalue',! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS); $form->selectyesnonum('constvalue',! $conf->global->XXX);
print '</td>'; print '</td>';
print '<td>'.$langs->trans("NotificationsDesc").'</td>'; print '<td>'.$langs->trans("XXXDesc").'</td>';
print '<td align="right">'; print '<td align="right">';
print '<input class="button" type="submit" value="'.$langs->trans('Modify').'" name="button"> &nbsp; '; print '<input class="button" type="submit" value="'.$langs->trans('Modify').'" name="button"> &nbsp; ';
print '</td>'; print '</td>';
@ -246,7 +233,7 @@ print "</tr>\n";
print '</form>'; print '</form>';
print "</table>\n"; print "</table>\n";
*/
$db->close(); $db->close();

View File

@ -69,82 +69,27 @@ if ($user->societe_id > 0)
*********************************************************************************/ *********************************************************************************/
if ($_socid > 0) if ($_socid > 0)
{ {
// On recupere les donnees societes par l'objet // On recupere les donnees societes par l'objet
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->id=$_socid; $objsoc->id=$_socid;
$objsoc->fetch($_socid,$to); $objsoc->fetch($_socid,$to);
$dac = strftime("%Y-%m-%d %H:%M", time()); $dac = strftime("%Y-%m-%d %H:%M", time());
if ($errmesg) if ($errmesg)
{ {
print '<div class="error">'.$errmesg.'</div><br>'; 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++;
}
$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; /*
$head[$h][1] = $langs->trans("Note"); * Affichage onglets
$h++; */
if ($user->societe_id == 0) $head = societe_prepare_head($objsoc);
{
$head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id;
$head[$h][1] = $langs->trans("Documents");
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; dolibarr_fiche_head($head, 'notify', $objsoc->nom);
$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, $hselected, $objsoc->nom);
/*
*
*
*/
print '<form method="POST" action="multiprix.php?id='.$objsoc->id.'">'; print '<form method="POST" action="multiprix.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="action" value="setpricelevel">'; print '<input type="hidden" name="action" value="setpricelevel">';
print '<table width="100%" border="0">'; print '<table width="100%" border="0">';

View File

@ -1422,7 +1422,8 @@ else
*/ */
if ($_GET['action'] == 'delete') 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 />'; print '<br />';
} }
@ -1433,7 +1434,7 @@ else
{ {
// on vérifie si la facture est en numérotation provisoire // on vérifie si la facture est en numérotation provisoire
$facref = substr($fac->ref, 1, 4); $facref = substr($fac->ref, 1, 4);
if ($facref == PROV) if ($facref == 'PROV')
{ {
$numfa = $fac->getNextNumRef($soc); $numfa = $fac->getNextNumRef($soc);
} }
@ -1441,7 +1442,17 @@ else
{ {
$numfa = $fac->ref; $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 />'; print '<br />';
} }

View File

@ -105,7 +105,6 @@ if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$var=True;
$paramlist=($_GET["orphelins"]?"&orphelins=1":""); $paramlist=($_GET["orphelins"]?"&orphelins=1":"");
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num);
@ -135,7 +134,7 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
print '</form>'; print '</form>';
$var=true;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);

View File

@ -134,12 +134,19 @@ class Conf
// Module bookmark4u // Module bookmark4u
$this->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0; $this->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0;
$this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0; $this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0;
// Module deplacement // Module deplacement
$this->deplacement->enabled=defined("MAIN_MODULE_DEPLACEMENT")?MAIN_MODULE_DEPLACEMENT:0; $this->deplacement->enabled=defined("MAIN_MODULE_DEPLACEMENT")?MAIN_MODULE_DEPLACEMENT:0;
// Module mailing // Module mailing
$this->mailing->enabled=defined("MAIN_MODULE_MAILING")?MAIN_MODULE_MAILING:0; $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 // Module externalrss
$this->externalrss->enabled=defined("MAIN_MODULE_EXTERNALRSS")?MAIN_MODULE_EXTERNALRSS:0; $this->externalrss->enabled=defined("MAIN_MODULE_EXTERNALRSS")?MAIN_MODULE_EXTERNALRSS:0;
// Module commande client // Module commande client
$this->commande->enabled=defined("MAIN_MODULE_COMMANDE")?MAIN_MODULE_COMMANDE:0; $this->commande->enabled=defined("MAIN_MODULE_COMMANDE")?MAIN_MODULE_COMMANDE:0;
$this->commande->dir_output=DOL_DATA_ROOT."/commande"; $this->commande->dir_output=DOL_DATA_ROOT."/commande";
@ -340,12 +347,13 @@ class Conf
$this->css = "theme/".$this->theme."/".$this->theme.".css"; $this->css = "theme/".$this->theme."/".$this->theme.".css";
// $this->email_from = email pour envoi par Dolibarr des mails auto (notifications, ...) // $this->email_from = email pour envoi par Dolibarr des mails auto (notifications, ...)
// $this->mailing->email_from = email pour envoi par Dolibarr des mailings $this->notification->email_from="dolibarr-robot@domain.com";
$this->email_from="dolibarr-robot@domain.com"; if (defined('NOTIFICATION_EMAIL_FROM'))
if (defined('MAIN_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')) if (defined('MAILING_EMAIL_FROM'))
{ {
$this->mailing->email_from=MAILING_EMAIL_FROM; $this->mailing->email_from=MAILING_EMAIL_FROM;

View File

@ -748,6 +748,31 @@ class Contact
return -1; 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;
}
} }
?> ?>

View File

@ -32,7 +32,6 @@
*/ */
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php"); 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 ."/product.class.php");
require_once(DOL_DOCUMENT_ROOT ."/client.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 // on vérifie si la facture est en numérotation provisoire
$facref = substr($this->ref, 1, 4); $facref = substr($this->ref, 1, 4);
$action_notify = 2; // ne pas modifier cette valeur
if ($force_number) if ($force_number)
{ {
$numfa = $force_number; $numfa = $force_number;
} }
else if ($facref == PROV) else if ($facref == 'PROV')
{ {
$numfa = $this->getNextNumRef($soc); $numfa = $this->getNextNumRef($soc);
} }
@ -880,7 +878,7 @@ class Facture extends CommonObject
// On vérifie si la facture était une provisoire // 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) // On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
// afin de ne pas perdre les fichiers attachés // 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 // On vérifie si la facture était une provisoire
if ($facref == PROV) if ($facref == 'PROV')
{ {
/* /*
* Pour chaque produit, on met a jour indicateur nbvente * Pour chaque produit, on met a jour indicateur nbvente
* On crée ici une dénormalisation des données pas forcément utilisée. * 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 = 'SELECT fk_product FROM '.MAIN_DB_PREFIX.'facturedet';
$sql.= ' WHERE fk_facture = '.$this->id; $sql.= ' WHERE fk_facture = '.$this->id;
$sql.= ' AND fk_product > 0'; $sql.= ' AND fk_product > 0';
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'product SET nbvente=nbvente+1 WHERE rowid = '.$obj->fk_product; $sql = 'UPDATE '.MAIN_DB_PREFIX.'product SET nbvente=nbvente+1 WHERE rowid = '.$obj->fk_product;
$resql2 = $this->db->query($sql); $resql2 = $this->db->query($sql);
$i++; $i++;
} }
} }
else else
{ {
$error++; $error++;
} }
} }
if ($error == 0) if ($error == 0)
{ {
@ -989,17 +987,6 @@ class Facture extends CommonObject
$result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf);
// Fin appel triggers // 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(); $this->db->commit();
return 1; return 1;

View File

@ -27,7 +27,6 @@
*/ */
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
/** \class Ficheinter /** \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 $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql.= " SET fk_statut = 1, date_valid=now(), fk_user_valid=".$user->id;
$this->fetch($this->id); $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
$resql=$this->db->query($sql);
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid"; if ($resql)
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
if ($this->db->query($sql) )
{ {
/* // Appel des triggers
* Set generates files readonly include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
*/ $interface=new Interfaces($this->db);
umask(0); $result=$interface->run_triggers('FICHEINTER_VALIDATE',$this,$user,$langs,$conf);
$file = $outputdir . "/$this->ref/$this->ref.tex"; // Fin appel triggers
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);
return 1; return 1;
} }
else else
{ {
print $this->db->error() . ' in ' . $sql; $this->error=$this->db->error().' sql='.$sql;
return -1; return -1;
} }
} }
/** /**

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.org> * Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.org>
* *
* This program is free software; you can redistribute it and/or modify * 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
@ -54,7 +54,9 @@ class modBookmark4u extends DolibarrModules
$this->family = "technic"; $this->family = "technic";
$this->name = "Bookmark4u"; $this->name = "Bookmark4u";
$this->description = "Ajoute fonction pour générer un compte Bookmark4u depuis un compte Dolibarr"; $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->const_name = 'MAIN_MODULE_BOOKMARK4U';
$this->special = 1; $this->special = 1;
$this->picto='user'; $this->picto='user';

View File

@ -55,8 +55,7 @@ class modClickToDial extends DolibarrModules
$this->name = "ClickToDial"; $this->name = "ClickToDial";
$this->description = "Gestion du Click To Dial"; $this->description = "Gestion du Click To Dial";
$this->revision = explode(' ','$Revision$'); $this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version
$this->version = $this->revision[1];
$this->const_name = 'MAIN_MODULE_CLICKTODIAL'; $this->const_name = 'MAIN_MODULE_CLICKTODIAL';
$this->special = 1; $this->special = 1;

View File

@ -55,7 +55,7 @@ class modOSCOmmerce2 extends DolibarrModules
$this->family = "products"; $this->family = "products";
$this->name = "OSCommerce 2"; $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->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->const_name = 'MAIN_MODULE_OSCOMMERCEWS';
$this->special = 1; $this->special = 1;

View File

@ -118,6 +118,7 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
} }
// Companies // Companies
elseif ($action == 'COMPANY_CREATE') elseif ($action == 'COMPANY_CREATE')
{ {
@ -131,6 +132,7 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id);
} }
// Products // Products
elseif ($action == 'PRODUCT_CREATE') elseif ($action == 'PRODUCT_CREATE')
{ {
@ -144,6 +146,7 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
} }
// Customer orders // Customer orders
elseif ($action == 'ORDER_CREATE') elseif ($action == 'ORDER_CREATE')
{ {
@ -157,6 +160,7 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
} }
// Supplier orders // Supplier orders
elseif ($action == 'ORDER_SUPPLIER_CREATE') elseif ($action == 'ORDER_SUPPLIER_CREATE')
{ {
@ -166,6 +170,7 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
} }
// Proposals // Proposals
elseif ($action == 'PROPAL_CREATE') elseif ($action == 'PROPAL_CREATE')
{ {
@ -187,6 +192,7 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
} }
// Contracts // Contracts
elseif ($action == 'CONTRACT_CREATE') elseif ($action == 'CONTRACT_CREATE')
{ {
@ -212,6 +218,7 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
} }
// Bills // Bills
elseif ($action == 'BILL_CREATE') elseif ($action == 'BILL_CREATE')
{ {
@ -233,6 +240,7 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
} }
// Payments // Payments
elseif ($action == 'PAYMENT_CUSTOMER_CREATE') elseif ($action == 'PAYMENT_CUSTOMER_CREATE')
{ {
@ -242,6 +250,13 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
} }
// Interventions
elseif ($action == 'FICHEINTER_VALIDATE')
{
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
}
// Members // Members
elseif ($action == 'MEMBER_CREATE') elseif ($action == 'MEMBER_CREATE')
{ {
@ -267,6 +282,8 @@ class InterfaceDemo
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched");
} }
// If not found
else else
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action."); dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action.");

View 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;
}
}
?>

View File

@ -137,6 +137,8 @@ Module410Name=Webcalendar
Module410Desc=Webcalendar integration Module410Desc=Webcalendar integration
Module500Name=Taxes and social contributions Module500Name=Taxes and social contributions
Module500Desc=Taxes and social contributions' management Module500Desc=Taxes and social contributions' management
Module600Name=Notification
Module600Desc=Send notifications (by email) on Dolibarr business events
Module700Name=Donations Module700Name=Donations
Module700Desc=Donations' management Module700Desc=Donations' management
Module800Name=OSCommerce 1 Module800Name=OSCommerce 1
@ -525,6 +527,9 @@ NewRSS=New RSS
##### Mailing ##### ##### Mailing #####
MailingSetup=Mailing module setup MailingSetup=Mailing module setup
MailingEMailFrom=Sender EMail (From) for emails sent by emailing module 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 ##### ##### Sendings #####
SendingsSetup=Sending module setup SendingsSetup=Sending module setup
SendingsReceiptModel=Sending receipt model SendingsReceiptModel=Sending receipt model

View File

@ -73,4 +73,10 @@ ToClearAllRecipientsClickHere=To clear recipients' list for this emailing, click
ToAddRecipientsChooseHere=To add recipients, choose in those lists ToAddRecipientsChooseHere=To add recipients, choose in those lists
NbOfEMailingsReceived=Mass emailings received NbOfEMailingsReceived=Mass emailings received
IdRecord=ID record 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

View File

@ -137,6 +137,8 @@ Module410Name=Webcalendar
Module410Desc=Interface avec le calendrier Webcalendar Module410Desc=Interface avec le calendrier Webcalendar
Module500Name=Taxes et charges sociales Module500Name=Taxes et charges sociales
Module500Desc=Gestion des 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 Module700Name=Dons
Module700Desc=Gestion des dons Module700Desc=Gestion des dons
Module800Name=OSCommerce 1 Module800Name=OSCommerce 1
@ -525,6 +527,9 @@ NewRSS=Syndication d'un nouveau flux RSS
##### Mailing ##### ##### Mailing #####
MailingSetup=Configuration du module EMailing MailingSetup=Configuration du module EMailing
MailingEMailFrom=Email emetteur (From) des mails envoyés par 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 ##### ##### Sendings #####
SendingsSetup=Configuration du module Expéditions/Livraisons SendingsSetup=Configuration du module Expéditions/Livraisons
SendingsReceiptModel=Modèle du bordereau d'expédition SendingsReceiptModel=Modèle du bordereau d'expédition

View File

@ -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 ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous
NbOfEMailingsReceived=Mailings de masse reçus NbOfEMailingsReceived=Mailings de masse reçus
IdRecord=ID enregistrement 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

View File

@ -87,7 +87,7 @@ function societe_prepare_head($objsoc)
$h++; $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][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id;
$head[$h][1] = $langs->trans("Notifications"); $head[$h][1] = $langs->trans("Notifications");
@ -95,13 +95,13 @@ function societe_prepare_head($objsoc)
$h++; $h++;
} }
if ($user->societe_id == 0) if ($user->societe_id == 0)
{ {
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id; $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;
} }
if ($conf->bookmark->enabled && $user->rights->bookmark->creer) if ($conf->bookmark->enabled && $user->rights->bookmark->creer)
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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 * 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
@ -25,6 +25,7 @@
\brief Fichier de la classe de gestion des notifications \brief Fichier de la classe de gestion des notifications
\version $Revision$ \version $Revision$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/lib/CMailFile.class.php");
/** /**
@ -45,7 +46,10 @@ class Notify
var $note; var $note;
var $projet_id; 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 * \brief Constructeur
@ -54,13 +58,59 @@ class Notify
function Notify($DB) function Notify($DB)
{ {
$this->db = $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="") 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 n.fk_soc = s.idp AND n.fk_action = ".$action;
$sql .= " AND s.idp = ".$socid; $sql .= " AND s.idp = ".$socid;
dolibarr_syslog("Notify.class::send $action, $socid, $texte, $objet_type, $objet_id, $file");
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
@ -85,19 +137,20 @@ class Notify
if (strlen($sendto)) if (strlen($sendto))
{ {
$subject = $langs->trans("DolibarrNotififcation"); $subject = $langs->trans("DolibarrNotification");
$message = $texte; $message = $texte;
$filename = split("/",$file); $filename = split("/",$file);
$replyto = $conf->email_from;
$replyto = $conf->notification->email_from;
$mailfile = new CMailFile($subject, $mailfile = new CMailFile($subject,
$sendto, $sendto,
$replyto, $replyto,
$message, $message,
array($file), array($file),
array("application/pdf"), array("application/pdf"),
array($filename[sizeof($filename)-1]) array($filename[sizeof($filename)-1])
); );
if ( $mailfile->sendfile() ) if ( $mailfile->sendfile() )
{ {
@ -109,7 +162,6 @@ class Notify
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
} }
else else
{ {
@ -118,10 +170,12 @@ class Notify
} }
$i++; $i++;
} }
return $i;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1;
} }
} }

View File

@ -22,13 +22,14 @@
/** /**
\file htdocs/societe/notify/fiche.php \file htdocs/societe/notify/fiche.php
\ingroup societe \ingroup societe, notification
\brief Onglet notifications pour une societe \brief Onglet notifications pour une societe
\version $Revision$ \version $Revision$
*/ */
require("pre.inc.php"); require("pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
$langs->load("companies"); $langs->load("companies");
@ -151,11 +152,16 @@ if ( $soc->fetch($soc->id) )
print "\n"; print "\n";
print_fiche_titre($langs->trans("AddNewNotification"));
print '<form action="fiche.php?socid='.$socid.'" method="post">';
// Ligne de titres // Ligne de titres
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">'; 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("Contact"),"fiche.php","c.name",'',"&socid=$socid",'"width="45%"',$sortfield);
print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre","","&socid=$socid",'',$sortfield); print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'"width="45%"',$sortfield);
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -184,7 +190,6 @@ if ( $soc->fetch($soc->id) )
} }
$var=false; $var=false;
print '<form action="fiche.php?socid='.$socid.'" method="post">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
$html->select_array("contactid",$soc->contact_email_array()); $html->select_array("contactid",$soc->contact_email_array());
@ -194,11 +199,25 @@ if ( $soc->fetch($soc->id) )
print '</td>'; print '</td>';
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>'; print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>'; print '</tr>';
print '</table>';
print '</form>'; 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>&nbsp;</td>';
print '</tr>';
// Liste // 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.= " 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; $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); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$contactstatic=new Contact($db);
while ($i < $num) while ($i < $num)
{ {
$var = !$var; $var = !$var;
$obj = $db->fetch_object($resql); $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>'.$obj->titre.'</td>';
print'<td align="center"><a href="fiche.php?socid='.$socid.'&action=delete&actid='.$obj->rowid.'">'.img_delete().'</a>'; print'<td align="center"><a href="fiche.php?socid='.$socid.'&action=delete&actid='.$obj->rowid.'">'.img_delete().'</a>';
print '</tr>'; print '</tr>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 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 * 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
@ -19,22 +19,25 @@
* $Id$ * $Id$
* $Source$ * $Source$
*/ */
/**
\file htdocs/societe/notify.index.php
\ingroup notification
\brief Liste des notifications réalisées
\version $Revision$
*/
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("companies"); $langs->load("companies");
$langs->load("banks"); $langs->load("banks");
/* // Sécurité accés client
* Sécurité accés client
*/
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
llxHeader();
if ($sortorder == "") if ($sortorder == "")
{ {
$sortorder="ASC"; $sortorder="ASC";
@ -50,60 +53,62 @@ $offset = $conf->liste_limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
/* /*
* Mode Liste * 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 = "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 .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action";
$sql .= " AND n.fk_soc = s.idp"; $sql .= " AND n.fk_soc = s.idp";
if ($socid > 0)
if ($socid > 0) { {
$sql .= " AND s.idp = " . $user->societe_id; $sql .= " AND s.idp = " . $user->societe_id;
} }
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows(); $num = $db->num_rows($result);
$i = 0; $i = 0;
$paramlist='';
print "<table class=\noborder\" width=\"100%\">"; print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, "index.php", $paramlist, $sortfield,$sortorder,'',$num);
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign=\"center\"'); print '<table class="noborder" width="100%">';
print_liste_field_titre($langs->trans("Contact"),"index.php","c.name"); print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Action"),"index.php","a.titre"); print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign=\"center\"');
print "</tr>\n"; print_liste_field_titre($langs->trans("Contact"),"index.php","c.name");
$var=True; print_liste_field_titre($langs->trans("Action"),"index.php","a.titre");
while ($i < $num) print "</tr>\n";
{ $var=True;
$obj = $db->fetch_object( $i); while ($i < $num)
{
$var=!$var; $obj = $db->fetch_object($result);
print "<tr $bc[$var]>"; $var=!$var;
print "<td><a href=\"fiche.php?socid=$obj->idp\">$obj->nom</A></td>\n";
print "<td>".$obj->firstname." ".$obj->name."</td>\n"; print "<tr $bc[$var]>";
print "<td>".$obj->titre."</td>\n"; print "<td><a href=\"fiche.php?socid=$obj->idp\">$obj->nom</A></td>\n";
print "</tr>\n"; print "<td>".$obj->firstname." ".$obj->name."</td>\n";
$i++; print "<td>".$obj->titre."</td>\n";
} print "</tr>\n";
print "</table>"; $i++;
$db->free(); }
print "</table>";
$db->free();
} }
else else
{ {
print $db->error() . ' ' . $sql; dolibarr_print_error($db);
} }
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 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 * 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
@ -18,34 +18,39 @@
* *
* $Id$ * $Id$
* $Source$ * $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"); require ("../../main.inc.php");
function llxHeader($head = "") 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) if ($conf->societe->enabled)
{ {
$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company"); $menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company");
if ($conf->rights->societe->creer) if ($conf->rights->societe->creer)
{ {
$menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany")); $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(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts"));
$menu->add_submenu("index.php", $langs->trans("Notifications")); $menu->add_submenu("index.php", $langs->trans("Notifications"));
} }
left_menu($menu->liste); left_menu($menu->liste);
} }
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 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 * 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
@ -18,34 +18,40 @@
* *
* $Id$ * $Id$
* $Source$ * $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"); require ("../main.inc.php");
function llxHeader($head = "") 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) if ($conf->societe->enabled)
{ {
$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company"); $menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company");
if ($conf->rights->societe->creer) if ($conf->rights->societe->creer)
{ {
$menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany")); $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("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);
} }
?> ?>

View File

@ -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_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_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_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'); 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); 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_DB_HOST','localhost','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'); --
-- 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 -- Modeles de numerotation et generation document

View File

@ -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 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='FACTURE_DISABLE_RECUR';
update llx_const set visible=0 where name='MAILING_EMAIL_FROM'; 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'); 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; alter table llx_paiementfourn add statut smallint(6) NOT NULL DEFAULT 0;

View File

@ -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_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_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); 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); 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_DB_HOST','localhost','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'); --
-- 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);
-- --
-- --