12
12
from collective .dms .mailcontent .dmsmail import internalReferenceOutgoingMailDefaultValue
13
13
from collective .dms .mailcontent .dmsmail import mailDateDefaultValue
14
14
from collective .dms .mailcontent .dmsmail import receptionDateDefaultValue
15
+ from collective .iconifiedcategory .utils import calculate_category_id
15
16
from DateTime .DateTime import DateTime
16
17
from imio .dms .mail import _tr as _
17
18
from imio .dms .mail import BLDT_DIR
@@ -98,8 +99,10 @@ def add_test_annexes_types(context):
98
99
site = context .getSite ()
99
100
logger .info ("Adding annexes types" )
100
101
ccc = site ["annexes_types" ]
102
+
103
+ # Content Category Group for classification folders
101
104
if "annexes" not in ccc :
102
- category_group = api .content .create (
105
+ annexes_category_group = api .content .create (
103
106
type = "ContentCategoryGroup" ,
104
107
title = "Annexes" ,
105
108
container = ccc ,
@@ -108,10 +111,11 @@ def add_test_annexes_types(context):
108
111
# to_be_printed_activated=True,
109
112
# signed_activated=True,
110
113
# publishable_activated=True,
114
+ # approved_activated=True,
111
115
)
112
- do_transitions (category_group , ["show_internally" ])
116
+ do_transitions (annexes_category_group , ["show_internally" ])
113
117
else :
114
- category_group = ccc ["annexes" ]
118
+ annexes_category_group = ccc ["annexes" ]
115
119
icats = (
116
120
("annex" , u"Annexe" , u"attach.png" , True ),
117
121
("deliberation" , u"Délibération" , u"deliberation_signed.png" , True ),
@@ -129,7 +133,92 @@ def add_test_annexes_types(context):
129
133
type = "ContentCategory" ,
130
134
title = title ,
131
135
description = u"" ,
132
- container = category_group ,
136
+ container = annexes_category_group ,
137
+ icon = icon ,
138
+ id = oid ,
139
+ predefined_title = title ,
140
+ # confidential=True,
141
+ # to_print=True,
142
+ # to_sign=True,
143
+ # signed=True,
144
+ # publishable=True,
145
+ # only_pdf=True,
146
+ show_preview = show_pv ,
147
+ )
148
+
149
+ # Content Category Group for dms main files and dms appendix files
150
+ if "signable_files" not in ccc :
151
+ signable_files_category_group = api .content .create (
152
+ type = "ContentCategoryGroup" ,
153
+ title = "Fichiers signables" ,
154
+ container = ccc ,
155
+ id = "signable_files" ,
156
+ # confidentiality_activated=True,
157
+ to_be_printed_activated = True ,
158
+ signed_activated = True ,
159
+ # publishable_activated=True,
160
+ approved_activated = True ,
161
+ )
162
+ do_transitions (signable_files_category_group , ["show_internally" ])
163
+ else :
164
+ signable_files_category_group = ccc ["signable_files" ]
165
+ icats = (
166
+ ("signable-ged-file" , u"Fichier signable" , u"attach.png" , True ),
167
+ )
168
+ for oid , title , img , show_pv in icats :
169
+ if oid in ccc ["signable_files" ]:
170
+ continue
171
+ icon_path = os .path .join (context ._profile_path , "images" , img )
172
+ with open (icon_path , "rb" ) as fl :
173
+ icon = NamedBlobImage (fl .read (), filename = img )
174
+ api .content .create (
175
+ type = "ContentCategory" ,
176
+ title = title ,
177
+ description = u"" ,
178
+ container = signable_files_category_group ,
179
+ icon = icon ,
180
+ id = oid ,
181
+ predefined_title = title ,
182
+ # confidential=True,
183
+ # to_print=True,
184
+ # to_sign=True,
185
+ # signed=True,
186
+ # publishable=True,
187
+ # only_pdf=True,
188
+ # approved=False,
189
+ show_preview = show_pv ,
190
+ )
191
+
192
+ # Content Category Group for dms main files and dms appendix files
193
+ if "classic_files" not in ccc :
194
+ classic_files_category_group = api .content .create (
195
+ type = "ContentCategoryGroup" ,
196
+ title = "Fichiers classiques" ,
197
+ container = ccc ,
198
+ id = "classic_files" ,
199
+ # confidentiality_activated=True,
200
+ # to_be_printed_activated=True,
201
+ # signed_activated=True,
202
+ # publishable_activated=True,
203
+ # approved_activated=True,
204
+ )
205
+ do_transitions (classic_files_category_group , ["show_internally" ])
206
+ else :
207
+ classic_files_category_group = ccc ["classic_files" ]
208
+ icats = (
209
+ ("classic-ged-file" , u"Fichier classique" , u"attach.png" , True ),
210
+ )
211
+ for oid , title , img , show_pv in icats :
212
+ if oid in ccc ["classic_files" ]:
213
+ continue
214
+ icon_path = os .path .join (context ._profile_path , "images" , img )
215
+ with open (icon_path , "rb" ) as fl :
216
+ icon = NamedBlobImage (fl .read (), filename = img )
217
+ api .content .create (
218
+ type = "ContentCategory" ,
219
+ title = title ,
220
+ description = u"" ,
221
+ container = classic_files_category_group ,
133
222
icon = icon ,
134
223
id = oid ,
135
224
predefined_title = title ,
@@ -139,6 +228,7 @@ def add_test_annexes_types(context):
139
228
# signed=True,
140
229
# publishable=True,
141
230
# only_pdf=True,
231
+ # approved=False,
142
232
show_preview = show_pv ,
143
233
)
144
234
@@ -467,6 +557,7 @@ def add_test_mails(context):
467
557
file = file_object ,
468
558
scan_id = "0509999000000%02d" % i ,
469
559
scan_date = scan_date ,
560
+ content_category = calculate_category_id (api .portal .get ()["annexes_types" ]["signable_files" ]["signable-ged-file" ]),
470
561
)
471
562
472
563
# tasks
@@ -525,7 +616,14 @@ def add_test_mails(context):
525
616
filename = next (files_cycle )
526
617
with open (u"%s/%s" % (filespath , filename ), "rb" ) as fo :
527
618
file_object = NamedBlobFile (fo .read (), filename = filename )
528
- createContentInContainer (mail , "dmsommainfile" , id = "1" , title = "" , file = file_object )
619
+ createContentInContainer (
620
+ mail ,
621
+ "dmsommainfile" ,
622
+ id = "1" ,
623
+ title = "" ,
624
+ file = file_object ,
625
+ content_category = calculate_category_id (api .portal .get ()["annexes_types" ]["signable_files" ]["signable-ged-file" ]),
626
+ )
529
627
530
628
531
629
def add_test_plonegroup_services (context ):
@@ -946,7 +1044,7 @@ def configure_imio_dms_mail(context):
946
1044
u"transfer_email_pat" : u"" ,
947
1045
u"original_email_pat" : u"" ,
948
1046
u"tal_condition_1" : u"python: agent_id and 'encodeurs' in modules['imio.dms.mail.utils']."
949
- u"current_user_groups_ids(userid=agent_id)" ,
1047
+ u"current_user_groups_ids(userid=agent_id)" ,
950
1048
u"user_value" : u"_empty_" ,
951
1049
u"tal_condition_2" : u"" ,
952
1050
u"tg_value" : u"_empty_" ,
@@ -969,7 +1067,7 @@ def configure_imio_dms_mail(context):
969
1067
u"transfer_email_pat" : u"" ,
970
1068
u"original_email_pat" : u"" ,
971
1069
u"tal_condition_1" : u"" ,
972
- u"state_value" : u"proposed_to_agent"
1070
+ u"state_value" : u"proposed_to_agent" ,
973
1071
},
974
1072
]
975
1073
0 commit comments