|
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php
|
|
|
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstationusergroup.class.php';
|
|
|
|
|
|
// Load translation files required by the page
|
|
|
-$langs->loadLangs(array("workstation@workstation", "other"));
|
|
|
+$langs->loadLangs(array("workstation", "other"));
|
|
|
|
|
|
// Get parameters
|
|
|
$id = GETPOST('id', 'int');
|
|
@@ -44,8 +44,9 @@ $cancel = GETPOST('cancel', 'aZ09');
|
|
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'workstationcard'; // To manage different context of search
|
|
|
$backtopage = GETPOST('backtopage', 'alpha');
|
|
|
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
|
|
-$groups = GETPOST('groups');
|
|
|
-$resources = GETPOST('resources');
|
|
|
+
|
|
|
+$groups = GETPOST('groups', 'array:int');
|
|
|
+$resources = GETPOST('resources', 'array:int');
|
|
|
//$lineid = GETPOST('lineid', 'int');
|
|
|
|
|
|
// Initialize technical objects
|
|
@@ -55,9 +56,9 @@ $diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$u
|
|
|
$hookmanager->initHooks(array('workstationcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
|
|
|
|
|
// Fetch optionals attributes and labels
|
|
|
-//$extrafields->fetch_name_optionals_label($object->table_element);
|
|
|
+$extrafields->fetch_name_optionals_label($object->table_element);
|
|
|
|
|
|
-//$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
|
|
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
|
|
|
|
|
// Initialize array of search criterias
|
|
|
$search_all = GETPOST("search_all", 'alpha');
|
|
@@ -77,13 +78,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
|
|
|
|
|
|
$permissiontoread = $user->rights->workstation->workstation->read;
|
|
|
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
|
|
-$permissiontodelete = $user->rights->workstation->workstation->delete;
|
|
|
+$permissiontodelete = $user->rights->workstation->workstation->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
|
|
$permissionnote = $user->rights->workstation->workstation->write; // Used by the include of actions_setnotes.inc.php
|
|
|
$permissiondellink = $user->rights->workstation->workstation->write; // Used by the include of actions_dellink.inc.php
|
|
|
$upload_dir = $conf->workstation->multidir_output[isset($object->entity) ? $object->entity : 1];
|
|
|
|
|
|
// Security check
|
|
|
-restrictedArea($user, $object->element, $object->id, '', 'workstation');
|
|
|
+$isdraft = 0;
|
|
|
+restrictedArea($user, $object->element, $object->id, $object->table_element, 'workstation', 'fk_soc', 'rowid', $isdraft);
|
|
|
|
|
|
|
|
|
/*
|
|
@@ -153,7 +155,6 @@ $formfile = new FormFile($db);
|
|
|
$formresource = new FormResource($db);
|
|
|
|
|
|
$title = $langs->trans("Workstation");
|
|
|
-
|
|
|
$help_url = 'EN:Module_Workstation';
|
|
|
|
|
|
llxHeader('', $title, $help_url);
|
|
@@ -212,7 +213,7 @@ if ($action == 'create') {
|
|
|
print '</td>';
|
|
|
print '<td>';
|
|
|
print img_picto('', 'group');
|
|
|
- print $form->select_dolgroups($groups, 'groups', 1, '', 0, '', '', $object->entity, true, 'minwidth200');
|
|
|
+ print $form->select_dolgroups($groups, 'groups', 1, '', 0, '', '', $object->entity, true, 'quatrevingtpercent widthcentpercentminusx');
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '<tr id="wsresources"><td>';
|
|
@@ -220,7 +221,7 @@ if ($action == 'create') {
|
|
|
print '</td>';
|
|
|
print '<td>';
|
|
|
print img_picto('', 'resource');
|
|
|
- print $formresource->select_resource_list($resources, 'resources', '', '', 0, '', '', $object->entity, true, 0, 'minwidth200', true);
|
|
|
+ print $formresource->select_resource_list($resources, 'resources', '', '', 0, '', '', $object->entity, true, 0, 'quatrevingtpercent widthcentpercentminusx', true);
|
|
|
print '</td></tr>';
|
|
|
|
|
|
// Other attributes
|
|
@@ -269,7 +270,7 @@ if (($id || $ref) && $action == 'edit') {
|
|
|
print '</td>';
|
|
|
print '<td>';
|
|
|
print img_picto('', 'group');
|
|
|
- print $form->select_dolgroups(empty($groups) ? $object->usergroups : $groups, 'groups', 1, '', 0, '', '', $object->entity, true);
|
|
|
+ print $form->select_dolgroups(empty($groups) ? $object->usergroups : $groups, 'groups', 1, '', 0, '', '', $object->entity, true, 'quatrevingtpercent widthcentpercentminusx');
|
|
|
print '</td></tr>';
|
|
|
|
|
|
print '<tr id="wsresources"><td>';
|
|
@@ -277,7 +278,7 @@ if (($id || $ref) && $action == 'edit') {
|
|
|
print '</td>';
|
|
|
print '<td>';
|
|
|
print img_picto('', 'resource');
|
|
|
- print $formresource->select_resource_list(empty($resources) ? $object->resources : $resources, 'resources', '', '', 0, '', '', $object->entity, true, 0, '', true);
|
|
|
+ print $formresource->select_resource_list(empty($resources) ? $object->resources : $resources, 'resources', '', '', 0, '', '', $object->entity, true, 0, 'quatrevingtpercent widthcentpercentminusx', true);
|
|
|
print '</td></tr>';
|
|
|
|
|
|
// Other attributes
|
|
@@ -346,12 +347,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|
|
// Thirdparty
|
|
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
|
|
|
// Project
|
|
|
- if (! empty($conf->projet->enabled))
|
|
|
- {
|
|
|
+ if (! empty($conf->projet->enabled)) {
|
|
|
$langs->load("projects");
|
|
|
$morehtmlref .= '<br>'.$langs->trans('Project') . ' ';
|
|
|
- if ($permissiontoadd)
|
|
|
- {
|
|
|
+ if ($permissiontoadd) {
|
|
|
//if ($action != 'classify') $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
|
|
|
$morehtmlref .= ' : ';
|
|
|
if ($action == 'classify') {
|
|
@@ -393,6 +392,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|
|
if ($object->type === 'MACHINE') {
|
|
|
$object->fields['nb_operators_required']['visible'] = 0;
|
|
|
}
|
|
|
+
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
|
|
|
|
|
// Groups
|
|
@@ -422,7 +422,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|
|
}
|
|
|
|
|
|
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
|
|
- //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
|
|
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
|
|
|
|
|
print '</table>';
|
|
|
print '</div>';
|