set_initial_proc_with_groups_id.sql 572 B

12345678910111213141516
  1. -- G.1--before-while-2-set-initial-proc_with_groups_id
  2. update `CRM_PROCES_idx_TEMP` i
  3. join `CRM_WSKAZNIK` as wsk on ( wsk.`ID_PROCES`= i.`ID_PROCES`
  4. and wsk.`A_STATUS` in ( 'NORMAL', 'WAITING' )
  5. )
  6. join `CRM_LISTA_ZASOBOW` as z on ( z.`ID` = wsk.`ID_ZASOB`
  7. and z.`TYPE` in ( 'STANOWISKO', 'PODMIOT', 'DZIAL' )
  8. and z.`A_STATUS` in ( 'NORMAL', 'WAITING' )
  9. )
  10. join `CRM_PRZYPADEK` przyp on ( przyp.`ID` = wsk.`ID_PRZYPADEK`
  11. and przyp.`FORM_TREAT` & 8 -- has perm X
  12. )
  13. set
  14. i.`idx_PROCES_WITH_GROUPS_ID` = i.`ID_PROCES`
  15. where i.`idx_PROCES_INIT_ID` > 0
  16. ;