43 |
|
|
44 |
foreach ($donnees as $value) { |
foreach ($donnees as $value) { |
45 |
|
|
46 |
$sql = "SELECT delai FROM service WHERE service = $value[0]"; |
$sql = "SELECT delai, type_consultation FROM ".DB_PREFIXE."service WHERE service = $value[0]"; |
47 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
48 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
49 |
$row=& $res->fetchRow(); |
$row=& $res->fetchRow(); |
50 |
$delai = $row[0]; |
$delai = $row[0]; |
51 |
|
$type_consultation = $row[1]; |
52 |
|
|
53 |
/*Calcul du delai de retour*/ |
/*Calcul du delai de retour*/ |
54 |
$date_envoi_temp = $om_dbform->datePHP($date_envoi); |
$date_envoi_temp = $om_dbform->datePHP($date_envoi); |
55 |
$delai = $om_dbform->dateDB($consultation->moisdate($date_envoi_temp, $delai)); |
$delai = $om_dbform->dateDB($consultation->moisdate($date_envoi_temp, $delai)); |
73 |
|
|
74 |
/*Comptage du nombre de consultations papier demandées et récupération des ids des PDFs à éditer*/ |
/*Comptage du nombre de consultations papier demandées et récupération des ids des PDFs à éditer*/ |
75 |
if ($value[1]==1){ |
if ($value[1]==1){ |
76 |
$idxConsultations[] = $consultation->valF['consultation']; |
$idxConsultations[] = $consultation->valF['consultation']; |
77 |
|
$objConsultations[] = $type_consultation; |
78 |
$nbConsPap++; |
$nbConsPap++; |
79 |
} |
} |
80 |
} |
} |
82 |
/*Génération du PDF*/ |
/*Génération du PDF*/ |
83 |
if ( isset($idxConsultations) && count($idxConsultations) > 0 ){ |
if ( isset($idxConsultations) && count($idxConsultations) > 0 ){ |
84 |
|
|
85 |
$textIdsConsultations = ""; |
$textIdsConsultations = "idx="; |
86 |
foreach ($idxConsultations as $value) |
foreach ($idxConsultations as $value) { |
87 |
$textIdsConsultations .= "&idxConsultations[]=$value"; |
$textIdsConsultations .= $value.";"; |
88 |
|
} |
89 |
|
$textObjConsultations = "obj="; |
90 |
|
foreach ($objConsultations as $value) { |
91 |
|
$textObjConsultations .= "consultation_".$value.";"; |
92 |
|
} |
93 |
echo " |
echo " |
94 |
<script language='javascript' type='text/javascript'> |
<script language='javascript' type='text/javascript'> |
95 |
$.download('../app/pdfetat.php','obj=$obj$textIdsConsultations', 'POST', $obj); |
$.download('../pdf/pdfetat.php?output=download','".$textObjConsultations."&".$textIdsConsultations."', 'POST', 'consultation_avec_avis_attendu'); |
96 |
</script> |
</script> |
97 |
"; |
"; |
98 |
} |
} |
108 |
ser_cat.service_categorie, ser_cat.libelle AS them_lib, |
ser_cat.service_categorie, ser_cat.libelle AS them_lib, |
109 |
ser.service, ser.libelle AS ser_lib, ser.consultation_papier |
ser.service, ser.libelle AS ser_lib, ser.consultation_papier |
110 |
FROM |
FROM |
111 |
public.lien_service_service_categorie lie, |
".DB_PREFIXE."lien_service_service_categorie lie, |
112 |
public.service_categorie ser_cat, |
".DB_PREFIXE."service_categorie ser_cat, |
113 |
public.service ser |
".DB_PREFIXE."service ser |
114 |
WHERE |
WHERE |
115 |
ser_cat.service_categorie = lie.service_categorie AND |
ser_cat.service_categorie = lie.service_categorie AND |
116 |
ser.service = lie.service AND |
ser.service = lie.service AND |
117 |
( |
( |
118 |
ser.om_validite_fin <= CURRENT_DATE OR |
(ser.om_validite_debut IS NULL |
119 |
ser.om_validite_fin IS NULL |
AND (ser.om_validite_fin IS NULL |
120 |
|
OR ser.om_validite_fin > CURRENT_DATE)) |
121 |
|
OR |
122 |
|
(ser.om_validite_debut <= CURRENT_DATE |
123 |
|
AND (ser.om_validite_fin IS NULL |
124 |
|
OR ser.om_validite_fin > CURRENT_DATE)) |
125 |
) |
) |
126 |
|
ORDER BY them_lib, ser_lib |
127 |
"; |
"; |
128 |
|
|
129 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
130 |
|
$f->addToLog("app/consultation_multiple.php: db->query(\"".$sql."\")", VERBOSE_MODE); |
131 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
132 |
|
|
133 |
$temp_ser_cat = 0; |
$temp_ser_cat = 0; |
134 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
135 |
$name = $row['service_categorie'].'_'. |
$name = $row['service_categorie'].'_'. |
136 |
$row['service'].'_'. |
$row['service'].'_'. |
137 |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '0' : '1' ).'_'; |
138 |
/*On change de thématique, donc rajoute le nom de la thématique*/ |
/*On change de thématique, donc rajoute le nom de la thématique*/ |
139 |
if ( $temp_ser_cat != $row['service_categorie'] ){ |
if ( $temp_ser_cat != $row['service_categorie'] ){ |
140 |
|
|
144 |
$row['them_lib']. |
$row['them_lib']. |
145 |
'</div> |
'</div> |
146 |
<div |
<div |
147 |
class="liste_gauche_service '.$name.'" |
class="liste_gauche_service t'.$name.'" |
148 |
id="'.$name.'" > |
id="t'.$name.'" > |
149 |
'.$row['ser_lib'].' |
'.$row['ser_lib'].' |
150 |
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '' : 'checked="checked"' ).'/> |
151 |
</div> |
</div> |
152 |
'; |
'; |
153 |
} |
} |
157 |
|
|
158 |
$liste_gauche .= ' |
$liste_gauche .= ' |
159 |
<div |
<div |
160 |
class="liste_gauche_service '.$name.'" |
class="liste_gauche_service t'.$name.'" |
161 |
id="'.$name.'" > |
id="t'.$name.'" > |
162 |
'.$row['ser_lib'].' |
'.$row['ser_lib'].' |
163 |
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '' : 'checked="checked"' ).'/> |
164 |
</div> |
</div> |
165 |
'; |
'; |
166 |
} |
} |
170 |
/*Requête qui récupère les services qui ne sont pas dans une thématique*/ |
/*Requête qui récupère les services qui ne sont pas dans une thématique*/ |
171 |
$sql = |
$sql = |
172 |
"SELECT service, libelle, consultation_papier |
"SELECT service, libelle, consultation_papier |
173 |
FROM public.service |
FROM ".DB_PREFIXE."service |
174 |
WHERE service NOT IN |
WHERE service NOT IN |
175 |
( |
( |
176 |
SELECT service |
SELECT service |
177 |
FROM lien_service_service_categorie |
FROM ".DB_PREFIXE."lien_service_service_categorie |
178 |
) |
) |
179 |
AND |
AND |
180 |
( |
( |
185 |
|
|
186 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
187 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
188 |
|
|
189 |
if ( $res->numrows() > 0 ) |
if ( $res->numrows() > 0 ) |
190 |
$liste_gauche .= ' |
$liste_gauche .= ' |
191 |
<div id="them_0" class="liste_gauche_them">Autres</div>'; |
<div id="them_0" class="liste_gauche_them">Autres</div>'; |
192 |
|
|
193 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
194 |
|
|
195 |
/*Ajout de tous les services qui n'ont pas de thématique*/ |
/*Ajout de tous les services qui n'ont pas de thématique*/ |
196 |
$name = '0_'. |
$name = '0_'. |
197 |
$row['service'].'_'. |
$row['service'].'_'. |
198 |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '0' : '1' ).'_'; |
199 |
$liste_gauche .= ' |
$liste_gauche .= ' |
200 |
<div |
<div |
201 |
class="liste_gauche_service '.$name.'" |
class="liste_gauche_service t'.$name.'" |
202 |
id="'.$name.'" > |
id="t'.$name.'" > |
203 |
'.$row['libelle'].' |
'.$row['libelle'].' |
204 |
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '' : 'checked="checked"' ).'/> |
205 |
</div> |
</div> |
206 |
'; |
'; |
207 |
} |
} |
218 |
echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;" |
echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;" |
219 |
method="get" action="" name="f2" id="form_val">'; |
method="get" action="" name="f2" id="form_val">'; |
220 |
echo '<div class="formEntete ui-corner-all">'; |
echo '<div class="formEntete ui-corner-all">'; |
221 |
echo "<div id='form-content'>"; |
echo "<div>"; |
222 |
echo '<div class="bloc">'; |
echo '<div class="bloc">'; |
223 |
echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n"; |
echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n"; |
224 |
echo "\t<legend class='ui-corner-all ui-widget-content ui-state-active'>". |
echo "\t<legend class='ui-corner-all ui-widget-content ui-state-active'>". |
232 |
echo '</label>'; |
echo '</label>'; |
233 |
echo '</div>'; |
echo '</div>'; |
234 |
echo '<div class="form-content">'; |
echo '<div class="form-content">'; |
235 |
echo '<input id="dossier" class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier"/>'; |
echo '<input class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier"/>'; |
236 |
echo $idx; |
echo $idx; |
237 |
echo '</div>'; |
echo '</div>'; |
238 |
echo '</div>'; |
echo '</div>'; |
253 |
echo '</div>'; |
echo '</div>'; |
254 |
echo '<div class="list-sel-ser-them">'; |
echo '<div class="list-sel-ser-them">'; |
255 |
echo '<div class=\'row\'>'; |
echo '<div class=\'row\'>'; |
256 |
echo '<div class=\'cell1 liste_gauche_them\' id=\'list-sel-ser-them-title\'>'._('Service a consulter').'</div>'; |
echo '<div class=\'cell1 liste_droite_title list-sel-ser-them-title\'>'._('Service a consulter').'</div>'; |
257 |
echo '<div class=\'cell2 liste_gauche_them\' id=\'list-sel-ser-them-title\'>'._('Version papier').'</div>'; |
echo '<div class=\'cell2 liste_droite_title list-sel-ser-them-title\'>'._('Version papier').'</div>'; |
258 |
echo '</div>'; |
echo '</div>'; |
259 |
echo '</div>'; |
echo '</div>'; |
260 |
echo '</div>'; |
echo '</div>'; |
282 |
echo '<input class="om-button ui-button ui-widget ui-state-default ui-corner-all" |
echo '<input class="om-button ui-button ui-widget ui-state-default ui-corner-all" |
283 |
type="button" onclick="if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { ajaxIt(\'consultation\', \'../app/consultation_multiple.php\'); } else alert(\'Veuillez choisir au moins un service et une date d envoi\');" |
type="button" onclick="if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { ajaxIt(\'consultation\', \'../app/consultation_multiple.php\'); } else alert(\'Veuillez choisir au moins un service et une date d envoi\');" |
284 |
value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'" |
value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'" |
285 |
role="button" aria-disabled="false" id="button_val">'; |
id="button_val">'; |
286 |
echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj='.$obj.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idx.'&premier=0&tricol=\');" |
echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj='.$obj.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idx.'&premier=0&tricol=\');" |
287 |
href="#">'; |
href="#">'; |
288 |
echo 'Retour'; |
echo 'Retour'; |
294 |
echo " |
echo " |
295 |
<script language='javascript' type='text/javascript'> |
<script language='javascript' type='text/javascript'> |
296 |
$(function(){ |
$(function(){ |
297 |
|
|
298 |
/* |
/* |
299 |
Sélectionne tous les services d'un thème au clique sur celui ci. |
Sélectionne tous les services d'un thème au clique sur celui ci. |
300 |
*/ |
*/ |
309 |
function() { |
function() { |
310 |
|
|
311 |
if ( $(this).attr('id').indexOf('them') == -1 && |
if ( $(this).attr('id').indexOf('them') == -1 && |
312 |
$(this).attr('id').indexOf(id) == 0 && |
$(this).attr('id').indexOf(id) == 1 && |
313 |
$(this).hasClass('liste_gauche_service_selected') ) |
$(this).hasClass('liste_gauche_service_selected') ) |
314 |
|
|
315 |
numSerWithClass++; |
numSerWithClass++; |
316 |
|
|
317 |
if ( $(this).attr('id').indexOf('them') == -1 && |
if ( $(this).attr('id').indexOf('them') == -1 && |
318 |
$(this).attr('id').indexOf(id) == 0 ) |
$(this).attr('id').indexOf(id) == 1 ) |
319 |
|
|
320 |
numSer++; |
numSer++; |
321 |
} |
} |
327 |
function() { |
function() { |
328 |
|
|
329 |
if ( $(this).attr('id').indexOf('them') == -1 && |
if ( $(this).attr('id').indexOf('them') == -1 && |
330 |
$(this).attr('id').indexOf(id) == 0 && |
$(this).attr('id').indexOf(id) == 1 && |
331 |
!$(this).hasClass('liste_gauche_service_selected') ) |
!$(this).hasClass('liste_gauche_service_selected') ) |
332 |
|
|
333 |
$(this).addClass('liste_gauche_service_selected'); |
$(this).addClass('liste_gauche_service_selected'); |
341 |
function() { |
function() { |
342 |
|
|
343 |
if ( $(this).attr('id').indexOf('them') == -1 && |
if ( $(this).attr('id').indexOf('them') == -1 && |
344 |
$(this).attr('id').indexOf(id) == 0 && |
$(this).attr('id').indexOf(id) == 1 && |
345 |
$(this).hasClass('liste_gauche_service_selected') ) |
$(this).hasClass('liste_gauche_service_selected') ) |
346 |
|
|
347 |
$(this).removeClass('liste_gauche_service_selected'); |
$(this).removeClass('liste_gauche_service_selected'); |
367 |
'click', |
'click', |
368 |
'.cell1', |
'.cell1', |
369 |
function(){ |
function(){ |
370 |
$(this).parent().toggleClass('liste_droite_service_selected'); |
if ( !$(this).hasClass('liste_droite_title') ) |
371 |
|
$(this).parent().toggleClass('liste_droite_service_selected'); |
372 |
} |
} |
373 |
); |
); |
374 |
|
|
377 |
'input[type=checkbox]', |
'input[type=checkbox]', |
378 |
function(){ |
function(){ |
379 |
|
|
380 |
old_id = $(this).attr('id'); |
old_id = $(this).attr('class'); |
381 |
|
|
382 |
tab_don = old_id.split('_'); |
tab_don = old_id.split('_'); |
383 |
|
|
384 |
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_'; |
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_'; |
385 |
|
|
386 |
changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) ); |
changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) ); |
387 |
$('div[name=\"' + $(this).attr('class') + '\"]').attr('id', new_id); |
$('div[class=\"' + old_id + '\"]').attr('class', new_id); |
388 |
$(this).attr('id', new_id); |
$(this).attr('class', new_id); |
389 |
|
|
390 |
} |
} |
391 |
); |
); |
399 |
$('.liste_gauche_service_selected').each( |
$('.liste_gauche_service_selected').each( |
400 |
function(i) { |
function(i) { |
401 |
|
|
402 |
var id = $(this).attr('id'); |
var name = $(this).attr('name'); |
403 |
|
|
404 |
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
if ( listServ.length > 0 && listServ.indexOf(name.split('_')[1]) != -1 ) |
405 |
return; |
return; |
406 |
listServ[i] = id.split('_')[1]; |
listServ[i] = name.split('_')[1]; |
407 |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ; |
408 |
|
|
409 |
} |
} |
410 |
); |
); |
434 |
$('.liste_droite_service_selected').each( |
$('.liste_droite_service_selected').each( |
435 |
function() { |
function() { |
436 |
|
|
437 |
var id = $('#'+ $(this).attr('id') + ' .cell1 div').attr('id'); |
var name = $('#'+ $(this).attr('id') + ' .cell1 div').attr('name'); |
438 |
|
|
439 |
manageListServ('.list-ser-them div', id, 1); |
manageListServ('.list-ser-them div', name, 1); |
440 |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ; |
441 |
|
|
442 |
$(this).remove(); |
$(this).remove(); |
443 |
} |
} |
459 |
/* |
/* |
460 |
Affiche ou cache un élément qui n'est pas une thématique et dont son identifiant correspond. |
Affiche ou cache un élément qui n'est pas une thématique et dont son identifiant correspond. |
461 |
*/ |
*/ |
462 |
function manageListServ( objet ,id, type){ |
function manageListServ( objet , name, type){ |
463 |
|
|
464 |
$(objet).each( |
$(objet).each( |
465 |
function() { |
function() { |
466 |
|
|
467 |
if ( isNotthemIsOneServ(this, id) ){ |
if ( isNotthemIsOneServ(this, name) ){ |
468 |
if ( type == 0 ) |
if ( type == 0 ) |
469 |
|
|
470 |
$(this).hide() ; |
$(this).hide() ; |
522 |
|
|
523 |
function changeDataLeftColumn(){ |
function changeDataLeftColumn(){ |
524 |
|
|
525 |
|
$('.list-sel-ser-them').empty(); |
526 |
|
$('.list-sel-ser-them').html( |
527 |
|
'<div class=\"row\">' + |
528 |
|
'<div class=\"cell1 liste_droite_title list-sel-ser-them-title\">Service a consulter</div>' + |
529 |
|
'<div class=\"cell2 liste_droite_title list-sel-ser-them-title\">Version papier</div>' + |
530 |
|
'</div>' |
531 |
|
); |
532 |
|
|
533 |
var listServ = new Array(); |
var listServ = new Array(); |
534 |
var data = ''; |
var data = ''; |
535 |
|
|
|
if ( $('.liste_droite_service').length == 0 ){ |
|
|
$('.list-sel-ser-them').empty(); |
|
|
$('.list-sel-ser-them').append(''+ |
|
|
'<div class=\'row\'>'+ |
|
|
'<div class=\'cell1 liste_gauche_them\' id=\'list-sel-ser-them-title\'>"._('Service a consulter')."</div>'+ |
|
|
'<div class=\'cell2 liste_gauche_them\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+ |
|
|
'</div>') ; |
|
|
} |
|
|
|
|
536 |
$('.liste_gauche_service_selected').each( |
$('.liste_gauche_service_selected').each( |
537 |
function(i) { |
function(i) { |
538 |
|
|
|
if ( !$(this).is(':visible') ) |
|
|
return; |
|
|
|
|
539 |
var id = $(this).attr('id'); |
var id = $(this).attr('id'); |
540 |
|
|
541 |
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
if ( $.inArray(id.split('_')[1], listServ) != -1 ) |
542 |
return; |
return; |
543 |
listServ[i] = id.split('_')[1]; |
|
544 |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
545 |
|
listServ[i] = id.split('_')[1]; |
546 |
|
|
547 |
$('.list-sel-ser-them').append( |
$('.list-sel-ser-them').append( |
548 |
'<div class=\'row liste_droite_service\' id=\'' + i + '\'>'+ |
'<div id=\'s' + i + '\' class=\'row liste_droite_service\'>'+ |
549 |
'<div class=\'cell1\'>'+ |
'<div class=\'cell1\'>'+ |
550 |
'<div name=\'' + $(this).attr('id') + '\' id=\'' + $(this).attr('id') + '\'>'+ |
'<div class=\'' + $(this).attr('id') + '\' name=\'' + $(this).attr('id') + '\'>'+ |
551 |
$(this).html().split('<')[0]+ |
$(this).html().split('<')[0]+ |
552 |
'</div>'+ |
'</div>'+ |
553 |
'</div>' + |
'</div>' + |
565 |
|
|
566 |
} |
} |
567 |
); |
); |
|
|
|
568 |
changeActionVal(data); |
changeActionVal(data); |
569 |
} |
} |
570 |
</script>"; |
</script>"; |