<?php

if (core::ifPost("from") AND core::getPost("from") == "rh-excel-to-temp") {
    // Nettoyage de la table temporaire des salairés
    salaries::cleanTmp();
    salaries::createTmp(core::getPost("excel"));
    salaries::excelUpdateInProgress(core::getPost("excel"), 1);
    $new_salaries = salaries::getExcelArray(core::getPost("excel"));

    if (isset($new_salaries)) {
        $location = (salaries::update_temp_salaries($new_salaries, core::getPost("excel")) == FALSE) ? "/rh-historique-excel.html" : "/rh-import-to-temp.html";
        salaries::updateInactiveTempSalarie();
    }
    header("Location: " . $location);
    exit();
} else {
    header('HTTP/1.0 401 Unauthorized');
    exit();
}

