function production_batterie() { if (isset($_GET['id'])) { $id = $_GET['id']; } if (isset($_POST['id_batterie'])) { $id = $_POST['id_batterie']; } if (is_current_version_test($id, $_POST['revision'])) { $page['batterie'] = get_batterie($id); //on recupere la liste des batteries $page['batterie'] = $page['batterie'][0]; //on prend la premiere valeur du tableau recuperé //on peut archiver une batterie uniquement si son etat est different de 4 if ($page['batterie']['id_etat'] == 2) { set_batterie_to_production($id); } header("Location: index.php?controleur=batterie_test&tache=base"); } else { header("Location: index.php?controleur=batterie_test&tache=visualiser_batterie&id=" . $id . "&message=batterie_outdated"); } }
function production_test() { global $message; global $page; //passage en prod si etat 2 + popup + item en prod $page['vue'] = "tests/test.vue.php"; $page['colonne'] = "tests/sidebar_test.vue.php"; $page['tests'] = liste_test(); $page['sphere'] = liste_sphere(); $page['facteur'] = liste_facteur(); $page['lieu'] = liste_lieux_auteur(); $page['projet'] = liste_projet(); if (isset($_GET['id'])) { $id = $_GET['id']; } if (isset($_POST['id_test'])) { $id = $_POST['id_test']; } $page['gabarit'] = "administration"; $page['test'] = get_test($id); $page['test'] = $page['test'][0]; $page['test']['id_test'] = $id; $page['etat'] = liste_etat(); if (has_reponse_test($id)) { $page['message_info'] = $message['info_test_prod']; } if (isset($_POST['prod'])) { $page['test'] = get_test($id); $page['test'] = $page['test'][0]; if (is_current_version_test($id, $_POST['revision'])) { if ($_POST['code_test'] != "" && $_POST['libelle_long_test'] != "" && $_POST['version_test'] != "") { if ($page['test']['id_etat'] == 2) { if (has_reponse_test($id)) { /*duplication: la source passe en archive et le nouveau passe en production*/ $new_id = dupliquation_test_prod($_POST['id_test'], $_POST['code_test'], $_POST['libelle_long_test'], $_POST['version_test']); if ($new_id != false) { $page['test']['contenu_test'] = get_contenu_test($_POST['id_test']); foreach ($page['test']['contenu_test'] as $key => $content) { if ($content['type'] == 'item') { set_item_to_archive($content['id_element']); } else { $section = get_section($content['id_element']); foreach ($section[0] as $k => $v) { $items = get_item_by_section($content['id_element']); foreach ($items as $it) { set_item_to_archive($it['id_item']); } } } } set_test_to_archive($id); header("Location: index.php?controleur=test&tache=visualiser_test&id=" . $new_id); } else { $page['message'] = $message['test_existe'] . "<br/> Merci de les modifier pour le passage en production"; } } else { $mprod = set_test_to_production($id, $_POST['code_test'], $_POST['libelle_long_test'], $_POST['version_test']); if (mprod) { $page['test']['contenu_test'] = get_contenu_test($_POST['id_test']); foreach ($page['test']['contenu_test'] as $key => $content) { if ($content['type'] == 'item') { set_item_to_production($content['id_element']); } else { $section = get_section($content['id_element']); foreach ($section[0] as $k => $v) { $items = get_item_by_section($content['id_element']); foreach ($items as $it) { set_item_to_production($it['id_item']); } } } } header("Location: index.php?controleur=test&tache=visualiser_test&id=" . $id); } else { $page['message'] = $message['test_existe'] . "<br/> Merci de les modifier pour le passage en production"; } } } } else { $page['message'] = $message['champs_obligatoire_2']; } } else { header("Location: index.php?controleur=test&tache=visualiser_test&id=" . $id . "&message=outdated_test"); } } }