wpcrm_system_create_wonlost

The wpcrm_system_create_wonlost allows you to filter the won/lost status used when creating new records.

The function checks to see if the status that is being imported is valid against the array of statuses that are included in the $statuses variable that is passed to the filter. If so, the function returns the correctly formatted status, and if not it returns ‘not-set’.

This can allow you to include statuses that are formatted slightly differently, yet still have the values displayed correctly in WP-CRM System.

Statuses included by default are:

$statuses    = array(
     'not-set'    =>    'not-set',
     'not set'    =>    'not-set',
     'won'        =>    'won',
     'lost'        =>    'lost',
     'suspended'    =>    'suspended',
     'abandoned'    =>    'abandoned',
 );

Why are there duplicate values in the array?

The function checks the keys against the value that is being passed to the filter. If the keys are not formatted exactly correctly (i.e. missing a hyphen), we still want to allow the field to be updated with the correct value. In this case, we don’t care if you pass ‘not-set’ or ‘not set’, both will correctly return ‘not-set’.

If you have a similar situation, perhaps with a different variation to the valid statuses that are not included above, you can add or edit this array to include your variation. The only requirement is that the value returned is one of the existing values shown in the array above.