* Script créant et vérifiant que les champs requis s'ajoutent bien * */ if (!defined('INC_FROM_DOLIBARR')) { 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);
function _addlines(&$PDOdb, $idLine, $qty) { global $db, $conf; dol_include_once('product/class/product.class.php'); //On met à jour la 1ère ligne des TO_MAKE $TAssetOFLine = new TAssetOFLine(); //$PDOdb->debug = true; $TAssetOFLine->load($PDOdb, $idLine); $TAssetOFLine->qty = $_REQUEST['qty']; if ($TAssetOFLine->type == 'TO_MAKE') { $TAssetOFLine->qty_needed = $TAssetOFLine->qty_used = $TAssetOFLine->qty; } $TAssetOFLine->save($PDOdb); //On charge l'OF pour pouvoir parcourir ses lignes et mettre à jour les quantités $TAssetOF = new TAssetOF(); $TAssetOF->load($PDOdb, $TAssetOFLine->fk_assetOf); //Id des lignes modifiés $TIdLineModified = array($TAssetOFLine->fk_assetOf); //Id des nouveaux OF créés $TNewIdAssetOF = array(); _updateNeeded($TAssetOF, $PDOdb, $db, $conf, $TAssetOFLine->fk_product, $_REQUEST['qty'], $TIdLineModified, $TNewIdAssetOF, $TAssetOFLine); return array($TIdLineModified, $TNewIdAssetOF); }