Benoit Hamet
2008-04-09 15:10:56 UTC
Hi all,
I was trying to "quickly fix" the note apps for some notices about
get_var, when I notice some weird thing :
Notes display only one note ...
Further investigations let me point this :
in notes/inc/class.sonotes.inc.php I got :
around line 130 :
while ($this->db->next_record())
{
$ngrants = $this->grants[$this->db->f('note_owner')];
$notes[$this->db->f('note_id')] = array
(
'note_id' => $this->db->f('note_id'),
'owner_id' => $this->db->f('note_owner'),
'owner' =>
$GLOBALS['phpgw']->accounts->id2name($this->db->f('note_owner')),
'access' => $this->db->f('note_access'),
'date' =>
$GLOBALS['phpgw']->common->show_date($this->db->f('note_date')),
'cat_id' => $this->db->f('note_category'),
'content' => $this->db->f('note_content', true),
'grants' => $ngrants
);
}
of course, removing the line 'owner' =>
$GLOBALS['phpgw']->accounts->id2name($this->db->f('note_owner')),
solve the problem, which let me think about a reentrant problem (so a
new query is done using the same db object, and so next_record() is
totaly wrong next time ...).
I Guess we already discuss this [Yeah : search for "Is there some
problem using adodb?" in 2005 archives] ... but do we have an "elegant"
solution for this kind of problem ?
clone the db object in the sonotes ? (beurk)
perhaps better, let accounts having it's own cloned db object (little
better, since like that it won't hurt when using ldap as backend).
avoid this kind of code ? :)
Regards,
Caeies.
I was trying to "quickly fix" the note apps for some notices about
get_var, when I notice some weird thing :
Notes display only one note ...
Further investigations let me point this :
in notes/inc/class.sonotes.inc.php I got :
around line 130 :
while ($this->db->next_record())
{
$ngrants = $this->grants[$this->db->f('note_owner')];
$notes[$this->db->f('note_id')] = array
(
'note_id' => $this->db->f('note_id'),
'owner_id' => $this->db->f('note_owner'),
'owner' =>
$GLOBALS['phpgw']->accounts->id2name($this->db->f('note_owner')),
'access' => $this->db->f('note_access'),
'date' =>
$GLOBALS['phpgw']->common->show_date($this->db->f('note_date')),
'cat_id' => $this->db->f('note_category'),
'content' => $this->db->f('note_content', true),
'grants' => $ngrants
);
}
of course, removing the line 'owner' =>
$GLOBALS['phpgw']->accounts->id2name($this->db->f('note_owner')),
solve the problem, which let me think about a reentrant problem (so a
new query is done using the same db object, and so next_record() is
totaly wrong next time ...).
I Guess we already discuss this [Yeah : search for "Is there some
problem using adodb?" in 2005 archives] ... but do we have an "elegant"
solution for this kind of problem ?
clone the db object in the sonotes ? (beurk)
perhaps better, let accounts having it's own cloned db object (little
better, since like that it won't hurt when using ldap as backend).
avoid this kind of code ? :)
Regards,
Caeies.