Overview
Comment:Error when trying to duplicate a non-existing transaction
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 6a16ddb8dde5da623a14704caa8311662408dac1bff0b695e1f77cf2239071f1
User & Date: bohwaz on 2021-11-23 23:37:08
Other Links: manifest | tags
Context
2021-11-23
23:41
Make sure the value is iterable check-in: efca0d5bfa user: bohwaz tags: trunk, stable
23:37
Error when trying to duplicate a non-existing transaction check-in: 6a16ddb8dd user: bohwaz tags: trunk, stable
21:59
Hide old services check-in: 2933ec352e user: bohwaz tags: trunk, stable
Changes

Modified src/www/admin/acc/transactions/new.php from [8e213aaf33] to [c612c4dc3a].

23
24
25
26
27
28
29





30
31
32
33
34
35
36
$amount = 0;
$types_accounts = null;
$id_analytical = null;

// Duplicate transaction
if (qg('copy')) {
	$old = Transactions::get((int)qg('copy'));





	$transaction = $old->duplicate($current_year);
	$lines = $transaction->getLinesWithAccounts(true);
	$id_analytical = $old->getAnalyticalId();
	$amount = $transaction->getLinesCreditSum();
	$types_accounts = $transaction->getTypesAccounts();
	$transaction->resetLines();








>
>
>
>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$amount = 0;
$types_accounts = null;
$id_analytical = null;

// Duplicate transaction
if (qg('copy')) {
	$old = Transactions::get((int)qg('copy'));

	if (!$old) {
		throw new UserException('Cette écriture n\'existe pas (ou plus).');
	}

	$transaction = $old->duplicate($current_year);
	$lines = $transaction->getLinesWithAccounts(true);
	$id_analytical = $old->getAnalyticalId();
	$amount = $transaction->getLinesCreditSum();
	$types_accounts = $transaction->getTypesAccounts();
	$transaction->resetLines();