Minor enhancement on agenda module.

Can filter on date of event.
Local calendar renamed into Internal calendar.
This commit is contained in:
Laurent Destailleur 2014-09-09 12:28:35 +02:00
parent 9e2a0cb671
commit 9f2b0b4f29
7 changed files with 70 additions and 26 deletions

View File

@ -998,7 +998,7 @@ elseif ($action == 'show_week') // View by week
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
if ($today) $style='cal_today';
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
echo ' <td class="'.$style.'" width="14%" valign="top">';
show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo " </td>\n";
}
@ -1032,7 +1032,7 @@ else // View by day
echo ' <td align="center">'.$langs->trans("Day".$arraytimestamp['wday'])."</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
echo ' <td class="'.$style.'" width="14%" valign="top">';
$maxnbofchar=80;
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
echo "</td>\n";
@ -1073,18 +1073,20 @@ $db->close();
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
* @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL
* @param int $showinfo Add extended information (used by day view)
* @param int $showinfo Add extended information (used by day and week view)
* @param int $minheight Minimum height for each event. 60px by default.
* @return void
*/
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 $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
global $theme_datacolor;
global $cachethirdparties, $cachecontacts, $colorindexused;
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
// Line with title of day
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
print '<table class="nobordernopadding" width="100%">';
print '<tr><td align="left" class="nowrap">';
@ -1092,7 +1094,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
print $newparam;
print '">';
if ($showinfo) print dol_print_date($curtime,'daytext');
if ($showinfo) print dol_print_date($curtime,'daytextshort');
else print dol_print_date($curtime,'%d');
print '</a>';
print '</td><td align="right" class="nowrap">';
@ -1107,7 +1109,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '</a>';
}
print '</td></tr>';
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="nowrap sortable" style="padding-bottom: 2px;">';
// Line with td contains all div of each events
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="sortable" style="padding-bottom: 2px;">';
print '<div style="width: 100%; position: relative;">';
//$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
@ -1192,15 +1197,23 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$cssclass.= " unsortable";
}
$h=''; $nowrapontd=1;
if ($action == 'show_day') { $h='height: 100%; '; $nowrapontd=0; }
if ($action == 'show_week') { $h='height: 100%; '; $nowrapontd=0; }
// Show rect of event
print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'">';
print '<ul class="cal_event"><li class="cal_event">';
print '<table class="cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="';
print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"';
//print ' style="height: 100px;';
//print ' position: absolute; top: 40px; width: 50%;';
//print '"';
print '>';
print '<ul class="cal_event" style="'.$h.'"><li class="cal_event" style="'.$h.'">';
print '<table class="cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h;
print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
//else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
print ' -moz-border-radius:4px;" width="100%"><tr>';
print '<td class="nowrap cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
print '<td class="'.($nowrapontd?'nowrap ':'').'cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
if ($event->type_code == 'BIRTHDAY') // It's a birthday
{
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
@ -1367,6 +1380,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '</script>'."\n";
}
print '</div>';
print '</td></tr>';
print '</table>';
print '</div>'."\n";

View File

@ -43,6 +43,7 @@ $pid=GETPOST("projectid",'int',3);
$status=GETPOST("status",'alpha');
$type=GETPOST('type');
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':''));
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
@ -178,6 +179,8 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")";
}
//if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1).'"';
if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1)."'";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
//print $sql;
@ -191,9 +194,11 @@ if ($resql)
$num = $db->num_rows($resql);
$title=$langs->trans("DoneAndToDoActions");
/*$title=$langs->trans("DoneAndToDoActions");
if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions");
*/
$title=$langs->trans("ListOfEvents");
$newtitle=$langs->trans($title);
@ -225,6 +230,8 @@ if ($resql)
print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,$link,$num,0,'');
//print '<br>';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?'.$param.'">'."\n";
$i = 0;
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
@ -240,6 +247,22 @@ if ($resql)
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">';
print $form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
print '</td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
//print '&nbsp; ';
//print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";
$contactstatic = new Contact($db);
$now=dol_now();
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
@ -349,6 +372,9 @@ if ($resql)
$i++;
}
print "</table>";
print '</form>';
$db->free($resql);
}

View File

@ -501,14 +501,14 @@ function calendars_prepare_head($param)
$head[$h][2] = 'cardday';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewList");
$head[$h][2] = 'cardlist';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewPerUser");
$head[$h][2] = 'cardperuser';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewList");
$head[$h][2] = 'cardlist';
$h++;
$object=new stdClass();

View File

@ -13,16 +13,19 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
-- ============================================================================
-- Table used to link an element actioncomm with a resource or user (llx_resource or llx_user)
-- ============================================================================
CREATE TABLE llx_element_resources
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
resource_id integer,
resource_type varchar(64),
element_id integer,
element_type varchar(64),
resource_id integer, -- id of resource or id of user
resource_type varchar(64), -- resource or user
busy integer,
mandatory integer,
fk_user_create integer,
fk_user_create integer,
tms timestamp
)ENGINE=innodb;

View File

@ -2,11 +2,11 @@
IdAgenda=ID event
Actions=Events
ActionsArea=Events area (Actions and tasks)
Agenda= Agenda
Agendas= Agendas
Calendar= Calendar
Calendars= Calendars
LocalAgenda=Local calendar
Agenda=Agenda
Agendas=Agendas
Calendar=Calendar
Calendars=Calendars
LocalAgenda=Internal calendar
AffectedTo=Assigned to
DoneBy=Done by
Event=Event
@ -22,7 +22,7 @@ MenuToDoActions=All incomplete events
MenuDoneActions=All terminated events
MenuToDoMyActions=My incomplete events
MenuDoneMyActions=My terminated events
ListOfEvents=List of Dolibarr events
ListOfEvents=List of events (internal calendar)
ActionsAskedBy=Events reported by
ActionsToDoBy=Events assigned to
ActionsDoneBy=Events done by

View File

@ -22,7 +22,7 @@ MenuToDoActions=Événements incomplets
MenuDoneActions=Événements terminés
MenuToDoMyActions=Mes événem. incomplets
MenuDoneMyActions=Mes événem. terminés
ListOfEvents=Liste des événements Dolibarr
ListOfEvents=Liste des événements (calendrier interne)
ActionsAskedBy=Événements enregistrés par
ActionsToDoBy=Événements affectés à
ActionsDoneBy=Événements réalisés par

View File

@ -2336,6 +2336,7 @@ table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px
moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25);
background: -webkit-gradient(linear, left top, left bottom, from(#006aac), to(#00438d));
min-height: 20px;
}
table.cal_event td { border: none; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 2px; padding-top: 0px; padding-bottom: 0px; }
ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -moz-padding-start: 0px; -webkit-padding-start: 0px; }