From 9e8ed661b3205974722748a23e9629947be55b34 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 4 Apr 2021 08:06:59 +0200 Subject: [PATCH 01/18] FIX: Accountancy - Warning on the pages of the preparatory statements of accounting entries --- htdocs/accountancy/journal/bankjournal.php | 7 +++++-- htdocs/accountancy/journal/expensereportsjournal.php | 7 +++++-- htdocs/accountancy/journal/purchasesjournal.php | 8 +++++--- htdocs/accountancy/journal/sellsjournal.php | 8 +++++--- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 9878f67890c..27b37c74932 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -997,8 +997,11 @@ if (empty($action) || $action == 'view') { if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' || empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { - print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); - print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); + $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); + print $desc; + print '
'; } diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 2f7569ab152..2916d4d1fca 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -506,8 +506,11 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { - print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); - print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); + $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); + print $desc; + print '
'; } print '
'; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index f6fa5c4b76a..bf950182798 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -735,9 +735,11 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { - print '
'; - print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); - print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); + $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); + print $desc; + print '
'; } print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index e5f52cbc2ea..1904631775d 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -688,9 +688,11 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { - print '
'; - print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); - print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); + $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); + print $desc; + print '
'; } print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { From c254d7dded58f3b3506700b2fffd2c631aecca3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Apr 2021 13:42:58 +0200 Subject: [PATCH 02/18] css --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5c0ad2747ba..9e342b9b8d3 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1530,7 +1530,7 @@ if ($action == 'create') { print ''; if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) { print ''; - print ''; + print ''; print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow'); print ''; } From 3c637fa1adce5858efba3ecdcd8d2224079488be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Apr 2021 15:11:51 +0200 Subject: [PATCH 03/18] Install php-gd --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 733e997bdf3..07895934136 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,8 @@ addons: - libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader + # We need pgloader for import mysql database into pgsql + - php-gd env: global: From 1b62ab73d781bfa801a9251188649a2e63ae487c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Apr 2021 15:42:37 +0200 Subject: [PATCH 04/18] Test --- test/phpunit/ImagesLibTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index 5d956fcf3c7..4835a8afd76 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -163,9 +163,9 @@ class ImagesLibTest extends PHPUnit\Framework\TestCase global $conf; $file=dirname(__FILE__).'/img250x20.png'; - $filetarget=$conf->admin->dir_temp.'/img250x20.webp'; + $filetarget=$conf->admin->dir_temp.'/img250x20.jpg'; $result = dol_imageResizeOrCrop($file, 0, 0, 0, 0, 0, $filetarget); print __METHOD__." result=".$result."\n"; - $this->assertEquals($filetarget, $result, 'Failed to convert into webp'); + $this->assertEquals($filetarget, $result, 'Failed to convert into '.$filetarget); } } From 000510a562baeb66f11743896d97ae06571565c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Apr 2021 15:46:31 +0200 Subject: [PATCH 05/18] clean travis --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07895934136..733e997bdf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,6 @@ addons: - libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader - # We need pgloader for import mysql database into pgsql - - php-gd env: global: From 6fc19c626d161e6d35f35a9aaf6fe0049f4d271a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Apr 2021 17:05:01 +0200 Subject: [PATCH 06/18] Try fix for #17094 --- htdocs/comm/mailing/card.php | 10 +++++----- htdocs/core/lib/files.lib.php | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 00c5c946326..4958811ef4d 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -524,15 +524,15 @@ if (empty($reshook)) { } /* - * Add file in email form + * Action of adding a file in email form */ - if (!empty($_POST['addfile'])) { + if (GETPOST('addfile')) { $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Set tmp user directory - dol_add_file_process($upload_dir, 0, 0); + dol_add_file_process($upload_dir, 0, 0, 'addedfile', '', null, '', 0); $action = "edit"; } @@ -543,7 +543,7 @@ if (empty($reshook)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_remove_file_process($_POST['removedfile'], 0, 0); // We really delete file linked to mailing + dol_remove_file_process(GETPOST('removedfile'), 0, 0); // We really delete file linked to mailing $action = "edit"; } @@ -1216,7 +1216,7 @@ if ($action == 'create') { $out .= '
'; } } else { - $out .= $langs->trans("NoAttachedFiles").'
'; + $out .= ''.$langs->trans("NoAttachedFiles").'
'; } // Add link to add file $out .= ''; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 431cdffccf4..782b0ec4694 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1544,7 +1544,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess if (!empty($_FILES[$varfiles])) { // For view $_FILES[$varfiles]['error'] dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG); - if (dol_mkdir($upload_dir) >= 0) { + $result = dol_mkdir($upload_dir); + // var_dump($result);exit; + if ($result >= 0) { $TFile = $_FILES[$varfiles]; if (!is_array($TFile['name'])) { foreach ($TFile as $key => &$val) { @@ -1647,6 +1649,8 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess $res = 1; setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs'); } + } else { + setEventMessages($langs->trans("ErrorFailedToCreateDir", $upload_dir), null, 'errors'); } } elseif ($link) { require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; From fd82776f672037a03c6feb65132a3e9ce080a80a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Apr 2021 18:00:07 +0200 Subject: [PATCH 07/18] Fix --- htdocs/user/perms.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 48b44d2fc57..81d687cd13c 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -288,7 +288,7 @@ if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->ad } print ''.$langs->trans("Permissions").''; if ($user->admin) { - print ''.$langs->trans("ID").''; + print ''; } print ''."\n"; @@ -438,7 +438,11 @@ if ($result) { // Permission id if ($user->admin) { - print ''.$obj->id.''; + print ''; + $htmltext = $langs->trans("ID").': '.$obj->id; + print $form->textwithpicto('', $htmltext); + //print ''.$obj->id.''; + print ''; } print ''."\n"; From e048d734871770c61e308da94798d58e8e077666 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Apr 2021 11:18:24 +0200 Subject: [PATCH 08/18] Show text of permission in tooltip --- htdocs/user/perms.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 81d687cd13c..a3d536cee49 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -440,6 +440,7 @@ if ($result) { if ($user->admin) { print ''; $htmltext = $langs->trans("ID").': '.$obj->id; + $htmltext .= '
'.$langs->trans("Permission").': user->rights->'.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : ''); print $form->textwithpicto('', $htmltext); //print ''.$obj->id.''; print ''; From 7cba3f8a0a6ab91dd06ebc3babd72adbf67d2083 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Apr 2021 12:41:39 +0200 Subject: [PATCH 09/18] css --- htdocs/website/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3e4c56cd240..26ca6df9bf8 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -895,6 +895,7 @@ if ($action == 'addcontainer' && $usercanedit) { getAllImages($object, $objectpage, $urltograbbis, $tmpgeturl['content'], $action, 1, $grabimages, $grabimagesinto); + // We try to convert the CSS we got by adding a prefix .bodywebsite with lessc to avoid conflicit with CSS of Dolibarr. include_once DOL_DOCUMENT_ROOT.'/core/class/lessc.class.php'; $lesscobj = new Lessc(); try { From f03190e23b6e1c97614cb44484377edb7627b9b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Apr 2021 12:57:43 +0200 Subject: [PATCH 10/18] Fix permissions in module workstation --- htdocs/workstation/workstation_agenda.php | 8 +++----- htdocs/workstation/workstation_card.php | 13 +++---------- htdocs/workstation/workstation_document.php | 7 ++----- htdocs/workstation/workstation_list.php | 13 +------------ htdocs/workstation/workstation_note.php | 2 ++ 5 files changed, 11 insertions(+), 32 deletions(-) diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index 8096aa3d771..324e640702b 100755 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -82,13 +82,11 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->workstation->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, 'workstation', $object->id); - $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php +// Security check +restrictedArea($user, $object->element, $object->id); + /* * Actions diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index b64f15e1f76..5d0d92c7cb0 100755 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -82,15 +82,8 @@ $permissionnote = $user->rights->workstation->workstation->write; // Used by the $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 - Protection if external user -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); -//$result = restrictedArea($user, 'workstation', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); - -if (!$permissiontoread) { - accessforbidden(); -} +// Security check +restrictedArea($user, $object->element, $object->id); /* @@ -343,7 +336,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Object card // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; /* diff --git a/htdocs/workstation/workstation_document.php b/htdocs/workstation/workstation_document.php index 2c1a9906c8e..324546a9647 100755 --- a/htdocs/workstation/workstation_document.php +++ b/htdocs/workstation/workstation_document.php @@ -74,13 +74,10 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->workstation->multidir_output[$object->entity ? $object->entity : $conf->entity]."/workstation/".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, 'workstation', $object->id); - $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php +// Security check +restrictedArea($user, $object->element, $object->id); /* diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 59dbfc658d3..2d8b371cd52 100755 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -146,18 +146,7 @@ $permissiontoadd = $user->rights->workstation->workstation->write; $permissiontodelete = $user->rights->workstation->workstation->delete; // Security check -if (empty($conf->workstation->enabled)) { - accessforbidden('Module not enabled'); -} -$socid = 0; -if ($user->socid > 0) { - // Protection if external user - //$socid = $user->socid; - accessforbidden(); -} -//$result = restrictedArea($user, 'workstation', $id, ''); -//if (!$permissiontoread) accessforbidden(); - +restrictedArea($user, $object->element, 0); /* diff --git a/htdocs/workstation/workstation_note.php b/htdocs/workstation/workstation_note.php index f2fa055102a..ddafd1136fe 100755 --- a/htdocs/workstation/workstation_note.php +++ b/htdocs/workstation/workstation_note.php @@ -60,6 +60,8 @@ if ($id > 0 || !empty($ref)) { $permissionnote = $user->rights->workstation->workstation->write; // Used by the include of actions_setnotes.inc.php $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php +// Security check +restrictedArea($user, $object->element, $object->id); /* From 6c521073ea9215fb7baddca5e48345b20b1ab5a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Apr 2021 13:52:19 +0200 Subject: [PATCH 11/18] Fix perm id and sort of modules by id. --- htdocs/admin/system/modules.php | 71 ++++++++---------- htdocs/core/modules/modBlockedLog.class.php | 2 +- htdocs/core/modules/modBom.class.php | 2 +- htdocs/core/modules/modDebugBar.class.php | 2 +- .../modules/modEventOrganization.class.php | 3 +- htdocs/core/modules/modLoan.class.php | 2 +- htdocs/core/modules/modMailing.class.php | 2 +- htdocs/core/modules/modMrp.class.php | 2 +- htdocs/core/modules/modNotification.class.php | 2 +- .../core/modules/modReceiptPrinter.class.php | 2 +- htdocs/core/modules/modWorkstation.class.php | 5 +- htdocs/core/modules/modZapier.class.php | 2 +- htdocs/theme/eldy/img/object_zapier.png | Bin 459 -> 3516 bytes htdocs/user/class/user.class.php | 5 +- htdocs/user/perms.php | 4 +- 15 files changed, 50 insertions(+), 56 deletions(-) diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index f9b8bdb65c8..51f3b4577cf 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -228,26 +228,26 @@ print ''; if ($arrayfields['name']['checked']) { print ''; - print ''; + print ''; print ''; } if ($arrayfields['version']['checked']) { print ''; - print ''; + print ''; print ''; } if ($arrayfields['id']['checked']) { print ''; - print ''; - print ''; -} -if ($arrayfields['module_position']['checked']) { - print ''; + print ''; print ''; } if ($arrayfields['permission']['checked']) { print ''; - print ''; + print ''; + print ''; +} +if ($arrayfields['module_position']['checked']) { + print ''; print ''; } @@ -267,14 +267,14 @@ if ($arrayfields['version']['checked']) { print_liste_field_titre($arrayfields['version']['label'], $_SERVER["PHP_SELF"], "version", "", "", "", $sortfield, $sortorder); } if ($arrayfields['id']['checked']) { - print_liste_field_titre($arrayfields['id']['label'], $_SERVER["PHP_SELF"], "id", "", "", "", $sortfield, $sortorder); -} -if ($arrayfields['module_position']['checked']) { - print_liste_field_titre($arrayfields['module_position']['label'], $_SERVER["PHP_SELF"], "module_position", "", "", "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['id']['label'], $_SERVER["PHP_SELF"], "id", "", "", "", $sortfield, $sortorder, 'nowraponall '); } if ($arrayfields['permission']['checked']) { print_liste_field_titre($arrayfields['permission']['label'], $_SERVER["PHP_SELF"], "permission", "", "", "", $sortfield, $sortorder); } +if ($arrayfields['module_position']['checked']) { + print_liste_field_titre($arrayfields['module_position']['label'], $_SERVER["PHP_SELF"], "module_position", "", "", "", $sortfield, $sortorder); +} // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); @@ -289,37 +289,30 @@ if ($sortfield == "name" && $sortorder == "asc") { usort($moduleList, function (stdClass $a, stdClass $b) { return strcasecmp($a->name, $b->name); }); -} -if ($sortfield == "name" && $sortorder == "desc") { +} elseif ($sortfield == "name" && $sortorder == "desc") { usort($moduleList, function (stdClass $a, stdClass $b) { return strcasecmp($b->name, $a->name); }); -} -if ($sortfield == "version" && $sortorder == "asc") { +} elseif ($sortfield == "version" && $sortorder == "asc") { usort($moduleList, function (stdClass $a, stdClass $b) { return strcasecmp($a->version, $b->version); }); -} -if ($sortfield == "version" && $sortorder == "desc") { +} elseif ($sortfield == "version" && $sortorder == "desc") { usort($moduleList, function (stdClass $a, stdClass $b) { return strcasecmp($b->version, $a->version); }); -} -if ($sortfield == "id" && $sortorder == "asc") { +} elseif ($sortfield == "id" && $sortorder == "asc") { usort($moduleList, "compareIdAsc"); -} -if ($sortfield == "id" && $sortorder == "desc") { +} elseif ($sortfield == "id" && $sortorder == "desc") { usort($moduleList, "compareIdDesc"); -} -if ($sortfield == "permission" && $sortorder == "asc") { +} elseif ($sortfield == "permission" && $sortorder == "asc") { usort($moduleList, "comparePermissionIdsAsc"); -} -if ($sortfield == "permission" && $sortorder == "desc") { +} elseif ($sortfield == "permission" && $sortorder == "desc") { usort($moduleList, "comparePermissionIdsDesc"); +} else { + $moduleList = dol_sort_array($moduleList, 'module_position'); } -$moduleList = dol_sort_array($moduleList, 'module_position'); - foreach ($moduleList as $module) { print ''; @@ -338,10 +331,6 @@ foreach ($moduleList as $module) { print ''.$module->id.''; } - if ($arrayfields['module_position']['checked']) { - print ''.$module->module_position.''; - } - if ($arrayfields['permission']['checked']) { $idperms = ''; @@ -357,7 +346,11 @@ foreach ($moduleList as $module) { } } - print ''.($idperms ? $idperms : " ").''; + print ''.($idperms ? $idperms : " ").''; + } + + if ($arrayfields['module_position']['checked']) { + print ''.$module->module_position.''; } print ''; @@ -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 b1337750b6732d01fcc1b04daab1612b71e20c85..b244cb1d5d675f0ae90fbe86e9b637842c15b961 100644 GIT binary patch delta 3352 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, $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(); From 685c880e6cd36568f47d16eca15fc413d2c67a85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Apr 2021 14:56:47 +0200 Subject: [PATCH 12/18] Debug module workstation --- htdocs/core/lib/functions.lib.php | 10 +- htdocs/core/modules/modWorkstation.class.php | 4 +- htdocs/install/upgrade2.php | 2 + .../workstation/class/workstation.class.php | 4 +- htdocs/workstation/workstation_agenda.php | 2 +- htdocs/workstation/workstation_card.php | 6 +- htdocs/workstation/workstation_document.php | 2 +- htdocs/workstation/workstation_list.php | 91 +++++++++++-------- htdocs/workstation/workstation_note.php | 2 +- 9 files changed, 71 insertions(+), 52 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d22aa0d40e2..3cca19ba0ff 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3525,7 +3525,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'object_recruitmentjobposition', 'object_recruitmentcandidature', 'object_salary', 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', - 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_movement', + 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_movement', 'object_workstation', 'off', 'on', 'order', 'paiment', 'play', 'pdf', 'phone', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'stock', 'resize', 'service', 'stats', 'trip', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', @@ -3537,7 +3537,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', - 'user-cog', 'website', + 'user-cog', 'website', 'workstation', 'conferenceorbooth', 'eventorganization' ))) { $pictowithouttext = str_replace('object_', '', $pictowithouttext); @@ -3585,7 +3585,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'title_agenda'=>'calendar-alt', 'uparrow'=>'share', 'vcard'=>'address-card', 'jabber'=>'comment-o', - 'website'=>'globe-americas', + 'website'=>'globe-americas', 'workstation'=>'pallet', 'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram' ); if ($pictowithouttext == 'off') { @@ -3619,7 +3619,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (in_array($pictowithouttext, array('dollyrevert', 'member', 'members', 'contract', 'group', 'resource', 'shipment'))) { $morecss = 'em092'; } - if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'project'))) { + if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'project', 'workstation'))) { $morecss = 'em088'; } if (in_array($pictowithouttext, array('intervention', 'info', 'payment', 'loan', 'stock', 'technic'))) { @@ -3676,7 +3676,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'other'=>'#ddd', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba', 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', - 'website'=>'#304' + 'website'=>'#304', 'workstation'=>'#a69944' ); if (isset($arrayconvpictotocolor[$pictowithouttext])) { $facolor = $arrayconvpictotocolor[$pictowithouttext]; diff --git a/htdocs/core/modules/modWorkstation.class.php b/htdocs/core/modules/modWorkstation.class.php index 84234a9f6a3..b0fae39bb52 100755 --- a/htdocs/core/modules/modWorkstation.class.php +++ b/htdocs/core/modules/modWorkstation.class.php @@ -50,7 +50,7 @@ class modWorkstation extends DolibarrModules $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','...' // It is used to group modules by family in module setup page - $this->family = "other"; + $this->family = "products"; // Module position in the family on 2 digits ('01', '10', '20', ...) $this->module_position = '90'; // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) @@ -71,7 +71,7 @@ class modWorkstation extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto = 'mrp'; + $this->picto = 'workstation'; // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( // Set this to 1 if module has its own trigger directory (core/triggers) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 32959af80cc..0db923b138f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -456,6 +456,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $listofmodule = array( 'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly', 'MAIN_MODULE_AGENDA'=>'newboxdefonly', + 'MAIN_MODULE_BOM'=>'menuonly', 'MAIN_MODULE_BANQUE'=>'menuonly', 'MAIN_MODULE_BARCODE'=>'newboxdefonly', 'MAIN_MODULE_CRON'=>'newboxdefonly', @@ -470,6 +471,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ 'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly', 'MAIN_MODULE_HOLIDAY'=>'newboxdefonly', 'MAIN_MODULE_MARGIN'=>'menuonly', + 'MAIN_MODULE_MRP'=>'menuonly', 'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly', 'MAIN_MODULE_PAYBOX'=>'newboxdefonly', 'MAIN_MODULE_PRINTING'=>'newboxdefonly', diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 07edb353aa4..b4364a2cc82 100755 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -61,7 +61,7 @@ class Workstation extends CommonObject /** * @var string String with name of icon for workstation. Must be the part after the 'object_' into object_workstation.png */ - public $picto = 'mrp'; + public $picto = 'workstation'; const STATUS_DISABLED = 0; @@ -100,7 +100,7 @@ class Workstation extends CommonObject */ public $fields=array( '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)', 'picto'=>'mrp', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), + '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'),), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index 324e640702b..420bf8b9051 100755 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -85,7 +85,7 @@ 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); +restrictedArea($user, $object->element, $object->id, '', 'workstation'); /* diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 5d0d92c7cb0..8f351523ecb 100755 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -83,7 +83,7 @@ $permissiondellink = $user->rights->workstation->workstation->write; // Used by $upload_dir = $conf->workstation->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check -restrictedArea($user, $object->element, $object->id); +restrictedArea($user, $object->element, $object->id, '', 'workstation'); /* @@ -212,7 +212,7 @@ if ($action == 'create') { print ''; print ''; print img_picto('', 'group'); - print $form->select_dolgroups($groups, 'groups', 1, '', 0, '', '', $object->entity, true); + print $form->select_dolgroups($groups, 'groups', 1, '', 0, '', '', $object->entity, true, 'minwidth200'); print ''; print ''; @@ -220,7 +220,7 @@ if ($action == 'create') { print ''; print ''; print img_picto('', 'resource'); - print $formresource->select_resource_list($resources, 'resources', '', '', 0, '', '', $object->entity, true, 0, '', true); + print $formresource->select_resource_list($resources, 'resources', '', '', 0, '', '', $object->entity, true, 0, 'minwidth200', true); print ''; // Other attributes diff --git a/htdocs/workstation/workstation_document.php b/htdocs/workstation/workstation_document.php index 324546a9647..2deb06579b8 100755 --- a/htdocs/workstation/workstation_document.php +++ b/htdocs/workstation/workstation_document.php @@ -77,7 +77,7 @@ 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); +restrictedArea($user, $object->element, $object->id, '', 'workstation'); /* diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 2d8b371cd52..40265496dbf 100755 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -28,9 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; - -// load workstation libraries -require_once __DIR__.'/class/workstation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; // Load translation files required by the page $langs->loadLangs(array("workstation", "other")); @@ -87,8 +85,9 @@ foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { $search[$key] = GETPOST('search_'.$key, 'alpha'); } - if (in_array($key, array('type', 'status')) && GETPOST('search_'.$key, 'alpha') == -1) { - $search[$key] = ''; + if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { + $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int')); + $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int')); } } @@ -108,7 +107,7 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = dol_eval($val['visible'], 1); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), @@ -146,7 +145,7 @@ $permissiontoadd = $user->rights->workstation->workstation->write; $permissiontodelete = $user->rights->workstation->workstation->delete; // Security check -restrictedArea($user, $object->element, 0); +restrictedArea($user, $object->element, 0, '', 'workstation'); /* @@ -154,7 +153,8 @@ restrictedArea($user, $object->element, 0); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -174,6 +174,10 @@ if (empty($reshook)) { if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers foreach ($object->fields as $key => $val) { $search[$key] = ''; + if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { + $search[$key.'_dtstart'] = ''; + $search[$key.'_dtend'] = ''; + } } $groups=$resources=array(); $toselect = ''; @@ -203,19 +207,15 @@ $formresource = new FormResource($db); $now = dol_now(); $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Workstations")); - -//$help_url="EN:Module_Workstation|FR:Module_Workstation_FR|ES:Módulo_Workstation"; $help_url = 'EN:Module_Workstation'; - -llxHeader('', $title, $help_url); +$morejs = array(); +$morecss = array(); // Build and execute select // -------------------------------------------------------------------- $sql = 'SELECT '; -foreach ($object->fields as $key => $val) { - $sql .= 't.'.$key.', '; -} +$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) { @@ -247,18 +247,32 @@ if ($object->ismultientitymanaged == 1) { $sql .= " WHERE 1 = 1"; } foreach ($search as $key => $val) { - if ($key == 'status' && $search[$key] == -1) { - continue; - } - $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if (strpos($object->fields[$key]['type'], 'integer:') === 0) { - if ($search[$key] == '-1') { - $search[$key] = ''; + if (array_key_exists($key, $object->fields)) { + if ($key == 'status' && $search[$key] == -1) { + 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 ($search[$key] == '-1' || $search[$key] === '0') { + $search[$key] = ''; + } + $mode_search = 2; + } + if ($search[$key] != '') { + $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + } + } else { + if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { + $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); + if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { + if (preg_match('/_dtstart$/', $key)) { + $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + } + if (preg_match('/_dtend$/', $key)) { + $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + } + } } - $mode_search = 2; - } - if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); } } if ($search_all) { @@ -283,10 +297,8 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -/* If a group by is required $sql.= " GROUP BY "; -foreach($object->fields as $key => $val) -{ +foreach ($object->fields as $key => $val) { $sql.='t.'.$key.', '; } // Add fields from extrafields @@ -295,11 +307,9 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) { } // Add where from hooks $parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters, $object); // Note that $action and $object may have been modified by hook +$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.= ' GROUP BY t.rowid'; +$sql=preg_replace('/,\s*$/', '', $sql); $sql .= $db->order($sortfield, $sortorder); // Count total nb of records @@ -341,7 +351,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ // Output page // -------------------------------------------------------------------- -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); // Example : Adding jquery code print '