Overview
Comment:Order fees by amount
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev | 1.0.0-rc4
Files: files | file ages | folders
SHA1: b63a216b8bc91d3dc93b4e69b272295c693d62f9
User & Date: bohwaz on 2020-12-02 12:31:00
Other Links: branch diff | manifest | tags
Context
2020-12-02
13:02
Fix arguments order in date filters check-in: f5fe8e1fa6 user: bohwaz tags: dev, 1.0.0-rc4
12:31
Order fees by amount check-in: b63a216b8b user: bohwaz tags: dev, 1.0.0-rc4
12:15
Only disable autocomplete on some inputs check-in: e47a822781 user: bohwaz tags: dev, 1.0.0-rc4
Changes

Modified src/include/lib/Garradin/Services/Fees.php from [07a27702c2] to [6282a643d2].

38
39
40
41
42
43
44








45
46
47
48
49
50
51

		foreach ($result as &$row) {
			if ($row->formula) {
				$sql = sprintf('SELECT %s FROM membres WHERE id = %d;', $row->formula, $user_id);
				$row->user_amount = $db->firstColumn($sql);
			}
		}









		return $result;
	}

	public function listWithStats()
	{
		$db = DB::getInstance();







>
>
>
>
>
>
>
>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

		foreach ($result as &$row) {
			if ($row->formula) {
				$sql = sprintf('SELECT %s FROM membres WHERE id = %d;', $row->formula, $user_id);
				$row->user_amount = $db->firstColumn($sql);
			}
		}

		usort($result, function ($a, $b) {
			if ($a->user_amount == $b->user_amount) {
				return 0;
			}

			return $a->user_amount > $b->user_amount ? 1 : -1;
		});

		return $result;
	}

	public function listWithStats()
	{
		$db = DB::getInstance();