--- /dev/null
+<?php
+/*
+This file is part of Variation.
+
+Variation is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Variation is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with Variation. If not, see <http://www.gnu.org/licenses/>.
+--------------------------------------------------------------------------------
+Ce fichier fait partie de Variation.
+
+Variation est un logiciel libre ; vous pouvez le redistribuer ou le modifier
+suivant les termes de la GNU Affero General Public License telle que publiée
+par la Free Software Foundation ; soit la version 3 de la licence, soit
+(à votre gré) toute version ultérieure.
+
+Variation est distribué dans l'espoir qu'il sera utile,
+mais SANS AUCUNE GARANTIE ; sans même la garantie tacite de
+QUALITÉ MARCHANDE ou d'ADÉQUATION à UN BUT PARTICULIER. Consultez la
+GNU Affero General Public License pour plus de détails.
+
+Vous devez avoir reçu une copie de la GNU Affero General Public License
+en même temps que Variation ; si ce n'est pas le cas,
+consultez <http://www.gnu.org/licenses>.
+--------------------------------------------------------------------------------
+Copyright (c) 2014 Kavarna SARL
+*/
+?>
+<?php
+require_once ('../inc/config.inc.php');
+require_once ('../inc/pgprocedures.class.php');
+require_once ('funcs.xmlentities.php');
+$base = new PgProcedures ($pghost, $pguser, $pgpass, $pgbase);
+$cmd = $_SERVER['PHP_SELF'];
+$cmd = basename ($cmd, '.php');
+
+$debug = false;
+
+$ret = $base->get_arguments ($cmd);
+
+if ($debug)
+ print_r ($ret);
+
+if (count ($ret)) {
+ foreach ($ret as $r) {
+ $all = true;
+ foreach ($r['argnames'] as $argname) {
+ if (!isset ($_REQUEST[$argname])) {
+ if ($debug) {
+ echo "$argname non trouve\n" ;
+ print_r ($_REQUEST);
+ }
+ $all = false;
+ break;
+ }
+ }
+ if ($all) {
+ break;
+ }
+
+ }
+}
+
+// Continue, $r contains argnames and argtypes
+//print_r ($r);
+
+$args = array ();
+if ($all) {
+ foreach ($r['argnames'] as $argname) {
+ $a = get_magic_quotes_gpc() ? stripslashes($_REQUEST[$argname]) : $_REQUEST[$argname];
+ if ($a == 'null')
+ $a = null;
+ $args[] = $a;
+ // $args[] = $_REQUEST[$argname];
+ }
+ }
+$results = $base->__call ($cmd, $args);
+
+if (isset ($_REQUEST['output']) && $_REQUEST['output'] == 'json') {
+ header ('Content-Type: application/json ; charset=utf-8');
+ header ('Cache-Control: no-cache , private');
+ header ('Pragma: no-cache');
+ echo '[ ';
+
+ $aout = array ();
+ if (is_array ($results) && isset ($results[0])) {
+ foreach ($results as $result) {
+ $ares = array ();
+ foreach ($result as $key => $val) {
+ $ares[] = '"'.$key.'": "'.$val.'"';
+ }
+ $aout[] = '{ '.implode (', ', $ares).' }';
+ }
+ echo implode (', ', $aout);
+ }
+ echo ' ]';
+ exit;
+ }
+
+if (isset ($_REQUEST['output']) && $_REQUEST['output'] == 'json2') {
+ header ('Content-Type: application/json ; charset=utf-8');
+ header ('Cache-Control: no-cache , private');
+ header ('Pragma: no-cache');
+ echo json_encode ($results);
+ exit;
+ }
+
+if (!$results)
+ exit;
+
+header ('Content-Type: text/xml ; charset=utf-8');
+header ('Cache-Control: no-cache , private');
+header ('Pragma: no-cache');
+echo '<?xml version="1.0" encoding="utf-8"?>';
+echo '<results>';
+//print_r ($results);
+if (is_array ($results) && isset ($results[0])) {
+ foreach ($results as $result) {
+ echo '<result>';
+ foreach ($result as $key => $val) {
+ if ($val === true)
+ echo "<$key>".$val."</$key>";
+ else
+ echo "<$key>".xmlentities ($val)."</$key>";
+ }
+ echo '</result>';
+ }
+ } else {
+ if (is_array ($results)) {
+ echo '<result>';
+ foreach ($results as $key => $val) {
+ if ($val === true)
+ echo "<$key>".$val."</$key>";
+ else
+ echo "<$key>".xmlentities ($val)."</$key>";
+ }
+ echo '</result>';
+ } else {
+ echo $results;
+ }
+ }
+echo '</results>';
+?>
<td>Statut</td>
<td>
<select id="peg_cycle_statut">
- <?= liste_statuts ($cycle_statuts, $peg['peg_cycle_statut']) ?>
+ <?= liste_statuts ($cycle_statuts, ($peg['peg_cycle_statut'] ?: 2)) ?>
</select>
</td>
</tr>
$dirs = liste_dirs (null);
-if (count($ret)) {
+if (count((array)$ret)) {
$dirs [] = array ('data' => "Non classés", 'attr' => array ('rel' => 'nonclasse'), 'children' => $ret);
}
$root = array ('data' => 'Champs disponibles', "attr" => array ('rel' => 'root', 'id' => 'din_0'), 'children' => $dirs);
global $base, $str;
$dirs = $base->meta_dirinfo_list ($_SESSION['token'], $parent, $base->order('din_libelle'));
$ret = array ();
- if (count ($dirs)) {
+ if (count ((array)$dirs)) {
foreach ($dirs as $dir) {
$children = array_merge ((array)liste_dirs ($dir['din_id']), (array)liste_champs ($dir['din_id']));
- if ((strlen ($str) && count ($children))
- || ($_GET['usedonly'] && count($children))
+ if ((strlen ($str) && count ((array)$children))
+ || ($_GET['usedonly'] && count((array)$children))
|| (!strlen ($str) && !$_GET['usedonly'])) {
$ret[] = array ('data' => $dir['din_libelle'], "attr" => array ('id' => 'din_'.$dir['din_id'],
'rel' => 'dossier'),
$err[] = $info;
}
}
-if (count ($err)) {
+if (count ((array)$err)) {
echo '<ul>';
foreach ($err as $info) {
echo '<li>'.$info['inf_libelle'].' ('.$info['inf_code'].')</li>';
$err[] = $info;
}
}
-if (count ($err)) {
+if (count ((array)$err)) {
echo '<ul>';
foreach ($err as $info) {
echo '<li>'.$info['inf_libelle'].' ('.$info['inf_code'].')</li>';
$err[] = $info;
}
}
-if (count ($err)) {
+if (count ((array)$err)) {
echo '<ul>';
foreach ($err as $info) {
echo '<li>'.$info['inf_libelle'].' ('.$info['inf_code'].')</li>';
foreach($droit_ajouts as $droit){
if($droit['daj_droit']){
$champs = $base->meta_info_groupe_obligatoire_liste($_SESSION['token'],$port['por_id'],$droit['ent_code']);
- if(count($champs)==0){
+ if(count((array)$champs)==0){
$err[] = "<li>Pas de champs obligatoire pour le portail ".$port['por_libelle']."/".$droit['ent_code']."</li>";
}
}
}
}
- if(count($err)){
+ if(count((array)$err)){
echo "<ul>".implode("\n",$err)."</ul>";
}
else{
if (trim ($val)) {
$per_ids_contact = $base->personne_cherche_exact_tout ($_SESSION['token'], trim ($val), $inf['inf__contact_filtre']);
if (count ($per_ids_contact) != 1) {
- echo "$val trouvé ".count($per_ids_contact)." fois\n"; exit;
+ echo "$val trouvé ".count((array)$per_ids_contact)." fois\n"; exit;
}
$per_id_contact = $per_ids_contact[0];
$base->personne_info_integer_set ($_SESSION['token'], $per_id, $champ, $per_id_contact, $_SESSION['uti_id']);
$val = $ligne[$entete[$champ]];
$per_ids_contact = $base->personne_cherche_exact_tout ($_SESSION['token'], trim ($val), $inf['inf__contact_filtre']);
if (count ($per_ids_contact) != 1) {
- echo "$val trouvé ".count($per_ids_contact)." fois\n"; exit;
+ echo "$val trouvé ".count((array)$per_ids_contact)." fois\n"; exit;
}
$per_id_contact = $per_ids_contact[0];
$base->personne_info_integer_set ($_SESSION['token'], $per_id, $champ, $per_id_contact, $_SESSION['uti_id']);
$parts = explode ('>', trim ($val));
$per_ids_famille = $base->personne_cherche_exact_tout ($_SESSION['token'], $parts[0], 'famille');
if (count ($per_ids_famille) != 1) {
- echo $parts[0]." trouvé ".count($per_ids_famille)." fois\n"; exit;
+ echo $parts[0]." trouvé ".count((array)$per_ids_famille)." fois\n"; exit;
}
$per_id_famille = $per_ids_famille[0];
$lfa = $base->meta_lien_familial_cherche ($_SESSION['token'], $parts[1]);
echo '</tr>';
$groupes = $base->personne_groupe_liste2 ($_SESSION['token'], $per_id, $info['inf_id']);
- if (count ($groupes)) {
+ if (count ((array)$groupes)) {
$impair = true;
foreach ($groupes as $groupe) {
echo '<tr class="'.($impair ? 'impair' : 'pair').'"><td>';
$classe ='infocontact_ro';
$valeurs = $base->personne_info_integer_get_multiple_details ($_SESSION['token'], $per_id, $info['inf_code']);
echo '<div id="'.$info['inf_code'].'_'.'list">';
- if (count ($valeurs)) {
+ if (count ((array)$valeurs)) {
foreach ($valeurs as $valeur) {
$nomprenom = $base->personne_get_libelle ($_SESSION['token'], $valeur['pii_valeur']);
echo '<span id="pii_'.$valeur['pii_id'].'" class="'.$classe.'"><nobr><span id="lienpersonne_'.$info['inf__contact_filtre'].'_'.$valeur['pii_valeur'].'" class="lienpersonne">'.$nomprenom.'</span></nobr></span> ';
$_GET['debut'], NULL,
NULL, NULL, NULL);
echo "<ul>" ;
- if(count($docs))foreach($docs as $doc){
+ if((array)$docs) foreach($docs as $doc){
$type = $base->document_document_type_get ($_SESSION['token'], $doc['dty_id']);
$responsable = $base->personne_get_libelle ($_SESSION['token'], $doc['per_id_responsable']);
echo '<li class="noBreak"><strong>'.$doc['doc_titre'].'';
}
echo"</ul>";
- if (count($docs)){
+ if ((array)$docs){
echo '<div class="separation"></div>';
}
} else if ($infos_fiche['sme_type'] == 'event') {
$liste_events = $base->events_event_liste($_SESSION['token'],$infos_fiche['sme_type_id'],$per_id,$_GET['debut'],NULL,NULL,NULL,NULL);
echo "<ul class='noBreak'>";
- if(count($liste_events))foreach($liste_events as $event){
+ if(count((array)$liste_events))foreach($liste_events as $event){
$date_event ="";
if($event['eve_debut']==$event['eve_fin']){
}
echo "</ul>";
- if (count($liste_events)){
+ if (count((array)$liste_events)){
echo '<div class="separation"></div>';
}
} else if ($infos_fiche['sme_type'] == 'notes') {
$liste_notes = $base->notes_note_usager_liste($_SESSION['token'],$per_id,$infos_fiche['sme_type_id'],$_GET['debut'],null);
echo "<ul class='noBreak'>";
- if(count($liste_notes))foreach($liste_notes as $note){
+ if(count((array)$liste_notes))foreach($liste_notes as $note){
$objet = "non défini";
if($note['not_objet']!=""){
$objet = textprotect($note['not_objet']);
echo "<li class='nothing_saved'>Aucune note enregistrée</li>";
}
echo "</ul>";
- if (count($liste_notes)){
+ if (count((array)$liste_notes)){
echo '<div class="separation"></div>';
}
}else if (!$infos_fiche['sme_type']){
$groupes = $base->meta_groupe_infos_liste ($_SESSION['token'], $infos_fiche['sme_id']);
- if (count ($groupes)) {
+ if (count ((array)$groupes)) {
$first = true;
foreach ($groupes as $groupe) {
$first = false;
echo '<div class="noBreak"><p class="titre2">'.$groupe['gin_libelle'].'</p>';
$infos = $base->meta_info_groupe_liste ($_SESSION['token'], $groupe['gin_id']);
$prochain_premier = true;
- if (count ($infos)) {
+ if (count ((array)$infos)) {
foreach ($infos as $info) {
$premier = false;
$dernier = false;
$.getJSON('/ajax/groupe_liste_details.php', { prm_token: $("#token").val(), prm_eta_id: $('#eta_id').val(), prm_sec_id_role: '', prm_sec_id_besoin: '', prm_interne_seuls: true, output: 'json2'}, function(data){
$.each (data, function (idx, val) {
$('#participantselect-group').append('<option value="'+val.grp_id+'">'+val.grp_nom+'</option');
- });
- });
+ });
+ });
+
+ $('#participantselect-frame').append('<br/><label class="etiq" for="participantselect-statut">Statut :</label><select name="rech_sta_id" onchange="$(\'#participantselect-chercher\').click();" id="participantselect-statut"></select>');
+ $('#participantselect-statut').append('<option value="">(tous statuts)</option>');
+
+ $.getJSON('/ajax/statuts_usager_liste.php', { prm_token: $("#token").val() }, function (data) {
+ $.each(data, function (idx, val) {
+ $('#participantselect-statut').append('<option value="'+idx+'">'+val+'</option');
+ });
+ });
}
$('#participantselect-frame').append ('<div id="participantselect-buttons" style="text-align: center; margin-top: 5px"><button id="participantselect-chercher">Chercher</button></div>');
if (o.ajout) {
if(grp_id==null){
grp_id="";
}
- var args = { prm_token: $("#token").val(), prm_nom: $("#participantselect-nom").val(), prm_prenom: $("#participantselect-prenom").val(), prm_grp_id:grp_id, prm_type: type, prm_secteur: o.secteur, output: 'json' };
+ var sta_id = $("#participantselect-statut").val();
+ if(sta_id==null){
+ sta_id="";
+ }
+ var args = { prm_token: $("#token").val(), prm_nom: $("#participantselect-nom").val(), prm_prenom: $("#participantselect-prenom").val(), prm_grp_id:grp_id, prm_type: type, prm_secteur: o.secteur, prm_sta_id:sta_id, output: 'json' };
var url_recherche = "/ajax/personne_cherche.php";
if(o.secteur != null){
DROP FUNCTION IF EXISTS document_document_liste(prm_dos_id integer, prm_per_id integer, prm_start date, prm_end date);
DROP FUNCTION IF EXISTS document_document_liste(prm_dos_id integer, prm_per_id integer, prm_start date, prm_end date, prm_grp_id integer, prm_per_ids integer[]);
DROP FUNCTION IF EXISTS document_document_liste(prm_token integer, prm_dos_id integer, prm_per_id integer, prm_start date, prm_end date, prm_grp_id integer, prm_per_ids integer[]);
+DROP FUNCTION IF EXISTS document_document_liste(prm_token integer, prm_dos_id integer, prm_per_id integer, prm_start date, prm_end date, prm_grp_id integer, prm_per_ids integer[], prm_eta_id integer);
DROP FUNCTION IF EXISTS document_document_save(prm_doc_id integer, prm_per_id_responsable integer, prm_dty_id integer, prm_titre character varying, prm_statut integer, prm_date_obtention date, prm_date_realisation date, prm_date_validite date, prm_description text);
DROP FUNCTION IF EXISTS document_document_save(prm_doc_id integer, prm_per_id_responsable integer, prm_dty_id integer, prm_titre character varying, prm_statut integer, prm_date_obtention date, prm_date_realisation date, prm_date_validite date, prm_description text, prm_uti_id integer);
DROP FUNCTION IF EXISTS document_document_secteur_save(prm_doc_id integer, prm_sec_ids integer[]);
-CREATE OR REPLACE FUNCTION document_document_liste(prm_token integer, prm_dos_id integer, prm_per_id integer, prm_start date, prm_end date, prm_grp_id integer, prm_per_ids integer[], prm_eta_id integer) RETURNS SETOF document
+CREATE OR REPLACE FUNCTION document_document_liste(prm_token integer, prm_dos_id integer, prm_per_id integer,
+ prm_start date, prm_end date, prm_grp_id integer, prm_per_ids integer[], prm_eta_id integer, prm_sec_id integer, prm_dty_id integer) RETURNS SETOF document
LANGUAGE plpgsql
AS $$
DECLARE
INNER JOIN document.documents_secteur USING(sec_id)
INNER JOIN document.documents USING(dos_id)
INNER JOIN document.document_usager USING(doc_id)
+ INNER JOIN document.document_type_secteur USING(sec_id)
LEFT JOIN document.documents_statut USING (dos_id)
LEFT JOIN personne_groupe on personne_groupe.per_id = document_usager.per_id_usager
LEFT JOIN public.personne_etablissement ON document.document_usager.per_id_usager = public.personne_etablissement.per_id
AND (prm_per_ids ISNULL OR document_usager.per_id_usager = ANY (prm_per_ids))
AND (prm_eta_id ISNULL OR personne_etablissement.eta_id = prm_eta_id)
AND (NOT documents.dos_locked OR documents_statut.sta_id = personne_info_integer_get(prm_token, document_usager.per_id_usager, 'statut_usager'))
+ AND (prm_sec_id ISNULL OR sec_id = prm_sec_id)
+ AND (prm_dty_id ISNULL OR document.dty_id = prm_dty_id)
LOOP
RETURN NEXT row;
END LOOP;
END;
$$;
-COMMENT ON FUNCTION document_document_liste(prm_token integer, prm_dos_id integer, prm_per_id integer, prm_start date, prm_end date, prm_grp_id integer, prm_per_ids integer[], prm_eta_id integer) IS
+COMMENT ON FUNCTION document_document_liste(prm_token integer, prm_dos_id integer, prm_per_id integer, prm_start date, prm_end date, prm_grp_id integer, prm_per_ids integer[], prm_eta_id integer, prm_sec_id integer, prm_dty_id integer) IS
'Retourne une liste de documents, filtrée selon plusieurs paramètres.
Entrées :
- prm_token : Token d''authentification
- prm_eta_id : Identifiant de l''établissement auquel sont rattachés les types de documents, ou NULL pour retourner tous les types de documents
';
+DROP FUNCTION IF EXISTS document.document_document_type_liste_par_secteur(prm_token integer, prm_sec_ids integer, prm_dos_id integer);
+DROP TYPE document.document_document_type_liste_par_secteur;
+
+CREATE OR REPLACE FUNCTION document.document_document_type_liste_par_secteur(prm_token integer, prm_sec_id integer, prm_dos_id integer)
+ RETURNS SETOF document.document_type
+ LANGUAGE plpgsql
+ AS $$
+DECLARE
+ row document.document_type;
+BEGIN
+ PERFORM login._token_assert (prm_token, FALSE, FALSE);
+ FOR row IN
+ SELECT DISTINCT document_type.dty_id, concat_ws(' - ', secteur.sec_nom, document_type.dty_nom) as dty_nom, document_type.dty_nom_individuel
+ FROM document.document_type
+ INNER JOIN document.document_type_secteur USING(dty_id)
+ INNER JOIN meta.secteur USING (sec_id)
+ INNER JOIN document.documents_secteur USING (sec_id)
+ WHERE (prm_sec_id ISNULL OR document_type_secteur.sec_id = prm_sec_id)
+ AND (prm_dos_id ISNULL OR documents_secteur.dos_id = prm_dos_id)
+ ORDER BY sec_nom, dty_nom
+ LOOP
+ RETURN NEXT row;
+ END LOOP;
+END;
+$$;
+COMMENT ON FUNCTION document.document_document_type_liste_par_secteur(prm_token integer, prm_sec_id integer, prm_dos_id integer) IS
+'Retourne la liste des types de documents rattachés à un secteur donné, ou tous les types de toutes les thématiques sur un onglet de documents
+Entrées :
+ - prm_token : Token d''authentification
+ - prm_sec_id : idetifiant d''un secteur
+';
+
CREATE OR REPLACE FUNCTION document.document_document_type_secteur_ajoute (prm_token integer, prm_dty_id integer, prm_sec_id integer) RETURNS integer
LANGUAGE plpgsql
AS $$
';
DROP FUNCTION IF EXISTS document.document_documents_liste_details (prm_token integer);
+DROP FUNCTION IF EXISTS document.document_documents_liste_details(integer,character varying);
DROP FUNCTION IF EXISTS document.document_documents_liste_details (prm_token integer, prm_titre varchar, prm_sec_id integer);
DROP TYPE IF EXISTS document.document_documents_liste_details;
CREATE TYPE document.document_documents_liste_details AS (
';
DROP FUNCTION IF EXISTS events.events_events_liste_details (prm_token integer);
+DROP FUNCTION IF EXISTS events.events_events_liste_details(integer,character varying);
DROP FUNCTION IF EXISTS events.events_events_liste_details (prm_token integer, prm_titre varchar, prm_sec_id integer);
DROP TYPE IF EXISTS events.events_events_liste_details;
CREATE TYPE events.events_events_liste_details AS (
BEGIN
PERFORM login._token_assert (prm_token, TRUE, FALSE);
mdp := 'password';
- WHILE mdp !~ '[-\!#\$%\*\+:<=>\?@\/]+' OR mdp !~ '[a-z]+' OR mdp !~ '[A-Z]+' OR mdp !~ '[0-9]+' OR char_length(mdp) != 8 LOOP
- SELECT string_agg (substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%*+-:<=>?@', ceil (random() * 88)::integer, 1), '') INTO mdp FROM generate_series(1, 8);
+ WHILE mdp !~ '[-\!#\$%\*\+:=\?@\/]+' OR mdp !~ '[a-z]+' OR mdp !~ '[A-Z]+' OR mdp !~ '[0-9]+' OR char_length(mdp) != 8 LOOP
+ SELECT string_agg (substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%*+-:=?@', ceil (random() * 86)::integer, 1), '') INTO mdp FROM generate_series(1, 8);
END LOOP;
UPDATE login.utilisateur SET uti_salt = crypt (mdp, gen_salt('des')), uti_pwd = mdp
WHERE uti_id = prm_uti_id;
- eta_id _auteur : Identifiant de l''établissement auquel est rattachée la note';
DROP FUNCTION IF EXISTS notes_note_boite_reception_liste(prm_token integer);
+DROP FUNCTION IF EXISTS notes_note_boite_reception_liste(prm_token integer, prm_start date, prm_end date, prm_nonlues boolean, prm_type character varying);
DROP TYPE IF EXISTS notes_note_boite_reception_liste;
CREATE TYPE notes_note_boite_reception_liste AS (
not_id integer,
nde_information_lue boolean
);
-CREATE OR REPLACE FUNCTION notes_note_boite_reception_liste(prm_token integer) RETURNS SETOF notes_note_boite_reception_liste
+CREATE OR REPLACE FUNCTION notes_note_boite_reception_liste(prm_token integer, prm_start date, prm_end date, prm_nonlues boolean, prm_type character varying) RETURNS SETOF notes_note_boite_reception_liste
LANGUAGE plpgsql
AS $$
DECLARE
uti integer;
row notes.notes_note_boite_reception_liste;
+ p_start timestamp;
+ p_end timestamp;
BEGIN
PERFORM login._token_assert (prm_token, FALSE, FALSE);
+ if prm_start NOTNULL THEN
+ p_start = prm_start;
+ ELSE
+ p_start = timestamp '-INFINITY';
+ END IF;
+ if prm_end NOTNULL THEN
+ p_end = prm_end + interval '1 day';
+ ELSE
+ p_end = timestamp 'INFINITY';
+ END IF;
+
SELECT uti_id INTO uti FROM login.token WHERE tok_token = prm_token;
FOR row IN
SELECT not_id, not_date_saisie, not_date_evenement, not_objet, not_texte, uti_id_auteur, eta_id_auteur,
FROM notes.note
INNER JOIN notes.note_destinataire USING(not_id)
WHERE note_destinataire.uti_id = uti AND NOT nde_supprime
+ AND ((prm_start ISNULL AND prm_end ISNULL) OR not_date_evenement BETWEEN p_start AND p_end OR not_date_saisie BETWEEN p_start AND p_end)
+ AND (prm_nonlues ISNULL OR NOT nde_action_faite AND NOT nde_information_lue)
+ AND (prm_type ISNULL OR prm_type = 'action' AND nde_pour_action OR prm_type = 'info' AND nde_pour_information)
LOOP
RETURN NEXT row;
END LOOP;
END;
$$;
-COMMENT ON FUNCTION notes_note_boite_reception_liste(prm_token integer) IS
+COMMENT ON FUNCTION notes_note_boite_reception_liste(prm_token integer, prm_start date, prm_end date, prm_nonlues boolean, prm_type character varying) IS
'Retourne la liste des notes dont l''utilisateur authentifié est destinataire.
Entrées :
- prm_token : Token d''authentification
+ - prm_start : Date de début de recherche (sur date événement et date saisie)
+ - prm_end : Date de fin de recherche (sur date événement et date saisie)
+ - prm_nonlues : Récupérer seulement les notes non lues
+ - prm_type : Filtrer le type de notes
Retour :
- not_id : Identifiant de la note
- not_date_saisie : Date de saisie de la note
';
DROP FUNCTION IF EXISTS notes_note_mesnotes(prm_token integer, prm_grp_id integer, prm_nos_id integer, prm_start date, prm_end date);
+DROP FUNCTION IF EXISTS notes_note_mesnotes(prm_token integer, prm_grp_id integer, prm_nos_id integer, prm_start date, prm_end date, boolean, character varying);
DROP TYPE IF EXISTS notes_note_mesnotes;
CREATE TYPE notes_note_mesnotes AS (
not_id integer,
INNER JOIN notes.note_theme USING(not_id)
WHERE per_id = prm_per_id AND the_id = the
AND ((prm_start ISNULL AND prm_end ISNULL) OR not_date_evenement BETWEEN p_start AND p_end OR not_date_saisie BETWEEN p_start AND p_end)
-
LOOP
RETURN NEXT row;
END LOOP;
DROP FUNCTION IF EXISTS personne_cherche(prm_token integer, prm_nom character varying, prm_prenom character varying);
DROP FUNCTION IF EXISTS personne_cherche(prm_token integer, prm_nom character varying, prm_prenom character varying, prm_type character varying);
DROP FUNCTION IF EXISTS personne_cherche(prm_token integer, prm_nom character varying, prm_prenom character varying, prm_type character varying, prm_grp_id integer);
+DROP FUNCTION IF EXISTS personne_cherche(prm_token integer, prm_nom character varying, prm_prenom character varying, prm_type character varying, prm_grp_id integer, prm_sta_id integer);
DROP FUNCTION IF EXISTS personne_cherche2(prm_token integer, prm_nom character varying, prm_prenom character varying, prm_type character varying, prm_secteur character varying);
DROP FUNCTION IF EXISTS personne_cherche_avec_lien(prm_token integer, prm_nom character varying, prm_prenom character varying, prm_type character varying, prm_grp_id integer, prm_per_id integer);
DROP FUNCTION IF EXISTS personne_cherche2_avec_lien(prm_token integer, prm_nom character varying, prm_prenom character varying, prm_type character varying, prm_secteur character varying, prm_per_id integer);
END;
$$;
-CREATE OR REPLACE FUNCTION personne_cherche(prm_token integer, prm_nom character varying, prm_prenom character varying, prm_type character varying, prm_grp_id integer) RETURNS SETOF personne_cherche
+CREATE OR REPLACE FUNCTION personne_cherche(prm_token integer, prm_nom character varying, prm_prenom character varying, prm_type character varying, prm_grp_id integer, prm_sta_id integer) RETURNS SETOF personne_cherche
LANGUAGE plpgsql
AS $$
DECLARE
AND (prm_prenom ISNULL OR personne_info_varchar_get(prm_token, per_id, 'prenom') ilike prm_prenom || '%')
AND ent_code = prm_type
AND (prm_grp_id ISNULL OR (personne_groupe.grp_id = prm_grp_id AND CURRENT_TIMESTAMP BETWEEN COALESCE(personne_groupe.peg_debut, '-Infinity'::timestamp) AND COALESCE (personne_groupe.peg_fin, 'Infinity'::timestamp)))
+ AND (prm_sta_id ISNULL OR (prm_sta_id = personne_info_integer_get(prm_token, per_id, 'statut_usager')))
ORDER BY COALESCE (personne_info_varchar_get(prm_token, per_id, 'nom') || ' ', '') || COALESCE (personne_info_varchar_get(prm_token, per_id, 'prenom'), '') ||
(CASE WHEN prm_type = 'usager' THEN ''
WHEN prm_type = 'famille' THEN ''
--------------------------------------------------------------------------------
Copyright (c) 2014 Kavarna SARL
*/
+?>
+
+<?php
+
+if (isset ($_REQUEST['go'])) {
+ $_SESSION['tripar'] = $_REQUEST['tripar'];
+ $_SESSION['filter_deb'] = $_REQUEST['events_date_debut'];
+ $_SESSION['filter_fin'] = $_REQUEST['events_date_fin'];
+ $_SESSION['nonread'] = $_REQUEST['nonread'] ? true : null;
+ $_SESSION['nottype'] = $_REQUEST['nottype'] != '' ? $_REQUEST['nottype'] : null;
+ header('Location: '.$_SERVER['REQUEST_URI']);
+ exit;
+}
+if (isset ($_REQUEST['reset'])) {
+ $_SESSION['tripar'] = 'not_date_evenement';
+ unset($_SESSION['nonread']);
+ unset($_SESSION['nottype']);
+ unset($_SESSION['filter_deb']);
+ unset($_SESSION['filter_fin']);
+ header('Location: '.$_SERVER['REQUEST_URI']);
+ exit;
+}
+
?>
<script type="text/javascript">
$(document).ready (function () {
function affiche_notes_reception () {
global $base;
// Page de pagination
+ echo '<form method="post" action="'.$_SERVER['REQUEST_URI'].'">';
+ echo '<fieldset><legend>Recherche</legend>';
$p = isset ($_GET['p']) ? $_GET['p'] : '1';
- $nnotes = $base->notes_note_boite_reception_liste ($_SESSION['token'], $base->count());
- $notes = $base->notes_note_boite_reception_liste ($_SESSION['token'], $base->order ('not_date_evenement', 'DESC'), $base->limit (NPAGES, ($p-1)*NPAGES));
+
+ if (!isset ($_SESSION['filter_deb'])) {
+ $_SESSION['filter_deb'] = date ('Y/m/d');
+ }
+ $startDate = $_SESSION['filter_deb'];
+ $endDate = arrval ($_SESSION, 'filter_fin');
+
+ echo '<div class="choix_vue" id="periode">';
+ echo '<h2>Période</h2>';
+ echo '<h3>Du </h3>';
+ echo '<input name="events_date_debut" type="text" size="9" class="datepicker" value="'.$startDate.'"/>';
+ echo '<br />';
+ echo '<h3>Au </h3>';
+ echo '<input name="events_date_fin" type="text" size="9" class="datepicker" value="'.$endDate.'"/>';
+ echo '</div>';
+
+ echo ' Tri par : <select name="tripar"><option value="not_date_evenement"'.(arrval ($_SESSION, 'tripar') == 'not_date_evenement' ? ' selected': '').'>Date de l\'événement</option><option value="not_date_saisie"'.(arrval ($_SESSION, 'tripar') == 'not_date_saisie' ? ' selected': '').'>Date de soumission</option></select>';
+ echo ' <label for="nonread">Non lues uniquement</label> <input name="nonread" id="nonread" type="checkbox" '.($_SESSION['nonread'] ? 'checked' : '').'>';
+ echo ' Type : <select name="nottype"><option value="">Toutes</option><option value="action"'.(arrval ($_SESSION, 'nottype') == 'action' ? ' selected': '').'>Pour action</option><option value="info"'.(arrval ($_SESSION, 'nottype') == 'info' ? ' selected': '').'>Pour information</option></select>';
+ echo '<input type="submit" name="go" value="OK"></input>';
+ echo '</fieldset>';
+ echo '</form><br/>';
+ $nnotes = $base->notes_note_boite_reception_liste ($_SESSION['token'], $startDate, $endDate, $_SESSION['nonread'], $_SESSION['nottype'], $base->count());
+ $notes = $base->notes_note_boite_reception_liste ($_SESSION['token'], $startDate, $endDate, $_SESSION['nonread'], $_SESSION['nottype'], $base->order ('not_date_evenement', 'DESC'), $base->limit (NPAGES, ($p-1)*NPAGES));
echo '<table width="100%" class="t1"><tr><th width="150">Date<br>Expéditeur</th><th width="70">Reçu pour</th><th width="150">Usagers</th><th>Note</th><th width="150">Autres destinataires</th></tr>';
$impair = true;
if ($note['not_objet']) {
echo '<strong>'.textprotect($note['not_objet']).'</strong><br>';
}
- echo textprotect($note['not_texte']);
+ echo '<pre>'.wordwrap (textprotect($note['not_texte'])).'</pre>';
echo '</td>';
echo '<td>';
if (is_array ($destinataires)) {
echo '<div id="dlg"></div><div id="dlg2"></div>';
$count1 = $base->document_document_liste ($_SESSION['token'], $dos_id, $per_id,
NULL, NULL,
- NULL, NULL,
+ NULL, NULL,
$_SESSION['eta_id'],
+ NULL, NULL,
$base->count());
$count = $count1[0]['count'];
$docs = $base->document_document_liste ($_SESSION['token'], $dos_id, $per_id,
NULL, NULL,
- NULL, NULL,
+ NULL, NULL,
$_SESSION['eta_id'],
+ NULL, NULL,
$base->order($col_order,$sort_by),
$base->limit ($nlines, ($p-1)*$nlines));
} else {
arrval ($_GET, 'rech_grp_id'),
arrval ($_GET, 'rech_per_id'),
$_SESSION['eta_id'],
+ arrval ($_GET, 'documents_thematique'),
+ arrval ($_GET, 'documents_type_doc'),
$base->count());
$count = $count1[0]['count'];
$docs = $base->document_document_liste ($_SESSION['token'], $dos_id, NULL,
arrval ($_GET, 'rech_grp_id'),
arrval ($_GET, 'rech_per_id'),
$_SESSION['eta_id'],
+ arrval ($_GET, 'documents_thematique'),
+ arrval ($_GET, 'documents_type_doc'),
$base->order($col_order,$sort_by),
$base->limit ($nlines, ($p-1)*$nlines));
}
$(".filtre_usager").click (on_filtre_usager_click);
$(".filtre_usager span").click (function () { return false; });
$("#filtre_usager_ajoute").click (on_filtre_usager_ajoute_click);
+ $("#documents_thematique_sel").change(on_documents_thematique_change);
+ $("#documents_thematique_sel").trigger('change');
});
function on_filtre_usager_click () {
});
}
+function on_documents_thematique_change() {
+ secid = $('#documents_thematique_sel').val() ? $('#documents_thematique_sel').val() : null;
+ dosid = $('#dos_id').val();
+ $.getJSON('/ajax/document_document_type_liste_par_secteur.php', { prm_token: $("#token").val(), prm_sec_id: secid, prm_dos_id: dosid, output: 'json' }, function (data) {
+ $('#documents_type_doc_sel').html('');
+ $('#documents_type_doc_sel').append('<option value="">(Tous types)</option>');
+ const _get = new URLSearchParams(location.search);
+ $.each(data, function (idx, val) {
+ let selected = _get.get('documents_type_doc') && _get.get('documents_type_doc') == val.dty_id ? ' selected' : '';
+ $('#documents_type_doc_sel').append('<option value="'+val.dty_id+'"'+selected+'>'+val.dty_nom+'</option');
+ });
+ });
+}
+
function on_docedit_click () {
var doc_id = $(this).attr('id').substr (4);
$document_debut = isset ($_GET['documents_date_debut']) ? $_GET['documents_date_debut'] : '';
$document_fin = isset ($_GET['documents_date_fin']) ? $_GET['documents_date_fin'] : '';
?>
- <h3>Du </h3>
+ <h3>Du </h3>
<input name="documents_date_debut" type="text" size="10" class="datepicker" value="<?php echo $document_debut; ?>" />
<br/>
<h3>Au </h3>
<input name="documents_date_fin" type="text" size="10" class="datepicker" value="<?php echo $document_fin; ?>" />
- </div>
+ </div>
+ <br>
+ <div class="choix_vue">
+ <h2>Type de document</h2>
+ <h3>Thématique</h3>
+ <select name="documents_thematique" id="documents_thematique_sel">
+ <option value="">(Toutes thématiques)</option>
+ <?php
+ $thematiques = $base->document_documents_secteur_liste_details_etab($_SESSION['token'], $dos_id, null);
+ foreach($thematiques as $the) {
+ $selected = isset($_GET['documents_thematique']) && $_GET['documents_thematique'] == $the['sec_id'] ? ' selected' : '';
+ echo '<option value="'.$the['sec_id'].'"'.$selected.'>'.$the['sec_nom'].'</option>';
+ }
+ ?>
+ </select>
+ <br>
+ <h3>Type</h3>
+ <select name="documents_type_doc" id="documents_type_doc_sel"></select>
+ </div>
<div class="choix_vue maj">
<input type="submit" name="recherchego" value="Mettre à jour" />
</div>
$_SESSION['tripar'] = $_REQUEST['tripar'];
$_SESSION['filter_deb'] = $_REQUEST['events_date_debut'];
$_SESSION['filter_fin'] = $_REQUEST['events_date_fin'];
+ $_SESSION['nonread'] = $_REQUEST['nonread'] ? true : null;
+ $_SESSION['nottype'] = $_REQUEST['nottype'] != '' ? $_REQUEST['nottype'] : null;
header('Location: '.$_SERVER['REQUEST_URI']);
exit;
}
if (isset ($_REQUEST['reset'])) {
$_SESSION['grp'] = '';
$_SESSION['tripar'] = 'not_date_evenement';
+ unset($_SESSION['nonread']);
+ unset($_SESSION['nottype']);
unset($_SESSION['filter_deb']);
unset($_SESSION['filter_fin']);
header('Location: '.$_SERVER['REQUEST_URI']);