Some fix on per user view.
This commit is contained in:
parent
0390085f54
commit
06cc08026b
@ -1248,46 +1248,48 @@ if ($id > 0)
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
// Link to agenda views
|
||||
print '<div id="agendaviewbutton">';
|
||||
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_month">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_week">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_day">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_peruser">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
|
||||
print '</form>'."\n";
|
||||
print '</div>';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
// Link to agenda views
|
||||
print '<div id="agendaviewbutton">';
|
||||
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_month">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_week">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_day">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_peruser">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
|
||||
print '</form>'."\n";
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -419,7 +419,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql2))
|
||||
{
|
||||
$this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency);
|
||||
if ($obj->fk_element > 0) $this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency);
|
||||
if (empty($this->userownerid)) $this->userownerid=$obj->fk_element; // If not defined (should not happened, we fix this)
|
||||
}
|
||||
|
||||
|
||||
@ -46,6 +46,11 @@ $filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filt
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && empty($conf->AGENDA_ALL_CALENDARS))
|
||||
{
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
|
||||
@ -56,6 +56,12 @@ $filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filt
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && empty($conf->AGENDA_ALL_CALENDARS))
|
||||
{
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
@ -98,6 +104,7 @@ $hookmanager->initHooks(array('agendalist'));
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
||||
{
|
||||
$param='';
|
||||
@ -144,7 +151,7 @@ $sql.= " a.fk_contact, a.note, a.label, a.percent as percent,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " ua.login as loginauthor, ua.rowid as useridauthor,";
|
||||
$sql.= " ut.login as logintodo, ut.rowid as useridtodo,";
|
||||
$sql.= " ud.login as logindone, ud.rowid as useriddone,";
|
||||
//$sql.= " ud.login as logindone, ud.rowid as useriddone,";
|
||||
$sql.= " sp.lastname, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.'user as u,';
|
||||
@ -154,7 +161,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON a.fk_user_author = ua.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid";
|
||||
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid";
|
||||
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
|
||||
$sql.= " WHERE c.id = a.fk_action";
|
||||
$sql.= ' AND a.fk_user_author = u.rowid';
|
||||
@ -244,7 +251,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AffectedTo"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -47,6 +47,11 @@ $usergroup = GETPOST("usergroup","int",3);
|
||||
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
$showbirthday = 0;
|
||||
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && empty($conf->AGENDA_ALL_CALENDARS))
|
||||
{
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -557,30 +562,32 @@ while ($i < 7)
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
|
||||
// Define $usernames
|
||||
$usernames = array(); //init
|
||||
/* Use this to have list of users only if users have events
|
||||
$usernamesid = array();
|
||||
/* Use this to have list of users only if users have events */
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
$annee = date('Y',$daykey);
|
||||
$mois = date('m',$daykey);
|
||||
$jour = date('d',$daykey);
|
||||
//if ($day==$jour && $month==$mois && $year==$annee)
|
||||
//{
|
||||
//Tout les events à la même date :
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
$myuser = new User($db);
|
||||
$user_id = $event->usertodo->id;
|
||||
$myuser->fetch($user_id);
|
||||
$username = $myuser->getFullName($langs);
|
||||
if (! in_array($username, $usernames))
|
||||
{
|
||||
$usernames[] = $username;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}*/
|
||||
// Get all assigned users for each event
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
$event->fetch_userassigned();
|
||||
$listofuserid=$event->userassigned;
|
||||
foreach($listofuserid as $userid => $tmp)
|
||||
{
|
||||
if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($usernamesid as $id)
|
||||
{
|
||||
$tmpuser=new User($db);
|
||||
$result=$tmpuser->fetch($id);
|
||||
$usernames[]=$tmpuser;
|
||||
}
|
||||
|
||||
/*
|
||||
if ($filtert > 0)
|
||||
{
|
||||
$tmpuser = new User($db);
|
||||
@ -598,7 +605,7 @@ else
|
||||
$tmpgroup = new UserGroup($db);
|
||||
//$tmpgroup->fetch($usergroup); No fetch, we want all users for all groups
|
||||
$usernames = $tmpgroup->listUsersForGroup();
|
||||
}
|
||||
}*/
|
||||
|
||||
// Load array of colors by type
|
||||
$colorsbytype=array();
|
||||
|
||||
@ -74,7 +74,7 @@ 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("ActionAffectedTo").' ';
|
||||
print $langs->trans("ActionsOwnedBy").' ';
|
||||
print '</td><td class="nowrap maxwidthonsmartphone">';
|
||||
//print $langs->trans("User");
|
||||
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
|
||||
|
||||
@ -7,6 +7,7 @@ Agendas=Agendas
|
||||
Calendar=Calendar
|
||||
Calendars=Calendars
|
||||
LocalAgenda=Internal calendar
|
||||
ActionsOwnedBy=Event owned by
|
||||
AffectedTo=Assigned to
|
||||
DoneBy=Done by
|
||||
Event=Event
|
||||
|
||||
@ -2375,7 +2375,7 @@ table.cal_month { border-spacing: 0px; }
|
||||
.cal_past { }
|
||||
.cal_peruser { padding: 0px; }
|
||||
.peruser_busy { background: #CC8888; }
|
||||
.peruser_notbusy { background: #EEDDDD; }
|
||||
.peruser_notbusy { background: #EEDDDD; opacity: 0.5; }
|
||||
table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px;
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25);
|
||||
moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user