From 0adca0a66036f3ef1edea969dfdfdc4bfb5445c4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 21 Sep 2020 11:43:08 +0200 Subject: [PATCH 1/4] fix event creation same on all page --- htdocs/contact/agenda.php | 9 +++------ htdocs/core/class/html.formactions.class.php | 2 +- htdocs/societe/agenda.php | 9 +++------ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 7ac512bd32f..386847abe38 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -240,12 +240,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $permok = $user->rights->agenda->myactions->create; if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { - //$out.='trans("AddAnAction"),'filenew'); - //$out.=""; + if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : ''); + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&origin=contact&originid='.$object->id.'&percentage=-1&backtopage='.urlencode($_SERVER['PHP_SELF'].($objcon->id > 0 ? '?id='.$objcon->id : '')); + $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog'); } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 8614d4ee433..1c359914bf0 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -202,7 +202,7 @@ class FormActions $newcardbutton = ''; if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) { - $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); + $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); } diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 61d473f5c43..0108ba0a607 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -139,12 +139,9 @@ if ($socid > 0) $permok = $user->rights->agenda->myactions->create; if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { - //$out.='trans("AddAnAction"),'filenew'); - //$out.=""; + 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 : '').'&percentage=-1'; + $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog'); } From 1efec17228ef6739d1af0b8a67b2ff7c45d65106 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 21 Sep 2020 11:53:09 +0200 Subject: [PATCH 2/4] remove commented code since 3 years --- htdocs/contact/agenda.php | 4 ---- htdocs/societe/agenda.php | 9 ++------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 386847abe38..1984097d3cb 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -245,10 +245,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog'); } - - //print '
'; - //print '
'; - $newcardbutton = ''; if (!empty($conf->agenda->enabled)) { diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 0108ba0a607..77953f73d7c 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -139,16 +139,11 @@ if ($socid > 0) $permok = $user->rights->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 : '').'&percentage=-1'; + 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 : '').'&percentage=-1'; $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog'); } - - //print '
'; - //print '
'; - - $newcardbutton = ''; if (!empty($conf->agenda->enabled)) { From 8e59d0528e3d39c0210b5db79b9aaa42bb542eba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Sep 2020 18:33:13 +0200 Subject: [PATCH 3/4] Update html.formactions.class.php --- htdocs/core/class/html.formactions.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 1c359914bf0..54406b1075b 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -202,7 +202,7 @@ class FormActions $newcardbutton = ''; if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) { - $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); + $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&origin='.urlencode($typeelement).'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); } From d53e7266d21a35eb302c3cfe6a12db4659e3564c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Sep 2020 18:34:35 +0200 Subject: [PATCH 4/4] Update agenda.php --- htdocs/contact/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 1984097d3cb..23a6042fbf9 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -242,7 +242,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : ''); $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&origin=contact&originid='.$object->id.'&percentage=-1&backtopage='.urlencode($_SERVER['PHP_SELF'].($objcon->id > 0 ? '?id='.$objcon->id : '')); - $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog'); + $out .= '&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')); } $newcardbutton = '';