Zmiany pomiędzy wersją 50 and wersją 51 dla DeployerGuide/Customization/ProcessAutomation/Examples

Pokaż
Ignoruj:
Data i czas:
10/22/14 12:57:53 (10 years temu)
Autor:
MK (IP: 213.227.67.33)
Komentarz:

--

Legend:

Bez zmian
Dodane
Usunięte
Zmienione
  • DeployerGuide/Customization/ProcessAutomation/Examples

    v50 v51  
    465465ORDER BY prtpid, ptstid, (end___ IS NOT NULL AND orgarr IS NOT NULL) DESC, end___ IS NOT NULL DESC, end___ ASC, orgarr IS NOT NULL DESC, dscrpt ASC 
    466466}}} 
     467[[BR]] 
     468 
     469zapytanie dla wszystkich zadań workflow z modułu Dokumenty: 
     470{{{ 
     471SELECT doc.*, reg.regtyp,reg.ndenam, type.dctptp,type.dctpnm,type.dctpic,  
     472    (SELECT ARRAY[count(f.fileid),min(f.fileid)] FROM attachments LEFT JOIN files f USING(fileid) WHERE is_del IS NOT TRUE AND doc_id = doc.doc_id) as files,  
     473    (EXISTS (SELECT 1 FROM documents_history WHERE doc_id=doc.doc_id AND orunid = 1 AND strpos(dscrpt, 'Otwarcie')=1)) as is_ack  
     474FROM documents doc  
     475INNER JOIN ( 
     476    SELECT doc_id, (array_agg(attrib))[1] as attrib  
     477    FROM ( 
     478        SELECT documents_view.doc_id, (CASE WHEN dlu_doc_id IS NULL THEN NULL ELSE coalesce(dlu.attrib, '') END) as attrib  
     479        FROM documents documents_view  
     480        LEFT JOIN storage_places stp using(strpid)  
     481        LEFT JOIN ( 
     482            SELECT dlu.doc_id as dlu_doc_id, dlu.attrib, dlu.usr_id, ul.prior_  
     483            FROM doc_link_users dlu  
     484            LEFT JOIN users_link_group ul on(ul.grp_id = dlu.grp_id AND ul.usr_id = 2) 
     485            WHERE dlu.usr_id = 2 OR ul.usr_id = 2 
     486        ) dlu ON (dlu_doc_id = documents_view.doc_id) 
     487        WHERE is_del IS NOT TRUE AND gostof IS NULL  
     488            AND procid IN ( 
     489                SELECT p.rootpr  
     490                FROM procedures p  
     491                LEFT JOIN stages s USING(procid)  
     492                WHERE (ARRAY(SELECT orunid FROM orgtree_view LEFT JOIN users_link_org_units ulo USING(orunid) WHERE orunid = 1 OR (ourpid = 1 AND EXISTS(SELECT 1 FROM (SELECT value_ FROM global_sys_conf WHERE ent_id = 2 AND objnam = 'Replacement_'||ulo.usr_id AND varnam = 'from__') as as1 WHERE value_::date <= now()::date) AND EXISTS(SELECT 1 FROM (SELECT value_ FROM global_sys_conf WHERE ent_id = 2 AND objnam = 'Replacement_'||ulo.usr_id AND varnam = 'to____') as sd2 WHERE value_::date >= now()::date))) && s.orgarr) AND s.ptsttp != 'SUBPROCESS' AND sop_id IS NOT NULL AND is_act IS TRUE 
     493            )  
     494            AND is_iso IS FALSE AND partof IS NULL ORDER BY dlu_doc_id, dlu.usr_id IS NOT NULL DESC, dlu.prior_ ASC  
     495    ) foo2 
     496    GROUP BY doc_id 
     497) dolu USING (doc_id)  
     498LEFT JOIN types_of_documents type USING(dctpid)  
     499LEFT JOIN registers reg USING(reg_id)  
     500WHERE (substr(dolu.attrib, 1, 1) = 'r') OR (dolu.attrib IS NULL AND (prionl IS NOT TRUE OR doc.adduid = 2)) 
     501ORDER BY timest DESC,doc_id DESC 
     502}}} 
    467503 
    468504