Browse Source

Drobne poprawki do punktów georeferencyjnych

Mariusz Muszyński 8 năm trước cách đây
mục cha
commit
00e20de5e8

+ 7 - 4
SE/se-lib/Route/GeoreferencesManager.php

@@ -2,6 +2,7 @@
 
 
 Lib::loadClass('RouteBase');
 Lib::loadClass('RouteBase');
 Lib::loadClass('EpsgConversion');
 Lib::loadClass('EpsgConversion');
+Lib::loadClass('RawSql');
 
 
 class Route_GeoreferencesManager extends RouteBase {
 class Route_GeoreferencesManager extends RouteBase {
 
 
@@ -200,14 +201,13 @@ class Route_GeoreferencesManager extends RouteBase {
             </thead>
             </thead>
             <tbody>
             <tbody>
 <?php
 <?php
-			$i = 0;
 			foreach ($points as $lp => $point) {
 			foreach ($points as $lp => $point) {
 				$disabled = false;
 				$disabled = false;
 				$checked = true;
 				$checked = true;
-				echo "<tr><td nowrap align='right'>" . ++$i . "</td><td nowrap>{$point['x']} ({$wgs84[$lp]->x})</td><td nowrap>{$point['y']} ({$wgs84[$lp]->y})</td><td nowrap>{$point['z']}</td><td nowrap align='center'>{$wgs84[$lp]->epsg}</td><td nowrap>";
+				echo "<tr><td nowrap align='right'>" . $lp . "</td><td nowrap>{$point['x']} ({$wgs84[$lp]->x})</td><td nowrap>{$point['y']} ({$wgs84[$lp]->y})</td><td nowrap>{$point['z']}</td><td nowrap align='center'>{$wgs84[$lp]->epsg}</td><td nowrap>";
 				if ($closePointsDetail[$lp]) {
 				if ($closePointsDetail[$lp]) {
 					if ($closePointsDetail[$lp]['distance'] == 0) {
 					if ($closePointsDetail[$lp]['distance'] == 0) {
-						if ($closePointsDetail[$lp]['z']) {
+						if ($closePointsDetail[$lp]['z'] > 0) {
 							if ($closePointsDetail[$lp]['z'] == $point['z']) {
 							if ($closePointsDetail[$lp]['z'] == $point['z']) {
 								echo "ID:{$closePoints[$lp]} - to ten sam punkt, nie ma co aktualiować";
 								echo "ID:{$closePoints[$lp]} - to ten sam punkt, nie ma co aktualiować";
 								$disabled = true;
 								$disabled = true;
@@ -271,7 +271,7 @@ class Route_GeoreferencesManager extends RouteBase {
 					$the_geom = "GeomFromText('POINT({$gx} {$gy})')";
 					$the_geom = "GeomFromText('POINT({$gx} {$gy})')";
 					$sqlArrs[$lp] = [
 					$sqlArrs[$lp] = [
 						"A_STATUS" => "NORMAL",
 						"A_STATUS" => "NORMAL",
-						"A_STATUS_INFO" => "Punkt uzgodniony automatycznie",
+						"A_STATUS_INFO" => 'Punkt uzgodniony automatycznie @ ' . date('Y-m-d'),
 						"the_geom" => $the_geom,
 						"the_geom" => $the_geom,
 						"x" => $x,
 						"x" => $x,
 						"y" => $y,
 						"y" => $y,
@@ -280,6 +280,8 @@ class Route_GeoreferencesManager extends RouteBase {
 					];
 					];
 					if ($action == "on") {
 					if ($action == "on") {
 						if (!isset($data['closePoints'][$lp])) throw new Exception("Błąd danych #3");
 						if (!isset($data['closePoints'][$lp])) throw new Exception("Błąd danych #3");
+						if ($curA_STATUS_INFO = DB::getPDO()->fetchValue("SELECT A_STATUS_INFO FROM " . self::TABLE . " WHERE ID = '{$data['closePoints'][$lp]}'"))
+							$sqlArrs[$lp]['A_STATUS_INFO'] .= "; {$curA_STATUS_INFO}";
 						$sqlArrs[$lp]['ID'] = $data['closePoints'][$lp];
 						$sqlArrs[$lp]['ID'] = $data['closePoints'][$lp];
 					} elseif ($action != "new") throw new Exception("Błąd danych #4");
 					} elseif ($action != "new") throw new Exception("Błąd danych #4");
 				} catch (Exception $e) {
 				} catch (Exception $e) {
@@ -306,6 +308,7 @@ class Route_GeoreferencesManager extends RouteBase {
 			SE_Layout::alert('danger', $e->getMessage());
 			SE_Layout::alert('danger', $e->getMessage());
 			$this->uploadPointsForm();
 			$this->uploadPointsForm();
 		}
 		}
+		if (isset($_SESSION['uploadPointsData'])) unset($_SESSION['uploadPointsData']);
 	}
 	}
 
 
 	private function uploadPointsForm() {
 	private function uploadPointsForm() {