Vox Populi(x) forum

Alexandria Book Library => Errori (Bugs) => Topic started by: A. Wayne Webb on 12 January 2013, 14:43:30

Title: ABL CSV export problem
Post by: A. Wayne Webb on 12 January 2013, 14:43:30
When I go to export a books category, such as "Fiction: Fantasy" all I get is a file with delimiters and quotes as below:


"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""
"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""


I see in another posting where Federica repaired the problem of a database with the string of "jos_" by changing it to "__".  I suspect I need to change <site>administrator/components/com_abook/models/importexport.php as described here (http://translate.google.com/translate?sl=it&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&eotf=1&u=http%3A%2F%2Fforum.voxpopulix.org%2Findex.php&act=url) to reflect my database string.

However, I get no error just an empty file.  Am I correct in that I need to replace "__" with "<variable string_>" where the variable is my database prefix?  This can be problematic in that many of the newer installations of Joomla use randomly generated strings of text as the first part of the database name.  This was done on their part as a security measure.

Cordially,
Wayne
Title: Re: ABL CSV export problem
Post by: federica on 12 January 2013, 18:40:28
This is the query that is used to export to csv. Try to run it, but before you have to substitute "#_" with your table prefix and modify the catid number in the WHERE.

SELECT title, subtitle, alias, ideditor, price, pag, user_id, created_by_alias, description, image, file,  year, idlocation, idlibrary, vote, numvote, hits, published, qty, isbn, approved, userid, url,  url_label, dateinsert, catalogo, checked_out, checked_out_time, access, metakey, metadesc, note, language, editedby,  GROUP_CONCAT(#__abbookauth.idauth SEPARATOR ',') as autori,  GROUP_CONCAT(#__abbooktag.idtag SEPARATOR ',') as tags  FROM #__abbook  LEFT JOIN #__abbookauth on #__abbookauth.idbook=#__abbook.id  LEFT JOIN #__abbooktag on #__abbooktag.idbook=#__abbook.id WHERE catid=2 GROUP BY #__abbook.id

What is the result?
Title: Re: ABL CSV export problem
Post by: A. Wayne Webb on 12 January 2013, 19:43:09
Quote from: federica on 12 January 2013, 18:40:28
This is the query that is used to export to csv. Try to run it, but before you have to substitute "#_" with your table prefix and modify the catid number in the WHERE.

SELECT title, subtitle, alias, ideditor, price, pag, user_id, created_by_alias, description, image, file,  year, idlocation, idlibrary, vote, numvote, hits, published, qty, isbn, approved, userid, url,  url_label, dateinsert, catalogo, checked_out, checked_out_time, access, metakey, metadesc, note, language, editedby,  GROUP_CONCAT(#__abbookauth.idauth SEPARATOR ',') as autori,  GROUP_CONCAT(#__abbooktag.idtag SEPARATOR ',') as tags  FROM #__abbook  LEFT JOIN #__abbookauth on #__abbookauth.idbook=#__abbook.id  LEFT JOIN #__abbooktag on #__abbooktag.idbook=#__abbook.id WHERE catid=2 GROUP BY #__abbook.id

What is the result?

Before I did that I went and opened the database ***_abbook and ran the export from MySql's menu.  That worked fine.

Then I went back and opened the abbook database again replacing the code:
SELECT * FROM `j25_abbook` WHERE 1

with

SELECT title, subtitle, alias, ideditor, price, pag, user_id, created_by_alias, description, image, file,  year, idlocation, idlibrary, vote, numvote, hits, published, qty, isbn, approved, userid, url,  url_label, dateinsert, catalogo, checked_out, checked_out_time, access, metakey, metadesc, note, language, editedby,  GROUP_CONCAT(j25_abbookauth.idauth SEPARATOR ',') as autori,  GROUP_CONCAT(j25_abbooktag.idtag SEPARATOR ',') as tags  FROM j25_abbook  LEFT JOIN j25_abbookauth on j25_abbookauth.idbook=j25_abbook.id  LEFT JOIN j25_abbooktag on j25_abbooktag.idbook=j25_abbook.id WHERE catid=4 GROUP BY j25_abbook.id

That got me a table with all the data in it.  At the bottom of the screen was an export link.  I exported with no problem.

While I was waiting for a response for my original posting, I tried some things.  I first copied the importexport.php file that came originally to my computer.  I then renamed the one on my server for safety.  The one on my computer then got edited.  In the importexport.php file I changed all the instances of "#__" to "j25_" in the "function datadumpCsv ($category) {" section.  There are 9 instances of the string of text.  Copying the file to my server I then refreshed my browser, cleaning the cache first.  The file I then got is a blank file, with nothing in it.  I was trying to export my Fiction: Fantasy catalog.  My browser indicates it is category ID 4.

If need be I can export using the MySql options as I understand how to do that.  But, for importing I am definitely not qualified to do so.  The other problem I will likely have is mapping of a different CSV file (different headers) when I go to import it into my existing database.

Cordially,
Wayne ;D