';
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
$out .= $langs->trans('TicketNewMessage');
} elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
$out .= $langs->trans('TicketNewMessage').'
('.$langs->trans('Private').')';
- } else {
- if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
- $transcode = $langs->trans("Action".$histo[$key]['acode']);
+ } elseif (isset($histo[$key]['type'])) {
+ if ($histo[$key]['type'] == 'action') {
+ $transcode = $langs->transnoentitiesnoconv("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
$libelle = $histo[$key]['note'];
$actionstatic->id = $histo[$key]['id'];
- $out .= dol_trunc($libelle, 120);
- }
- if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
+ $out .= dol_escape_htmltag(dol_trunc($libelle, 120));
+ } elseif ($histo[$key]['type'] == 'mailing') {
$out .= '
'.img_object($langs->trans("ShowEMailing"), "email").' ';
- $transcode = $langs->trans("Action".$histo[$key]['acode']);
+ $transcode = $langs->transnoentitiesnoconv("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
- $out .= dol_trunc($libelle, 120);
+ $out .= dol_escape_htmltag(dol_trunc($libelle, 120));
+ } else {
+ $libelle .= $histo[$key]['note'];
+ $out .= dol_escape_htmltag(dol_trunc($libelle, 120));
}
}
@@ -12336,7 +12342,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
$out .= '';
- if (!empty($histo[$key]['message'])
+ if (!empty($histo[$key]['message'] && $histo[$key]['message'] != $libelle)
&& $actionstatic->code != 'AC_TICKET_CREATE'
&& $actionstatic->code != 'AC_TICKET_MODIFY'
) {
diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php
index 3b17c830ed4..9c49035a757 100644
--- a/htdocs/core/lib/invoice.lib.php
+++ b/htdocs/core/lib/invoice.lib.php
@@ -118,7 +118,6 @@ function facture_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
-
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php
index 71a9849dc16..83b936a9b0b 100644
--- a/htdocs/core/lib/member.lib.php
+++ b/htdocs/core/lib/member.lib.php
@@ -126,16 +126,38 @@ function member_prepare_head(Adherent $object)
$h++;
// Show agenda tab
- if (isModEnabled('agenda')) {
- $head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
- $head[$h][1] = $langs->trans("Events");
- if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
- $head[$h][1] .= '/';
- $head[$h][1] .= $langs->trans("Agenda");
+ $head[$h][0] = DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id;
+ $head[$h][1] = $langs->trans("Events");
+ if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
+ $nbEvent = 0;
+ // Enable caching of thirdparty count actioncomm
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
+ $cachekey = 'count_events_member_'.$object->id;
+ $dataretrieved = dol_getcache($cachekey);
+ if (!is_null($dataretrieved)) {
+ $nbEvent = $dataretrieved;
+ } else {
+ $sql = "SELECT COUNT(id) as nb";
+ $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
+ $sql .= " WHERE elementtype = 'member' AND fk_element = ".((int) $object->id);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ $nbEvent = $obj->nb;
+ } else {
+ dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
+ }
+ dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
+ }
+
+ $head[$h][1] .= '/';
+ $head[$h][1] .= $langs->trans("Agenda");
+ if ($nbEvent > 0) {
+ $head[$h][1] .= ''.$nbEvent.'';
}
- $head[$h][2] = 'agenda';
- $h++;
}
+ $head[$h][2] = 'agenda';
+ $h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member', 'add', 'external');
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 36b9cf6d9f2..a89d4359f14 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -124,7 +124,7 @@ if ($nolinesbefore) {
multicurrency_code != $conf->currency) { ?>
trans('PriceUHTCurrency'); ?> |
-
+
trans('PriceUTTC'); ?> |
trans('Qty'); ?> |
diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php
index 67f087f9774..c7a50fd0f19 100644
--- a/htdocs/societe/agenda.php
+++ b/htdocs/societe/agenda.php
@@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
// Load translation files required by the page
$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal'));
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartyagenda';
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@@ -79,9 +80,16 @@ $socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
+
+$result = $object->fetch($socid);
+if ($result <= 0) {
+ accessforbidden('Third party not found');
+}
+
$result = restrictedArea($user, 'societe', $socid, '&societe');
+
/*
* Actions
*/
@@ -114,109 +122,106 @@ if (empty($reshook)) {
$form = new Form($db);
-if ($socid > 0) {
- $result = $object->fetch($socid);
+$title = $langs->trans("Agenda");
+if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
+ $title = $object->name." - ".$title;
+}
+$help_url = '';
+llxHeader('', $title, $help_url);
- $title = $langs->trans("Agenda");
- if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
- $title = $object->name." - ".$title;
+if (isModEnabled('notification')) {
+ $langs->load("mails");
+}
+$head = societe_prepare_head($object);
+
+
+print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, $object->picto);
+
+$linkback = '
'.$langs->trans("BackToList").'';
+
+$morehtmlref = '';
+
+dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref);
+
+print '
';
+
+print '
';
+
+$object->info($socid);
+dol_print_object_info($object, 1);
+
+print '
';
+
+print dol_get_fiche_end();
+
+
+
+// Actions buttons
+
+$objthirdparty = $object;
+$objcon = new stdClass();
+
+$out = '';
+$permok = $user->hasRight('agenda', 'myactions', 'create');
+if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
+ if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
+ $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
}
- $help_url = '';
- llxHeader('', $title, $help_url);
+ $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '');
+ $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog');
+}
- if (isModEnabled('notification')) {
- $langs->load("mails");
- }
- $head = societe_prepare_head($object);
+$morehtmlright = '';
+$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
+$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
+$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
+$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
- print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, $object->picto);
+// // Show link to send an email (if read and not closed)
+// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
+// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
+// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
- $linkback = '
'.$langs->trans("BackToList").'';
+// // Show link to add a private message (if read and not closed)
+// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
+// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
+// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
- $morehtmlref = '';
-
- dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref);
-
- print '
';
-
- print '
';
-
- $object->info($socid);
- dol_print_object_info($object, 1);
-
- print '
';
-
- print dol_get_fiche_end();
-
-
-
- // Actions buttons
-
- $objthirdparty = $object;
- $objcon = new stdClass();
-
- $out = '';
- $permok = $user->hasRight('agenda', 'myactions', 'create');
- if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
- if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
- $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
- }
- $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '');
- $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog');
- }
-
- $morehtmlright = '';
-
- $messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
- $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
- $messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
- $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
-
- // // Show link to send an email (if read and not closed)
- // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
- // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
- // $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
-
- // // Show link to add a private message (if read and not closed)
- // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
- // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
- // $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
-
- if (isModEnabled('agenda')) {
- if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) {
- $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
- }
- }
-
- if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
- print '
';
-
- $param = '&socid='.urlencode($socid);
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
- $param .= '&contextpage='.urlencode($contextpage);
- }
- if ($limit > 0 && $limit != $conf->liste_limit) {
- $param .= '&limit='.urlencode($limit);
- }
-
- // Try to know count of actioncomm from cache
- require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
- $cachekey = 'count_events_thirdparty_'.$object->id;
- $nbEvent = dol_getcache($cachekey);
-
- print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '
('.$nbEvent.')': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
-
- // List of all actions
- $filters = array();
- $filters['search_agenda_label'] = $search_agenda_label;
- $filters['search_rowid'] = $search_rowid;
-
- // TODO Replace this with same code than into list.php
- show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
+if (isModEnabled('agenda')) {
+ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
+ $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
}
+if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
+ print '
';
+
+ $param = '&socid='.urlencode($socid);
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
+ $param .= '&contextpage='.urlencode($contextpage);
+ }
+ if ($limit > 0 && $limit != $conf->liste_limit) {
+ $param .= '&limit='.urlencode($limit);
+ }
+
+ // Try to know count of actioncomm from cache
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
+ $cachekey = 'count_events_thirdparty_'.$object->id;
+ $nbEvent = dol_getcache($cachekey);
+
+ print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '
('.$nbEvent.')': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
+
+ // List of all actions
+ $filters = array();
+ $filters['search_agenda_label'] = $search_agenda_label;
+ $filters['search_rowid'] = $search_rowid;
+
+ // TODO Replace this with same code than into list.php
+ show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
+}
+
+
// End of page
llxFooter();
$db->close();