From c16a150a708c6a6345050c39f26004d3f5679f0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2017 20:02:46 +0100 Subject: [PATCH] NEW Remove background on agenda view when event is a not busy event. --- htdocs/comm/action/card.php | 37 ++++++++++++++----- htdocs/comm/action/class/actioncomm.class.php | 9 +++-- .../comm/action/class/cactioncomm.class.php | 19 ++++++++-- htdocs/comm/action/index.php | 15 ++++++-- htdocs/comm/action/list.php | 25 ++++++++----- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 4 +- htdocs/core/class/html.formactions.class.php | 2 +- htdocs/langs/en_US/commercial.lang | 1 + htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 11 files changed, 82 insertions(+), 36 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index eeb01cfb116..03c087e1a4e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -133,7 +133,7 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) { $assignedtouser=json_decode($_SESSION['assignedtouser'], true); } - $assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'),'mandatory'=>1); + $assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'), 'mandatory'=>1); $_SESSION['assignedtouser']=json_encode($assignedtouser); } $donotclearsession=1; @@ -439,7 +439,7 @@ if ($action == 'update') if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users { // Restore array with key with same value than param 'id' - $tmplist1=json_decode($_SESSION['assignedtouser'], true); $tmplist2=array(); + $tmplist1=json_decode($_SESSION['assignedtouser'], true); foreach($tmplist1 as $key => $val) { if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; @@ -449,7 +449,6 @@ if ($action == 'update') $assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0); if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first } - $object->userassigned=array(); $object->userownerid=0; // Clear old content $i=0; foreach($listofuserid as $key => $val) @@ -460,6 +459,7 @@ if ($action == 'update') } $object->transparency = $transparency; // We set transparency on event (even if we can also store it on each user, standard says this property is for event) + // TODO store also transparency on owner user if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { @@ -954,11 +954,11 @@ if ($id > 0) $object->location = GETPOST('location'); $object->socid = GETPOST("socid"); $socpeopleassigned = GETPOST("socpeopleassigned",'array'); - foreach ($socpeopleassigned as $id) $object->socpeopleassigned[$id] = array('id' => $id); + foreach ($socpeopleassigned as $tmpid) $object->socpeopleassigned[$id] = array('id' => $tmpid); $object->contactid = GETPOST("contactid",'int'); $object->fk_project = GETPOST("projectid",'int'); - $object->note = GETPOST("note"); + $object->note = GETPOST("note",'none'); } if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) @@ -1136,11 +1136,21 @@ if ($id > 0) $listofuserid=array(); // User assigned if (empty($donotclearsession)) { - if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid, 'type'=>'user', 'transparency'=>$object->userassigned[$user->id]['transparency'], 'answer_status'=>$object->userassigned[$user->id]['answer_status'], 'mandatory'=>$object->userassigned[$user->id]['mandatory']); // Owner first + if ($object->userownerid > 0) + { + $listofuserid[$object->userownerid]=array( + 'id'=>$object->userownerid, + 'type'=>'user', + //'transparency'=>$object->userassigned[$user->id]['transparency'], + 'transparency'=>$object->transparency, // Force transparency on ownerfrom event + 'answer_status'=>$object->userassigned[$object->userownerid]['answer_status'], + 'mandatory'=>$object->userassigned[$object->userownerid]['mandatory'] + ); + } if (! empty($object->userassigned)) // Now concat assigned users { // Restore array with key with same value than param 'id' - $tmplist1=$object->userassigned; $tmplist2=array(); + $tmplist1=$object->userassigned; foreach($tmplist1 as $key => $val) { if ($val['id'] && $val['id'] != $object->userownerid) @@ -1384,11 +1394,19 @@ if ($id > 0) $listofuserid=array(); if (empty($donotclearsession)) { - if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first + if ($object->userownerid > 0) + { + $listofuserid[$object->userownerid]=array( + 'id'=>$object->userownerid, + 'transparency'=>$object->transparency, // Force transparency on onwer from preoperty of event + 'answer_status'=>$object->userassigned[$object->userownerid]['answer_status'], + 'mandatory'=>$object->userassigned[$object->userownerid]['mandatory'] + ); + } if (! empty($object->userassigned)) // Now concat assigned users { // Restore array with key with same value than param 'id' - $tmplist1=$object->userassigned; $tmplist2=array(); + $tmplist1=$object->userassigned; foreach($tmplist1 as $key => $val) { if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; @@ -1403,6 +1421,7 @@ if ($id > 0) $listofuserid=json_decode($_SESSION['assignedtouser'], true); } } + $listofcontactid=array(); // not used yet $listofotherid=array(); // not used yet print '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 82ca607b5f8..2eb14c6abf8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -571,8 +571,9 @@ class ActionComm extends CommonObject $this->type_color = $obj->type_color; $this->type_picto = $obj->type_picto; $transcode=$langs->trans("Action".$obj->type_code); - $type_label=($transcode!="Action".$obj->type_code?$transcode:$obj->type_label); - $this->type = $type_label; + $this->type = (($transcode!="Action".$obj->type_code) ? $transcode : $obj->type_label); + $transcode=$langs->trans("Action".$obj->type_code.'Short'); + $this->type_short = (($transcode!="Action".$obj->type_code.'Short') ? $transcode : ''); $this->code = $obj->code; $this->label = $obj->label; @@ -589,11 +590,11 @@ class ActionComm extends CommonObject $this->authorid = $obj->fk_user_author; $this->usermodid = $obj->fk_user_mod; - if (!is_object($this->author)) $this->author = new stdClass(); // For avoid warning + if (!is_object($this->author)) $this->author = new stdClass(); // To avoid warning $this->author->id = $obj->fk_user_author; // deprecated $this->author->firstname = $obj->firstname; // deprecated $this->author->lastname = $obj->lastname; // deprecated - if (!is_object($this->usermod)) $this->usermod = new stdClass(); // For avoid warning + if (!is_object($this->usermod)) $this->usermod = new stdClass(); // To avoid warning $this->usermod->id = $obj->fk_user_mod; // deprecated $this->userownerid = $obj->fk_user_action; diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index c03763c13a6..ec79fb68574 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -107,9 +107,10 @@ class CActionComm * @param string $excludetype Type to exclude ('system' or 'systemauto') * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual" * @param string $morefilter Add more SQL filter + * @param int $shortlabel 1=Get short label instead of long label * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ - function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='') + function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='', $shortlabel=0) { global $langs,$conf; $langs->load("commercial"); @@ -154,11 +155,21 @@ class CActionComm if ($qualified) { + $keyfortrans=''; $code=$obj->code; if ($onlyautoornot > 0 && $code == 'AC_OTH') $code='AC_MANUAL'; if ($onlyautoornot > 0 && $code == 'AC_OTH_AUTO') $code='AC_AUTO'; - $transcode=$langs->trans("Action".$code); - $label = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label)); + if ($shortlabel) + { + $keyfortrans="Action".$code.'Short'; + $transcode=$langs->trans($keyfortrans); + } + if (empty($keyfortrans) || $keyfortrans == $transcode) + { + $keyfortrans="Action".$code; + $transcode=$langs->trans($keyfortrans); + } + $label = (($transcode!=$keyfortrans) ? $transcode : $langs->trans($obj->label)); if ($onlyautoornot == -1 && ! empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/auto/i', $code)) { $label='  '.$label; @@ -166,7 +177,7 @@ class CActionComm $repcode['AC_NON_AUTO']=$langs->trans("ActionAC_MANUAL"); } $repid[$obj->id] = $label; - $repcode[$obj->code] = $label; + $repcode[$obj->code] = $label; if ($onlyautoornot > 0 && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')'; } $i++; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index eb505228b3f..4418cc014fb 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1373,9 +1373,18 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa //print ' position: absolute; top: 40px; width: 50%;'; //print '"'; print '>'; - print 'transparency)?' cal_event_notbusy':' cal_event_busy').'" style="'.$h; + if (empty($event->transparency)) + { + print 'border: 2px solid #'.$color.';'; + } + else + { + print 'background: #'.$color.';'; + print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($color, -3).'), 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;"'; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index b727c023778..ae32f09a31e 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -121,8 +121,8 @@ $hookmanager->initHooks(array('agendalist')); $arrayfields=array( 'a.id'=>array('label'=>"Ref", 'checked'=>1), 'owner'=>array('label'=>"Owner", 'checked'=>1), - 'a.label'=>array('label'=>"Title", 'checked'=>1), 'c.libelle'=>array('label'=>"Type", 'checked'=>1), + 'a.label'=>array('label'=>"Title", 'checked'=>1), 'a.datep'=>array('label'=>"DateStart", 'checked'=>1), 'a.datep2'=>array('label'=>"DateEnd", 'checked'=>1), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), @@ -542,7 +542,7 @@ if ($resql) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction=new CActionComm($db); - $arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0)); + $arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1); $var=true; while ($i < min($num,$limit)) @@ -584,17 +584,21 @@ if ($resql) else print ' '; print ''; } - if (! empty($arrayfields['c.libelle']['checked'])) { - // Type + + // Type + if (! empty($arrayfields['c.libelle']['checked'])) + { print ''; } + + // Label if (! empty($arrayfields['a.label']['checked'])) { - // Label print ''; } + // Start date if (! empty($arrayfields['a.datep']['checked'])) { - // Start date print ''; print ''; print '
'; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if ($actionstatic->type_picto) print img_picto('', $actionstatic->type_picto); else { - if ($actionstatic->type_code == 'AC_RDV') print img_picto('', 'object_group').' '; - if ($actionstatic->type_code == 'AC_TEL') print img_picto('', 'object_phoning').' '; - if ($actionstatic->type_code == 'AC_FAX') print img_picto('', 'object_phoning_fax').' '; - if ($actionstatic->type_code == 'AC_EMAIL') print img_picto('', 'object_email').' '; + if ($actionstatic->type_code == 'AC_RDV') print img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' '; + elseif ($actionstatic->type_code == 'AC_TEL') print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' '; + elseif ($actionstatic->type_code == 'AC_FAX') print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' '; + elseif ($actionstatic->type_code == 'AC_EMAIL') print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' '; + elseif ($actionstatic->type_code == 'AC_INT') print img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' '; + elseif (! preg_match('/_AUTO/', $actionstatic->type_code)) print img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' '; } } $labeltype=$obj->type_code; @@ -603,15 +607,16 @@ if ($resql) print dol_trunc($labeltype,28); print ''; print $actionstatic->label; print ''; print dol_print_date($db->jdate($obj->dp),"dayhour"); $late=0; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 93031ef9725..23315ef2778 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4361,7 +4361,7 @@ abstract class CommonObject /** - * Function to get extra fields of a member into $this->array_options + * Function to get extra fields of an object into $this->array_options * This method is in most cases called by method fetch of objects but you can call it separately. * * @param int $rowid Id of line. Use the id of object if not defined. Deprecated. Function must be called without parameters. diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 25a794745f2..533a18524e3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1692,10 +1692,10 @@ class Form // Show my availability if ($showproperties) { - if ($user->id == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($user->id, array_keys($listofuserid))) + if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { $out.='
'; - $out.=' - '.$langs->trans("MyAvailability").': id]['transparency']?' checked':'').'>'.$langs->trans("Busy"); + $out.=' - '.$langs->trans("Availability").': '.$langs->trans("Busy"); $out.='
'; } } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 3fcf4a15bdd..7a0dc9b6cb6 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -246,7 +246,7 @@ class FormActions if ($action->type_code == 'AC_EMAIL') print img_picto('', 'object_email').' '; } } - print $action->type; + print $action->type_short ? $action->type_short : $action->type; print '
'.$label.''.dol_print_date($action->datep, 'dayhour', 'tzuserrel'); diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 4b2386e04d0..24f5bc100f6 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -66,6 +66,7 @@ ActionAC_OTH=Other ActionAC_OTH_AUTO=Automatically inserted events ActionAC_MANUAL=Manually inserted events ActionAC_AUTO=Automatically inserted events +ActionAC_OTH_AUTOShort=Auto Stats=Sales statistics StatusProsp=Prospect status DraftPropals=Draft commercial proposals diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index fc992bd5cf9..859e31706d8 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3539,7 +3539,7 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; } .cal_event a:link { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } -.cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); } +.cal_event_busy a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); } .cal_event_busy { } .cal_peruserviewname { max-width: 100px; height: 22px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 59f5ac9208c..a02cd7f60ac 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3608,7 +3608,7 @@ table.cal_event td.cal_event_right { padding: 4px 4px !important; } .cal_event a:link { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } -.cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); } +.cal_event_busy a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); } .cal_event_busy { } .cal_peruserviewname { max-width: 100px; height: 22px; }