X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=WEB-INF%2Flib%2FttOrgImportHelper.class.php;h=251cb3ea6a2a398ad160683dce94d7d5d80cba9d;hb=e5486346ac0574517a4fd118f03616ec455df9a9;hp=b33901b2e48ad7275d361268c181d3f93a54b4d0;hpb=d91fe5d8b53fe26e8b6c5bdadb27a5178652813d;p=timetracker.git diff --git a/WEB-INF/lib/ttOrgImportHelper.class.php b/WEB-INF/lib/ttOrgImportHelper.class.php index b33901b2..251cb3ea 100644 --- a/WEB-INF/lib/ttOrgImportHelper.class.php +++ b/WEB-INF/lib/ttOrgImportHelper.class.php @@ -31,6 +31,7 @@ class ttOrgImportHelper { var $errors = null; // Errors go here. Set in constructor by reference. var $schema_version = null; // Database schema version from XML file we import from. + var $num_users = 0; // A number of active and inactive users we are importing. var $conflicting_logins = null; // A comma-separated list of logins we cannot import. var $canImport = true; // False if we cannot import data due to a conflict such as login collision. var $firstPass = true; // True during first pass through the file. @@ -81,6 +82,7 @@ class ttOrgImportHelper { // In first pass we check user logins for potential collisions with existing. if ($name == 'USER' && $this->canImport) { $login = $attrs['LOGIN']; + if ('' != $attrs['STATUS']) $this->num_users++; if ('' != $attrs['STATUS'] && $this->loginExists($login)) { // We have a login collision. Append colliding login to a list of things we cannot import. $this->conflicting_logins .= ($this->conflicting_logins ? ", $login" : $login); @@ -569,6 +571,10 @@ class ttOrgImportHelper { $this->errors->add($i18n->get('error.user_exists')); $this->errors->add(sprintf($i18n->get('error.cannot_import'), $this->conflicting_logins)); } + if (!ttUserHelper::canAdd($this->num_users)) { + $this->canImport = false; + $this->errors->add($i18n->get('error.user_count')); + } $this->firstPass = false; // We are done with 1st pass. xml_parser_free($parser);