dolibarr 24.0.0-beta
actions_quickmemo.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2026 John BOTELLA
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
26require_once DOL_DOCUMENT_ROOT.'/core/class/commonhookactions.class.php';
27
28require_once __DIR__ . '/memo.class.php';
29
30
35{
39 public $db;
40
44 public $error = '';
45
49 public $errors = array();
50
51
55 public $results = array();
56
60 public $resprints;
61
65 public $priority;
66
67
73 public function __construct($db)
74 {
75 $this->db = $db;
76 }
77
87 public function llxFooter($parameters, &$object, &$action, $hookmanager)
88 {
89 if (!isModEnabled('quickmemo')) {
90 return 0;
91 }
92
93 $context = Memo::getMemoContext($parameters['context']??'');
94 if (empty($context)) {
95 return 0;
96 }
97
98 $jsConfVars = [
99 'context' => $context,
100 ];
101
102 if (!empty($object) && is_object($object) && isset($object->element)) {
103 $jsConfVars = array_merge([
104 'archivesUrlParams' => '&search_fk_element='. (int) $object->id .'&search_element_type='.$object->element,
105 'elementId' => (int) $object->id,
106 'elementType' => $object->element
107 ], $jsConfVars);
108 }
109
111
112 return 0;
113 }
114
115
125 public function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
126 {
127 if (!isModEnabled('quickmemo')) {
128 return 0;
129 }
130
131 if (empty($object) || !is_object($object) || !isset($object->element)) {
132 return 0;
133 }
134
135 $jsConfVars = [
136 'archivesUrlParams' => '&search_fk_element='. (int) $object->id .'&search_element_type='.$object->element,
137 'elementId' => (int) $object->id,
138 'elementType' => $object->element,
139 'context' => Memo::getMemoContext($parameters['context']??'', $object),
140 ];
141
143
144 return 0;
145 }
146}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class ActionsQuickMemo.
addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
Overload the addHtmlHeader function : add or replace array of object linkable.
__construct($db)
Constructor.
llxFooter($parameters, &$object, &$action, $hookmanager)
Overload the llxFooter function : add or replace array of object linkable.
Parent class of all other hook actions classes.
static loadQuickMemoJsInterface($jsConfVars)
Load the Javascript interface for QuickMemo.
static getMemoContext($context, $object=null)
Get memo context.
isModEnabled($module)
Is Dolibarr module enabled.
$context
@method int call_trigger(string $triggerName, ?User $user)
Definition logout.php:42