Article Text won't save if previously saved with no content

Technical talks related to the Joom!Fish project. All those discussions are mostly related to development or high-profile usage of the extension.

Article Text won't save if previously saved with no content

Postby quodo on Fri Feb 03, 2012 5:31 pm

This thread got me intrigued: viewtopic.php?f=47&t=8375&start=10#p35213, especially after I noticed that I ran into the problem myself.

I can reproduce my problem now, and I suspect that in the above thread most users have the same problem, although perhaps there are more issues, can't tell...

System and setting details
    - Joomla 1.5.25
    - JoomFish 2.2.3 (upgraded from 2.0.4 via 2.1.7), second language: Dutch (nl-NL)
    - PHP 5.2.9 / Database MySQL 5.1.3 / Apache 2.2.1 (on Windows (Xampp)) / Browser: Mozilla Firefox 3.6.26
    - Editor TinyMCE (as came with Joomla)
    - Debug System: Yes / Error Reporting: Maximum

Reproduce (and play)
    - Backend > Components > JoomFish > Translation
    - Choose the language and 'Contents' for Content Element
    - Pick a translation with a readmore line in it, with introtext and text after readmore (checked in database: #__content has an introtext and a fulltext).
      - I made a test article for this, with this text (copied from when the editor is toggled off)
      Code: Select all
      <p>Text before Readmore.</p>
      <hr id="system-readmore" />
      <p>Text after Readmore.</p>

      line 1: introtext in #__content
      line 2: Readmore
      line 3: Fulltext in #__content
    - Copy all fields (no changes) and click apply: translation is saved ok
      - #__jf_content has reference field introtext with correct value
      - #__jf_content has reference field fulltext with correct value
    - Test: remove Readmore and text after that, then click apply
      - Text: <p>Text without Readmore.</p>
      - Introtext has text, fulltext has no text: in database there is an introtext field and a fulltext field with an empty value
    - Click apply again, without changing anything. Everything stays OK.
    - Click save, then try to edit the article again. Everything stays OK.
    - Now, clear the field with the label Article Text (leaving empty field: Joomla does not allow a user to save an article with no text, JoomFish does for its translation) and click apply
      - Now the introtext field is empty, and JoomFish deletes the entry from #__jf_content for the reference field introtext!
      - When, after the save, the edit page is shown again, indeed without an article text, check the contents of these fields:
      Code: Select all
      <input type="hidden" name="id_introtext" value="xxx" />
      <input type="hidden" name="id_fulltext" value="xxx" />
    They both have the same number, both id’s are from the fulltext. Where introtext, I think, shouldn't have an id, since there is no field for it in the database table.
    - Get some text again in this field, without a Readmore, and click apply
      - Text: <p>Text without Readmore.</p>
      - Joomfish now puts this text in introtext, but with stores it in the field with the wrong id, that of the fulltext and then stores the (empty) fulltext in its field. Result: not text is saved. (But that seems logical to me, you only keep the last text saved for a specific id...)
    - Now some text with a readmore and Apply: same problem, only the text after the readmore is now saved, the introtext translation does not exist in the #__jf_content table and the introtext and full text fields have the same (hidden) id-s in the edit page.
    - Result: user cannot save his translation (other than by removing the translations fields for the fulltext for this translation in the database (start over), e.g. where there is not introtext: can be done by deleting the translation in the Translate overview).

What can the user do now to 'fix' the problem?
1) Delete the translation(s) with problems: Backend > Components > JoomFish > Translation > [Select the translation(s) with problems] > Click Delete on the toolbar.
2) Either never save an article without any article text OR apply the solution proposed by Gofry at the solution proposed by Gofry proposes here viewtopic.php?f=47&t=8375&p=35301#p35469 to prevent problems when saving a translated article without any text in the article.

I've been tracking with Eclipse and jDump what JoomFish does when it stores the introtext/fulltext. Bottom line is that as far as I understand what is happening (and I'm new at this/JoomFish!) the solution proposed by Gofry proposes here viewtopic.php?f=47&t=8375&p=35301#p35469
allows the user to save with empty introtext AND empty fulltext, preventing problems for new articles that the user translates. It’s not a solution for articles already having a problem.
Gofry's solution prevents the introtext item being deleted if it's empty (in the same way an empty fulltext isn't deleted).

Possibly that has something to do with the id for the introtext that is the id for the full text in case of a non-existing introtext AND existing fulltext.
quodo
Contributor
 
Posts: 556
Joined: Wed Feb 03, 2010 3:08 pm

Return to Joom!Fish Tech-Talk

Who is online

Users browsing this forum: No registered users and 1 guest