Fix in agenda output per user/type (reduce memory usage)
This commit is contained in:
parent
8b82fc3c70
commit
cae21d3937
@ -38,7 +38,7 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
|
|||||||
|
|
||||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||||
|
|
||||||
$filter = GETPOST("filter",'',3);
|
$filter = GETPOST("filter",'alpha',3);
|
||||||
$filtert = GETPOST("filtert","int",3);
|
$filtert = GETPOST("filtert","int",3);
|
||||||
$usergroup = GETPOST("usergroup","int",3);
|
$usergroup = GETPOST("usergroup","int",3);
|
||||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||||
@ -82,9 +82,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
|||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
||||||
$pid=GETPOST("projectid","int",3);
|
$pid=GETPOST("projectid","int",3);
|
||||||
$status=GETPOST("status");
|
$status=GETPOST("status",'alpha');
|
||||||
$type=GETPOST("type");
|
$type=GETPOST("type",'alpha');
|
||||||
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||||
if (GETPOST('actioncode','array'))
|
if (GETPOST('actioncode','array'))
|
||||||
{
|
{
|
||||||
@ -97,18 +97,18 @@ else
|
|||||||
}
|
}
|
||||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||||
|
|
||||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
|
||||||
if ($dateselect > 0)
|
if ($dateselect > 0)
|
||||||
{
|
{
|
||||||
$day=GETPOST('dateselectday');
|
$day=GETPOST('dateselectday','int');
|
||||||
$month=GETPOST('dateselectmonth');
|
$month=GETPOST('dateselectmonth','int');
|
||||||
$year=GETPOST('dateselectyear');
|
$year=GETPOST('dateselectyear','int');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
||||||
$tmparray=explode('-',$tmp);
|
$tmparray=explode('-',$tmp);
|
||||||
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
||||||
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
||||||
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
||||||
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
||||||
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
||||||
@ -124,13 +124,13 @@ if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $ac
|
|||||||
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
||||||
$action='show_month'; $day='';
|
$action='show_month'; $day='';
|
||||||
} // View by month
|
} // View by month
|
||||||
if (GETPOST('viewweek') || $action == 'show_week') {
|
if (GETPOST('viewweek','alpha') || $action == 'show_week') {
|
||||||
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
||||||
} // View by week
|
} // View by week
|
||||||
if (GETPOST('viewday') || $action == 'show_day') {
|
if (GETPOST('viewday','alpha') || $action == 'show_day') {
|
||||||
$action='show_day'; $day=($day?$day:date("d"));
|
$action='show_day'; $day=($day?$day:date("d"));
|
||||||
} // View by day
|
} // View by day
|
||||||
if (GETPOST('viewyear') || $action == 'show_year') {
|
if (GETPOST('viewyear','alpha') || $action == 'show_year') {
|
||||||
$action='show_year';
|
$action='show_year';
|
||||||
} // View by year
|
} // View by year
|
||||||
|
|
||||||
@ -161,12 +161,12 @@ if ($action =='delete_action')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
|
||||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
$companystatic=new Societe($db);
|
$companystatic=new Societe($db);
|
||||||
|
|
||||||
|
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||||
|
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
$nowarray=dol_getdate($now);
|
$nowarray=dol_getdate($now);
|
||||||
$nowyear=$nowarray['year'];
|
$nowyear=$nowarray['year'];
|
||||||
@ -456,11 +456,14 @@ if ($resql)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$datep=$db->jdate($obj->datep);
|
||||||
|
$datep2=$db->jdate($obj->datep2);
|
||||||
|
|
||||||
// Create a new object action
|
// Create a new object action
|
||||||
$event=new ActionComm($db);
|
$event=new ActionComm($db);
|
||||||
$event->id=$obj->id;
|
$event->id=$obj->id;
|
||||||
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
|
$event->datep=$datep; // datep and datef are GMT date
|
||||||
$event->datef=$db->jdate($obj->datep2);
|
$event->datef=$datep2;
|
||||||
$event->type_code=$obj->code;
|
$event->type_code=$obj->code;
|
||||||
$event->type_color=$obj->color;
|
$event->type_color=$obj->color;
|
||||||
//$event->libelle=$obj->label; // deprecated
|
//$event->libelle=$obj->label; // deprecated
|
||||||
@ -469,7 +472,6 @@ if ($resql)
|
|||||||
//$event->author->id=$obj->fk_user_author; // user id of creator
|
//$event->author->id=$obj->fk_user_author; // user id of creator
|
||||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||||
$event->fetch_userassigned(); // This load $event->userassigned
|
|
||||||
$event->priority=$obj->priority;
|
$event->priority=$obj->priority;
|
||||||
$event->fulldayevent=$obj->fulldayevent;
|
$event->fulldayevent=$obj->fulldayevent;
|
||||||
$event->location=$obj->location;
|
$event->location=$obj->location;
|
||||||
@ -487,15 +489,15 @@ if ($resql)
|
|||||||
// They are date start and end of action but modified to not be outside calendar view.
|
// They are date start and end of action but modified to not be outside calendar view.
|
||||||
if ($event->percentage <= 0)
|
if ($event->percentage <= 0)
|
||||||
{
|
{
|
||||||
$event->date_start_in_calendar=$event->datep;
|
$event->date_start_in_calendar=$datep;
|
||||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
|
||||||
else $event->date_end_in_calendar=$event->datep;
|
else $event->date_end_in_calendar=$datep;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$event->date_start_in_calendar=$event->datep;
|
$event->date_start_in_calendar=$datep;
|
||||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
|
||||||
else $event->date_end_in_calendar=$event->datep;
|
else $event->date_end_in_calendar=$datep;
|
||||||
}
|
}
|
||||||
// Define ponctual property
|
// Define ponctual property
|
||||||
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
||||||
@ -508,10 +510,14 @@ if ($resql)
|
|||||||
$event->date_start_in_calendar >= $lastdaytoshow)
|
$event->date_start_in_calendar >= $lastdaytoshow)
|
||||||
{
|
{
|
||||||
// This record is out of visible range
|
// This record is out of visible range
|
||||||
|
unset($event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
//print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'<br>'."\n";
|
||||||
|
$event->fetch_userassigned(); // This load $event->userassigned
|
||||||
|
|
||||||
|
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||||
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
||||||
|
|
||||||
// Add an entry in actionarray for each day
|
// Add an entry in actionarray for each day
|
||||||
@ -928,6 +934,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now output $casesX
|
||||||
for ($h = $begin_h; $h < $end_h; $h++)
|
for ($h = $begin_h; $h < $end_h; $h++)
|
||||||
{
|
{
|
||||||
$color1='';$color2='';
|
$color1='';$color2='';
|
||||||
|
|||||||
@ -38,7 +38,7 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
|
|||||||
|
|
||||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||||
|
|
||||||
$filter = GETPOST("filter",'',3);
|
$filter = GETPOST("filter",'alpha',3);
|
||||||
$filtert = GETPOST("filtert","int",3);
|
$filtert = GETPOST("filtert","int",3);
|
||||||
$usergroup = GETPOST("usergroup","int",3);
|
$usergroup = GETPOST("usergroup","int",3);
|
||||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||||
@ -82,9 +82,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
|||||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||||
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
||||||
$pid=GETPOST("projectid","int",3);
|
$pid=GETPOST("projectid","int",3);
|
||||||
$status=GETPOST("status");
|
$status=GETPOST("status",'alpha');
|
||||||
$type=GETPOST("type");
|
$type=GETPOST("type",'alpha');
|
||||||
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||||
if (GETPOST('actioncode','array'))
|
if (GETPOST('actioncode','array'))
|
||||||
{
|
{
|
||||||
@ -96,26 +96,26 @@ else
|
|||||||
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||||
}
|
}
|
||||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
|
||||||
if ($dateselect > 0)
|
if ($dateselect > 0)
|
||||||
{
|
{
|
||||||
$day=GETPOST('dateselectday');
|
$day=GETPOST('dateselectday','int');
|
||||||
$month=GETPOST('dateselectmonth');
|
$month=GETPOST('dateselectmonth','int');
|
||||||
$year=GETPOST('dateselectyear');
|
$year=GETPOST('dateselectyear','int');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
||||||
$tmparray=explode('-',$tmp);
|
$tmparray=explode('-',$tmp);
|
||||||
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
||||||
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
||||||
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
||||||
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
||||||
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
||||||
|
|
||||||
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
|
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
|
||||||
$tmparray=explode('-',$tmp);
|
$tmparray=explode('-',$tmp);
|
||||||
$begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
|
$begin_d = GETPOST('begin_d','int')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
|
||||||
$end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5);
|
$end_d = GETPOST('end_d','int')?GETPOST('end_d','int'):($tmparray[1] != '' ? $tmparray[1] : 5);
|
||||||
if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
|
if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
|
||||||
if ($end_d < 1 || $end_d > 7) $end_d = 7;
|
if ($end_d < 1 || $end_d > 7) $end_d = 7;
|
||||||
if ($end_d < $begin_d) $end_d = $begin_d + 1;
|
if ($end_d < $begin_d) $end_d = $begin_d + 1;
|
||||||
@ -123,13 +123,13 @@ if ($end_d < $begin_d) $end_d = $begin_d + 1;
|
|||||||
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||||
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
||||||
|
|
||||||
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
if (GETPOST('viewcal','alpha') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
||||||
$action='show_month'; $day='';
|
$action='show_month'; $day='';
|
||||||
} // View by month
|
} // View by month
|
||||||
if (GETPOST('viewweek') || $action == 'show_week') {
|
if (GETPOST('viewweek','alpha') || $action == 'show_week') {
|
||||||
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
||||||
} // View by week
|
} // View by week
|
||||||
if (GETPOST('viewday') || $action == 'show_day') {
|
if (GETPOST('viewday','alpha') || $action == 'show_day') {
|
||||||
$action='show_day'; $day=($day?$day:date("d"));
|
$action='show_day'; $day=($day?$day:date("d"));
|
||||||
} // View by day
|
} // View by day
|
||||||
|
|
||||||
@ -160,12 +160,12 @@ if ($action =='delete_action')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
|
||||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
$companystatic=new Societe($db);
|
$companystatic=new Societe($db);
|
||||||
|
|
||||||
|
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||||
|
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
$nowarray=dol_getdate($now);
|
$nowarray=dol_getdate($now);
|
||||||
$nowyear=$nowarray['year'];
|
$nowyear=$nowarray['year'];
|
||||||
@ -418,14 +418,14 @@ else
|
|||||||
{
|
{
|
||||||
// To limit array
|
// To limit array
|
||||||
$sql.= " AND (";
|
$sql.= " AND (";
|
||||||
$sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; // Start 7 days before
|
$sql.= " (a.datep BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'"; // Start 2 day before $firstdaytoshow
|
||||||
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; // End 7 days after + 3 to go from 28 to 31
|
$sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')"; // End 2 day after $lastdaytoshow
|
||||||
$sql.= " OR ";
|
$sql.= " OR ";
|
||||||
$sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
|
$sql.= " (a.datep2 BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
|
||||||
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
|
$sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
|
||||||
$sql.= " OR ";
|
$sql.= " OR ";
|
||||||
$sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
|
$sql.= " (a.datep < '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
|
||||||
$sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
|
$sql.= " AND a.datep2 > '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
}
|
}
|
||||||
if ($type) $sql.= " AND ca.id = ".$type;
|
if ($type) $sql.= " AND ca.id = ".$type;
|
||||||
@ -444,13 +444,14 @@ if ($filtert > 0 || $usergroup > 0)
|
|||||||
}
|
}
|
||||||
// Sort on date
|
// Sort on date
|
||||||
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
|
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
|
||||||
//print $sql;
|
//print $sql;exit;
|
||||||
|
|
||||||
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
|
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
@ -463,11 +464,14 @@ if ($resql)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$datep=$db->jdate($obj->datep);
|
||||||
|
$datep2=$db->jdate($obj->datep2);
|
||||||
|
|
||||||
// Create a new object action
|
// Create a new object action
|
||||||
$event=new ActionComm($db);
|
$event=new ActionComm($db);
|
||||||
$event->id=$obj->id;
|
$event->id=$obj->id;
|
||||||
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
|
$event->datep=$datep; // datep and datef are GMT date
|
||||||
$event->datef=$db->jdate($obj->datep2);
|
$event->datef=$datep2;
|
||||||
$event->type_code=$obj->code;
|
$event->type_code=$obj->code;
|
||||||
$event->type_color=$obj->color;
|
$event->type_color=$obj->color;
|
||||||
//$event->libelle=$obj->label; // deprecated
|
//$event->libelle=$obj->label; // deprecated
|
||||||
@ -476,7 +480,6 @@ if ($resql)
|
|||||||
//$event->author->id=$obj->fk_user_author; // user id of creator
|
//$event->author->id=$obj->fk_user_author; // user id of creator
|
||||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||||
$event->fetch_userassigned(); // This load $event->userassigned
|
|
||||||
$event->priority=$obj->priority;
|
$event->priority=$obj->priority;
|
||||||
$event->fulldayevent=$obj->fulldayevent;
|
$event->fulldayevent=$obj->fulldayevent;
|
||||||
$event->location=$obj->location;
|
$event->location=$obj->location;
|
||||||
@ -494,15 +497,15 @@ if ($resql)
|
|||||||
// They are date start and end of action but modified to not be outside calendar view.
|
// They are date start and end of action but modified to not be outside calendar view.
|
||||||
if ($event->percentage <= 0)
|
if ($event->percentage <= 0)
|
||||||
{
|
{
|
||||||
$event->date_start_in_calendar=$event->datep;
|
$event->date_start_in_calendar=$datep;
|
||||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
|
||||||
else $event->date_end_in_calendar=$event->datep;
|
else $event->date_end_in_calendar=$datep;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$event->date_start_in_calendar=$event->datep;
|
$event->date_start_in_calendar=$datep;
|
||||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
|
||||||
else $event->date_end_in_calendar=$event->datep;
|
else $event->date_end_in_calendar=$datep;
|
||||||
}
|
}
|
||||||
// Define ponctual property
|
// Define ponctual property
|
||||||
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
||||||
@ -515,10 +518,14 @@ if ($resql)
|
|||||||
$event->date_start_in_calendar >= $lastdaytoshow)
|
$event->date_start_in_calendar >= $lastdaytoshow)
|
||||||
{
|
{
|
||||||
// This record is out of visible range
|
// This record is out of visible range
|
||||||
|
unset($event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
//print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'<br>'."\n";
|
||||||
|
$event->fetch_userassigned(); // This load $event->userassigned
|
||||||
|
|
||||||
|
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||||
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
||||||
|
|
||||||
// Add an entry in actionarray for each day
|
// Add an entry in actionarray for each day
|
||||||
@ -548,6 +555,7 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -869,7 +877,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
$cases1 = array(); // Color first half hour
|
$cases1 = array(); // Color first half hour
|
||||||
$cases2 = array(); // Color second half hour
|
$cases2 = array(); // Color second half hour
|
||||||
|
|
||||||
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
$curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0);
|
||||||
|
|
||||||
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
|
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
|
||||||
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
||||||
@ -1029,6 +1037,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now output $casesX
|
||||||
for ($h = $begin_h; $h < $end_h; $h++)
|
for ($h = $begin_h; $h < $end_h; $h++)
|
||||||
{
|
{
|
||||||
$color1='';$color2='';
|
$color1='';$color2='';
|
||||||
|
|||||||
@ -98,12 +98,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$param=($mode=='mine'?'&mode=mine':'');
|
$param=($mode=='mine'?'&mode=mine':'');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Project card
|
// Project card
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Title
|
// Title
|
||||||
$morehtmlref.=$object->title;
|
$morehtmlref.=$object->title;
|
||||||
@ -113,29 +113,29 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
// Define a complementary filter for search of next/prev ref.
|
// Define a complementary filter for search of next/prev ref.
|
||||||
if (! $user->rights->projet->all->lire)
|
if (! $user->rights->projet->all->lire)
|
||||||
{
|
{
|
||||||
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
|
||||||
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Visibility
|
// Visibility
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
|
||||||
if ($object->public) print $langs->trans('SharedProject');
|
if ($object->public) print $langs->trans('SharedProject');
|
||||||
else print $langs->trans('PrivateProject');
|
else print $langs->trans('PrivateProject');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date start - end
|
// Date start - end
|
||||||
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
|
||||||
$start = dol_print_date($object->date_start,'dayhour');
|
$start = dol_print_date($object->date_start,'dayhour');
|
||||||
@ -145,45 +145,45 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print ($end?$end:'?');
|
print ($end?$end:'?');
|
||||||
if ($object->hasDelay()) print img_warning("Late");
|
if ($object->hasDelay()) print img_warning("Late");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Budget
|
// Budget
|
||||||
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
|
||||||
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency);
|
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$cols = 2;
|
$cols = 2;
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="fichehalfright">';
|
print '<div class="fichehalfright">';
|
||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print nl2br($object->description);
|
print nl2br($object->description);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
if($conf->categorie->enabled) {
|
if($conf->categorie->enabled) {
|
||||||
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
|
||||||
print $form->showCategories($object->id,'project',1);
|
print $form->showCategories($object->id,'project',1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth"></div>';
|
print '<div class="clearboth"></div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3425,6 +3425,15 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
|
|||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ============================================================================== */
|
||||||
|
/* Gantt
|
||||||
|
/* ============================================================================== */
|
||||||
|
|
||||||
|
td.gtaskname {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
|
|||||||
@ -3508,6 +3508,17 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; }
|
|||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================================== */
|
||||||
|
/* Gantt
|
||||||
|
/* ============================================================================== */
|
||||||
|
|
||||||
|
td.gtaskname {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user