Overview
Comment:Move NULL checks to end of Chart check
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 08311c30beae71a63c3c0e5af5901a1818210f235d190f5972c5299c6a211d20
User & Date: bohwaz on 2022-08-08 00:14:33
Other Links: manifest | tags
Context
2022-08-08
00:14
Handle 'Y-m-d H:i' datetime format check-in: 35b1a16c04 user: bohwaz tags: trunk, stable
00:14
Move NULL checks to end of Chart check check-in: 08311c30be user: bohwaz tags: trunk
2022-08-02
21:32
Do not show back to website if there is no website :) check-in: ce2748cf1b user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Entities/Accounting/Chart.php from [83c4d84edf] to [7d108c460e].

25
26
27
28
29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45
46
47
48
49
		'country'  => 'string',
		'code'     => '?string',
		'archived' => 'int',
	];

	public function selfCheck(): void
	{
		parent::selfCheck();
		$this->assert(trim($this->label) !== '', 'Le libellé ne peut rester vide.');
		$this->assert(strlen($this->label) <= 200, 'Le libellé ne peut faire plus de 200 caractères.');
		$this->assert(trim($this->country) !== '', 'Le pays ne peut rester vide.');
		$this->assert(Utils::getCountryName($this->country), 'Le code pays doit être un code ISO valide');
		$this->assert($this->archived === 0 || $this->archived === 1);

	}

	public function accounts()
	{
		return new Accounts($this->id());
	}

	public function canDelete()
	{
		return !DB::getInstance()->firstColumn(sprintf('SELECT 1 FROM %s WHERE id_chart = ? LIMIT 1;', Year::TABLE), $this->id());
	}
}







<





>












25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		'country'  => 'string',
		'code'     => '?string',
		'archived' => 'int',
	];

	public function selfCheck(): void
	{

		$this->assert(trim($this->label) !== '', 'Le libellé ne peut rester vide.');
		$this->assert(strlen($this->label) <= 200, 'Le libellé ne peut faire plus de 200 caractères.');
		$this->assert(trim($this->country) !== '', 'Le pays ne peut rester vide.');
		$this->assert(Utils::getCountryName($this->country), 'Le code pays doit être un code ISO valide');
		$this->assert($this->archived === 0 || $this->archived === 1);
		parent::selfCheck();
	}

	public function accounts()
	{
		return new Accounts($this->id());
	}

	public function canDelete()
	{
		return !DB::getInstance()->firstColumn(sprintf('SELECT 1 FROM %s WHERE id_chart = ? LIMIT 1;', Year::TABLE), $this->id());
	}
}