Piotr Labudda 9 лет назад
Родитель
Сommit
1f46a6d71a
2 измененных файлов с 3 добавлено и 14 удалено
  1. 2 6
      SE/se-lib/Data_Source.php
  2. 1 8
      SE/se-lib/TableAcl.php

+ 2 - 6
SE/se-lib/Data_Source.php

@@ -981,10 +981,7 @@ class Data_Source {
 		} else if (!is_array($item)) {
 			throw new HttpException('Item is not array', 400);
 		}
-		if (empty($item)) {
-			//throw new Exception('Item patch is empty');
-			return 0;// nothing to insert
-		}
+		// add empty record is allowed - empty($item)
 
 		// the geom fix
 		foreach ($item as $fld => $val) {
@@ -998,8 +995,7 @@ class Data_Source {
 			}
 		}
 
-		$item = (object)$item;
-		$primaryKey = $this->_db->ADD_NEW_OBJ($this->_tbl, $item);
+		$primaryKey = $this->_db->ADD_NEW_OBJ($this->_tbl, (object)$item);
 		if ($primaryKey < 0) {
 			$dsErrors = $this->getDbErrors();
 			$dsErrors = "Wystąpiły błędy!\n" . implode("\n", $dsErrors);

+ 1 - 8
SE/se-lib/TableAcl.php

@@ -1430,11 +1430,6 @@ class TableAcl extends Core_AclBase {
 		} else if (!is_array($itemTodo)) {
 			throw new HttpException('Item is not array', 400);
 		}
-		if (empty($itemTodo)) {
-			//throw new Exception('Item patch is empty');
-			DBG::_('DBG_DS', '>2', "Item patch is empty", null, __CLASS__, __FUNCTION__, __LINE__);
-			return 0;// nothing to insert
-		}
 		$ds = $this->getDataSource();
 
 		// from convertObjectFromUserInput
@@ -1454,9 +1449,7 @@ class TableAcl extends Core_AclBase {
 				$item[$vFieldName] = $value;
 			}
 		}
-		if (empty($item)) {
-			throw new Exception("Nothing to add");
-		}
+		// add empty record is allowed - empty($item)
 
 		{// add DefaultAclGroup if no create perms ('C')
 			$defaultAclGroup = User::getDefaultAclGroup();