diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f0bb9f92e22..6452e3ca922 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1236,8 +1236,12 @@ class ActionComm extends CommonObject $result=''; - // Set label of typ - $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label; + // Set label of type + $labeltype = ''; + if ($this->type_code) + { + $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label; + } if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL'); @@ -1289,7 +1293,7 @@ class ActionComm extends CommonObject $linkstart.=$linkclose.'>'; $linkend=''; - //print 'rrr'.$this->libelle.'-'.$withpicto; + //print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto; if ($withpicto == 2) { @@ -1309,7 +1313,10 @@ class ActionComm extends CommonObject { if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) // Add code into () { - $libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':''); + if ($labeltype) + { + $libelle.=(preg_match('/'.preg_quote($labeltype,'/').'/', $libelle)?'':' ('.$langs->transnoentities("Action".$this->type_code).')'); + } } } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index efdad6a3738..a042007f54f 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -589,6 +589,7 @@ if ($resql) $event->type_color=$obj->type_color; $event->libelle=$obj->label; + $event->label=$obj->label; $event->percentage=$obj->percent; $event->authorid=$obj->fk_user_author; // user id of creator $event->userownerid=$obj->fk_user_action; // user id of owner @@ -601,7 +602,9 @@ if ($resql) $event->elementtype=$obj->elementtype; $event->societe->id=$obj->fk_soc; + $event->thirdparty_id=$obj->fk_soc; $event->contact->id=$obj->fk_contact; + $event->contact_id=$obj->fk_contact; // Defined date_start_in_calendar and date_end_in_calendar property // They are date start and end of action but modified to not be outside calendar view. @@ -1176,19 +1179,72 @@ else // View by day $timestamp=dol_mktime(12,0,0,$month,$day,$year); $arraytimestamp=dol_getdate($timestamp); - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - echo ''; - echo ' '; - echo ' \n"; - echo " \n"; - echo " \n"; - echo ' \n"; - echo " \n"; + //echo '
'.$langs->trans("Day".$arraytimestamp['wday'])."
'; - $maxnbofchar=80; - show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); - echo "
'; + echo '
'; + + echo ' '; + echo ' '; + echo ' \n"; + echo " \n"; + + /* + echo '
'; + echo '
'; + echo '
'; + echo show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, -1); + echo '
'."\n"; + echo "
\n"; + */ + echo '
'.$langs->trans("Day".$arraytimestamp['wday'])."
'; - print '
'; + + /* WIP View per hour */ + $useviewhour = 0; + if ($useviewhour) + { + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + + $maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 500)?($_SESSION["dol_screenheight"]-200):660; // Also into index.php file + + echo '
'; + echo '
'; + + $maxnbofchar=80; + + $tmp = explode('-', $conf->global->MAIN_DEFAULT_WORKING_HOURS); + $minhour = round($tmp[0],0); + $maxhour = round($tmp[1],0); + if ($minhour > 23) $minhour = 23; + if ($maxhour < 1) $maxhour = 1; + if ($maxhour <= $minhour) { $maxhour = $minhour + 1; } + + $i = 0; + $j = 0; + while ($i < 24) + { + echo '
'."\n"; + echo '
'.dol_print_date($i*3600, 'hour', 'gmt').'
'; + echo '
'; + echo "
\n"; + echo "
\n"; + $i++; + $j++; + } + + echo '
'; + + show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1); + + print '
'; + } + else + { + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + + show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0); + + print '
'; + } } print "\n".''; @@ -1213,9 +1269,10 @@ $db->close(); * @param string $newparam Parameters on current URL * @param int $showinfo Add extended information (used by day and week view) * @param int $minheight Minimum height for each event. 60px by default. + * @param string $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button" * @return void */ -function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60) +function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $nonew=0) { global $user, $conf, $langs; global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form @@ -1230,26 +1287,35 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $curtime = dol_mktime(0, 0, 0, $month, $day, $year); print '
'."\n"; - print '
'; - if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) + if ($nonew <= 0) { - $newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year; + print '
'; + if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) + { + $newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year; - //$param='month='.$monthshown.'&year='.$year; - $hourminsec='100000'; - print ''; - print img_picto($langs->trans("NewAction"),'edit_add.png'); - print ''; + //$param='month='.$monthshown.'&year='.$year; + $hourminsec='100000'; + print ''; + print img_picto($langs->trans("NewAction"),'edit_add.png'); + print ''; + } + print '
'."\n"; + } + + if ($nonew < 0) + { + print '
'; + return; } - print '
'."\n"; // Line with td contains all div of each events print '
'; @@ -1390,6 +1456,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa //print ' position: absolute; top: 40px; width: 50%;'; //print '"'; print '>'; + //var_dump($event->userassigned); //var_dump($event->transparency); print '