Overview
Comment:Make sure a year is selected in accounting pages
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 10273757da566310186aea628789060ee6607c62
User & Date: bohwaz on 2020-09-09 21:16:27
Other Links: branch diff | manifest | tags
Context
2020-09-09
21:17
Display current year and chart check-in: 78ca60b49f user: bohwaz tags: dev
21:16
Make sure a year is selected in accounting pages check-in: 10273757da user: bohwaz tags: dev
21:15
Add ability to open dialogs check-in: 2e91cecaaa user: bohwaz tags: dev
Changes

Modified src/www/admin/acc/_inc.php from [1ab6e238e9] to [dc1413be6a].

1
2
3


4
5
6
7


















<?php

namespace Garradin;



require_once __DIR__ . '/../_inc.php';

$session->requireAccess('compta', Membres::DROIT_ACCES);





















>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

namespace Garradin;

use Garradin\Accounting\Years;

require_once __DIR__ . '/../_inc.php';

$session->requireAccess('compta', Membres::DROIT_ACCES);

if ($year_id = $session->get('acc_year')) {
	$year = Years::get($year_id);
}
else {
	$year = Years::getCurrentOpenYearIfSingle();

	if ($year) {
		$year_id = $year->id();
		$session->set('acc_year', $year_id);
	}
	else {
		Utils::redirect(ADMIN_URL . '/acc/years/?msg=SELECT_YEAR');
	}
}

$tpl->assign('year', $year);
$tpl->assign('chart', $year->chart());