diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 5d96adbd7fb..d577f9aedf4 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -124,6 +124,9 @@ if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array'); +if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) { + $search_omitChildren = GETPOST('search_omitChildren', 'alpha') == 'on' ? 1 : 0; +} $mine = ((GETPOST('mode') == 'mine') ? 1 : 0); @@ -601,6 +604,12 @@ if ($search_login) { if ($search_import_key) { $sql .= natural_search(array('p.import_key'), $search_import_key); } +if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) { + if ($search_omitChildren == 1) { + $sql .= " AND p.fk_project IS NULL"; + } +} + // Search for tag/category ($searchCategoryProjectList is an array of ID) $searchCategoryProjectList = $search_category_array; $searchCategoryProjectOperator = 0; @@ -1018,6 +1027,11 @@ if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST) && isMo $moreforfilter .= ''; } +if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) { + //Checkbox for omitting child projects filter + $moreforfilter .= '

'.$langs->trans("Omit sub-projects").'

'; +} + if (!empty($moreforfilter)) { print '
'; print $moreforfilter;