|
1 | 1 | <?php |
2 | 2 | include_once($serverRoot.'/config/dbconnection.php'); |
3 | | -include_once($serverRoot.'/classes/OccurrenceUtilities.php'); |
4 | 3 |
|
5 | 4 | class ChecklistAdmin { |
6 | 5 |
|
@@ -85,7 +84,22 @@ public function editMetaData($postArr){ |
85 | 84 | } |
86 | 85 | $sql = 'UPDATE fmchecklists SET '.substr($setSql,2).' WHERE (clid = '.$this->clid.')'; |
87 | 86 | //echo $sql; exit; |
88 | | - if(!$this->conn->query($sql)){ |
| 87 | + if($this->conn->query($sql)){ |
| 88 | + if($postArr['type'] == 'rarespp'){ |
| 89 | + if($postArr['locality']){ |
| 90 | + $sql = 'UPDATE omoccurrences o INNER JOIN taxstatus ts1 ON o.tidinterpreted = ts1.tid '. |
| 91 | + 'INNER JOIN taxstatus ts2 ON ts1.tidaccepted = ts2.tidaccepted '. |
| 92 | + 'INNER JOIN fmchklsttaxalink cl ON ts2.tid = cl.tid '. |
| 93 | + 'SET o.localitysecurity = 1 '. |
| 94 | + 'WHERE (cl.clid = '.$this->clid.') AND (o.stateprovince = "'.$postArr['locality'].'") '. |
| 95 | + 'AND (o.localitysecurity IS NULL OR o.localitysecurity = 0) AND (ts1.taxauthid = 1) AND (ts2.taxauthid = 1) '; |
| 96 | + if(!$this->conn->query($sql)){ |
| 97 | + $statusStr = 'Error updating rare state species: '.$this->conn->error; |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + else{ |
89 | 103 | $statusStr = 'Error: unable to update checklist metadata. SQL: '.$this->conn->error; |
90 | 104 | } |
91 | 105 | return $statusStr; |
@@ -240,8 +254,8 @@ public function addNewSpecies($dataArr,$setRareSpp = false){ |
240 | 254 | $sqlRare = 'UPDATE omoccurrences o INNER JOIN taxstatus ts1 ON o.tidinterpreted = ts1.tid '. |
241 | 255 | 'INNER JOIN taxstatus ts2 ON ts1.tidaccepted = ts2.tidaccepted '. |
242 | 256 | 'SET o.localitysecurity = 1 '. |
243 | | - 'WHERE (o.localitysecurity IS NULL OR o.localitysecurity = 0) AND ts1.taxauthid = 1 AND ts2.taxauthid = 1 '. |
244 | | - 'AND o.stateprovince = "'.$state.'" AND ts2.tid = '.$dataArr['tid']; |
| 257 | + 'WHERE (o.localitysecurity IS NULL OR o.localitysecurity = 0) AND (ts1.taxauthid = 1) AND (ts2.taxauthid = 1) '. |
| 258 | + 'AND (o.stateprovince = "'.$state.'") AND (ts2.tid = '.$dataArr['tid'].')'; |
245 | 259 | //echo $sqlRare; exit; |
246 | 260 | $this->conn->query($sqlRare); |
247 | 261 | } |
|
0 commit comments