@@ -210,13 +210,13 @@ function _os2web_esdh_provider_import_meeting($meeting_id, $force = FALSE, &$con
210
210
$ node ->field_os2web_meetings_partic [LANGUAGE_NONE ][0 ]['value ' ] = implode (variable_get ('os2dagsorden_participants_delimeter ' , ', ' ), $ meeting ['participants ' ]);
211
211
$ node ->field_os2web_meetings_partic [LANGUAGE_NONE ][0 ]['format ' ] ='filtered_html ' ;
212
212
}
213
-
213
+
214
214
//Adding cancelled participants
215
215
if (isset ($ meeting ['participants_cancellation ' ])){
216
216
$ node ->field_os2web_meetings_particcanl [LANGUAGE_NONE ][0 ]['value ' ] = implode (variable_get ('os2dagsorden_participants_delimeter ' , ', ' ), $ meeting ['participants_cancellation ' ]);
217
217
$ node ->field_os2web_meetings_particcanl [LANGUAGE_NONE ][0 ]['format ' ] ='filtered_html ' ;
218
218
}
219
-
219
+
220
220
//Adding comments
221
221
if (isset ($ meeting ['description ' ])){
222
222
$ node ->field_os2web_meetings_comments [LANGUAGE_NONE ][0 ]['value ' ] = $ meeting ['comments ' ];
@@ -321,15 +321,15 @@ function _os2web_esdh_provider_import_items($items) {
321
321
$ node ->title = $ item ['title ' ];
322
322
// Set some default values.
323
323
node_object_prepare ($ node );
324
-
324
+
325
325
if (module_exists ('os2dagsorden_esdh_provider ' )){
326
326
$ node = os2dagsorden_esdh_provider_bullet_add_number ($ node , $ item ['id ' ]);
327
327
}
328
328
329
329
if ($ item ['access ' ] === 'Lukket ' ) {
330
330
$ node ->field_os2web_meetings_bul_closed [LANGUAGE_NONE ][]['value ' ] = 1 ;
331
331
if (module_exists ('os2dagsorden_esdh_provider ' )){
332
- $ node = os2dagsorden_esdh_provider_process_closed_bullet ($ node , $ item );
332
+ $ node = os2dagsorden_esdh_provider_process_closed_bullet ($ node , $ item );
333
333
}
334
334
node_submit ($ node );
335
335
node_save ($ node );
@@ -438,7 +438,16 @@ function _os2web_esdh_provider_import_file($file_meta) {
438
438
}
439
439
440
440
$ uri_out = $ pinfo ['dirname ' ] . '/ ' . _os2web_esdh_provider_sanetize_filename ($ fname . '. ' . strtolower ($ pinfo ['extension ' ]));
441
- $ uri_pdf = $ pinfo ['dirname ' ] . '/ ' . _os2web_esdh_provider_sanetize_filename ($ fname . '.pdf ' );
441
+
442
+ if (_os2web_esdh_provider_similar_file_exists (drupal_realpath ($ uri_out ))) {
443
+ $ file_counter = 0 ;
444
+ do {
445
+ $ uri_out = $ pinfo ['dirname ' ] . '/ ' . _os2web_esdh_provider_sanetize_filename ($ fname . '_ ' . $ file_counter ++ . '. ' . strtolower ($ pinfo ['extension ' ]));
446
+ } while (_os2web_esdh_provider_similar_file_exists (drupal_realpath ($ uri_out )));
447
+ }
448
+
449
+ $ new_pinfo = pathinfo ($ uri_out );
450
+ $ uri_pdf = $ pinfo ['dirname ' ] . '/ ' . $ new_pinfo ['filename ' ] . '.pdf ' ;
442
451
443
452
err_debug ('Start import file ' . $ uri_out . ' ' );
444
453
@@ -501,7 +510,7 @@ function _os2web_esdh_provider_import_file($file_meta) {
501
510
$ file ->uid = 1 ;
502
511
$ file ->status = FILE_STATUS_PERMANENT ;
503
512
$ file = file_save ($ file );
504
-
513
+
505
514
if (module_exists ('os2web_pdf_conversion_manager ' ))
506
515
_os2web_pdf_conversion_manager_copy_file_to_convertion_dir ($ file ->fid );
507
516
0 commit comments