1
0
-1

I am doing a bunch of testing on V 3.3.2 before I move over to it. So once in a while I am clearing the datatbase. 

So I chose the option to export the data on the above 3 but they all fail.

If I try to import the cred or discovery csv file I get 

Total credentials uploaded: 3
Total Created: 0
Total Updated: 0
Total Errors: 3
Check your user has permission on the supplied organisation and/or the supplied credentials id exists.


If I try to import my locations.csv file I get - 


A Database Error Occurred

<p>Error Number: 1146</p><p>Table 'openaudit.$table' doesn't exist</p><p>/* include_import */ SELECT org_id FROM `$table` WHERE `id` = 2</p><p>Filename: C:\xampp\open-audit\code_igniter\system\database\DB_driver.php</p><p>Line Number: 329</p>



    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      That got rid of the db error but now I still get the following - 


      Total locations uploaded: 1
      Total Created: 0
      Total Updated: 0
      Total Errors: 1
      Check your user has permission on the supplied organisation and/or the supplied locations id exists.


      Total credentials uploaded: 3
      Total Created: 0
      Total Updated: 0
      Total Errors: 3
      Check your user has permission on the supplied organisation and/or the supplied credentials id exists


      Total discoveries uploaded: 10
      Total Created: 0
      Total Updated: 0
      Total Errors: 10
      Check your user has permission on the supplied organisation and/or the supplied discoveries id exists..

      1. Mark Unwin

        If you're uploading a CSV that contains an ID for each row, but there is no items in the table (ie, you've deleted all the locations), it will error like that. You need to remove the ID column from the CSV.

        Leaving the ID column means you want to update those items - but in this case they don't exist.

      2. Chad

        Still same type of error even after I remove that field.


        These are the only items left in the csv file. I removed all empty columns from the original export. 


        nametypesuiteaddresscitystatepostcodecountry
      3. Mark Unwin

        As per the import page in the application, you must include name and org_id at a minimum.

      4. Chad

        Alright so the issue with the Credentials export is all the fields have credentials.name, credentials.xxx and so on. Once I removed anything with credentials. it imported fine. Oh and like you mentioned remove the 1st column which is ID Column.

        The Discoveries export file seems to have more issues than the above one.

        After first opening the CSV file I see the following.

        <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

        <h4>A PHP Error was encountered</h4>

        <p>Severity: 4096</p>
        <p>Message: Object of class stdClass could not be converted to string</p>
        <p>Filename: helpers/output_helper.php</p>
        <p>Line Number: 418</p>

        </div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

        <h4>A PHP Error was encountered</h4>

        <p>Severity: 4096</p>
        <p>Message: Object of class stdClass could not be converted to string</p>
        <p>Filename: helpers/output_helper.php</p>
        <p>Line Number: 418</p>

        </div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

        <h4>A PHP Error was encountered</h4>

        <p>Severity: 4096</p>
        <p>Message: Object of class stdClass could not be converted to string</p>
        <p>Filename: helpers/output_helper.php</p>
        <p>Line Number: 418</p>

        </div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

        <h4>A PHP Error was encountered</h4>

        <p>Severity: 4096</p>
        <p>Message: Object of class stdClass could not be converted to string</p>
        <p>Filename: helpers/output_helper.php</p>
        <p>Line Number: 418</p>

        Also the field titles are like the following:


        </div>"discoveries.id" discoveries.name discoveries.org_id discoveries.description discoveries.type discoveries.devices_assigned_to_org discoveries.devices_assigned_to_location discoveries.network_address discoveries.system_id


        I did just remove all the PHP error stuff and the ID field and again discoveries. and was able to import it but is it meant to be this way. I would think I could just export it and import it.


      5. Mark Unwin

        Yes, it looks like the discoveries export / import is broken.

        I'll look into a patch.

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Chad,

      Thanks for letting us know. The fix is to edit the file (Windows)

      c:\xampp\open-audit\code_igniter\application\controllers\include_import.php

      Or Linux (I know you're on Windows, but for the Linux users):

      /usr/local/open-audit/code_igniter/application/controllers/include_import.php

      Line 104. Change from:

                      $sql = '/* include_import */ ' . 'SELECT org_id FROM `$table` WHERE `id` = ?';

      to:

                      $sql = '/* include_import */ ' . "SELECT org_id FROM `{$table}` WHERE `id` = ?";

      I was a bit overly cautious there. My apologies. This will obviously be fixed for our next release.

        CommentAdd your comment...