Skip to content

Commit

Permalink
Eoxia#246 [Hook] add: lastEvent open in dialog popup as well
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Jun 28, 2024
1 parent 78fc8fc commit 2815378
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions class/actions_easycrm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,10 @@ public function printFieldListValue(array $parameters): int
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';

$pictopath = dol_buildpath('/easycrm/img/easycrm_color.png', 1);
$picto = img_picto($langs->trans('CommercialsRelaunching'), 'fontawesome_fa-headset_fas');

$actiomcomm = new ActionComm($db);

$filter = ' AND a.id IN (SELECT c.fk_actioncomm FROM ' . MAIN_DB_PREFIX . 'categorie_actioncomm as c WHERE c.fk_categorie = ' . $conf->global->EASYCRM_ACTIONCOMM_COMMERCIAL_RELAUNCH_TAG . ')';
$picto = img_picto($langs->trans('CommercialsRelaunching'), 'fontawesome_fa-headset_fas');
$filter = ' AND a.id IN (SELECT c.fk_actioncomm FROM ' . MAIN_DB_PREFIX . 'categorie_actioncomm as c WHERE c.fk_categorie = ' . $conf->global->EASYCRM_ACTIONCOMM_COMMERCIAL_RELAUNCH_TAG . ')';
if (is_object($parameters['obj']) && !empty($parameters['obj'])) {
if (!empty($parameters['obj']->id)) {
$actiomcomms = $actiomcomm->getActions($parameters['obj']->socid, $parameters['obj']->id, 'project', $filter, 'a.datec');
Expand All @@ -448,17 +446,20 @@ public function printFieldListValue(array $parameters): int
$badgeClass = 'badge-danger';
}

$out = ' <span class="badge '. $badgeClass .'">' . $picto . '</span>';
$out .= '&nbsp <span class="badge badge-info">' . $nbActiomcomms . '</span> &nbsp';
$out = ' <span class="badge '. $badgeClass .'">' . $picto . ' : ' . $nbActiomcomms . '</span>';
// -- Old design --
//$out .= '<span class="badge badge-info" title="' . $langs->trans('CommercialsRelaunching') . '">' . $nbActiomcomms . '</span> &nbsp';

$url = '?socid=' . $parameters['obj']->socid . '&fromtype=project' . '&project_id=' . $parameters['obj']->id . '&action=create&token=' . newToken();
if ($user->hasRight('agenda', 'myactions', 'create')) {
$out .= dolButtonToOpenUrlInDialogPopup('quickEventCreation' . $parameters['obj']->id, $langs->transnoentities('QuickEventCreation'), '<span class="fa fa-plus-circle valignmiddle paddingleft" title="' . $langs->trans('QuickEventCreation') . '"></span>', '/custom/easycrm/view/quickevent.php' . $url);
// @todo find somewhere to add a user->conf to choose between popup dialog or open in current tab
//$out .= '<a href="' . dol_buildpath('/easycrm/view/quickevent.php', 1) . $url . '" target="_blank"><span class="fa fa-plus-circle valignmiddle paddingleft" title="' . $langs->trans('QuickEventCreation') . '"></span></a>';
}
if ($nbActiomcomms > 0) {
$out .= '<br><span>' . dol_print_date($lastActiomcomm->datec, 'dayhourtext', 'tzuser') . '</span>';
$out .= '&nbsp' . $lastActiomcomm->getNomUrl(1);
$out .= '&nbsp' . dolButtonToOpenUrlInDialogPopup('lastActionComm' . $parameters['obj']->id, $langs->transnoentities('LastEvent'), img_picto('', $lastActiomcomm->picto) . ' ' . $lastActiomcomm->label, '/comm/action/card.php?id=' . $lastActiomcomm->id);
//$out .= '&nbsp' . $lastActiomcomm->getNomUrl(1);
}
} ?>
<script>
Expand Down
1 change: 1 addition & 0 deletions langs/fr_FR/easycrm.lang
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ LastCommercialReminderDate = Date dernière relance commerciale
ActionCommCreation = Événement créé
ReminderActionCommCreation = Rappel crée le %s
ErrorNoProjectAndThirdpartyInformations = Veuillez renseigner un nom de projet et un nom de tiers
LastEvent = Dernier événement

#
# Config page - Page d'administration
Expand Down

0 comments on commit 2815378

Please sign in to comment.