Tongda OA use Ajax and workflow plug-ins to achieve according to human resources system data to increase the OA account (text detailed) _ajax related

Source: Internet
Author: User

The small Flying Fish Development program is mainly to solve a subordinate company in the human system to increase the number of accounts can not be immediately approved the issue, through the process of approval by the plug-in in the background to determine the automatic increase of OA account, the increase mechanism and HR and OA system synchronization is the same.

Only the increment operation, no modification, delete operation. The original data of two systems have been automatically synchronized development, so this development belongs to a supplementary content, only to provide an application of the thinking and development process of discussion.

When the front-end sponsor fills in the assigned work number in the HR system, the corresponding data can be queried. To avoid data detection, add a confirmation entry box to the work number. Additional information is automatically obtained by Ajax for read-only form. In this way, the complete artificial input data can be avoided by obtaining data from another system.

After approval of the process through the flow to the OA administrator where, the administrator in the next transfer is in the background to create an account, if there is no error will prompt the creation of success, if there are errors will be prompted.

HR system is a macro-view of the human system, the database is SQL Server2008, so this development also needs to connect the SQL Server database.

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) {$query 2= "select * from user where hr_unique_id= ' $hr _unique_id ' limit 1"; 
    $cursor 2=exequery (Td::conn (), $query 2); 
    $num =mysql_num_rows ($cursor 2); 
      if ($num ==0 and $hr _gonghao!= "") {//new user $DEPT _id= "0"; 
      $new _flag=1; 
      $query 4= "Select dept_id from department where hr_dept_id= ' $hr _dept_id ' limit 1"; 
      $cursor 4=exequery (Td::conn (), $query 4); 
      if ($row 4=mysql_fetch_row ($cursor 4)) {$DEPT _id= $row 4[0]; 
      } if (In_array ($hr _dept_name, $neitui _dept_arr)) {$DEPT _id= "0"; /**** Query ByName There is no duplicate **/$query 5 = "SELECT * from user where byname= ' $hr _gonghao ' limit 1 '; 
      $cursor 5=exequery (Td::conn (), $query 5);      
      $num 5=mysql_num_rows ($cursor 5);  
      $num 5=1;//test Failure if ($num 5==1) {$new _flag=-1; 
          }/******/if ($new _flag==1) {//allow added user $has = '; 
          $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; 
          Login name is work number $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; $query 3 = "INSERT INTO User_ext (uid,user_id,use_pop3,email_capacity,folder_capacity,webmail_capacity,wEbmail_num,duty_type values (' $UID ', ' $USER _id ', ' 0 ', ' 500 ', ' 500 ', ' 0 ', ' 0 ', ' 1 ') ";                                           
          Exequery (Td::conn (), $query 3); }  
      }  
    }     
  }  
}

The above is a small set to introduce the Tongda OA using AJAX and workflow Plug-ins to achieve according to the human resources system data added OA account (picture and text), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.