From fddff4d1ca98bae787725681580e7db00ffff0f8 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 27 Oct 2021 15:59:27 +0200 Subject: [PATCH 1/8] TakePOS hooks improvements --- htdocs/takepos/index.php | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 2c4da0515f1..dede65df2d6 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1121,15 +1121,26 @@ if ($resql) { } $hookmanager->initHooks(array('takeposfrontend')); -$reshook = $hookmanager->executeHooks('ActionButtons'); -if (!empty($reshook)) { - if (is_array($reshook) && !isset($reshook['title'])) { - foreach ($reshook as $reshook) { - $menus[$r++] = $reshook; - } - } else { - $menus[$r++] = $reshook; - } +$parameters = array('menus'=>$menus); +$reshook = $hookmanager->executeHooks('ActionButtons',$parameters); +if ($reshook == 0) { //add buttons + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } + elseif ($reshook == 1){ + $r = 0; //replace buttons + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } + } } if ($r % 3 == 2) { From b81d826f8824280ee63ffb500ea8559fc92c0950 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 27 Oct 2021 17:00:46 +0200 Subject: [PATCH 2/8] Fix travis --- htdocs/takepos/index.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dede65df2d6..8f93dfca0bb 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1122,25 +1122,25 @@ if ($resql) { $hookmanager->initHooks(array('takeposfrontend')); $parameters = array('menus'=>$menus); -$reshook = $hookmanager->executeHooks('ActionButtons',$parameters); +$reshook = $hookmanager->executeHooks('ActionButtons', $parameters); if ($reshook == 0) { //add buttons - if (is_array($hookmanager->resArray) ) { - foreach ($hookmanager->resArray as $resArray) { - foreach ($resArray as $butmenu) { - $menus[$r++] = $butmenu; - } - } - } - elseif ($reshook == 1){ - $r = 0; //replace buttons - if (is_array($hookmanager->resArray) ) { - foreach ($hookmanager->resArray as $resArray) { - foreach ($resArray as $butmenu) { - $menus[$r++] = $butmenu; - } - } - } - } + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } + elseif ($reshook == 1) { + $r = 0; //replace buttons + if (is_array($hookmanager->resArray) ) { + foreach ($hookmanager->resArray as $resArray) { + foreach ($resArray as $butmenu) { + $menus[$r++] = $butmenu; + } + } + } + } } if ($r % 3 == 2) { From 9cd6e7ac75f64c7cfd0daecf82dde23c333b5fda Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 27 Oct 2021 17:44:07 +0200 Subject: [PATCH 3/8] Fix travis --- htdocs/takepos/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8f93dfca0bb..8271103cfb6 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1130,8 +1130,7 @@ if ($reshook == 0) { //add buttons $menus[$r++] = $butmenu; } } - } - elseif ($reshook == 1) { + } elseif ($reshook == 1) { $r = 0; //replace buttons if (is_array($hookmanager->resArray) ) { foreach ($hookmanager->resArray as $resArray) { From 156f1e7e2a70209290fefd0eb20b167daa0d1eea Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 28 Oct 2021 11:00:12 +0200 Subject: [PATCH 4/8] fix holiday page titles --- htdocs/holiday/card.php | 2 +- htdocs/holiday/document.php | 3 +-- htdocs/holiday/info.php | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index b4bb54f3b1b..216e524a905 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -882,7 +882,7 @@ $object = new Holiday($db); $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); -$title = $langs->trans('CPTitreMenu'); +$title = $langs->trans('Leave'); $help_url = 'EN:Module_Holiday'; llxHeader('', $title, $help_url); diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 7dc086a113f..17687a101ab 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -137,8 +137,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $form = new Form($db); $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); - -$title = $langs->trans('InterventionCard'); +$title = $langs->trans("Leave").' - '.$langs->trans("Files"); llxHeader('', $title); diff --git a/htdocs/holiday/info.php b/htdocs/holiday/info.php index 3ec95e61a52..5df3a5069de 100644 --- a/htdocs/holiday/info.php +++ b/htdocs/holiday/info.php @@ -78,7 +78,7 @@ $result = restrictedArea($user, 'holiday', $object->id, 'holiday'); $form = new Form($db); -$title = $langs->trans("Holiday")." - ".$langs->trans("Info"); +$title = $langs->trans("Leave")." - ".$langs->trans("Info"); $helpurl = ""; llxHeader("", $title, $helpurl); From d93cf696e8a7c9223d8f667835a7da24898a6bc4 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 28 Oct 2021 11:00:51 +0200 Subject: [PATCH 5/8] use FKEditor only if activated --- htdocs/holiday/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 216e524a905..82a8542a9e0 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1088,7 +1088,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''; print ''.$langs->trans("DescCP").''; print ''; - $doleditor = new DolEditor('description', GETPOST('description', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + $doleditor = new DolEditor('description', GETPOST('description', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%'); print $doleditor->Create(1); print ''; @@ -1289,7 +1289,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''; print ''.$langs->trans('DescCP').''; print ''; - $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%'); print $doleditor->Create(1); print ''; } From 449e1821fc2a2ab1b9d822c8d8b56dccaede1bbb Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 28 Oct 2021 11:04:43 +0200 Subject: [PATCH 6/8] cleanup html and comment --- htdocs/holiday/card.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 82a8542a9e0..045c370de8e 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1158,7 +1158,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { setEventMessages($errors, null, 'errors'); } - // On vérifie si l'utilisateur à le droit de lire cette demande + // check if the user has the right to read this request if ($canread) { $head = holiday_prepare_head($object); @@ -1433,11 +1433,9 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) { - print '
'; if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { - print ''; + print $form->buttonsSaveCancel(); } - print '
'; } print ''; @@ -1521,7 +1519,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $action = 'presend'; } - if ($action != 'presend') { + if ($action != 'presend' && $action != 'edit') { print '
'; print ''; // ancre @@ -1543,7 +1541,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { //$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - print '
'; + print '
'; $MAXEVENT = 10; @@ -1552,7 +1550,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright); - print '
'; + print '
'; } } } From 966b3ab85fec62b979bbceed7519f489645a4b76 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 28 Oct 2021 11:05:01 +0200 Subject: [PATCH 7/8] use ref prefix for file uploads --- htdocs/holiday/document.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 17687a101ab..6986d75d630 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -346,12 +346,12 @@ if ($object->id) { print dol_get_fiche_end(); - - - $modulepart = 'holiday'; $permissiontoadd = $user->rights->holiday->write; $permtoedit = $user->rights->holiday->write; $param = '&id='.$object->id; + $relativepathwithnofile = $modulepart.'/'.dol_sanitizeFileName($object->ref).'/'; + $savingdocmask = dol_sanitizeFileName($object->ref).'-__file__'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); From 41b8c92311f37172436886394bec319f8354d6f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Oct 2021 15:16:40 +0100 Subject: [PATCH 8/8] Update card.php --- htdocs/holiday/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 045c370de8e..e84fb79c7e3 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1541,7 +1541,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { //$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - print '
'; + print '
'; $MAXEVENT = 10; @@ -1550,7 +1550,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright); - print '
'; + print ''; } } }