@@ -158,6 +158,8 @@ public function run($args = [])
158158 self ::$ stats = new stdClass ();
159159 self ::$ stats ->names = [];
160160 self ::$ stats ->skipped_names = [];
161+ self ::$ stats ->invalid_names = [];
162+ self ::$ stats ->error_names = [];
161163 self ::$ stats ->count = count ($ vcards );
162164 self ::$ stats ->inserted = 0 ;
163165 self ::$ stats ->skipped = 0 ;
@@ -187,6 +189,7 @@ public function run($args = [])
187189 // skip invalid (incomplete) entries
188190 if (!$ CONTACTS ->validate ($ a_record , true )) {
189191 self ::$ stats ->invalid ++;
192+ self ::$ stats ->invalid_names [] = rcube_addressbook::compose_display_name ($ a_record , true );
190193 continue ;
191194 }
192195
@@ -251,6 +254,7 @@ public function run($args = [])
251254 self ::$ stats ->names [] = $ a_record ['name ' ] ?: $ email ;
252255 } else {
253256 self ::$ stats ->errors ++;
257+ self ::$ stats ->error_names [] = $ a_record ['name ' ] ?: $ email ;
254258 }
255259 }
256260
@@ -430,13 +434,10 @@ public static function import_map($attrib)
430434 public static function import_confirm ($ attrib )
431435 {
432436 $ rcmail = rcmail::get_instance ();
433- $ vars = get_object_vars (self ::$ stats );
434- $ vars ['names ' ] = $ vars ['skipped_names ' ] = '' ;
435437
436438 $ content = html::p (null , $ rcmail ->gettext ([
437439 'name ' => 'importconfirm ' ,
438- 'nr ' => self ::$ stats ->inserted ,
439- 'vars ' => $ vars ,
440+ 'vars ' => ['inserted ' => self ::$ stats ->inserted ],
440441 ]) . (self ::$ stats ->names ? ': ' : '. ' )
441442 );
442443
@@ -447,12 +448,27 @@ public static function import_confirm($attrib)
447448 if (self ::$ stats ->skipped ) {
448449 $ content .= html::p (null , $ rcmail ->gettext ([
449450 'name ' => 'importconfirmskipped ' ,
450- 'nr ' => self ::$ stats ->skipped ,
451- 'vars ' => $ vars ,
451+ 'vars ' => ['skipped ' => self ::$ stats ->skipped ],
452452 ]) . ': ' )
453453 . html::p ('em ' , implode (', ' , array_map (['rcube ' , 'Q ' ], self ::$ stats ->skipped_names )));
454454 }
455455
456+ if (self ::$ stats ->invalid ) {
457+ $ content .= html::p (null , $ rcmail ->gettext ([
458+ 'name ' => 'importconfirminvalid ' ,
459+ 'vars ' => ['invalid ' => self ::$ stats ->invalid ],
460+ ]) . ': ' )
461+ . html::p ('em ' , implode (', ' , array_map (['rcube ' , 'Q ' ], self ::$ stats ->invalid_names )));
462+ }
463+
464+ if (self ::$ stats ->errors ) {
465+ $ content .= html::p (null , $ rcmail ->gettext ([
466+ 'name ' => 'importconfirmerrors ' ,
467+ 'vars ' => ['errors ' => self ::$ stats ->errors ],
468+ ]) . ': ' )
469+ . html::p ('em ' , implode (', ' , array_map (['rcube ' , 'Q ' ], self ::$ stats ->error_names )));
470+ }
471+
456472 return html::div ($ attrib , $ content );
457473 }
458474
0 commit comments