+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see https://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/modules/workstation/modules_workstation.php
+ * \ingroup workstation
+ * \brief File that contains parent class for workstations document models and parent class for workstations numbering models
+ */
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
+
+
+/**
+ * Parent class for documents models
+ */
+abstract class ModelePDFWorkstation extends CommonDocGenerator
+{
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ global $conf;
+
+ $type = 'workstation';
+ $list = array();
+
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $list = getListOfModels($db, $type, $maxfilenamelength);
+
+ return $list;
+ }
+}
+
+
+
+/**
+ * Parent class to manage numbering of Workstation
+ */
+abstract class ModeleNumRefWorkstation
+{
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+ /**
+ * Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
+
+ /**
+ * Returns the default description of the numbering template
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("workstation@workstation");
+ return $langs->trans("NoDescription");
+ }
+
+ /**
+ * Returns an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("workstation@workstation");
+ return $langs->trans("NoExample");
+ }
+
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated($object)
+ {
+ return true;
+ }
+
+ /**
+ * Returns next assigned value
+ *
+ * @param Object $object Object we need next value for
+ * @return string Valeur
+ */
+ public function getNextValue($object)
+ {
+ global $langs;
+ return $langs->trans("NotAvailable");
+ }
+
+ /**
+ * Returns version of numbering module
+ *
+ * @return string Valeur
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
+
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ if ($this->version) return $this->version;
+ return $langs->trans("NotAvailable");
+ }
+}
diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php
index c7069b3d2aa..a0b0ce7a6e2 100644
--- a/htdocs/core/tpl/commonfields_add.tpl.php
+++ b/htdocs/core/tpl/commonfields_add.tpl.php
@@ -55,6 +55,7 @@ foreach ($object->fields as $key => $val)
print '| ';
if (!empty($val['picto'])) { print img_picto('', $val['picto']); }
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
+ elseif ($val['type'] == 'double') $value = price2num(GETPOST($key, 'alphanohtml'));
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'restricthtml');
else $value = GETPOST($key, 'alpha');
if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0);
diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php
index 946d8c0b504..76a9fafe417 100644
--- a/htdocs/core/tpl/commonfields_edit.tpl.php
+++ b/htdocs/core/tpl/commonfields_edit.tpl.php
@@ -53,6 +53,7 @@ foreach ($object->fields as $key => $val)
print ' | ';
if (!empty($val['picto'])) { print img_picto('', $val['picto']); }
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key) ?GETPOST($key, 'int') : $object->$key;
+ elseif ($val['type'] == 'double') $value = GETPOSTISSET($key) ? price2num(GETPOST($key, 'alphanohtml')) : $object->$key;
elseif (preg_match('/^(text|html)/', $val['type'])) {
$tmparray = explode(':', $val['type']);
if (!empty($tmparray[1])) {
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
new file mode 100644
index 00000000000..a75de31a905
--- /dev/null
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -0,0 +1,40 @@
+CREATE TABLE llx_workstation_workstation(
+ -- BEGIN MODULEBUILDER FIELDS
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ ref varchar(128) DEFAULT '(PROV)' NOT NULL,
+ label varchar(255),
+ type varchar(7),
+ note_public text,
+ entity int DEFAULT 1,
+ note_private text,
+ date_creation datetime NOT NULL,
+ tms timestamp,
+ fk_user_creat integer NOT NULL,
+ fk_user_modif integer,
+ import_key varchar(14),
+ status smallint NOT NULL,
+ nb_operators_required integer,
+ thm_operator_estimated double,
+ thm_machine_estimated double
+ -- END MODULEBUILDER FIELDS
+) ENGINE=innodb;
+
+ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_rowid (rowid);
+ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_ref (ref);
+ALTER TABLE llx_workstation_workstation ADD CONSTRAINT llx_workstation_workstation_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
+ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_status (status);
+
+CREATE TABLE llx_workstation_workstation_resource(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ tms timestamp,
+ fk_resource integer,
+ fk_workstation integer
+) ENGINE=innodb;
+
+CREATE TABLE llx_workstation_workstation_usergroup(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ tms timestamp,
+ fk_usergroup integer,
+ fk_workstation integer
+) ENGINE=innodb;
+
diff --git a/htdocs/install/mysql/tables/llx_workstation_workstation.key.sql b/htdocs/install/mysql/tables/llx_workstation_workstation.key.sql
new file mode 100755
index 00000000000..2e013ee0128
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_workstation_workstation.key.sql
@@ -0,0 +1,27 @@
+-- Copyright (C) ---Put here your own copyright and developer email---
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+
+
+-- BEGIN MODULEBUILDER INDEXES
+ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_rowid (rowid);
+ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_ref (ref);
+ALTER TABLE llx_workstation_workstation ADD CONSTRAINT llx_workstation_workstation_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
+ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_status (status);
+-- END MODULEBUILDER INDEXES
+
+--ALTER TABLE llx_workstation_workstation ADD UNIQUE INDEX uk_workstation_workstation_fieldxy(fieldx, fieldy);
+
+--ALTER TABLE llx_workstation_workstation ADD CONSTRAINT llx_workstation_workstation_fk_field FOREIGN KEY (fk_field) REFERENCES llx_workstation_myotherobject(rowid);
+
diff --git a/htdocs/install/mysql/tables/llx_workstation_workstation.sql b/htdocs/install/mysql/tables/llx_workstation_workstation.sql
new file mode 100755
index 00000000000..5c141ed59df
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_workstation_workstation.sql
@@ -0,0 +1,36 @@
+-- Copyright (C) ---Put here your own copyright and developer email---
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+
+
+CREATE TABLE llx_workstation_workstation(
+ -- BEGIN MODULEBUILDER FIELDS
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ ref varchar(128) DEFAULT '(PROV)' NOT NULL,
+ label varchar(255),
+ type varchar(7),
+ note_public text,
+ entity int DEFAULT 1,
+ note_private text,
+ date_creation datetime NOT NULL,
+ tms timestamp,
+ fk_user_creat integer NOT NULL,
+ fk_user_modif integer,
+ import_key varchar(14),
+ status smallint NOT NULL,
+ nb_operators_required integer,
+ thm_operator_estimated double,
+ thm_machine_estimated double
+ -- END MODULEBUILDER FIELDS
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_workstation_workstation_resource.sql b/htdocs/install/mysql/tables/llx_workstation_workstation_resource.sql
new file mode 100755
index 00000000000..1ab019f4385
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_workstation_workstation_resource.sql
@@ -0,0 +1,22 @@
+-- Copyright (C) ---Put here your own copyright and developer email---
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+
+
+CREATE TABLE llx_workstation_workstation_resource(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ tms timestamp,
+ fk_resource integer,
+ fk_workstation integer
+) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_workstation_workstation_user_group.sql b/htdocs/install/mysql/tables/llx_workstation_workstation_user_group.sql
new file mode 100755
index 00000000000..9bffb4f30c9
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_workstation_workstation_user_group.sql
@@ -0,0 +1,22 @@
+-- Copyright (C) ---Put here your own copyright and developer email---
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+
+
+CREATE TABLE llx_workstation_workstation_usergroup(
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ tms timestamp,
+ fk_usergroup integer,
+ fk_workstation integer
+) ENGINE=innodb;
diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang
index 902f167d819..ec999a473a4 100644
--- a/htdocs/langs/en_US/mrp.lang
+++ b/htdocs/langs/en_US/mrp.lang
@@ -77,4 +77,28 @@ UnitCost=Unit cost
TotalCost=Total cost
BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price)
GoOnTabProductionToProduceFirst=You must first have started the production to close a Manufacturing Order (See tab '%s'). But you can Cancel it.
-ErrorAVirtualProductCantBeUsedIntoABomOrMo=A kit can't be used into a BOM or a MO
\ No newline at end of file
+ErrorAVirtualProductCantBeUsedIntoABomOrMo=A kit can't be used into a BOM or a MO
+Workstation=Workstation
+Workstations=Workstations
+WorkstationsDescription=Workstations management
+WorkstationSetup = Workstations setup
+WorkstationSetupPage = Workstations setup page
+WorkstationAbout = About Workstation
+WorkstationAboutPage = Workstations about page
+WorkstationList=Workstation list
+WorkstationCreate=Add new workstation
+ConfirmEnableWorkstation=Are you sure you want to enable workstation %s ?
+EnableAWorkstation=Enable a workstation
+ConfirmDisableWorkstation=Are you sure you want to disable workstation %s ?
+DisableAWorkstation=Disable a workstation
+DeleteWorkstation=Supprimer
+NbOperatorsRequired=Number of operators required
+THMOperatorEstimated=Estimated operator THM
+THMMachineEstimated=Estimated machine THM
+WorkstationType=Workstation type
+Human=Human
+Machine=Machine
+HumanMachine=Human / Machine
+WorkstationArea=Workstation area
+Machines=Machines
+THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item
diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php
index 0b6239b01e4..46085c126e0 100644
--- a/htdocs/resource/class/html.formresource.class.php
+++ b/htdocs/resource/class/html.formresource.class.php
@@ -77,7 +77,7 @@ class FormResource
* @param string $morecss More css
* @return string HTML string with
*/
- public function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20, $morecss = '')
+ public function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20, $morecss = '', $multiple=false)
{
// phpcs:enable
global $conf, $user, $langs;
@@ -89,6 +89,8 @@ class FormResource
$resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, 0, $filter);
+ if (!is_array($selected)) $selected = array($selected);
+
if ($outputmode != 2)
{
$out = ' |