src: |
  SELECT substr(t_rapports.code, GREATEST("position"(t_rapports.code, 'VIEW_'::text), "position"(t_rapports.code, 'LIST_'::text)) + 5, 3) AS contexte,
      t_rapports.code,
          CASE
              WHEN t_rapports.label <> ''::text THEN t_rapports.label::character varying
              ELSE t_rapports.texte
          END AS texte,
      ((('VIEW.VIEWTYPE'::text ||
          CASE
              WHEN t_rapports.code ~~ '%LIST_%'::text THEN '=='::text
              ELSE '!='::text
          END) || '''JUSTIF'' && VIEW.CONTEXTE=='''::text) || substr(t_rapports.code, GREATEST("position"(t_rapports.code, 'VIEW_'::text), "position"(t_rapports.code, 'LIST_'::text)) + 5, 3)) || ''''::text AS condition,
          CASE
              WHEN t_rapports.code ~~ '%LIST_%'::text THEN 'JUSTIF'::text
              ELSE ''::text
          END AS viewtype,
          CASE
              WHEN (t_rapports.code ~~ 'CTI\_VIEW\_%'::text OR t_rapports.code ~~ 'CTI\_LIST\_%'::text) AND length(t_rapports.code) = 12 THEN '*DFT'::text
              ELSE ''::text
          END AS alias
     FROM eco.t_rapports
    WHERE (t_rapports.code ~~* '%VIEW\_%'::text OR t_rapports.code ~~* '%LIST\_%'::text) AND t_rapports.is_hide = 0::text
    ORDER BY (substr(t_rapports.code, "position"(t_rapports.code, 'VIEW_'::text) + 5, 3)), t_rapports.code;