Skip to content

Commit

Permalink
Merge branch 'hotfix/0.22.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
polosson committed Aug 4, 2023
2 parents 7592728 + 7114d28 commit 877980c
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Tous les changements notables sur le projet sont documentés dans ce fichier.

Ce projet adhère au principe du [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.22.1 (2023-08-04)

- L'utilisation d'un champ de tri non autorisé ne fait plus planter les pages de listing.
- Corrige les boutons de modification et suppression des emplacements de parc (Premium).

## 0.22.0 (2023-08-03)

- Ajoute la possibilité de choisir un emplacement de rangement pour chaque matériel
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.22.0
0.22.1
27 changes: 27 additions & 0 deletions server/src/App/Controllers/BeneficiaryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@ class BeneficiaryController extends BaseController
{
use WithCrud;

public function getAll(Request $request, Response $response): Response
{
$paginated = (bool) $request->getQueryParam('paginated', true);
$search = $request->getQueryParam('search', null);
$limit = $request->getQueryParam('limit', null);
$ascending = (bool) $request->getQueryParam('ascending', true);
$onlyDeleted = (bool) $request->getQueryParam('deleted', false);

$orderBy = $request->getQueryParam('orderBy', null);
if (!in_array($orderBy, ['full_name', 'reference', 'company', 'email'], true)) {
$orderBy = null;
}

$query = (new Beneficiary)
->setOrderBy($orderBy, $ascending)
->setSearch($search)
->getAll($onlyDeleted);

if ($paginated) {
$results = $this->paginate($request, $query, is_numeric($limit) ? (int) $limit : null);
} else {
$results = $query->get();
}

return $response->withJson($results, StatusCode::STATUS_OK);
}

public function create(Request $request, Response $response): Response
{
$postData = (array) $request->getParsedBody();
Expand Down
7 changes: 6 additions & 1 deletion server/src/App/Controllers/MaterialController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,17 @@ public function getAll(Request $request, Response $response): Response
{
$paginated = (bool) $request->getQueryParam('paginated', true);
$limit = $request->getQueryParam('limit', null);
$orderBy = $request->getQueryParam('orderBy', null);
$ascending = (bool) $request->getQueryParam('ascending', true);
$search = $request->getQueryParam('search', null);
$dateForQuantities = $request->getQueryParam('dateForQuantities', null);
$onlyDeleted = (bool) $request->getQueryParam('deleted', false);

$orderBy = $request->getQueryParam('orderBy', null);
$allowedOrderFields = ['name', 'reference', 'rental_price', 'stock_quantity', 'out_of_order_quantity'];
if (!in_array($orderBy, $allowedOrderFields, true)) {
$orderBy = null;
}

$query = (new Material)
->setOrderBy($orderBy, $ascending)
->setSearch($search)
Expand Down
5 changes: 2 additions & 3 deletions server/src/App/Controllers/ParkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ public function getAll(Request $request, Response $response): Response
{
$paginated = (bool) $request->getQueryParam('paginated', true);
$search = $request->getQueryParam('search', null);
$orderBy = $request->getQueryParam('orderBy', null);
$limit = $request->getQueryParam('limit', null);
$ascending = (bool) $request->getQueryParam('ascending', true);
$onlyDeleted = (bool) $request->getQueryParam('deleted', false);

$query = $this->getModel()
->setOrderBy($orderBy, $ascending)
$query = (new Park)
->setOrderBy(null, $ascending)
->setSearch($search)
->getAll($onlyDeleted);

Expand Down
6 changes: 5 additions & 1 deletion server/src/App/Controllers/TechnicianController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ public function __construct(Container $container, I18n $i18n)
public function getAll(Request $request, Response $response): Response
{
$search = $request->getQueryParam('search', null);
$orderBy = $request->getQueryParam('orderBy', null);
$limit = $request->getQueryParam('limit', null);
$ascending = (bool) $request->getQueryParam('ascending', true);
$onlyDeleted = (bool) $request->getQueryParam('deleted', false);

$orderBy = $request->getQueryParam('orderBy', null);
if (!in_array($orderBy, ['full_name', 'email', 'nickname'], true)) {
$orderBy = null;
}

// - Disponibilité dans une période donnée.
$availabilityPeriod = Arr::mapKeys(
function ($key) use ($request) {
Expand Down
6 changes: 5 additions & 1 deletion server/src/App/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ public function getAll(Request $request, Response $response): Response
{
$paginated = (bool) $request->getQueryParam('paginated', true);
$search = $request->getQueryParam('search', null);
$orderBy = $request->getQueryParam('orderBy', null);
$group = $request->getQueryParam('group', null);
$limit = $request->getQueryParam('limit', null);
$ascending = (bool) $request->getQueryParam('ascending', true);
$onlyDeleted = (bool) $request->getQueryParam('deleted', false);

$orderBy = $request->getQueryParam('orderBy', null);
if (!in_array($orderBy, ['pseudo', 'email', 'group'], true)) {
$orderBy = null;
}

$query = (new User())
->setOrderBy($orderBy, $ascending)
->setSearch($search)
Expand Down

0 comments on commit 877980c

Please sign in to comment.