function getControlPDF(&$PDOdb)
 {
     $res = array();
     foreach ($this->TAssetOFControl as $ofControl) {
         $control = new TAssetControl();
         $control->load($PDOdb, $ofControl->fk_control);
         switch ($control->type) {
             case 'text':
             case 'num':
                 $res[] = array('question' => utf8_decode($control->question), 'response' => $ofControl->response);
                 break;
             case 'checkbox':
                 $res[] = array('question' => utf8_decode($control->question), 'response' => $ofControl->response ? 'Oui' : 'Non');
                 break;
             case 'checkboxmultiple':
                 $res2 = '';
                 foreach ($control->TAssetControlMultiple as $controlVal) {
                     $res2 .= $controlVal->value . ', ';
                 }
                 $res[] = array('question' => utf8_decode($control->question), 'response' => rtrim($res2, ', '));
                 break;
         }
     }
     return $res;
 }
    define('INC_FROM_CRON_SCRIPT', true);
    require '../config.php';
    $ATMdb = new TPDOdb();
    $ATMdb->debug = true;
} else {
    $ATMdb = new TPDOdb();
}
global $db;
dol_include_once('/of/class/ordre_fabrication_asset.class.php');
$o = new TAssetOF();
$o->init_db_by_vars($ATMdb);
$o = new TAssetOFLine();
$o->init_db_by_vars($ATMdb);
if (class_exists('TWorkstation')) {
    $o = new TAssetWorkstation();
    $o->init_db_by_vars($ATMdb);
} else {
    exit($langs->trans("moduleWorkstationNeeded") . ' : <a href="https://github.com/ATM-Consulting/dolibarr_module_workstation" target="_blank">' . $langs->trans('DownloadModule') . '</a>');
}
$o = new TAssetWorkstationOF();
$o->init_db_by_vars($ATMdb);
$o = new TAssetWorkstationProduct();
$o->init_db_by_vars($ATMdb);
$o = new TAssetControl();
$o->init_db_by_vars($ATMdb);
$o = new TAssetControlMultiple();
$o->init_db_by_vars($ATMdb);
$o = new TAssetOFControl();
$o->init_db_by_vars($ATMdb);
$o = new TAssetWorkstationTask();
$o->init_db_by_vars($ATMdb);
    case 'deleteValue':
        $control = new TAssetControl();
        $control->load($ATMdb, $id);
        if ($control->removeChild('TAssetControlMultiple', __get('id_value', 0, 'integer'))) {
            $control->save($ATMdb);
            setEventMessage($langs->trans('AssetMsgDeleteControlValue'));
        } else {
            setEventMessage($langs->trans('AssetErrDeleteControlValue'));
        }
        _fiche($ATMdb, $control, 'view');
        break;
    default:
        if ($id <= 0) {
            header('Location: ' . DOL_MAIN_URL_ROOT . '/custom/asset/list_control.php');
        }
        $control = new TAssetControl();
        $control->load($ATMdb, $id);
        _fiche($ATMdb, $control, 'view');
        break;
}
function _fiche(&$ATMdb, &$control, $mode = 'view', $editValue = false)
{
    global $db, $langs;
    llxHeader('', $langs->trans('AssetAddControl'), '', '');
    $TBS = new TTemplateTBS();
    $form = new TFormCore();
    $form->Set_typeaff($mode);
    $TForm = array('id' => $control->getId(), 'libelle' => $form->texte('', 'libelle', $control->libelle, 50, 255), 'type' => $form->combo('', 'type', TAssetControl::$TType, $control->type), 'question' => $form->texte('', 'question', $control->question, 120, 255));
    $TFormVal = _fiche_value($ATMdb, $editValue);
    $TVal = _liste_valeur($ATMdb, $control->getId(), $control->type);
    print $TBS->render('./tpl/control.tpl.php', array('TVal' => $TVal), array('co' => $TForm, 'FormVal' => $TFormVal, 'view' => array('mode' => $mode, 'editValue' => $editValue, 'type' => $control->type, 'url' => dol_buildpath('/of/control.php', 1))));