From 7922fd028123bc5641799b9a6cc39b5b12c39266 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Sat, 11 Nov 2017 18:41:35 +0100 Subject: [PATCH 1/2] NEW add burger menu to list action comm --- htdocs/comm/action/listactions.php | 370 ++++++++++++++++++++--------- 1 file changed, 260 insertions(+), 110 deletions(-) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 4540580fed8..21aec8626eb 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -70,6 +70,13 @@ $filtert = GETPOST("filtert","int",3); $usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; +$contextpage='actioncommlist'; + +$extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('actioncomm'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + // If not choice done on calendar owner, we filter on user. if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { @@ -112,6 +119,26 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permi // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendalist')); +$arrayfields=array( + 'a.id'=>array('label'=>"Ref", 'checked'=>1), + 'a.label'=>array('label'=>"Title", 'checked'=>1), + 'c.libelle'=>array('label'=>"Type", 'checked'=>1), + 'a.datep'=>array('label'=>"DateStart", 'checked'=>1), + 'a.datep2'=>array('label'=>"DateEnd", 'checked'=>1), + 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), + 'a.fk_contact'=>array('label'=>"Contact", 'checked'=>1), + 'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))), + 'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), + +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} /* * Actions @@ -136,6 +163,9 @@ $parameters=array('id'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +// Selection of new fields +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + // Purge search criteria if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { @@ -143,6 +173,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_title=''; $datestart=''; $dateend=''; + $search_array_options=array(); } @@ -191,6 +222,13 @@ if (GETPOST('datestartyear','int')) $param.='&datestartyear='.GETPOST('datestart if (GETPOST('dateendday','int')) $param.='&dateendday='.GETPOST('dateendday','int'); if (GETPOST('dateendmonth','int')) $param.='&dateendmonth='.GETPOST('dateendmonth','int'); if (GETPOST('dateendyear','int')) $param.='&dateendyear='.GETPOST('dateendyear','int'); +// Add $param from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); +} $sql = "SELECT"; if ($usergroup > 0) $sql.=" DISTINCT"; @@ -201,7 +239,11 @@ $sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " a.fk_element, a.elementtype,"; $sql.= " c.code as type_code, c.libelle as type_label,"; $sql.= " sp.lastname, sp.firstname"; -$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; +$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON (c.id = a.fk_action)"; +$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object) "; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $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"; @@ -210,7 +252,7 @@ if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r"; // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; -$sql.= " WHERE c.id = a.fk_action"; +$sql.= " WHERE 1"; $sql.= ' AND a.entity IN ('.getEntity('agenda').')'; // Condition on actioncode if (! empty($actioncode)) @@ -269,6 +311,20 @@ if ($filtert > 0 || $usergroup > 0) if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))"; if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'"; if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric + if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + } +} $sql.= $db->order($sortfield,$sortorder); $nbtotalofrecords = ''; @@ -376,27 +432,72 @@ if ($resql) $moreforfilter=''; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + $i = 0; print '
'; print ''."\n"; print ''; + if (! empty($arrayfields['a.id']['checked'])) print ''; + if (! empty($arrayfields['a.label']['checked'])) print ''; + if (! empty($arrayfields['c.libelle']['checked'])) print ''; + if (! empty($arrayfields['a.datep']['checked'])) { + print ''; + } + if (! empty($arrayfields['a.datep2']['checked'])) { + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) print ''; + if (! empty($arrayfields['a.fk_contact']['checked'])) print ''; + if (! empty($arrayfields['a.fk_element']['checked']) && ! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print ''; - print ''; - print ''; + + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + + if (! empty($arrayfields['a.percent']['checked'])) { + print ''; + } // Action column print '\n"; print ''; - print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); + if (! empty($arrayfields['a.id']['checked'])) print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); + if (! empty($arrayfields['a.label']['checked'])) print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); - print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); - print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); - if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre(""); + if (! empty($arrayfields['c.libelle']['checked'])) print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); + if (! empty($arrayfields['a.datep']['checked'])) print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['a.datep2']['checked'])) print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); + if (! empty($arrayfields['a.fk_contact']['checked'])) print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); + if (! empty($arrayfields['a.fk_element']['checked']) && ! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $sortonfield = "ef.".$key; + if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } + } + // Hook fields + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['a.percent']['checked']))print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; $contactstatic = new Contact($db); @@ -448,89 +567,96 @@ if ($resql) print ''; - // Action (type) - print ''; - - // Action (type) - print ''; - - // Type - print ''; } - $labeltype=$obj->type_code; - if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) $labeltype='AC_OTH'; - if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype]; - print dol_trunc($labeltype,28); - print ''; - // Start date - print ''; - - // End date - print ''; - - // Third party - print ''; } - else print ' '; - print ''; - - // Contact - print ''; } - else - { - print " "; + if (! empty($arrayfields['a.datep']['checked'])) { + // Start date + print ''; + } + if (! empty($arrayfields['a.datep2']['checked'])) { + // End date + print ''; + } + if (! empty($arrayfields['s.nom']['checked'])) { + // Third party + print ''; + } + if (! empty($arrayfields['a.fk_contact']['checked'])) { + // Contact + print ''; + } + // Linked object + if (! empty($arrayfields['a.fk_element']['checked']) && ! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) { + print ''; } - print ''; - - // Linked object - if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) { - print ''; - } - // User owner print ''; + + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; - // Status/Percent - $datep=$db->jdate($obj->datep); - print ''; - + if (! empty($arrayfields['a.percent']['checked'])) { + // Status/Percent + $datep=$db->jdate($obj->datep); + print ''; + } print ''; print "\n"; From 3dc06977af6b5a45ae4b69b93ed3736c2ad92378 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2017 01:33:44 +0100 Subject: [PATCH 2/2] Update listactions.php --- htdocs/comm/action/listactions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 90f2f9298fa..55a824c93ca 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -240,17 +240,17 @@ $sql.= " sp.lastname, sp.firstname"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; -$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON (c.id = a.fk_action)"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object) "; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $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.=" ,".MAIN_DB_PREFIX."c_actioncomm as c"; // We must filter on resource table if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r"; // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; -$sql.= " WHERE 1"; +$sql.= " WHERE c.id = a.fk_action"; $sql.= ' AND a.entity IN ('.getEntity('agenda').')'; // Condition on actioncode if (! empty($actioncode))
'; + print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1); + print ''; + print $form->select_date($dateend, 'dateend', 0, 0, 1, '', 1, 0, 1); + print ''; - print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1); - print ''; - print $form->select_date($dateend, 'dateend', 0, 0, 1, '', 1, 0, 1); - print ''; - print $formactions->form_select_status_action('formaction',$status,1,'status',1,2); - print ''; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attribute_computed[$key])) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + else + { + // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') + echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_'); + } + print ''; + print $formactions->form_select_status_action('formaction',$status,1,'status',1,2); + print ''; $searchpicto=$form->showFilterButtons(); @@ -405,18 +506,36 @@ if ($resql) print "
'; - print $actionstatic->getNomUrl(1,-1); - print ''; - print $actionstatic->label; - 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 (! empty($arrayfields['a.id']['checked'])) { + // Action (type) + print ''; + print $actionstatic->getNomUrl(1,-1); + print ''; - print dol_print_date($db->jdate($obj->dp),"dayhour"); - $late=0; - if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; - if ($obj->percent == 0 && ! $obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; - if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) $late=1; - if ($obj->percent > 0 && $obj->percent < 100 && ! $obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; - if ($late) print img_warning($langs->trans("Late")).' '; - print ''; - print dol_print_date($db->jdate($obj->dp2),"dayhour"); - print ''; - if ($obj->socid) - { - $societestatic->id=$obj->socid; - $societestatic->client=$obj->client; - $societestatic->name=$obj->societe; - print $societestatic->getNomUrl(1,'',28); + if (! empty($arrayfields['a.label']['checked'])) { + // Action (type) + print ''; + print $actionstatic->label; + print ''; - if ($obj->fk_contact > 0) - { - $contactstatic->lastname=$obj->lastname; - $contactstatic->firstname=$obj->firstname; - $contactstatic->id=$obj->fk_contact; - print $contactstatic->getNomUrl(1,'',28); + if (! empty($arrayfields['c.libelle']['checked'])) { + // Type + 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').' '; + } + } + $labeltype=$obj->type_code; + if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) $labeltype='AC_OTH'; + if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype]; + print dol_trunc($labeltype,28); + print ''; + print dol_print_date($db->jdate($obj->dp),"dayhour"); + $late=0; + if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; + if ($obj->percent == 0 && ! $obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; + if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) $late=1; + if ($obj->percent > 0 && $obj->percent < 100 && ! $obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; + if ($late) print img_warning($langs->trans("Late")).' '; + print ''; + print dol_print_date($db->jdate($obj->dp2),"dayhour"); + print ''; + if ($obj->socid) + { + $societestatic->id=$obj->socid; + $societestatic->client=$obj->client; + $societestatic->name=$obj->societe; + print $societestatic->getNomUrl(1,'',28); + } + else print ' '; + print ''; + if ($obj->fk_contact > 0) + { + $contactstatic->lastname=$obj->lastname; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print $contactstatic->getNomUrl(1,'',28); + } + else + { + print " "; + } + print ''; + if ($obj->fk_element > 0 && ! empty($obj->elementtype)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + print dolGetElementUrl($obj->fk_element,$obj->elementtype,1); + } else { + print " "; + } + print ''; - if ($obj->fk_element > 0 && ! empty($obj->elementtype)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - print dolGetElementUrl($obj->fk_element,$obj->elementtype,1); - } else { - print " "; - } - print ''; if ($obj->fk_user_action > 0) @@ -540,11 +666,35 @@ if ($resql) } else print ' '; print ''.$actionstatic->LibStatut($obj->percent,3,0,$datep).''.$actionstatic->LibStatut($obj->percent,3,0,$datep).'