function createTask(&$PDOdb, &$db, &$conf, &$user, &$OF)
 {
     //l'ajout de poste de travail à un OF en ajax n'initialise pas le $user
     if (!$user->id) {
         $user->id = GETPOST('user_id');
     }
     $ws = new TAssetWorkstation();
     $ws->load($PDOdb, $this->fk_asset_workstation);
     $class_mod = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
     $modTask = new $class_mod();
     $projectTask = new Task($db);
     $projectTask->fk_project = $OF->fk_project;
     $projectTask->ref = $modTask->getNextValue(0, $projectTask);
     $projectTask->label = $ws->libelle;
     if (!empty($conf->global->ASSET_TASK_HIERARCHIQUE_BY_RANK)) {
         $PDOdb->Execute("SELECT MAX(t.rowid) as rowid\n            FROM " . MAIN_DB_PREFIX . "projet_task t LEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (t.rowid=tex.fk_object)\n            WHERE t.fk_projet=" . $this->of_fk_project . " AND tex.fk_of=" . $this->fk_assetOf);
         $PDOdb->Get_line();
         $projectTask->fk_task_parent = (int) $PDOdb->Get_field('rowid');
     } else {
         $projectTask->fk_task_parent = 0;
     }
     $projectTask->date_start = strtotime(' +' . (int) $this->nb_days_before_beginning . 'days', $OF->date_lancement);
     $projectTask->date_end = $OF->date_besoin;
     if ($projectTask->date_end < $projectTask->date_start) {
         $projectTask->date_end = $projectTask->date_start;
     }
     $projectTask->planned_workload = $this->nb_hour * 3600;
     $projectTask->array_options['options_grid_use'] = 1;
     $projectTask->array_options['options_fk_workstation'] = $ws->getId();
     $projectTask->array_options['options_fk_of'] = $this->fk_assetOf;
     $p = new Product($db);
     $line_product_to_make = $OF->getLineProductToMake();
     if (!empty($line_product_to_make) && $p->fetch($line_product_to_make->fk_product) > 0) {
         $projectTask->array_options['options_fk_product'] = $p->id;
     }
     $res = $projectTask->create($user);
     if ($res < 0) {
         var_dump($projectTask);
         exit('ErrorCreateTaskWS');
     } else {
         $this->fk_project_task = $projectTask->id;
     }
     $this->updateAssociation($PDOdb, $db, $projectTask);
 }