diff --git a/ChangeLog b/ChangeLog index 586bccbe03ba1af503c2ca050c1a6b6e9ba6c9dd..a793f802da906c0b27f65aab178faa9d50bb2a05 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 371854410b0e319cafac79e0fd504ab235129d23..6b683c8b52b87afea874c7842a7edeb14c3c9a26 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 "<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'.$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 - 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) print '<td class="nowrap" align="right">'; //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 "</tr>"; $i++; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 5021fa11f942e00f9faaf7735147cb843a6ee63c..318d7efbee94b8d70b991403fcb8cc1ad02fbadc 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 964dc751932768313ae8496d6822f6b004b809b5..a0c1e3f1b4bd2df5831d01def6063059a133813c 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 ' </td><td class="nowrap maxwidthonsmartphone">'; //print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit); //print ' '.$langs->trans("or") . ' '; - print $langs->trans("ActionsForUser").' '; + print $langs->trans("ActionAffectedTo").' '; print '</td><td class="nowrap maxwidthonsmartphone">'; - //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 '<br>'; + 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 0b8c759f21a160e9358935c577cc901af648d72f..97354bd08abd701a7abfa8996568ed336697c08e 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 ab08ecee1b976cb98dcb8e43fab299bb288ca5ac..f4a7aa0f5c664165c224b8894442d8ec7c77e1b3 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 0000000000000000000000000000000000000000..4109e7ab9a4eadbb2e4fa12bbc3bfefb28250da7 --- /dev/null +++ b/htdocs/user/agenda_extsites.php @@ -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();