dolibarr 18.0.6
ajax.php
Go to the documentation of this file.
1<?php
24if (!defined('NOTOKENRENEWAL')) {
25 define('NOTOKENRENEWAL', '1'); // Disables token renewal
26}
27if (!defined('NOREQUIREHTML')) {
28 define('NOREQUIREHTML', '1');
29}
30if (!defined('NOREQUIREAJAX')) {
31 define('NOREQUIREAJAX', '1');
32}
33if (!defined('NOREQUIRESOC')) {
34 define('NOREQUIRESOC', '1');
35}
36if (!defined('NOREQUIREMENU')) {
37 define('NOREQUIREMENU', '1');
38}
39if (!defined('NOBROWSERNOTIF')) {
40 define('NOBROWSERNOTIF', '1');
41}
42
43include_once '../../main.inc.php'; // Load $user and permissions
44require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
45require_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
57
58if ($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(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.