diff --git a/ChangeLog b/ChangeLog index 1195325e5a6..518acca1be4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 2.9 compared to 2.8 ***** For users: +- New: Can set a past delay to limit calendar export. - New: Can join files on emailing campaigns. - New: Add statistics on trips and expenses module. - New: Can reopen a closed customer order. diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 7e77e042428..10f34512496 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -46,9 +46,10 @@ if ($actionsave) $db->begin(); $i+=dolibarr_set_const($db,'MAIN_AGENDA_XCAL_EXPORTKEY',trim($_POST["MAIN_AGENDA_XCAL_EXPORTKEY"]),'chaine',0,'',$conf->entity); + $i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_PAST_DELAY',trim($_POST["MAIN_AGENDA_EXPORT_PAST_DELAY"]),'chaine',0,'',$conf->entity); $i+=dolibarr_set_const($db,'MAIN_AGENDA_EXPORT_CACHE',trim($_POST["MAIN_AGENDA_EXPORT_CACHE"]),'chaine',0,'',$conf->entity); - if ($i >= 2) + if ($i >= 3) { $db->commit(); $mesg = "".$langs->trans("SetupSaved").""; @@ -66,6 +67,8 @@ if ($actionsave) * View */ +if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; + llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; @@ -98,6 +101,12 @@ print " "; print ""; print ""; +print "".$langs->trans("PastDelayVCalExport").""; +print "global->MAIN_AGENDA_EXPORT_PAST_DELAY) . "\" size=\"10\"> ".$langs->trans("days").""; +print " "; +print ""; + +print ""; print "".$langs->trans("UseACacheDelay").""; print "global->MAIN_AGENDA_EXPORT_CACHE) . "\" size=\"10\">"; print " "; diff --git a/htdocs/comm/action/actioncomm.class.php b/htdocs/comm/action/actioncomm.class.php index b49c6a6600a..72db58899d8 100644 --- a/htdocs/comm/action/actioncomm.class.php +++ b/htdocs/comm/action/actioncomm.class.php @@ -585,6 +585,7 @@ class ActionComm global $conf,$langs,$dolibarr_main_url_root; require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); + require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".sizeof($filters), LOG_DEBUG); @@ -609,12 +610,14 @@ class ActionComm $buildfile=true; $login='';$logina='';$logind='';$logint=''; + $now = dol_now(); + if ($cachedelay) { - $now = gmmktime(); - if (filemtime($outputfile) > ($now - $cachedelay)) + $nowgmt = dol_now('gmt'); + if (filemtime($outputfile) > ($nowgmt - $cachedelay)) { - dol_syslog("ActionComm::build_exportfile file ".$outputfile." not older than now - cachedelay (".$now." - ".$cachedelay."). Build is canceled"); + dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); $buildfile = false; } } @@ -625,8 +628,8 @@ class ActionComm $eventarray=array(); $sql = "SELECT a.id,"; - $sql.= " a.datep,"; - $sql.= " a.datep2,"; + $sql.= " a.datep,"; // Start + $sql.= " a.datep2,"; // End $sql.= " a.durationp,"; $sql.= " a.datec, a.tms as datem,"; $sql.= " a.note, a.label, a.fk_action as type_id,"; @@ -644,7 +647,8 @@ class ActionComm $sql.= " WHERE a.fk_action=c.id"; foreach ($filters as $key => $value) { - if ($key == 'year') $sql.=' AND a.datep BETWEEN ( )'; // TODO Put year range + if ($key == 'notolderthan') $sql.=" AND a.datep >= '".$this->db->idate($now-($value*24*60*60))."'"; + if ($key == 'year') $sql.=" AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($value,1))."' AND '".$this->db->idate(dol_get_last_day($value,12))."'"; if ($key == 'idaction') $sql.=' AND a.id='.$value; if ($key == 'login') { @@ -680,8 +684,8 @@ class ActionComm } } $sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import - //$sql.= " AND a.datep != 'null'"; // To exclude corrupted events and avoid errors in lightning/sunbird import $sql.= " ORDER by datep"; + //print $sql;exit; dol_syslog("ActionComm::build_exportfile select events sql=".$sql); $resql=$this->db->query($sql); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 559dce04b06..a66ab75e936 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1136,6 +1136,7 @@ YourCompanyDoesNotUseVAT=Your company has been defined to not use VAT (Home - Se ##### Agenda ##### AgendaSetup=Actions and agenda module setup PasswordTogetVCalExport=Key to authorize export link +PastDelayVCalExport=Do not export event older than ##### ClickToDial ##### ClickToDialDesc=This module allows to add an icon after the phone number of Dolibarr contacts. A click on this icon, will call a serveur with a particular URL you define below. This can be used to call a call center system from Dolibarr that can call the phone number on a SIP system for example. ##### Point Of Sales (CashDesk) ##### diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index e6fe2443661..035fc1e10e6 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1138,6 +1138,7 @@ YourCompanyDoesNotUseVAT=Votre institution est configurée comme non assujettie ##### Agenda #####= undefined AgendaSetup= Configuration du module actions et agenda PasswordTogetVCalExport= Clé pour autoriser lien export +PastDelayVCalExport=Ne pas exporter les évênements de plus de ##### ClickToDial #####= undefined ClickToDialDesc= Ce module permet d'ajouter un petit picto à côté des numéros de téléphones des contacts. Un clic sur ce picto provoque l'appel de l'URL définie dans ce paramétrage. Ceci permet de provoquer des appels à un serveur de téléphonie depuis Dolibarr qui peut alors composer le numéro sur un system SIP par exemple. ##### Point Of Sales (CashDesk) ##### diff --git a/htdocs/lib/agenda.lib.php b/htdocs/lib/agenda.lib.php index 1b2371348ac..194a5a34552 100644 --- a/htdocs/lib/agenda.lib.php +++ b/htdocs/lib/agenda.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -306,7 +306,7 @@ function agenda_prepare_head() $h++; $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php"; - $head[$h][1] = $langs->trans("Other"); + $head[$h][1] = $langs->trans("Export"); $head[$h][2] = 'xcal'; $h++; diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 3369a12720e..afc0a93fae5 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -51,7 +51,9 @@ if (! empty($_GET["login"])) $filters['login']=$_GET["login"]; if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"]; if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"]; if (! empty($_GET["logind"])) $filters['logind']=$_GET["logind"]; - +// Not older than +if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; +$filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; // Check config if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) @@ -75,6 +77,7 @@ if (empty($_GET["exportkey"]) || $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY != $_ exit; } + // Define filename with prefix on filters predica (each predica set must have on cache file) $filename=''; $shortfilename='';