From 169859b7086704b4362d7964be64a5f2dd4d11ef Mon Sep 17 00:00:00 2001 From: KHELIFA <kkhelifa@open-dsi.fr> Date: Wed, 17 May 2017 17:00:45 +0200 Subject: [PATCH] Module Agenda: Add option - Show linked object into agenda view --- htdocs/admin/agenda_other.php | 24 ++++++++++++++++++++++++ htdocs/comm/action/index.php | 10 ++++++++++ htdocs/comm/action/listactions.php | 18 +++++++++++++++++- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 1d785e882fc..55b61145b6a 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -4,6 +4,7 @@ * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> + * Copyright (C) 2017 Open-DSI <support@open-dsi.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -431,6 +432,29 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) } } +// AGENDA_SHOW_LINKED_OBJECT +$var=!$var; +print '<tr '.$bc[$var].'>'."\n"; +print '<td>'.$langs->trans("AGENDA_SHOW_LINKED_OBJECT").'</td>'."\n"; +print '<td align="center"> </td>'."\n"; +print '<td align="right">'."\n"; +if (! empty($conf->use_javascript_ajax)) +{ + print ajax_constantonoff('AGENDA_SHOW_LINKED_OBJECT'); +} +else +{ + if (empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) + { + print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_SHOW_LINKED_OBJECT">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; + } + else + { + print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_SHOW_LINKED_OBJECT">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; + } +} +print '</td></tr>'."\n"; + print '</table>'; dol_fiche_end(); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 47ef8093c1a..0a8ab49ea38 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -6,6 +6,7 @@ * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> + * Copyright (C) 2017 Open-DSI <support@open-dsi.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -446,6 +447,7 @@ $sql.= ' a.percent,'; $sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.fk_soc, a.fk_contact,'; +$sql.= ' a.fk_element, a.elementtype,'; $sql.= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_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"; @@ -570,6 +572,8 @@ if ($resql) $event->fulldayevent=$obj->fulldayevent; $event->location=$obj->location; $event->transparency=$obj->transparency; + $event->fk_element=$obj->fk_element; + $event->elementtype=$obj->elementtype; $event->societe->id=$obj->fk_soc; $event->contact->id=$obj->fk_contact; @@ -1478,6 +1482,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($linerelatedto) $linerelatedto.=' / '; if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',0); } + if (! empty($event->fk_element) && $event->fk_element > 0 && ! empty($event->elementtype) && ! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + if ($linerelatedto) $linerelatedto.=' / '; + $linerelatedto.=dolGetElementUrl($event->fk_element,$event->elementtype,1); + } if ($linerelatedto) print '<br>'.$linerelatedto; } diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 3e6224e0c41..4de2fce68dd 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -3,6 +3,7 @@ * Copyright (C) 2003 Eric Seigne <erics@rycks.com> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2017 Open-DSI <support@open-dsi.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -183,6 +184,7 @@ $sql.= " s.nom as societe, s.rowid as socid, s.client,"; $sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,"; $sql.= ' a.fk_user_author,a.fk_user_action,'; $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"; @@ -355,6 +357,7 @@ if ($resql) print '</td>'; print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>'; + if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>'; print '<td class="liste_titre center">'; print $formactions->form_select_status_action('formaction',$status,1,'status',1,2); @@ -375,7 +378,8 @@ if ($resql) print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre($langs->trans("LinkedObject"),$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre(""); print "</tr>\n"; @@ -482,6 +486,18 @@ if ($resql) } print '</td>'; + // Linked object + if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) { + print '<td>'; + 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 '</td>'; + } + // User to do print '<td align="left">'; if ($obj->fk_user_action > 0) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1c9ac65e4b8..19e296bd951 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1512,6 +1512,7 @@ AGENDA_DEFAULT_FILTER_STATUS=Set automatically this status for events into searc AGENDA_DEFAULT_VIEW=Which tab do you want to open by default when selecting menu Agenda AGENDA_NOTIFICATION=Enable event notification on user browsers when event date is reached (each user is able to refuse this from the browser confirmation question) AGENDA_NOTIFICATION_SOUND=Enable sound notification +AGENDA_SHOW_LINKED_OBJECT=Show linked object into agenda view ##### Clicktodial ##### ClickToDialSetup=Click To Dial module setup ClickToDialUrlDesc=Url called when a click on phone picto is done. In URL, you can use tags<br><b>__PHONETO__</b> that will be replaced with the phone number of person to call<br><b>__PHONEFROM__</b> that will be replaced with phone number of calling person (yours)<br><b>__LOGIN__</b> that will be replaced with clicktodial login (defined on user card)<br><b>__PASS__</b> that will be replaced with clicktodial password (defined on user card). diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index bd3d6405843..65ab2f84184 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1479,6 +1479,7 @@ AGENDA_DEFAULT_FILTER_STATUS=Régler automatiquement le statut d'événement dan AGENDA_DEFAULT_VIEW=Quel onglet voulez-vous voir ouvrir par défaut quand on choisit le menu Agenda AGENDA_NOTIFICATION=Activer les notifications d'événements dans le navigateur utilisateur quand la date de l'événement est atteinte (Chaque utilisateur peut refuser ceci au moment de la question de confirmation posée par le navigateur). AGENDA_NOTIFICATION_SOUND=Activer les notifications sonores. +AGENDA_SHOW_LINKED_OBJECT=Afficher l'objet lié dans la vue agenda ##### Clicktodial ##### ClickToDialSetup=Configuration du module Click To Dial ClickToDialUrlDesc=URL appelée lors d'un clic sur le pictogramme téléphone. Dans l'URL, vous pouvez utiliser les balises<br><b>__PHONETO__</b> qui sera remplacée par le téléphone de l'appelé<br><b>__PHONEFROM__</b> qui sera remplacée par le téléphone de l'appelant (le votre, défini sur votre fiche utilisateur)<br><b>__LOGIN__</b> qui sera remplacée par votre identifiant clicktodial (défini sur votre fiche utilisateur)<br><b>__PASS__</b> qui sera remplacée par votre mot de passe clicktodial (défini sur votre fiche utilisateur). -- GitLab