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); }