FEAT #11422 TIME 0:20

parent 6af23718
......@@ -17,24 +17,24 @@ foreach ($customs as $custom) {
$cases = \SrcCore\models\DatabaseModel::select([
'select' => ['*'],
'select' => ['case_id', 'case_label', 'case_closing_date'],
'table' => ['cases']
]);
if (!empty($cases)) {
$file = fopen("migration/19.12/cases_{$custom}.csv", 'w+');
$csvHead = ['Identifiant affaire', 'Libellé affaire', 'Date de cloture', 'Identifiant courrier', 'Sujet courrier'];
$csvHead = ['Identifiant affaire', 'Libellé affaire', 'Date de cloture', 'Identifiant courrier', 'Numéro chrono', 'Sujet courrier'];
fputcsv($file, $csvHead, ',');
foreach ($cases as $case) {
$resources = \SrcCore\models\DatabaseModel::select([
'select' => ['res_letterbox.res_id', 'res_letterbox.subject'],
'table' => ['cases_res, res_letterbox'],
'where' => ['cases_res.res_id = res_letterbox.res_id', 'case_id = ?'],
'select' => ['r.res_id', 'r.subject', 'mlb.alt_identifier'],
'table' => ['cases_res c, res_letterbox r, mlb_coll_ext mlb'],
'where' => ['c.res_id = r.res_id', 'r.res_id = mlb.res_id', 'case_id = ?', 'r.status <> \'DEL\''],
'data' => [$case['case_id']]
]);
foreach ($resources as $resource) {
$csvContent = [$case['case_id'], $case['case_label'], $case['case_closing_date'], $resource['res_id'], $resource['subject']];
$csvContent = [$case['case_id'], $case['case_label'], $case['case_closing_date'], $resource['res_id'], $resource['alt_identifier'], $resource['subject']];
fputcsv($file, $csvContent, ',');
}
++$migrated;
......
......@@ -17,20 +17,20 @@ foreach ($customs as $custom) {
$fileplans = \SrcCore\models\DatabaseModel::select([
'select' => ['*'],
'select' => ['fileplan_id', 'fileplan_label'],
'table' => ['fp_fileplan'],
'where' => ['user_id is null']
]);
if (!empty($fileplans)) {
$file = fopen("migration/19.12/fileplans_{$custom}.csv", 'w+');
$csvHead = ['Identifiant plan', 'Libellé plan', 'Identifiant position', 'Libellé position', 'Identifiant courrier', 'Sujet courrier'];
$csvHead = ['Identifiant plan', 'Libellé plan', 'Identifiant position', 'Libellé position', 'Identifiant courrier', 'Numéro chrono', 'Sujet courrier'];
fputcsv($file, $csvHead, ',');
foreach ($fileplans as $fileplan) {
$csvContent = [];
$positions = \SrcCore\models\DatabaseModel::select([
'select' => ['*'],
'select' => ['position_id', 'position_label'],
'table' => ['fp_fileplan_positions'],
'where' => ['fileplan_id = ?'],
'data' => [$fileplan['fileplan_id']]
......@@ -38,13 +38,13 @@ foreach ($customs as $custom) {
foreach ($positions as $position) {
$resources = \SrcCore\models\DatabaseModel::select([
'select' => ['res_letterbox.res_id', 'res_letterbox.subject'],
'table' => ['fp_res_fileplan_positions, res_letterbox'],
'where' => ['fp_res_fileplan_positions.res_id = res_letterbox.res_id', 'position_id = ?'],
'select' => ['r.res_id', 'r.subject', 'mlb.alt_identifier'],
'table' => ['fp_res_fileplan_positions p, res_letterbox r, mlb_coll_ext mlb'],
'where' => ['p.res_id = r.res_id', 'r.res_id = mlb.res_id', 'position_id = ?', 'r.status <> \'DEL\''],
'data' => [$position['position_id']]
]);
foreach ($resources as $resource) {
$csvContent = [$fileplan['fileplan_id'], $fileplan['fileplan_label'], $position['position_id'], $position['position_label'], $resource['res_id'], $resource['subject']];
$csvContent = [$fileplan['fileplan_id'], $fileplan['fileplan_label'], $position['position_id'], $position['position_label'], $resource['res_id'], $resource['alt_identifier'], $resource['subject']];
fputcsv($file, $csvContent, ',');
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment