[Solved] 1.2.5 upgrade
Posted: Mon Sep 13, 2010 7:01 am
Hello,
I need your help once again... sorry for the inconvenience.
My problem is not very easy to explain, I'll try to be clear.
I'v got an application which is working (very well) with Xataface version 1.1.5r2 984.
I try to run it with the new version ; I have not changed my application, nor the database : only the Xataface directory.
I've got some trouble with the action "new_related_record" in a many to many relationship.
Each time I try to insert a new related record, I've got an error :
Obviously it lacks the "MouvrageID", but the field was filled in the form !
I use a function to fill it, and it displays well. (I tried to fill the form manually : I got the same error)
Here's my tables
The file tables\vehicule\relationships.ini ;
The fonction I use in tables\compteur\compteur.php to get MouvrageID
The trouble occurs when i call :
With the same code, everything is working well with version 1.1.5r2 984.
What could prevent Xataface to take the form into account ?
Thank you in advance for your help, and sorry for my English.
I need your help once again... sorry for the inconvenience.
My problem is not very easy to explain, I'll try to be clear.
I'v got an application which is working (very well) with Xataface version 1.1.5r2 984.
I try to run it with the new version ; I have not changed my application, nor the database : only the Xataface directory.
I've got some trouble with the action "new_related_record" in a many to many relationship.
Each time I try to insert a new related record, I've got an error :
- Code: Select all
Fatal error: [pear_error: message="11" code=0 mode=return level=notice prefix="" info="Erreur en effectuant la requĂȘte 'INSERT INTO `compteur` (`Nom`,`Type`,`EnergieID`,`Estenergie`) VALUES ('TESTTEST','CONSO','1','1')' sur la ligne '1244' du fichier 'C:\wamp\www\xataface\Dataface\IO.php':
1452: Cannot add or update a child row: a foreign key constraint fails (`enerconso2`.`compteur`, CONSTRAINT `compteur_ibfk_1` FOREIGN KEY (`MouvrageID`) REFERENCES `mouvrage` (`MouvrageID`) ON DELETE CASCADE ON UPDATE CASCADE)"]On line 1247 of file C:\wamp\www\xataface\Dataface\IO.php in function printStackTrace()
On line 1344 of file C:\wamp\www\xataface\Dataface\IO.php in function performSQL(array(INSERT INTO `compteur` (`Nom`,`Type`,`EnergieID`,`Estenergie`) VALUES ('TESTTEST','CONSO','1',)
On line 628 of file C:\wamp\www\xataface\Dataface\ShortRelatedRecordForm.php in function addRelatedRecord(Dataface_RelatedRecord Object,1)
On line of file in function save(array(1,,,BASE1,6,array(52,BASE1),vehicule,Compteurs,new in C:\wamp\www\xataface\Dataface\IO.php on line 1247
Obviously it lacks the "MouvrageID", but the field was filled in the form !
I use a function to fill it, and it displays well. (I tried to fill the form manually : I got the same error)
Here's my tables
- Code: Select all
CREATE TABLE `compteur` (
`CompteurID` int(11) NOT NULL AUTO_INCREMENT,
`Nom` varchar(45) DEFAULT NULL,
`Reference` varchar(45) DEFAULT NULL,
`EnergieID` int(11) DEFAULT '1',
`Estenergie` tinyint(1) DEFAULT NULL,
`MouvrageID` int(11) NOT NULL,
(...)
PRIMARY KEY (`CompteurID`,`BaseID`),
KEY `Compteurs_belong_to_Energie` (`EnergieID`),
KEY `indexNom` (`Nom`),
KEY `MouvrageID` (`MouvrageID`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
CREATE TABLE `compteurvehicules` (
`VehiculeID` int(11) NOT NULL DEFAULT '0',
`CompteurID` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`VehiculeID`,`CompteurID`,`BaseID`),
KEY `CompteurVehicule_belong_to_Vehicule` (`VehiculeID`),
KEY `CompteurVehicule_belong_to_Compteur` (`CompteurID`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `vehicule` (
`VehiculeID` int(11) NOT NULL AUTO_INCREMENT,
`CategorieID` int(11) DEFAULT NULL,
`MouvrageID` int(11) NOT NULL,
`Nom` varchar(45) NOT NULL,
`Marque` varchar(45) DEFAULT NULL,
`Modele` varchar(45) DEFAULT NULL,
(...)
PRIMARY KEY (`VehiculeID`,`BaseID`),
KEY `vehicules_belong_to_Categorie` (`CategorieID`),
KEY `MouvrageID` (`MouvrageID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
The file tables\vehicule\relationships.ini ;
- Code: Select all
[Compteurs]
compteur.CompteurID=compteurvehicules.CompteurID
compteurvehicules.VehiculeID="$VehiculeID"
The fonction I use in tables\compteur\compteur.php to get MouvrageID
- Code: Select all
function mouvrageID__default(){
$app =& Dataface_Application::getInstance();
$enregistrement =& $app->getRecord();
$mouvrageid = '' ;
if ( $enregistrement ) $mouvrageid = $enregistrement->val("MouvrageID");
return $mouvrageid;
}
The trouble occurs when i call :
- Code: Select all
/index.php?-action=new_related_record&-table=vehicule&-relationship=Compteurs&VehiculeID=52&-cursor=0&-skip=0&-limit=30&-mode=list
With the same code, everything is working well with version 1.1.5r2 984.
What could prevent Xataface to take the form into account ?
Thank you in advance for your help, and sorry for my English.