function _get(&$PDOdb, $get)
{
    switch ($get) {
        case 'serial_number':
            __out(_serial_number($PDOdb, GETPOST('term')), 'json');
            break;
        case 'autocomplete_asset':
            __out(_autocomplete_asset($PDOdb, GETPOST('lot_number'), GETPOST('productid')), 'json');
            break;
        case 'autocomplete_lot_number':
            __out(_autocomplete_lot_number($PDOdb, GETPOST('productid')), 'json');
            break;
    }
}
function traite_get(&$PDOdb, $case)
{
    switch (strtolower($case)) {
        case 'autocomplete':
            __out(_autocomplete($PDOdb, GETPOST('fieldcode'), GETPOST('term'), GETPOST('fk_product'), GETPOST('type_product')));
            break;
        case 'autocomplete-serial':
            __out(_autocompleteSerial($PDOdb, GETPOST('lot_number'), GETPOST('fk_product')));
            break;
        case 'addofproduct':
            __out(_addofproduct($PDOdb, GETPOST('id_assetOf'), GETPOST('fk_product'), GETPOST('type'), GETPOST('default_qty_to_make', 'int') ? GETPOST('default_qty_to_make', 'int') : 1));
            break;
        case 'deletelineof':
            __out(_deletelineof($PDOdb, GETPOST('idLine'), GETPOST('type')), 'json');
            break;
        case 'addlines':
            __out(_addlines($PDOdb, GETPOST('idLine'), GETPOST('qty')), GETPOST('type'));
            break;
        case 'addofworkstation':
            __out(_addofworkstation($PDOdb, GETPOST('id_assetOf'), GETPOST('fk_asset_workstation')));
            break;
        case 'deleteofworkstation':
            __out(_deleteofworkstation($PDOdb, GETPOST('id_assetOf'), GETPOST('fk_asset_workstation_of')));
            break;
        case 'measuringunits':
            __out(_measuringUnits(GETPOST('type'), GETPOST('name')), 'json');
            break;
        case 'getofchildid':
            $Tid = array();
            $assetOf = new TAssetOF();
            $assetOf->load($PDOdb, __get('id', 0, 'integer'));
            $assetOf->getListeOFEnfants($PDOdb, $Tid);
            __out($Tid);
            break;
        case 'getchildlisthtml':
            $Tid = array();
            $assetOf = new TAssetOF();
            $assetOf->load($PDOdb, __get('id', 0, 'integer'));
            $assetOf->getListeOFEnfants($PDOdb, $Tid);
            echo _listOFEnfantHtml($PDOdb, $Tid);
            break;
        case 'getnomenclatures':
            __out(_getNomenclatures($PDOdb, GETPOST('fk_product')), 'json');
            break;
        case 'validernomenclature':
            __out(_validerNomenclature($PDOdb, GETPOST('id_assetOF'), GETPOST('fk_product'), GETPOST('fk_of_line'), GETPOST('fk_nomenclature'), GETPOST('qty')));
            break;
    }
}
<?php

require '../config.php';
$get = GETPOST('get');
switch ($get) {
    case 'search':
        __out(_search(GETPOST('key')), 'json');
        break;
    default:
        break;
}
function _search($keyword)
{
    global $db, $conf, $langs;
    $Tab = array();
    $TType = array('invoice', 'commande', 'propal', 'projet', 'task', 'company', 'contact', 'event', 'product', 'facture_fournisseur', 'commande_fournisseur', 'fichinter');
    if (!empty($conf->of->enabled)) {
        $TType[] = 'ordre_fabrication';
    }
    //$TType=array('facture_fournisseur', 'commande_fournisseur');
    foreach ($TType as $type) {
        $Tab[$type] = _search_type($type, $keyword);
    }
    return $Tab;
}
function _search_type($type, $keyword)
{
    global $db, $conf, $langs;
    $table = MAIN_DB_PREFIX . $type;
    $objname = ucfirst($type);
    $id_field = 'rowid';
$put = GETPOST('put');
switch ($get) {
    case 'search-user':
        __out(_search_user(GETPOST('q')), 'json');
        break;
    case 'search-tag':
        __out(_search_tag(GETPOST('q')), 'json');
        break;
    case 'search-element':
        __out(_search_element(GETPOST('q')), 'json');
        break;
    case 'comments':
        print _comments(GETPOST('id'), GETPOST('ref'), GETPOST('element'));
        break;
    case 'graph':
        __out(_graph(GETPOST('id'), GETPOST('ref'), GETPOST('element')), 'json');
        break;
}
switch ($put) {
    case 'comment':
        print _comment(GETPOST('id'), GETPOST('ref'), GETPOST('element'), GETPOST('comment'));
        break;
}
function _graph($fk_object, $ref, $element)
{
    $TLink = array();
    TTwiiit::getLinkFor($TLink, $fk_object, $element, TTwiiit::getTag($element, $ref));
    return $TLink;
}
function _comment($fk_object, $ref, $element, $comment)
{
        /*
        		if(!empty($year)) {
        
        			if(!empty($day)) {
        				$start = $year.'-'.$month.'-'.$day;
        				$end = $year.'-'.$month.'-'.$day;
        			}
        			else{
        				$start = $year.'-'.$month.'-01';
        				$end = $year.'-'.$month.'-31';
        			}
        
        		}
        */
        $TEvent = _events($start, $end);
        __out($TEvent, 'json');
        break;
    default:
        break;
}
switch ($put) {
    case 'event-move':
        $a = new ActionComm($db);
        if ($a->fetch(GETPOST('id')) > 0) {
            $a->fetch_userassigned();
            $TData = $_REQUEST['data'];
            if (!empty($TData['minutes'])) {
                $a->datep = strtotime($TData['minutes'] . ' minute', $a->datep);
                $a->datef = strtotime($TData['minutes'] . ' minute', $a->datef);
            }
            if (!empty($TData['hours'])) {
<?php

require '../config.php';
dol_include_once('/comm/propal/class/propal.class.php');
dol_include_once('/compta/facture/class/facture.class.php');
dol_include_once('/commande/class/commande.class.php');
$put = GETPOST('put');
switch ($put) {
    case 'price':
        $Tab = _updateLine(GETPOST('objectid'), GETPOST('objectelement'), GETPOST('lineid'), GETPOST('column'), GETPOST('value'));
        __out($Tab, 'json');
        break;
}
function _updateLine($objectid, $objectelement, $lineid, $column, $value)
{
    global $db, $conf, $langs;
    ${$column} = price2num($value);
    $Tab = array();
    $o = new $objectelement($db);
    $o->fetch($objectid);
    $find = false;
    foreach ($o->lines as &$line) {
        if ($line->id == $lineid || $line->rowid == $lineid) {
            $find = true;
            break;
        }
    }
    if ($find) {
        if (is_null($qty)) {
            $qty = $line->qty;
        }
<?php

define('INC_FROM_CRON_SCRIPT', true);
require 'config.php';
set_time_limit(0);
ini_set('memory_limit', '128M');
dol_include_once('/query/class/query.class.php');
$PDOdb = new TPDOdb();
$query = new TQuery();
if ($query->loadBy($PDOdb, GETPOST('uid'), 'uid')) {
    $query->type = 'RAW';
    $Tab = $query->run();
    __out($Tab['champs'], 'json');
} else {
    exit('InvalidUID');
}
require '../config.php';
dol_include_once('/query/class/query.class.php');
dol_include_once('/query/class/dashboard.class.php');
$PDOdb = new TPDOdb();
$get = GETPOST('get');
$put = GETPOST('put');
switch ($get) {
    case 'tables':
        $query = new TQuery();
        $query->load($PDOdb, GETPOST('id'));
        __out(TQuery::getTables($query->pdodb), 'json');
        break;
    case 'fields':
        $query = new TQuery();
        $query->load($PDOdb, GETPOST('id'));
        __out(TQuery::getFields($query->pdodb, GETPOST('table')), 'json');
        break;
    default:
        break;
}
switch ($put) {
    case 'query':
        $query = new TQuery();
        $query->load($PDOdb, GETPOST('id'));
        $query->set_values($_REQUEST);
        $query->THide = GETPOST('THide');
        $query->TOperator = GETPOST('TOperator');
        $query->TGroup = GETPOST('TGroup');
        $query->TFunction = GETPOST('TFunction');
        $query->TValue = GETPOST('TValue');
        $query->TNull = GETPOST('TNull');