From c51b964b1966e1a6aa2b1bd8f3f4592897efb9a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Oct 2014 03:44:20 +0200 Subject: [PATCH] Fix: Pb when showing availability --- htdocs/comm/action/card.php | 27 ++++++++++++++++++++++++--- htdocs/langs/en_US/agenda.lang | 2 +- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 2b59b6cf622..74762b40c63 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -679,8 +679,15 @@ if ($action == 'create') if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first $_SESSION['assignedtouser']=dol_json_encode($listofuserid); } + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + } + } print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1); - print $langs->trans("MyAvailability").': '.$langs->trans("Busy"); + if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.$langs->trans("Busy"); print ''; // Realised by @@ -922,8 +929,15 @@ if ($id > 0) } $_SESSION['assignedtouser']=dol_json_encode($listofuserid); } + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + } + } print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1); - print $langs->trans("MyAvailability").': id]['transparency']?' checked="checked"':'').'">'.$langs->trans("Busy"); + if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': id]['transparency']?' checked="checked"':'').'">'.$langs->trans("Busy"); print ''; // Realised by @@ -1085,8 +1099,15 @@ if ($id > 0) } $_SESSION['assignedtouser']=dol_json_encode($listofuserid); } + else + { + if (!empty($_SESSION['assignedtouser'])) + { + $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); + } + } print $form->select_dolusers_forevent('view','assignedtouser',1); - print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody + if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody print ' '; // Done by diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index dd793c7bfdd..8c4fdabce7d 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -89,4 +89,4 @@ ExtSiteNoLabel=No Description WorkingTimeRange=Working time range WorkingDaysRange=Working days range AddEvent=Create event -MyAvailability=Ma disponibilité \ No newline at end of file +MyAvailability=My availability \ No newline at end of file