Overview
Comment:Autoriser d'autres présentations du numéro de téléphone pour les autres pays
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: c58cdbb39299473417b67c0fd161d59a395923c7
User & Date: bohwaz on 2019-11-17 18:12:17
Other Links: manifest | tags
References
2019-11-17
18:12 Fixed ticket [6a713d04d6]: Affichage des numéros de téléphone selon le pays plus 5 other changes artifact: 00560e4808 user: bohwaz
Context
2019-11-17
19:46
Fix: stdClass, pas object check-in: 56bed8c330 user: bohwaz tags: trunk, stable
18:12
Autoriser d'autres présentations du numéro de téléphone pour les autres pays check-in: c58cdbb392 user: bohwaz tags: trunk, stable
17:35
Gérer les champs à choix multiple à l'export et import check-in: f5de34b507 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Template.php from [9944aa0b81] to [1753fedcdf].

196
197
198
199
200
201
202
203
204
205
206
207
208
209

210
211
212

213
214
215
216
217
218
219
		}

		return $escape ? htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8') : $value;
	}

	protected function formatPhoneNumber($n)
	{
		$n = preg_replace('![^\d\+]!', '', $n);

		if (substr($n, 0, 1) == '+')
		{
			$n = preg_replace('!^\+(?:1|2[07]|2\d{2}|3[0-469]|3\d{2}|4[013-9]|'
				. '4\d{2}|5[1-8]|5\d{2}|6[0-6]|6\d{2}|7\d|8[1-469]|8\d{2}|'
				. '9[0-58]|9\d{2})!', '\\0 ', $n);

		}
		elseif (preg_match('/^\d{10}$/', $n))
		{

			$n = preg_replace('!(\d{2})!', '\\1 ', $n);
		}

		return $n;
	}

	protected function customColors()







|

|
<
<
<
<
>

<
|
>







196
197
198
199
200
201
202
203
204
205




206
207

208
209
210
211
212
213
214
215
216
		}

		return $escape ? htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8') : $value;
	}

	protected function formatPhoneNumber($n)
	{
		$country = Config::getInstance()->get('pays');

		if ($country !== 'FR') {




			return $n;
		}


		if ('FR' === $country && $n[0] === '0' && strlen($n) === 10) {
			$n = preg_replace('!(\d{2})!', '\\1 ', $n);
		}

		return $n;
	}

	protected function customColors()

Modified src/include/lib/Garradin/Utils.php from [3b510ca29b] to [794409535e].

469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
    static public function checkBIC($bic)
    {
        return preg_match('!^[A-Z]{4}[A-Z]{2}[1-9A-Z]{2}(?:[A-Z\d]{3})?$!', $bic);
    }

    static public function normalizePhoneNumber($n)
    {
        $n = preg_replace('!(\+\d+)\(0\)!', '\\1', $n);
        $n = preg_replace('![^\d\+]!', '', $n);
        return $n;
    }

    static public function write_ini_string($in)
    {
        $out = '';
        $get_ini_line = function ($key, $value) use (&$get_ini_line)
        {







<
|
<







469
470
471
472
473
474
475

476

477
478
479
480
481
482
483
    static public function checkBIC($bic)
    {
        return preg_match('!^[A-Z]{4}[A-Z]{2}[1-9A-Z]{2}(?:[A-Z\d]{3})?$!', $bic);
    }

    static public function normalizePhoneNumber($n)
    {

        return preg_replace('![^\d\+\(\)p#,;-]!', '', trim($n));

    }

    static public function write_ini_string($in)
    {
        $out = '';
        $get_ini_line = function ($key, $value) use (&$get_ini_line)
        {