';
@@ -394,11 +387,11 @@ $db->close();
*/
function compareIdAsc(stdClass $a, stdClass $b)
{
- if ($a->id == $b->id) {
+ if ((int) $a->id == (int) $b->id) {
return 0;
}
- return $a->id > $b->id ? -1 : 1;
+ return ((int) $a->id < (int) $b->id) ? -1 : 1;
}
/**
@@ -410,11 +403,11 @@ function compareIdAsc(stdClass $a, stdClass $b)
*/
function compareIdDesc(stdClass $a, stdClass $b)
{
- if ($a->id == $b->id) {
+ if ((int) $a->id == (int) $b->id) {
return 0;
}
- return $b->id > $a->id ? -1 : 1;
+ return ((int) $b->id < (int) $a->id) ? -1 : 1;
}
/**
@@ -441,7 +434,7 @@ function comparePermissionIdsAsc(stdClass $a, stdClass $b)
return 0;
}
- return $a->permission[0] > $b->permission[0] ? -1 : 1;
+ return $a->permission[0] < $b->permission[0] ? -1 : 1;
}
/**
@@ -468,5 +461,5 @@ function comparePermissionIdsDesc(stdClass $a, stdClass $b)
return 0;
}
- return $a->permission[0] > $b->permission[0] ? 1 : -1;
+ return $b->permission[0] < $a->permission[0] ? -1 : 1;
}
diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php
index 16f95a5e926..9a90fa945bb 100644
--- a/htdocs/core/modules/modBlockedLog.class.php
+++ b/htdocs/core/modules/modBlockedLog.class.php
@@ -113,7 +113,7 @@ class modBlockedLog extends DolibarrModules
// -----------------
$this->rights = array(); // Permission array used by this module
- $r = 0;
+ $r = 1;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read archived events and fingerprints'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php
index 67a480dcc08..6b69c6b7af0 100644
--- a/htdocs/core/modules/modBom.class.php
+++ b/htdocs/core/modules/modBom.class.php
@@ -205,7 +205,7 @@ class modBom extends DolibarrModules
// Permissions provided by this module
$this->rights = array(); // Permission array used by this module
- $r = 0;
+ $r = 1;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read bom of Bom'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
diff --git a/htdocs/core/modules/modDebugBar.class.php b/htdocs/core/modules/modDebugBar.class.php
index 1b591f02da1..ae2bdcfffc8 100644
--- a/htdocs/core/modules/modDebugBar.class.php
+++ b/htdocs/core/modules/modDebugBar.class.php
@@ -79,7 +79,7 @@ class modDebugBar extends DolibarrModules
// Permissions
$this->rights = array();
- $this->rights[1][0] = 430; // id de la permission
+ $this->rights[1][0] = 431; // id de la permission
$this->rights[1][1] = 'Use Debug Bar'; // libelle de la permission
$this->rights[1][2] = 'u'; // type de la permission (deprecie a ce jour)
$this->rights[1][3] = 1; // La permission est-elle une permission par defaut
diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php
index 9ee0cb1b74f..3a81102f4bd 100644
--- a/htdocs/core/modules/modEventOrganization.class.php
+++ b/htdocs/core/modules/modEventOrganization.class.php
@@ -224,7 +224,8 @@ class modEventOrganization extends DolibarrModules
// Permissions provided by this module
$this->rights = array();
- $r = 0;
+ $r = 1;
+
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php
index 30aa547cb3a..b061e1b73a6 100644
--- a/htdocs/core/modules/modLoan.class.php
+++ b/htdocs/core/modules/modLoan.class.php
@@ -97,7 +97,7 @@ class modLoan extends DolibarrModules
$r = 0;
$r++;
- $this->rights[$r][0] = 520;
+ $this->rights[$r][0] = 521;
$this->rights[$r][1] = 'Read loans';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php
index 9d590631fe4..ad14724d154 100644
--- a/htdocs/core/modules/modMailing.class.php
+++ b/htdocs/core/modules/modMailing.class.php
@@ -48,7 +48,7 @@ class modMailing extends DolibarrModules
// It is used to group modules by family in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
- $this->module_position = '22';
+ $this->module_position = '23';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php
index 0a4a7592a20..eb3baae78cd 100644
--- a/htdocs/core/modules/modMrp.class.php
+++ b/htdocs/core/modules/modMrp.class.php
@@ -236,7 +236,7 @@ class modMrp extends DolibarrModules
// Permissions provided by this module
$this->rights = array();
- $r = 0;
+ $r = 1;
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php
index e124b8304f3..072e0607b60 100644
--- a/htdocs/core/modules/modNotification.class.php
+++ b/htdocs/core/modules/modNotification.class.php
@@ -45,7 +45,7 @@ class modNotification extends DolibarrModules
// It is used to group modules in module setup page
$this->family = "interface";
// Module position in the family on 2 digits ('01', '10', '20', ...)
- $this->module_position = '01';
+ $this->module_position = '22';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "EMail notifications (push) on business Dolibarr events";
diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php
index 4fe437700e4..ee87f4c57ba 100644
--- a/htdocs/core/modules/modReceiptPrinter.class.php
+++ b/htdocs/core/modules/modReceiptPrinter.class.php
@@ -95,7 +95,7 @@ class modReceiptPrinter extends DolibarrModules
// $this->rights[$r][5] Niveau 2 pour nommer permission dans code
$r++;
- $this->rights[$r][0] = 67000;
+ $this->rights[$r][0] = 67001;
$this->rights[$r][1] = 'ReceiptPrinter';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
diff --git a/htdocs/core/modules/modWorkstation.class.php b/htdocs/core/modules/modWorkstation.class.php
index 02f5e059297..84234a9f6a3 100755
--- a/htdocs/core/modules/modWorkstation.class.php
+++ b/htdocs/core/modules/modWorkstation.class.php
@@ -45,7 +45,7 @@ class modWorkstation extends DolibarrModules
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
- $this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
+ $this->numero = 690;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'workstation';
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
@@ -239,7 +239,7 @@ class modWorkstation extends DolibarrModules
// Permissions provided by this module
$this->rights = array();
- $r = 0;
+ $r = 1;
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
@@ -330,6 +330,7 @@ class modWorkstation extends DolibarrModules
// This is a Left menu entry
'type'=>'left',
'titre'=>$langs->trans('Workstations'),
+ 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
'mainmenu'=>'mrp',
'leftmenu'=>'workstation_workstation',
'url'=>'',
diff --git a/htdocs/core/modules/modZapier.class.php b/htdocs/core/modules/modZapier.class.php
index 5685a30c701..430622465ca 100644
--- a/htdocs/core/modules/modZapier.class.php
+++ b/htdocs/core/modules/modZapier.class.php
@@ -242,7 +242,7 @@ class modZapier extends DolibarrModules
// Permission array used by this module
$this->rights = array();
- $r = 0;
+ $r = 1;
// Permission id (must not be already used)
$this->rights[$r][0] = $this->numero + $r;
// Permission label
diff --git a/htdocs/theme/eldy/img/object_zapier.png b/htdocs/theme/eldy/img/object_zapier.png
index b1337750b67..b244cb1d5d6 100644
Binary files a/htdocs/theme/eldy/img/object_zapier.png and b/htdocs/theme/eldy/img/object_zapier.png differ
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index b3303492417..db9010cc504 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -673,8 +673,7 @@ class User extends CommonObject
if (!empty($rid)) {
$module = $perms = $subperms = '';
- // Si on a demande ajout d'un droit en particulier, on recupere
- // les caracteristiques (module, perms et subperms) de ce droit.
+ // Si on a demande ajout d'un droit en particulier, on recupere les caracteristiques (module, perms et subperms) de ce droit.
$sql = "SELECT module, perms, subperms";
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def";
$sql .= " WHERE id = ".((int) $rid);
@@ -718,7 +717,7 @@ class User extends CommonObject
}
}
- // Ajout des droits trouves grace au critere whereforadd
+ // Add automatically other permission using the criteria whereforadd
if (!empty($whereforadd)) {
//print "$module-$perms-$subperms";
$sql = "SELECT id";
diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php
index a3d536cee49..e80cb6c8462 100644
--- a/htdocs/user/perms.php
+++ b/htdocs/user/perms.php
@@ -105,7 +105,7 @@ if (empty($reshook)) {
setEventMessages($edituser->error, $edituser->errors, 'errors');
}
- // If we are changing our own permissions, we reload
+ // If we are changing our own permissions, we reload permissions and menu
if ($object->id == $user->id) {
$user->clearrights();
$user->getrights();
@@ -124,7 +124,7 @@ if (empty($reshook)) {
setEventMessages($edituser->error, $edituser->errors, 'errors');
}
- // If we are changing our own permissions, we reload
+ // If we are changing our own permissions, we reload permissions and menu
if ($object->id == $user->id) {
$user->clearrights();
$user->getrights();