diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php
index ff960cad722..9b2e89d06b3 100644
--- a/htdocs/actioncomm.class.php
+++ b/htdocs/actioncomm.class.php
@@ -521,6 +521,116 @@ class ActionComm
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;
+ }
+
}
?>
diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php
index 41b57cb24c3..33c9d5a70bb 100644
--- a/htdocs/admin/agenda.php
+++ b/htdocs/admin/agenda.php
@@ -17,78 +17,109 @@
*/
/**
- \file htdocs/admin/agenda.php
+ \file htdocs/admin/agenda_actions.php
\ingroup agenda
- \brief Page de configuration du module agenda
+ \brief Autocreate actions for agenda module setup page
\version $Id$
*/
require("./pre.inc.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)
accessforbidden();
-
$langs->load("admin");
$langs->load("other");
$langs->load("agenda");
-$def = array();
-$actionsave=$_POST["save"];
+$action=$_POST["action"];
-// 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;
$db->begin();
- $i+=dolibarr_set_const($db,'MAIN_PASSWORD_VCALEXPORT',trim($_POST["MAIN_PASSWORD_VCALEXPORT"]),'chaine',0);
-
- if ($i > 0)
- {
- $db->commit();
- $mesg = "".$langs->trans("SetupSaved")."";
- }
- else
- {
- $db->rollback();
- $mesg = "".$langs->trans("SaveFailed")."";
- }
+ foreach ($eventstolog as $key => $arr)
+ {
+ $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();
+ $mesg = "".$langs->trans("SetupSaved")."";
}
/**
- * Vies
+ * Affichage du formulaire de saisie
*/
llxHeader();
$linkback=''.$langs->trans("BackToModuleList").'';
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
-print '
';
+print "
\n";
+
+print $langs->trans("AgendaAutoActionDesc")."
\n";
+print "
\n";
+
+$head=agenda_prepare_head();
+
+dolibarr_fiche_head($head, 'autoactions', $langs->trans("Agenda"));
-print '
\n";
+print '';
+
-clearstatcache();
if ($mesg) print "
$mesg
";
print "
";
-// Show message
-$message='';
-$urlwithouturlroot=eregi_replace(DOL_URL_ROOT.'$','',$dolibarr_main_url_root);
-$urlvcal=''.$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/agendaexport.php?format=vcal&exportkey=...'.'';
-$message.=$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
-$message.='
';
-$urlical=''.$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/agendaexport.php?format=ical&type=event&exportkey=...'.'';
-$message.=$langs->trans("WebCalUrlForVCalExport",'ical',$urlical);
-print info_admin($message);
$db->close();
diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php
index 12bfdef6a1a..b11b792979d 100644
--- a/htdocs/admin/stock.php
+++ b/htdocs/admin/stock.php
@@ -14,15 +14,13 @@
* 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$
*/
/**
\file htdocs/admin/stock.php
\ingroup stock
\brief Page d'administration/configuration du module gestion de stock
- \version $Revision$
+ \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
@@ -97,6 +95,7 @@ llxHeader('',$langs->trans("StockSetup"));
$linkback=''.$langs->trans("BackToModuleList").'';
print_fiche_titre($langs->trans("StockSetup"),$linkback,'setup');
+print '
';
$html=new Form($db);
$var=true;
diff --git a/htdocs/cactioncomm.class.php b/htdocs/cactioncomm.class.php
index 7d02ee66aad..3b2a52fa378 100644
--- a/htdocs/cactioncomm.class.php
+++ b/htdocs/cactioncomm.class.php
@@ -15,17 +15,13 @@
* 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/cactioncomm.class.php
\ingroup commercial
\brief Fichier de la classe des types d'actions commerciales
- \version $Revision$
+ \version $Id$
*/
@@ -62,7 +58,7 @@ class CActionComm {
* \param id id ou code du type d'action à récupérer
* \return int 1=ok, 0=aucune action, -1=erreur
*/
- function fetch($id)
+ function fetch($id)
{
$sql = "SELECT id, code, type, libelle, active";
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index d5d0a48f7e3..8b60ba6672d 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -40,8 +40,10 @@ $sortorder=$_GET["sortorder"];
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
-if (! $sortorder) $sortorder="DESC";
-if (! $sortfield) $sortfield="a.datea";
+if (! $sortorder) $sortorder="ASC";
+if (! $sortfield) $sortfield="a.datec";
+
+$status=isset($_GET["status"])?$_GET["status"]:$_POST["status"];
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
@@ -137,7 +139,7 @@ $nav.=" $year";
$nav.=" \n";
$nav.="".img_next($langs->trans("Next"))."\n";
-print_fiche_titre($title,$nav,$_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,'',$num);
+print_fiche_titre($title,$nav,"");
// Filters
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;
$sql.= ")";
}
+if ($status == 'done') { $sql.= " AND a.percent = 100"; }
+if ($status == 'todo') { $sql.= " AND a.percent < 100"; }
//echo "$sql
";
$actionarray=array();
@@ -327,7 +331,7 @@ function show_day_events($db, $day, $month, $year, $style, $actionarray)
if ($day==$jour && $month==$mois && $year==$annee)
{
if ($i) print "
";
- print $action->getNomUrl(1,10)." ".$action->getLibStatut(3);
+ print $action->getNomUrl(1,9)." ".$action->getLibStatut(3);
$i++;
}
}
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index d3d0b9541d0..6745d37e3e2 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -351,19 +351,19 @@ if ($_POST['action'] == 'send')
if($subject == '')
{
- $subject = $langs->trans('Propal').' '.$propal->ref;
+ $subject = $langs->transnoentities('Propal').' '.$propal->ref;
}
- $actiontypeid=3;
- $actionmsg = $langs->trans('MailSentBy').' '.$from.' '.$langs->trans('To').' '.$sendto.'.
';
+ $actiontypecode='AC_PROP';
+ $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message)
{
- $actionmsg.=$langs->trans('TextUsedInTheMessageBody').' :
';
+ $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message;
}
- $actionmsg2=$langs->trans('SendPropalByMail');
+ $actionmsg2=$langs->transnoentities('SendPropalByMail');
}
$filepath[0] = $file;
@@ -389,23 +389,24 @@ if ($_POST['action'] == 'send')
if ($result)
{
$mesg=''.$langs->trans('MailSuccessfulySent',$from,$sendto).'.
';
+
+ $error=0;
+
+ // Initialisation donnees
+ $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
- // Insertion action
- 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
- if ($ret < 0)
+ if ($error)
{
dolibarr_print_error($db);
}
@@ -415,7 +416,7 @@ if ($_POST['action'] == 'send')
Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&msg='.urlencode($mesg));
exit;
}
- }
+ }
else
{
$langs->load("other");
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index d0f058eabe9..9e0565550d3 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -570,155 +570,156 @@ if ($_REQUEST['action'] == 'remove_file')
*/
if ($_POST['action'] == 'send')
{
- $langs->load('mails');
+ $langs->load('mails');
- $commande= new Commande($db);
- if ( $commande->fetch($_POST['orderid']) )
- {
- $orderref = sanitize_string($commande->ref);
- $file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
-
- if (is_readable($file))
+ $commande= new Commande($db);
+ if ( $commande->fetch($_POST['orderid']) )
{
- $commande->fetch_client();
+ $orderref = sanitize_string($commande->ref);
+ $file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
- if ($_POST['sendto'])
- {
- // Le destinataire a ete fourni via le champ libre
- $sendto = $_POST['sendto'];
- $sendtoid = 0;
- }
- elseif ($_POST['receiver'])
- {
- // Le destinataire a ete fourni via la liste deroulante
- if ($_POST['receiver'] < 0) // Id du tiers
+ if (is_readable($file))
{
- $sendto = $commande->client->email;
- $sendtoid = 0;
- }
- else // Id du contact
- {
- $sendto = $commande->client->contact_get_email($_POST['receiver']);
- $sendtoid = $_POST['receiver'];
- }
- }
+ $commande->fetch_client();
- if (strlen($sendto))
- {
- $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
- $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
- $message = $_POST['message'];
- $sendtocc = $_POST['sendtocc'];
- $deliveryreceipt = $_POST['deliveryreceipt'];
-
- if ($_POST['action'] == 'send')
- {
- $subject = $_POST['subject'];
-
- if($subject == '')
- {
- $subject = $langs->trans('Order').' '.$commande->ref;
- }
-
- $actiontypeid=8;
- $actionmsg = $langs->trans('MailSentBy').' '.$from.' '.$langs->trans('To').' '.$sendto.'.
';
-
- if ($message)
- {
- $actionmsg.=$langs->trans('TextUsedInTheMessageBody').' :
';
- $actionmsg.=$message;
- }
-
- $actionmsg2=$langs->trans('SendOrderByMail');
- }
-
- $filepath[0] = $file;
- $filename[0] = $commande->ref.'.pdf';
- $mimetype[0] = 'application/pdf';
- if ($_FILES['addedfile']['tmp_name'])
- {
- $filepath[1] = $_FILES['addedfile']['tmp_name'];
- $filename[1] = $_FILES['addedfile']['name'];
- $mimetype[1] = $_FILES['addedfile']['type'];
- }
-
- // Envoi de la commande
- require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
- $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
- if ($mailfile->error)
- {
- $mesg=''.$mailfile->error.'
';
- }
- else
- {
- $result=$mailfile->sendfile();
- if ($result)
- {
- $mesg=''.$langs->trans('MailSuccessfulySent',$from,$sendto).'.
';
-
- // Insertion action
- 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
- if ($ret < 0)
+ if ($_POST['sendto'])
{
- dolibarr_print_error($db);
+ // Le destinataire a ete fourni via le champ libre
+ $sendto = $_POST['sendto'];
+ $sendtoid = 0;
}
- else
+ elseif ($_POST['receiver'])
{
- // Renvoie sur la fiche
- Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&msg='.urlencode($mesg));
- exit;
+ // Le destinataire a ete fourni via la liste deroulante
+ if ($_POST['receiver'] < 0) // Id du tiers
+ {
+ $sendto = $commande->client->email;
+ $sendtoid = 0;
+ }
+ else // Id du contact
+ {
+ $sendto = $commande->client->contact_get_email($_POST['receiver']);
+ $sendtoid = $_POST['receiver'];
+ }
}
- }
- else
- {
- $langs->load("other");
- $mesg='';
- if ($mailfile->error)
+
+ if (strlen($sendto))
{
- $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
- $mesg.='
'.$mailfile->error;
+ $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
+ $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
+ $message = $_POST['message'];
+ $sendtocc = $_POST['sendtocc'];
+ $deliveryreceipt = $_POST['deliveryreceipt'];
+
+ if ($_POST['action'] == 'send')
+ {
+ $subject = $_POST['subject'];
+
+ if($subject == '')
+ {
+ $subject = $langs->transnoentities('Order').' '.$commande->ref;
+ }
+
+ $actiontypecode='AC_COM';
+ $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
+
+ if ($message)
+ {
+ $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
+ $actionmsg.=$message;
+ }
+
+ $actionmsg2=$langs->transnoentities('SendOrderByMail');
+ }
+
+ $filepath[0] = $file;
+ $filename[0] = $commande->ref.'.pdf';
+ $mimetype[0] = 'application/pdf';
+ if ($_FILES['addedfile']['tmp_name'])
+ {
+ $filepath[1] = $_FILES['addedfile']['tmp_name'];
+ $filename[1] = $_FILES['addedfile']['name'];
+ $mimetype[1] = $_FILES['addedfile']['type'];
+ }
+
+ // Envoi de la commande
+ require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
+ $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
+ if ($mailfile->error)
+ {
+ $mesg='
'.$mailfile->error.'
';
+ }
+ else
+ {
+ $result=$mailfile->sendfile();
+ if ($result)
+ {
+ $mesg='
'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.
';
+
+ $error=0;
+
+ // Initialisation donnees
+ $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);
+ }
+ else
+ {
+ // Renvoie sur la fiche
+ Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&msg='.urlencode($mesg));
+ exit;
+ }
+ }
+ else
+ {
+ $langs->load("other");
+ $mesg='
';
+ if ($mailfile->error)
+ {
+ $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
+ $mesg.='
'.$mailfile->error;
+ }
+ else
+ {
+ $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
+ }
+ $mesg.='
';
+ }
+ }
}
- else
+ else
{
- $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
+ $langs->load("other");
+ $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').' !
';
+ dolibarr_syslog('Recipient email is empty');
}
- $mesg.='
';
- }
}
- }
- else
- {
- $langs->load("other");
- $mesg=''.$langs->trans('ErrorMailRecipientIsEmpty').' !
';
- dolibarr_syslog('Recipient email is empty');
- }
+ else
+ {
+ $langs->load("other");
+ $mesg=''.$langs->trans('ErrorCantReadFile',$file).'
';
+ dolibarr_syslog('Failed to read file: '.$file);
+ }
}
- else
+ else
{
- $langs->load("other");
- $mesg=''.$langs->trans('ErrorCantReadFile',$file).'
';
- dolibarr_syslog('Failed to read file: '.$file);
+ $langs->load("other");
+ $mesg=''.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
';
+ dolibarr_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.');
}
- }
- else
- {
- $langs->load("other");
- $mesg=''.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
';
- dolibarr_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.');
- }
}
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 2db219a28de..a4947e5cc8c 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1007,26 +1007,26 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
}
$actiontypecode='AC_FAC';
- $actionmsg ="Mail envoyé par ".$from." à ".$sendto.".\n";
+ $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->trans('To').' '.$sendto.".\n";
if ($message)
{
- $actionmsg.="Texte utilisé dans le corps du message:\n";
+ $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message;
}
- $actionmsg2='Envoi facture par mail';
+ $actionmsg2=$langs->transnoentities('SendInvoiceByMail');
}
if ($_POST['action'] == 'relance')
{
$subject = 'Relance facture '.$fac->ref;
$actiontypecode='AC_FAC';
- $actionmsg="Mail envoyé par ".$from." à ".$sendto.".\n";
+ $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message) {
- $actionmsg.="Texte utilisé dans le corps du message:\n";
+ $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message;
}
- $actionmsg2='Relance facture par mail';
+ $actionmsg2=$langs->transnoentities('ReSendInvoiceByMail');
}
$filepath[0] = $file;
@@ -1053,22 +1053,23 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
{
$mesg=''.$langs->trans('MailSuccessfulySent',$from,$sendto).'.
';
- // Insertion action
- 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;
+ $error=0;
+
+ // Initialisation donnees
+ $fac->sendtoid=$sendtoid;
+ $fac->actiontypecode=$actiontypecode;
+ $fac->actionmsg = $actionmsg;
+ $fac->actionmsg2= $actionmsg2;
+ $fac->facid=$fac->id;
- $ret=$actioncomm->add($user); // User qui saisit l'action
- if ($ret < 0)
+ // 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);
}
diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php
index 887b0d47f92..b85c755348e 100644
--- a/htdocs/conf/conf.class.php
+++ b/htdocs/conf/conf.class.php
@@ -155,6 +155,7 @@ class Conf
// Module agenda
$this->agenda->enabled=defined('MAIN_MODULE_AGENDA')?MAIN_MODULE_AGENDA:0;
+ $this->agenda->dir_temp=DOL_DATA_ROOT."/agenda/temp";
// Module bookmark
$this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0;
diff --git a/htdocs/document.php b/htdocs/document.php
index d3d2225ab32..19bd70250c3 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -378,6 +378,14 @@ if ($modulepart)
$encoding='UTF-8';
$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)
diff --git a/htdocs/includes/triggers/interface_all_Logevents.class.php b/htdocs/includes/triggers/interface_all_Logevents.class.php
index c64ddf94c33..50551831567 100644
--- a/htdocs/includes/triggers/interface_all_Logevents.class.php
+++ b/htdocs/includes/triggers/interface_all_Logevents.class.php
@@ -47,7 +47,7 @@ class InterfaceLogevents
{
$this->db = $DB ;
- $this->name = "Eventsynchro";
+ $this->name = "Logevents";
$this->family = "core";
$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
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index c1d46d81a4e..65c7bd07017 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -22,3 +22,6 @@ AllActions=Toutes les actions/tasks
ViewList=View list
ViewCal=View calendar
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.
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang
index 720b9342d29..3085ba35d61 100644
--- a/htdocs/langs/fr_FR/agenda.lang
+++ b/htdocs/langs/fr_FR/agenda.lang
@@ -21,4 +21,7 @@ AllMyActions=Toutes mes actions/taches
AllActions=Toutes les actions/taches
ViewList=Voir liste
ViewCal=Voir calendrier
-ViewWithPredefinedFilters=Vues avec filtres prédéfinis
\ No newline at end of file
+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.
\ No newline at end of file
diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php
index 8df57721f83..ab7a83f154a 100644
--- a/htdocs/lib/admin.lib.php
+++ b/htdocs/lib/admin.lib.php
@@ -307,12 +307,10 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
/**
- \file htdocs/lib/company.lib.php
- \brief Ensemble de fonctions de base pour le module societe
- \ingroup societe
- \version $Id$
+ \brief Define head array for tabs of security setup pages
+ \return Array of head
+ \version $Id$
*/
-
function security_prepare_head()
{
global $langs, $conf, $user;
diff --git a/htdocs/lib/agenda.lib.php b/htdocs/lib/agenda.lib.php
index 67ca987d6d9..f82d16fafcd 100644
--- a/htdocs/lib/agenda.lib.php
+++ b/htdocs/lib/agenda.lib.php
@@ -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;
+}
+
?>
\ No newline at end of file
diff --git a/htdocs/lib/xcal.lib.php b/htdocs/lib/xcal.lib.php
index b555a9ea67e..49b6e07cf2e 100644
--- a/htdocs/lib/xcal.lib.php
+++ b/htdocs/lib/xcal.lib.php
@@ -14,15 +14,13 @@
* 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$
*/
/**
\file htdocs/lib/xcal.lib.php
\brief Function to manage calendar files (vcal/ical/...)
- \version $Revision$
+ \version $Id$
*/
/**
diff --git a/htdocs/notify.class.php b/htdocs/notify.class.php
index c547932cdd1..9bf7acd8121 100644
--- a/htdocs/notify.class.php
+++ b/htdocs/notify.class.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2006 Laurent Destailleur
+ * Copyright (C) 2004-2008 Laurent Destailleur
*
* 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
@@ -15,15 +15,12 @@
* 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/notify.class.php
\brief Fichier de la classe de gestion des notifications
- \version $Revision$
+ \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT ."/lib/CMailFile.class.php");
diff --git a/htdocs/telephonie/client/facture.php b/htdocs/telephonie/client/facture.php
index c3be953c14e..b00188ea9c1 100644
--- a/htdocs/telephonie/client/facture.php
+++ b/htdocs/telephonie/client/facture.php
@@ -135,31 +135,9 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
{
$msg=''.$langs->trans("MailSuccessfulySent",$from,$sendto).'.
';
- // 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
Header("Location: facture.php?facid=".$fac->id."&msg=".urlencode($msg));
exit;
- }
}
else
{
diff --git a/htdocs/webcal/webcal.class.php b/htdocs/webcal/webcal.class.php
index 5f58daade8b..9b05e291704 100644
--- a/htdocs/webcal/webcal.class.php
+++ b/htdocs/webcal/webcal.class.php
@@ -15,8 +15,6 @@
* 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$
*/
/**
@@ -25,7 +23,7 @@
\brief Ensemble des fonctions permettant d'acceder a la database webcalendar.
\author Rodolphe Quiedeville.
\author Laurent Destailleur.
- \version $Revision$
+ \version $Id$
*/
diff --git a/htdocs/webcal/webcalexport.php b/htdocs/webcal/webcalexport.php
index 42e8d7bd76a..13b3cbf2c35 100644
--- a/htdocs/webcal/webcalexport.php
+++ b/htdocs/webcal/webcalexport.php
@@ -33,9 +33,8 @@ require_once(DOL_DOCUMENT_ROOT.'/webcal/webcal.class.php');
function llxHeader() { print 'Export cal'; }
function llxFooter() { print ''; }
-
// Check config
-if (empty($conf->global->PHPWEBCALENDAR_URL))
+if (! $conf->webcal->enabled && empty($conf->global->PHPWEBCALENDAR_URL))
{
$user->getrights();