Overview
Comment: | Make sure requested user exists |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA3-256: |
631339fd508b1bb38dc0dbe2a48a6b92 |
User & Date: | bohwaz on 2023-06-06 12:33:19 |
Other Links: | branch diff | manifest | tags |
Context
2023-06-06
| ||
13:16 | Fix generated columns in fields editing check-in: 19457093c4 user: bohwaz tags: dev | |
12:33 | Make sure requested user exists check-in: 631339fd50 user: bohwaz tags: dev | |
2023-06-05
| ||
10:28 | Make sure to cast the column when copying the table data, so that if by error a string is present for an integer, this will not break the app check-in: 14d6d002a7 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Users/Users.php from [48d8e7ac83] to [d532632555].
︙ | ︙ | |||
366 367 368 369 370 371 372 373 374 375 376 377 378 379 | } static public function importReport(CSV_Custom $csv, bool $ignore_ids, int $logged_user_id): array { $report = ['created' => [], 'modified' => [], 'unchanged' => [], 'has_logged_user' => false]; foreach (self::iterateImport($csv, $ignore_ids) as $line => $user) { if ($user->id == $logged_user_id) { $report['has_logged_user'] = true; continue; } try { $user->selfCheck(); | > > > > | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | } static public function importReport(CSV_Custom $csv, bool $ignore_ids, int $logged_user_id): array { $report = ['created' => [], 'modified' => [], 'unchanged' => [], 'has_logged_user' => false]; foreach (self::iterateImport($csv, $ignore_ids) as $line => $user) { if (!$user) { throw new UserException(sprintf('Ligne %d : le numéro de membre indiqué n\'existe pas', $line)); } if ($user->id == $logged_user_id) { $report['has_logged_user'] = true; continue; } try { $user->selfCheck(); |
︙ | ︙ | |||
398 399 400 401 402 403 404 405 406 407 408 409 410 411 | static public function import(CSV_Custom $csv, bool $ignore_ids, int $logged_user_id): void { $db = DB::getInstance(); $db->begin(); foreach (self::iterateImport($csv, $ignore_ids) as $user) { if ($user->id == $logged_user_id) { continue; } $user->save(); } | > > > > | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | static public function import(CSV_Custom $csv, bool $ignore_ids, int $logged_user_id): void { $db = DB::getInstance(); $db->begin(); foreach (self::iterateImport($csv, $ignore_ids) as $user) { if (!$user) { continue; } if ($user->id == $logged_user_id) { continue; } $user->save(); } |
︙ | ︙ | |||
423 424 425 426 427 428 429 | $user->setNumberIfEmpty(); unset($row->$number_field); } else { $user = self::getFromNumber($row->$number_field); } | > | > | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | $user->setNumberIfEmpty(); unset($row->$number_field); } else { $user = self::getFromNumber($row->$number_field); } if ($user) { $user->importForm((array)$row); } yield $i => $user; } } } |