dolibarr  13.0.2
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')) define('NOREQUIRESOC', '1');
26 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
27 if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
28 if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
29 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
30 if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
31 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
32 
33 require '../../main.inc.php'; // Load $user and permissions
34 require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
35 
36 $idbom = GETPOST('idbom', 'alpha');
37 $action = GETPOST('action', 'aZ09');
38 
39 
40 /*
41  * View
42  */
43 
44 $object = new BOM($db);
45 $result = $object->fetch($idbom);
46 if ($result > 0)
47 {
48  // We remove properties we don't need in answer
49  unset($object->fields);
50  unset($object->db);
51  echo json_encode($object);
52 } else {
53  echo 'Failed to load category with id='.$idbom;
54 }
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class for BOM.
Definition: bom.class.php:32