- 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;