From 655056ed31eb4270fceceffea8b1366a5cc033f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Apr 2021 12:10:55 +0200 Subject: [PATCH] Debug v14 --- htdocs/admin/workstation.php | 26 ++++++------- htdocs/bom/class/bom.class.php | 4 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/bank/class/account.class.php | 2 +- .../bank/class/paymentvarious.class.php | 2 +- .../cashcontrol/class/cashcontrol.class.php | 2 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/core/class/commonobject.class.php | 8 ++-- htdocs/core/class/defaultvalues.class.php | 2 +- .../core/class/emailsenderprofile.class.php | 2 +- htdocs/core/lib/security.lib.php | 1 + .../workstation/mod_workstation_standard.php | 28 ++++++------- .../class/emailcollector.class.php | 2 +- .../class/emailcollectoraction.class.php | 2 +- .../class/emailcollectorfilter.class.php | 2 +- .../class/conferenceorbooth.class.php | 2 +- .../class/conferenceorboothattendee.class.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + htdocs/modulebuilder/index.php | 2 +- .../template/class/myobject.class.php | 2 +- .../template/myobject_agenda.php | 13 ++++--- .../modulebuilder/template/myobject_card.php | 8 ++-- .../template/myobject_contact.php | 10 +++-- .../template/myobject_document.php | 12 +++--- .../modulebuilder/template/myobject_list.php | 16 ++++---- .../modulebuilder/template/myobject_note.php | 12 +++--- htdocs/mrp/class/mo.class.php | 2 +- .../partnership/class/partnership.class.php | 2 +- .../class/productfournisseurprice.class.php | 2 +- .../inventory/class/inventory.class.php | 2 +- .../product/stock/class/productlot.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- .../class/recruitmentcandidature.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- htdocs/website/class/websitepage.class.php | 2 +- .../workstation/class/workstation.class.php | 18 ++++----- htdocs/workstation/lib/workstation.lib.php | 2 +- .../lib/workstation_workstation.lib.php | 6 +-- htdocs/workstation/workstation_agenda.php | 5 ++- htdocs/workstation/workstation_card.php | 34 ++++++++-------- htdocs/workstation/workstation_document.php | 5 ++- htdocs/workstation/workstation_list.php | 39 +++++++------------ htdocs/workstation/workstation_note.php | 3 +- htdocs/zapier/class/hook.class.php | 2 +- 50 files changed, 156 insertions(+), 155 deletions(-) diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index c0b4055ba5b..1157000fd6b 100755 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -33,11 +33,6 @@ require_once DOL_DOCUMENT_ROOT . '/workstation/lib/workstation.lib.php'; // Translations $langs->loadLangs(array("admin", "workstation")); -// Access control -if (!$user->admin) { - accessforbidden(); -} - // Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -52,14 +47,19 @@ $value = GETPOST('value', 'alpha'); $error = 0; $setupnotempty = 0; +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + +// Access control +if (!$user->admin) { + accessforbidden(); +} + /* * Actions */ -if ((float) DOL_VERSION >= 6) { - include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -} +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { $maskconstorder = GETPOST('maskconstWorkstation', 'alpha'); @@ -157,19 +157,19 @@ if ($action == 'updateMask') { $form = new Form($db); -$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - +$help_url = ''; $page_name = "WorkstationSetup"; -llxHeader('', $langs->trans($page_name)); + +llxHeader('', $langs->trans($page_name), $help_url); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans($page_name), $linkback, 'object_workstation@workstation'); +print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); // Configuration header $head = workstationAdminPrepareHead(); -print dol_get_fiche_head($head, 'settings', '', -1, "workstation@workstation"); +print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "workstation"); // Setup page goes here //echo ''.$langs->trans("WorkstationSetupPage").'

'; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 47246b8423d..b6ca36b6b42 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -81,7 +81,7 @@ class BOM extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * @@ -1117,7 +1117,7 @@ class BOMLine extends CommonObjectLine * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ // BEGIN MODULEBUILDER PROPERTIES diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 441020c9b5d..c544f5f7fe9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -269,7 +269,7 @@ class Propal extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 074e3a6d67b..faf10596d8c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -280,7 +280,7 @@ class Commande extends CommonOrder * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 5a00e93e83f..4e0faea04cb 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -247,7 +247,7 @@ class Account extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index d9d50d74421..cdb2c0596f5 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -144,7 +144,7 @@ class PaymentVarious extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index cfd201e3ec4..a59816eebd7 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -73,7 +73,7 @@ class CashControl extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 367523084e2..286b5a1ccea 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -154,7 +154,7 @@ class FactureRec extends CommonInvoice * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ac9a6c505d7..172788c8517 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -279,7 +279,7 @@ class Facture extends CommonInvoice * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 5befcba4537..78e4ffae99b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -78,7 +78,7 @@ class Contact extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 3bfe1a2315e..186e4ee5761 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -206,7 +206,7 @@ class Contrat extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f24b864dfa8..c46da48b858 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6419,14 +6419,16 @@ abstract class CommonObject } elseif (preg_match('/varchar/', $val['type'])) { $param['options'] = array(); $type = 'varchar'; - } elseif (is_array($this->fields[$key]['arrayofkeyval'])) { - $param['options'] = $this->fields[$key]['arrayofkeyval']; - $type = 'select'; } else { $param['options'] = array(); $type = $this->fields[$key]['type']; } + // Special case that force options and type ($type can be integer, varchar, ...) + if (is_array($this->fields[$key]['arrayofkeyval'])) { + $param['options'] = $this->fields[$key]['arrayofkeyval']; + $type = 'select'; + } $label = $this->fields[$key]['label']; //$elementtype=$this->fields[$key]['elementtype']; // Seems not used diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index c6be235b89a..5b49254b275 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -77,7 +77,7 @@ class DefaultValues extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 7b9ee37225e..bea56d0701b 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -80,7 +80,7 @@ class EmailSenderProfile extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index e1df5da4dfb..ca689732e8b 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -526,6 +526,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (!empty($objectid) && $objectid > 0) { $ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select, $parentfortableentity); $params = array('objectid' => $objectid, 'features' => join(',', $featuresarray), 'features2' => $feature2); + //print 'checkUserAccessToObject ok='.$ok; return $ok ? 1 : accessforbidden('', 1, 1, 0, $params); } diff --git a/htdocs/core/modules/workstation/mod_workstation_standard.php b/htdocs/core/modules/workstation/mod_workstation_standard.php index 34e727dd272..7bef21a8599 100755 --- a/htdocs/core/modules/workstation/mod_workstation_standard.php +++ b/htdocs/core/modules/workstation/mod_workstation_standard.php @@ -36,7 +36,7 @@ class mod_workstation_standard extends ModeleNumRefWorkstation */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' - public $prefix = 'WORKSTATION'; + public $prefix = 'WKSTATION'; /** * @var string Error code (or message) @@ -57,7 +57,7 @@ class mod_workstation_standard extends ModeleNumRefWorkstation public function info() { global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + return $langs->trans("SimpleNumRefNoDateModelDesc", $this->prefix); } @@ -68,7 +68,7 @@ class mod_workstation_standard extends ModeleNumRefWorkstation */ public function getExample() { - return $this->prefix."0501-0001"; + return $this->prefix."-0001"; } @@ -83,13 +83,12 @@ class mod_workstation_standard extends ModeleNumRefWorkstation { global $conf, $langs, $db; - $coyymm = ''; $max = ''; - $posindice = strlen($this->prefix) + 6; + $posindice = strlen($this->prefix) + 2; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."workstation_workstation"; - $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; } elseif ($object->ismultientitymanaged == 2) { @@ -100,15 +99,14 @@ class mod_workstation_standard extends ModeleNumRefWorkstation if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; } } - if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { + /*if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; - } + }*/ return true; } @@ -124,10 +122,10 @@ class mod_workstation_standard extends ModeleNumRefWorkstation global $db, $conf; // First we get the max value - $posindice = strlen($this->prefix) + 6; + $posindice = strlen($this->prefix) + 2; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."workstation_workstation"; - $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."-%'"; //$sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); @@ -143,17 +141,13 @@ class mod_workstation_standard extends ModeleNumRefWorkstation return -1; } - //$date=time(); - $date = dol_now(); - $yymm = strftime("%y%m", $date); - if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { $num = sprintf("%04s", $max + 1); } - dol_syslog("mod_workstation_standard::getNextValue return ".$this->prefix.$yymm."-".$num); - return $this->prefix.$yymm."-".$num; + dol_syslog("mod_workstation_standard::getNextValue return ".$this->prefix."-".$num); + return $this->prefix."-".$num; } } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 9bff240c3ac..6643d95a4ab 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -89,7 +89,7 @@ class EmailCollector extends CommonObject * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ // BEGIN MODULEBUILDER PROPERTIES diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 10fe00a816d..bd044f37d0f 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -74,7 +74,7 @@ class EmailCollectorAction extends CommonObject * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ // BEGIN MODULEBUILDER PROPERTIES diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 736aeda47f4..d926a8bf14f 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -74,7 +74,7 @@ class EmailCollectorFilter extends CommonObject * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ // BEGIN MODULEBUILDER PROPERTIES diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 41fe4ebd94d..6c68cd827e7 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -91,7 +91,7 @@ class ConferenceOrBooth extends ActionComm * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 6418d73580b..d84a3785a75 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -88,7 +88,7 @@ class ConferenceOrBoothAttendee extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6a11c26c50c..e5803332b9b 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1254,6 +1254,7 @@ YouMustRunCommandFromCommandLineAfterLoginToUser=You must run this command from YourPHPDoesNotHaveSSLSupport=SSL functions not available in your PHP DownloadMoreSkins=More skins to download SimpleNumRefModelDesc=Returns the reference number in the format %syymm-nnnn where yy is the year, mm is the month and nnnn is a sequential auto-incrementing number with no reset +SimpleNumRefNoDateModelDesc=Returns the reference number in the format %s-nnnn where nnnn is a sequential auto-incrementing number with no reset ShowProfIdInAddress=Show professional id with addresses ShowVATIntaInAddress=Hide intra-Community VAT number with addresses TranslationUncomplete=Partial translation diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index c4c0aceed3a..dc5a84071d7 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -783,7 +783,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ /*public $fields=array( diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2c96190e232..e69c5bc333d 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -88,7 +88,7 @@ class MyObject extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 51ce708b755..cc49275e5f8 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -132,13 +132,16 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id; } -// Security check - Protection if external user -// if ($user->socid > 0) accessforbidden(); -// if ($user->socid > 0) $socid = $user->socid; -// $result = restrictedArea($user, 'mymodule', $object->id); - $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php +// Security check (enable the most restrictive one) +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); +//if (empty($conf->mymodule->enabled)) accessforbidden(); +//if (!$permissiontoread) accessforbidden(); + /* * Actions diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index bc43961ec08..89c787e5a01 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -129,13 +129,13 @@ $permissionnote = $user->rights->mymodule->myobject->write; // Used by the inclu $permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1]; -// Security check - Protection if external user +// Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', $isdraft); +//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); //if (empty($conf->mymodule->enabled)) accessforbidden(); -//if (empty($permissiontoread)) accessforbidden(); +//if (!$permissiontoread) accessforbidden(); /* @@ -310,7 +310,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = myobjectPrepareHead($object); - print dol_get_fiche_head($head, 'card', '', -1, $object->picto); + print dol_get_fiche_head($head, 'card', $langs->trans("Workstation"), -1, $object->picto); $formconfirm = ''; diff --git a/htdocs/modulebuilder/template/myobject_contact.php b/htdocs/modulebuilder/template/myobject_contact.php index dfc3d26f447..171ef3aab1d 100644 --- a/htdocs/modulebuilder/template/myobject_contact.php +++ b/htdocs/modulebuilder/template/myobject_contact.php @@ -78,12 +78,16 @@ $extrafields->fetch_name_optionals_label($object->table_element); // 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 -// Security check - Protection if external user +$permission = $user->rights->mymodule->myobject->write; + +// Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; -//$result = restrictedArea($user, 'mymodule', $object->id); +//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); +//if (empty($conf->mymodule->enabled)) accessforbidden(); +//if (!$permissiontoread) accessforbidden(); -$permission = $user->rights->mymodule->myobject->write; /* * Add a new contact diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index d5340cd8eb7..8598cc3dd18 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -124,13 +124,15 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".get_exdir(0, 0, 0, 1, $object); } -// Security check - Protection if external user -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$result = restrictedArea($user, 'mymodule', $object->id); - $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php +// Security check (enable the most restrictive one) +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); +//if (empty($conf->mymodule->enabled)) accessforbidden(); +//if (!$permissiontoread) accessforbidden(); /* diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 29d940288b7..07a5cf4fa03 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -182,12 +182,14 @@ $permissiontodelete = $user->rights->mymodule->myobject->delete; if (empty($conf->mymodule->enabled)) { accessforbidden('Module not enabled'); } -$socid = 0; -if ($user->socid > 0) { // Protection if external user - //$socid = $user->socid; - accessforbidden(); -} -//$result = restrictedArea($user, 'mymodule'); + +// Security check (enable the most restrictive one) +if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) accessforbidden(); +//$socid = 0; if ($user->socid > 0) $socid = $user->socid; +//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); +//if (empty($conf->mymodule->enabled)) accessforbidden(); //if (!$permissiontoread) accessforbidden(); @@ -289,7 +291,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) { + if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { if ($search[$key] == '-1' || $search[$key] === '0') { $search[$key] = ''; } diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index 02a72fbb76c..f5fc29a2591 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -95,11 +95,6 @@ $hookmanager->initHooks(array('myobjectnote', 'globalcard')); // Note that conf- // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -// Security check - Protection if external user -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$result = restrictedArea($user, 'mymodule', $id); - // 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 if ($id > 0 || !empty($ref)) { @@ -109,6 +104,13 @@ if ($id > 0 || !empty($ref)) { $permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php +// Security check (enable the most restrictive one) +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); +//if (empty($conf->mymodule->enabled)) accessforbidden(); +//if (!$permissiontoread) accessforbidden(); /* diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index b357fd8a5b5..ea37715b4e5 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -85,7 +85,7 @@ class Mo extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 4be5256062b..1dab8890050 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -89,7 +89,7 @@ class Partnership extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 709afcb6d20..41e1d2d0f6b 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -81,7 +81,7 @@ class ProductFournisseurPrice extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index e872d7e353a..064be57091a 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -82,7 +82,7 @@ class Inventory extends CommonObject * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ // BEGIN MODULEBUILDER PROPERTIES diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index f05d6ebc168..5b516ec03d7 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -75,7 +75,7 @@ class Productlot extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 5032cc27a89..ca42e8a3fd1 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -211,7 +211,7 @@ class Project extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index db9c4eaaa4a..0069ce2d30f 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -91,7 +91,7 @@ class RecruitmentCandidature extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 68fb7a1fea6..86cd99e7180 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -87,7 +87,7 @@ class RecruitmentJobPosition extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 14ebede6b07..46b80e7f77e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -146,7 +146,7 @@ class Societe extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6d5f7022a41..6c883be6b1a 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -241,7 +241,7 @@ class Ticket extends CommonObject * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 2fd363c7965..ddfdea57ef2 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -138,7 +138,7 @@ class WebsitePage extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'comment' is not used. You can store here any text of your choice. It is not used by application. * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index b4364a2cc82..d81bab42eab 100755 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -87,7 +87,7 @@ class Workstation extends CommonObject * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. * @@ -102,7 +102,7 @@ class Workstation extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'showoncombobox'=>'1',), - 'type' => array('type'=>'select', 'label'=>'Type', 'enabled'=>'1', 'position'=>32, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('HUMAN'=>'Human', 'MACHINE'=>'Machine', 'BOTH'=>'HumanMachine'),), + 'type' => array('type'=>'varchar(8)', 'label'=>'Type', 'enabled'=>'1', 'position'=>32, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('HUMAN'=>'Human', 'MACHINE'=>'Machine', 'BOTH'=>'HumanMachine'),), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -230,7 +230,7 @@ class Workstation extends CommonObject $id = $this->createCommon($user, $notrigger); // Usergroups - $groups = GETPOST('groups'); + $groups = GETPOST('groups', 'array:int'); if (empty($groups)) { $groups = $this->usergroups; // createFromClone } @@ -245,7 +245,7 @@ class Workstation extends CommonObject } // Resources - $resources = GETPOST('resources'); + $resources = GETPOST('resources', 'array:int'); if (empty($resources)) { $resources = $this->resources; // createFromClone } @@ -486,7 +486,7 @@ class Workstation extends CommonObject { // Usergroups - $groups = GETPOST('groups'); + $groups = GETPOST('groups', 'array:int'); WorkstationUserGroup::deleteAllGroupsOfWorkstation($this->id); $this->usergroups=array(); @@ -499,7 +499,7 @@ class Workstation extends CommonObject } // Resources - $resources = GETPOST('resources'); + $resources = GETPOST('resources', 'array:int'); WorkstationResource::deleteAllResourcesOfWorkstation($this->id); $this->resources=array(); if (!empty($resources)) { @@ -849,7 +849,7 @@ class Workstation extends CommonObject // phpcs:enable if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; - //$langs->load("workstation@workstation"); + //$langs->load("workstation"); $this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled'); $this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled'); } @@ -948,7 +948,7 @@ class Workstation extends CommonObject public function getNextNumRef() { global $langs, $conf; - $langs->load("workstation@workstation"); + $langs->load("workstation"); if (empty($conf->global->WORKSTATION_WORKSTATION_ADDON)) { $conf->global->WORKSTATION_WORKSTATION_ADDON = 'mod_workstation_standard'; @@ -1013,7 +1013,7 @@ class Workstation extends CommonObject $result = 0; $includedocgeneration = 0; - $langs->load("workstation@workstation"); + $langs->load("workstation"); if (!dol_strlen($modele)) { $modele = 'standard_workstation'; diff --git a/htdocs/workstation/lib/workstation.lib.php b/htdocs/workstation/lib/workstation.lib.php index 18307d0cd3a..fc57575bcf9 100755 --- a/htdocs/workstation/lib/workstation.lib.php +++ b/htdocs/workstation/lib/workstation.lib.php @@ -30,7 +30,7 @@ function workstationAdminPrepareHead() { global $langs, $conf; - $langs->load("workstation@workstation"); + $langs->load("workstation"); $h = 0; $head = array(); diff --git a/htdocs/workstation/lib/workstation_workstation.lib.php b/htdocs/workstation/lib/workstation_workstation.lib.php index a0cd7736d88..3869d3f9f9c 100755 --- a/htdocs/workstation/lib/workstation_workstation.lib.php +++ b/htdocs/workstation/lib/workstation_workstation.lib.php @@ -31,7 +31,7 @@ function workstationPrepareHead($object) { global $db, $langs, $conf; - $langs->load("workstation@workstation"); + $langs->load("workstation"); $h = 0; $head = array(); @@ -84,9 +84,9 @@ function workstationPrepareHead($object) //$this->tabs = array( // 'entity:-tabname:Title:@workstation:/workstation/mypage.php?id=__ID__' //); // to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'workstation@workstation'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'workstation'); - complete_head_from_modules($conf, $langs, $object, $head, $h, 'workstation@workstation', 'remove'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'workstation', 'remove'); return $head; } diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index f33961d5768..682431d7c8a 100755 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.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'); @@ -85,7 +85,8 @@ if ($id > 0 || !empty($ref)) { $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php // 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); /* diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 8f351523ecb..673b1db935d 100755 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -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 ''; print ''; 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 ''; print ''; @@ -220,7 +221,7 @@ if ($action == 'create') { print ''; print ''; 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 ''; // Other attributes @@ -269,7 +270,7 @@ if (($id || $ref) && $action == 'edit') { print ''; print ''; 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 ''; print ''; @@ -277,7 +278,7 @@ if (($id || $ref) && $action == 'edit') { print ''; print ''; 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 ''; // Other attributes @@ -346,12 +347,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Thirdparty $morehtmlref.='
'.$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 .= '
'.$langs->trans('Project') . ' '; - if ($permissiontoadd) - { + if ($permissiontoadd) { //if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; $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 ''; print ''; diff --git a/htdocs/workstation/workstation_document.php b/htdocs/workstation/workstation_document.php index 2deb06579b8..b33be2818dc 100755 --- a/htdocs/workstation/workstation_document.php +++ b/htdocs/workstation/workstation_document.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation_workstation.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("workstation@workstation", "companies", "other", "mails")); +$langs->loadLangs(array("workstation", "companies", "other", "mails")); $action = GETPOST('action', 'aZ09'); @@ -77,7 +77,8 @@ if ($id > 0 || !empty($ref)) { $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php // 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); /* diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index c4141a7ac61..4ca96ec00ff 100755 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -71,6 +71,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { + reset($object->fields); // Reset is required to avoid key() to return null. $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. } if (!$sortorder) { @@ -91,8 +92,8 @@ foreach ($object->fields as $key => $val) { } } -$groups = GETPOST('groups'); -$resources = GETPOST('resources'); +$groups = GETPOST('groups', 'array:int'); +$resources = GETPOST('resources', 'array:int'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array(); @@ -145,7 +146,7 @@ $permissiontoadd = $user->rights->workstation->workstation->write; $permissiontodelete = $user->rights->workstation->workstation->delete; // Security check -restrictedArea($user, $object->element, 0, '', 'workstation'); +restrictedArea($user, $object->element, 0, $object->table_element, 'workstation'); /* @@ -219,7 +220,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : ''); } } // Add fields from hooks @@ -252,7 +253,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) { + if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { if ($search[$key] == '-1' || $search[$key] === '0') { $search[$key] = ''; } @@ -283,12 +284,12 @@ if ($search_all) { // usergroups if (!empty($groups)) { - $sql.= ' AND wug.fk_usergroup IN('.implode(',', $groups).')'; + $sql.= ' AND wug.fk_usergroup IN('.$db->sanitize(implode(',', $groups)).')'; } // resources if (!empty($resources)) { - $sql.= ' AND wr.fk_resource IN('.implode(',', $resources).')'; + $sql.= ' AND wr.fk_resource IN('.$db->sanitize(implode(',', $resources)).')'; } include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -306,11 +307,12 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); } // Add where from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; -$sql=preg_replace('/,\s*$/', '', $sql); +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql = preg_replace('/,\s*$/', '', $sql); $sql .= $db->order($sortfield, $sortorder); +//print $sql; // Count total nb of records $nbtotalofrecords = ''; @@ -353,21 +355,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/workstation/workstation_note.php b/htdocs/workstation/workstation_note.php index b49be96dafa..18fa87b5ea6 100755 --- a/htdocs/workstation/workstation_note.php +++ b/htdocs/workstation/workstation_note.php @@ -61,7 +61,8 @@ $permissionnote = $user->rights->workstation->workstation->write; // Used by the $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php // 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); /* diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index 5197296f659..9197942b5c0 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -76,7 +76,7 @@ class Hook extends CommonObject * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ /**