Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
MaarchCourrier
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
18
Issues
18
List
Board
Labels
Milestones
Redmine
Redmine
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Maarch Labs
MaarchCourrier
Commits
a4cd13d8
Verified
Commit
a4cd13d8
authored
Aug 29, 2019
by
Damien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FEAT #11422 TIME 0:30 Export fileplans
parent
6ee53316
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
1 deletion
+63
-1
exportCases.php
migration/19.12/exportCases.php
+1
-1
exportFileplans.php
migration/19.12/exportFileplans.php
+61
-0
migrate.sh
migration/19.12/migrate.sh
+1
-0
No files found.
migration/19.12/exportCases.php
View file @
a4cd13d8
...
...
@@ -43,5 +43,5 @@ foreach ($customs as $custom) {
fclose
(
$file
);
}
printf
(
"Export Affaires (CUSTOM
{
$custom
}
) : "
.
$migrated
.
" Affaire
s
exportée(s) dans le fichier cases_
{
$custom
}
.csv
\n
"
);
printf
(
"Export Affaires (CUSTOM
{
$custom
}
) : "
.
$migrated
.
" Affaire
(s)
exportée(s) dans le fichier cases_
{
$custom
}
.csv
\n
"
);
}
migration/19.12/exportFileplans.php
0 → 100644
View file @
a4cd13d8
<?php
require
'../../vendor/autoload.php'
;
chdir
(
'../..'
);
$customs
=
scandir
(
'custom'
);
foreach
(
$customs
as
$custom
)
{
if
(
$custom
==
'custom.xml'
||
$custom
==
'.'
||
$custom
==
'..'
)
{
continue
;
}
$migrated
=
0
;
\SrcCore\models\DatabasePDO
::
reset
();
new
\SrcCore\models\DatabasePDO
([
'customId'
=>
$custom
]);
$fileplans
=
\SrcCore\models\DatabaseModel
::
select
([
'select'
=>
[
'*'
],
'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'
];
fputcsv
(
$file
,
$csvHead
,
','
);
foreach
(
$fileplans
as
$fileplan
)
{
$csvContent
=
[];
$positions
=
\SrcCore\models\DatabaseModel
::
select
([
'select'
=>
[
'*'
],
'table'
=>
[
'fp_fileplan_positions'
],
'where'
=>
[
'fileplan_id = ?'
],
'data'
=>
[
$fileplan
[
'fileplan_id'
]]
]);
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 = ?'
],
'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'
]];
fputcsv
(
$file
,
$csvContent
,
','
);
}
}
if
(
!
empty
(
$csvContent
))
{
++
$migrated
;
}
}
fclose
(
$file
);
}
printf
(
"Export Plans de Classements (CUSTOM
{
$custom
}
) : "
.
$migrated
.
" Plan(s) de classement public exportée(s) dans le fichier fileplans_
{
$custom
}
.csv
\n
"
);
}
migration/19.12/migrate.sh
View file @
a4cd13d8
...
...
@@ -7,3 +7,4 @@ php ./migrateIndexing.php
php ./migrateServicesEntities.php
php ./migrateMenuEntities.php
php ./exportCases.php
php ./exportFileplans.php
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment