From 63d7698b43b7ffd2be954bfbd0930428b6030481 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 16 Apr 2021 15:26:29 +0200 Subject: [PATCH 1/3] ADD company option for disable Workforce --- htdocs/societe/card.php | 43 ++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 66b5f68564e..512c66f9ddd 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1459,15 +1459,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } // Type - Workforce/Staff - print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'."\n"; + print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'."\n"; $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam, '', 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print ''; - if ($conf->browser->layout == 'phone') print ''; - print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'; - print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); - if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + { + print ''; + if ($conf->browser->layout == 'phone') print ''; + print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'; + print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); + if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + else + { + print ''; + } print ''; // Legal Form @@ -2081,14 +2088,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; // Type - Workforce/Staff - print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; + print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'; print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print ''; - if ($conf->browser->layout == 'phone') print ''; - print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).''; - print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + { + print ''; + if ($conf->browser->layout == 'phone') print ''; + print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).''; + print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + else + { + print ''; + } print ''; // Juridical type @@ -2494,7 +2508,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; // Workforce/Staff - print ''.$langs->trans("Workforce").''.$object->effectif.''; + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + { + print ''.$langs->trans("Workforce").''.$object->effectif.''; + } print ''; print ''; From 3b9ff839a7d2f4d783ad90da3330522e90412c70 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 21 Apr 2021 14:14:47 +0000 Subject: [PATCH 2/3] Fixing style errors. --- htdocs/societe/card.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 512c66f9ddd..72d5ead1935 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1463,7 +1463,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam, '', 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { print ''; if ($conf->browser->layout == 'phone') print ''; @@ -1471,8 +1471,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - else - { + else { print ''; } print ''; @@ -2091,7 +2090,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'; print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { print ''; if ($conf->browser->layout == 'phone') print ''; @@ -2099,8 +2098,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - else - { + else { print ''; } print ''; @@ -2508,7 +2506,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; // Workforce/Staff - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { print ''.$langs->trans("Workforce").''.$object->effectif.''; } From 166a23004cbaa01d509dec288450a6290993d315 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 21 Apr 2021 15:04:44 +0000 Subject: [PATCH 3/3] Fixing style errors. --- htdocs/societe/card.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ce4fbcb1213..8102c5064f2 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1516,8 +1516,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($user->admin) { print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) - { + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { print ''; if ($conf->browser->layout == 'phone') { print ''; @@ -1527,8 +1526,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($user->admin) { print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - } - else { + } else { print ''; } print ''; @@ -2207,8 +2205,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($user->admin) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) - { + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { print ''; if ($conf->browser->layout == 'phone') { print ''; @@ -2218,8 +2215,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($user->admin) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - } - else { + } else { print ''; } print ''; @@ -2658,8 +2654,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Workforce/Staff - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) - { + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { print ''.$langs->trans("Workforce").''.$object->effectif.''; }