@@ -3852,8 +3852,34 @@ function paranoidEvent() {
38523852
38533853 $ paranoids = false ;
38543854
3855+ $ map_event_type = [
3856+ "rfId " => [
3857+ "event_type " => "3 " ,
3858+ "title " => "mobile.paranoidTitleRf " ,
3859+ "message " => "mobile.paranoidMsgRf " ,
3860+ ],
3861+ "app " => [
3862+ "event_type " => "4 " ,
3863+ "title " => "mobile.paranoidTitleApp " ,
3864+ "message " => "mobile.paranoidMsgApp " ,
3865+ ],
3866+ "code " => [
3867+ "event_type " => "6 " ,
3868+ "title " => "mobile.paranoidTitleCode " ,
3869+ "message " => "mobile.paranoidMsgCode " ,
3870+ ],
3871+ "lp " => [
3872+ "event_type " => "9 " ,
3873+ "title " => "mobile.paranoidTitleLP " ,
3874+ "message " => "mobile.paranoidMsgLP " ,
3875+ ],
3876+ ];
3877+
38553878 switch ($ by ) {
38563879 case "rfId " :
3880+ case "app " :
3881+ case "code " :
3882+ case "lp " :
38573883 $ paranoids = $ this ->db ->get ("
38583884 select * from (
38593885 select
@@ -3862,24 +3888,25 @@ function paranoidEvent() {
38623888 houses_subscribers_devices.push_token,
38633889 houses_subscribers_devices.push_token_type,
38643890 houses_subscribers_devices.ua,
3865- houses_watchers.comments
3891+ coalesce( houses_watchers.comments, '') comments
38663892 from
38673893 houses_watchers
38683894 left join
38693895 houses_flats on houses_flats.house_flat_id = houses_watchers.house_flat_id
38703896 left join
38713897 houses_subscribers_devices on houses_subscribers_devices.subscriber_device_id = houses_watchers.subscriber_device_id
38723898 where
3873- event_type = '3' and
3874- event_detail = :rfid and
3899+ event_type = :event_type and
3900+ ( event_detail = :detail or coalesce(event_detail, '') = '') and
38753901 houses_watchers.house_flat_id in (
38763902 select house_flat_id from houses_entrances_flats where house_entrance_id = :house_entrance_id
38773903 )
38783904 ) as t
38793905 group by
38803906 address_house_id, platform, push_token, push_token_type, ua, comments
38813907 " , [
3882- "rfid " => $ detail ,
3908+ "event_type " => $ map_event_type [$ by ]["event_type " ],
3909+ "detail " => $ detail ,
38833910 "house_entrance_id " => $ entrance ["entranceId " ]
38843911 ], [
38853912 "address_house_id " => "houseId " ,
@@ -3930,8 +3957,8 @@ function paranoidEvent() {
39303957 "timestamp " => time (),
39313958 "ttl " => 90 ,
39323959 "platform " => [ "android " , "ios " , "web " ][(int )$ paranoid ["platform " ]],
3933- "title " => i18nL ($ l , " mobile.paranoidTitleRf " ),
3934- "msg " => i18nL ($ l , " mobile.paranoidMsgRf " , $ house ["houseFull " ], $ entrance ["callerId " ], $ paranoid ["comments " ] ?: $ detail ),
3960+ "title " => i18nL ($ l , $ map_event_type [ $ by ][ " title " ] ),
3961+ "msg " => i18nL ($ l , $ map_event_type [ $ by ][ " message " ] , $ house ["houseFull " ], $ entrance ["callerId " ], $ paranoid ["comments " ] ?: $ detail ),
39353962 "houseId " => $ paranoid ["houseId " ],
39363963 "hash " => $ hash ,
39373964 "sound " => "default " ,
0 commit comments