Пример #1
0
/**
 * Customer Restore from trash
 *
 * @since 1.0
 *
 * @param  array|int $customer_ids
 *
 * @return void
 */
function erp_crm_customer_restore($customer_ids)
{
    if (empty($customer_ids)) {
        return;
    }
    if (is_array($customer_ids)) {
        foreach ($customer_ids as $key => $user_id) {
            WeDevs\ERP\Framework\Models\People::withTrashed()->find($user_id)->restore();
        }
    }
    if (is_int($customer_ids)) {
        WeDevs\ERP\Framework\Models\People::withTrashed()->find($customer_ids)->restore();
    }
}
Пример #2
0
/**
 * Fetch a single people from database
 *
 * @since 1.0
 *
 * @param int   $id
 *
 * @return array
 */
function erp_get_people($id = 0)
{
    $cache_key = 'erp-people-single-' . $id;
    $people = wp_cache_get($cache_key, 'wp-erp');
    if (false === $people) {
        $peep = WeDevs\ERP\Framework\Models\People::withTrashed()->find($id);
        if ($peep->id) {
            $people = (object) $peep->toArray();
            wp_cache_set($cache_key, $people, 'wp-erp');
        }
    }
    return $people;
}