diff --git a/ChangeLog b/ChangeLog index 841e4b39651..d93f5199c40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,12 +6,10 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: - New: PDF event report show project and status of event. -- New: Onto event summary of elements, end date and status are visible. - New: Can filter on status on interventions. - New: Add help info of field type into dictionary of payment types. - New: Add proposals into referer page of thirdparty. - New: On contact list can set filter on both active and not active (no more exclusive select). -- New: Each user can include its own external ics calendar into dolibarr agenda view. - New: Intervention documents are now available in ECM module. - New: Can attach supplier order to a customer order. - New: Supervisor is now visible into user list. @@ -22,16 +20,21 @@ For users: - New: No more dependency between contract and service module. - New: [ task #867 ] Remove ESAEB external module code from core. - New: Can create proposal from an intervention. +- New: An event can be assigned to several users. - New: Can filter events on a group of users. - New: Can filter events of a thirdparty. +- New: Onto event summary of elements, end date and status are visible. - New: Split Agenda view (month, week, day) into different tabs. +- New: Add a view "per user" of agenda events (with different colors according to type of event). +- New: Each user can include its own external ics calendar into dolibarr agenda view. +- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to + create an automatic event into agenda. +- New: Add new type of event (when type of events are used, not by default). +- New: Can disable predefined type of events. - New: Form to add a photo is immediatly available on photo page if permissions are ok (save one click per photo to add). - New: Add option PRODUCT_MAX_VISIBLE_PHOTO to limit number of photos shown on main product card. -- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to - create an automatic event into agenda. -- New: Add new type of event (when type of events are used, not by default). - New: Add country into table of thirdparties type. This will allow to provide a list of thirdparty types specific to a country (like argentina that need type A or B). diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index dd8fa456600..7a84470b320 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent @@ -375,7 +375,7 @@ $tabfieldcheck[24] = array(); complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck); -// Define elementList and sourceList (used for dictionary "type of contacts") +// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact") $elementList = array(); $sourceList=array(); if ($id == 11) @@ -412,7 +412,7 @@ if ($id == 11) ); } -// Define localtax_typeList (used for dictionary "c_tva") +// Define localtax_typeList (used for dictionary "llx_c_tva") $localtax_typeList = array(); if ($id == 10) { @@ -425,7 +425,6 @@ if ($id == 10) "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), ); - if (! empty($conf->global->MAIN_USE_LOCALTAX_TYPE_7)) $localtax_typeList["7"]= $langs->trans("Yes").' ('.$langs->trans("Type")." 7)"; //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype } @@ -445,6 +444,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; + if ($value == 'color' && empty($_POST['color'])) continue; if ((! isset($_POST[$value]) || $_POST[$value]=='') && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory ) @@ -1127,27 +1127,29 @@ if ($id) } } - // Est-ce une entree du dictionnaire qui peut etre desactivee ? - // True by default - $iserasable=1; + // Can an entry be erased or disabled ? + $iserasable=1;$isdisable=1; // true by default if (isset($obj->code)) { - if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable = 0; - else if ($obj->code == 'RECEP') $iserasable = 0; - else if ($obj->code == 'EF0') $iserasable = 0; + if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; } + else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; } + else if ($obj->code == 'EF0') { $iserasable = 0; $isdisable = 0; } } - if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0; + if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; } + if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $isdisable=0; $isdisable = 0; } $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&'; // Active print ''; - if ($iserasable) print ''.$actl[$obj->active].''; + if ($isdisable) print ''.$actl[$obj->active].''; else { - if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto')) && empty($obj->active)) print $langs->trans("Deprecated"); + if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive"); + else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated"); + else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption"); else print $langs->trans("AlwaysActive"); } print ""; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 827e2df976a..e92dacc5dc9 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -35,7 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; -if (! empty($conf->projet->enabled)) { +if (! empty($conf->projet->enabled)) +{ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -366,8 +367,8 @@ if ($action == 'update') $object->location = GETPOST('location'); $object->socid = $_POST["socid"]; $object->contactid = $_POST["contactid"]; - $object->societe->id = $_POST["socid"]; // deprecated - $object->contact->id = $_POST["contactid"]; // deprecated + //$object->societe->id = $_POST["socid"]; // deprecated + //$object->contact->id = $_POST["contactid"]; // deprecated $object->fk_project = $_POST["projectid"]; $object->note = $_POST["note"]; $object->pnote = $_POST["note"]; @@ -380,13 +381,14 @@ if ($action == 'update') setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")),$object->errors,'errors'); $action = 'edit'; } + + $transparency=(GETPOST("transparency")=='on'?1:0); + // Users $listofuserid=array(); - //$assignedtouser=(GETPOST("assignedtouser") >0)?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : 0); - $assignedtouser=(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : 0); - if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>$object->transparency); // Owner first - - if (! empty($_SESSION['assignedtouser'])) + $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 + if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users { // Restore array with key with same value than param 'id' $tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array(); @@ -399,7 +401,7 @@ if ($action == 'update') $object->userassigned=array(); // Clear old content foreach($listofuserid as $key => $val) { - $object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>(GETPOST("transparency")=='on'?1:0)); + $object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>($user->id == $val['id'] ? $transparency : '')); } if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) @@ -670,36 +672,19 @@ if ($action == 'create') $listofuserid=array(); if (empty($donotclearsession)) { - $assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id); + $assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id); if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first $_SESSION['assignedtouser']=dol_json_encode($listofuserid); } - /* - if (empty($donotclearsession)) - { - $assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id); - $_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('id'=>$assignedtouser,'transparency'=>1,'mandatory'=>1))); - }*/ print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1); - //print $form->select_dolusers(GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1); - print ''; - - print ''; - - print '

'; - - print ''; - - // Busy - print ''; // Realised by if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { print ''; } @@ -803,6 +788,7 @@ if ($id > 0) { $result1=$object->fetch($id); $result2=$object->fetch_thirdparty(); + $result2=$object->fetch_contact(); $result3=$object->fetch_userassigned(); $result4=$object->fetch_optionals($id,$extralabels); @@ -812,20 +798,15 @@ if ($id > 0) exit; } - if ($object->author->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->author->id); $object->author=$tmpuser; } - if ($object->usermod->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermod->id); $object->usermod=$tmpuser; } - if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; } - if ($object->userdone->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdone->id); $object->userdone=$tmpuser; } + if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; } + if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; } + + if ($object->userownerid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userownerid); $object->usertodo=$tmpuser; } + if ($object->userdoneid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdoneid); $object->userdone=$tmpuser; } - $contact = new Contact($db); - if ($object->contact->id) - { - $result=$contact->fetch($object->contact->id,$user); - } - $object->contact = $contact; /* - * Affichage onglets + * Show tabs */ $head=actions_prepare_head($object); @@ -867,7 +848,6 @@ if ($id > 0) print ''."\n"; } - // Fiche action en mode edition print ''; print ''; print ''; @@ -926,30 +906,33 @@ if ($id > 0) $listofuserid=array(); if (empty($donotclearsession)) { - if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency); // Owner first - $listofuserid=array_merge($listofuserid,$object->userassigned); + if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->userassigned[$user->id]['transparency'],'answer_status'=>$object->userassigned[$user->id]['answer_status'],'mandatory'=>$object->userassigned[$user->id]['mandatory']); // Owner first + if (! empty($object->userassigned)) // Now concat assigned users + { + // Restore array with key with same value than param 'id' + $tmplist1=$object->userassigned; $tmplist2=array(); + foreach($tmplist1 as $key => $val) + { + if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; + } + } $_SESSION['assignedtouser']=dol_json_encode($listofuserid); } print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1); - //print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'assignedtouser',1); - print ''; - - print '
'.$langs->trans("Busy").''; - print ''; + print $langs->trans("MyAvailability").': '.$langs->trans("Busy"); print '
'.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1); + print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdoneid) && $percent==100?$object->userdoneid:0),'doneby',1); print '


'; - - // Busy - print ''; // Realised by if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { print ''; } - print '
'.$langs->trans("Busy").''; - print 'transparency?' checked="checked"':'').'">'; + print $langs->trans("MyAvailability").': id]['transparency']?' checked="checked"':'').'">'.$langs->trans("Busy"); print '
'.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1); + print $form->select_dolusers($object->userdoneid> 0?$object->userdoneid:-1,'doneby',1); print '


'; + print ''; + + print '

'; print ''; @@ -960,12 +943,12 @@ if ($id > 0) print ''; // Contact print ''; } @@ -979,10 +962,10 @@ if ($id > 0) $langs->load("project"); print ''; } @@ -1056,99 +1039,65 @@ if ($id > 0) if (empty($conf->global->AGENDA_DISABLE_LOCATION)) $rowspan++; // Date start - print ''; - print ''; print ''; // Date end - print ''; // Status - print ''; // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { - print ''; + print ''; } // Assigned to - //if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1); - print ''; - - print '
'; $events=array(); $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); - print $form->select_company($object->thirdparty->id,'socid','',1,1,0,$events); + print $form->select_company($object->socid,'socid','',1,1,0,$events); print ''.$langs->trans("Contact").''; - $form->select_contacts($object->thirdparty->id, $object->contact->id,'contactid',1); + $form->select_contacts($object->socid, $object->contactid,'contactid',1); print '
'.$langs->trans("Project").''; - $numprojet=$formproject->select_projects($object->thirdparty->id,$object->fk_project,'projectid'); + $numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid'); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").''; } print '
'.$langs->trans("DateActionStart").''; + print '
'.$langs->trans("DateActionStart").''; if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); else print dol_print_date($object->datep,'day'); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); print ''."\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; - print ''."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; - print '
'."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; - print '
'."\n"; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; - print '
'."\n"; - print '
'.$langs->trans("DateActionEnd").''; + print '
'.$langs->trans("DateActionEnd").''; if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour'); else print dol_print_date($object->datef,'day'); if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; + print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print $object->getLibStatut(4); print '
'.$langs->trans("Location").''.$object->location.'
'.$langs->trans("Location").''.$object->location.'
'.$langs->trans("ActionAffectedTo").''; + print '
'.$langs->trans("ActionAffectedTo").''; $listofuserid=array(); if (empty($donotclearsession)) { - if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency); // Owner first - $listofuserid=array_merge($listofuserid,$object->userassigned); + if (is_object($object->usertodo)) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first + if (! empty($object->userassigned)) // Now concat assigned users + { + // Restore array with key with same value than param 'id' + $tmplist1=$object->userassigned; $tmplist2=array(); + foreach($tmplist1 as $key => $val) + { + if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; + } + } $_SESSION['assignedtouser']=dol_json_encode($listofuserid); - //var_dump($_SESSION['assignedtouser']); } print $form->select_dolusers_forevent('view','assignedtouser',1); - print '


'; - - // Busy - print ''; + 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 if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''; } - print '
'.$langs->trans("Busy").''; - if ($object->usertodo->id > 0) print yn(($object->transparency > 0)?1:0); // We show nothing if event is assigned to nobody - print '
'.$langs->trans("ActionDoneBy").''; - if ($object->userdone->id > 0) print $object->userdone->getNomUrl(1); + if ($object->userdoneid > 0) print $object->userdone->getNomUrl(1); print '


'; + print '
'; + + print '

'; + + print ''; // Third party - Contact if ($conf->societe->enabled) @@ -1164,12 +1113,12 @@ if ($id > 0) print ''; print ''; print '
'.$langs->trans("Contact").''; - if ($object->contact->id > 0) + if ($object->contactid > 0) { print $object->contact->getNomUrl(1); - if ($object->contact->id && $object->type_code == 'AC_TEL') + if ($object->contactid && $object->type_code == 'AC_TEL') { - if ($object->contact->fetch($object->contact->id)) + if ($object->contact->fetch($object->contactid)) { print "
".dol_print_phone($object->contact->phone_pro); } @@ -1250,7 +1199,7 @@ if ($id > 0) if ($action != 'edit') { if ($user->rights->agenda->allactions->create || - (($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->create)) + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { print ''; } @@ -1260,7 +1209,7 @@ if ($id > 0) } if ($user->rights->agenda->allactions->delete || - (($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete)) + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) { print ''; } @@ -1272,6 +1221,47 @@ if ($id > 0) } print ''; + + + // Link to agenda views + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; + print '
'."\n"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; + print '
'."\n"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; + print '
'."\n"; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; + print '
'."\n"; + print '
'; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 773fdb48b0f..fc75488ee3d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -39,9 +39,10 @@ class ActionComm extends CommonObject var $id; - var $type_id; // id into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) - var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required). With defautl setup, should be AC_OTH_AUTO or AC_OTH - var $type; // label into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) + var $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set) + var $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. + var $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set) + var $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set) var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) var $label; @@ -56,7 +57,7 @@ class ActionComm extends CommonObject var $datef; // Date action end (datep2) var $durationp = -1; // -1=Unkown duration // deprecated var $fulldayevent = 0; // 1=Event on full day - var $punctual = 1; // Milestone + var $punctual = 1; // Milestone // TODO Not sure we need this. Milestone is already event with end date = start date var $percentage; // Percentage var $location; // Location @@ -66,7 +67,8 @@ class ActionComm extends CommonObject var $userassigned = array(); // Array of user ids var $userownerid; // Id of user owner - var $usertodo; // Object user of owner // deprecated + var $userdoneid; // Id of user done + var $usertodo; // Object user of owner // deprecated var $userdone; // Object user that did action // deprecated var $socid; @@ -352,25 +354,29 @@ class ActionComm extends CommonObject $this->note = $obj->note; $this->percentage = $obj->percentage; - $this->author->id = $obj->fk_user_author; - $this->author->firstname = $obj->firstname; - $this->author->lastname = $obj->lastname; - $this->usermod->id = $obj->fk_user_mod; + $this->authorid = $obj->fk_user_author; + $this->usermodid = $obj->fk_user_mod; + $this->author->id = $obj->fk_user_author; // deprecated + $this->author->firstname = $obj->firstname; // deprecated + $this->author->lastname = $obj->lastname; // deprecated + $this->usermod->id = $obj->fk_user_mod; // deprecated $this->userownerid = $obj->fk_user_action; + $this->userdoneid = $obj->fk_user_done; $this->usertodo->id = $obj->fk_user_action; // deprecated - //$this->userdone->id = $obj->fk_user_done; + $this->userdone->id = $obj->fk_user_done; // deprecated $this->priority = $obj->priority; $this->fulldayevent = $obj->fulldayevent; $this->location = $obj->location; $this->transparency = $obj->transparency; + $this->punctual = $obj->punctual; $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working - $this->contactid = $obj->fk_contact; + $this->contactid = $obj->fk_contact; // To have fetch_contact method working $this->fk_project = $obj->fk_project; // To have fetch_project method working - $this->societe->id = $obj->fk_soc; // For backward compatibility - $this->contact->id = $obj->fk_contact; // For backward compatibility + $this->societe->id = $obj->fk_soc; // deprecated + $this->contact->id = $obj->fk_contact; // deprecated $this->fk_element = $obj->fk_element; $this->elementtype = $obj->elementtype; @@ -1041,6 +1047,7 @@ class ActionComm extends CommonObject $event['fulldayevent']=$obj->fulldayevent; $event['location']=$obj->location; $event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) + $event['punctual']=$obj->punctual; $event['category']=$obj->libelle; // libelle type action // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); @@ -1146,7 +1153,7 @@ class ActionComm extends CommonObject $this->punctual=0; $this->percentage=0; $this->location='Location'; - $this->transparency=0; + $this->transparency=1; // 1 means opaque $this->priority=1; $this->note = 'Note'; } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 24502897ec1..a1c03a7f15e 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1140,7 +1140,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); - // Define $color and $cssclass of event + // Define $color (Hex string like '0088FF') and $cssclass of event $color=-1; $cssclass=''; $colorindex=-1; if (in_array($user->id, $keysofuserassigned)) { @@ -1163,8 +1163,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $color=$event->icalcolor; $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); } - else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } - else { $numother++; $cssclass='family_other'; } + else if ($event->type_code == 'BIRTHDAY') + { + $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); + } + else + { + $numother++; $cssclass='family_other'; + } if ($color == -1) // Color was not forced. Set color according to color index. { // Define color index if not yet defined diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 54dada1ff52..ad3bfddd2ef 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -108,7 +108,7 @@ $begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tm $end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5); if ($begin_d < 1 || $begin_d > 7) $begin_d = 1; 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; if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); @@ -321,7 +321,7 @@ $sql.= ' a.percent,'; $sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.fk_soc, a.fk_contact,'; -$sql.= ' ca.code'; +$sql.= ' ca.code, ca.color'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; @@ -396,6 +396,7 @@ if ($resql) $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date $event->datef=$db->jdate($obj->datep2); $event->type_code=$obj->code; + $event->type_color=$obj->color; //$event->libelle=$obj->label; // deprecated $event->label=$obj->label; $event->percentage=$obj->percent; @@ -665,7 +666,7 @@ jQuery(document).ready(function() { else if (ids.indexOf(",") > -1) /* There is several events */ { /* alert(\'several events\'); */ - url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid + url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+dateselectday; window.location.href = url; } else /* One event */ @@ -744,12 +745,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); - // Define $color and $cssclass of event + // Define $color (Hex string like '0088FF') and $cssclass of event $color=-1; $cssclass=''; $colorindex=-1; if (in_array($user->id, $keysofuserassigned)) { $nummytasks++; $cssclass='family_mytasks'; - // TODO Set color according to event type + $color=$event->type_color; } else if ($event->type_code == 'ICALEVENT') { @@ -760,15 +761,19 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } $numicals[dol_string_nospecial($event->icalname)]++; } + $color=$event->icalcolor; $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable'); } - else if ($event->type_code == 'BIRTHDAY') { + else if ($event->type_code == 'BIRTHDAY') + { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } - else { $numother++; $cssclass='family_other'; + else + { + $numother++; $cssclass='family_other'; } - if ($color == -1) // Color was not forced. Set color according to color index. + if ($color < 0) // Color was not forced. Set color according to color index. { // Define color index if not yet defined $idusertouse=($event->userownerid?$event->userownerid:0); @@ -791,7 +796,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & for ($h = $begin_h; $h < $end_h; $h++) { //if ($username->id == 1 && $day==1) print 'h='.$h; - $color = ''; //init + $newcolor = ''; //init if (empty($event->fulldayevent)) { $a = dol_mktime((int) $h,0,0,$month,$day,$year,false,false); @@ -801,6 +806,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $dateendtouse=$event->date_end_in_calendar; if ($dateendtouse==$event->date_start_in_calendar) $dateendtouse++; + //print dol_print_date($event->date_start_in_calendar,'dayhour').'-'.dol_print_date($a,'dayhour').'-'.dol_print_date($b,'dayhour').'
'; + if ($event->date_start_in_calendar < $b && $dateendtouse > $a) { $busy=$event->transparency; @@ -817,8 +824,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases1[$h][$event->id]['typecode']=$event->type_code; if ($event->socid) { - $cases1[$h][$event->id]['string'].='xxx'; + //$cases1[$h][$event->id]['string'].='xxx'; } + $cases1[$h][$event->id]['color']=$color; } if ($event->date_start_in_calendar < $c && $dateendtouse > $b) { @@ -836,8 +844,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases2[$h][$event->id]['typecode']=$event->type_code; if ($event->socid) { - $cases2[$h][$event->id]['string'].='xxx'; + //$cases2[$h][$event->id]['string'].='xxx'; } + $cases2[$h][$event->id]['color']=$color; } } else @@ -849,7 +858,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases2[$h][$event->id]['string']=$event->label; $cases1[$h][$event->id]['typecode']=$event->type_code; $cases2[$h][$event->id]['typecode']=$event->type_code; - //break; + $cases1[$h][$event->id]['color']='009900'; + $cases2[$h][$event->id]['color']='009900'; } } $i++; @@ -861,6 +871,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & for ($h = $begin_h; $h < $end_h; $h++) { + $color1='';$color2=''; $style1='';$style2=''; $string1=' ';$string2=' '; $title1='';$title2=''; @@ -893,20 +904,25 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $ids=array_keys($cases1[$h]); $output = array_slice($cases1[$h], 0, 1); if ($output[0]['string']) $title1.=' - '.$output[0]['string']; + if ($output[0]['color']) $color1 = $output[0]['color']; } + else if (count($cases1[$h]) > 1) $color1='222222'; + if (count($cases2[$h]) == 1) // 1 seul evenement { $ids=array_keys($cases2[$h]); $output = array_slice($cases2[$h], 0, 1); if ($output[0]['string']) $title2.=' - '.$output[0]['string']; + if ($output[0]['color']) $color2 = $output[0]['color']; } + else if (count($cases2[$h]) > 1) $color2='222222'; $ids1=join(',',array_keys($cases1[$h])); $ids2=join(',',array_keys($cases2[$h])); //var_dump($cases1[$h]); print ''; - print ''; print '
'; + print '
'; print $string1; - print ''; + print ''; print $string2; print '
'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e8dcce57ac4..f65136ec81d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -577,11 +577,15 @@ abstract class CommonObject /** * Charge le contact d'id $id dans this->contact * - * @param int $contactid Id du contact + * @param int $contactid Id du contact. Use this->contactid if empty. * @return int <0 if KO, >0 if OK */ - function fetch_contact($contactid) + function fetch_contact($contactid='') { + if (empty($contactid)) $contactid=$this->contactid; + + if (empty($contactid)) return 0; + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contact = new Contact($this->db); $result=$contact->fetch($contactid); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8b6b656417e..33b1d42ca08 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1329,9 +1329,9 @@ class Form { $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); } - $numassignetouser=count($assignedtouser); + $nbassignetouser=count($assignedtouser); - if ($numassignetouser && $action != 'view') $out.='
'; + if ($nbassignetouser && $action != 'view') $out.='
'; $i=0; $ownerid=0; foreach($assignedtouser as $key => $value) { @@ -1339,7 +1339,7 @@ class Form $userstatic->fetch($value['id']); $out.=$userstatic->getNomUrl(1); if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; } - if ($numassignetouser > 1 && $action != 'view') $out.=' '; + if ($nbassignetouser > 1 && $action != 'view') $out.=' '; //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); $out.='
'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 13003ea5cf3..5d67dc0b38e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -219,6 +219,7 @@ AutomaticIfJavascriptDisabled=Automatic if Javascript is disabled AvailableOnlyIfJavascriptNotDisabled=Available only if JavaScript is not disabled AvailableOnlyIfJavascriptAndAjaxNotDisabled=Available only if JavaScript is not disabled Required=Required +UsedOnlyWithTypeOption=Used by some agenda option only Security=Security Passwords=Passwords DoNotStoreClearPassword=Do no store clear passwords in database but store only encrypted value (Activated recommended) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index c4c332336d2..dd793c7bfdd 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -88,4 +88,5 @@ ExtSiteUrlAgenda=URL to access .ical file ExtSiteNoLabel=No Description WorkingTimeRange=Working time range WorkingDaysRange=Working days range -AddEvent=Create event \ No newline at end of file +AddEvent=Create event +MyAvailability=Ma disponibilité \ No newline at end of file