diff --git a/application/Espo/Controllers/Import.php b/application/Espo/Controllers/Import.php index 2297c04bc5..1c2fe76c26 100644 --- a/application/Espo/Controllers/Import.php +++ b/application/Espo/Controllers/Import.php @@ -43,12 +43,12 @@ class Import extends \Espo\Core\Controllers\Record } } - public function actionPatch($params, $data) + public function actionPatch($params, $data, $request) { throw new BadRequest(); } - public function actionUpdate($params, $data) + public function actionUpdate($params, $data, $request) { throw new BadRequest(); } @@ -58,12 +58,12 @@ class Import extends \Espo\Core\Controllers\Record throw new BadRequest(); } - public function actionCreateLink($params, $data) + public function actionCreateLink($params, $data, $request) { throw new BadRequest(); } - public function actionRemoveLink($params, $data) + public function actionRemoveLink($params, $data, $request) { throw new BadRequest(); } diff --git a/application/Espo/Repositories/Import.php b/application/Espo/Repositories/Import.php index f9ce51114d..27adf2ff79 100644 --- a/application/Espo/Repositories/Import.php +++ b/application/Espo/Repositories/Import.php @@ -33,13 +33,16 @@ use Espo\ORM\Entity; class Import extends \Espo\Core\ORM\Repositories\RDB { - public function findRelated(Entity $entity, $link, $selectParams = array()) + public function findRelated(Entity $entity, $relationName, array $params = array()) { $entityType = $entity->get('entityType'); - $selectParams['customJoin'] .= $this->getRelatedJoin($entity, $link); + if (empty($params['customJoin'])) { + $params['customJoin'] = ''; + } + $params['customJoin'] .= $this->getRelatedJoin($entity, $relationName); - return $this->getEntityManager()->getRepository($entityType)->find($selectParams); + return $this->getEntityManager()->getRepository($entityType)->find($params); } protected function getRelatedJoin(Entity $entity, $link) @@ -73,13 +76,16 @@ class Import extends \Espo\Core\ORM\Repositories\RDB return $sql; } - public function countRelated(Entity $entity, $link, $selectParams = array()) + public function countRelated(Entity $entity, $relationName, array $params = array()) { $entityType = $entity->get('entityType'); - $selectParams['customJoin'] .= $this->getRelatedJoin($entity, $link); + if (empty($params['customJoin'])) { + $params['customJoin'] = ''; + } + $params['customJoin'] .= $this->getRelatedJoin($entity, $relationName); - return $this->getEntityManager()->getRepository($entityType)->count($selectParams); + return $this->getEntityManager()->getRepository($entityType)->count($params); } protected function afterRemove(Entity $entity, array $options = array()) diff --git a/application/Espo/Services/Import.php b/application/Espo/Services/Import.php index 55b556401b..94b1229a66 100644 --- a/application/Espo/Services/Import.php +++ b/application/Espo/Services/Import.php @@ -186,12 +186,14 @@ class Import extends \Espo\Services\Record } } else { + if (!array_key_exists($num, $o)) { + $o[$num] = ''; + } if ($escesc) { - $o[$num].= $CSV_ENCLOSURE; + $o[$num] .= $CSV_ENCLOSURE; $escesc = false; } - - $o[$num].= $s; + $o[$num] .= $s; } $i++; @@ -406,7 +408,7 @@ class Import extends \Espo\Services\Record if (!empty($fieldsDefs['phoneNumber']) && !empty($fieldsDefs['phoneNumber']['type']) && $fieldsDefs['phoneNumber']['type'] == 'phone') { $typeList = $this->getMetadata()->get('entityDefs.' . $scope . '.fields.phoneNumber.typeList', []); foreach ($typeList as $type) { - $attr = $field . str_replace(' ', '_', ucfirst($type)); + $attr = str_replace(' ', '_', ucfirst($type)); $phoneFieldList[] = 'phoneNumber' . $attr; } }