Prechádzať zdrojové kódy

fixed the_geom revert from hist BUG

Piotr Labudda 9 rokov pred
rodič
commit
2747c956bd
1 zmenil súbory, kde vykonal 10 pridanie a 9 odobranie
  1. 10 9
      SE/se-lib/TableAjax.php

+ 10 - 9
SE/se-lib/TableAjax.php

@@ -4993,27 +4993,28 @@ jQuery(document).ready(function(){
 		if (empty($rowsHist)) return $jsonResponse;
 
 		$jsonResponse['rows'] = array();
-		foreach ($rowsHist as $row) {
+		foreach ($rowsHist as $histRow) {
 			$histItem = array();
-			$histItem['ID'] = V::get('ID', '', $row);
-			$histItem['_created'] = V::get('_created', '', $row);
-			$histItem['_author'] = V::get('_author', '', $row);
+			$histItem['ID'] = V::get('ID', '', $histRow);
+			$histItem['_created'] = V::get('_created', '', $histRow);
+			$histItem['_author'] = V::get('_author', '', $histRow);
 			$histItem['changes'] = array();
 			foreach ($visibleColsWithIds as $fldId => $fieldName) {
-				if (!array_key_exists($fieldName, (array)$row)) continue;
-				if ('N/S;' == V::get($fieldName, '', $row)) continue;
+				if (!array_key_exists($fieldName, (array)$histRow)) continue;
+				$value = V::get($fieldName, '', $histRow);
+				if ('N/S;' == $value) continue;
 
 				$changeItem = array();
 				$changeItem['fieldName'] = $fieldName;
 				$changeItem['acl_read'] = $acl->canReadObjectField($fieldName, $record);
 				if ($changeItem['acl_read']) {
-					$changeItem['value'] = V::get($fieldName, '', $row);
+					$changeItem['value'] = V::get($fieldName, '', $histRow);
 				}
 				if ('the_geom' == $fieldName && $acl->canWriteObjectField($fieldName, $record)) {
 					$sourceName = $acl->getSourceName();
-					if ('default_db' == $sourceName) {
+					if ('default_db' == $sourceName && !empty($value)) {
 						$typeName = $acl->getName();
-						$idHist = V::get('ID', '', $_row);
+						$idHist = V::get('ID', '', $histRow);
 						$changeItem['revert_function_url'] = Request::getPathUri() . "index.php?_route=ViewTableAjax&typeName=p5_{$sourceName}:{$typeName}&_task=revertFromHistAjax&ID={$id}&idHist={$idHist}&fieldName={$fieldName}";
 						$changeItem['revert_function_data'] = "ID={$id}&idHist={$idHist}&fieldName={$fieldName}";
 					}