} else { if (!empty($conf->global->IMPORTDEVIS_UPDATE_PRODUCT)) { $product->update($product->id, $user); } } //var_dump($product->id); $last_line_product = $product->id; if ($product->id > 0 && !empty($conf->global->CREATE_PRODUCT_FROM_IMPORT)) { $nomenclature = new TNomenclature(); $nomenclature->loadByObjectId($PDOdb, $product->id, 'product'); $nomenclature->deleteChildrenNotImported($PDOdb); } if ($row['fk_propaldet'] > 0) { $last_line_id = $row['fk_propaldet']; $nomenclature = new TNomenclature(); $nomenclature->loadByObjectId($PDOdb, $last_line_id, $object->element); $nomenclature->deleteChildrenNotImported($PDOdb); } else { // var_dump($product->id); if ($doliversion >= 3.8) { if ($row['fk_unit'] == 'none') { $row['fk_unit'] = null; } if ($object->element == 'facture') { $last_line_id = $object->addline($row['label'], $row['price'], $row['qty'], $default_tva, 0, 0, $product->id, 0, '', '', 0, 0, '', 'HT', 0, Facture::TYPE_STANDARD, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $row['fk_unit']); } else { if ($object->element == 'propal') { $last_line_id = $object->addline($row['label'], $row['price'], $row['qty'], $default_tva, 0, 0, $product->id, 0, 'HT', 0, 0, 0, -1, 0, 0, 0, 0, '', '', '', 0, $row['fk_unit']); } else { if ($object->element == 'commande') { $last_line_id = $object->addline($row['label'], $row['price'], $row['qty'], $default_tva, 0, 0, $product->id, 0, 0, 0, 'HT', 0, '', '', 0, -1, 0, 0, null, 0, '', 0, $row['fk_unit']);
function _task_from_line_object(&$PDOdb, &$TLine, $type_object) { $TTask = array(); foreach ($TLine as &$line) { $n = new TNomenclature(); $n->loadByObjectId($PDOdb, $fk_commande, $type_object, true, $line->fk_product, $line->qty); foreach ($n->TNomenclatureWorkstation as &$ws) { $TTask[] = array('status' => 1, 'id' => 1, 'fk_projet' => 1, 'label' => 'Simul', 'ref' => 'TKSIMUL', 'grid_col' => 0, 'grid_row' => 999999, 'fk_workstation' => $ws->fk_workstation, 'fk_product' => $line->fk_product, 'fk_task_parent' => 0, 'needed_ressource' => 1, 'planned_workload' => $ws->nb_hour, 'progress' => 0, 'fk_soc' => 0, 'TUser' => array(), 'date_start' => time(), 'date_end' => 0, 'date_estimated_end' => 0); } } //var_dump($TTask); return $TTask; }