@@ -21,7 +21,7 @@ public static function options()
21
21
private static $ valid_field_names = array (
22
22
'uuid ' , 'cache_code ' , 'date ' , 'user ' , 'type ' , 'was_recommended ' , 'comment ' ,
23
23
'images ' , 'internal_id ' , 'oc_team_entry ' , 'needs_maintenance2 ' ,
24
- 'listing_is_outdated ' ,
24
+ 'listing_is_outdated ' , ' location ' ,
25
25
);
26
26
27
27
public static function call (OkapiRequest $ request )
@@ -53,13 +53,17 @@ public static function call(OkapiRequest $request)
53
53
$ ratingdate_condition = 'and cr.rating_date=cl.date ' ;
54
54
$ needs_maintenance_SQL = 'cl.needs_maintenance ' ;
55
55
$ listing_is_outdated_SQL = 'cl.listing_outdated ' ;
56
+ $ join_SQL = '' ;
57
+ $ latlong_SQL = ', null as latitude, null as longitude ' ;
56
58
}
57
59
else
58
60
{
59
61
$ teamentry_field = '(cl.type=12) ' ;
60
62
$ ratingdate_condition = '' ;
61
63
$ needs_maintenance_SQL = 'IF(cl.type=5, 2, IF(cl.type=6, 1, 0)) ' ;
62
64
$ listing_is_outdated_SQL = '0 ' ;
65
+ $ join_SQL = 'left join cache_moved cm on cm.log_id=cl.id ' ;
66
+ $ latlong_SQL = ', cm.latitude, cm.longitude ' ;
63
67
}
64
68
$ rs = Db::query ("
65
69
select
@@ -70,6 +74,7 @@ public static function call(OkapiRequest $request)
70
74
unix_timestamp(cl.date) as date, cl.text,
71
75
u.uuid as user_uuid, u.username, u.user_id,
72
76
if(cr.user_id is null, 0, 1) as was_recommended
77
+ " .$ latlong_SQL ."
73
78
from
74
79
(cache_logs cl,
75
80
user u,
@@ -82,6 +87,7 @@ public static function call(OkapiRequest $request)
82
87
" .Okapi::logtypename2id ("Found it " ).",
83
88
" .Okapi::logtypename2id ("Attended " )."
84
89
)
90
+ " .$ join_SQL ."
85
91
where
86
92
cl.uuid in (' " .implode ("',' " , array_map ('\okapi\Db::escape_string ' , $ log_uuids ))."')
87
93
and " .((Settings::get ('OC_BRANCH ' ) == 'oc.pl ' ) ? "cl.deleted = 0 " : "true " )."
@@ -109,6 +115,7 @@ public static function call(OkapiRequest $request)
109
115
'listing_is_outdated ' => $ flag_options [$ row ['listing_is_outdated ' ]],
110
116
'oc_team_entry ' => $ row ['oc_team_entry ' ] ? true : false ,
111
117
'comment ' => Okapi::fix_oc_html ($ row ['text ' ], Okapi::OBJECT_TYPE_CACHE_LOG ),
118
+ 'location ' => $ row ['latitude ' ] === null ? null : round ($ row ['latitude ' ], 6 )."| " .round ($ row ['longitude ' ], 6 ),
112
119
'images ' => array (),
113
120
'internal_id ' => $ row ['id ' ],
114
121
);
0 commit comments