New: Yeh! Now all automatic actions are externalised in triggers. This make code so so much easier to understand and offer a lot of possible new features.

This commit is contained in:
Laurent Destailleur 2008-04-07 22:11:22 +00:00
parent 7430dc5bb3
commit f9ed5b522f
20 changed files with 420 additions and 277 deletions

View File

@ -521,6 +521,116 @@ class ActionComm
return $result; return $result;
} }
/**
\brief Export fichier cal depuis base webcalendar
\param format 'ical' or 'vcal'
\param type 'event' or 'journal'
\param cachedelay Do not rebuild file if date older than cachedelay seconds
\param filename Force filename
\param filters Array of filters
\return int <0 if error, nb of events in new file if ok
*/
function build_calfile($format,$type,$cachedelay,$filename,$filters)
{
global $conf,$langs,$dolibarr_main_url_root;
require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php");
dolibarr_syslog("ActionComm::build_calfile Build cal file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".sizeof($filters), LOG_DEBUG);
// Check parameters
if (empty($format)) return -1;
// Clean parameters
if (! $filename)
{
$extension='vcs';
if ($format == 'ical') $extension='ics';
$filename=$format.'.'.$extension;
}
create_exdir($conf->agenda->dir_temp);
$outputfile=$conf->agenda->dir_temp.'/'.$filename;
$result=0;
$buildfile=true;
if ($cachedelay)
{
// \TODO Check cache
}
if ($buildfile)
{
// Build event array
$eventarray=array();
$sql = "SELECT a.id,";
$sql.= " ".$this->db->pdate("a.datep")." as datep,";
$sql.= " ".$this->db->pdate("a.datep2")." as datep2,";
$sql.= " ".$this->db->pdate("a.datea")." as datea,";
$sql.= " ".$this->db->pdate("a.datea2")." as datea2,";
$sql.= " a.durationp, a.durationa,";
$sql.= " ".$this->db->pdate("a.datec")." as datec, tms as datem,";
$sql.= " a.note, a.label, a.fk_action as type_id,";
$sql.= " a.fk_soc,";
$sql.= " a.fk_user_author, a.fk_user_mod,";
$sql.= " a.fk_user_action, a.fk_user_done,";
$sql.= " a.fk_contact, a.fk_facture, a.percent as percentage, a.fk_commande,";
$sql.= " a.priority,";
$sql.= " c.id as type_id, c.code as type_code, c.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c";
$sql.= " WHERE a.fk_action=c.id";
$sql.= " order by datec";
dolibarr_syslog("ActionComm::build_vcal select events sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
$qualified=true;
// 'eid','startdate','duration','enddate','title','summary','category','email','url','desc','author'
$event=array();
$event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"];
$event['type']=$type;
$datestart=$obj->datea?$obj->datea:$obj->datep;
$dateend=$obj->datea2?$obj->datea2:$obj->datep2;
$duration=$obj->durationa?$obj->durationa:$obj->durationp;
$event['startdate']=$datestart;
$event['duration']=$duration; // Not required with type 'journal'
$event['enddate']=$dateend; // Not required with type 'journal'
$event['summary']=$obj->label;
$event['desc']=$obj->note;
$event['author']=$obj->fk_user_done>0?$obj->fk_user_done:$obj->fk_user_action;
$event['transparency']='TRANSPARENT'; // TRANSPARENT or OPAQUE
$url=$dolibarr_main_url_root.DOL_URL_ROOT;
if (! eregi('\/$',$url)) $url.='/';
$url.='comm/action/fiche.php?id='.$obj->id;
$event['url']=$url;
if ($qualified)
{
$eventarray[$datestart]=$event;
}
}
}
else
{
dolibarr_syslog("ActionComm::build_calfile ".$this->db->lasterror(), LOG_ERR);
return -1;
}
// Write file
$title='Dolibarr actions';
$desc='List of actions - built by Dolibarr';
$result=build_calfile($format,$title,$desc,$eventarray,$outputfile);
}
return $result;
}
} }
?> ?>

View File

@ -17,78 +17,109 @@
*/ */
/** /**
\file htdocs/admin/agenda.php \file htdocs/admin/agenda_actions.php
\ingroup agenda \ingroup agenda
\brief Page de configuration du module agenda \brief Autocreate actions for agenda module setup page
\version $Id$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/agenda.lib.php'); require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$langs->load("admin"); $langs->load("admin");
$langs->load("other"); $langs->load("other");
$langs->load("agenda"); $langs->load("agenda");
$def = array(); $action=$_POST["action"];
$actionsave=$_POST["save"];
// Sauvegardes parametres
if ($actionsave) // List of all events supported by triggers
$eventstolog=array(
// array('id'=>'USER_CREATE', 'test'=>1),
// array('id'=>'GROUP_CREATE', 'test'=>1),
// array('id'=>'COMPANY_CREATE', 'test'=>$conf->societe->enabled),
// array('id'=>'CONTRACT_VALIDATE', 'test'=>$conf->contrat->enabled),
// array('id'=>'PROPAL_VALIDATE', 'test'=>$conf->propal->enabled),
array('id'=>'PROPAL_SENTBYMAIL', 'test'=>$conf->propal->enabled),
// array('id'=>'BILL_VALIDATE', 'test'=>$conf->facture->enabled),
// array('id'=>'BILL_PAYED', 'test'=>$conf->facture->enabled),
// array('id'=>'BILL_CANCELED', 'test'=>$conf->facture->enabled),
array('id'=>'BILL_SENTBYMAIL', 'test'=>$conf->facture->enabled),
array('id'=>'ORDER_SENTBYMAIL', 'test'=>$conf->commande->enabled),
// array('id'=>'PAYMENT_CUSTOMER_CREATE','test'=>$conf->facture->enabled),
// array('id'=>'PAYMENT_SUPPLIER_CREATE','test'=>$conf->fournisseur->enabled),
// array('id'=>'MEMBER_VALIDATE', 'test'=>$conf->adherent->enabled),
// array('id'=>'MEMBER_SUBSCRIPTION', 'test'=>$conf->adherent->enabled),
);
/*
* Actions
*/
if ($action == "save")
{ {
$i=0; $i=0;
$db->begin(); $db->begin();
$i+=dolibarr_set_const($db,'MAIN_PASSWORD_VCALEXPORT',trim($_POST["MAIN_PASSWORD_VCALEXPORT"]),'chaine',0); foreach ($eventstolog as $key => $arr)
if ($i > 0)
{ {
$param='MAIN_AGENDA_ACTIONAUTO_'.$arr['id'];
//print "param=".$param." - ".$_POST[$param];
if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0);
else dolibarr_del_const($db,$param);
}
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("SaveFailed")."</font>";
}
} }
/** /**
* Vies * Affichage du formulaire de saisie
*/ */
llxHeader(); llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
print '<br>'; print "<br>\n";
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
print "<br>\n";
$head=agenda_prepare_head();
dolibarr_fiche_head($head, 'autoactions', $langs->trans("Agenda"));
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="action" value="save">';
$var=true;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td width=\"30%\">".$langs->trans("Parameter")."</td>"; print "<td colspan=\"2\">".$langs->trans("LogEvents")."</td>";
print "<td>".$langs->trans("Value")."</td>"; print "</tr>\n";
//print "<td>".$langs->trans("Examples")."</td>"; foreach ($eventstolog as $key => $arr)
print "<td>&nbsp;</td>"; {
print "</tr>"; if ($arr['id'])
{
print "<tr class=\"impair\">"; $var=!$var;
print "<td>".$langs->trans("PasswordTogetVCalExport")."</td>"; print '<tr '.$bc[$var].'>';
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_PASSWORD_VCALEXPORT\" value=\"". ($_POST["MAIN_PASSWORD_VCALEXPORT"]?$_POST["MAIN_PASSWORD_VCALEXPORT"]:$conf->global->MAIN_PASSWORD_VCALEXPORT) . "\" size=\"40\"></td>"; print '<td>'.$arr['id'].'</td>';
print "<td>&nbsp;</td>"; print '<td>';
print "</tr>"; $key='MAIN_AGENDA_ACTIONAUTO_'.$arr['id'];
$value=$conf->global->$key;
print '<input type="checkbox" name="'.$key.'" value="1"'.($value?' checked="true"':'').'>';
print '</td></tr>'."\n";
}
}
print '</table>'; print '</table>';
print '<br><center>'; print '<br><center>';
@ -97,21 +128,13 @@ print "</center>";
print "</form>\n"; print "</form>\n";
print '</div>';
clearstatcache();
if ($mesg) print "<br>$mesg<br>"; if ($mesg) print "<br>$mesg<br>";
print "<br>"; print "<br>";
// Show message
$message='';
$urlwithouturlroot=eregi_replace(DOL_URL_ROOT.'$','',$dolibarr_main_url_root);
$urlvcal='<a href="'.DOL_URL_ROOT.'/comm/action/agendaexport.php?format=vcal&exportkey=..." target="_blank">'.$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/agendaexport.php?format=vcal&exportkey=...'.'</a>';
$message.=$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
$message.='<br>';
$urlical='<a href="'.DOL_URL_ROOT.'/comm/action/agendaexport.php?format=ical&type=event&exportkey=..." target="_blank">'.$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/agendaexport.php?format=ical&type=event&exportkey=...'.'</a>';
$message.=$langs->trans("WebCalUrlForVCalExport",'ical',$urlical);
print info_admin($message);
$db->close(); $db->close();

View File

@ -14,15 +14,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/admin/stock.php \file htdocs/admin/stock.php
\ingroup stock \ingroup stock
\brief Page d'administration/configuration du module gestion de stock \brief Page d'administration/configuration du module gestion de stock
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
@ -97,6 +95,7 @@ llxHeader('',$langs->trans("StockSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("StockSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("StockSetup"),$linkback,'setup');
print '<br>';
$html=new Form($db); $html=new Form($db);
$var=true; $var=true;

View File

@ -15,17 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/ */
/** /**
\file htdocs/cactioncomm.class.php \file htdocs/cactioncomm.class.php
\ingroup commercial \ingroup commercial
\brief Fichier de la classe des types d'actions commerciales \brief Fichier de la classe des types d'actions commerciales
\version $Revision$ \version $Id$
*/ */

View File

@ -40,8 +40,10 @@ $sortorder=$_GET["sortorder"];
if ($page == -1) { $page = 0 ; } if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$offset = $limit * $page ; $offset = $limit * $page ;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datea"; if (! $sortfield) $sortfield="a.datec";
$status=isset($_GET["status"])?$_GET["status"]:$_POST["status"];
// Security check // Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:''; $socid = isset($_GET["socid"])?$_GET["socid"]:'';
@ -137,7 +139,7 @@ $nav.=" $year";
$nav.=" </span>\n"; $nav.=" </span>\n";
$nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n"; $nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n";
print_fiche_titre($title,$nav,$_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,'',$num); print_fiche_titre($title,$nav,"");
// Filters // Filters
if ($canedit) if ($canedit)
@ -201,6 +203,8 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0)
if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
$sql.= ")"; $sql.= ")";
} }
if ($status == 'done') { $sql.= " AND a.percent = 100"; }
if ($status == 'todo') { $sql.= " AND a.percent < 100"; }
//echo "$sql<br>"; //echo "$sql<br>";
$actionarray=array(); $actionarray=array();
@ -327,7 +331,7 @@ function show_day_events($db, $day, $month, $year, $style, $actionarray)
if ($day==$jour && $month==$mois && $year==$annee) if ($day==$jour && $month==$mois && $year==$annee)
{ {
if ($i) print "<br>"; if ($i) print "<br>";
print $action->getNomUrl(1,10)." ".$action->getLibStatut(3); print $action->getNomUrl(1,9)." ".$action->getLibStatut(3);
$i++; $i++;
} }
} }

View File

@ -351,19 +351,19 @@ if ($_POST['action'] == 'send')
if($subject == '') if($subject == '')
{ {
$subject = $langs->trans('Propal').' '.$propal->ref; $subject = $langs->transnoentities('Propal').' '.$propal->ref;
} }
$actiontypeid=3; $actiontypecode='AC_PROP';
$actionmsg = $langs->trans('MailSentBy').' '.$from.' '.$langs->trans('To').' '.$sendto.'.<br>'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message) if ($message)
{ {
$actionmsg.=$langs->trans('TextUsedInTheMessageBody').' :<br>'; $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message; $actionmsg.=$message;
} }
$actionmsg2=$langs->trans('SendPropalByMail'); $actionmsg2=$langs->transnoentities('SendPropalByMail');
} }
$filepath[0] = $file; $filepath[0] = $file;
@ -390,22 +390,23 @@ if ($_POST['action'] == 'send')
{ {
$mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>'; $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>';
// Insertion action $error=0;
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
$actioncomm = new ActionComm($db);
$actioncomm->type_id = $actiontypeid;
$actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg;
$actioncomm->date = time(); // L'action est faite maintenant
$actioncomm->percentage = 100;
$actioncomm->contact = new Contact($db,$sendtoid);
$actioncomm->societe = new Societe($db,$propal->socid);
$actioncomm->user = $user; // User qui a fait l'action
$actioncomm->propalrowid = $propal->id;
$ret=$actioncomm->add($user); // User qui saisit l'action // Initialisation donnees
if ($ret < 0) $propal->sendtoid=$sendtoid;
$propal->actiontypecode=$actiontypecode;
$propal->actionmsg = $actionmsg;
$propal->actionmsg2= $actionmsg2;
$propal->propalrowid=$propal->id;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('PROPAL_SENTBYMAIL',$propal,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if ($error)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }

View File

@ -617,19 +617,19 @@ if ($_POST['action'] == 'send')
if($subject == '') if($subject == '')
{ {
$subject = $langs->trans('Order').' '.$commande->ref; $subject = $langs->transnoentities('Order').' '.$commande->ref;
} }
$actiontypeid=8; $actiontypecode='AC_COM';
$actionmsg = $langs->trans('MailSentBy').' '.$from.' '.$langs->trans('To').' '.$sendto.'.<br>'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message) if ($message)
{ {
$actionmsg.=$langs->trans('TextUsedInTheMessageBody').' :<br>'; $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message; $actionmsg.=$message;
} }
$actionmsg2=$langs->trans('SendOrderByMail'); $actionmsg2=$langs->transnoentities('SendOrderByMail');
} }
$filepath[0] = $file; $filepath[0] = $file;
@ -656,22 +656,23 @@ if ($_POST['action'] == 'send')
{ {
$mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>'; $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>';
// Insertion action $error=0;
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
$actioncomm = new ActionComm($db);
$actioncomm->type_id = $actiontypeid;
$actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg;
$actioncomm->date = time(); // L'action est faite maintenant
$actioncomm->percentage = 100;
$actioncomm->contact = new Contact($db,$sendtoid);
$actioncomm->societe = new Societe($db,$commande->socid);
$actioncomm->user = $user; // User qui a fait l'action
$actioncomm->orderrowid = $commande->id;
$ret=$actioncomm->add($user); // User qui saisit l'action // Initialisation donnees
if ($ret < 0) $commande->sendtoid=$sendtoid;
$commande->actiontypecode=$actiontypecode;
$commande->actionmsg = $actionmsg;
$commande->actionmsg2= $actionmsg2;
$commande->orderrowid=$commande->id;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('ORDER_SENTBYMAIL',$commande,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if ($error)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }

View File

@ -1007,26 +1007,26 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
} }
$actiontypecode='AC_FAC'; $actiontypecode='AC_FAC';
$actionmsg ="Mail envoyé par ".$from." à ".$sendto.".\n"; $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->trans('To').' '.$sendto.".\n";
if ($message) if ($message)
{ {
$actionmsg.="Texte utilisé dans le corps du message:\n"; $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message; $actionmsg.=$message;
} }
$actionmsg2='Envoi facture par mail'; $actionmsg2=$langs->transnoentities('SendInvoiceByMail');
} }
if ($_POST['action'] == 'relance') if ($_POST['action'] == 'relance')
{ {
$subject = 'Relance facture '.$fac->ref; $subject = 'Relance facture '.$fac->ref;
$actiontypecode='AC_FAC'; $actiontypecode='AC_FAC';
$actionmsg="Mail envoyé par ".$from." à ".$sendto.".\n"; $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message) { if ($message) {
$actionmsg.="Texte utilisé dans le corps du message:\n"; $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message; $actionmsg.=$message;
} }
$actionmsg2='Relance facture par mail'; $actionmsg2=$langs->transnoentities('ReSendInvoiceByMail');
} }
$filepath[0] = $file; $filepath[0] = $file;
@ -1053,22 +1053,23 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
{ {
$mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>'; $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>';
// Insertion action $error=0;
require_once(DOL_DOCUMENT_ROOT.'/contact.class.php');
require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
$actioncomm = new ActionComm($db);
$actioncomm->type_code = $actiontypecode;
$actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg;
$actioncomm->date = time(); // L'action est faite maintenant
$actioncomm->percentage = 100;
$actioncomm->contact = new Contact($db,$sendtoid);
$actioncomm->societe = new Societe($db,$fac->socid);
$actioncomm->user = $user; // User qui a fait l'action
$actioncomm->facid = $fac->id;
$ret=$actioncomm->add($user); // User qui saisit l'action // Initialisation donnees
if ($ret < 0) $fac->sendtoid=$sendtoid;
$fac->actiontypecode=$actiontypecode;
$fac->actionmsg = $actionmsg;
$fac->actionmsg2= $actionmsg2;
$fac->facid=$fac->id;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_SENTBYMAIL',$fac,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if ($error)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }

View File

@ -155,6 +155,7 @@ class Conf
// Module agenda // Module agenda
$this->agenda->enabled=defined('MAIN_MODULE_AGENDA')?MAIN_MODULE_AGENDA:0; $this->agenda->enabled=defined('MAIN_MODULE_AGENDA')?MAIN_MODULE_AGENDA:0;
$this->agenda->dir_temp=DOL_DATA_ROOT."/agenda/temp";
// Module bookmark // Module bookmark
$this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0; $this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0;

View File

@ -378,6 +378,14 @@ if ($modulepart)
$encoding='UTF-8'; $encoding='UTF-8';
$original_file=$conf->webcal->dir_temp.'/'.$original_file; $original_file=$conf->webcal->dir_temp.'/'.$original_file;
} }
// Wrapping for webcalexport
if ($modulepart == 'agenda')
{
$accessallowed=1;
$encoding='UTF-8';
$original_file=$conf->agenda->dir_temp.'/'.$original_file;
}
} }
// Basic protection (against external users only) // Basic protection (against external users only)

View File

@ -47,7 +47,7 @@ class InterfaceLogevents
{ {
$this->db = $DB ; $this->db = $DB ;
$this->name = "Eventsynchro"; $this->name = "Logevents";
$this->family = "core"; $this->family = "core";
$this->description = "Les triggers de ce composant permettent de logguer les evenements Dolibarr (modification status des objets)."; $this->description = "Les triggers de ce composant permettent de logguer les evenements Dolibarr (modification status des objets).";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version

View File

@ -22,3 +22,6 @@ AllActions=Toutes les actions/tasks
ViewList=View list ViewList=View list
ViewCal=View calendar ViewCal=View calendar
ViewWithPredefinedFilters=View with predefined filters ViewWithPredefinedFilters=View with predefined filters
AutoActions=Automatic creation of actions
AgendaAutoActionDesc=Define here, actions for which you want Dolibarr to creat automatically an action in agenda. If nothing is checked (by default), only manual actions will be included in agenda.
AgendaSetupOtherDesc=This page allows to configure other parameters.

View File

@ -22,3 +22,6 @@ AllActions=Toutes les actions/taches
ViewList=Voir liste ViewList=Voir liste
ViewCal=Voir calendrier ViewCal=Voir calendrier
ViewWithPredefinedFilters=Vues avec filtres prédéfinis ViewWithPredefinedFilters=Vues avec filtres prédéfinis
AutoActions=Création automatiques des actions
AgendaAutoActionDesc=Définissez dans cet onglet, les actions pour lesquels dolibarr créera automatique une tache dans l'agenda. Si aucune case n'est cochée (par défaut), seules les actions manuelles seront incluses dans l'agenda.
AgendaSetupOtherDesc=Cette page permet de configurer les autres paramètres.

View File

@ -307,12 +307,10 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
/** /**
\file htdocs/lib/company.lib.php \brief Define head array for tabs of security setup pages
\brief Ensemble de fonctions de base pour le module societe \return Array of head
\ingroup societe
\version $Id$ \version $Id$
*/ */
function security_prepare_head() function security_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf, $user;

View File

@ -195,4 +195,29 @@ function show_array_last_actions_done($max=5)
} }
} }
/**
\brief Define head array for tabs of agenda setup pages
\return Array of head
\version $Id$
*/
function agenda_prepare_head()
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/agenda.php";
$head[$h][1] = $langs->trans("AutoActions");
$head[$h][2] = 'autoactions';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php";
$head[$h][1] = $langs->trans("Other");
$head[$h][2] = 'xcal';
$h++;
return $head;
}
?> ?>

View File

@ -14,15 +14,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/lib/xcal.lib.php \file htdocs/lib/xcal.lib.php
\brief Function to manage calendar files (vcal/ical/...) \brief Function to manage calendar files (vcal/ical/...)
\version $Revision$ \version $Id$
*/ */
/** /**

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-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 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
@ -15,15 +15,12 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/notify.class.php \file htdocs/notify.class.php
\brief Fichier de la classe de gestion des notifications \brief Fichier de la classe de gestion des notifications
\version $Revision$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/lib/CMailFile.class.php"); require_once(DOL_DOCUMENT_ROOT ."/lib/CMailFile.class.php");

View File

@ -135,32 +135,10 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
{ {
$msg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$from,$sendto).'.</div>'; $msg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$from,$sendto).'.</div>';
// Insertion action
$actioncomm = new ActionComm($db);
$actioncomm->type_id = $actiontypeid;
$actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg;
$actioncomm->date = time();
$actioncomm->percentage = 100;
$actioncomm->contact = new Contact($db,$sendtoid);
$actioncomm->societe = new Societe($db,$fac->socid);
$actioncomm->user = $user; // User qui a fait l'action
$actioncomm->facid = $fac->id;
$ret=$actioncomm->add($user); // User qui saisi l'action
if ($ret < 0)
{
dolibarr_print_error($db);
}
else
{
// Renvoie sur la fiche // Renvoie sur la fiche
Header("Location: facture.php?facid=".$fac->id."&msg=".urlencode($msg)); Header("Location: facture.php?facid=".$fac->id."&msg=".urlencode($msg));
exit; exit;
} }
}
else else
{ {
$msg='<div class="error">'.$langs->trans("ErrorFailedToSendMail",$from,$sendto).' !</div>'; $msg='<div class="error">'.$langs->trans("ErrorFailedToSendMail",$from,$sendto).' !</div>';

View File

@ -15,8 +15,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
@ -25,7 +23,7 @@
\brief Ensemble des fonctions permettant d'acceder a la database webcalendar. \brief Ensemble des fonctions permettant d'acceder a la database webcalendar.
\author Rodolphe Quiedeville. \author Rodolphe Quiedeville.
\author Laurent Destailleur. \author Laurent Destailleur.
\version $Revision$ \version $Id$
*/ */

View File

@ -33,9 +33,8 @@ require_once(DOL_DOCUMENT_ROOT.'/webcal/webcal.class.php');
function llxHeader() { print '<html><title>Export cal</title><body>'; } function llxHeader() { print '<html><title>Export cal</title><body>'; }
function llxFooter() { print '</body></html>'; } function llxFooter() { print '</body></html>'; }
// Check config // Check config
if (empty($conf->global->PHPWEBCALENDAR_URL)) if (! $conf->webcal->enabled && empty($conf->global->PHPWEBCALENDAR_URL))
{ {
$user->getrights(); $user->getrights();