Overview
Comment:Merge with trunk
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: cb79a7bfc6a2bcb8b50162d431be282c7ff3752f80b0b551bb127e92eaa3e15f
User & Date: bohwaz on 2022-08-13 10:20:29
Other Links: branch diff | manifest | tags
Context
2022-08-13
12:04
Refactor password change form, customize for first password check-in: ff4431861d user: bohwaz tags: dev
10:20
Merge with trunk check-in: cb79a7bfc6 user: bohwaz tags: dev
10:14
Refactor password recovery form check-in: b9689fbdc8 user: bohwaz tags: dev
2022-08-12
15:24
Fix duplicate accounts of simple transactions check-in: f2d1709bf1 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/DynamicList.php from [a672b61802] to [66db2c1a47].

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
	}

	public function getHeaderColumns(bool $label_only = false)
	{
		$columns = [];

		foreach ($this->columns as $alias => $properties) {
			if (isset($properties['only_with_order']) && !($properties['only_with_order'] == $this->order && !$this->desc)) {
				continue;
			}

			// Skip columns that require a certain order AND paginated result
			if (isset($properties['only_with_order']) && $this->page > 1) {
				continue;
			}







|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
	}

	public function getHeaderColumns(bool $label_only = false)
	{
		$columns = [];

		foreach ($this->columns as $alias => $properties) {
			if (isset($properties['only_with_order']) && !($properties['only_with_order'] == $this->order)) {
				continue;
			}

			// Skip columns that require a certain order AND paginated result
			if (isset($properties['only_with_order']) && $this->page > 1) {
				continue;
			}
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
	public function SQL()
	{
		$start = ($this->page - 1) * $this->per_page;
		$columns = [];

		foreach ($this->columns as $alias => $properties) {
			// Skip columns that require a certain order (eg. calculating a running sum)
			if (isset($properties['only_with_order']) && !($properties['only_with_order'] == $this->order && !$this->desc)) {
				continue;
			}

			// Skip columns that require a certain order AND paginated result
			if (isset($properties['only_with_order']) && $this->page > 1) {
				continue;
			}







|







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
	public function SQL()
	{
		$start = ($this->page - 1) * $this->per_page;
		$columns = [];

		foreach ($this->columns as $alias => $properties) {
			// Skip columns that require a certain order (eg. calculating a running sum)
			if (isset($properties['only_with_order']) && !($properties['only_with_order'] == $this->order)) {
				continue;
			}

			// Skip columns that require a certain order AND paginated result
			if (isset($properties['only_with_order']) && $this->page > 1) {
				continue;
			}

Modified src/include/lib/Garradin/Entities/Accounting/Account.php from [5a3bbbbd6d] to [b3943d175a].

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
244
245
246

247
248
249
250
251
252
253
		$columns = self::LIST_COLUMNS;

		$tables = 'acc_transactions_lines l
			INNER JOIN acc_transactions t ON t.id = l.id_transaction
			LEFT JOIN acc_accounts b ON b.id = l.id_analytical';
		$conditions = sprintf('l.id_account = %d AND t.id_year = %d', $this->id(), $year_id);

		$sum = 0;
		$reverse = $this->isReversed($simple, $year_id) ? -1 : 1;

		if ($start) {
			$conditions .= sprintf(' AND t.date >= %s', $db->quote($start->format('Y-m-d')));
			$sum = $this->getSumAtDate($year_id, $start) * $reverse;
		}

		if ($end) {
			$conditions .= sprintf(' AND t.date <= %s', $db->quote($end->format('Y-m-d')));
		}

		$columns['change']['select'] = sprintf($columns['change']['select'], $reverse);

		if ($simple) {
			unset($columns['debit']['label'], $columns['credit']['label'], $columns['line_label']);
			$columns['line_reference']['label'] = 'Réf. paiement';
		}
		else {
			unset($columns['change']['label']);
		}

		$list = new DynamicList($columns, $tables, $conditions);
		$list->orderBy('date', false);
		$list->setCount('COUNT(*)');
		$list->setPageSize(null);
		$list->setModifier(function (&$row) use (&$sum) {
			if (property_exists($row, 'sum')) {









				$sum += $row->change;


				$row->sum = $sum;




			}

			$row->date = \DateTime::createFromFormat('!Y-m-d', $row->date);
		});

		$list->setExportCallback(function (&$row) {
			static $columns = ['change', 'sum', 'credit', 'debit'];
			foreach ($columns as $key) {
				if (isset($row->$key)) {
					$row->$key = Utils::money_format($row->$key, '.', '', false);
				}
			}







|




<

















|

|
|

>
>
>
>
>
>
>
>
>
|
>
>

>
>
>
>




>







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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
		$columns = self::LIST_COLUMNS;

		$tables = 'acc_transactions_lines l
			INNER JOIN acc_transactions t ON t.id = l.id_transaction
			LEFT JOIN acc_accounts b ON b.id = l.id_analytical';
		$conditions = sprintf('l.id_account = %d AND t.id_year = %d', $this->id(), $year_id);

		$sum = null;
		$reverse = $this->isReversed($simple, $year_id) ? -1 : 1;

		if ($start) {
			$conditions .= sprintf(' AND t.date >= %s', $db->quote($start->format('Y-m-d')));

		}

		if ($end) {
			$conditions .= sprintf(' AND t.date <= %s', $db->quote($end->format('Y-m-d')));
		}

		$columns['change']['select'] = sprintf($columns['change']['select'], $reverse);

		if ($simple) {
			unset($columns['debit']['label'], $columns['credit']['label'], $columns['line_label']);
			$columns['line_reference']['label'] = 'Réf. paiement';
		}
		else {
			unset($columns['change']['label']);
		}

		$list = new DynamicList($columns, $tables, $conditions);
		$list->orderBy('date', true);
		$list->setCount('COUNT(*)');
		$list->setPageSize(null); // Because with paging we can't calculate the running sum
		$list->setModifier(function (&$row) use (&$sum, &$list, $reverse, $year_id, $start, $end) {
			if (property_exists($row, 'sum')) {
				// Reverse running sum needs the last sum, first
				if ($list->desc && null === $sum) {
					$sum = $this->getSumAtDate($year_id, ($end ?? new \DateTime($row->date))->modify('+1 day')) * -1 * $reverse;
				}
				elseif (!$list->desc) {
					if (null === $sum && $start) {
						$sum = $this->getSumAtDate($year_id, $start) * -1 * $reverse;
					}

					$sum += $row->change;
				}

				$row->sum = $sum;

				if ($list->desc) {
					$sum -= $row->change;
				}
			}

			$row->date = \DateTime::createFromFormat('!Y-m-d', $row->date);
		});

		$list->setExportCallback(function (&$row) {
			static $columns = ['change', 'sum', 'credit', 'debit'];
			foreach ($columns as $key) {
				if (isset($row->$key)) {
					$row->$key = Utils::money_format($row->$key, '.', '', false);
				}
			}

Modified src/include/lib/Garradin/Entities/Accounting/Chart.php from [83c4d84edf] to [7d108c460e].

25
26
27
28
29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45
46
47
48
49
		'country'  => 'string',
		'code'     => '?string',
		'archived' => 'int',
	];

	public function selfCheck(): void
	{
		parent::selfCheck();
		$this->assert(trim($this->label) !== '', 'Le libellé ne peut rester vide.');
		$this->assert(strlen($this->label) <= 200, 'Le libellé ne peut faire plus de 200 caractères.');
		$this->assert(trim($this->country) !== '', 'Le pays ne peut rester vide.');
		$this->assert(Utils::getCountryName($this->country), 'Le code pays doit être un code ISO valide');
		$this->assert($this->archived === 0 || $this->archived === 1);

	}

	public function accounts()
	{
		return new Accounts($this->id());
	}

	public function canDelete()
	{
		return !DB::getInstance()->firstColumn(sprintf('SELECT 1 FROM %s WHERE id_chart = ? LIMIT 1;', Year::TABLE), $this->id());
	}
}







<





>












25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
		'country'  => 'string',
		'code'     => '?string',
		'archived' => 'int',
	];

	public function selfCheck(): void
	{

		$this->assert(trim($this->label) !== '', 'Le libellé ne peut rester vide.');
		$this->assert(strlen($this->label) <= 200, 'Le libellé ne peut faire plus de 200 caractères.');
		$this->assert(trim($this->country) !== '', 'Le pays ne peut rester vide.');
		$this->assert(Utils::getCountryName($this->country), 'Le code pays doit être un code ISO valide');
		$this->assert($this->archived === 0 || $this->archived === 1);
		parent::selfCheck();
	}

	public function accounts()
	{
		return new Accounts($this->id());
	}

	public function canDelete()
	{
		return !DB::getInstance()->firstColumn(sprintf('SELECT 1 FROM %s WHERE id_chart = ? LIMIT 1;', Year::TABLE), $this->id());
	}
}

Modified src/include/lib/Garradin/Entities/Accounting/Transaction.php from [5a7b1424d2] to [7c3a5d2ac4].

1082
1083
1084
1085
1086
1087
1088


1089


1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
			'Lignes'          => $lines,
		];
	}

	public function asJournalArray(): array
	{
		$out = $this->asArray();


		$out['url'] = $this->url();


		$out['lines'] = $this->getLinesWithAccounts();
		foreach ($out['lines'] as &$line) {
			unset($line->line);
		}
		unset($line);
		return $out;
	}

	public function url(): string
	{
		return Utils::getLocalURL('!acc/transactions/details.php?id=' . $this->id());
	}
}







>
>
|
>
>













1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
			'Lignes'          => $lines,
		];
	}

	public function asJournalArray(): array
	{
		$out = $this->asArray();

		if ($this->exists()) {
			$out['url'] = $this->url();
		}

		$out['lines'] = $this->getLinesWithAccounts();
		foreach ($out['lines'] as &$line) {
			unset($line->line);
		}
		unset($line);
		return $out;
	}

	public function url(): string
	{
		return Utils::getLocalURL('!acc/transactions/details.php?id=' . $this->id());
	}
}

Modified src/include/lib/Garradin/Entities/Files/File.php from [e0df22ffe5] to [3240dfbbd4].

966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
			throw new ValidationException('Le nom de fichier ne peut commencer par un point');
		}

		if (strpos($name, "\0") !== false) {
			throw new ValidationException('Nom de fichier invalide');
		}

		$extension = strtolower(substr($name, strrpos($name, '.')));

		if (preg_match(self::FORBIDDEN_EXTENSIONS, $extension)) {
			throw new ValidationException('Extension de fichier non autorisée, merci de renommer le fichier avant envoi.');
		}
	}

	static public function validatePath(string $path): array







|







966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
			throw new ValidationException('Le nom de fichier ne peut commencer par un point');
		}

		if (strpos($name, "\0") !== false) {
			throw new ValidationException('Nom de fichier invalide');
		}

		$extension = strtolower(substr($name, strrpos($name, '.')+1));

		if (preg_match(self::FORBIDDEN_EXTENSIONS, $extension)) {
			throw new ValidationException('Extension de fichier non autorisée, merci de renommer le fichier avant envoi.');
		}
	}

	static public function validatePath(string $path): array

Modified src/include/lib/Garradin/Form.php from [5505ba6380] to [2d4b774922].

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
	}

	public function addError($msg)
	{
		$this->errors[] = $msg;
	}

	public function getErrorMessages($membre = false)
	{
		$errors = [];
		$champs = null;

		if ($membre) {
			$champs = Config::getInstance()->get('champs_membres');
		}

		foreach ($this->errors as $error)
		{
			if (is_array($error))
			{
				if ($membre && $champs) {
					$error['name'] = $champs->get($error['name'], 'title');
				}

				$errors[] = $this->getErrorMessage($error['rule'], $error['name'], $error['params']);
			}
			else
			{
				$errors[] = $error;
			}
		}

		return $errors;
	}

	protected function getFieldName($name)
	{
		switch ($name)
		{
			case '_id': return 'identifiant';
			case 'passe': return 'mot de passe';
			case 'debut': return 'date de début';
			case 'fin': return 'date de fin';
			case 'duree': return 'durée';
			case 'passe_check': return 'vérification de mot de passe';
			case 'id_account': return 'compte';
			case 'label': return 'libellé';
			default: return $name;
		}
	}

	protected function getErrorMessage($rule, $element, Array $params)
	{
		$element = $this->getFieldName($element);

		switch ($rule)
		{
			case 'required':
			case 'required_if':
			case 'required_unless':
			case 'required_with':
			case 'required_with_all':
			case 'required_without':
			case 'required_without_all':
				return sprintf('Le champ %s est vide.', $element);
			case 'min':
				return sprintf('Le champ %s doit faire au moins %d caractères.', $element, $params[0]);
			case 'max':
				return sprintf('Le champ %s doit faire moins de %d caractères.', $element, $params[0]);
			case 'file':
				return sprintf('Le fichier envoyé n\'est pas valide.');
			case 'confirmed':
				return sprintf('La vérification du champ %s n\'est pas identique au champ lui-même.', $element);
			case 'date_format':
				return sprintf('Format de date invalide dans le champ %s.', $element);
			case 'numeric':
				return sprintf('Le champ %s doit être un nombre.', $element);
			case 'money':
				return sprintf('Le champ %s n\'est pas un nombre valide.', $element);
			case 'in':
			case 'in_table':
				return sprintf('Valeur invalide dans le champ \'%s\'.', $element);
			default:
				return sprintf('Erreur "%s" dans le champ "%s"', $rule, $element);
		}
	}

	public function __invoke($key)
	{
		return \KD2\Form::get($key);
	}








|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







98
99
100
101
102
103
104
105
106























107




















































108
109
110
111
112
113
114
	}

	public function addError($msg)
	{
		$this->errors[] = $msg;
	}

	public function getErrorMessages()
	{























		return $this->errors;




















































	}

	public function __invoke($key)
	{
		return \KD2\Form::get($key);
	}

Modified src/include/lib/Garradin/Membres.php from [9d392ca5eb] to [6e2caeaaf9].

45
46
47
48
49
50
51




52


53
54
55

56
57
58
59
60
61
62
63
                }
            }

            if (isset($data[$key]))
            {
                if ($config->type == 'datetime' && trim($data[$key]) !== '')
                {




                    $dt = \DateTime::createFromFormat('Y-m-d H:i', $data[$key]);


                    if (!$dt) {
                        throw new UserException(sprintf('Format invalide pour le champ "%s": AAAA-MM-JJ HH:mm attendu.', $config->title));
                    }

                    $data[$key] = $dt->format('Y-m-d H:i');
                }
                elseif ($config->type == 'date' && trim($data[$key]) !== '')
                {
                    $dt = \DateTime::createFromFormat('Y-m-d', $data[$key]);

                    if (!$dt) {
                        $dt = \DateTime::createFromFormat('d/m/y', $data[$key]);







>
>
>
>
|
>
>

|

>
|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
                }
            }

            if (isset($data[$key]))
            {
                if ($config->type == 'datetime' && trim($data[$key]) !== '')
                {
                    $value = sprintf('%s %s', $data[$key], $_POST[$key . '_time'] ?? '');
                    $dt = null;

                    if (preg_match('!^\d{2}/\d{2}/\d{4}\s\d{1,2}:\d{2}$!', $value)) {
                        $dt = \DateTime::createFromFormat('!d/m/Y H:i', $value);
                    }

                    if (!$dt) {
                        throw new UserException(sprintf('Format de date et heure invalide pour le champ "%s" : %s', $config->title, $value));
                    }

                    $data[$key] = $dt->format('Y-m-d H:i:s');
                }
                elseif ($config->type == 'date' && trim($data[$key]) !== '')
                {
                    $dt = \DateTime::createFromFormat('Y-m-d', $data[$key]);

                    if (!$dt) {
                        $dt = \DateTime::createFromFormat('d/m/y', $data[$key]);

Modified src/include/lib/Garradin/Template.php from [8306b4881d] to [afb4864343].

385
386
387
388
389
390
391














392
393
394
395
396
397
398
		elseif ($type == 'time' && is_object($current_value) && $current_value instanceof \DateTimeInterface) {
			$current_value = $current_value->format('H:i');
		}
		elseif ($type == 'date' && is_string($current_value)) {
			if ($v = \DateTime::createFromFormat('!Y-m-d', $current_value)) {
				$current_value = $v->format('d/m/Y');
			}














		}


		$attributes['id'] = 'f_' . str_replace(['[', ']'], '', $name);
		$attributes['name'] = $name;

		if (!isset($attributes['autocomplete']) && ($type == 'money' || $type == 'password')) {







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







385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
		elseif ($type == 'time' && is_object($current_value) && $current_value instanceof \DateTimeInterface) {
			$current_value = $current_value->format('H:i');
		}
		elseif ($type == 'date' && is_string($current_value)) {
			if ($v = \DateTime::createFromFormat('!Y-m-d', $current_value)) {
				$current_value = $v->format('d/m/Y');
			}
			elseif ($v = \DateTime::createFromFormat('!Y-m-d H:i:s', $current_value)) {
				$current_value = $v->format('d/m/Y');
			}
			elseif ($v = \DateTime::createFromFormat('!Y-m-d H:i', $current_value)) {
				$current_value = $v->format('d/m/Y');
			}
		}
		elseif ($type == 'time' && is_string($current_value)) {
			if ($v = \DateTime::createFromFormat('!Y-m-d H:i:s', $current_value)) {
				$current_value = $v->format('H:i');
			}
			elseif ($v = \DateTime::createFromFormat('!Y-m-d H:i', $current_value)) {
				$current_value = $v->format('H:i');
			}
		}


		$attributes['id'] = 'f_' . str_replace(['[', ']'], '', $name);
		$attributes['name'] = $name;

		if (!isset($attributes['autocomplete']) && ($type == 'money' || $type == 'password')) {
537
538
539
540
541
542
543






544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
			$currency = Config::getInstance()->get('currency');
			$input = sprintf('<nobr><input type="text" pattern="-?[0-9]*([.,][0-9]{1,2})?" inputmode="decimal" size="8" class="money" %s value="%s" /><b>%s</b></nobr>', $attributes_string, $this->escape($current_value), $currency);
		}
		else {
			$value = isset($attributes['value']) ? '' : sprintf(' value="%s"', $this->escape($current_value));
			$input = sprintf('<input type="%s" %s %s />', $type, $attributes_string, $value);
		}







		// No label? then we only want the input without the widget
		if (empty($label)) {
			if (!array_key_exists('label', $params) && ($type == 'radio' || $type == 'checkbox')) {
				$input .= sprintf('<label for="%s"></label>', $attributes['id']);
			}

			return $input;
		}

		if ($type == 'file') {
			$input .= sprintf('<input type="hidden" name="MAX_FILE_SIZE" value="%d" id="f_maxsize" />', Utils::return_bytes(Utils::getMaxUploadSize()));
		}

		$input .= $suffix;

		$label = sprintf('<label for="%s">%s</label>', $attributes['id'], $this->escape($label));

		if ($type == 'radio' || $type == 'checkbox') {
			$out = sprintf('<dd>%s %s', $input, $label);

			if (isset($help)) {
				$out .= sprintf(' <em class="help">(%s)</em>', $this->escape($help));







>
>
>
>
>
>










<
<
<
<
<
<







551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573






574
575
576
577
578
579
580
			$currency = Config::getInstance()->get('currency');
			$input = sprintf('<nobr><input type="text" pattern="-?[0-9]*([.,][0-9]{1,2})?" inputmode="decimal" size="8" class="money" %s value="%s" /><b>%s</b></nobr>', $attributes_string, $this->escape($current_value), $currency);
		}
		else {
			$value = isset($attributes['value']) ? '' : sprintf(' value="%s"', $this->escape($current_value));
			$input = sprintf('<input type="%s" %s %s />', $type, $attributes_string, $value);
		}

		if ($type == 'file') {
			$input .= sprintf('<input type="hidden" name="MAX_FILE_SIZE" value="%d" id="f_maxsize" />', Utils::return_bytes(Utils::getMaxUploadSize()));
		}

		$input .= $suffix;

		// No label? then we only want the input without the widget
		if (empty($label)) {
			if (!array_key_exists('label', $params) && ($type == 'radio' || $type == 'checkbox')) {
				$input .= sprintf('<label for="%s"></label>', $attributes['id']);
			}

			return $input;
		}







		$label = sprintf('<label for="%s">%s</label>', $attributes['id'], $this->escape($label));

		if ($type == 'radio' || $type == 'checkbox') {
			$out = sprintf('<dd>%s %s', $input, $label);

			if (isset($help)) {
				$out .= sprintf(' <em class="help">(%s)</em>', $this->escape($help));

Modified src/include/lib/Garradin/Utils.php from [530b6c0552] to [5ffee2b21c].

130
131
132
133
134
135
136



137
138
139
140
141
142
143
        }
        elseif (strlen($ts) == 10) {
            return \DateTime::createFromFormat('!Y-m-d', $ts);
        }
        elseif (strlen($ts) == 19) {
            return \DateTime::createFromFormat('Y-m-d H:i:s', $ts);
        }



        else {
            return null;
        }
    }

    static public function strftime_fr($ts, $format)
    {







>
>
>







130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
        }
        elseif (strlen($ts) == 10) {
            return \DateTime::createFromFormat('!Y-m-d', $ts);
        }
        elseif (strlen($ts) == 19) {
            return \DateTime::createFromFormat('Y-m-d H:i:s', $ts);
        }
        elseif (strlen($ts) == 16) {
            return \DateTime::createFromFormat('!Y-m-d H:i', $ts);
        }
        else {
            return null;
        }
    }

    static public function strftime_fr($ts, $format)
    {

Modified src/templates/acc/accounts/journal.tpl from [a4a61762be] to [e73e00104c].

145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
			{/if}
			{if !$simple}<td></td>{/if}
			{if null !== $sum}
				{if !$simple}
				<td><b>Total</b></td>
				<td class="money">{$sum.debit|raw|money:false}</td>
				<td class="money">{$sum.credit|raw|money:false}</td>
				<td class="money">{$line.sum|raw|money:false}</td>
				{else}
				<td></td>
				<td colspan="2"><b>Total</b></td>
				<td class="money">{$line.sum|raw|money:false}</td>
				{/if}
			{else}
				<td colspan="4"></td>
			{/if}
			{if !$simple}<td></td>{/if}
			<td class="actions" colspan="5">
				{if $can_edit}







|



|







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
			{/if}
			{if !$simple}<td></td>{/if}
			{if null !== $sum}
				{if !$simple}
				<td><b>Total</b></td>
				<td class="money">{$sum.debit|raw|money:false}</td>
				<td class="money">{$sum.credit|raw|money:false}</td>
				<td class="money"><strong>{$sum.balance|raw|money:false}</strong></td>
				{else}
				<td></td>
				<td colspan="2"><b>Total</b></td>
				<td class="money"><strong>{$sum.balance|raw|money:false}</strong></td>
				{/if}
			{else}
				<td colspan="4"></td>
			{/if}
			{if !$simple}<td></td>{/if}
			<td class="actions" colspan="5">
				{if $can_edit}

Modified src/templates/admin/_head.tpl from [8c1f55b64c] to [83a5af10c5].

118
119
120
121
122
123
124

125

126
127
128
129
130
131
132
		{if $help_url}
		<li>
			<h3><a href="{$help_url}" target="_dialog"><b data-icn="{icon html=false shape="help"}"></b><span>Aide</span></a></h3>
		</li>
		{/if}

	{elseif !defined('Garradin\INSTALL_PROCESS')}

		<li><a href="{if $config.org_web}{$config.org_web}{else}{$www_url}{/if}">&larr; Retour au site</a></li>

		<li><a href="{$admin_url}">Connexion</a>
			<ul>
				<li><a href="{$admin_url}password.php">Mot de passe perdu</a>
			</ul>
		</li>
	{/if}
	</ul>







>

>







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
		{if $help_url}
		<li>
			<h3><a href="{$help_url}" target="_dialog"><b data-icn="{icon html=false shape="help"}"></b><span>Aide</span></a></h3>
		</li>
		{/if}

	{elseif !defined('Garradin\INSTALL_PROCESS')}
        {if $config.org_web || !$config.site_disabled}
		<li><a href="{if $config.org_web}{$config.org_web}{else}{$www_url}{/if}">&larr; Retour au site</a></li>
        {/if}
		<li><a href="{$admin_url}">Connexion</a>
			<ul>
				<li><a href="{$admin_url}password.php">Mot de passe perdu</a>
			</ul>
		</li>
	{/if}
	</ul>

Modified src/www/admin/acc/transactions/new.php from [6424d9b0e5] to [b08a590bb9].

52
53
54
55
56
57
58

59
60
61
62
63
64
65
		throw new UserException('Cette écriture n\'existe pas (ou plus).');
	}

	$transaction = $old->duplicate($current_year);

	if (empty($_POST)) {
		$lines = $transaction->getLinesWithAccounts();

	}

	$id_analytical = $old->getAnalyticalId();
	$amount = $transaction->getLinesCreditSum();
	$linked_users = $old->listLinkedUsersAssoc();

	$tpl->assign('duplicate_from', $old->id());







>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
		throw new UserException('Cette écriture n\'existe pas (ou plus).');
	}

	$transaction = $old->duplicate($current_year);

	if (empty($_POST)) {
		$lines = $transaction->getLinesWithAccounts();
		$types_details = $transaction->getTypesDetails();
	}

	$id_analytical = $old->getAnalyticalId();
	$amount = $transaction->getLinesCreditSum();
	$linked_users = $old->listLinkedUsersAssoc();

	$tpl->assign('duplicate_from', $old->id());

Modified src/www/admin/password.php from [499c36cca4] to [cecdb57f0d].

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
34
35
36
37
38
39
40
41
42
43


44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
59
<?php

namespace Garradin;

const LOGIN_PROCESS = true;

require_once __DIR__ . '/_inc.php';

if (qg('c'))
{

    if (!$session->recoverPasswordCheck(qg('c')))
    {
        $form->addError('Le lien que vous avez suivi est invalide ou a expiré.');
    }
    else
    {
        if (f('change') && $form->check('changePassword'))
        {
            try {

                $session->recoverPasswordChange(qg('c'), f('passe'), f('passe_confirmed'));
                Utils::redirect('!login.php?changed');
            }
            catch (UserException $e) {
                $form->addError($e->getMessage());
            }
        }

        $tpl->assign('passphrase', Utils::suggestPassword());
        $tpl->display('password_change.tpl');
        exit;

    }
}
elseif (f('recover'))
{
    $form->check('recoverPassword', [
        'id' => 'required'
    ]);

    if (!$form->hasErrors())
    {
        if (f('id') && $session->recoverPasswordSend(f('id')))
        {
            Utils::redirect(ADMIN_URL . 'password.php?sent');


        }

        $form->addError('Ce membre n\'a pas d\'adresse email enregistrée ou n\'a pas le droit de se connecter.');
    }

}

if (!$form->hasErrors() && null !== qg('sent'))
{
    $tpl->assign('sent', true);
}

$id_field = DynamicFields::get(DynamicFields::getLoginField());

$tpl->assign('id_field', $id_field);

$tpl->display('password.tpl');








|
|
>
|
<
|
|
<
|
|
|
<
>
|
|
|
<
<
<
<
|
<
|
|
>
|
<
|
|
<
<
<
|
<
<
|
|
<
>
>
|
|
|
|
>
|
<
|
<
<
<



|


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
34
35
36
37
38
39

40



41
42
43
44
45
46
<?php

namespace Garradin;

const LOGIN_PROCESS = true;

require_once __DIR__ . '/_inc.php';

$session = Session::getInstance();

$form->runIf(qg('c'), function () use ($session, $form) {
	if (!$session->recoverPasswordCheck(qg('c'))) {

		throw new UserException('Le lien que vous avez suivi est invalide ou a expiré.');
	}


	$csrf_key = 'password_change_' . qg('c');


	$form->runIf('change', function () use ($session) {
		$session->recoverPasswordChange(qg('c'), f('password'), f('password_confirmed'));
	}, $csrf_key, '!login.php?changed');





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

	$tpl->display('password_change.tpl');
	exit;
});


$csrf_key = 'recover_password';




$form->runIf('recover', function () use ($session) {


	$error = $session->recoverPasswordSend((int) f('id'));


	if ($error === 1) {
		throw new UserException('Aucun membre trouvé avec cette adresse e-mail, ou le membre trouvé n\'a pas le droit de se connecter.');
	}
	elseif ($error === 2) {
		throw new UserException('Ce membre n\'a pas le droit de se connecter.');
	}
}, $csrf_key, '!password.php?sent');


$sent = !$form->hasErrors() && null !== qg('sent');




$id_field = DynamicFields::get(DynamicFields::getLoginField());

$tpl->assign(compact('id_field', 'sent', 'csrf_key'));

$tpl->display('password.tpl');

Modified src/www/skel-dist/_head.html from [ad08703b66] to [7b636d0bec].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html lang="fr">
<head>
	<meta charset="utf-8" />
	<title>{{if $title}}{{$title}} — {{/if}}{{$config.org_name}}</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, target-densitydpi=device-dpi" />
	<style type="text/css">
	:root {
		--first-color: {{if $config.couleur1}}{{$config.couleur1|css_hex_to_rgb}}{{else}}120, 120, 120{{/if}};
		--second-color: {{if $config.couleur2}}{{$config.couleur2|css_hex_to_rgb}}{{else}}30, 30, 30{{/if}};
	}
	</style>
	<link rel="stylesheet" type="text/css" href="{{$root_url}}default.css?2022" media="screen,projection,handheld" />
	<link rel="stylesheet" type="text/css" href="{{$root_url}}content.css" media="all" />
	<link rel="alternate" type="application/atom+xml" title="{{$config.org_name}}" href="{{$root_url}}atom.xml" />
	<link rel="icon" type="image/png" href="{{$config.files.favicon}}" />
</head>

<body>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html lang="fr">
<head>
	<meta charset="utf-8" />
	<title>{{if $title}}{{$title}} — {{/if}}{{$config.org_name}}</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, target-densitydpi=device-dpi" />
	<style type="text/css">
	:root {
		--first-color: {{if $config.couleur1}}{{$config.couleur1|css_hex_to_rgb}}{{else}}120, 120, 120{{/if}};
		--second-color: {{if $config.couleur2}}{{$config.couleur2|css_hex_to_rgb}}{{else}}30, 30, 30{{/if}};
	}
	</style>
	<link rel="stylesheet" type="text/css" href="{{$root_url}}default.css?2022-07" media="screen,projection,handheld" />
	<link rel="stylesheet" type="text/css" href="{{$root_url}}content.css" media="all" />
	<link rel="alternate" type="application/atom+xml" title="{{$config.org_name}}" href="{{$root_url}}atom.xml" />
	<link rel="icon" type="image/png" href="{{$config.files.favicon}}" />
</head>

<body>

Modified src/www/skel-dist/default.css from [25f3f8689b] to [db424ff1b1].

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
    text-decoration: none;
    height: calc(100% - 2rem);
    align-items: center;
    justify-content: center;
}

header.main h1 a span {
    font-size: 3vw;
    font-weight: normal;
    color: rgb(var(--second-color));
    display: block;
}

header.main h1 a:hover span {
    color: rgb(var(--first-color));
}

header.main h1 a:hover img {
    opacity: 0.8;
}

header.main h1 a img {
    max-height: 200px;
}

header.main.home h1 a img {
    max-height: 300px;
}

header.main.home h1 a span {
    font-size: 5vw;
}

header.main .contacts {
    font-size: 1.3em;
    display: flex;
    justify-content: flex-end;
    flex-direction: column;







|

|




|















|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
    text-decoration: none;
    height: calc(100% - 2rem);
    align-items: center;
    justify-content: center;
}

header.main h1 a span {
    font-size: 1.5em;
    font-weight: normal;
    color: rgb(var(--first-color));
    display: block;
}

header.main h1 a:hover span {
    color: rgb(var(--second-color));
}

header.main h1 a:hover img {
    opacity: 0.8;
}

header.main h1 a img {
    max-height: 200px;
}

header.main.home h1 a img {
    max-height: 300px;
}

header.main.home h1 a span {
    font-size: 2em;
}

header.main .contacts {
    font-size: 1.3em;
    display: flex;
    justify-content: flex-end;
    flex-direction: column;
290
291
292
293
294
295
296







297
298
299
300
301
302
303
    color: #990;
}

/* AFFICHAGE D'UN ARTICLE */
section.articles article h3, section.articles article h1 {
    margin-bottom: .3em;
}








section.articles article h1 a {
    color: #000;
    text-decoration: none;
    font-weight: normal;
}








>
>
>
>
>
>
>







290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
    color: #990;
}

/* AFFICHAGE D'UN ARTICLE */
section.articles article h3, section.articles article h1 {
    margin-bottom: .3em;
}

section.articles article::after, article.single::after {
    content: "";
    display: block;
    height: 0px;
    clear: both;
}

section.articles article h1 a {
    color: #000;
    text-decoration: none;
    font-weight: normal;
}