I am geeting the below error A necessary field "Summary" was empty. Please recheck your inputs.Can anyone suggest how to proceed.

I have mapped the summary column in import but still shows the error.

<?php
class Csv_importPlugin extends MantisPlugin
{
    function register() {
        $this->name = plugin_lang_get( 'title' );
        $this->description = plugin_lang_get( 'description' );

        $this->version = '2.0.0';
        $this->requires = array( 'MantisCore' => '2.0.0' );
        $this->author = 'Bug 4220 Team';
        $this->contact = 'https://github.com/mantisbt-plugins/csv-import/';
        $this->url = 'https://github.com/mantisbt-plugins/csv-import/';
        $this->page = 'config';
    }

    function config() {
        return array(
            'import_issues_threshold'   => MANAGER ,
            );
    }

    function hooks() {
        return array(
            'EVENT_MENU_MANAGE' => 'csv_import_menu',
        );
    }

    function csv_import_menu() {
        return array(
            '<a href="' . plugin_page( 'import_issues_page_init' ) . '">' . plugin_lang_get( 'manage_issues_link' ) . '</a>',
        );
    }
}

1 Answers

0
Kwaku amoh On

Try this. No need of plugin

Let's say you have a CSV file with file columns

$file = $_FILES['csv_file']['tmp_name']; //get CSV file
$handle = fopen($file, "r"); //handle
    while(($filesop = fgetcsv($handle, 1000, ",")) !== false){ //start while loop

$sname = $filesop[0];              
$fname = $filesop[1];
$oname = $filesop[2];
$gender= $filesop[3];
$country= $filesop[4];

    // Put your SQL code to insert before while loop ends
    } //end while loop