| 150 | |
| 151 | == Wstawianie danych z bazy do szablonu maila == |
| 152 | Przydatną opcją dla dużych organizacji jest pobieranie automatyczne danych do stopki z danych pracownika pochodzących ze struktury organizacyjnej i konta użytkownika. Przykładowe zapytania poniżej: |
| 153 | |
| 154 | {{{ |
| 155 | <div class="imie"> |
| 156 | {sql_query(#SELECT u.firnam || ' ' || u.lasnam AS line_1 FROM organization_units o LEFT JOIN users_link_org_units ulo ON o.orunid = ulo.orunid LEFT JOIN users u ON u.usr_id = ulo.usr_id WHERE u.usr_id = {%1}#,LOGGED_USR_ID)}<br></div> |
| 157 | <br /> |
| 158 | <div class="stanowisko"> |
| 159 | {sql_query(#SELECT o.ndenam AS line_2 FROM organization_units o LEFT JOIN users_link_org_units ulo ON o.orunid = ulo.orunid LEFT JOIN users u ON u.usr_id = ulo.usr_id WHERE u.usr_id = {%1}#,LOGGED_USR_ID)}<br/> |
| 160 | <br/> |
| 161 | {sql_query(#SELECT CASE WHEN u.iphone IS NOT NULL THEN 'phone ' || u.iphone ELSE ''END AS line_3 FROM organization_units o LEFT JOIN users_link_org_units ulo ON o.orunid = ulo.orunid LEFT JOIN users u ON u.usr_id = ulo.usr_id WHERE u.usr_id = {%1}#,LOGGED_USR_ID)}<br/> |
| 162 | {sql_query(#SELECT CASE WHEN u.phone_ IS NOT NULL THEN 'mobile ' || u.phone_ ELSE ''END AS line_4 FROM organization_units o LEFT JOIN users_link_org_units ulo ON o.orunid = ulo.orunid LEFT JOIN users u ON u.usr_id = ulo.usr_id WHERE u.usr_id = {%1}#,LOGGED_USR_ID)}<br/> |
| 163 | <u>{sql_query(#SELECT CASE WHEN e_mail IS NOT NULL THEN e_mail ELSE ''END AS line_5 FROM organization_units o LEFT JOIN users_link_org_units ulo ON o.orunid = ulo.orunid LEFT JOIN users u ON u.usr_id = ulo.usr_id WHERE u.usr_id = {%1}#,LOGGED_USR_ID)}</u><br/> |
| 164 | |
| 165 | <br > |
| 166 | </div> |
| 167 | |
| 168 | }}} |
| 169 | |