From 255d8ba7537d5920834533348a92313be0eddda0 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 18 Jan 2022 10:59:10 +0100 Subject: [PATCH 1/7] FIX : rankorder + vacant positions --- htdocs/hrm/class/position.class.php | 2 +- htdocs/hrm/skill_card.php | 6 +++--- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 26298c31aa7..bd31311f4bf 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -109,7 +109,7 @@ class Position extends CommonObject 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), - 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1,), + 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>1,), 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 6fa601249db..a06cf40952a 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -264,7 +264,7 @@ if (($id || $ref) && $action == 'edit') { if (is_array($SkilldetRecords) && count($SkilldetRecords) > 0) { print ''; foreach ($SkilldetRecords as $sk) { - if ($sk->rank > $MaxNumberSkill) { + if ($sk->rankorder > $MaxNumberSkill) { continue; } @@ -291,7 +291,7 @@ if (($id || $ref) && $action == 'edit') { // if (!empty($val['help'])) { // print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); // } else { - print $langs->trans($val['label']).' '.$langs->trans('rank').' '.$sk->rank; + print $langs->trans($val['label']).' '.$langs->trans('rank').' '.$sk->rankorder; // } print ''; print '
'; @@ -696,7 +696,7 @@ if ($action != "create" && $action != "edit") { break; // Should not happen } - if ($obj->rank > $MaxNumberSkill) { + if ($obj->rankorder > $MaxNumberSkill) { continue; } diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index e60208cf56d..ae5625cabbb 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -289,7 +289,7 @@ CREATE TABLE llx_hrm_job_user( date_creation datetime NOT NULL, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_contrat integer, - fk_user integer NOT NULL, + fk_user integer, fk_job integer NOT NULL, date_start date, date_end date, diff --git a/htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql b/htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql index 33906d1607f..4e10bf64bf8 100644 --- a/htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql +++ b/htdocs/install/mysql/tables/llx_hrm_job_user-hrm.sql @@ -23,7 +23,7 @@ CREATE TABLE llx_hrm_job_user( date_creation datetime NOT NULL, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_contrat integer, - fk_user integer NOT NULL, + fk_user integer, fk_job integer NOT NULL, date_start datetime, date_end datetime, From 0e8b7ef656eb8259757c38b87ba006cb5bc1379a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jan 2022 16:38:25 +0100 Subject: [PATCH 2/7] Clean code --- htdocs/core/lib/sendings.lib.php | 2 +- htdocs/core/tpl/commonfields_view.tpl.php | 48 +++++++++++++---------- htdocs/delivery/card.php | 4 +- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 0814c0f4825..e2ab74b8cfc 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -180,7 +180,7 @@ function delivery_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($tmpobject->ref); + $upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $tmpobject->element, $tmpobject->id); $head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$tmpobject->id; diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 29bf3943cea..42ead1573f4 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -110,11 +110,9 @@ print '
'; // We close div and reopen for second column print ''; -print '
'; -print '
'; -print ''; +$rightpart = ''; $alreadyoutput = 1; foreach ($object->fields as $key => $val) { if ($alreadyoutput) { @@ -139,38 +137,46 @@ foreach ($object->fields as $key => $val) { $value = $object->$key; - print ' 0) $rightpart .= ' fieldrequired'; // No fieldrequired inthe view output if ($val['type'] == 'text' || $val['type'] == 'html') { - print ' tdtop'; + $rightpart .= ' tdtop'; } - print '">'; + $rightpart.= '">'; if (!empty($val['help'])) { - print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); + $rightpart .= $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); } else { - print $langs->trans($val['label']); + $rightpart .= $langs->trans($val['label']); } - print ''; - print ''; - print ''; + $rightpart .= ''; + $rightpart .= ''; } + +print '
'; +print '
'; + +print '
'; + $rightpart .= '">'; if (in_array($val['type'], array('text', 'html'))) { - print '
'; + $rightpart .= '
'; } - print $object->showOutputField($val, $key, $value, '', '', '', 0); - //print dol_escape_htmltag($object->$key, 1, 1); + $rightpart .= $object->showOutputField($val, $key, $value, '', '', '', 0); + //$rightpart .= dol_escape_htmltag($object->$key, 1, 1); if (in_array($val['type'], array('text', 'html'))) { - print '
'; + $rightpart .= '
'; } - print '
'; + +print $rightpart; + ?> diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 62955da7f06..00975946f6b 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -101,7 +101,7 @@ if ($action == 'add') { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled)) { - $expedition->entrepot_id = GETPOST('entrepot_id'); + $expedition->entrepot_id = GETPOST('entrepot_id', 'int'); } // We loop on each line of order to complete object delivery with qty to delivery @@ -282,7 +282,7 @@ if ($action == 'create') { // Create. Seems to no be used print ''; print ''; - print dol_get_fiche_head($head, 'delivery', $langs->trans("Shipment"), -1, 'sending'); + print dol_get_fiche_head($head, 'delivery', $langs->trans("Shipment"), -1, 'dolly'); /* * Confirmation de la suppression From bb11ab992ba91d7250f1cf3faee1e0cbd3bf3d9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jan 2022 17:50:35 +0100 Subject: [PATCH 3/7] Trans --- htdocs/langs/en_US/admin.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 47daec0851b..1bf5233f660 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2216,4 +2216,5 @@ NativeModules=Native modules NoDeployedModulesFoundWithThisSearchCriteria=No modules found for these search criteria API_DISABLE_COMPRESSION=Disable compression of API responses EachTerminalHasItsOwnCounter=Each terminal use its own counter. -FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first \ No newline at end of file +FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first +PreviousHash=Previous hash \ No newline at end of file From d56048387575db738e6945dbe33d59e09c851698 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jan 2022 18:32:03 +0100 Subject: [PATCH 4/7] Fix permission from group not found --- htdocs/user/class/user.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6345cac8b1a..71ed5f9a7e2 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1149,9 +1149,12 @@ class User extends CommonObject $sql .= " AND r.entity = ".((int) $conf->entity); } } else { - $sql .= " AND gr.entity = ".((int) $conf->entity); - $sql .= " AND gu.entity = ".((int) $conf->entity); - $sql .= " AND r.entity = ".((int) $conf->entity); + $sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity + // The entity on the table usergroup_user should be useless and shoumd never be used because it is alreay into gr and r. + // but when using MULTICOMPANY_TRANSVERSE_MODE, we may insert record that make rubbish result due to duplicate record of + // other entities, so we are forced to add a filter here + $sql .= " AND gu.entity IN (0,".$conf->entity.")"; + $sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity } $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; $sql .= " AND gu.fk_user = ".((int) $this->id); From 15346d1c4acafb7576914b4b48df2e73ba233fef Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 25 Jan 2022 09:17:30 +0100 Subject: [PATCH 5/7] getTasksArray() fetch_optionals to populate ExtraFields --- htdocs/projet/class/task.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index d0b27caf326..87a66279714 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -800,9 +800,10 @@ class Task extends CommonObject * @param array $extrafields Show additional column from project or task * @param int $includebilltime Calculate also the time to bill and billed * @param array $search_array_options Array of search + * @param int $loadextras Fetch all Extrafields on each task * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array()) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0) { global $conf, $hookmanager; @@ -1022,6 +1023,10 @@ class Task extends CommonObject } } } + + if ($loadextras) { + $tasks[$i]->fetch_optionals(); + } } $i++; From 54e5b5d369f88f8ef505dee41e0e05cd3647e1b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jan 2022 13:40:22 +0100 Subject: [PATCH 6/7] Fix reponsive --- htdocs/core/boxes/box_produits_alerte_stock.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 14862f3cf43..e074cb76198 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -163,7 +163,7 @@ class box_produits_alerte_stock extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', + 'td' => 'class="tdoverflowmax100 maxwidth150onsmartphone"', 'text' => $objp->label, ); @@ -186,18 +186,13 @@ class box_produits_alerte_stock extends ModeleBoxes } } - $this->info_box_contents[$line][] = array( + /*$this->info_box_contents[$line][] = array( 'td' => 'class="nowraponall right amount"', - 'text' => $price, - ); + 'text' => $price.' '.$price_base_type, + );*/ $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', - 'text' => $price_base_type, - ); - - $this->info_box_contents[$line][] = array( - 'td' => 'class="center"', + 'td' => 'class="center nowraponall"', 'text' => price2num($objp->total_stock, 'MS').' / '.$objp->seuil_stock_alerte, 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit", $objp->seuil_stock_alerte)), ); From bab35fd97d7492c77ed772cd224775cd50ebc419 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 25 Jan 2022 09:59:49 +0100 Subject: [PATCH 7/7] Fix ticket module : security check would prevent automatic fill of thirdparty fields when creating a ticket from thirdparty card. --- htdocs/ticket/agenda.php | 1 - htdocs/ticket/card.php | 1 - htdocs/ticket/contact.php | 1 - htdocs/ticket/messaging.php | 1 - 4 files changed, 4 deletions(-) diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 66cbe8e7290..9a4af31014a 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -80,7 +80,6 @@ if (!$action) { // Security check $id = GETPOST("id", 'int'); -$socid = 0; if ($user->socid > 0) $socid = $user->socid; $result = restrictedArea($user, 'ticket', $id, ''); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index cf665e8a470..7decdeadd7b 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -115,7 +115,6 @@ if ($id || $track_id || $ref) { $url_page_current = DOL_URL_ROOT.'/ticket/card.php'; // Security check - Protection if external user -$socid = 0; if ($user->socid > 0) $socid = $user->socid; $result = restrictedArea($user, 'ticket', $object->id); diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index d31469f13f2..093aaf5de1e 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -61,7 +61,6 @@ $permissiontoadd = $user->rights->ticket->write; // Security check $id = GETPOST("id", 'int'); -$socid = 0; if ($user->socid > 0) $socid = $user->socid; $result = restrictedArea($user, 'ticket', $object->id, ''); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 61291836cdb..292fff329ad 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -80,7 +80,6 @@ $permissiontoadd = $user->rights->ticket->write; // Security check $id = GETPOST("id", 'int'); -$socid = 0; if ($user->socid > 0) $socid = $user->socid; $result = restrictedArea($user, 'ticket', $object->id, '');