GetAvailableListByCategory(); $csrf_key = 'add_output'; if (f('save') && $form->check($csrf_key) && !$form->hasErrors()) { $output_date_format = date_create_from_format( "d/m/Y", f('entry_date'))->format("Y-m-d"); $output->add([ 'kind' => f('kind'), 'equipment_number' => (int) f('equipment_number'), 'equipment_id' => f('equipment_id'), 'output_date' => $output_date_format, 'additional_comment' => f('additional_comment'), ]); Utils::redirect(PLUGIN_URL . 'entrees/index.php'); } $kinds = $output->listKinds(); $selected_kind = $kinds[0]; $date = new \DateTime; $date->setTimestamp(time()); $default_date = $date; $default_comment = ""; $cancel_link = PLUGIN_URL . 'sorties/index.php'; $legend_part = "en stock disponible"; $tpl_materiel_name = "stock_disponible"; $tpl->assign(compact( 'csrf_key', 'cancel_link', 'legend_part', 'tpl_materiel_name', 'kinds', 'selected_kind', 'default_date', 'default_comment', 'eqmts_by_cat')); $tpl->display(PLUGIN_ROOT . '/templates/sorties/ajouter_sortie.tpl');