New: Each user can include its own external ics calendar into dolibarr
agenda view.
This commit is contained in:
parent
96cb9fe6cb
commit
7edf2eacea
@ -5,6 +5,7 @@ English Dolibarr ChangeLog
|
|||||||
|
|
||||||
***** ChangeLog for 3.7 compared to 3.6.* *****
|
***** ChangeLog for 3.7 compared to 3.6.* *****
|
||||||
For users:
|
For users:
|
||||||
|
- New: Each user can include its own external ics calendar into dolibarr agenda view.
|
||||||
- New: Intervention documents are now available in ECM module.
|
- New: Intervention documents are now available in ECM module.
|
||||||
- New: Can attach supplier order to a customer order.
|
- New: Can attach supplier order to a customer order.
|
||||||
- New: Supervisor is now visible into user list.
|
- New: Supervisor is now visible into user list.
|
||||||
|
|||||||
@ -62,10 +62,11 @@ if ($actionsave)
|
|||||||
// Save agendas
|
// Save agendas
|
||||||
while ($i <= $MAXAGENDA)
|
while ($i <= $MAXAGENDA)
|
||||||
{
|
{
|
||||||
$name=trim(GETPOST('agenda_ext_name'.$i,'alpha'));
|
$name=trim(GETPOST('AGENDA_EXT_NAME'.$i,'alpha'));
|
||||||
$src=trim(GETPOST('agenda_ext_src'.$i,'alpha'));
|
$src=trim(GETPOST('AGENDA_EXT_SRC'.$i,'alpha'));
|
||||||
$color=trim(GETPOST('agenda_ext_color'.$i,'alpha'));
|
$color=trim(GETPOST('AGENDA_EXT_COLOR'.$i,'alpha'));
|
||||||
if ($color=='-1') $color='';
|
if ($color=='-1') $color='';
|
||||||
|
$enabled=trim(GETPOST('AGENDA_EXT_ENABLED'.$i,'alpha'));
|
||||||
|
|
||||||
if (! empty($src) && ! dol_is_url($src))
|
if (! empty($src) && ! dol_is_url($src))
|
||||||
{
|
{
|
||||||
@ -82,6 +83,8 @@ if ($actionsave)
|
|||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
$res=dolibarr_set_const($db,'AGENDA_EXT_COLOR'.$i,$color,'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db,'AGENDA_EXT_COLOR'.$i,$color,'chaine',0,'',$conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
$res=dolibarr_set_const($db,'AGENDA_EXT_ENABLED'.$i,$enabled,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,19 +198,20 @@ while ($i <= $MAXAGENDA)
|
|||||||
$name='AGENDA_EXT_NAME'.$key;
|
$name='AGENDA_EXT_NAME'.$key;
|
||||||
$src='AGENDA_EXT_SRC'.$key;
|
$src='AGENDA_EXT_SRC'.$key;
|
||||||
$color='AGENDA_EXT_COLOR'.$key;
|
$color='AGENDA_EXT_COLOR'.$key;
|
||||||
|
$enabled='AGENDA_EXT_ENABLED'.$key;
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
// Nb
|
// Nb
|
||||||
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb",$key)."</td>";
|
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb",$key)."</td>";
|
||||||
// Name
|
// Name
|
||||||
print '<td><input type="text" class="flat hideifnotset" name="agenda_ext_name'.$key.'" value="'. (GETPOST('agenda_ext_name'.$key)?GETPOST('agenda_ext_name'.$key):$conf->global->$name) . '" size="28"></td>';
|
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME'.$key.'" value="'. (GETPOST('AGENDA_EXT_NAME'.$key)?GETPOST('AGENDA_EXT_NAME'.$key):$conf->global->$name) . '" size="28"></td>';
|
||||||
// URL
|
// URL
|
||||||
print '<td><input type="url" class="flat hideifnotset" name="agenda_ext_src'.$key.'" value="'. (GETPOST('agenda_ext_src'.$key)?GETPOST('agenda_ext_src'.$key):$conf->global->$src) . '" size="60"></td>';
|
print '<td><input type="url" class="flat hideifnotset" name="AGENDA_EXT_SRC'.$key.'" value="'. (GETPOST('AGENDA_EXT_SRC'.$key)?GETPOST('AGENDA_EXT_SRC'.$key):$conf->global->$src) . '" size="60"></td>';
|
||||||
// Color (Possible colors are limited by Google)
|
// Color (Possible colors are limited by Google)
|
||||||
print '<td class="nowrap" align="right">';
|
print '<td class="nowrap" align="right">';
|
||||||
//print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist);
|
//print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist);
|
||||||
print $formother->selectColor((GETPOST("agenda_ext_color".$key)?GETPOST("agenda_ext_color".$key):$conf->global->$color), "agenda_ext_color".$key, 'extsitesconfig', 1, '', 'hideifnotset');
|
print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key)?GETPOST("AGENDA_EXT_COLOR".$key):$conf->global->$color), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -163,8 +163,9 @@ $nowyear=$nowarray['year'];
|
|||||||
$nowmonth=$nowarray['mon'];
|
$nowmonth=$nowarray['mon'];
|
||||||
$nowday=$nowarray['mday'];
|
$nowday=$nowarray['mday'];
|
||||||
|
|
||||||
// Define list of all external calendars
|
|
||||||
$listofextcals=array();
|
$listofextcals=array();
|
||||||
|
|
||||||
|
// Define list of external calendars (global admin setup)
|
||||||
if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
|
if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -182,7 +183,22 @@ if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Define list of external calendars (user setup)
|
||||||
|
$i=0;
|
||||||
|
while($i < $conf->global->AGENDA_EXT_NB)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$source='AGENDA_EXT_SRC_'.$user->id.'_'.$i;
|
||||||
|
$name='AGENDA_EXT_NAME_'.$user->id.'_'.$i;
|
||||||
|
$color='AGENDA_EXT_COLOR_'.$user->id.'_'.$i;
|
||||||
|
$enabled='AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
|
||||||
|
$buggedfile='AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
|
||||||
|
if (! empty($user->conf->$source) && ! empty($user->conf->$name))
|
||||||
|
{
|
||||||
|
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
|
||||||
|
$listofextcals[]=array('src'=>$user->conf->$source,'name'=>$user->conf->$name,'color'=>$user->conf->$color,'buggedfile'=>(isset($user->conf->buggedfile)?$user->conf->buggedfile:0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($action) || $action=='show_month')
|
if (empty($action) || $action=='show_month')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -73,17 +73,18 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
|||||||
//print ' </td><td class="nowrap maxwidthonsmartphone">';
|
//print ' </td><td class="nowrap maxwidthonsmartphone">';
|
||||||
//print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit);
|
//print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit);
|
||||||
//print ' '.$langs->trans("or") . ' ';
|
//print ' '.$langs->trans("or") . ' ';
|
||||||
print $langs->trans("ActionsForUser").' ';
|
print $langs->trans("ActionAffectedTo").' ';
|
||||||
print '</td><td class="nowrap maxwidthonsmartphone">';
|
print '</td><td class="nowrap maxwidthonsmartphone">';
|
||||||
//print ' ';
|
//print $langs->trans("User");
|
||||||
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
|
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
print ajax_combobox('usertodo');
|
print ajax_combobox('usertodo');
|
||||||
}
|
}
|
||||||
print ' '.$langs->trans("or") . ' ';
|
if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' ';
|
||||||
print $langs->trans("ActionsForUsersGroup").' ';
|
else print '<br>';
|
||||||
|
print $langs->trans("Group").' ';
|
||||||
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
|
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,6 +71,14 @@ function user_prepare_head($object)
|
|||||||
$head[$h][2] = 'guisetup';
|
$head[$h][2] = 'guisetup';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
if (! empty($conf->agenda->enabled))
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/user/agenda_extsites.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("ExtSites");
|
||||||
|
$head[$h][2] = 'extsites';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->clicktodial->enabled))
|
if (! empty($conf->clicktodial->enabled))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
|
||||||
|
|||||||
@ -517,6 +517,8 @@ Module6000Name=Workflow
|
|||||||
Module6000Desc=Workflow management
|
Module6000Desc=Workflow management
|
||||||
Module20000Name=Holidays
|
Module20000Name=Holidays
|
||||||
Module20000Desc=Declare and follow employees holidays
|
Module20000Desc=Declare and follow employees holidays
|
||||||
|
Module39000Name=Product batch
|
||||||
|
Module39000Desc=Batch number, eat-by and sell-by date management on products
|
||||||
Module50000Name=PayBox
|
Module50000Name=PayBox
|
||||||
Module50000Desc=Module to offer an online payment page by credit card with PayBox
|
Module50000Desc=Module to offer an online payment page by credit card with PayBox
|
||||||
Module50100Name=Point of sales
|
Module50100Name=Point of sales
|
||||||
|
|||||||
187
htdocs/user/agenda_extsites.php
Normal file
187
htdocs/user/agenda_extsites.php
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/user/agenda_extsites.php
|
||||||
|
* \ingroup agenda
|
||||||
|
* \brief Page to setup external calendars for agenda module
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.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/lib/date.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
|
|
||||||
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
$langs->load("agenda");
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("other");
|
||||||
|
|
||||||
|
$def = array();
|
||||||
|
$actiontest=GETPOST('test','alpha');
|
||||||
|
$actionsave=GETPOST('save','alpha');
|
||||||
|
|
||||||
|
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
|
||||||
|
$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB;
|
||||||
|
|
||||||
|
// List of aviable colors
|
||||||
|
$colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5');
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$id = GETPOST('id','int');
|
||||||
|
$fuser = new User($db);
|
||||||
|
$fuser->fetch($id);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
if ($actionsave)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$i=1; $errorsaved=0;
|
||||||
|
$error=0;
|
||||||
|
$tabparam=array();
|
||||||
|
|
||||||
|
// Save agendas
|
||||||
|
while ($i <= $MAXAGENDA)
|
||||||
|
{
|
||||||
|
$name=trim(GETPOST('AGENDA_EXT_NAME_'.$id.'_'.$i,'alpha'));
|
||||||
|
$src=trim(GETPOST('AGENDA_EXT_SRC_'.$id.'_'.$i,'alpha'));
|
||||||
|
$color=trim(GETPOST('AGENDA_EXT_COLOR_'.$id.'_'.$i,'alpha'));
|
||||||
|
if ($color=='-1') $color='';
|
||||||
|
$enabled=trim(GETPOST('AGENDA_EXT_ENABLED_'.$id.'_'.$i,'alpha'));
|
||||||
|
|
||||||
|
if (! empty($src) && ! dol_is_url($src))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("ErrorParamMustBeAnUrl"),'errors');
|
||||||
|
$error++;
|
||||||
|
$errorsaved++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tabparam['AGENDA_EXT_NAME_'.$id.'_'.$i]=$name;
|
||||||
|
$tabparam['AGENDA_EXT_SRC_'.$id.'_'.$i]=$src;
|
||||||
|
$tabparam['AGENDA_EXT_COLOR_'.$id.'_'.$i]=$color;
|
||||||
|
$tabparam['AGENDA_EXT_ENABLED_'.$id.'_'.$i]=$enabled;
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$result=dol_set_user_param($db, $conf, $fuser, $tabparam);
|
||||||
|
if (! $result > 0) $error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
if (empty($errorsaved)) setEventMessage($langs->trans("Error"),'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
$formadmin=new FormAdmin($db);
|
||||||
|
$formother=new FormOther($db);
|
||||||
|
|
||||||
|
$arrayofjs=array();
|
||||||
|
$arrayofcss=array();
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("UserSetup"),'','',0,0,$arrayofjs,$arrayofcss);
|
||||||
|
|
||||||
|
$head=user_prepare_head($fuser);
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'extsites', $langs->trans("User"), 0, 'user');
|
||||||
|
|
||||||
|
print $langs->trans("AgendaExtSitesDesc")."<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
|
||||||
|
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
|
||||||
|
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print "<td>".$langs->trans("Parameter")."</td>";
|
||||||
|
print "<td>".$langs->trans("Name")."</td>";
|
||||||
|
print "<td>".$langs->trans("ExtSiteUrlAgenda")." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Color").'</td>';
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
$i=1;
|
||||||
|
$var=true;
|
||||||
|
while ($i <= $MAXAGENDA)
|
||||||
|
{
|
||||||
|
$key=$i;
|
||||||
|
$name='AGENDA_EXT_NAME_'.$id.'_'.$key;
|
||||||
|
$src='AGENDA_EXT_SRC_'.$id.'_'.$key;
|
||||||
|
$color='AGENDA_EXT_COLOR_'.$id.'_'.$key;
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
// Nb
|
||||||
|
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb",$key)."</td>";
|
||||||
|
// Name
|
||||||
|
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME_'.$id.'_'.$key.'" value="'. (GETPOST('AGENDA_EXT_NAME_'.$id.'_'.$key)?GETPOST('AGENDA_EXT_NAME_'.$id.'_'.$key):$fuser->conf->$name) . '" size="28"></td>';
|
||||||
|
// URL
|
||||||
|
print '<td><input type="url" class="flat hideifnotset" name="AGENDA_EXT_SRC_'.$id.'_'.$key.'" value="'. (GETPOST('AGENDA_EXT_SRC_'.$id.'_'.$key)?GETPOST('AGENDA_EXT_SRC_'.$id.'_'.$key):$fuser->conf->$src) . '" size="60"></td>';
|
||||||
|
// Color (Possible colors are limited by Google)
|
||||||
|
print '<td class="nowrap" align="right">';
|
||||||
|
//print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist);
|
||||||
|
print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR_".$id.'_'.$key)?GETPOST("AGENDA_EXT_COLOR_".$id.'_'.$key):$fuser->conf->$color), "AGENDA_EXT_COLOR_".$id.'_'.$key, 'extsitesconfig', 1, '', 'hideifnotset');
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<center>';
|
||||||
|
print "<input type=\"submit\" id=\"save\" name=\"save\" class=\"button hideifnotset\" value=\"".$langs->trans("Save")."\">";
|
||||||
|
print "</center>";
|
||||||
|
|
||||||
|
print "</form>\n";
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
Loading…
Reference in New Issue
Block a user