Commit 35d4b8be authored by THEO GUILLON's avatar THEO GUILLON

Merge branch '380-pb-de-generation-au-format-csv' into '2.0.0'

Resolve "Pb de génération au format csv"

See merge request libriciel/pole-citoyens/web-DPO/web-DPO!445
parents e9ab755f 565194a1
......@@ -2085,7 +2085,7 @@ class FichesController extends AppController
// On verifie si le dossier file existe. Si c'est pas le cas on le cree
create_arborescence_files();
$date = date("Y-m-d_H:i:s");
$date = date("Y-m-d_H-i-s");
if (!file_exists(CHEMIN_EXPORTS . $date)) {
mkdir(CHEMIN_EXPORTS . $date, 0777, true);
}
......
......@@ -478,7 +478,7 @@
<script type="text/javascript">
//<![CDATA[
var currentTraitementId = 0;
let currentTraitementId = 0;
$(document).ready(function () {
......@@ -536,7 +536,7 @@
return;
}
var action = element.selected;
let action = element.selected;
// $('.extraitRegistreCheckbox')
// .attr('disabled', true)
......@@ -591,13 +591,14 @@
* @param {int} numSelected
* @returns {Array|createOption.optionPosition}
*/
function createOption(nbTraitement, numSelected){
var optionPosition = [];
function createOption(nbTraitement, numSelected)
{
let optionPosition = [];
for(var i = 1; i< nbTraitement + 1; i++){
if(i === numSelected){
for (let i = 1; i< nbTraitement + 1; i++) {
if (i === numSelected) {
optionPosition.push('<option value="'+i+'" selected="selected">'+i+'<\/option>');
}else{
} else {
optionPosition.push('<option value="'+i+'">'+i+'<\/option>');
}
}
......@@ -634,11 +635,11 @@
});
$('#modalChangerPosition').on('shown.bs.modal', function () {
var selectedList = [];
var traitement = [];
var nbTraitement = 0;
var oldPosition = 0;
var fichesValid = <?php echo json_encode($fichesValid); ?>;
let selectedList = [],
traitement = [],
nbTraitement = 0,
oldPosition = 0,
fichesValid = <?php echo json_encode($fichesValid); ?>;
$("#render > tbody > tr").remove();
......@@ -650,16 +651,16 @@
nbTraitement = selectedList.length;
for (var key = 0; key < fichesValid.length; key++) {
for (var selectkey = 0; selectkey < nbTraitement; selectkey++) {
for (let key = 0; key < fichesValid.length; key++) {
for (let selectkey = 0; selectkey < nbTraitement; selectkey++) {
if (parseInt(fichesValid[key]['Fiche']['id'], 10) === parseInt(selectedList[selectkey], 10)) {
traitement.push(fichesValid[key]);
}
}
}
for (var key = 0; key < nbTraitement; key++) {
var tr = $('<tr id="'+selectedList[key]+'"><\/tr>')
for (let key = 0; key < nbTraitement; key++) {
let tr = $('<tr id="'+selectedList[key]+'"><\/tr>')
.append('<td class="col-md-1"><select class="form-control optionSelected" required="required">' + createOption(nbTraitement, key+1) + '<\/select><\/td>')
.append('<td class="col-md-1 tdleft">'+traitement[key]['Fiche']['numero']+'<\/td>')
.append('<td class="col-md-3 tdleft">'+traitement[key]['Fiche']['Valeur']['outilnom']+'<\/td>')
......@@ -672,10 +673,10 @@
});
$(".optionSelected").change(function () {
var newPosition = parseInt($(this).val(), 10);
var row = $(this).closest("tr");
var table = $('#render > tbody');
var nRow = table.children('tr').eq(newPosition-1);
let newPosition = parseInt($(this).val(), 10),
row = $(this).closest("tr"),
table = $('#render > tbody'),
nRow = table.children('tr').eq(newPosition-1);
if (oldPosition !== newPosition){
if (oldPosition > newPosition) {
......@@ -690,89 +691,55 @@
});
function reordonnerPosition(){
var table = $('#render > tbody');
var nbRow = table.children('tr').length;
function reordonnerPosition()
{
let table = $('#render > tbody'),
nbRow = table.children('tr').length;
for (var i = 0; i < nbRow; i++) {
var newValue = i + 1;
var nRow = table.children('tr').eq(i);
var row = nRow.children('td').children('select');
for (let i = 0; i < nbRow; i++) {
let newValue = i + 1,
nRow = table.children('tr').eq(i),
row = nRow.children('td').children('select');
row.val(newValue).attr('selected', true);
}
}
function sendDataExtrait() {
var url = "<?php echo Router::url(['controller' => 'fiches', 'action' => 'genereExtraitRegistre']); ?>";
var selectedList = [];
var table = $('#render > tbody');
var nbRow = table.children('tr').length;
for (var i = 0; i < nbRow; i++) {
var nRow = table.children('tr').eq(i);
var idRow = nRow.attr('id');
selectedList.push(idRow);
}
url = url + '/' + JSON.stringify(selectedList);
window.location.href = url;
function sendDataExtrait()
{
window.location.href = send("<?php echo Router::url(['controller' => 'fiches', 'action' => 'genereExtraitRegistre']); ?>");
}
function sendData() {
var url = "<?php echo Router::url(['controller' => 'registres', 'action' => 'imprimer']); ?>";
var selectedList = [];
var table = $('#render > tbody');
var nbRow = table.children('tr').length;
for (var i = 0; i < nbRow; i++) {
var nRow = table.children('tr').eq(i);
var idRow = nRow.attr('id');
selectedList.push(idRow);
}
url = url + '/' + JSON.stringify(selectedList);
window.location.href = url;
function sendData()
{
window.location.href = send("<?php echo Router::url(['controller' => 'registres', 'action' => 'imprimer']); ?>");
}
function sendDataDeclaration() {
var url = "<?php echo Router::url(['controller' => 'fiches', 'action' => 'genereTraitementNonVerrouiller']); ?>";
var selectedList = [];
var table = $('#render > tbody');
var nbRow = table.children('tr').length;
for (var i = 0; i < nbRow; i++) {
var nRow = table.children('tr').eq(i);
var idRow = nRow.attr('id');
selectedList.push(idRow);
}
url = url + '/' + JSON.stringify(selectedList);
window.location.href = url;
function sendDataDeclaration()
{
window.location.href = send("<?php echo Router::url(['controller' => 'fiches', 'action' => 'genereTraitementNonVerrouiller']); ?>");
}
function sendDataExport() {
var url = "<?php echo Router::url(['controller' => 'fiches', 'action' => 'export']); ?>";
var selectedList = [];
function sendDataExport()
{
window.location.href = send("<?php echo Router::url(['controller' => 'fiches', 'action' => 'export']); ?>");
}
function send (url)
{
let selectedList = [],
table = $('#render > tbody'),
nbRow = table.children('tr').length;
for (let i = 0; i < nbRow; i++) {
let nRow = table.children('tr').eq(i),
idRow = nRow.attr('id');
var table = $('#render > tbody');
var nbRow = table.children('tr').length;
for (var i = 0; i < nbRow; i++) {
var nRow = table.children('tr').eq(i);
var idRow = nRow.attr('id');
selectedList.push(idRow);
}
url = url + '/' + JSON.stringify(selectedList);
window.location.href = url;
return (url + '/' + JSON.stringify(selectedList));
}
//]]>
</script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment