Tongda OA uses Ajax and workflow plug-ins to add an OA account (image details) and ajaxoa Based on Human Resources System Data
The program developed by xiaofeiyu mainly solves the problem that a subordinate company cannot immediately approve the process of adding an account to the human resources system. After the process is approved, the plug-in will automatically add an OA account in the background, the addition mechanism is the same as that of the hr and OA systems.
Only add operations, but not modify or delete operations. The original two systems have been automatically developed for data synchronization. Therefore, this development is a complementary content, which only provides an application idea and a discussion of the development process.
When applying, the front-end initiator fills in the assigned employee ID in the HR system to query other related data. To avoid modifying the employee ID after checking the data, add a confirmation employee ID input box. Other information is automatically obtained from Ajax in read-only mode. In this way, data can be retrieved from another system to avoid errors caused by full human input of data.
After the process is approved, the Administrator will create an account in the background when performing the next transfer. If there is no error, the Administrator will prompt that the process is successfully created, if an error occurs, a prompt is displayed.
The HR system is a macro human system, and the database is SQL Server2008. Therefore, you need to connect to the SQL Server database in this development.
Main Code of the system:
$ Query = "select * from t_hr_view where c01u7 = '". $ gonghao. "'"; $ cursor = sqlsrv_query ($ conn, $ query); if ($ row = sqlsrv_fetch_array ($ cursor, SQLSRV_FETCH_ASSOC )) {$ hr_dept_id = $ row ["E0122_0"]; $ hr_dept_name = $ row ["e0122"]; $ OA = $ row ["OA"]; $ hr_name = $ row ["A0101"]; $ hr_gangwei = $ row ["e01a1"]; $ hr_gonghao = $ row ["c01u7"]; $ hr_unique_id = $ row ["unique_id"]; if ($ OA = 1 or $ OA = 2) {$ query2 = "select * from user where hr_u Nique_id = '$ hr_unique_id 'limit 1 "; $ cursor2 = exequery (TD: conn (), $ query2); $ num = mysql_num_rows ($ cursor2 ); if ($ num = 0 and $ hr_gonghao! = "") {// Add User $ DEPT_ID = "0"; $ new_flag = 1; $ query4 = "select DEPT_ID from department where hr_dept_id = '$ hr_dept_id 'limit 1 "; $ cursor4 = exequery (TD: conn (), $ query4); if ($ row4 = mysql_fetch_row ($ cursor4) {$ DEPT_ID = $ row4 [0];} if (in_array ($ hr_dept_name, $ neitui_dept_arr) {$ DEPT_ID = "0 ";} /***** query whether byname has repeated **/$ query5 = "select * from user where BYNAME = '$ hr_gonghao 'limit 1"; $ cursor5 = exequery (TD :: conn (), $ qu Ery5); $ num5 = mysql_num_rows ($ cursor5); // $ num5 = 1; // test failed if ($ num5 = 1) {$ new_flag =-1 ;} /*****/if ($ new_flag = 1) {// allow new users $ has_user_id_str = ''; $ queryn = 'select UID, USER_ID FROM user '; $ cursorn = exequery (TD: conn (), $ queryn); while ($ rown = mysql_fetch_array ($ cursorn) {$ has_user_id_str. = $ rown ['user _ id']. ',';} $ USER_ID = get_user_id ($ has_user_id_str); $ BYNAME = $ hr_gonghao; // the login name is the employee ID $ BYNAME = Trim ($ BYNAME); $ USER_NAME = $ hr_name; $ USER_NAME = trim ($ USER_NAME); $ BYNAME = trim ($ BYNAME); $ UID = add_user_new ($ ARRAY ); if ($ UID! = "") {$ USER_ID = $ UID; $ query3 = "insert into USER_EXT (UID, USER_ID, USE_POP3, EMAIL_CAPACITY, FOLDER_CAPACITY, WEBMAIL_CAPACITY, WEBMAIL_NUM, DUTY_TYPE) values ('$ uid',' $ USER_ID ', '0', '000000', '000000', '0', '0', '1 ')"; exequery (TD: conn (), $ query3 );}}}}}
The above section describes how to use Ajax and workflow plug-ins to add an OA account based on the data in the human resources system. I hope to help you, if you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!