Пример #1
0
/**
 * Checks if event employees have been paid in full.
 *
 * @since	1.3
 * @param	int		$event_id		The event ID.
 * @param	int		$employee_id	User ID of employee to check
 * @return	bool	True if all employees, or selected employee have been paid.
 *					False if one employee, or the selected employee has not been paid.
 *					If no employees are assigned, a true value is returned.
 */
function mdjm_event_employees_paid($event_id, $employee_id = '')
{
    if (!mdjm_get_option('enable_employee_payments')) {
        return false;
    }
    $employees = mdjm_get_all_event_employees($event_id);
    if (empty($employees)) {
        return true;
    }
    if (!empty($employee_id)) {
        if ($employees[$employee_id]['payment_status'] != 'paid' && 'Completed' != get_post_meta($employees[$employee_id]['txn_id'], '_mdjm_txn_status', true)) {
            return false;
        }
    } else {
        foreach ($employees as $employee) {
            if ($employee['payment_status'] != 'paid' && 'Completed' != get_post_meta($employee['txn_id'], '_mdjm_txn_status', true)) {
                return false;
            }
        }
    }
    return true;
}
Пример #2
0
/**
 * Content tag: event_employees.
 * List of event employees.
 *
 * @param	int		The event ID.
 * @param
 *
 * @return	str		List of employees working the event.
 */
function mdjm_content_tag_event_employees_roles($event_id = '')
{
    if (empty($event_id)) {
        return;
    }
    $employees = mdjm_get_all_event_employees($event_id);
    if (empty($employees)) {
        return;
    }
    foreach ($employees as $employee_id => $employee_data) {
        $event_employees[] = mdjm_get_employee_display_name($employee_id) . ' - ' . $employee_data['role'];
    }
    $return = implode('<br />', $event_employees);
    return $return;
}