public function process(LocalezeRequest $request)
 {
     $username = $this->app->make('config')->get('laravel-localeze::username');
     $password = $this->app->make('config')->get('laravel-localeze::password');
     $response = $this->soap->query(["origination" => $this->setupOrigination($username, $password), "transId" => 1, "serviceId" => $this->serviceId, "elements" => $request->elements, "serviceKeys" => $request->serviceKeys]);
     return new LocalezeResponse($response);
 }
Example #2
0
              "attrName"=>"time",
              "gteq"=>$start,
              "lt"  =>$end ); */
 // Iteratively Retrieve Data and Print Out by FETCH protocol
 $cursor = NULL;
 $data_size = 0;
 $tmp = 0;
 do {
     $query = array("type" => "storage", "id" => uuid(), "acceptableSize" => "1000", "key" => array($key1));
     if ($cursor != NULL) {
         $query["cursor"] = $cursor;
     }
     $header = array("query" => $query);
     $transport = array("header" => $header);
     $queryRQ = array("transport" => $transport);
     $queryRS = $server->query($queryRQ);
     $transport = $queryRS->transport;
     if (!array_key_exists("header", $transport)) {
         echo "Fatal errpr: no header in the transport \n";
         exit(0);
     }
     if (array_key_exists("OK", $transport->header) && array_key_exists("body", $transport)) {
         $points = $transport->body->point;
         for ($i = 0; $i < count($points); $i++) {
             $point = null;
             if (count($points) == 1) {
                 $point = $points;
             } else {
                 $point = $points[$i];
             }
             if (array_key_exists("value", $point)) {
    /**
     *Function to Import Bullhorn Data
     */
    public function importBullhornPage()
    {
        global $wpdb;
        if (!current_user_can('manage_options')) {
            wp_die(__('You do not have sufficient permissions to access this page.', 'wp-rapid-bullhorn'));
        }
        $optionMetaData = $this->getOptionMetaData();
        ?>
            <div class="wrap">
            <h2><?php 
        _e('System Settings', 'wp-rapid-bullhorn');
        ?>
</h2>
            <table cellspacing="1" cellpadding="2"><tbody>
            <tr><td><?php 
        _e('System', 'wp-rapid-bullhorn');
        ?>
</td><td><?php 
        echo php_uname();
        ?>
</td></tr>
            <tr><td><?php 
        _e('PHP Version', 'wp-rapid-bullhorn');
        ?>
</td>
                <td><?php 
        echo phpversion();
        ?>
                <?php 
        if (version_compare('5.2', phpversion()) > 0) {
            echo '&nbsp;&nbsp;&nbsp;<span style="background-color: #ffcc00;">';
            _e('(WARNING: This plugin may not work properly with versions earlier than PHP 5.2)', 'wp-rapid-bullhorn');
            echo '</span>';
        }
        ?>
                </td>
            </tr>
            <tr><td><?php 
        _e('MySQL Version', 'wp-rapid-bullhorn');
        ?>
</td>
                <td><?php 
        echo $this->getMySqlVersion();
        ?>
                    <?php 
        echo '&nbsp;&nbsp;&nbsp;<span style="background-color: #ffcc00;">';
        if (version_compare('5.0', $this->getMySqlVersion()) > 0) {
            _e('(WARNING: This plugin may not work properly with versions earlier than MySQL 5.0)', 'wp-rapid-bullhorn');
        }
        echo '</span>';
        ?>
                </td>
            </tr>
            </tbody></table>

            <h2><?php 
        echo $this->getPluginDisplayName();
        echo ' ';
        _e('Importer', 'wp-rapid-bullhorn');
        ?>
</h2>
            
            <?php 
        $params = array('trace' => 1, 'soap_version' => SOAP_1_1);
        $BHclient = new SoapClient("https://api.bullhornstaffing.com/webservices-1.1/?wsdl", $params);
        // To run this code, you will need a valid username, password, and API key.
        $username = $this->getOption('bh_username');
        $password = $this->getOption('bh_pass');
        $apiKey = $this->getOption('bh_apikey');
        $session_request = new stdClass();
        $session_request->username = $username;
        $session_request->password = $password;
        $session_request->apiKey = $apiKey;
        $API_session = $BHclient->startSession($session_request);
        $API_currentSession = $API_session->return;
        // Create an array with the query parameters
        $query_array = array('entityName' => 'JobOrder', 'where' => 'isOpen=1', 'parameters' => array(), 'distinct' => TRUE);
        // Create the DTO type that the API will understand by casting the array to the dtoQuery
        // type that the query operation expects.
        $SOAP_query = new SoapVar($query_array, SOAP_ENC_OBJECT, "dtoQuery", "http://query.apiservice.bullhorn.com/");
        // Put the DTO into a request object
        $request_array = array('session' => $API_currentSession, 'query' => $SOAP_query);
        // Cast the request as a query type
        $SOAP_request = new SoapVar($request_array, SOAP_ENC_OBJECT, "query", "http://query.apiservice.bullhorn.com/");
        // Use the query method to return the candidate ids
        try {
            $queryResult = $BHclient->query($SOAP_request);
        } catch (SoapFault $fault) {
            var_dump($BHclient->__getLastRequest());
            die($fault->faultstring);
        }
        // Use the find() method to retrieve the candidate DTO for each Id
        // Loop through each Id in the query result list
        foreach ($queryResult->return->ids as $value) {
            // Cast each Id to an integer type
            $findId = new SoapVar($value, XSD_INTEGER, "int", "http://www.w3.org/2001/XMLSchema");
            // Create the find() method request
            $find_request = array('session' => $API_currentSession, 'entityName' => 'JobOrder', 'id' => $findId);
            try {
                $findResult = $BHclient->find($find_request);
            } catch (SoapFault $fault) {
                var_dump($BHclient->__getLastRequest());
                die($fault->faultstring);
            }
        }
        // Use the findMultiple() method to retrieve the candidate DTO for each Id
        // Create an array containing each Id in the query result list
        $findId_array = array();
        foreach ($queryResult->return->ids as $value) {
            // Cast each Id to an integer type
            $findId = new SoapVar($value, XSD_INTEGER, "int", "http://www.w3.org/2001/XMLSchema");
            $findId_array[] = $findId;
        }
        // Create the findMultiple() method request
        foreach (array_chunk($findId_array, 20) as $chunk) {
            $find_request = array('session' => $API_currentSession, 'entityName' => 'JobOrder', 'ids' => $chunk);
            // Use the findMultiple method to return the candidate dtos
            try {
                // echo "<pre>"  ;
                // print_R($find_request) ;
                // die;
                $findjobs = $BHclient->findMultiple($find_request);
                foreach ($findjobs->return->dtos as $job) {
                    $post = array('post_status' => 'publish', 'post_type' => 'job_listing', 'post_title' => (string) $job->title, 'post_content' => (string) $job->description, 'post_date' => date("Y-m-d H:i:s", strtotime($job->dateAdded)));
                    //	echo $job->employmentType;
                    $posttag1 = $job->employmentType;
                    $postmeta1 = array();
                    $postmeta1 = array('_job_jobOrderID' => $job->jobOrderID, '_company_description' => $job->publicDescription, '_start_date' => strtotime($job->startDate), '_date_end' => strtotime($job->dateEnd), '_duration_weeks' => $job->durationWeeks, '_employment_type' => $job->employmentType, '_custom_text_1' => $job->correlatedCustomInt1, '_custom_text_2' => $job->correlatedCustomInt2, '_custom_text_3' => $job->correlatedCustomInt3, '_custom_text_4' => $job->correlatedCustomInt4, '_custom_text_5' => $job->correlatedCustomInt5, '_custom_text_6' => $job->correlatedCustomInt6, '_custom_text_7' => $job->correlatedCustomInt7, '_custom_text_8' => $job->correlatedCustomInt8, '_custom_text_9' => $job->correlatedCustomInt9, '_years_required' => $job->yearsRequired, '_travel_requirements' => $job->travelRequirements, '_certification_list' => $job->certificationList, '_skill_list' => $job->skillList, '_job_externalCategoryID' => $job->externalCategoryID, '_job_benefits' => $job->benefits, '_job_educationDegree' => $job->educationDegree, '_job_hoursOfOperation' => $job->hoursOfOperation, '_job_salary' => $job->salary, '_job_salaryUnit' => $job->salaryUnit, '_job_taxRate' => $job->taxRate, '_job_taxStatus' => $job->taxStatus, '_job_travelRequirements' => $job->travelRequirements, '_job_willRelocate' => $job->willRelocate);
                    $postmeta2 = array();
                    foreach ($job->address as $field_name => $field_value) {
                        if (is_object($field_value)) {
                            $postmeta2['_job_location'] = $field_value->address1;
                            $postmeta2['_job_address_state'] = $field_value->state;
                            $postmeta2['_job_address_city'] = $field_value->city;
                        }
                        /*  if(is_object($field_value))
                        			    {
                        					
                        			        
                        						$postmeta2 = array(
                        						  '_job_location' => $field_value->address1,
                        						  '_job_address_city' => $field_value->city,
                        						  '_job_address_state' => $field_value->state
                        						  );
                        						 
                        						 $termregion = $field_value->state; 
                        					
                        					
                        				} */
                    }
                    echo '</br>---------------------<br>';
                    $post_id = $wpdb->get_var(sprintf("\n\t\t\t\t\t\t\tSELECT post_id\n\t\t\t\t\t\t\tFROM {$wpdb->postmeta}\n\t\t\t\t\t\t\tWHERE meta_key = '_job_jobOrderID'\n\t\t\t\t\t\t\tAND meta_value = %s\n\t\t\t\t\t\t\tLIMIT 1", $job->jobOrderID));
                    if ($post_id != 0) {
                        $post['ID'] = $post_id;
                        $post_id = wp_update_post($post);
                    } else {
                        $post_id = wp_insert_post($post);
                    }
                    //echo $termregion;
                    /*$stterm = term_exists( $termregion ); 
                    		
                    		if(empty($stterm['term_id'])){
                    		wp_insert_term( 'job_listing_region', $termregion );
                    		$stterm = term_exists( $termregion ); 	
                    		}
                    		
                    		wp_set_post_terms( $post_id, $stterm['term_id'], 'job_listing_region' );
                    		
                    		
                    		$term = term_exists( $posttag1);
                    		var_dump($term);
                    		if(empty($term['term_id'])){
                    		wp_insert_term( 'job_listing_type', $posttag1 );
                    		$term = term_exists( $posttag1);;	
                    		}
                    		
                    		wp_set_post_terms( $post_id, $term['term_id'], 'job_listing_type' );*/
                    $term = get_term_by('name', $termregion, 'job_listing_region');
                    if ($term->term_id == "") {
                        wp_insert_term($termregion, 'job_listing_region');
                    }
                    $term = get_term_by('name', $termregion, 'job_listing_region');
                    wp_set_post_terms($post_id, $term->term_id, 'job_listing_region');
                    $tterm = get_term_by('name', $posttag1, 'job_listing_type');
                    if ($tterm->term_id == "") {
                        wp_insert_term($posttag1, 'job_listing_type');
                    }
                    $tterm = get_term_by('name', $posttag1, 'job_listing_type');
                    wp_set_post_terms($post_id, $tterm->term_id, 'job_listing_type');
                    $post_metas = array();
                    $post_metas = array_merge($postmeta2, $postmeta1);
                    foreach ($post_metas as $pkey => $pvalue) {
                        @update_post_meta($post_id, $pkey, $pvalue);
                    }
                    /*ClientCorporation Query*/
                    /*$cc_query_array = array(
                    		'entityName' => 'ClientCorporation',
                    		'parameters' => array()
                    		);
                    		
                    		$CCSOAP_query = new SoapVar($cc_query_array, SOAP_ENC_OBJECT,"dtoQuery", "http://query.apiservice.bullhorn.com/");
                    		
                    		$cc_request_array = array (
                    		'session' => $API_currentSession,
                    		'query' => $CCSOAP_query);
                    		
                    		// Cast the request as a query type
                    		$CCSOAP_request = new SoapVar($cc_request_array, SOAP_ENC_OBJECT, "query", "http://query.apiservice.bullhorn.com/");
                    		
                    		// Use the query method to return the candidate ids
                    		try {
                    		$ccqueryResult = $BHclient->query($CCSOAP_request);
                    		} catch (SoapFault $fault) {
                    		var_dump($BHclient->__getLastRequest());
                    		die($fault->faultstring);
                    		}
                    	
                    	//var_dump($ccqueryResult);	
                    	$ccfindId_array =  array();
                    	$ccfindId_array = (array)$ccqueryResult->return->ids;
                    		foreach(array_chunk($ccfindId_array, 20) as $ccchunk)
                                {
                    		
                    		$ccfind_request = array(
                    			'session' => $API_currentSession,
                    			'entityName' => 'ClientCorporation',
                    			'ids' => $ccchunk
                    		);
                    			
                    	
                    		try {
                    		$findccs = $BHclient->findMultiple($ccfind_request);		
                    		} catch (SoapFault $fault) {
                    		var_dump($BHclient->__getLastRequest());
                    		die($fault->faultstring);
                    		}
                    		
                    		//var_dump($findccs);
                    		//echo '<br>I am here<br>';
                    	}*/
                    /*-----------------*/
                }
            } catch (SoapFault $fault) {
                var_dump($BHclient->__getLastRequest());
                die($fault->faultstring);
            }
        }
        ?>
		
	
        </div>
            
            <?php 
    }