dollar ($) signs missing on new records

A place for users and developers of the Xataface to discuss and receive support.

dollar ($) signs missing on new records

Postby jimr451 » Thu Sep 29, 2011 8:26 am

Hi,

I have a strange problem. I have a table "A" with a "relationship" set up to table "B" (1 to many).

So when editing a record in table "A", there's a tab that shows the related records in "B", and you can edit / add new records in table "B". Works as expected.

I also have a separate menu option allowing you to edit / add records to "B" directly, pretty plain vanilla.

Now, the issue. There's a text field in table "B" - that often has $ values in it - like "$1 off XYZ" etc. When you add a new record from the sub-tab noted above, the $ gets dropped. The record is saved perfectly otherwise. If you edit the record and add back the $, it keeps, and all it well.

If you add a new record to "B" using the "side menu" option noted above, the $ keeps just fine. Note that all $ seem to get wiped out when the bug occurs.

If someone can point me to a spot in the code where I can start looking, I don't mind debugging the code myself. I'm on the latest 1.3 release.

-Jim
Jim Roberts
Roberts WebForge, Inc.
http://www.robertswebforge.com
jimr451
 
Posts: 20
Joined: Mon Jun 27, 2011 1:46 pm

Re: dollar ($) signs missing on new records

Postby jimr451 » Wed Oct 19, 2011 1:14 pm

I debugged this and figured out where the problem occurs:

In Relationship.php, around line 1186:

Code: Select all
$table_cols[$table][$field] = ( is_scalar(@$vals[$label]) and $record !== null  and !preg_match('/(blob|binary)/', strtolower($fieldArr['Type'])) ) ? $record->parseString(@$vals[$label]) : @$vals[$label];


This calls parseString in Record.php (around line 306)

In that function, the string is searched for "$" variables for substitution. This is what is taking out the $ in the string on insert.

I put in an awful workaround because I wasn't sure what else relied on this code.

-Jim
Jim Roberts
Roberts WebForge, Inc.
http://www.robertswebforge.com
jimr451
 
Posts: 20
Joined: Mon Jun 27, 2011 1:46 pm

Re: dollar ($) signs missing on new records

Postby shannah » Wed Oct 19, 2011 1:19 pm

Yes... this is some of the magic code that allows relationships to work. Looks like I need to look at this closely find out why it isn't escaping the literal $xyz strings properly so they aren't treated like wildcards.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 10 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved