From 85606126a9180cc8a992d39a83ffaf1e6bca3b89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Oct 2017 12:58:13 +0200 Subject: [PATCH 1/2] Standardize code for events --- htdocs/adherents/agenda.php | 71 +++++++++++++++++--- htdocs/adherents/card.php | 8 ++- htdocs/comm/action/listactions.php | 20 +++--- htdocs/comm/action/rapport/index.php | 2 +- htdocs/contact/agenda.php | 15 +++-- htdocs/core/class/html.formactions.class.php | 27 ++++---- htdocs/core/lib/company.lib.php | 44 ++++++------ htdocs/core/lib/functions.lib.php | 10 ++- htdocs/langs/en_US/agenda.lang | 1 + htdocs/langs/en_US/main.lang | 1 + htdocs/projet/card.php | 10 ++- htdocs/projet/class/project.class.php | 4 +- htdocs/projet/info.php | 30 +++------ htdocs/projet/tasks.php | 2 +- htdocs/societe/agenda.php | 16 +++-- htdocs/societe/card.php | 8 ++- 16 files changed, 169 insertions(+), 100 deletions(-) diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 007ce92a4d5..1228dc92bf9 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -38,6 +38,28 @@ $langs->load("members"); $id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int'); +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='a.datep,a.id'; +if (! $sortorder) $sortorder='DESC'; + +if (GETPOST('actioncode','array')) +{ + $actioncode=GETPOST('actioncode','array',3); + if (! count($actioncode)) $actioncode='0'; +} +else +{ + $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); +} +$search_agenda_label=GETPOST('search_agenda_label'); + // Security check $result=restrictedArea($user,'adherent',$id); @@ -56,7 +78,26 @@ if ($result > 0) * Actions */ -// None +$parameters=array('id'=>$id, 'objcanvas'=>$objcanvas); +$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'); + +if (empty($reshook)) +{ + // Cancel + if (GETPOST('cancel','alpha') && ! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers + { + $actioncode=''; + $search_agenda_label=''; + } +} @@ -103,25 +144,33 @@ if ($object->id > 0) dol_fiche_end(); - /* - * Barre d'action - */ + //print '
'; + //print '
'; - print '
'; + $morehtmlcenter = ''; if (! empty($conf->agenda->enabled)) { - print ''; + $morehtmlcenter.=''.$langs->trans("AddAction").''; } - print '
'; + if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) + { + print '
'; - $out=''; + $param='&id='.$id; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - print load_fiche_titre($langs->trans("ActionsOnMember"),$out,''); + print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1); - // List of actions - show_actions_done($conf,$langs,$db,$object,null,0,'',''); + // List of all actions + $filters=array(); + $filters['search_agenda_label']=$search_agenda_label; + + // TODO Replace this with same code than into listactions.php + show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder); + } } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 9f8ea7ea2f0..5ab8ff1cc99 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1799,10 +1799,16 @@ else print '
'; + $MAX = 10; + + $morehtmlright = ''; + $morehtmlright.= $langs->trans("SeeAll"); + $morehtmlright.= ''; + // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', 10); + $somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', $MAX, '', $morehtmlright); print '
'; } diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 78e73fe0717..982974b3d7a 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -357,7 +357,7 @@ if ($resql) //$param='month='.$monthshown.'&year='.$year; $hourminsec='100000'; $link = ''; - $link.= $langs->trans("NewAction"); + $link.= $langs->trans("AddAction"); $link.= ''; } @@ -372,9 +372,9 @@ if ($resql) print ''; print ''; print ''; + print ''; print ''; - print ''; - print ''; + print ''; print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1); print ''; print ''; @@ -396,9 +396,9 @@ if ($resql) print ''; print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Label",$_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("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$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); @@ -452,11 +452,6 @@ if ($resql) else print ' '; print ''; - // Label - print ''; - print $actionstatic->label; - print ''; - // Type print ''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) @@ -475,6 +470,11 @@ if ($resql) print dol_trunc($labeltype,28); print ''; + // Label + print ''; + print $actionstatic->label; + print ''; + // Start date print ''; print dol_print_date($db->jdate($obj->dp),"dayhour"); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index dcda4e0cf04..5994f692cc8 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -116,7 +116,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit); + print_barre_liste($langs->trans("EventReports"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit); $moreforfilter=''; diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index a4412082ead..c885f0869de 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -257,30 +257,33 @@ else } - print '
'; + //print '
'; + //print '
'; + + $morehtmlcenter=''; if (! empty($conf->agenda->enabled)) { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlcenter.= ''.$langs->trans("AddAction").''; } else { - print ''.$langs->trans("AddAction").''; + $morehtmlcenter.= ''.$langs->trans("AddAction").''; } } - print '
'; if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) { + print '
'; + $param='&id='.$id; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - - print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'',''); + print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1); // List of all actions $filters=array(); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 84c7ab389f3..adf5f4c340b 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -157,9 +157,10 @@ class FormActions * @param string $morecss More css on table * @param int $max Max number of record * @param string $moreparambacktopage More param for the backtopage + * @param string $morehtmlright More html text on right of title line * @return int <0 if KO, >=0 if OK */ - function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecss='listactions', $max=0, $moreparambacktopage='') + function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecss='listactions', $max=0, $moreparambacktopage='', $morehtmlright='') { global $langs,$conf,$user; global $bc; @@ -196,7 +197,7 @@ class FormActions $buttontoaddnewevent.= ''; print ''."\n"; - print load_fiche_titre($title, $buttontoaddnewevent, ''); + print load_fiche_titre($title, $morehtmlright, '', 0, 0, '', $buttontoaddnewevent); $page=0; $param=''; @@ -206,10 +207,10 @@ class FormActions print ''; print ''; print getTitleFieldOfList('Ref', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1); - print getTitleFieldOfList('Action', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1); - print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1); - print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, 'align="center"', $sortfield, $sortorder, '', 1); print getTitleFieldOfList('By', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1); + print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1); + print getTitleFieldOfList('Action', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1); + print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, 'align="center"', $sortfield, $sortorder, '', 1); print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"', $sortfield, $sortorder, '', 1); print ''; print "\n"; @@ -228,8 +229,14 @@ class FormActions print ''; print ''; - print ''; print ''; + print ''; + print ''; print ''; - print ''; print ''; $out.=''; - $out.=''; - $out.=''; $out.=''; + $out.=''; + $out.=''; $out.=''; $out.=''; $out.=''; @@ -1316,9 +1316,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= } $out.=getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder); $out.=getTitleFieldOfList($langs->trans("Owner")); + $out.=getTitleFieldOfList($langs->trans("Type")); $out.=getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder); - $out.=getTitleFieldOfList($langs->trans("Type")); $out.=getTitleFieldOfList(''); $out.=getTitleFieldOfList(''); $out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder); @@ -1353,6 +1353,25 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=$userstatic->getNomUrl(-1); $out.=''; + // Type + $out.=''; + // Title $out.='\n"; - // Type - $out.=''; - // Title of event //$out.=''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 230d023e7aa..dbd1832aeb4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3540,10 +3540,11 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $id To force an id on html objects * @param string $morecssontable More css on table + * @param string $morehtmlcenter Added message to show on center * @return string * @see print_barre_liste */ -function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='') +function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='') { global $conf; @@ -3558,6 +3559,10 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $return.= ''; + if (dol_strlen($morehtmlcenter)) + { + $return.= ''; + } if (dol_strlen($morehtmlright)) { $return.= ''; @@ -3585,9 +3590,10 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', * @param string $morecss More css to the table * @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit). * @param int $hideselectlimit Force to hide select limit + * @param int $hidenavigation Force to hide all navigation tools * @return void */ -function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0) +function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0) { global $conf,$langs; diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 88c6bbc54f5..116fc189732 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -12,6 +12,7 @@ Event=Event Events=Events EventsNb=Number of events ListOfActions=List of events +EventReports=Event reports Location=Location ToUserOfGroup=To any user in group EventOnFullDay=Event on all day(s) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fbbd8dbaabd..7383cdea931 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -597,6 +597,7 @@ Undo=Undo Redo=Redo ExpandAll=Expand all UndoExpandAll=Undo expand +SeeAll=See all Reason=Reason FeatureNotYetSupported=Feature not yet supported CloseWindow=Close window diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1146ba49b80..6fc06b3e51a 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1192,16 +1192,20 @@ elseif ($object->id > 0) $genallowed=($user->rights->projet->lire && $userAccess > 0); $delallowed=($user->rights->projet->creer && $userWrite > 0); - $var=true; - print $formfile->showdocuments('project',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); print '
'; + $MAX = 10; + + $morehtmlright = ''; + $morehtmlright.= $langs->trans("SeeAll"); + $morehtmlright.= ''; + // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'project', $socid, 1, '', 10); + $somethingshown = $formactions->showactions($object, 'project', $socid, 1, '', $MAX, '', $morehtmlright); print '
'; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 18aa3fe1f52..4ade2a31f41 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -296,6 +296,7 @@ class Project extends CommonObject $sql.= ", fk_user_close=" . ($this->fk_user_close > 0 ? $this->fk_user_close : "null"); $sql.= ", opp_amount = " . (strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : "null"); $sql.= ", budget_amount = " . (strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : "null"); + $sql.= ", fk_user_modif = " . $user->id; $sql.= " WHERE rowid = " . $this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -390,7 +391,7 @@ class Project extends CommonObject if (empty($id) && empty($ref)) return -1; $sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,"; - $sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_close, fk_statut, fk_opp_status, opp_percent, note_private, note_public, model_pdf"; + $sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut, fk_opp_status, opp_percent, note_private, note_public, model_pdf"; $sql.= " FROM " . MAIN_DB_PREFIX . "projet"; if (! empty($id)) { @@ -428,6 +429,7 @@ class Project extends CommonObject $this->note_public = $obj->note_public; $this->socid = $obj->fk_soc; $this->user_author_id = $obj->fk_user_creat; + $this->user_modification_id = $obj->fk_user_modif; $this->user_close_id = $obj->fk_user_close; $this->public = $obj->public; $this->statut = $obj->fk_statut; diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 3c21d9e0ced..124371e299b 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -156,42 +156,32 @@ if ($permok) } -print '
'; - +//print '
'; +$morehtmlcenter=''; if (! empty($conf->agenda->enabled)) { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlcenter.=''.$langs->trans("AddAction").''; } else { - print ''.$langs->trans("AddAction").''; + $morehtmlcenter.=''.$langs->trans("AddAction").''; } } -print '
'; - +//print '
'; if (!empty($object->id)) { - $param='&id='.$object->id; + print '
'; + + $param='&id='.$object->id; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - print load_fiche_titre($langs->trans("ActionsOnProject"),'',''); - - // List of actions on element - /*include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown = $formactions->showactions($object,'project',0);*/ - - // List of todo actions - //show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode); - - // List of done actions - //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode); - + print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1); + // List of all actions $filters=array(); $filters['search_agenda_label']=$search_agenda_label; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 41413645906..12da09053cd 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -366,7 +366,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; print ''; // List of projects diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 0dea66946ec..73b662741cd 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -155,30 +155,32 @@ if ($socid > 0) } - print '
'; + //print '
'; + //print '
'; + + $morehtmlcenter=''; if (! empty($conf->agenda->enabled)) { if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlcenter.=''.$langs->trans("AddAction").''; } else { - print ''.$langs->trans("AddAction").''; + $morehtmlcenter.=''.$langs->trans("AddAction").''; } } - print '
'; - if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) { + print '
'; + $param='&socid='.$socid; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - - print load_fiche_titre($langs->trans("ActionsOnCompany"),'',''); + print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1); // List of all actions $filters=array(); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index dc02303e3bb..1d447a9ad0f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2532,12 +2532,16 @@ else print '
'; - $MAX = 5; + $MAX = 10; + + $morehtmlright = ''; + $morehtmlright.= $langs->trans("SeeAll"); + $morehtmlright.= ''; // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAX); // Show all action for thirdparty + $somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAX, '', $morehtmlright); // Show all action for thirdparty print '
'; } From 9b3826a54c97338aa243e87173573feb64d5b473 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Oct 2017 13:17:16 +0200 Subject: [PATCH 2/2] Invert left and right (my own comment on left) --- htdocs/core/actions_comments.inc.php | 6 ++-- htdocs/core/lib/project.lib.php | 48 ++++++++++++++-------------- htdocs/core/tpl/bloc_comment.tpl.php | 22 +++++++------ 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/htdocs/core/actions_comments.inc.php b/htdocs/core/actions_comments.inc.php index 185973cb258..ee45a035043 100644 --- a/htdocs/core/actions_comments.inc.php +++ b/htdocs/core/actions_comments.inc.php @@ -35,13 +35,13 @@ $comment = new Comment($db); if ($action == 'addcomment') { - $description = GETPOST('comment_description'); + $description = GETPOST('comment_description', 'none'); if (!empty($description)) { $comment->description = $description; $comment->datec = time(); - $comment->fk_element = GETPOST('id'); - $comment->element_type = GETPOST('comment_element_type'); + $comment->fk_element = GETPOST('id','int'); + $comment->element_type = GETPOST('comment_element_type','alpha'); $comment->fk_user_author = $user->id; $comment->entity = $conf->entity; if ($comment->create($user) > 0) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7f809fadd77..c33ae364a2b 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -66,19 +66,8 @@ function project_prepare_head($object) // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'project'); - - - // Manage discussion - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) - { - $nbComments = $object->getNbComments(); - $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id; - $head[$h][1] = $langs->trans("CommentLink"); - if ($nbComments > 0) $head[$h][1].= ' '.$nbComments.''; - $head[$h][2] = 'project_comment'; - $h++; - } - + + if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { $nbNote = 0; @@ -122,6 +111,17 @@ function project_prepare_head($object) $h++; } + // Manage discussion + if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) + { + $nbComments = $object->getNbComments(); + $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id; + $head[$h][1] = $langs->trans("CommentLink"); + if ($nbComments > 0) $head[$h][1].= ' '.$nbComments.''; + $head[$h][2] = 'project_comment'; + $h++; + } + $head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; $head[$h][1].= $langs->trans("Events"); if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) @@ -188,17 +188,6 @@ function task_prepare_head($object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'task'); - // Manage discussion - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) - { - $nbComments = $object->getNbComments(); - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); - $head[$h][1] = $langs->trans("CommentLink"); - if ($nbComments > 0) $head[$h][1].= ' '.$nbComments.''; - $head[$h][2] = 'task_comment'; - $h++; - } - if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { $nbNote = 0; @@ -222,6 +211,17 @@ function task_prepare_head($object) $head[$h][2] = 'task_document'; $h++; + // Manage discussion + if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) + { + $nbComments = $object->getNbComments(); + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/comment.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); + $head[$h][1] = $langs->trans("CommentLink"); + if ($nbComments > 0) $head[$h][1].= ' '.$nbComments.''; + $head[$h][2] = 'task_comment'; + $h++; + } + complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove'); return $head; diff --git a/htdocs/core/tpl/bloc_comment.tpl.php b/htdocs/core/tpl/bloc_comment.tpl.php index b28699744d2..48b0e0c990f 100644 --- a/htdocs/core/tpl/bloc_comment.tpl.php +++ b/htdocs/core/tpl/bloc_comment.tpl.php @@ -29,10 +29,9 @@ print ''; print "\n"; print ''; -print ''; // Description -print ''; print '
'.$ref.''.$label.''; + if (! empty($action->userownerid)) + { + $userstatic->fetch($action->userownerid); // TODO Introduce a cache on users fetched + print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, '', ''); + } + print ''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if ($action->type_picto) print img_picto('', $action->type_picto); @@ -242,6 +249,7 @@ class FormActions } print $action->type; print ''.$label.''.dol_print_date($action->datep,'dayhour'); if ($action->datef) { @@ -254,13 +262,6 @@ class FormActions else print '-'.dol_print_date($action->datef,'dayhour'); } print ''; - if (! empty($action->userownerid)) - { - $userstatic->fetch($action->userownerid); // TODO Introduce a cache on users fetched - print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, '', ''); - } - print ''; if (! empty($action->author->id)) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index f22da301ec4..b269a9c1e42 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1287,11 +1287,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= } $out.=''; $out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1); $out.=''; + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($histo[$key]['apicto']) $out.=img_picto('', $histo[$key]['apicto']); + else { + if ($histo[$key]['acode'] == 'AC_TEL') $out.=img_picto('', 'object_phoning').' '; + if ($histo[$key]['acode'] == 'AC_FAX') $out.=img_picto('', 'object_phoning_fax').' '; + if ($histo[$key]['acode'] == 'AC_EMAIL') $out.=img_picto('', 'object_email').' '; + } + $out.=$actionstatic->type; + } + else { + $typelabel = $actionstatic->type; + if ($histo[$key]['acode'] != 'AC_OTH_AUTO') $typelabel = $langs->trans("ActionAC_MANUAL"); + $out.=$typelabel; + } + $out.=''; if (isset($histo[$key]['type']) && $histo[$key]['type']=='action') @@ -1392,25 +1411,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= if ($late) $out.=img_warning($langs->trans("Late")).' '; $out.="'; - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - { - if ($histo[$key]['apicto']) $out.=img_picto('', $histo[$key]['apicto']); - else { - if ($histo[$key]['acode'] == 'AC_TEL') $out.=img_picto('', 'object_phoning').' '; - if ($histo[$key]['acode'] == 'AC_FAX') $out.=img_picto('', 'object_phoning_fax').' '; - if ($histo[$key]['acode'] == 'AC_EMAIL') $out.=img_picto('', 'object_email').' '; - } - $out.=$actionstatic->type; - } - else { - $typelabel = $actionstatic->type; - if ($histo[$key]['acode'] != 'AC_OTH_AUTO') $typelabel = $langs->trans("ActionAC_MANUAL"); - $out.=$typelabel; - } - $out.=''.dol_trunc($histo[$key]['note'], 40).''; $return.= '
'.$titre.'
'; $return.= '
'.$morehtmlcenter.''.$morehtmlright.'
'.$langs->trans("Label").''; - print ''; + print ''; print '
'; +print ''; $desc = GETPOST('comment_description'); @@ -47,13 +46,16 @@ print '
'; // List of comments -if(!empty($object->comments)) { +if (!empty($object->comments)) +{ // Default color for current user $TColors = array($user->id => array('bgcolor'=>'efefef','color'=>'555')); $first = true; - foreach($object->comments as $comment) { + foreach($object->comments as $comment) + { $fk_user = $comment->fk_user_author; $userstatic->fetch($fk_user); + if(empty($TColors[$fk_user])) { $bgcolor = random_color(180,240); if(!empty($userstatic->color)) { @@ -63,10 +65,10 @@ if(!empty($object->comments)) { $TColors[$fk_user] = array('bgcolor'=>$bgcolor,'color'=>$color); } print '
'; - if($fk_user == $user->id) { + if ($fk_user != $user->id) { print '
 
'; } - + print '
'; print '
'; if (! empty($user->photo)) @@ -76,7 +78,7 @@ if(!empty($object->comments)) { print $langs->trans('User').' : '.$userstatic->getNomUrl().'
'; print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec'); print '
'; // End comment-info - + print '
'; print '
'; print '
'; @@ -90,13 +92,13 @@ if(!empty($object->comments)) { print '
'; // End comment-table print '
'; // End comment-right print '
'; // End comment - - if($fk_user != $user->id) { + + if($fk_user == $user->id) { print '
 
'; } print '
'; print '
'; // end 100p - + $first = false; } }