Hereās what I do:
function myUpdate($action)
{
global $ancienTodo;
$requete = "SELECT * FROM tblpmtodo WHERE TodoId = " . $action->get_id();
$resultat = mysql_query($requete);
$ligne = mysql_fetch_array($resultat);
$ancienTodo = array();
$ancienTodo['Titre'] = $ligne['Titre'];
$ancienTodo['Description'] = $ligne['Description'];
$ancienTodo['Client'] = getNom('tblcartetempsclients', 'NoClient', $ligne['NoClient'], 'NomClient');
$ancienTodo['Division'] = getNom('tblcartetempsdivisions', 'NoDivision', $ligne['NoDivision'], 'NomDivision');
$ancienTodo['AssignePar'] = getNom('tblcartetempspersonnes', 'NoPersonne', $ligne['DeNoPersonne'], 'NomPersonne');
$ancienTodo['StartDateTime'] = substr($ligne['StartDateTime'], 0, strlen($ligne['StartDateTime']) - 3);
$ancienTodo['EndDateTime'] = substr($ligne['EndDateTime'], 0, strlen($ligne['EndDateTime']) - 3);
$ancienTodo['Statut'] = getNom('tblpmstatut', 'StatutId', $ligne['StatutId'], 'Statut');
$requete = "UPDATE tblpmtodo SET NoClient = " . $action->get_value('NoClient') . ", " .
"NoDivision = " . $action->get_value('NoDivision') . ", " .
"Titre = " . mysql_real_escape_string($action->get_value('Titre')) . ", " .
"Etiquette = " . mysql_real_escape_string($action->get_value('Etiquette')) . ", " .
"Description = \"" . mysql_real_escape_string($action->get_value('Description')) . "\" " .
"StartDateTime = \"" . $action->get_value('StartDateTime') . "\", " .
"EndDateTime = \"" . $action->get_value('EndDateTime') . "\", " .
"Priorite = " . $action->get_value('Priorite') . ", " .
"ANoPersonne = " . $action->get_value('ANoPersonne') . ", " .
"StatutId = " . $action->get_value('StatutId') . ", " .
"PrcComplete = " . $action->get_value('PrcComplete') . ", " .
"CalendrierStrategique = " . $action->get_value('CalendrierStrategique') . " " .
"WHERE TodoId = " . $action->get_id();
$scheduler->sql->query($requete);
//mysql_query($requete) or die(mysql_error());
$action->success();
}
$sqlPrincipal = "SELECT * FROM tblpmtodo INNER JOIN tblpmdestinatairespermissions on tblpmtodo.TodoId = tblpmdestinatairespermissions.TodoId WHERE tblpmdestinatairespermissions.NoPersonne = " . $_SESSION['Employe'];
$scheduler->event->attach("beforeUpdate", "myUpdate");
$scheduler->enable_log("log.txt",true);
$scheduler->render_sql($sqlPrincipal, "TodoId", "StartDateTime,EndDateTime,Etiquette,Description,Titre,ANoPersonne,NoClient,NoDivision,PrcComplete,Priorite,CalendrierStrategique,StatutId");
And inside the log:
====================================
Log started, 03/12/2010 11:12:31
====================================
SELECT * FROM tblpmtodo INNER JOIN tblpmdestinatairespermissions on tblpmtodo.TodoId = tblpmdestinatairespermissions.TodoId WHERE tblpmdestinatairespermissions.NoPersonne = 64
SELECT NoPersonne as value, NomPersonne as label FROM tblcartetempspersonnes WHERE MembreScheduler = 1 ORDER BY NomPersonne ASC
SELECT NoClient as value, NomClient as label FROM tblcartetempsclients WHERE Statut = 1 ORDER BY NomClient ASC
SELECT 0 as value, '' as label FROM tblcartetempsdivisions WHERE 1 union SELECT NoDivision as value, NomDivision as label FROM tblcartetempsdivisions ORDER BY label ASC
Done in 0.012165069580078s
====================================
Log started, 03/12/2010 11:12:39
====================================
DataProcessor object initialized
126_id => 126
126_start_date => 2010-12-01 10:15
126_end_date => 2010-12-01 10:20
126_text => TODO - tfilteau - 126
126_Description => hjjghjgh
126_Titre =>
126_ANoPersonne => 64
126_NoClient => 53
126_NoDivision => 0
126_PrcComplete => 0
126_Priorite => 1
126_CalendrierStrategique => 0
126_StatutId => 1
126_RappelA => 1
126_DateRappelA => 1900-01-01 00:00:00
126_FrequenceRappelA => 0
126_UniteRappelA => 1
126_DroitsA => 3
126_ListeCC =>
126_DateNotificationCC =>
126_DroitCC =>
126_NotificationCC =>
126_FrequenceCC =>
126_UniteFrequenceCC =>
126_CC_length => 0
126_DateRappelGeneral => 1900-01-01 00:00:00
126_FrequenceGenerale => 0
126_FrequenceUniteGeneral => 1
126_DeNomPersonne => Tobbi Filteau
126_DeNoPersonne => 64
126_NotificationA => 1
126_DroitDestinataire => 3
126_!nativeeditor_status => updated
ids => 126
Row data [126]
TodoId => 126
StartDateTime => 2010-12-01 10:15
EndDateTime => 2010-12-01 10:20
Etiquette => TODO - tfilteau - 126
Description => hjjghjgh
Titre =>
ANoPersonne => 64
NoClient => 53
NoDivision => 0
PrcComplete => 0
Priorite => 1
CalendrierStrategique => 0
StatutId => 1
RappelA => 1
DateRappelA => 1900-01-01 00:00:00
FrequenceRappelA => 0
UniteRappelA => 1
DroitsA => 3
ListeCC =>
DateNotificationCC =>
DroitCC =>
NotificationCC =>
FrequenceCC =>
UniteFrequenceCC =>
CC_length => 0
DateRappelGeneral => 1900-01-01 00:00:00
FrequenceGenerale => 0
FrequenceUniteGeneral => 1
DeNomPersonne => Tobbi Filteau
DeNoPersonne => 64
NotificationA => 1
DroitDestinataire => 3
!nativeeditor_status => updated
As you can see, thereās no mention of SQL anywhere. If you could point me in the right direction, Iād be really grateful.
Thanks in advance.
Osu