Ticket #840 (closed defect: fixed)

Opened 14 months ago

Last modified 7 months ago

Incorrect draft filenames

Reported by: vaibhav Owned by: somebody
Priority: must Milestone: 2.1.1
Component: Codegen Version: 2.1.0 Stable
Keywords: drafts incorrect filename Cc:

Description

If you create a table with name like item_category_l1 then the draft file that gets created for Create new action would have the 'Cancel' button working erroneously. It tries to redirect to item_category_l1_list.php (which is correct, as that is what the name should be according to the table name) but the file does not exist. The reason is that the draft file creation during the codegen run will generate files using QConvertNotation::UnderscoreFromCamelCase($objTable->ClassName while the links for redirection are created using the strtolower($objTable->Name) call. The attached patch fixes this.

Attachments

drafts_correct_filename.patch Download (4.2 KB) - added by vaibhav 14 months ago.
ticket840.patch Download (1.7 KB) - added by vakopian 13 months ago.
my proposed fix

Change History

Changed 14 months ago by vaibhav

Changed 13 months ago by vakopian

I would prefer to fix the links in the redirection code, because changing file names will cause lots of headaches with version management systems (i.e. the old files will remain, since codegen will not delete the old files, new files will be created, and developers have to start copying, moving files with "svn mv" and such).

Changed 13 months ago by vakopian

my proposed fix

Changed 13 months ago by vakopian

  • status changed from new to in_QA

Changed 12 months ago by vakopian

vaibhav, do you agree with my fix?

Changed 11 months ago by vaibhav

Ummm... I think that it would be better if we actually kept the table name (as it is)in the file and try to redirect there instead of changing the redirection call! It becomes easy for the developer to figure out the filename to search for (in case he ever has to do it...well, I had to). Your patch seems to work but the filenames remain wrong!

Changed 10 months ago by vaibhav

I guess you were right Vakopian. However, I am unable to figure out what exactly does your patch do? Doesn't it convert the right file names to the wrong ones?

How about changing the file names to Class Names rather? For example, if there are tables in different databases with the same name then the codegen process will overwrite the draft file of either of them (depending on which one ran later). However, if we use filenames which utilize classnames as the prefix (before '_edit' or '_list' that appear in the file name), we would effectively overcome that issue - two classnames would not be similar dues to prefixing which would be applied anyway for the different database table classes by the developer.

What do you say?

Changed 7 months ago by vakopian

  • status changed from in_QA to closed
  • resolution set to fixed

(In [1503]) fixes #840

Note: See TracTickets for help on using tickets.