Fix: Debug and enhance agenda external ical view

This commit is contained in:
Laurent Destailleur 2011-06-10 22:05:07 +00:00
parent 47e279d40d
commit 159d6418d5
7 changed files with 689 additions and 598 deletions

View File

@ -29,6 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php');
require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
@ -54,7 +55,9 @@ if ($actionsave)
{ {
$db->begin(); $db->begin();
$res=dolibarr_set_const($db,'ENABLE_AGENDA_EXT'.$i,trim(GETPOST("ENABLE_AGENDA_EXT".$i)),'chaine',0); $disableext=GETPOST("AGENDA_DISABLE_EXT");
if ($disableext) $disableext=0; else $disableext=1;
$res=dolibarr_set_const($db,'AGENDA_DISABLE_EXT',$disableext,'chaine',0);
$i=1; $i=1;
$error=0; $error=0;
@ -115,7 +118,9 @@ dol_fiche_head($head, 'extsites', $langs->trans("Agenda"));
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print $langs->trans("ExtSitesEnableThisTool").' '.$form->selectyesno("ENABLE_AGENDA_EXT",(GETPOST("ENABLE_AGENDA_EXT"))?GETPOST("ENABLE_AGENDA_EXT"):$conf->global->ENABLE_AGENDA_EXT,1).'<br><br>'; $selectedvalue=(GETPOST("AGENDA_DISABLE_AGENDA"))?GETPOST("AGENDA_DISABLE_EXT"):$conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
print $langs->trans("ExtSitesEnableThisTool").' '.$form->selectyesno("AGENDA_DISABLE_EXT",$selectedvalue,1).'<br><br>';
$var=false; $var=false;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";

View File

@ -638,7 +638,8 @@ class ActionComm extends CommonObject
if ($cachedelay) if ($cachedelay)
{ {
$nowgmt = dol_now(); $nowgmt = dol_now();
if (filemtime($outputfile) > ($nowgmt - $cachedelay)) include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay))
{ {
dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled");
$buildfile = false; $buildfile = false;

View File

@ -86,6 +86,7 @@ class ical
// is this text vcalendar standart text ? on line 1 is BEGIN:VCALENDAR // is this text vcalendar standart text ? on line 1 is BEGIN:VCALENDAR
if (!stristr($this->file_text[0],'BEGIN:VCALENDAR')) return 'error not VCALENDAR'; if (!stristr($this->file_text[0],'BEGIN:VCALENDAR')) return 'error not VCALENDAR';
$insidealarm=0;
foreach ($this->file_text as $text) foreach ($this->file_text as $text)
{ {
$text = trim($text); // trim one line $text = trim($text); // trim one line
@ -106,6 +107,11 @@ class ical
$type = "VEVENT"; $type = "VEVENT";
break; break;
case "BEGIN:VFREEBUSY":
$this->freebusy_count = $this->freebusy_count+1; // new event begin
$type = "VFREEBUSY";
break;
case "BEGIN:VCALENDAR": // all other special string case "BEGIN:VCALENDAR": // all other special string
case "BEGIN:DAYLIGHT": case "BEGIN:DAYLIGHT":
case "BEGIN:VTIMEZONE": case "BEGIN:VTIMEZONE":
@ -115,6 +121,7 @@ class ical
case "END:VTODO": // end special text - goto VCALENDAR key case "END:VTODO": // end special text - goto VCALENDAR key
case "END:VEVENT": case "END:VEVENT":
case "END:VFREEBUSY":
case "END:VCALENDAR": case "END:VCALENDAR":
case "END:DAYLIGHT": case "END:DAYLIGHT":
@ -123,8 +130,16 @@ class ical
$type = "VCALENDAR"; $type = "VCALENDAR";
break; break;
// Manage VALARM that are inside a VEVENT to avoid fields of VALARM to overwrites fields of VEVENT
case "BEGIN:VALARM":
$insidealarm=1;
break;
case "END:VALARM":
$insidealarm=0;
break;
default: // no special string default: // no special string
$this->add_to_array($type, $key, $value); // add to array if (! $insidealarm) $this->add_to_array($type, $key, $value); // add to array
break; break;
} }
} }
@ -133,7 +148,7 @@ class ical
} }
/** /**
* Add to $this->ical array one value and key. Type is VTODO, VEVENT, VCALENDAR ... . * Add to $this->ical array one value and key. Type is VTODO, VEVENT, VFREEBUSY, VCALENDAR ... .
* *
* @param string $type * @param string $type
* @param string $key * @param string $key
@ -141,12 +156,16 @@ class ical
*/ */
function add_to_array($type, $key, $value) function add_to_array($type, $key, $value)
{ {
//print 'type='.$type.' key='.$key.' value='.$value.'<br>'."\n";
if ($key == false) if ($key == false)
{ {
$key = $this->last_key; $key = $this->last_key;
switch ($type) switch ($type)
{ {
case 'VEVENT': $value = $this->cal[$type][$this->event_count][$key].$value;break; case 'VEVENT': $value = $this->cal[$type][$this->event_count][$key].$value;break;
case 'VFREEBUSY': $value = $this->cal[$type][$this->freebusy_count][$key].$value;break;
case 'VTODO': $value = $this->cal[$type][$this->todo_count][$key].$value;break; case 'VTODO': $value = $this->cal[$type][$this->todo_count][$key].$value;break;
} }
} }
@ -157,10 +176,14 @@ class ical
if (stristr($key,"DTSTART") or stristr($key,"DTEND") or stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE")) if (stristr($key,"DTSTART") or stristr($key,"DTEND") or stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE"))
{ {
if (stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE")) if (stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE"))
{
list($key,$value) = array($key,$value); list($key,$value) = array($key,$value);
}
else else
{
list($key,$value) = $this->ical_dt_date($key,$value); list($key,$value) = $this->ical_dt_date($key,$value);
} }
}
switch ($type) switch ($type)
{ {
@ -172,6 +195,10 @@ class ical
$this->cal[$type][$this->event_count][$key] = $value; $this->cal[$type][$this->event_count][$key] = $value;
break; break;
case "VFREEBUSY":
$this->cal[$type][$this->freebusy_count][$key] = $value;
break;
default: default:
$this->cal[$type][$key] = $value; $this->cal[$type][$key] = $value;
break; break;
@ -228,15 +255,14 @@ class ical
$ical_date = str_replace('T', '', $ical_date); $ical_date = str_replace('T', '', $ical_date);
$ical_date = str_replace('Z', '', $ical_date); $ical_date = str_replace('Z', '', $ical_date);
$ntime=0;
// TIME LIMITED EVENT // TIME LIMITED EVENT
preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})([0-9]{0,2})/', $ical_date, $date); if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})([0-9]{0,2})/', $ical_date, $date))
$ntime=dol_mktime($date[4], $date[5], $date[6], $date[2],$date[3], $date[1], true);
// UNIX timestamps can't deal with pre 1970 dates //if (empty($date[4])) print 'Error bad date: '.$ical_date.' - date1='.$date[1];
if ($date[1] <= 1970) //print dol_print_date($ntime,'dayhour');exit;
{ return $ntime; // ntime is a GTM time
$date[1] = 1971;
}
return mktime($date[4], $date[5], $date[6], $date[2],$date[3], $date[1]);
} }
/** /**
@ -307,6 +333,16 @@ class ical
return $this->cal['VEVENT']; return $this->cal['VEVENT'];
} }
/**
* Return eventlist array (not sort eventlist array)
*
* @return array
*/
function get_freebusy_list()
{
return $this->cal['VFREEBUSY'];
}
/** /**
* Return todo array (not sort todo array) * Return todo array (not sort todo array)
* *

View File

@ -338,7 +338,7 @@ if ($resql)
// Create a new object action // Create a new object action
$event=new ActionComm($db); $event=new ActionComm($db);
$event->id=$obj->id; $event->id=$obj->id;
$event->datep=$db->jdate($obj->datep); $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
$event->datef=$db->jdate($obj->datep2); $event->datef=$db->jdate($obj->datep2);
$event->type_code=$obj->code; $event->type_code=$obj->code;
$event->libelle=$obj->label; $event->libelle=$obj->label;
@ -447,14 +447,15 @@ if ($showbirthday)
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$event=new ActionComm($db); $event=new ActionComm($db);
$event->id=$obj->rowid; // We put contact id in action id for birthdays events $event->id=$obj->rowid; // We put contact id in action id for birthdays events
$datebirth=dol_stringtotime($obj->birthday); $datebirth=dol_stringtotime($obj->birthday,1);
//print 'ee'.$obj->birthday.'-'.$datebirth; //print 'ee'.$obj->birthday.'-'.$datebirth;
$datearray=dol_getdate($datebirth,true); $datearray=dol_getdate($datebirth,true);
$event->datep=dol_mktime(0,0,0,$datearray['mon'],$datearray['mday'],$year); $event->datep=dol_mktime(0,0,0,$datearray['mon'],$datearray['mday'],$year,true); // For full day events, date are also GMT but they wont but converted during output
$event->datef=$event->datep; $event->datef=$event->datep;
$event->type_code='BIRTHDAY'; $event->type_code='BIRTHDAY';
$event->libelle=$langs->trans("Birthday").' '.$obj->firstname.' '.$obj->name; $event->libelle=$langs->trans("Birthday").' '.$obj->firstname.' '.$obj->name;
$event->percentage=100; $event->percentage=100;
$event->fulldayevent=true;
$event->date_start_in_calendar=$event->datep; $event->date_start_in_calendar=$event->datep;
$event->date_end_in_calendar=$event->datef; $event->date_end_in_calendar=$event->datef;
@ -485,19 +486,40 @@ if ($showbirthday)
} }
//Exernal Calendars //Exernal Calendars
$listofextcals=array();
if ($conf->global->MAIN_FEATURES_LEVEL>=2) if ($conf->global->MAIN_FEATURES_LEVEL>=2)
if ($conf->global->ENABLE_AGENDA_EXT==1 && $conf->global->AGENDA_EXT_NB>0)
{ {
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/ical.class.php"); if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
$numcals= $conf->global->AGENDA_EXT_NB;
$i=1;
while ($i<=$numcals)
{ {
$i=0;
while($i < $conf->global->AGENDA_EXT_NB)
{
$i++;
$paramkey='AGENDA_EXT_SRC'.$i; $paramkey='AGENDA_EXT_SRC'.$i;
$url=$conf->global->$paramkey; $url=$conf->global->$paramkey;
$paramkey='AGENDA_EXT_NAME'.$i;
$namecal = $conf->global->$paramkey;
$paramkey='AGENDA_EXT_COLOR'.$i;
$colorcal = $conf->global->$paramkey;
if ($url && $namecal) $listofextcals[]=array('src'=>$url,'name'=>$namecal,'color'=>$colorcal);
}
}
}
if (sizeof($listofextcals))
{
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/ical.class.php");
foreach($listofextcals as $extcal)
{
$url=$extcal['src'];
$namecal = $extcal['name'];
$colorcal = $extcal['color'];
//print "url=".$url." namecal=".$namecal." colorcal=".$colorcal;
$ical=new ical(); $ical=new ical();
$ical->parse($url); $ical->parse($url);
$icalevents= $ical->get_event_list(); $icalevents=array();
if (is_array($ical->get_event_list())) $icalevents=array_merge($icalevents,$ical->get_event_list());
if (is_array($ical->get_freebusy_list())) $icalevents=array_merge($icalevents,$ical->get_freebusy_list());
if(count($icalevents)>0) if(count($icalevents)>0)
{ {
foreach($icalevents as $icalevent) foreach($icalevents as $icalevent)
@ -507,8 +529,11 @@ if ($conf->global->ENABLE_AGENDA_EXT==1 && $conf->global->AGENDA_EXT_NB>0)
$addevent = false; $addevent = false;
if($icalevent['DTSTART;VALUE=DATE']) //fullday event if($icalevent['DTSTART;VALUE=DATE']) //fullday event
{ {
$datestart=$db->jdate($icalevent['DTSTART;VALUE=DATE']); // For full day events, date are also GMT but they wont but converted using tz during output
$dateend=$db->jdate($icalevent['DTEND;VALUE=DATE']); $datestart=dol_stringtotime($icalevent['DTSTART;VALUE=DATE'],1);
$dateend=dol_stringtotime($icalevent['DTEND;VALUE=DATE'],1)-1; // We remove one second to get last second of day
//print 'x'.$datestart.'-'.$dateend;exit;
//print dol_print_date($dateend,'dayhour','gmt');
$event->fulldayevent=true; $event->fulldayevent=true;
$addevent=true; $addevent=true;
} }
@ -525,14 +550,11 @@ if ($conf->global->ENABLE_AGENDA_EXT==1 && $conf->global->AGENDA_EXT_NB>0)
if($addevent) if($addevent)
{ {
$paramkey='AGENDA_EXT_NAME'.$i;
$namecal = $conf->global->$paramkey;
$paramkey='AGENDA_EXT_COLOR'.$i;
$colorcal = $conf->global->$paramkey;
$event->id=$icalevent['UID']; $event->id=$icalevent['UID'];
$event->icalname=$namecal; $event->icalname=$namecal;
$event->icalcolor=$colorcal; $event->icalcolor=$colorcal;
$usertime=($_SESSION['dol_tz']*60*60)+($_SESSION['dol_dst']*60*60); //$usertime=($_SESSION['dol_tz']*60*60)+($_SESSION['dol_dst']*60*60);
$usertime=0; // We dont modify date because we want to have date into memory datep and datef stored as GMT date. Compensation will be done during output.
$event->datep=$datestart+$usertime; $event->datep=$datestart+$usertime;
$event->datef=$dateend+$usertime; $event->datef=$dateend+$usertime;
$event->type_code="ICALEVENT"; $event->type_code="ICALEVENT";
@ -567,23 +589,25 @@ if ($conf->global->ENABLE_AGENDA_EXT==1 && $conf->global->AGENDA_EXT_NB>0)
// Loop on each day covered by action to prepare an index to show on calendar // Loop on each day covered by action to prepare an index to show on calendar
$loop=true; $j=0; $loop=true; $j=0;
// daykey must be date that represent day box in calendar so must be a user time
$daykey=dol_mktime(0,0,0,$mois,$jour,$annee); $daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
$daykeygmt=dol_mktime(0,0,0,$mois,$jour,$annee,true,0,false);
do do
{ {
//if ($event->fulldayevent) print dol_print_date($daykeygmt,'dayhour','gmt').'-'.dol_print_date($daykey,'dayhour','gmt').'-'.dol_print_date($event->date_end_in_calendar,'dayhour','gmt').' ';
$eventarray[$daykey][]=$event; $eventarray[$daykey][]=$event;
$daykey+=60*60*24; $daykey+=60*60*24; $daykeygmt+=60*60*24; // Add one day
if ($daykey > $event->date_end_in_calendar) $loop=false; if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) $loop=false;
} }
while ($loop); while ($loop);
} }
} }
} }
} }
$i++;
} }
} }
$maxlength=16; $maxlength=18;
$cachethirdparties=array(); $cachethirdparties=array();
$cachecontacts=array(); $cachecontacts=array();
@ -772,7 +796,7 @@ llxFooter('$Date$ - $Revision$');
* @param $showinfo Add extended information (used by day view) * @param $showinfo Add extended information (used by day view)
* @param $minheight Minimum height for each event. 60px by default. * @param $minheight Minimum height for each event. 60px by default.
*/ */
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxPrint=0, $maxnbofchar=14, $newparam='', $showinfo=0, $minheight=60) function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxPrint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
global $filter, $filtera, $filtert, $filterd, $status; global $filter, $filtera, $filtert, $filterd, $status;
@ -827,18 +851,26 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
else $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); else $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
//print "x".$color; //print "x".$color;
print '<div class="event">';
print '<table class="cal_event" style="background: #'.$color.'; -moz-border-radius:4px; " width="100%"><tr>'; print '<table class="cal_event" style="background: #'.$color.'; -moz-border-radius:4px; " width="100%"><tr>';
print '<td nowrap="nowrap">'; print '<td nowrap="nowrap">';
if ($event->type_code == 'BIRTHDAY') // It's a birthday
{
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
}
if ($event->type_code != 'BIRTHDAY') if ($event->type_code != 'BIRTHDAY')
{ {
// Picto
if ($showinfo && $event->type_code != 'ICALEVENT') if ($showinfo && $event->type_code != 'ICALEVENT')
{ {
print $event->getNomUrl(2).' '; print $event->getNomUrl(2).' ';
} }
// Date
if (empty($event->fulldayevent)) if (empty($event->fulldayevent))
{ {
$daterange='';
// Show hours (start ... end) // Show hours (start ... end)
$tmpyearstart = date('Y',$event->date_start_in_calendar); $tmpyearstart = date('Y',$event->date_start_in_calendar);
$tmpmonthstart = date('m',$event->date_start_in_calendar); $tmpmonthstart = date('m',$event->date_start_in_calendar);
@ -849,11 +881,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
// Hour start // Hour start
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour)
{ {
print dol_print_date($event->date_start_in_calendar,'%H:%M'); $daterange.=dol_print_date($event->date_start_in_calendar,'%H:%M');
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{ {
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend)
print '-'; $daterange.='-';
//else //else
//print '...'; //print '...';
} }
@ -862,16 +894,28 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
{ {
if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend) if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend)
{ {
print '...'; $daterange.='...';
} }
} }
// Hour end // Hour end
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{ {
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
print dol_print_date($event->date_end_in_calendar,'%H:%M'); $daterange.=dol_print_date($event->date_end_in_calendar,'%H:%M');
}
if ($event->type_code == 'ICALEVENT') $daterange.='<br>('.$event->icalname.')';
//print $daterange;
if ($event->type_code != 'ICALEVENT')
{
$savlabel=$event->libelle;
$event->libelle=$daterange;
print $event->getNomUrl(0);
$event->libelle=$savlabel;
}
else
{
print $daterange;
} }
if ($event->type_code == 'ICALEVENT') print '<br>('.$event->icalname.')';
print '<br>'."\n"; print '<br>'."\n";
} }
else else
@ -882,6 +926,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
} }
} }
// Show label
if ($event->type_code == 'ICALEVENT')
{
if ($event->fulldayevent) print '('.$event->icalname.')<br>';
print $event->libelle;
}
else print $event->getNomUrl(0,$maxnbofchar,'cal_event');
// If action related to company / contact // If action related to company / contact
$linerelatedto='';$length=16; $linerelatedto='';$length=16;
if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2); if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2);
@ -908,20 +960,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($linerelatedto) $linerelatedto.=' / '; if ($linerelatedto) $linerelatedto.=' / ';
$linerelatedto.=$contact->getNomUrl(1,'',$length); $linerelatedto.=$contact->getNomUrl(1,'',$length);
} }
if ($linerelatedto) print $linerelatedto.'<br>'; if ($linerelatedto) print '<br>'.$linerelatedto;
// Show label
if($event->type_code == 'ICALEVENT')
{
if ($event->fulldayevent) print '('.$event->icalname.')<br>';
print $event->libelle;
}
else print $event->getNomUrl(0,$maxnbofchar,'cal_event');
}
else // It's a birthday
{
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
} }
// Show location // Show location
if ($showinfo) if ($showinfo)
{ {
@ -931,12 +973,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print $langs->trans("Location").': '.$event->location; print $langs->trans("Location").': '.$event->location;
} }
} }
print '</td>'; print '</td>';
// Status - Percent // Status - Percent
print '<td align="right" nowrap="nowrap">'; print '<td align="right" nowrap="nowrap">';
if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1); if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1);
else print '&nbsp;'; else print '&nbsp;';
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>';
$i++; $i++;
} }
else else

View File

@ -31,7 +31,7 @@ ViewWithPredefinedFilters=Vues avec filtres prédéfinis
AutoActions=Alimentation automatique de l'agenda AutoActions=Alimentation automatique de l'agenda
AgendaAutoActionDesc=Définissez dans cet onglet les événements pour lesquels dolibarr créera automatiquement une action dans l'agenda. Si aucune case n'est cochée (par défaut), seules les actions manuelles seront incluses dans l'agenda. AgendaAutoActionDesc=Définissez dans cet onglet les événements pour lesquels dolibarr créera automatiquement une action 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 du module agenda. AgendaSetupOtherDesc=Cette page permet de configurer les autres paramètres du module agenda.
AgendaExtSitesDesc=Cette page permet de configurer les calendriers externes. AgendaExtSitesDesc=Cette page permet d'ajouter des sources de calendriers externes pour les visualiser au sein de l'agenda Dolibarr.
ActionsEvents=Événements pour lesquels Dolibarr doit créer une action dans l'agenda en automatique. ActionsEvents=Événements pour lesquels Dolibarr doit créer une action dans l'agenda en automatique.
PropalValidatedInDolibarr=Proposition %s validée PropalValidatedInDolibarr=Proposition %s validée
InvoiceValidatedInDolibarr=Facture %s validée InvoiceValidatedInDolibarr=Facture %s validée
@ -65,4 +65,4 @@ ExtSites=Calendriers extérieures
ExtSitesEnableThisTool=Afficher les calendriers externes sur l'agenda ExtSitesEnableThisTool=Afficher les calendriers externes sur l'agenda
ExtSitesNbOfAgenda=Nombre de calendriers ExtSitesNbOfAgenda=Nombre de calendriers
AgendaExtNb=Calendrier no %s AgendaExtNb=Calendrier no %s
ExtSiteUrlAgenda=Url de acceso al archivo .ical ExtSiteUrlAgenda=Url d'accès au fichier ical

View File

@ -551,9 +551,9 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$enc
* "%d/%m/%Y %H:%M", * "%d/%m/%Y %H:%M",
* "%d/%m/%Y %H:%M:%S", * "%d/%m/%Y %H:%M:%S",
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext" * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext"
* @param tzoutput true=output string is for Greenwich location * @param tzoutput true=output or 'gmt' => string is for Greenwich location
* false or 'tzserver'=output string is for local PHP server TZ usage * false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser'=output string is for local browser TZ usage * 'tzuser' => output string is for local browser TZ usage
* @param outputlangs Object lang that contains language for text translation. * @param outputlangs Object lang that contains language for text translation.
* @param encodetooutput false=no convert into output pagecode * @param encodetooutput false=no convert into output pagecode
* @return string Formated date or '' if time is null * @return string Formated date or '' if time is null
@ -806,7 +806,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$chec
* @return timestamp Date as a timestamp, '' if error * @return timestamp Date as a timestamp, '' if error
* @see dol_print_date, dol_stringtotime * @see dol_print_date, dol_stringtotime
*/ */
function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1,$isdst=true)
{ {
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
@ -841,7 +841,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
$date=strtotime($string); $date=strtotime($string);
print "- ".$string." ".$date." -"; print "- ".$string." ".$date." -";
*/ */
$date=adodb_mktime($hour,$minute,$second,$month,$day,$year,0,$gm); $date=adodb_mktime($hour,$minute,$second,$month,$day,$year,$isdst,$gm);
} }
else else
{ {

View File

@ -45,7 +45,7 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile)
$calfileh=fopen($outputfile,'w'); $calfileh=fopen($outputfile,'w');
if ($calfileh) if ($calfileh)
{ {
$now=mktime(); $now=dol_now();
$encoding=''; $encoding='';
if ($format == 'vcal') $encoding='ENCODING=QUOTED-PRINTABLE:'; if ($format == 'vcal') $encoding='ENCODING=QUOTED-PRINTABLE:';
@ -59,7 +59,12 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile)
fwrite($calfileh,"CALSCALE:GREGORIAN\n"); fwrite($calfileh,"CALSCALE:GREGORIAN\n");
fwrite($calfileh,"X-WR-CALNAME:".$encoding.format_cal($format,$title)."\n"); fwrite($calfileh,"X-WR-CALNAME:".$encoding.format_cal($format,$title)."\n");
fwrite($calfileh,"X-WR-CALDESC:".$encoding.format_cal($format,$desc)."\n"); fwrite($calfileh,"X-WR-CALDESC:".$encoding.format_cal($format,$desc)."\n");
$hh=ConvertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'hour');
$mm=ConvertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'min');
$ss=ConvertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'sec');
//fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n"); //fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n");
if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)
&& $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60) fwrite($calfileh,"X-PUBLISHED-TTL: "."P".$hh."H".$mm."M".$ss."S\n");
foreach ($events_array as $date => $event) foreach ($events_array as $date => $event)
{ {
@ -149,31 +154,31 @@ function build_calfile($format='vcal',$title,$desc,$events_array,$outputfile)
if ($modified) fwrite($calfileh,"LAST-MODIFIED:".dol_print_date($modified,'dayhourxcard',true)."\n"); if ($modified) fwrite($calfileh,"LAST-MODIFIED:".dol_print_date($modified,'dayhourxcard',true)."\n");
fwrite($calfileh,"SUMMARY:".$encoding.$summary."\n"); fwrite($calfileh,"SUMMARY:".$encoding.$summary."\n");
fwrite($calfileh,"DESCRIPTION:".$encoding.$description."\n"); fwrite($calfileh,"DESCRIPTION:".$encoding.$description."\n");
/*
/* Other keys:
// Status values for a "VEVENT" // Status values for a "VEVENT"
statvalue = "TENTATIVE" ;Indicates event is statvalue = "TENTATIVE" ;Indicates event is
;tentative. ;tentative.
/ "CONFIRMED" ;Indicates event is / "CONFIRMED" ;Indicates event is
;definite. ;definite.
/ "CANCELLED" ;Indicates event was / "CANCELLED" ;Indicates event was
;cancelled.
;
// Status values for "VTODO". // Status values for "VTODO".
statvalue =/ "NEEDS-ACTION" ;Indicates to-do needs action. statvalue =/ "NEEDS-ACTION" ;Indicates to-do needs action.
/ "COMPLETED" ;Indicates to-do completed. / "COMPLETED" ;Indicates to-do completed.
/ "IN-PROCESS" ;Indicates to-do in process of / "IN-PROCESS" ;Indicates to-do in process of
/ "CANCELLED" ;Indicates to-do was cancelled. / "CANCELLED" ;Indicates to-do was cancelled.
// Status values for "VJOURNAL". // Status values for "VJOURNAL".
statvalue =/ "DRAFT" ;Indicates journal is draft. statvalue =/ "DRAFT" ;Indicates journal is draft.
/ "FINAL" ;Indicates journal is final. / "FINAL" ;Indicates journal is final.
/ "CANCELLED" ;Indicates journal is removed. / "CANCELLED" ;Indicates journal is removed.
*/ */
if (! empty($location)) fwrite($calfileh,"LOCATION:".$encoding.$location."\n");
//fwrite($calfileh,"CLASS:PUBLIC\n"); // PUBLIC, PRIVATE, CONFIDENTIAL //fwrite($calfileh,"CLASS:PUBLIC\n"); // PUBLIC, PRIVATE, CONFIDENTIAL
//fwrite($calfileh,"X-MICROSOFT-CDO-BUSYSTATUS:1\n");
//ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Laurent Destailleur;X-NUM-GUESTS=0:mailto:eldy10@gmail.com
if (! empty($location)) fwrite($calfileh,"LOCATION:".$encoding.$location."\n");
if ($fulldayevent) fwrite($calfileh,"X-FUNAMBOL-ALLDAY:1\n");
if ($fulldayevent) fwrite($calfileh,"X-MICROSOFT-CDO-ALLDAYEVENT:1\n");
// Date must be GMT dates // Date must be GMT dates
// Current date // Current date