diff --git a/ChangeLog b/ChangeLog
index 586bccbe03b..a793f802da9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
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: Can attach supplier order to a customer order.
- New: Supervisor is now visible into user list.
diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php
index 371854410b0..6b683c8b52b 100644
--- a/htdocs/admin/agenda_extsites.php
+++ b/htdocs/admin/agenda_extsites.php
@@ -62,10 +62,11 @@ if ($actionsave)
// Save agendas
while ($i <= $MAXAGENDA)
{
- $name=trim(GETPOST('agenda_ext_name'.$i,'alpha'));
- $src=trim(GETPOST('agenda_ext_src'.$i,'alpha'));
- $color=trim(GETPOST('agenda_ext_color'.$i,'alpha'));
+ $name=trim(GETPOST('AGENDA_EXT_NAME'.$i,'alpha'));
+ $src=trim(GETPOST('AGENDA_EXT_SRC'.$i,'alpha'));
+ $color=trim(GETPOST('AGENDA_EXT_COLOR'.$i,'alpha'));
if ($color=='-1') $color='';
+ $enabled=trim(GETPOST('AGENDA_EXT_ENABLED'.$i,'alpha'));
if (! empty($src) && ! dol_is_url($src))
{
@@ -82,6 +83,8 @@ if ($actionsave)
if (! $res > 0) $error++;
$res=dolibarr_set_const($db,'AGENDA_EXT_COLOR'.$i,$color,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
+ $res=dolibarr_set_const($db,'AGENDA_EXT_ENABLED'.$i,$enabled,'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
$i++;
}
@@ -195,19 +198,20 @@ while ($i <= $MAXAGENDA)
$name='AGENDA_EXT_NAME'.$key;
$src='AGENDA_EXT_SRC'.$key;
$color='AGENDA_EXT_COLOR'.$key;
+ $enabled='AGENDA_EXT_ENABLED'.$key;
$var=!$var;
print "
";
// Nb
print ''.$langs->trans("AgendaExtNb",$key)." ";
// Name
- print ' ';
+ print ' ';
// URL
- print ' ';
+ print ' ';
// Color (Possible colors are limited by Google)
print '';
//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 ' ';
print " ";
$i++;
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 5021fa11f94..318d7efbee9 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -163,8 +163,9 @@ $nowyear=$nowarray['year'];
$nowmonth=$nowarray['mon'];
$nowday=$nowarray['mday'];
-// Define list of all external calendars
$listofextcals=array();
+
+// Define list of external calendars (global admin setup)
if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 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')
{
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 964dc751932..a0c1e3f1b4b 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -73,17 +73,18 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
//print ' ';
//print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit);
//print ' '.$langs->trans("or") . ' ';
- print $langs->trans("ActionsForUser").' ';
+ print $langs->trans("ActionAffectedTo").' ';
print ' ';
- //print ' ';
+ //print $langs->trans("User");
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
if (! empty($conf->use_javascript_ajax))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
print ajax_combobox('usertodo');
}
- print ' '.$langs->trans("or") . ' ';
- print $langs->trans("ActionsForUsersGroup").' ';
+ if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' ';
+ else print ' ';
+ print $langs->trans("Group").' ';
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
if (! empty($conf->use_javascript_ajax))
{
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 0b8c759f21a..97354bd08ab 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -71,6 +71,14 @@ function user_prepare_head($object)
$head[$h][2] = 'guisetup';
$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))
{
$head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$object->id;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index ab08ecee1b9..f4a7aa0f5c6 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -517,6 +517,8 @@ Module6000Name=Workflow
Module6000Desc=Workflow management
Module20000Name=Holidays
Module20000Desc=Declare and follow employees holidays
+Module39000Name=Product batch
+Module39000Desc=Batch number, eat-by and sell-by date management on products
Module50000Name=PayBox
Module50000Desc=Module to offer an online payment page by credit card with PayBox
Module50100Name=Point of sales
diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php
new file mode 100644
index 00000000000..4109e7ab9a4
--- /dev/null
+++ b/htdocs/user/agenda_extsites.php
@@ -0,0 +1,187 @@
+
+ * Copyright (C) 2011-2014 Juanjo Menent
+ *
+ * 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 .
+ */
+
+/**
+ * \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")." \n";
+print " \n";
+
+print '\n";
+
+dol_fiche_end();
+
+llxFooter();
+
+$db->close();