浏览代码

Add hidden search parameter search_current_entity

Laurent Destailleur 2 年之前
父节点
当前提交
c510b7d4df
共有 3 个文件被更改,包括 9 次插入3 次删除
  1. 6 1
      htdocs/admin/defaultvalues.php
  2. 1 1
      htdocs/modulebuilder/template/myobject_list.php
  3. 2 1
      htdocs/projet/list.php

+ 6 - 1
htdocs/admin/defaultvalues.php

@@ -383,7 +383,12 @@ if (!is_array($result) && $result < 0) {
 			print '</td>';
 		}
 
-		print '<td></td>';
+		// Multicompany
+		print '<td>';
+		if (isModEnabled('multicompany')) {
+			print dol_escape_htmltag($defaultvalue->entity);
+		}
+		print '</td>';
 
 		// Actions
 		print '<td class="center">';

+ 1 - 1
htdocs/modulebuilder/template/myobject_list.php

@@ -305,7 +305,7 @@ $parameters = array();
 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 $sql .= $hookmanager->resPrint;
 if ($object->ismultientitymanaged == 1) {
-	$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
+	$sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOST('search_current_entity', 'int') ? 0 : 1)).")";
 } else {
 	$sql .= " WHERE 1 = 1";
 }

+ 2 - 1
htdocs/projet/list.php

@@ -117,6 +117,7 @@ $search_price_registration = GETPOST("search_price_registration", 'alpha');
 $search_price_booth = GETPOST("search_price_booth", 'alpha');
 $search_login = GETPOST('search_login', 'alpha');
 $search_import_key = GETPOST('search_import_key', 'alpha');
+$search_current_entity = GETPOST('search_current_entity', 'alpha');
 $searchCategoryCustomerOperator = 0;
 if (GETPOSTISSET('formfilteraction')) {
 	$searchCategoryCustomerOperator = GETPOST('search_category_customer_operator', 'int');
@@ -473,7 +474,7 @@ if ($search_project_contact > 0) {
 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
 $sql .= $hookmanager->resPrint;
 
-$sql .= " WHERE p.entity IN (".getEntity('project').')';
+$sql .= " WHERE p.entity IN (".getEntity('project', $search_current_entity ? 0 : 1).')';
 if (empty($user->rights->projet->all->lire)) {
 	$sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
 }