Problem with relationship

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

Re: Problem with relationship

Postby 00Davo » Mon Jan 04, 2010 8:02 pm

I think the permissions problem goes a bit deeper than this one issue. From the documentation, I discover that there should be buttons in the relationship tab to let me add new related records, or associate existing records, and things like that. But no such buttons exist. I suspect that I lack the "add related record" permission too. :(
00Davo
 
Posts: 55
Joined: Sat Jan 02, 2010 9:02 pm

Re: Problem with relationship

Postby HWT » Tue Jan 05, 2010 9:21 am

I think OODavo has the exactly same problem. I have no news so far but I keep up following this thread.
HWT
 
Posts: 7
Joined: Tue Dec 29, 2009 12:02 pm

Re: Problem with relationship

Postby shannah » Tue Jan 05, 2010 9:36 am

I suspect that this may be related to the PHP 5.3 parse_ini_file bug, but I won't know for sure until I'm able to set up a PHP 5.3 instance. One other peculiar thing is in the print_r($perms) output you provided, it included a permission 'all'. There is no such permission.... so somewhere along the line it is loading a phantom permission....
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problem with relationship

Postby HWT » Tue Jan 05, 2010 10:02 am

shannah wrote:I suspect that this may be related to the PHP 5.3 parse_ini_file bug, but I won't know for sure until I'm able to set up a PHP 5.3 instance. One other peculiar thing is in the print_r($perms) output you provided, it included a permission 'all'. There is no such permission.... so somewhere along the line it is loading a phantom permission....


I support your guess that it's in some way an incompatibility with PHP 5.3: I had the opportunity to move to an 5.3.x environment and the completely equal installation works.
HWT
 
Posts: 7
Joined: Tue Dec 29, 2009 12:02 pm

Re: Problem with relationship

Postby shannah » Tue Jan 05, 2010 10:52 am

I had the opportunity to move to an 5.3.x environment and the completely equal installation works.


Do you mean 5.2.x?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problem with relationship

Postby shannah » Tue Jan 05, 2010 10:53 am

I'm installing Xamp right now with PHP 5.3.1 so I'll be able to test and see what is happening some time today.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problem with relationship

Postby HWT » Tue Jan 05, 2010 1:10 pm

shannah wrote:
I had the opportunity to move to an 5.3.x environment and the completely equal installation works.


Do you mean 5.2.x?


Yes, sorry for the typo
HWT
 
Posts: 7
Joined: Tue Dec 29, 2009 12:02 pm

Re: Problem with relationship

Postby shannah » Tue Jan 05, 2010 6:08 pm

I finally got Xampp installed with PHP 5.3.0. It allowed me to see the mess. I have made some changes to work around the parse_ini_file bug, and I've done some work to remove all of those pesky deprecation warnings.

Note, that I haven't done a great deal of testing on this release (hence the b1 marking), but nothing critical was really changed, so I think it should be ok.

You can find the download link here:

viewtopic.php?f=4&t=5101&p=24842#p24842
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problem with relationship

Postby 00Davo » Tue Jan 05, 2010 6:24 pm

I think the permissions were fixed, but I still have issues. :(
Code: Select all
Warning: defined() expects parameter 1 to be string, resource given in C:\xampp\xampp\htdocs\newypt\xataface\Dataface\QuickForm.php on line 213

I now have all the missing buttons, but when I try one (adding a existing related record), I just get the above error and this one:
Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\xampp\htdocs\newypt\xataface\Dataface\QuickForm.php:213) in C:\xampp\xampp\htdocs\newypt\xataface\actions\existing_related_record.php on line 107

The change is not actually made.

This is not good. :(

EDIT: It's a many-to-many. The central linking table does receive a new record when I try to relate them, but it doesn't include the foreign ID:
Code: Select all
--
-- Table structure for table `family`
--

CREATE TABLE IF NOT EXISTS `family` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ParentID` int(11) DEFAULT NULL,
  `StudentID` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `family`
--

INSERT INTO `family` (`ID`, `ParentID`, `StudentID`) VALUES
(1, 0, 8),
(2, 0, 10),
(3, 0, 10),
(4, 0, 10),
(5, 0, 10),
(6, 0, 10);
00Davo
 
Posts: 55
Joined: Sat Jan 02, 2010 9:02 pm

Re: Problem with relationship

Postby shannah » Tue Jan 05, 2010 6:39 pm

Change the line
Code: Select all
if ( !$db and defined(DATAFACE_DB_HANDLE) ){

to
Code: Select all
if ( !$db and defined('DATAFACE_DB_HANDLE') ){

(i.e. line 213 or Dataface/QuickForm.php)

See if that corrects the problem.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problem with relationship

Postby 00Davo » Tue Jan 05, 2010 6:41 pm

The errors no longer show up, and it claims to work correctly. Except it doesn't, because the table still isn't getting the IDs correctly. :(
00Davo
 
Posts: 55
Joined: Sat Jan 02, 2010 9:02 pm

Re: Problem with relationship

Postby shannah » Tue Jan 05, 2010 7:09 pm

Please post the relationship definition in the relationships.ini file, and the associated table definitions.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problem with relationship

Postby 00Davo » Tue Jan 05, 2010 7:14 pm

/tables/Parent/relationships.ini
Code: Select all
[Children]
Student.ID = Family.StudentID
Family.ParentID = "$ID"

/tables/Student/relationships.ini
Code: Select all
[Parents]
Parent.ID = Family.ParentID
Family.StudentID = "$ID"
[Class]
Class.ID = "$Class"

Structure for Parent:
Code: Select all
--
-- Table structure for table `parent`
--

CREATE TABLE IF NOT EXISTS `parent` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `LName` varchar(50) DEFAULT NULL,
  `FName` varchar(50) DEFAULT NULL,
  `HouseNo` int(11) DEFAULT NULL,
  `Street` varchar(50) DEFAULT NULL,
  `Suburb` varchar(50) DEFAULT NULL,
  `Postcode` int(11) DEFAULT NULL,
  `Phone` varchar(11) DEFAULT NULL,
  `Mobile` varchar(11) DEFAULT NULL,
  `Email` varchar(50) DEFAULT NULL,
  `YPTReceiptNo` int(11) DEFAULT NULL,
  `LSPReceiptNo` int(11) DEFAULT NULL,
  `YPTFeePaid` double DEFAULT NULL,
  `LSPFeePaid` double DEFAULT NULL,
  `Involvement` text,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

Structure for Student:
Code: Select all
--
-- Table structure for table `student`
--

CREATE TABLE IF NOT EXISTS `student` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `LName` varchar(50) DEFAULT NULL,
  `FName` varchar(50) DEFAULT NULL,
  `DOB` date DEFAULT NULL,
  `HouseNo` tinyint(4) DEFAULT NULL,
  `Street` varchar(50) DEFAULT NULL,
  `Suburb` varchar(50) DEFAULT NULL,
  `Postcode` int(11) DEFAULT NULL,
  `Phone` varchar(11) DEFAULT NULL,
  `Mobile` varchar(11) DEFAULT NULL,
  `Email` varchar(50) DEFAULT NULL,
  `EnrolmentStatus` enum('WL','E','WD') DEFAULT NULL,
  `SchoolYear` year(4) DEFAULT NULL,
  `WaitingListPlace` int(11) DEFAULT NULL,
  `WaitingListDate` date DEFAULT NULL,
  `ClassPlacementDate` date DEFAULT NULL,
  `ClassPlacementAcceptance` tinyint(1) DEFAULT NULL,
  `ClassEnrolmentDate` date DEFAULT NULL,
  `EnrolmentYear` year(4) DEFAULT NULL,
  `Class` int(11) DEFAULT NULL,
  `Status` enum('S','A') DEFAULT NULL,
  `FeesPaid` double DEFAULT NULL,
  `ReceiptNo` int(11) DEFAULT NULL,
  `PaymentMethod` enum('dd','cc','c','cqe') DEFAULT NULL,
  `Productions` text,
  `Involvement` text,
  PRIMARY KEY (`ID`),
  KEY `FK_class` (`Class`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;

I've already posted the Family definitions.
00Davo
 
Posts: 55
Joined: Sat Jan 02, 2010 9:02 pm

Re: Problem with relationship

Postby shannah » Tue Jan 05, 2010 7:18 pm

One thing I notice is that you are referring to your table names capitalized in your relationship definitions, but they are actually all lower case in the database definition. MySQL may be forgiving for these things (case insensitive), but Xataface is case sensitive.

I.e. If you change your relationship definitions to have the correct table names it should work properly.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Problem with relationship

Postby 00Davo » Tue Jan 05, 2010 7:39 pm

Unfortunately, it still does not seem to work properly. It only fills in the "local" ID, and not the foreign one, so the relationship fails. :(
00Davo
 
Posts: 55
Joined: Sat Jan 02, 2010 9:02 pm

PreviousNext

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 6 guests

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