Overview
Comment:Check and alert if the same account is listed twice in a transaction
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 9f32cf302a8e7cdf36732488ce87200154959dfd218f84abff0e4387b558c0a0
User & Date: bohwaz on 2023-01-22 14:11:02
Other Links: manifest | tags
Context
2023-01-22
19:00
Display todays date when generating an accounting report, not the closing date, it may be misleading check-in: 4220d4a1a7 user: bohwaz tags: trunk, stable
14:11
Check and alert if the same account is listed twice in a transaction check-in: 9f32cf302a user: bohwaz tags: trunk, stable
13:52
List pending debts and credits from closed years, and alert about them check-in: 6566b208d0 user: bohwaz tags: trunk, stable
Changes

Modified src/www/admin/static/scripts/accounting.js from [93a05e165e] to [7039cc2124].

1

























2
3
4
5
6
7
8
function initTransactionForm(is_new) {

























	// Advanced transaction: line management
	var lines = $('.transaction-lines tbody tr');

	function initLine(row) {
		var removeBtn = row.querySelector('button[name="remove_line"]');
		removeBtn.onclick = () => {
			var count = $('.transaction-lines tbody tr').length;

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
28
29
30
31
32
33
function initTransactionForm(is_new) {
	var form = $('form')[0];
	// Check if an account is listed twice and ask for confirmation
	form.addEventListener('submit', (e) => {
		var accounts = [];
		var lines = $('.transaction-lines tbody tr');

		for (var i = 0; i < lines.length; i++) {
			var a = lines[i].querySelector('.input-list input[type="hidden"]');

			if (!a) {
				continue;
			}

			if (accounts.includes(a.value)
				&& !window.confirm(`Attention, cette écriture affecte deux fois le même compte (${a.value}). Confirmer ?`)) {
				e.preventDefault();
				return false;
			}

			accounts.push(a.value);
		}

		return true;
	});

	// Advanced transaction: line management
	var lines = $('.transaction-lines tbody tr');

	function initLine(row) {
		var removeBtn = row.querySelector('button[name="remove_line"]');
		removeBtn.onclick = () => {
			var count = $('.transaction-lines tbody tr').length;