dolibarr  17.0.4
ajax.php
Go to the documentation of this file.
1 <?php
24 if (!defined('NOTOKENRENEWAL')) {
25  define('NOTOKENRENEWAL', '1'); // Disables token renewal
26 }
27 if (!defined('NOREQUIREHTML')) {
28  define('NOREQUIREHTML', '1');
29 }
30 if (!defined('NOREQUIREAJAX')) {
31  define('NOREQUIREAJAX', '1');
32 }
33 if (!defined('NOREQUIRESOC')) {
34  define('NOREQUIRESOC', '1');
35 }
36 if (!defined('NOREQUIREMENU')) {
37  define('NOREQUIREMENU', '1');
38 }
39 if (!defined('NOBROWSERNOTIF')) {
40  define('NOBROWSERNOTIF', '1');
41 }
42 
43 include_once '../../main.inc.php'; // Load $user and permissions
44 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
45 require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
46 
47 
48 $action = GETPOST('action', 'aZ09');
49 $idproduct = GETPOST('idproduct', 'int');
50 
51 
52 /*
53  * View
54  */
55 
56 top_httphead();
57 
58 if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) {
59  $product = new Product($db);
60  $res = $product->fetch($idproduct);
61 
62  $cUnit = new CUnits($db);
63  $fk_unit = $cUnit->getUnitFromCode($product->duration_unit, 'short_label', 'time');
64 
65  echo json_encode($fk_unit);
66  exit();
67 }
Class of dictionary type of thirdparty (used by imports)
Class to manage products or services.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1440