Overview
Comment:Fix accounting raw import
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: f61a69840eb6aa78c3587c55cdb203016f4e19d7
User & Date: bohwaz on 2020-11-20 17:37:11
Other Links: branch diff | manifest | tags
Context
2020-11-22
19:30
Update config.dist.php file to comment everything by default check-in: da1574366c user: bohwaz tags: dev
2020-11-20
17:37
Fix accounting raw import check-in: f61a69840e user: bohwaz tags: dev
16:57
Add ability to delete multiple transactions from account journal check-in: 32589b6817 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Accounting/Transactions.php from [13e724a358] to [c4c7222539].

197
198
199
200
201
202
203




204
205
206
207
208
209
210
						}
					}
					else {
						$transaction = new Transaction;
						$transaction->id_creator = $user_id;
						$transaction->id_year = $year->id();
					}





					$transaction->type = $types[$row->type];
					$fields = array_intersect_key((array)$row, array_flip(['label', 'date', 'notes', 'reference']));

					$transaction->importForm($fields);
				}








>
>
>
>







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
						}
					}
					else {
						$transaction = new Transaction;
						$transaction->id_creator = $user_id;
						$transaction->id_year = $year->id();
					}

					if (!isset($types[$row->type])) {
						throw new UserException(sprintf('le type "%s" est inconnu', $row->type));
					}

					$transaction->type = $types[$row->type];
					$fields = array_intersect_key((array)$row, array_flip(['label', 'date', 'notes', 'reference']));

					$transaction->importForm($fields);
				}

Modified src/include/lib/Garradin/CSV.php from [a38542997d] to [0895323879].

247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
			// Empty line, skip
			if (empty($row)) {
				continue;
			}

			if (count($row) != count($columns))
			{
				$db->rollback();
				throw new UserException('Erreur sur la ligne ' . $line . ' : le nombre de colonnes est incorrect.');
			}

			$row = array_combine($columns, $row);

			yield $line => $row;
		}

		fclose($fp);
	}
}







<











247
248
249
250
251
252
253

254
255
256
257
258
259
260
261
262
263
264
			// Empty line, skip
			if (empty($row)) {
				continue;
			}

			if (count($row) != count($columns))
			{

				throw new UserException('Erreur sur la ligne ' . $line . ' : le nombre de colonnes est incorrect.');
			}

			$row = array_combine($columns, $row);

			yield $line => $row;
		}

		fclose($fp);
	}
}