Overview
Comment:When type is changed, change also the position
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 95dbbf3898c6867c121bb54720770234210e17f396e2fd8205abc49b526b373a
User & Date: bohwaz on 2022-03-29 17:14:05
Other Links: manifest | tags
Context
2022-03-31
23:25
Merge 1.1.23 check-in: 0cb78355c3 user: bohwaz tags: trunk, stable, 1.1.23
2022-03-29
17:14
When type is changed, change also the position check-in: 95dbbf3898 user: bohwaz tags: trunk, stable
17:04
Make it possible to change the account type check-in: b925a9161b user: bohwaz tags: trunk, stable
Changes

Modified src/templates/acc/accounts/index.tpl from [bc10ab9cdd] to [cf589f8a0d].

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
			{foreach from=$group.accounts item="account"}
				<tr>
					<td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}&amp;year={$current_year.id}">{$account.code}</a></td>
					<th><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}&amp;year={$current_year.id}">{$account.label}</a></th>
					<td class="money">
						{if $account.balance < 0
							|| ($account.balance > 0 && $account.position == Account::LIABILITY && ($account.type == Account::TYPE_BANK || $account.type == Account::TYPE_THIRD_PARTY || $account.type == Account::TYPE_CASH))}
							<strong class="error">-{$account.balance|raw|money_currency:false}</strong>
						{else}
							{$account.balance|raw|money_currency:false}
						{/if}
					</td>
					<td>
						{if $account.type == Account::TYPE_THIRD_PARTY && $account.balance > 0}
							{if $account.position == Account::LIABILITY}<em class="alert">(Dette)</em>







|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
			{foreach from=$group.accounts item="account"}
				<tr>
					<td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}&amp;year={$current_year.id}">{$account.code}</a></td>
					<th><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}&amp;year={$current_year.id}">{$account.label}</a></th>
					<td class="money">
						{if $account.balance < 0
							|| ($account.balance > 0 && $account.position == Account::LIABILITY && ($account.type == Account::TYPE_BANK || $account.type == Account::TYPE_THIRD_PARTY || $account.type == Account::TYPE_CASH))}
							<strong class="error">-{$account.balance|raw|abs|money_currency:false}</strong>
						{else}
							{$account.balance|raw|money_currency:false}
						{/if}
					</td>
					<td>
						{if $account.type == Account::TYPE_THIRD_PARTY && $account.balance > 0}
							{if $account.position == Account::LIABILITY}<em class="alert">(Dette)</em>

Modified src/www/admin/acc/charts/accounts/edit.php from [1dfbc47d52] to [4df5ac9aa9].

26
27
28
29
30
31
32





33
34
35
36
37
38
39
	try {
		if ($edit_disabled) {
			$account->importLimitedForm();
		}
		else {
			$account->importForm();
		}






		$account->save();

		$page = '';

		if (!$account->type) {
			$page = 'all.php';







>
>
>
>
>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	try {
		if ($edit_disabled) {
			$account->importLimitedForm();
		}
		else {
			$account->importForm();
		}

		// Force account position from type
		if ($account->isModified('type') && $account->user) {
			$account->position = Accounts::getPositionFromType($account->type);
		}

		$account->save();

		$page = '';

		if (!$account->type) {
			$page = 'all.php';