1 |
<?php |
<?php |
2 |
|
/** |
3 |
|
* Script personnalisé pour les consultations multiples. |
4 |
|
* |
5 |
|
* @package openfoncier |
6 |
|
* @version SVN : $Id$ |
7 |
|
*/ |
8 |
|
|
9 |
require_once "../obj/utils.class.php"; |
require_once "../obj/utils.class.php"; |
10 |
|
|
11 |
// Identifiant de l'objet metier a copier |
// Identifiant de l'objet metier a copier |
22 |
$f->disableLog(); |
$f->disableLog(); |
23 |
/*Récupération des données et formatage.*/ |
/*Récupération des données et formatage.*/ |
24 |
$donnees_temp = explode(';', $_GET['data']); |
$donnees_temp = explode(';', $_GET['data']); |
25 |
for ( $i = 0 ; $i < count($donnees_temp) - 1 ; $i++ ) |
for ( $i = 1 ; $i < count($donnees_temp) ; $i++ ) |
26 |
$donnees[] = explode('_', $donnees_temp[$i]); |
$donnees[] = explode('_', $donnees_temp[$i]); |
27 |
|
|
28 |
/*Nombre de consultations papier à générer */ |
/* Nombre de consultations papier à générer */ |
29 |
$nbConsPap = 0; |
$nbConsPap = 0; |
30 |
|
|
31 |
/* Ajout des données en base de données |
/* Ajout des données en base de données |
33 |
* 1 : consultation papier {0,1} |
* 1 : consultation papier {0,1} |
34 |
* */ |
* */ |
35 |
if ( isset($donnees) && count($donnees) > 0 ){ |
if ( isset($donnees) && count($donnees) > 0 ){ |
36 |
|
|
37 |
|
require_once "../core/om_dbform.class.php"; |
38 |
|
$om_dbform = new dbForm(); |
39 |
require_once "../obj/consultation.class.php"; |
require_once "../obj/consultation.class.php"; |
40 |
$consultation = new consultation("]",$f->db,DEBUG); |
$consultation = new consultation("]",$f->db,DEBUG); |
41 |
|
|
48 |
$delai = $row[0]; |
$delai = $row[0]; |
49 |
|
|
50 |
/*Calcul du delai de retour*/ |
/*Calcul du delai de retour*/ |
51 |
$date_envoi_temp = explode("/", $date_envoi); |
$date_envoi_temp = $om_dbform->datePHP($date_envoi); |
52 |
$date_envoi_temp = $date_envoi_temp[2]."-".$date_envoi_temp[1]."-".$date_envoi_temp[0]; |
$delai = $om_dbform->dateDB($consultation->moisdate($date_envoi_temp, $delai)); |
|
$delai_temp = explode('-',$consultation->moisdate($date_envoi_temp, $delai)); |
|
|
$delai = $delai_temp[2]."/".$delai_temp[1]."/".$delai_temp[0]; |
|
53 |
|
|
54 |
/*Les données à ajouter*/ |
/*Les données à ajouter*/ |
55 |
$arrayVal = array( |
$arrayVal = array( |
67 |
); |
); |
68 |
|
|
69 |
$consultation->ajouter($arrayVal, $f->db, DEBUG); |
$consultation->ajouter($arrayVal, $f->db, DEBUG); |
70 |
|
|
71 |
/*Génération des PDF + comptage du nombre de consultations papier demandées*/ |
/*Comptage du nombre de consultations papier demandées et récupération des ids des PDFs à éditer*/ |
72 |
if ($value[1]==1){ |
if ($value[1]==1){ |
73 |
|
$idxConsultations[] = $consultation->valF['consultation']; |
74 |
$nbConsPap++; |
$nbConsPap++; |
75 |
} |
} |
76 |
} |
} |
77 |
|
|
78 |
|
/*Génération du PDF*/ |
79 |
|
if ( isset($idxConsultations) && count($idxConsultations) > 0 ){ |
80 |
|
|
81 |
|
$textIdsConsultations = ""; |
82 |
|
foreach ($idxConsultations as $value) |
83 |
|
$textIdsConsultations .= "&idxConsultations[]=$value"; |
84 |
|
|
85 |
|
echo " |
86 |
|
<script> |
87 |
|
$.download('../app/pdfetat.php','obj=$obj$textIdsConsultations', 'POST', $obj); |
88 |
|
</script> |
89 |
|
"; |
90 |
|
} |
91 |
/*Affichage du message d'information*/ |
/*Affichage du message d'information*/ |
92 |
echo '<div class="subtitle">'; |
$f->displayMessage("valid", count($donnees)._(' service(s) sélectionné(s) dont ').$nbConsPap._(' consultation(s) papier.')); |
|
echo '<h3>'; |
|
|
echo _("Application"); |
|
|
echo '<span class="om-icon om-icon-16 om-icon-fix arrow-right-16"></span>'; |
|
|
echo _("consultation"); |
|
|
echo '</h3>'; |
|
|
echo '</div>'; |
|
|
echo '<div class="sformulaire">'; |
|
|
echo'<div class="message ui-widget ui-corner-all ui-state-highlight ui-state-valid"> |
|
|
<p> |
|
|
<span class="ui-icon ui-icon-info"></span> |
|
|
<span class="text"> |
|
|
'.count($donnees).' service(s) sélectionné(s) dont '.$nbConsPap.' consultation(s) papier. |
|
|
</span> |
|
|
</p> |
|
|
</div>'; |
|
|
echo '</div>'; |
|
93 |
} |
} |
94 |
|
|
95 |
} |
} |
129 |
$row['them_lib']. |
$row['them_lib']. |
130 |
'</div> |
'</div> |
131 |
<div |
<div |
132 |
class="liste_gauche_service" |
class="liste_gauche_service '.$name.'" |
133 |
id="'.$name.'" > |
id="'.$name.'" > |
134 |
'.$row['ser_lib'].' |
'.$row['ser_lib'].' |
135 |
<input name="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
136 |
</div> |
</div> |
137 |
'; |
'; |
138 |
} |
} |
142 |
|
|
143 |
$liste_gauche .= ' |
$liste_gauche .= ' |
144 |
<div |
<div |
145 |
class="liste_gauche_service" |
class="liste_gauche_service '.$name.'" |
146 |
id=id="'.$name.'" > |
id="'.$name.'" > |
147 |
'.$row['ser_lib'].' |
'.$row['ser_lib'].' |
148 |
<input name="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
149 |
</div> |
</div> |
150 |
'; |
'; |
151 |
} |
} |
182 |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
183 |
$liste_gauche .= ' |
$liste_gauche .= ' |
184 |
<div |
<div |
185 |
class="liste_gauche_service" |
class="liste_gauche_service '.$name.'" |
186 |
id="'.$name.'" > |
id="'.$name.'" > |
187 |
'.$row['libelle'].' |
'.$row['libelle'].' |
188 |
<input name="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
189 |
</div> |
</div> |
190 |
'; |
'; |
191 |
} |
} |
305 |
/* |
/* |
306 |
Change la class CSS d'un service sur lequel on clique dans la liste de droite. |
Change la class CSS d'un service sur lequel on clique dans la liste de droite. |
307 |
*/ |
*/ |
308 |
$('.liste_droite_service').live( |
$('.field-ser-them').on( |
309 |
'click', |
'click', |
310 |
|
'.liste_droite_service', |
311 |
function(){ |
function(){ |
312 |
$(this).toggleClass('liste_droite_service_selected'); |
$(this).toggleClass('liste_droite_service_selected'); |
313 |
} |
} |
315 |
|
|
316 |
$('.liste_droite_service input[type=checkbox]').live( |
$('.liste_droite_service input[type=checkbox]').live( |
317 |
'click', |
'click', |
318 |
|
'input[type=checkbox]', |
319 |
function(){ |
function(){ |
320 |
old_id = $(this).attr('name'); |
|
321 |
tab_don = $(this).attr('name').split('_'); |
old_id = $(this).attr('id'); |
322 |
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[1] == 0 ) ? 1 : 0 ) + '_'; |
|
323 |
//alert($('#' + old_id+'.cell1').attr('id')); |
tab_don = old_id.split('_'); |
324 |
$(this).attr('name', new_id); |
|
325 |
|
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_'; |
326 |
|
|
327 |
|
changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) ); |
328 |
|
$('div[name=\"' + $(this).attr('class') + '\"]').attr('id', new_id); |
329 |
|
$(this).attr('id', new_id); |
330 |
|
|
331 |
} |
} |
332 |
); |
); |
333 |
|
|
346 |
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
347 |
return; |
return; |
348 |
listServ[i] = id.split('_')[1]; |
listServ[i] = id.split('_')[1]; |
349 |
data += id.split('_')[1] + '_' + id.split('_')[2] + ';'; |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
350 |
|
|
351 |
} |
} |
352 |
); |
); |
379 |
var id = $('#'+ $(this).attr('id') + ' .cell1 div').attr('id'); |
var id = $('#'+ $(this).attr('id') + ' .cell1 div').attr('id'); |
380 |
|
|
381 |
manageListServ('.list-ser-them div', id, 1); |
manageListServ('.list-ser-them div', id, 1); |
382 |
data += id.split('_')[1] + '_' + id.split('_')[2] + ';'; |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
383 |
|
|
384 |
$(this).remove(); |
$(this).remove(); |
385 |
} |
} |
430 |
|
|
431 |
$('#form_val').attr( |
$('#form_val').attr( |
432 |
'onsubmit', |
'onsubmit', |
433 |
'if ( $(\'.liste_gauche_service_selected\').length > 0 ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?data='+data+'&idx=$idx&date_envoi='+date+'\',true);return false;' + |
'if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?obj=$obj&data='+data+'&idx=$idx&date_envoi='+date+'\',true);return false;' + |
434 |
'messageIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\',false);}' |
'messageIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\',false);} else alert(\'Veuillez choisir une service et une date d envoi\');' |
435 |
|
|
436 |
); |
); |
437 |
$('#button_val').attr( |
$('#button_val').attr( |
438 |
'onclick', |
'onclick', |
439 |
'if ( $(\'.liste_gauche_service_selected\').length > 0 ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?data='+data+'&idx=$idx&date_envoi='+date+'\',true);' + |
'if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?obj=$obj&data='+data+'&idx=$idx&date_envoi='+date+'\',true);' + |
440 |
'messageIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\',false);}' |
'messageIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\',false);} else alert(\'Veuillez choisir une service et une date d envoi\');' |
441 |
|
|
442 |
); |
); |
443 |
} |
} |
444 |
|
|
445 |
|
function changeOneData( oldData, newData) { |
446 |
|
|
447 |
|
date = $('#date_envoi').val(); |
448 |
|
|
449 |
|
$('#form_val').attr( |
450 |
|
'onsubmit', |
451 |
|
$('#form_val').attr('onsubmit').replace(oldData,newData) |
452 |
|
); |
453 |
|
$('#button_val').attr( |
454 |
|
'onclick', |
455 |
|
$('#button_val').attr('onclick').replace(oldData,newData) |
456 |
|
); |
457 |
|
} |
458 |
|
|
459 |
function changeDataLeftColumn(){ |
function changeDataLeftColumn(){ |
460 |
$('.list-sel-ser-them').empty(); |
|
461 |
var listServ = new Array(); |
var listServ = new Array(); |
462 |
var data = ''; |
var data = ''; |
463 |
|
|
464 |
|
if ( $('.liste_droite_service').length == 0 ){ |
465 |
|
$('.list-sel-ser-them').empty(); |
466 |
|
$('.list-sel-ser-them').append(''+ |
467 |
|
'<div class=\'row\'>'+ |
468 |
|
'<div class=\'cell1\' id=\'list-sel-ser-them-title\'>"._('Service à consulter')."</div>'+ |
469 |
|
'<div class=\'cell2\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+ |
470 |
|
'</div>') ; |
471 |
|
} |
472 |
|
|
473 |
$('.liste_gauche_service_selected').each( |
$('.liste_gauche_service_selected').each( |
474 |
function(i) { |
function(i) { |
475 |
|
|
476 |
|
if ( !$(this).is(':visible') ) |
477 |
|
return; |
478 |
|
|
479 |
var id = $(this).attr('id'); |
var id = $(this).attr('id'); |
480 |
|
|
|
( i == 0 ) ? |
|
|
$('.list-sel-ser-them').append(''+ |
|
|
'<div class=\'row\'>'+ |
|
|
'<div class=\'cell1\' id=\'list-sel-ser-them-title\'>"._('Service à consulter')."</div>'+ |
|
|
'<div class=\'cell2\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+ |
|
|
'</div>') |
|
|
: '' ; |
|
|
|
|
481 |
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
482 |
return; |
return; |
483 |
listServ[i] = id.split('_')[1]; |
listServ[i] = id.split('_')[1]; |
484 |
data += id.split('_')[1] + '_' + id.split('_')[2] + ';'; |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
485 |
|
|
486 |
$('.list-sel-ser-them').append( |
$('.list-sel-ser-them').append( |
487 |
'<div class=\'row liste_droite_service\' id=\'' + i + '\'>'+ |
'<div class=\'row liste_droite_service\' id=\'' + i + '\'>'+ |
488 |
'<div class=\'cell1\'>'+ |
'<div class=\'cell1\'>'+ |
489 |
'<div id=\'' + $(this).attr('id') + '\'>'+ |
'<div name=\'' + $(this).attr('id') + '\' id=\'' + $(this).attr('id') + '\'>'+ |
490 |
$(this).html().split('<')[0]+ |
$(this).html().split('<')[0]+ |
491 |
'</div>'+ |
'</div>'+ |
492 |
'</div>' + |
'</div>' + |
493 |
'<div class=\'cell2\'>'+ |
'<div class=\'cell2\'>'+ |
494 |
'<div>'+ |
'<div>'+ |
495 |
'<'+$(this).html().split('<')[1]+ |
'<input class=\'' + $(this).attr('id') + '\''+$(this).html().split('<input')[1]+ |
496 |
'</div>'+ |
'</div>'+ |
497 |
'</div>'+ |
'</div>'+ |
498 |
'</div>' |
'</div>' |
509 |
} |
} |
510 |
</script>"; |
</script>"; |
511 |
} |
} |
|
?> |
|
512 |
|
?> |