Nextrek
Diff Revisions
536
vs
537
for /Android/SmartCharging/endPoints/nightly/repositories/LocalRepository.php
|
@@ -1,6 +1,7 @@ |
1 |
1 |
|
<?php |
2 |
2 |
|
require_once('LocalRepositoryInterface.php'); |
3 |
3 |
|
require_once(dirname(__FILE__).'/../classes/Local.php'); |
|
4 |
+ |
require_once(dirname(__FILE__)."/../utilities.php"); |
4 |
5 |
|
|
5 |
6 |
|
class LocalRepository implements LocalRepositoryInterface { |
6 |
7 |
|
protected $db; |
|
@@ -33,6 +34,8 @@ |
33 |
34 |
|
$this->db->exec($queryLocal); |
34 |
35 |
|
$id_locale = $this->db->lastInsertId(); |
35 |
36 |
|
|
|
37 |
+ |
$queryUser = "UPDATE utente SET is_owner=1 WHERE id=".$local->id_utente_owner; |
|
38 |
+ |
|
36 |
39 |
|
/*foreach($imgs as $img) { |
37 |
40 |
|
$imgsToInsert[] = '("'.$id_locale.'", "'.$img.'")'; |
38 |
41 |
|
} |
|
@@ -41,6 +44,8 @@ |
41 |
44 |
|
|
42 |
45 |
|
$this->db->exec($queryImgs);*/ |
43 |
46 |
|
|
|
47 |
+ |
$this->db->exec($queryUser); |
|
48 |
+ |
|
44 |
49 |
|
$status["local_id"] = $id_locale; |
45 |
50 |
|
$status["return"] = 0; |
46 |
51 |
|
|
|
@@ -48,9 +53,9 @@ |
48 |
53 |
|
|
49 |
54 |
|
} catch (PDOException $e) { |
50 |
55 |
|
echo $e->getMessage(); |
51 |
|
- |
|
|
56 |
+ |
$risposta = createErrorMessage(3, "Errore DB"); |
52 |
57 |
|
$status["local_id"] = -1; |
53 |
|
- |
$status["return"] = 3; |
|
58 |
+ |
//$status["return"] = 3; |
54 |
59 |
|
|
55 |
60 |
|
return $status; |
56 |
61 |
|
} |
|
@@ -153,7 +158,8 @@ |
153 |
158 |
|
|
154 |
159 |
|
} catch (PDOException $e) { |
155 |
160 |
|
echo $e->getMessage(); |
156 |
|
- |
$status["return"] = 1; |
|
161 |
+ |
$risposta = createErrorMessage(1, "Errore DB"); |
|
162 |
+ |
//$status["return"] = 1; |
157 |
163 |
|
return $status; |
158 |
164 |
|
} |
159 |
165 |
|
|