cf_si_process_form_client

Function runs on form process to create an estimate.

Description

cf_si_process_form_client( $config, $form ); 

This will create the Estimate and Client and Return the Estimate ID which is then a magic tag.

Parameters (2)

0. $config
The config.
1. $form
The form.

Usage

  1. if ( !function_exists( 'cf_si_process_form_client' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'caldera-forms-sprout-invoices-integration/cf-sprout-invoice.php'; 
  3.  
  4. // The config. 
  5. $config = null; 
  6.  
  7. // The form. 
  8. $form = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cf_si_process_form_client($config, $form); 
  12.  

Defined (1)

The function is defined in the following location(s).

/cf-sprout-invoice.php  
  1. function cf_si_process_form_client($config, $form) { 
  2. global $transdata; 
  3.  
  4. foreach ($config as $key => &$value) { 
  5. $value = Caldera_Forms::do_magic_tags($value); 
  6. // Set Values 
  7. $email = $config['email']; 
  8. $client_name = $config['client_name']; 
  9. $full_name = $config['first_name'] . ' ' . $config['first_name']; 
  10. $website = $config['website']; 
  11. $contact_street = $config['street_address']; 
  12. $contact_city = $config['city']; 
  13. $contact_zone = $config['state']; 
  14. $contact_postal_code = $config['postal_code']; 
  15. $contact_country = $config['country']; 
  16.  
  17. // build the client arguments 
  18. $client_args = array( 
  19. 'email' => $email,  
  20. 'client_name' => $client_name,  
  21. 'full_name' => $full_name,  
  22. 'website' => $website,  
  23. 'contact_street' => $contact_street,  
  24. 'contact_city' => $contact_city,  
  25. 'contact_zone' => $contact_zone,  
  26. 'contact_postal_code' => $contact_postal_code,  
  27. 'contact_country' => $contact_country 
  28. ); 
  29. // maybe create a client? 
  30. cf_si_maybe_create_client( null, $client_args ); 
  31.