dolibarr  16.0.5
ajax_bom.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2019 Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
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('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
24 //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
25 if (!defined('NOREQUIRESOC')) {
26  define('NOREQUIRESOC', '1');
27 }
28 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
29 if (!defined('NOCSRFCHECK')) {
30  define('NOCSRFCHECK', '1');
31 }
32 if (!defined('NOTOKENRENEWAL')) {
33  define('NOTOKENRENEWAL', '1');
34 }
35 if (!defined('NOREQUIREMENU')) {
36  define('NOREQUIREMENU', '1');
37 }
38 if (!defined('NOREQUIREHTML')) {
39  define('NOREQUIREHTML', '1');
40 }
41 if (!defined('NOREQUIREAJAX')) {
42  define('NOREQUIREAJAX', '1');
43 }
44 
45 require '../../main.inc.php'; // Load $user and permissions
46 require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
47 
48 $idbom = GETPOST('idbom', 'alpha');
49 $action = GETPOST('action', 'aZ09');
50 
51 
52 /*
53  * View
54  */
55 
56 $object = new BOM($db);
57 $result = $object->fetch($idbom);
58 if ($result > 0) {
59  // We remove properties we don't need in answer
60  unset($object->fields);
61  unset($object->db);
62  echo json_encode($object);
63 } else {
64  echo 'Failed to load category with id='.$idbom;
65 }
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
BOM
Class for BOM.
Definition: bom.class.php:34