Overview
Comment:Fix small issues on transaction adding
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: e57d8c495d52b6454ea714d120ab4eb76c340fbd
User & Date: bohwaz on 2020-09-29 18:47:22
Other Links: branch diff | manifest | tags
Context
2020-09-30
12:16
Replace datepicker with something lighter check-in: 2fec91572c user: bohwaz tags: dev
2020-09-29
18:47
Fix small issues on transaction adding check-in: e57d8c495d user: bohwaz tags: dev
17:25
Link users to transactions check-in: 1ba9497799 user: bohwaz tags: dev
Changes

Modified src/include/data/1.0.0_migration.sql from [e268d29158] to [aaf3069145].

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
-- Recopie des descriptions de catégories dans la table des comptes, et mise des comptes en signets
UPDATE acc_accounts SET type = 1, description = (SELECT description FROM compta_categories WHERE compte = acc_accounts.code)
	WHERE id IN (SELECT a.id FROM acc_accounts a INNER JOIN compta_categories c ON c.compte = a.code AND c.type = 1);

UPDATE acc_accounts SET type = 2, description = (SELECT description FROM compta_categories WHERE compte = acc_accounts.code)
	WHERE id IN (SELECT a.id FROM acc_accounts a INNER JOIN compta_categories c ON c.compte = a.code AND c.type = -1);

-- Recopie des opérations, mais le nom a changé pour "mouvements"
INSERT INTO membres_mouvements
	SELECT * FROM membres_operations_old;

-- FIXME: ajout d'entrées dans le le log utilisateur à partir de id_auteur

-- Recopie des exercices, mais la date de fin ne peut être nulle
INSERT INTO acc_years (id, label, start_date, end_date, closed, id_chart)
	SELECT id, libelle, debut, CASE WHEN fin IS NULL THEN date(debut, '+1 year') ELSE fin END, cloture, 1 FROM compta_exercices;







|
|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
-- Recopie des descriptions de catégories dans la table des comptes, et mise des comptes en signets
UPDATE acc_accounts SET type = 1, description = (SELECT description FROM compta_categories WHERE compte = acc_accounts.code)
	WHERE id IN (SELECT a.id FROM acc_accounts a INNER JOIN compta_categories c ON c.compte = a.code AND c.type = 1);

UPDATE acc_accounts SET type = 2, description = (SELECT description FROM compta_categories WHERE compte = acc_accounts.code)
	WHERE id IN (SELECT a.id FROM acc_accounts a INNER JOIN compta_categories c ON c.compte = a.code AND c.type = -1);

-- Recopie des opérations, mais le nom a changé pour acc_transactions_users
INSERT INTO acc_transactions_users
	SELECT * FROM membres_operations_old;

-- FIXME: ajout d'entrées dans le le log utilisateur à partir de id_auteur

-- Recopie des exercices, mais la date de fin ne peut être nulle
INSERT INTO acc_years (id, label, start_date, end_date, closed, id_chart)
	SELECT id, libelle, debut, CASE WHEN fin IS NULL THEN date(debut, '+1 year') ELSE fin END, cloture, 1 FROM compta_exercices;

Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [057c49d87b] to [0734f7a1b0].

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233



234
235
236
237
238
239
240
...
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257

			$line = new Line;
			$line->importForm([
				'reference'     => $source['payment_reference'],
				'credit'        => '0',
				'debit'         => $amount,
				'id_account'    => $from,
				'id_analytical' => $source['id_analytical'] ?? null,
			]);
			$this->add($line);

			$line = new Line;
			$line->importForm([
				'reference'     => $source['payment_reference'],
				'credit'        => $amount,
				'debit'         => '0',
				'id_account'    => $to,
				'id_analytical' => $source['id_analytical'] ?? null,
			]);
			$this->add($line);
		}
		else {
			foreach ($source['lines'] as $i => $line) {
				$line['id_account'] = @count($line['id_account']) ? key($line['id_account']) : null;

				if (!$line['id_account']) {
					throw new ValidationException('Numéro de compte invalide sur la ligne ' . ($i+1));
				}




				$line = (new Line)->import($line);
				$this->add($line);
			}
		}
	}

	public function year()
................................................................................
	}

	public function listFiles()
	{
		return Fichiers::listLinkedFiles(Fichiers::LIEN_COMPTA, $this->id());
	}

	public function linkTo(int $user_id, ?int $contribution_id = null)
	{
		if (!$this->id()) {
			throw new \LogicException('Cannot link a non-saved transaction');
		}

		$db = EntityManager::getInstance(self::class)->DB();








|









|











>
>
>







 







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
...
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260

			$line = new Line;
			$line->importForm([
				'reference'     => $source['payment_reference'],
				'credit'        => '0',
				'debit'         => $amount,
				'id_account'    => $from,
				'id_analytical' => !empty($source['id_analytical']) ? $source['id_analytical'] : null,
			]);
			$this->add($line);

			$line = new Line;
			$line->importForm([
				'reference'     => $source['payment_reference'],
				'credit'        => $amount,
				'debit'         => '0',
				'id_account'    => $to,
				'id_analytical' => !empty($source['id_analytical']) ? $source['id_analytical'] : null,
			]);
			$this->add($line);
		}
		else {
			foreach ($source['lines'] as $i => $line) {
				$line['id_account'] = @count($line['id_account']) ? key($line['id_account']) : null;

				if (!$line['id_account']) {
					throw new ValidationException('Numéro de compte invalide sur la ligne ' . ($i+1));
				}

				// FIXME: allow one different analytical account per line
				$line['id_analytical'] = !empty($source['id_analytical']) ? $source['id_analytical'] : null;

				$line = (new Line)->import($line);
				$this->add($line);
			}
		}
	}

	public function year()
................................................................................
	}

	public function listFiles()
	{
		return Fichiers::listLinkedFiles(Fichiers::LIEN_COMPTA, $this->id());
	}

	public function linkToUser(int $user_id, ?int $service_id = null)
	{
		if (!$this->id()) {
			throw new \LogicException('Cannot link a non-saved transaction');
		}

		$db = EntityManager::getInstance(self::class)->DB();

Modified src/include/lib/Garradin/Template.php from [ffeeb083b6] to [36dcf1a90d].

234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
		}
		elseif ($type == 'date') {
			$type = 'text';
			$attributes['placeholder'] = 'JJ/MM/AAAA';
			$attributes['data-input'] = 'date';
			$attributes['size'] = 12;
			$attributes['maxlength'] = 10;
			$attributes['pattern'] = '\d+/\d+/\d{2,4}';
		}

		// Create attributes string
		if (array_key_exists('required', $attributes)) {
			$attributes['required'] = 'required';
		}








|







234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
		}
		elseif ($type == 'date') {
			$type = 'text';
			$attributes['placeholder'] = 'JJ/MM/AAAA';
			$attributes['data-input'] = 'date';
			$attributes['size'] = 12;
			$attributes['maxlength'] = 10;
			$attributes['pattern'] = '\d\d?/\d\d?/\d{4}';
		}

		// Create attributes string
		if (array_key_exists('required', $attributes)) {
			$attributes['required'] = 'required';
		}

Modified src/www/admin/static/admin.css from [96d6e1e894] to [9d2e7e9250].

382
383
384
385
386
387
388

389
390
391
392
393
394
395
...
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418

form .input-list .label {
    padding: .4rem .6rem;
}

form .input-list button {
    padding: .4rem .6rem;

    margin: 0;
    border: none;
    border-right: 1px solid #ccc;
    border-radius: 0;
}

form .input-list .label button {
................................................................................
}

input.money {
    text-align: right;
}

input.money + b {
    padding: .4rem .6rem;
    line-height: 1.5rem;
    color: #999;
}

#dialog {
    width: 100%;
    height: 100%;







>







 







|







382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
...
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419

form .input-list .label {
    padding: .4rem .6rem;
}

form .input-list button {
    padding: .4rem .6rem;
    align-self: stretch;
    margin: 0;
    border: none;
    border-right: 1px solid #ccc;
    border-radius: 0;
}

form .input-list .label button {
................................................................................
}

input.money {
    text-align: right;
}

input.money + b {
    padding: .2rem .6rem;
    line-height: 1.5rem;
    color: #999;
}

#dialog {
    width: 100%;
    height: 100%;