dolibarr  13.0.2
getaccountcurrency.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
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')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
25 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
26 
27 require '../../main.inc.php';
28 
29 $id = GETPOST('id', 'int');
30 
31 
32 /*
33  * View
34  */
35 
36 top_httphead();
37 
38 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
39 
40 // Load original field value
41 if (!empty($id))
42 {
43  require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
44  $account = new Account($db);
45  $result = $account->fetch($id);
46  if ($result < 0) {
47  $return['value'] = '';
48  $return['num'] = $result;
49  $return['error'] = $account->errors[0];
50  } else {
51  $return['value'] = $account->currency_code;
52  $return['num'] = $result;
53  $return['error'] = '';
54  }
55 
56  echo json_encode($return);
57 }
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage bank accounts.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1214