Overview
Comment:Default label for new year
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: ad416068b57af6a6355d8a2ffc196761b50d9673da6fcdb8d9a0f6470e3f8830
User & Date: bohwaz on 2021-03-04 13:44:27
Other Links: manifest | tags
Context
2021-03-05
19:24
Sometime old duration is zero instead of NULL, fix that in migration check-in: ce717c67a5 user: bohwaz tags: trunk, stable
2021-03-04
13:44
Default label for new year check-in: ad416068b5 user: bohwaz tags: trunk, stable
00:07
Show multiple projects if required in advanced transactions check-in: ff66ad1017 user: bohwaz tags: trunk, stable
Changes

Modified src/templates/acc/years/new.tpl from [847d4ab122] to [c5ecc858e4].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
	<fieldset>
		<legend>Commencer un nouvel exercice</legend>
		<dl>
			{input type="select_groups" options=$charts name="id_chart" label="Plan comptable" required=true}
			<dd class="help">Attention, il ne sera pas possible de modifier ou supprimer un compte du plan comptable si le compte est utilisé dans un exercice clôturé.<br />
				Si vous souhaitez modifier le plan comptable pour ce nouvel exercice, il est recommandé de créer un nouveau plan comptable, recopié à partir de l'ancien plan comptable. Ainsi tous les comptes seront modifiables et supprimables.</dd>
			<dd class="help">{linkbutton shape="settings" label="Gestion des plans comptables" href="!acc/charts/"}</dd>
			{input type="text" name="label" label="Libellé" required=true}
			{input type="date" label="Début de l'exercice" name="start_date" required=true default=$start_date}
			{input type="date" label="Fin de l'exercice" name="end_date" required=true default=$end_date}
		</dl>
	</fieldset>

	<p class="submit">
		{csrf_field key="acc_years_new"}
		{button type="submit" name="new" label="Créer ce nouvel exercice" shape="right" class="main"}
	</p>

</form>

{include file="admin/_foot.tpl"}







|













14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
	<fieldset>
		<legend>Commencer un nouvel exercice</legend>
		<dl>
			{input type="select_groups" options=$charts name="id_chart" label="Plan comptable" required=true}
			<dd class="help">Attention, il ne sera pas possible de modifier ou supprimer un compte du plan comptable si le compte est utilisé dans un exercice clôturé.<br />
				Si vous souhaitez modifier le plan comptable pour ce nouvel exercice, il est recommandé de créer un nouveau plan comptable, recopié à partir de l'ancien plan comptable. Ainsi tous les comptes seront modifiables et supprimables.</dd>
			<dd class="help">{linkbutton shape="settings" label="Gestion des plans comptables" href="!acc/charts/"}</dd>
			{input type="text" name="label" label="Libellé" required=true default=$label}
			{input type="date" label="Début de l'exercice" name="start_date" required=true default=$start_date}
			{input type="date" label="Fin de l'exercice" name="end_date" required=true default=$end_date}
		</dl>
	</fieldset>

	<p class="submit">
		{csrf_field key="acc_years_new"}
		{button type="submit" name="new" label="Créer ce nouvel exercice" shape="right" class="main"}
	</p>

</form>

{include file="admin/_foot.tpl"}

Modified src/www/admin/acc/years/new.php from [bb5f6f537d] to [e19c3a9787].

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43

44
45
46
use Garradin\Services\Fees;
use Garradin\Entities\Accounting\Year;

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

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

if (f('new') && $form->check('acc_years_new')) {
	try {
		$year = new Year;
		$year->importForm();
		$year->save();

		if ($old_id = qg('from')) {
			$old = Years::get((int) $old_id);
			$changed = Fees::updateYear($old, $year);

			if (!$changed) {
				Utils::redirect(ADMIN_URL . 'acc/years/?msg=UPDATE_FEES');
			}
		}

		if (Years::countClosed()) {
			Utils::redirect(ADMIN_URL . 'acc/years/balance.php?id=' . $year->id());
		}
		else {
			Utils::redirect(ADMIN_URL . 'acc/years/');
		}
	}
	catch (UserException $e)
	{
		$form->addError($e->getMessage());
	}
}


$new_dates = Years::getNewYearDates();
$tpl->assign('start_date', $new_dates[0]);
$tpl->assign('end_date', $new_dates[1]);

$tpl->assign('charts', Charts::listByCountry());

$tpl->display('acc/years/new.tpl');







|
<
|
|
|

|
|
|

|
|
|
|

|
|
|
<
<
<
<
<
<
<
<
<
>




>



6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29









30
31
32
33
34
35
36
37
38
use Garradin\Services\Fees;
use Garradin\Entities\Accounting\Year;

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

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

$form->runIf('new', function () {

	$year = new Year;
	$year->importForm();
	$year->save();

	if ($old_id = qg('from')) {
		$old = Years::get((int) $old_id);
		$changed = Fees::updateYear($old, $year);

		if (!$changed) {
			Utils::redirect(ADMIN_URL . 'acc/years/?msg=UPDATE_FEES');
		}
	}

	if (Years::countClosed()) {
		Utils::redirect(ADMIN_URL . 'acc/years/balance.php?id=' . $year->id());
	}









}, 'acc_years_new', '!acc/years/');

$new_dates = Years::getNewYearDates();
$tpl->assign('start_date', $new_dates[0]);
$tpl->assign('end_date', $new_dates[1]);
$tpl->assign('label', sprintf('Exercice %d', $new_dates[0]->format('Y')));
$tpl->assign('charts', Charts::listByCountry());

$tpl->display('acc/years/new.tpl');