fixe pas de réception si émetteur du SMS n'est pas...
...connu
... | ... |
@@ -261,21 +261,22 @@ sub inbox_sms_parse { |
261 | 261 |
|
262 | 262 |
$msg->{Phone} =~ s/^\+33/0/; |
263 | 263 |
$msg->{Email} = ''; |
264 |
+ $msg->{PhoneOwner} = ''; |
|
264 | 265 |
|
265 | 266 |
my @results = sql_request("SELECT * FROM " . $cfg::config{table} . " WHERE phone = '$msg->{Phone}'"); |
266 | 267 |
my $number_of_candidates = @results; |
267 |
- $number_of_candidates == 0 and return; |
|
268 |
- $msg->{PhoneOwner} = '('; |
|
269 |
- foreach (@results) { |
|
270 |
- $msg->{PhoneOwner} .= "$_->{firstname} $_->{lastname}"; |
|
271 |
- --$number_of_candidates > 0 and $msg->{PhoneOwner} .= ' ou '; |
|
272 |
- $msg->{Email} = $_->{email}; |
|
268 |
+ if ($number_of_candidates > 0) { |
|
269 |
+ foreach (@results) { |
|
270 |
+ $msg->{PhoneOwner} .= "$_->{firstname} $_->{lastname}"; |
|
271 |
+ --$number_of_candidates > 0 and $msg->{PhoneOwner} .= ' ou '; |
|
272 |
+ $msg->{Email} = $_->{email}; |
|
273 |
+ } |
|
274 |
+ $msg->{PhoneOwner} = ' (' . $msg->{PhoneOwner} . ')'; |
|
273 | 275 |
} |
274 |
- $msg->{PhoneOwner} .= ')'; |
|
275 |
- $msg->{Subject} = "SMS recu de $msg->{Phone} $msg->{PhoneOwner}"; |
|
276 |
+ $msg->{Subject} = "SMS recu de $msg->{Phone}$msg->{PhoneOwner}"; |
|
276 | 277 |
|
277 | 278 |
if (defined $msg->{Phone} and !(is_authorized(\%$msg) and react_on_message(\%part_from_user, \%$msg))) { |
278 |
- log_bot("message de $msg->{Phone} $msg->{PhoneOwner}"); |
|
279 |
+ log_bot("message de $msg->{Phone}$msg->{PhoneOwner}"); |
|
279 | 280 |
$mail_queue->enqueue(\%$msg); |
280 | 281 |
} |
281 | 282 |
|