Overview
Comment:Fix issues with accounting: graphs and empty selector
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev | 1.0.0-alpha2
Files: files | file ages | folders
SHA1: 435252f2289704b66729c985b255f978a91445ee
User & Date: bohwaz on 2020-10-26 00:09:45
Other Links: branch diff | manifest | tags
Context
2020-10-26
00:45
Implement @zou patch for folding accounts in general ledger check-in: 42c2519468 user: bohwaz tags: dev, 1.0.0-alpha2
00:09
Fix issues with accounting: graphs and empty selector check-in: 435252f228 user: bohwaz tags: dev, 1.0.0-alpha2
2020-10-25
23:07
Fix issues with selector frame, and HTTP status code check-in: 98fcdb2ddf user: bohwaz tags: dev, 1.0.0-alpha2
Changes

Modified src/include/lib/Garradin/Accounting/Graph.php from [970fb106f7] to [2cc02e6f86].

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
<?php

namespace Garradin\Accounting;

use Garradin\Entities\Accounting\Account;
use Garradin\Entities\Accounting\Line;
use Garradin\Entities\Accounting\Transaction;
use Garradin\Utils;
use Garradin\Config;
use Garradin\DB;
use const Garradin\ADMIN_COLOR1;

use const Garradin\ADMIN_URL;
use KD2\DB\EntityManager;

use KD2\Graphics\SVG\Plot;
use KD2\Graphics\SVG\Plot_Data;

use KD2\Graphics\SVG\Pie;











>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

namespace Garradin\Accounting;

use Garradin\Entities\Accounting\Account;
use Garradin\Entities\Accounting\Line;
use Garradin\Entities\Accounting\Transaction;
use Garradin\Utils;
use Garradin\Config;
use Garradin\DB;
use const Garradin\ADMIN_COLOR1;
use const Garradin\ADMIN_COLOR2;
use const Garradin\ADMIN_URL;
use KD2\DB\EntityManager;

use KD2\Graphics\SVG\Plot;
use KD2\Graphics\SVG\Plot_Data;

use KD2\Graphics\SVG\Pie;

Modified src/templates/acc/accounts/index.tpl from [2d3a7ab0ee] to [eb8e3427ba].

50
51
52
53
54
55
56





57
58
59
60
61
62
63
64
65
							{linkbutton label="Dépôt en banque" shape="check" href="acc/accounts/deposit.php?id=%d"|args:$account.id}
						{/if}
					{/if}
				</td>
			</tr>
		{/foreach}
	</tbody>





	{/foreach}
</table>

<p class="help">
	Note : n'apparaissent ici que les comptes favoris.
	Pour voir le solde de tous les comptes, se référer à la <a href="{$admin_url}acc/reports/trial_balance.php?year={$current_year.id}">balance générale de l'exercice</a>.
</p>

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







>
>
>
>
>









50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
							{linkbutton label="Dépôt en banque" shape="check" href="acc/accounts/deposit.php?id=%d"|args:$account.id}
						{/if}
					{/if}
				</td>
			</tr>
		{/foreach}
	</tbody>
	{foreachelse}
	<tbody>
		<tr>
			<td colspan="4">Il n'y a aucun compte favori avec des écritures pour l'exercice sélectionné.</td>
		</tr>
	{/foreach}
</table>

<p class="help">
	Note : n'apparaissent ici que les comptes favoris.
	Pour voir le solde de tous les comptes, se référer à la <a href="{$admin_url}acc/reports/trial_balance.php?year={$current_year.id}">balance générale de l'exercice</a>.
</p>

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

Modified src/templates/acc/charts/accounts/selector.tpl from [603a14de12] to [df03b9b499].

1
2



3
4
5
6
7
8
9
{include file="admin/_head.tpl" title="Sélectionner un compte" body_id="popup" is_popup=true}




{if isset($grouped_accounts)}

	{foreach from=$grouped_accounts item="group"}
		<h2 class="ruler">{$group.label}</h2>

		<table class="list">
			<tbody>


>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
{include file="admin/_head.tpl" title="Sélectionner un compte" body_id="popup" is_popup=true}

{if empty($grouped_accounts) && empty($accounts)}
	<p class="alert">Le plan comptable ne comporte aucun compte de ce type. Pour afficher des comptes ici, les <a href="{$www_url}admin/acc/charts/accounts/all.php?id={$chart.id}" target="_blank">modifier dans le plan comptable</a> en sélectionnant le type de compte favori voulu.</td>

{if isset($grouped_accounts)}

	{foreach from=$grouped_accounts item="group"}
		<h2 class="ruler">{$group.label}</h2>

		<table class="list">
			<tbody>
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
			<tr class="account-level-{$account.code|strlen}">
				<td>{$account.code}</td>
				<th>{$account.label}</th>
				<td class="actions">
					<button class="icn-btn" value="{$account.id}" data-label="{$account.code} — {$account.label}" data-icon="&rarr;">Sélectionner</button>
				</td>
			</tr>
		{/foreach}
		</tbody>
	</table>

{/if}

{literal}
<script type="text/javascript">







<







34
35
36
37
38
39
40

41
42
43
44
45
46
47
			<tr class="account-level-{$account.code|strlen}">
				<td>{$account.code}</td>
				<th>{$account.label}</th>
				<td class="actions">
					<button class="icn-btn" value="{$account.id}" data-label="{$account.code} — {$account.label}" data-icon="&rarr;">Sélectionner</button>
				</td>
			</tr>

		</tbody>
	</table>

{/if}

{literal}
<script type="text/javascript">

Modified src/www/admin/acc/_inc.php from [01d0f4003c] to [734ee883db].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

$current_year_id = $session->get('acc_year');

if ($current_year_id) {
	// Check that the year is still valid
	$current_year = Years::get($current_year_id);

	if ($current_year->closed) {
		$current_year_id = null;
		$session->set('acc_year', null);
	}
}

if (!$current_year_id) {
	$current_year = Years::getCurrentOpenYear();







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

$current_year_id = $session->get('acc_year');

if ($current_year_id) {
	// Check that the year is still valid
	$current_year = Years::get($current_year_id);

	if (!$current_year || $current_year->closed) {
		$current_year_id = null;
		$session->set('acc_year', null);
	}
}

if (!$current_year_id) {
	$current_year = Years::getCurrentOpenYear();

Modified src/www/admin/acc/charts/accounts/selector.php from [7123244e59] to [6f12870ca9].

10
11
12
13
14
15
16


17
18
19
20
21
22
23
24
25
26
header('X-Frame-Options: SAMEORIGIN', true);

if (!qg('chart') || !($chart = Charts::get((int)qg('chart')))) {
	throw new UserException('Aucun ID de plan comptable spécifié');
}

$accounts = $chart->accounts();



if (!qg('targets')) {
	$tpl->assign('accounts', $accounts->listAll());
}
else {
	$tpl->assign('grouped_accounts', $accounts->listCommonGrouped(explode(':', qg('targets'))));
}


$tpl->display('acc/charts/accounts/selector.tpl');







>
>










10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
header('X-Frame-Options: SAMEORIGIN', true);

if (!qg('chart') || !($chart = Charts::get((int)qg('chart')))) {
	throw new UserException('Aucun ID de plan comptable spécifié');
}

$accounts = $chart->accounts();

$tpl->assign(compact('chart'));

if (!qg('targets')) {
	$tpl->assign('accounts', $accounts->listAll());
}
else {
	$tpl->assign('grouped_accounts', $accounts->listCommonGrouped(explode(':', qg('targets'))));
}


$tpl->display('acc/charts/accounts/selector.tpl');