コード例 #1
0
 public function get_exceptions()
 {
     global $wpdb;
     $table = appointments_get_table('exceptions');
     return $wpdb->get_results($wpdb->prepare("SELECT * FROM {$table} WHERE worker = %d", $this->ID));
 }
コード例 #2
0
/**
 * Delete a service
 *
 * @param int $service_id
 *
 * @return bool|false|int
 */
function appointments_delete_service($service_id)
{
    global $wpdb;
    if (!appointments_get_service($service_id)) {
        return false;
    }
    $table = appointments_get_table('services');
    $service_id = absint($service_id);
    $result = $wpdb->query($wpdb->prepare("DELETE FROM {$table} WHERE ID = %d", $service_id));
    // Remove the service from all workers
    $table = appointments_get_table('workers');
    $wpdb->query($wpdb->prepare("UPDATE {$table} SET services_provided = REPLACE( services_provided,':%d:','' )", $service_id));
    if ($result) {
        appointments_delete_service_cache($service_id);
        return true;
    }
    return false;
}
コード例 #3
0
/**
 * Delete an appointment forever
 *
 * @param $app_id
 *
 * @return bool|false|int
 */
function appointments_delete_appointment($app_id)
{
    global $wpdb;
    $app = appointments_get_appointment($app_id);
    if (!$app) {
        return false;
    }
    $table = appointments_get_table('appointments');
    $result = $wpdb->query($wpdb->prepare("DELETE FROM {$table} WHERE ID = %d", $app_id));
    appointments_clear_appointment_cache($app_id);
    return (bool) $result;
}