Update workstation_note.php

This commit is contained in:
UT from dolibit 2022-08-26 12:24:01 +02:00 committed by GitHub
parent e5937ef742
commit 8aa2c5ee96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
<?php <?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
@ -17,7 +18,7 @@
*/ */
/** /**
* \file workstation_note.php * \file htdocs/workstation/workstation_note.php
* \ingroup workstation * \ingroup workstation
* \brief Tab for notes on Workstation * \brief Tab for notes on Workstation
*/ */
@ -29,12 +30,12 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("workstation", "companies")); $langs->loadLangs(array('workstation', 'companies'));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
@ -42,18 +43,19 @@ $backtopage = GETPOST('backtopage', 'alpha');
$object = new Workstation($db); $object = new Workstation($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('workstationnote', 'globalcard')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array('workstationnote', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->workstation->multidir_output[$object->entity]."/".$object->id; $upload_dir = $conf->workstation->multidir_output[$object->entity]."/".$object->id;
} }
$permissionnote = $user->rights->workstation->workstation->write; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->workstation->workstation->write; // Used by the include of actions_setnotes.inc.php
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
// Security check // Security check
$isdraft = 0; $isdraft = 0;
@ -63,7 +65,8 @@ restrictedArea($user, $object->element, $object->id, $object->table_element, 'wo
/* /*
* Actions * Actions
*/ */
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} }