Fix: Export calendar to ical
This commit is contained in:
parent
1c67bfee27
commit
b207f3419d
@ -552,7 +552,7 @@ class ActionComm
|
||||
$filename=$format.'.'.$extension;
|
||||
}
|
||||
|
||||
create_exdir($conf->agenda->dir_temp);
|
||||
$result=create_exdir($conf->agenda->dir_temp);
|
||||
$outputfile=$conf->agenda->dir_temp.'/'.$filename;
|
||||
$result=0;
|
||||
|
||||
@ -583,7 +583,12 @@ class ActionComm
|
||||
$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";
|
||||
foreach($filters as $key => $value)
|
||||
{
|
||||
if ($key == 'year') $sql.=' AND ';
|
||||
if ($key == 'idaction') $sql.=' AND a.id='.$value;
|
||||
}
|
||||
$sql.= " ORDER by datec";
|
||||
|
||||
dolibarr_syslog("ActionComm::build_vcal select events sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -620,6 +625,7 @@ class ActionComm
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dolibarr_syslog("ActionComm::build_calfile ".$this->db->lasterror(), LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
86
htdocs/comm/action/agendaexport.php
Normal file
86
htdocs/comm/action/agendaexport.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/** \file htdocs/comm/action/agendaexport.php
|
||||
\ingroup agenda
|
||||
\brief Page export agenda
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
// This is to make Dolibarr working with Plesk
|
||||
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
|
||||
|
||||
require("../../master.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
|
||||
|
||||
|
||||
// C'est un wrapper, donc header vierge
|
||||
function llxHeader() { print '<html><title>Export agenda cal</title><body>'; }
|
||||
function llxFooter() { print '</body></html>'; }
|
||||
|
||||
|
||||
// Check config
|
||||
if (! $conf->agenda->enabled && empty($conf->global->MAIN_PASSWORD_VCALEXPORT))
|
||||
{
|
||||
$user->getrights();
|
||||
|
||||
llxHeader();
|
||||
print '<div class="error">Module Agenda was not configured properly.</div>';
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$mainmenu=isset($_GET["mainmenu"])?$_GET["mainmenu"]:"";
|
||||
$leftmenu=isset($_GET["leftmenu"])?$_GET["leftmenu"]:"";
|
||||
|
||||
// Define format, type, filename and filter
|
||||
$format='vcal';
|
||||
$type='event';
|
||||
$filename='';
|
||||
if (! empty($_GET["format"])) $format=$_GET["format"];
|
||||
if ($format == 'vcal') $filename='dolibarrcalendar.vcs';
|
||||
if ($format == 'ical') $filename='dolibarrcalendar.ics';
|
||||
if (! empty($_GET["type"])) $type=$_GET["type"];
|
||||
if (! $filename)
|
||||
{
|
||||
$langs->load("main");
|
||||
$langs->load("errors");
|
||||
llxHeader();
|
||||
print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX",'format').'</div>';
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
exit;
|
||||
}
|
||||
$filters=array();
|
||||
if (! empty($_GET["year"])) $filters['year']=$_GET["year"];
|
||||
if (! empty($_GET["idaction"])) $filters['idaction']=$_GET["idaction"];
|
||||
|
||||
$agenda=new ActionComm($db);
|
||||
|
||||
// Build file
|
||||
$result=$agenda->build_calfile($format,$type,0,$filename,$filters);
|
||||
if ($result >= 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
|
||||
exit;
|
||||
}
|
||||
|
||||
llxHeader();
|
||||
print '<div class="error">'.$agenda->error.'</div>';
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -827,7 +827,7 @@ llxFooter('$Date$ - $Revision$');
|
||||
|
||||
/**
|
||||
\brief Ajoute une ligne de tableau a 2 colonnes pour avoir l'option synchro calendrier
|
||||
\return int Retourne le nombre de lignes ajout<EFBFBD>es
|
||||
\return int Retourne le nombre de lignes ajoutees
|
||||
*/
|
||||
function add_row_for_calendar_link()
|
||||
{
|
||||
|
||||
@ -230,9 +230,9 @@ if ($resql)
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePlanShort"),$_SERVER["PHP_SELF"],"a.datep",$param,'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateRealShort"),$_SERVER["PHP_SELF"],"a.datea2",$param,'','',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
|
||||
@ -260,6 +260,11 @@ if ($resql)
|
||||
print $actionstatic->getNomUrl(1,4);
|
||||
print '</td>';
|
||||
|
||||
// Titre
|
||||
print '<td>';
|
||||
print dolibarr_trunc($obj->label,12);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->dp,"day");
|
||||
$late=0;
|
||||
@ -274,11 +279,6 @@ if ($resql)
|
||||
print dolibarr_print_date($obj->da2,"day");
|
||||
print '</td>';
|
||||
|
||||
// Titre
|
||||
print '<td>';
|
||||
print dolibarr_trunc($obj->label,10);
|
||||
print '</td>';
|
||||
|
||||
// Société
|
||||
print '<td>';
|
||||
$societestatic->id=$obj->socid;
|
||||
|
||||
@ -23,5 +23,5 @@ ViewList=Voir liste
|
||||
ViewCal=Voir calendrier
|
||||
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.
|
||||
AgendaAutoActionDesc=Définissez dans cet onglet, les actions pour lesquels dolibarr créera automatiquement 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.
|
||||
@ -26,15 +26,16 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* \brief Création de 2 vignettes a partir d'un fichier image (une small et un mini)
|
||||
* \brief Les extension prise en compte sont jpg et png
|
||||
* \param file Chemin du fichier image a redimensionner
|
||||
* \param maxWidth Largeur maximum que dois faire la miniature (160 par défaut)
|
||||
* \param maxHeight Hauteur maximum que dois faire l'image (120 par défaut)
|
||||
* \param extName Extension pour différencier le nom de la vignette
|
||||
* \param quality Qualité de compression (0=worst, 100=best)
|
||||
* \return string Chemin de la vignette
|
||||
/**
|
||||
* \brief Create a thumbnail from an image file (une small et un mini)
|
||||
* \brief Les extensions prises en compte sont jpg et png
|
||||
* \param file Chemin du fichier image a redimensionner
|
||||
* \param maxWidth Largeur maximum que dois faire la miniature (160 par défaut)
|
||||
* \param maxHeight Hauteur maximum que dois faire l'image (120 par défaut)
|
||||
* \param extName Extension pour différencier le nom de la vignette
|
||||
* \param quality Qualité de compression (0=worst, 100=best)
|
||||
* \return string Full path of thumb
|
||||
* \remarks With file=myfile.jpg -> myfile_small.jpg
|
||||
*/
|
||||
function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user