Pannous

Pannous Commit Details

Date:2018-04-22 11:41:00 (2 years 7 months ago)
Author:Grégory Soutadé
Branch:master
Commit:9fb341d90b7f5f6645d9fef5f717b8f0ef1a3a43
Parents: 65fb1f3974d83031d716ac17af8acac305e8ca93
Message:Remove List::clearListUsers() + Fix a bug in retreiving readers/writers (bad SQL condition)

Changes:
Cfuel/app/cache/.gitkeep → fuel/app/config/crypt.php
Mfuel/app/classes/controller/lists.php (2 diffs)
Mfuel/app/classes/model/lists.php (2 diffs)

File differences

fuel/app/classes/controller/lists.php
156156
157157
158158
159
160
161
162159
163160
164161
......
181178
182179
183180
184
185181
186182
187183
}
}
/* Clear all previous users and groups */
$list->clearListUsers();
$merged_users = array_merge($user_readers, $user_writers);
if (count($merged_users))
{
/* Must save here to update related tables */
$list->save();
/* Validate readers */
foreach($list->users as $user)
$list->validateReader($user);
fuel/app/classes/model/lists.php
257257
258258
259259
260
260
261261
262262
263263
......
270270
271271
272272
273
273
274274
275275
276276
277277
278278
279
280
281
282
283
284
285
286279
287280
288281
282
289283
290284
291285
292286
293287
288
289
290
291
292
293
294294
295295
296296
297297
298298
299
299300
300301
301302
302303
303304
305
306
307
308
309
310
311
304312
305313
306314
->where('id_list', '=', $this->id)
->and_where_open()
->where('writer', '!=', '0')
->or_where('writer', null, DB::expr('IS NOT NULL'))
->and_where('writer', null, DB::expr('IS NOT NULL'))
->and_where_close();
return $query->execute()->as_array('id_user');
->where('id_list', '=', $this->id)
->and_where_open()
->where('writer', '!=', '0')
->or_where('writer', null, DB::expr('IS NOT NULL'))
->and_where('writer', null, DB::expr('IS NOT NULL'))
->and_where_close();
return $query->execute()->as_array('id_group');
}
public function clearListUsers()
{
DB::delete('list_users')
->where('id_list', '=', $this->id)
->execute();
}
public function setListUsersWriters($writers)
{
if (count($writers))
{
DB::update('list_users')
->set(array('writer' => '1'))
->where('id_list', '=', $this->id)
->and_where('id_user', 'IN', $writers)
->execute();
DB::update('list_users')
->set(array('writer' => '0'))
->where('id_list', '=', $this->id)
->and_where('id_user', 'NOT IN', $writers)
->execute();
}
}
public function setListGroupsWriters($writers)
{
if (count($writers))
{
DB::update('list_groups')
->set(array('writer' => '1'))
->where('id_list', '=', $this->id)
->and_where('id_group', 'IN', $writers)
->execute();
DB::update('list_groups')
->set(array('writer' => '0'))
->where('id_list', '=', $this->id)
->and_where('id_group', 'NOT IN', $writers)
->execute();
}
}

Archive Download the corresponding diff file

Branches