25if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL',
'1');
27if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
28if (!defined(
'NOREQUIREHTML')) define(
'NOREQUIREHTML',
'1');
34if (! defined(
"NOREDIRECTBYMAINTOLOGIN")) define(
'NOREDIRECTBYMAINTOLOGIN', 1);
41require
'../main.inc.php';
49require_once DOL_DOCUMENT_ROOT .
'/core/class/jsonResponse.class.php';
50require_once __DIR__ .
'/class/memo.class.php';
51if (!class_exists(
'Validate')) {
52 require_once DOL_DOCUMENT_ROOT .
'/core/class/validate.class.php';
56$hookmanager->initHooks([
'quickmemoInterface']);
59$langs->loadLangs([
"quickmemo",
"other",
'main']);
69if (!$user || !$user->hasRight(
'quickmemo',
'memo',
'read')) {
70 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
71 $jsonResponse->result = 0;
72 print $jsonResponse->getResponse();
78$reshook = $hookmanager->executeHooks(
'quickMemoInterface', [], $jsonResponse, $action);
80 $jsonResponse->msg = $hookmanager->error;
81 if (!empty($hookmanager->errors)) {
82 $jsonResponse->msg = (!empty($hookmanager->error) ?
'<br>' :
'') . implode(
'<br>', $hookmanager->errors);
84 $jsonResponse->result = 0;
85 print $jsonResponse->getResponse();
93} elseif ($action ===
'update_position') {
94 quickMemoIntefaceActionUpdatePosition($jsonResponse);
95} elseif ($action ===
'update_all_positions') {
96 quickMemoIntefaceActionUpdateAllPositions($jsonResponse);
97} elseif ($action ===
'list') {
98 quickMemoIntefaceActionList($jsonResponse);
99} elseif ($action ===
'list_models') {
100 quickMemoIntefaceActionListModels($jsonResponse);
101} elseif ($action ===
'update-color') {
102 quickMemoIntefaceActionUpdateColor($jsonResponse);
103} elseif ($action ===
'update-shared-on-element') {
104 quickMemoIntefaceActionUpdateSharedOnElement($jsonResponse);
105} elseif ($action ===
'update-private') {
106 quickMemoIntefaceActionUpdatePrivate($jsonResponse);
107} elseif ($action ===
'archive') {
108 quickMemoIntefaceActionArchiveNote($jsonResponse);
109} elseif ($action ===
'delete') {
110 quickMemoIntefaceActionDeleteNote($jsonResponse);
111} elseif ($action ===
'create') {
112 quickMemoIntefaceActionCreate($jsonResponse);
113} elseif ($action ===
'create_model') {
114 quickMemoIntefaceActionCreateModel($jsonResponse);
115} elseif ($action ===
'delete_model') {
116 quickMemoIntefaceActionDeleteModel($jsonResponse);
117} elseif ($action ===
'update_model_rank') {
118 quickMemoIntefaceActionUpdateModelRank($jsonResponse);
119} elseif ($action ===
'update_note') {
120 quickMemoIntefaceActionUpdateNote($jsonResponse);
122 $jsonResponse->msg =
'Action not found';
125print $jsonResponse->getResponse();
134function quickMemoIntefaceActionUpdatePosition($jsonResponse)
136 global $user, $langs,
$db;
139 if (!$user->hasRight(
'quickmemo',
'memo',
'read')) {
140 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
141 $jsonResponse->result = 0;
147 if (empty(
$id) && !is_numeric(
$id)) {
148 $jsonResponse->msg =
'Need memo Id';
153 if ($memo->fetch(
$id) <= 0) {
154 $jsonResponse->msg =
'Memo not found';
159 if ($user->id != $memo->fk_user_creat && $memo->private) {
160 $jsonResponse->msg = $langs->trans(
'QuickMemoCantMoveThisPrivateNote');
170 if (!$memo->updatePosition($user, (
int) $x, (
int) $y, (
int) $w, (
int) $h, (
int) $z)) {
171 $jsonResponse->result = 0;
172 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
175 $jsonResponse->result = 1;
176 $jsonResponse->data =
null;
186function quickMemoIntefaceActionUpdateAllPositions($jsonResponse)
188 global $user, $langs,
$db;
192 if (!$user->hasRight(
'quickmemo',
'memo',
'read')) {
193 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
194 $jsonResponse->result = 0;
198 $json = file_get_contents(
'php://input');
199 $data = json_decode($json,
true);
201 if (!is_array($data) || empty($data[
'memos'])) {
202 $jsonResponse->result = 0;
203 $jsonResponse->msg =
'No data received';
209 foreach ($data[
'memos'] as $item) {
211 if ($memo->fetch((
int) $item[
'id']) > 0) {
213 if ($user->id != $memo->fk_user_creat && $memo->private)
continue;
215 $memo->updatePosition(
227 $jsonResponse->result = 1;
237function quickMemoIntefaceActionCreate($jsonResponse)
239 global $user, $langs,
$db;
241 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
242 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
243 $jsonResponse->result = 0;
247 $element_id =
GETPOST(
"element_id",
"int");
248 $element_type =
GETPOST(
"element_type");
251 if (empty($element_id) && !is_numeric($element_id) && !empty($element_type)) {
252 $jsonResponse->msg =
'Need memo element_id';
257 $context_tab =
GETPOST(
'context');
258 if (!in_array($context_tab, $memo->getAvailableMemoContext())) {
259 $jsonResponse->result = 0;
260 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : Context unknown';
266 $firstColor = !empty($colorPresets) ? $colorPresets[0] :
null;
267 $memo->color =
GETPOST(
"color");
269 $memo->color = $firstColor;
272 $memo->quick_note =
GETPOST(
"note",
"alphanohtml");
273 $memo->fk_element = $element_id;
274 $memo->element_type = $element_type;
275 $jsonResponse->debug =
GETPOST(
"color", $firstColor);
276 $memo->context_tab = $context_tab;
277 $memo->shared_on_element =
GETPOST(
"shared_on_element",
"int") ? 1 : 0;
278 $memo->private =
GETPOST(
"private",
"int") ? 1 : 0;
280 $memo->pos_x =
GETPOST(
"x",
"int");
281 $memo->pos_y =
GETPOST(
"y",
"int");
282 $memo->pos_w =
GETPOST(
"w",
"int");
283 $memo->pos_h =
GETPOST(
"h",
"int");
284 $memo->pos_z =
GETPOST(
"z",
"int");
285 $memo->status = Memo::STATUS_VALIDATED;
287 $resCre = $memo->create($user);
289 $jsonResponse->result = 0;
290 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
293 $jsonResponse->result = 1;
294 $jsonResponse->data =
new stdClass();
295 $jsonResponse->data->id = (int) $resCre;
307function quickMemoIntefaceActionArchiveNote($jsonResponse)
309 global $user, $langs,
$db;
311 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
312 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
313 $jsonResponse->result = 0;
319 if (empty(
$id) && !is_numeric(
$id)) {
320 $jsonResponse->msg =
'Need memo Id';
325 if ($memo->fetch(
$id) <= 0) {
326 $jsonResponse->msg =
'Memo not found';
330 if ($user->id != $memo->fk_user_creat && $memo->private) {
331 $jsonResponse->msg = $langs->trans(
'QuickMemoCantArchiveThisPrivateNote');
335 if ($memo->setArchived($user) < 0) {
336 $jsonResponse->result = 0;
337 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
340 $jsonResponse->result = 1;
341 $jsonResponse->data =
null;
351function quickMemoIntefaceActionCreateModel($jsonResponse)
353 global $user, $langs,
$db;
355 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
356 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
357 $jsonResponse->result = 0;
363 if (empty(
$id) && !is_numeric(
$id)) {
364 $jsonResponse->msg =
'Need memo Id';
369 if ($memo->fetch(
$id) <= 0) {
370 $jsonResponse->msg =
'Memo not found';
374 if ($user->id != $memo->fk_user_creat && $memo->private) {
375 $jsonResponse->msg = $langs->trans(
'QuickMemoCantChangeThisPrivateNote');
379 $element_type =
GETPOST(
"element_type");
380 if (empty($element_type)) {
381 $memo->element_type =
'';
384 $memo->status = Memo::STATUS_TPL;
385 $memo->private_tpl =
GETPOST(
"tpl_private",
"int");
386 $memo->name_tpl =
GETPOST(
"tpl_name");
387 $memo->fk_user_creat = $user->id;
388 $memo->date_creation =
dol_now();
389 $memo->fk_user_modif =
null;
390 $memo->date_modification =
null;
391 $memo->fk_user_archived =
null;
392 $memo->date_archived =
null;
394 if ($memo->update($user) < 0) {
395 $jsonResponse->result = 0;
396 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
399 $jsonResponse->result = 1;
400 $jsonResponse->data =
null;
411function quickMemoIntefaceActionDeleteModel($jsonResponse)
413 global $user, $langs,
$db;
415 if (!$user->hasRight(
'quickmemo',
'memo',
'delete')) {
416 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
417 $jsonResponse->result = 0;
423 if (empty(
$id) && !is_numeric(
$id)) {
424 $jsonResponse->msg =
'Need model Id';
429 if ($memo->fetch(
$id) <= 0) {
430 $jsonResponse->msg =
'Memo not found';
434 if ($memo->status != Memo::STATUS_TPL) {
435 $jsonResponse->msg =
'Not a model';
439 if ($user->id != $memo->fk_user_creat && $memo->private_tpl) {
440 $jsonResponse->msg = $langs->trans(
'QuickMemoCantDeleteThisPrivateModel');
444 if ($memo->delete($user) < 0) {
445 $jsonResponse->result = 0;
446 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
449 $jsonResponse->result = 1;
450 $jsonResponse->data =
null;
487function quickMemoIntefaceActionUpdateModelRank($jsonResponse)
489 global $user, $langs,
$db;
491 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
492 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
493 $jsonResponse->result = 0;
497 $json = file_get_contents(
'php://input');
498 $data = json_decode($json,
true);
500 if (!is_array($data) || empty($data[
'moved'][
'id']) || !isset($data[
'moved'][
'newPos'])) {
501 $jsonResponse->result = 0;
502 $jsonResponse->msg =
'INVALID MOVED DATA';
508 $movedId = (int) $data[
'moved'][
'id'];
509 $newPos = max(1, (
int) $data[
'moved'][
'newPos']);
514 $sql =
'SELECT rowid, element_type, context_tab
515 FROM '.MAIN_DB_PREFIX.$tmpMemo->table_element.
'
516 WHERE rowid = '. (int) $movedId.
'
517 AND status = '. (
int) Memo::STATUS_TPL;
519 $res =
$db->query($sql);
520 if (!$res || !
$db->num_rows($res)) {
521 $jsonResponse->result = 0;
522 $jsonResponse->msg =
'MODEL NOT FOUND';
526 $movedModel =
$db->fetch_object($res);
529 $sqlAll =
'SELECT rowid
530 FROM '.MAIN_DB_PREFIX.$tmpMemo->table_element.
'
531 WHERE status = '. (int) Memo::STATUS_TPL.
'
532 AND element_type IN (\''.
$db->escape($movedModel->element_type).
'\', \
'\')
533 ORDER BY rank_tpl DESC
';
535 // AND context_tab = \''.
$db->escape($movedModel->context_tab).
'\'
537 $resAll =
$db->query($sqlAll);
539 $jsonResponse->result = 0;
540 $jsonResponse->msg =
$db->error();
545 while ($obj =
$db->fetch_object($resAll)) {
546 $orderedIds[] = (int) $obj->rowid;
550 $orderedIds = array_values(array_diff($orderedIds, [$movedId]));
553 $newIndex = min(count($orderedIds), $newPos - 1);
556 array_splice($orderedIds, $newIndex, 0, [$movedId]);
559 $total = count($orderedIds);
560 $currentRank = $total;
564 foreach ($orderedIds as
$id) {
565 $sqlUp =
'UPDATE '.MAIN_DB_PREFIX.$tmpMemo->table_element.
'
566 SET rank_tpl = '.(int) $currentRank.
'
567 WHERE rowid = '.(
int)
$id.
'
568 AND status = '. (int) Memo::STATUS_TPL.
'
569 AND (private_tpl = 0 OR fk_user_creat = '.(
int) $user->id.
')';
571 if (!
$db->query($sqlUp)) {
573 $jsonResponse->result = 0;
574 $jsonResponse->msg =
$db->error();
583 $jsonResponse->result = 1;
584 $jsonResponse->data =
null;
592function quickMemoIntefaceActionDeleteNote($jsonResponse)
594 global $user, $langs,
$db;
596 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
597 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
598 $jsonResponse->result = 0;
604 if (empty(
$id) && !is_numeric(
$id)) {
605 $jsonResponse->msg =
'Need memo Id';
610 if ($memo->fetch(
$id) <= 0) {
611 $jsonResponse->msg =
'Memo not found';
615 if ($memo->status == Memo::STATUS_TPL) {
616 $jsonResponse->msg =
'Can\'t delete model';
620 if ($user->id != $memo->fk_user_creat && $memo->private) {
621 $jsonResponse->msg = $langs->trans(
'QuickMemoCantDeleteThisPrivateNote');
625 if ($memo->delete($user) < 0) {
626 $jsonResponse->result = 0;
627 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
630 $jsonResponse->result = 1;
631 $jsonResponse->data =
null;
642function quickMemoIntefaceActionUpdateNote($jsonResponse)
644 global $user, $langs,
$db;
646 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
647 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
648 $jsonResponse->result = 0;
654 if (empty(
$id) && !is_numeric(
$id)) {
655 $jsonResponse->msg =
'Need memo Id';
660 if ($memo->fetch(
$id) <= 0) {
661 $jsonResponse->msg =
'Memo not found';
665 $memo->quick_note =
GETPOST(
"note",
"alphanohtml");
667 $memo->fk_user_modif = $user->id;
669 if ($memo->update($user) < 0) {
670 $jsonResponse->result = 0;
671 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
674 $jsonResponse->result = 1;
675 $jsonResponse->data =
new stdClass();
678 $jsonResponse->data->memo = $memo->getJsMemo($user);
688function quickMemoIntefaceActionUpdateColor($jsonResponse)
690 global $user, $langs,
$db;
692 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
693 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
694 $jsonResponse->result = 0;
700 if (empty(
$id) && !is_numeric(
$id)) {
701 $jsonResponse->msg =
'Need memo Id';
707 $jsonResponse->msg =
'Need valide Color';
712 if ($memo->fetch(
$id) <= 0) {
713 $jsonResponse->msg =
'Memo not found';
717 if ($user->id != $memo->fk_user_creat && $memo->private) {
718 $jsonResponse->msg = $langs->trans(
'QuickMemoCantChangeThisPrivateNote');
722 $memo->color = $color;
724 if (!$memo->update($user) < 0) {
725 $jsonResponse->result = 0;
726 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
729 $jsonResponse->result = 1;
730 $jsonResponse->data =
new stdClass();
733 $jsonResponse->data->memo = $memo->getJsMemo($user);
743function quickMemoIntefaceActionUpdateSharedOnElement($jsonResponse)
745 global $user, $langs,
$db;
747 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
748 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
749 $jsonResponse->result = 0;
755 if (empty(
$id) && !is_numeric(
$id)) {
756 $jsonResponse->msg =
'Need memo Id';
760 $shared_on_element =
GETPOST(
"shared_on_element",
"int");
763 if ($memo->fetch(
$id) <= 0) {
764 $jsonResponse->msg =
'Memo not found';
768 if ($user->id != $memo->fk_user_creat && $memo->private) {
769 $jsonResponse->msg = $langs->trans(
'QuickMemoCantChangeThisPrivateNote');
773 $memo->shared_on_element = $shared_on_element ? 1 : 0;
775 if (!$memo->update($user) < 0) {
776 $jsonResponse->result = 0;
777 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
780 $jsonResponse->result = 1;
781 $jsonResponse->data =
null;
782 $jsonResponse->data =
new stdClass();
785 $jsonResponse->data->memo = $memo->getJsMemo($user);
796function quickMemoIntefaceActionUpdatePrivate($jsonResponse)
798 global $user, $langs,
$db;
800 if (!$user->hasRight(
'quickmemo',
'memo',
'write')) {
801 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
802 $jsonResponse->result = 0;
808 if (empty(
$id) && !is_numeric(
$id)) {
809 $jsonResponse->msg =
'Need memo Id';
813 $private =
GETPOST(
"private",
"int");
816 if ($memo->fetch(
$id) <= 0) {
817 $jsonResponse->msg =
'Memo not found';
821 if ($user->id != $memo->fk_user_creat && $memo->private) {
822 $jsonResponse->msg = $langs->trans(
'QuickMemoCantChangeThisPrivateNote');
826 $memo->private = $private ? 1 : 0;
828 if (!$memo->update($user) < 0) {
829 $jsonResponse->result = 0;
830 $jsonResponse->msg = $langs->trans(
'UpdateError') .
' : ' . $memo->errorsToString();
833 $jsonResponse->result = 1;
834 $jsonResponse->data =
new stdClass();
837 $jsonResponse->data->memo = $memo->getJsMemo($user);
847function quickMemoIntefaceActionListModels($jsonResponse)
849 global $user, $langs,
$db;
851 if (!$user->hasRight(
'quickmemo',
'memo',
'read')) {
852 $jsonResponse->msg = $langs->trans(
'NotEnoughRights');
853 $jsonResponse->result = 0;
857 $element_type =
GETPOST(
'element_type',
'alpha');
860 $jsonResponse->data =
new stdClass();
861 $jsonResponse->data->modelTemplate = [];
862 $jsonResponse->data->presetTemplate = [];
867 foreach ($colorList as $color) {
870 $default->color = $color;
876 $default->shared_on_element = 0;
877 $default->private = 0;
878 $default->user_name = $user->getFullName($langs);
880 $default->date_change =
'';
881 $default->user_change_name =
'';
884 $jsonResponse->data->presetTemplate[] = $default;
889 $sql = $memoStatic->getTemplateMemosQuery($element_type,
$context);
890 $resql =
$db->query($sql);
892 $jsonResponse->result = 0;
893 $jsonResponse->msg =
$db->lasterror();
897 while ($obj =
$db->fetch_object($resql)) {
899 $jsonResponse->data->modelTemplate[] = quickMemoInterfacePopulateMemoTplFromQueryObj($obj);
902 $jsonResponse->result = 1;
910function quickMemoIntefaceActionList($jsonResponse)
912 global $user, $langs,
$db;
914 if (!$user->hasRight(
'quickmemo',
'memo',
'read')) {
915 $jsonResponse->msg = $langs->trans(
'NotEnoughPermissions');
916 $jsonResponse->result = 0;
921 $element_type =
GETPOST(
'element_type',
'alpha');
923 $jsonResponse->data =
new stdClass();
924 $jsonResponse->data->memos = [];
925 $jsonResponse->data->nbArchives = 0;
927 if (empty($element_id) && !empty($element_type)) {
928 $jsonResponse->msg =
'Need element_id ';
929 $jsonResponse->result = 0;
936 $sql = $staticMemo->getMemosQuery($element_type, $element_id,
$context);
937 $resql =
$db->query($sql);
939 $jsonResponse->result = 0;
940 $jsonResponse->msg =
$db->lasterror();
946 while ($obj =
$db->fetch_object($resql)) {
948 $memos[] = quickMemoInterfacePopulateMemoFromQueryObj($obj);
951 $jsonResponse->data->memos = $memos;
954 $nbArchives = $staticMemo->countArchivedMemoQuery($element_type, $element_id,
$context);
955 if ($nbArchives ===
false) {
956 $jsonResponse->result = 0;
957 $jsonResponse->msg =
'Error count archive';
961 $jsonResponse->data->nbArchives = $nbArchives;
963 $jsonResponse->result = 1;
972function quickMemoInterfacePopulateMemoFromQueryObj($obj)
975 $obj->date_creation =
$db->jdate($obj->date_creation);
976 $obj->tms =
$db->jdate($obj->tms);
979 $memo->id = $obj->rowid;
980 $memo->color = $obj->color;
981 $memo->note = $obj->quick_note;
983 $memo->pos_x = $obj->user_pos_x !==
null ? (int) $obj->user_pos_x : (int) $obj->pos_x;
984 $memo->pos_y = $obj->user_pos_y !==
null ? (int) $obj->user_pos_y : (int) $obj->pos_y;
985 $memo->pos_w = $obj->user_pos_w !==
null ? (int) $obj->user_pos_w : (int) $obj->pos_w;
986 $memo->pos_h = $obj->user_pos_h !==
null ? (int) $obj->user_pos_h : (int) $obj->pos_h;
987 $memo->pos_z = $obj->user_pos_z !==
null ? (int) $obj->user_pos_z : (int) $obj->pos_z;
989 $memo->shared_on_element = $obj->shared_on_element;
990 $memo->private = (int) $obj->private;
991 $memo->date_creation =
dol_print_date($obj->date_creation,
'%d/%m/%Y %H:%M',
'tzuserrel');
992 $memo->date_change =
'';
993 if (!empty($obj->tms) && ((
int) $obj->date_creation !== (
int) $obj->tms || (
int) $obj->fk_user_modif > 0)) {
994 $memo->date_change =
dol_print_date($obj->tms,
'%d/%m/%Y %H:%M',
'tzuserrel');
997 $memo->fk_user_creat = $obj->fk_user_creat;
998 $memo->user_name =
'';
999 if ((
int) $obj->fk_user_creat > 0) {
1001 if ($userCreate->fetch((
int) $obj->fk_user_creat) > 0) {
1002 $memo->user_name = $userCreate->getFullName($langs);
1006 $memo->fk_user_modif = $obj->fk_user_modif;
1007 $memo->user_change_name =
'';
1008 if ((
int) $obj->fk_user_modif > 0) {
1010 if ($userMod->fetch((
int) $obj->fk_user_modif) > 0) {
1011 $memo->user_change_name = $userMod->getFullName($langs);
1023function quickMemoInterfacePopulateMemoTplFromQueryObj($obj)
1025 global
$db, $langs, $user;
1026 $obj->date_creation =
$db->jdate($obj->date_creation);
1027 $obj->tms =
$db->jdate($obj->tms);
1031 $memo->name = $obj->name_tpl;
1032 $memo->id = $obj->rowid;
1033 $memo->color = $obj->color;
1034 $memo->note = $obj->quick_note;
1035 $memo->pos_x = $obj->user_pos_x !==
null ? (int) $obj->user_pos_x : (int) $obj->pos_x;
1036 $memo->pos_y = $obj->user_pos_y !==
null ? (int) $obj->user_pos_y : (int) $obj->pos_y;
1037 $memo->pos_w = $obj->user_pos_w !==
null ? (int) $obj->user_pos_w : (int) $obj->pos_w;
1038 $memo->pos_h = $obj->user_pos_h !==
null ? (int) $obj->user_pos_h : (int) $obj->pos_h;
1039 $memo->pos_z = $obj->user_pos_z !==
null ? (int) $obj->user_pos_z : (int) $obj->pos_z;
1040 $memo->rank_tpl = (int) $obj->rank_tpl;
1042 $memo->shared_on_element = $obj->shared_on_element;
1043 $memo->private = (int) $obj->private;
1044 $memo->date_creation =
dol_print_date($obj->date_creation,
'%d/%m/%Y %H:%M',
'tzuserrel');
1045 $memo->fk_user_creat = $user->id;
1046 $memo->user_name = $user->getFullName($langs);
1047 $memo->date_change =
'';
1048 $memo->user_change_name =
'';
$id
Support class for third parties, contacts, members, users or resources.
Class JsonResponse used for ajax responses in Dolibarr.
static checkColor($color)
Vérifie si une couleur est un code hex valide.
static getJsMemoDefault()
Get JS memo default.
static getColorPreset()
Get color preset.
Class to manage Dolibarr users.
dol_now($mode='gmt')
Return date for now.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
isModEnabled($module)
Is Dolibarr module enabled.
$context
@method int call_trigger(string $triggerName, ?User $user)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.