Gestion international

This commit is contained in:
Pierre-Lin Bonnemaison 2015-08-16 04:39:13 +02:00
parent 03f6d2aa2c
commit 3692f98a90
3 changed files with 4 additions and 4 deletions

View File

@ -8,8 +8,8 @@
*/
public static function parsePhone($number)
{
$number = preg_replace('#[^0-9+]#', '', $number);
if (preg_match('#^(0|\+33)[1-9][0-9]{8}$#', $number))
$number = preg_replace('#[^-0-9+]#', '', $number);
if (preg_match('#^(0|\+[1-9]{1,3}|\+1\-[0-9]{3})[1-9][0-9]{8}$#', $number))
{
return $number;
}

View File

@ -49,7 +49,7 @@
<label>Numéro de téléphone du contact</label>
<div class="form-group input-group">
<span class="input-group-addon"><span class="fa fa-phone"></span></span>
<input name="phone" class="form-control" type="text" placeholder="Numéro du contact" pattern="((0[1-9])|(\+33( )?[0-9]))( ?)([0-9] ?){8}" required>
<input name="phone" class="form-control" type="text" placeholder="Numéro du contact" pattern="(0|\+[1-9]{1,3}|\+1\-[0-9]{3})[1-9][0-9]{8}" required>
</div>
</div>
<a class="btn btn-danger" href="<?php echo $this->generateUrl('contacts'); ?>">Annuler</a>

View File

@ -53,7 +53,7 @@
<label>Numéro de téléphone du contact</label>
<div class="form-group input-group">
<span class="input-group-addon"><span class="fa fa-phone"></span></span>
<input name="contacts[<?php secho($contact['id']); ?>][phone]" class="form-control" type="text" placeholder="Numéro du contact" pattern="((0[1-9])|(\+33( )?[0-9]))( ?)([0-9] ?){8}" required value="<?php secho($contact['number']); ?>">
<input name="contacts[<?php secho($contact['id']); ?>][phone]" class="form-control" type="text" placeholder="Numéro du contact" pattern="(0|\+[1-9]{1,3}|\+1\-[0-9]{3})[1-9][0-9]{8}" required value="<?php secho($contact['number']); ?>">
</div>
</div>
<hr/>