function pof_importer_tasksdriveimport_importRow($row, $row_index, $saveToDataBase = false)
{
    $agegroups_and_taskgroups = pof_importer_get_agegroups_and_taskgroups();
    if (empty($row['A']) || substr($row['A'], 0, 2) != 'KY' || empty($row['D'])) {
        if (!empty($row['D'])) {
            echo "Not importing, because row not setted to be imported: " . $row['D'];
        } else {
            if (empty($row['A'])) {
                return;
            }
            echo "Not importing, because row not setted to be imported, empty title. Row " . $row_index;
        }
        echo '<br />';
        return;
    }
    echo "<br />";
    echo "to be imported: " . $row['D'];
    /*
    	echo "<pre>";
    	print_r($row);
    	echo "</pre>";
    */
    $taskgroup_obj = new stdClass();
    $agegroup_title = pof_importer_normalize_title($row['B']);
    $taskgroup_title = pof_importer_normalize_title($row['C']);
    if (!empty($agegroups_and_taskgroups[$agegroup_title]) && !empty($agegroups_and_taskgroups[$agegroup_title]->taskgroups[$taskgroup_title])) {
        $taskgroup_obj = $agegroups_and_taskgroups[$agegroup_title]->taskgroups[$taskgroup_title];
    }
    if (empty($taskgroup_obj->id)) {
        echo "<h2>Couldn't find taskgroup '" . $row['C'] . "' for task '" . $row['D'] . "'</h2>";
        return;
    }
    $wp_error = false;
    $post = null;
    $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => array('pof_post_task'), 'meta_key' => 'suoritepaketti', 'meta_value' => $taskgroup_obj->id, 'search_post_title' => trim($row['D']));
    add_filter('posts_where', 'pof_importer_title_filter', 10, 2);
    $the_query_task = new WP_Query($args);
    remove_filter('posts_where', 'pof_importer_title_filter', 10, 2);
    if ($the_query_task->have_posts()) {
        while ($the_query_task->have_posts()) {
            $item = new stdClass();
            $the_query_task->the_post();
            $post = $the_query_task->post;
        }
    }
    if (empty($post)) {
        echo "  POST NOT FOUND; TO BE CREATED";
        if ($saveToDataBase) {
            $post = array('post_title' => trim($row['D']), 'post_content' => $row['F'], 'post_type' => 'pof_post_task', 'post_status' => 'publish', 'post_author' => get_current_user_id());
            $post_id = wp_insert_post($post, $wp_error);
            echo "imported, post_id: " . $post_id;
            $post = get_post($post_id);
        }
    } else {
        echo "  POST FOUND; TO BE UPDATED";
        $post_id = $post->ID;
    }
    if ($saveToDataBase) {
        update_post_meta($post_id, "suoritepaketti", $taskgroup_obj->id);
        update_field("ingress", $row['E'], $post_id);
        update_field("leader_tasks_fi", $row['G'], $post_id);
        $post->post_title = trim($row['D']);
        $post->post_content = $row['F'];
        $post->post_author = get_current_user_id();
        update_post_meta($post_id, "task_duration", trim(str_replace(" min", "", $row['M'])));
        if (substr(strtolower($row['K']), 0, 2) == 'ky') {
            update_field("task_mandatory", 1, $post_id);
        } else {
            update_field("task_mandatory", 0, $post_id);
        }
        $places = pof_importer_get_places($row['L']);
        update_field("task_place_of_performance", $places, $post_id);
        update_field("task_level", pof_importer_get_level($row['N']), $post_id);
        echo " updated places, " . count($places) . " items,";
        $skillareas = pof_importer_get_skillareas(trim($row['I']));
        wp_set_post_terms($post_id, $skillareas, "pof_tax_skillarea", false);
        $growth_targets = pof_importer_get_growth_targets(trim($row['H']));
        wp_set_post_terms($post_id, $growth_targets, "pof_tax_growth_target", false);
        update_post_meta($post_id, "content_imported_fi", pof_settigs_getDatetimeNow());
        wp_update_post($post, $wp_error);
    }
    echo "<br />";
}
function pof_importer_suggestionssdriveimport_importRow($row, $row_index, $saveToDataBase = false)
{
    $agegroups_and_taskgroups = pof_importer_get_agegroups_and_taskgroups();
    if (empty($row['A']) || substr($row['A'], 0, 2) != 'KY' || empty($row['D'])) {
        if (empty($row['A'])) {
            return;
        }
        if (!empty($row['D'])) {
            echo "Not importing, because row not setted to be imported: " . $row['D'];
        } else {
            echo "Not importing, because row not setted to be imported, empty title. Row " . $row_index;
        }
        echo '<br />';
        return;
    }
    echo "<br />";
    echo "to be imported:" . $row['F'];
    echo "<br />";
    /*
    	echo "<pre>";
    	print_r($row);
    	echo "</pre>";
    */
    $taskgroup_obj = new stdClass();
    $agegroup_title = pof_importer_normalize_title($row['B']);
    $taskgroup_title = pof_importer_normalize_title($row['C']);
    if (!empty($agegroups_and_taskgroups[$agegroup_title]) && !empty($agegroups_and_taskgroups[$agegroup_title]->taskgroups[$taskgroup_title])) {
        $taskgroup_obj = $agegroups_and_taskgroups[$agegroup_title]->taskgroups[$taskgroup_title];
    }
    if (empty($taskgroup_obj->id)) {
        echo "<h2>Couldn't find taskgroup '" . $row['C'] . "' for suggestion '" . $row['F'] . "'</h2>";
        return;
    }
    $wp_error = false;
    $post = null;
    $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => array('pof_post_task'), 'meta_key' => 'suoritepaketti', 'meta_value' => $taskgroup_obj->id, 'search_post_title' => $row['D']);
    add_filter('posts_where', 'pof_importer_title_filter', 10, 2);
    $the_query_task = new WP_Query($args);
    remove_filter('posts_where', 'pof_importer_title_filter', 10, 2);
    if ($the_query_task->have_posts()) {
        while ($the_query_task->have_posts()) {
            $the_query_task->the_post();
            $task = $the_query_task->post;
        }
    }
    if (empty($task)) {
        echo "<h2>Couldn't find task '" . $row['D'] . "' for suggestion '" . $row['F'] . "'</h2>";
        return;
    }
    $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => array('pof_post_suggestion'), 'meta_key' => 'pof_suggestion_task', 'meta_value' => $task->ID, 'search_post_title' => $row['F']);
    add_filter('posts_where', 'pof_importer_title_filter', 10, 2);
    $the_query_suggestion = new WP_Query($args);
    remove_filter('posts_where', 'pof_importer_title_filter', 10, 2);
    if ($the_query_suggestion->have_posts()) {
        while ($the_query_suggestion->have_posts()) {
            $the_query_suggestion->the_post();
            $post = $the_query_suggestion->post;
        }
    }
    if (empty($post)) {
        echo "POST NOT FOUND; TO BE CREATED<br />";
        if ($saveToDataBase) {
            $post = array('post_title' => trim($row['B']), 'post_content' => $row['F'], 'post_type' => 'pof_post_suggestion', 'post_status' => 'publish', 'post_author' => get_current_user_id());
            $post_id = wp_insert_post($post, $wp_error);
            echo "imported, post: <a href=\"/wp-admin/post.php?post=" . $post_id . "&action=edit\" target=\"_blank\">" . $post_id . "</a>";
            echo "<br />";
            $post = get_post($post_id);
        }
    } else {
        echo "POST FOUND; TO BE UPDATED: <a href=\"/wp-admin/post.php?post=" . $post_id . "&action=edit\" target=\"_blank\">" . $post_id . "</a><br />";
        $post_id = $post->ID;
    }
    if ($saveToDataBase) {
        update_post_meta($post_id, "pof_suggestion_task", $task->ID);
        update_post_meta($post_id, "pof_suggestion_lang", pof_importer_suggestions_get_language($row['C']));
        update_post_meta($post_id, "pof_suggestion_writer", $row['D']);
        $post->post_title = trim($row['F']);
        $post->post_content = $row['I'];
        $post->post_author = get_current_user_id();
        // TODO: read publish time
        wp_update_post($post, $wp_error);
    }
}