Search

I just pushed some bugfixes, fixing some various bugs:

  • in some cases not all entries where imported
  • when a field was set to "don't use", it would cause an error while importing
  • bugfix for exporting Select Box Link and Reference Link fields when the value was NULL

Hey Giel, is the latest in the repo on git then? or are all changes in that driver file in last post?

The Git repo is the latest.

As fortune would have it, today I had to do some work for a client which greatly relied on the Import/Export module, so a lot of bugs have been fixed and features/drivers are added! :-)

Woop! cheers. :)

Geil, just updated to the latest version, enabled it in extensions.

I'm importing into a different section now with more than one field.

Symphony Fatal Database Error
Table 'symphony_cashflow.sym_entries_data_' doesn't exist

An error occurred while attempting to execute the following query

    DELETE FROM sym_entries_data_ WHERE `entry_id` = '1527'

Backtrace:

    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/symphony/lib/toolkit/class.mysql.php:458] MySQL->__error();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/symphony/lib/toolkit/class.mysql.php:586] MySQL->query();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/symphony/lib/toolkit/class.entrymanager.php:149] MySQL->delete();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/symphony/lib/toolkit/class.entry.php:295] EntryManager->add();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/extensions/importcsv/content/content.index.php:304] Entry->commit();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/extensions/importcsv/content/content.index.php:43] contentExtensionImportcsvIndex->__ajaxImportRows();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/symphony/lib/toolkit/class.administrationpage.php:260] contentExtensionImportcsvIndex->view();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/extensions/importcsv/content/content.index.php:25] AdministrationPage->build();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/symphony/lib/core/class.administration.php:222] contentExtensionImportcsvIndex->build();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/symphony/lib/core/class.administration.php:375] Administration->__buildPage();
    [/Users/designermonkey/Projects/Symphony/cashflow/httpdocs/index.php:25] Administration->display();

Database Query Log:

    SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'; [0.0001]
    SET CHARACTER SET 'utf8'; [0.0001]
    SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = '8b4e5cb0e88e0dab8091f2090232f868' LIMIT 1; [0.0002]
    SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled'; [0.0002]
    SELECT SQL_CACHE `id` FROM `sym_authors` WHERE `username` = 'john-porter' AND `password` = '***' LIMIT 1; [0.0002]
    UPDATE sym_authors SET `last_seen` = '2011-07-10 14:12:50' WHERE `id` = '1'; [0.0002]
    SELECT SQL_CACHE * FROM `sym_authors` WHERE `id` IN (1) ORDER BY id ASC; [0.0002]
    SELECT SQL_CACHE * FROM `sym_extensions`; [0.0004]
    SELECT SQL_CACHE * FROM `sym_authors` WHERE `username` = 'john-porter' LIMIT 1; [0.0002]
    SELECT SQL_CACHE * FROM `sym_sections` ORDER BY `sortorder` ASC; [0.0004]
    SELECT SQL_CACHE * FROM `sym_authors` WHERE `username` = 'john-porter' LIMIT 1; [0.0003]
    SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled'; [0.0004]
    SELECT SQL_NO_CACHE * FROM `sym_cache` WHERE `hash` = 'importcsv' AND (`expiry` IS NULL OR UNIX_TIMESTAMP() <= `expiry`) LIMIT 1; [0.0003]
    SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`id` = '19' LIMIT 1; [0.0002]
    SELECT SQL_CACHE * FROM `sym_fields_selectbox_link` WHERE `field_id` = '19' LIMIT 1; [0.0002]
    SELECT SQL_CACHE `related_field_id` FROM `sym_fields_selectbox_link` WHERE `field_id` = 19; [0.0002]
    SELECT SQL_CACHE `entry_id` FROM `sym_entries_data_3` WHERE `value` = '1';; [0.0002]
    SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`id` = '11' LIMIT 1; [0.0002]
    SELECT SQL_CACHE * FROM `sym_fields_number` WHERE `field_id` = '11' LIMIT 1; [0.0002]
    SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`id` = '20' LIMIT 1; [0.0002]
    SELECT SQL_CACHE * FROM `sym_fields_datetime` WHERE `field_id` = '20' LIMIT 1; [0.0003]
    SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`id` = '13' LIMIT 1; [0.0002]
    SELECT SQL_CACHE * FROM `sym_fields_textbox` WHERE `field_id` = '13' LIMIT 1; [0.0002]
    SELECT SQL_CACHE f.id FROM `sym_entries_data_13` AS f WHERE f.handle = 'asda-home-delivery' LIMIT 1; [0.0003]
    SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`id` = '17' LIMIT 1; [0.0001]
    SELECT SQL_CACHE * FROM `sym_fields_number` WHERE `field_id` = '17' LIMIT 1; [0.0001]
    SELECT SQL_CACHE `s`.* FROM `sym_sections` AS `s` WHERE `s`.`id` = '4'; [0.0002]
    SELECT SQL_CACHE t1.* FROM sym_fields as t1 WHERE 1 AND t1.`parent_section` = '4' ORDER BY t1.`sortorder` ASC; [0.0003]
    SELECT SQL_CACHE * FROM `sym_fields_subsectionmanager` WHERE `field_id` = '14' LIMIT 1; [0.0002]
    SELECT SQL_CACHE * FROM `sym_fields_reflection` WHERE `field_id` = '16' LIMIT 1; [0.0002]
    SELECT SQL_CACHE * FROM `sym_fields_reflection` WHERE `field_id` = '18' LIMIT 1; [0.0002]
    INSERT INTO `sym_entries` (`section_id`, `creation_date`, `creation_date_gmt`) VALUES ('4', '2011-07-10T14:12:50+01:00', '2011-07-10T13:12:50+00:00'); [0.0001]
    DELETE FROM sym_entries_data_19 WHERE `entry_id` = '1527'; [0.0001]
    INSERT INTO `sym_entries_data_19` (`entry_id`, `relation_id`) VALUES ('1527', NULL); [0.0001]
    DELETE FROM sym_entries_data_11 WHERE `entry_id` = '1527'; [0.0001]
    INSERT INTO `sym_entries_data_11` (`entry_id`, `value`) VALUES ('1527', '457'); [0.0001]
    DELETE FROM sym_entries_data_13 WHERE `entry_id` = '1527'; [0.0001]
    INSERT INTO `sym_entries_data_13` (`entry_id`, `handle`, `value`, `value_formatted`, `word_count`) VALUES ('1527', 'asda-home-delivery', 'ASDA HOME DELIVERY', 'ASDA HOME DELIVERY', '3'); [0.0002]
    DELETE FROM sym_entries_data_17 WHERE `entry_id` = '1527'; [0.0001]
    INSERT INTO `sym_entries_data_17` (`entry_id`, `value`) VALUES ('1527', '3.00'); [0.0001]
    DELETE FROM sym_entries_data_ WHERE `entry_id` = '1527'; [0.0000]

There are two reflection fields in the section which are being ignored (i.e. there are no values for them).

The difference since the upgrade is that your importer breaks the layout of Symphony when these errors display, the CSS goes haywire. (screenshot attached).

The first entry and last from the list are imported, but with most of the information missing. The error above is displayed for every entry in the list.

I've attached a screenshot of the section editor screen.

Attachments:
Symphony – Sections – Transactions_1310304467633.png and Symphony Fatal Error_1310302698864.png

I haven't tested the extension with 'Number'- and 'Reflection Link'-fields, so I'm not sure if the problem is with one of these fields. It could be that there need to be a driver for one or both of these fields, but both of the fields seem to store the data in a row named value which should work with the default driver.

The error seems to occur due to a lack of a field-ID when creating the delete-query. Therefore it can't complete the tablename in the query (resulting in a sym_entries_date_). I am only wondering where this delete-query is executed, since my extension doesn't delete anything. Could this be default behaviour of the entry->commit()-function?

Could you narrow it down into which field the importing fails?

If I remember right, an entry commit will try and delete an existing entry with the same ID first.

If it's not your extension doing that then yeah it's probably a field. As I'm not on top of knowledge about these things, does your extension call the fields entry->commit() function? If so, then it shouldn't be too difficult to track down.

It's bed time first though ;o) Will look tomorrow yawn

Ok, so I couldn't wait. I've hacked the entry manager to dump out the data and dummy ran it on one entry. Here's the weird part...

All the fields are accounted for, and have values, but oddly a ghost field has appeared in the list, here's the var_dump of the entry data.

array
  19 => 
    array
      'relation_id' => 
        array
          0 => null
  11 => 
    array
      'value' => string '600' (length=3)
  13 => 
    array
      'handle' => string 'test-entry' (length=10)
      'value' => string 'TEST ENTRY' (length=10)
      'value_formatted' => string 'TEST ENTRY' (length=10)
      'word_count' => int 2
  17 => 
    array
      'value' => string '-3.25' (length=5)
  '' => 
    array
      'value' => null
  20 => null
  14 => null
  16 => 
    array
      'handle' => null
      'value' => null
      'value_formatted' => null
  18 => 
    array
      'handle' => null
      'value' => null
      'value_formatted' => null

As you can see, there's a ghost field there. Has anyone ever come across this before? I've never seen this before myself, I've seen it when a field goes awry and doesn't pass it's id forward, but all the fields are accounted for in the list.

Very weird.

Geil, I'm thinking there could be something wrong with the csv data?

Account,Number,Date,Transaction,Withdrawals
1,600,2011/07/06,TEST ENTRY,-3.25

Can you see anything here?

The entry was created, and the missing data that wasn't entered was the date (Date Time field) and the account (Select Box Link field). The date is in the same format specified in the config file, and the account is the ID of the Linked section in the SBL.

I'm confused...

I've set every field to don't use and run each field one by one to see which one errors, and it errors on every field individually. This says to me that it isn't the fields.

I don't know what's going on, but I really must call it a Night tonight.

It's happening at class.entry.php line 293 with the findDefaultData function, which is picking up the extra fields and appending a blank 'ghost' to the list.

Got a weird issue when importing from a CSV yesterday. Latest release of extension.

1 text field in a section. Import works fine, but every field seemed to have 1 empty space before the actual text of the entry.. so I get (space)Client name and weirdly this is affecting my datasource sorting cos the filter is interpreting the space as part of the string and ordering alphabetically is all to pot.. Had to manually edit all 300 entries to remove the space. Is this something others have encountered?

Does your CSV data contain separation by coma and space like ', ' that would probably cause that...

Ahhh the little tinker.. it probably does John and I just haven't noticed... #fail :(

Actually saying that, the CSV was exported from the extension first then used to populate content and imported back into section... so not sure.. I'll check tomorrow and see if it was separated correctly.

This is weird, I recall coming across this issue myself in the past, and therefore I added trim()-commands to the code.

But since the last major update (when the extension became driver-based), the extensions im- and exports the literal value from the database/csv-file. Perhaps I should bring back the trim()-command then?

It definately occurs on my 2.2.1 install each time I export as csv from section.. insert data into csv and then re-import the csv into the section.. re-introducing trim() might solve this for me.. not sure how many others have encountered this though. Having the space at the start affects datasource sorting as well... where's best to report this?

Weird, I tried exporting with the latest version of this extension, and there is no space added in front of the value.

Nevertheless, re-introducing trim() couldn't make things worse... I'll pick it up from here

Ok cool.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details