dolibarr
24.0.0-beta
Main Page
Related Pages
Topics
Classes
Files
File List
File Members
dolibarr_dev
htdocs
core
ajax
getphonecode.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (C) 2026 Open-Dsi <support@open-dsi.fr>
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16
*/
17
23
if
(!defined(
'NOTOKENRENEWAL'
)) {
24
define(
'NOTOKENRENEWAL'
,
'1'
);
// Disables token renewal
25
}
26
if
(!defined(
'NOREQUIREMENU'
)) {
27
define(
'NOREQUIREMENU'
,
'1'
);
28
}
29
if
(!defined(
'NOREQUIREAJAX'
)) {
30
define(
'NOREQUIREAJAX'
,
'1'
);
31
}
32
33
// Load Dolibarr environment
34
require
'../../main.inc.php'
;
35
require_once DOL_DOCUMENT_ROOT.
'/core/lib/phone.lib.php'
;
41
$country_id =
GETPOSTINT
(
'country_id'
);
42
43
// Security check - user must be logged in
44
if
(empty($user->id)) {
45
http_response_code(403);
46
echo json_encode(array(
'error'
=>
'Not authorized'
));
47
exit;
48
}
49
50
/*
51
* View
52
*/
53
54
top_httphead
(
'application/json'
);
55
56
$phone_code =
dol_get_phone_code_from_country
(
$db
, $country_id);
57
58
echo json_encode(array(
'phone_code'
=> $phone_code));
$db
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
Definition
execute_tool.php:46
GETPOSTINT
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
Definition
functions.lib.php:951
top_httphead
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition
main.inc.php:1512
dol_get_phone_code_from_country
dol_get_phone_code_from_country($db, $country_id)
Get the phone calling code for a country.
Definition
phone.lib.php:141
Generated on Mon Jun 22 2026 21:04:38 for
dolibarr
by Doxygen 1.11.0