| Línea 947... |
Línea 947... |
| 947 |
if (!$companyMapper->update($company)) {
|
947 |
if (!$companyMapper->update($company)) {
|
| 948 |
return $this->_createSimpleErrorResponse('ERROR_THERE_WAS_AN_ERROR');
|
948 |
return $this->_createSimpleErrorResponse('ERROR_THERE_WAS_AN_ERROR');
|
| 949 |
}
|
949 |
}
|
| Línea 950... |
Línea 950... |
| 950 |
|
950 |
|
| 951 |
// Actualizar la imagen del propietario si es necesario
|
951 |
// Actualizar la imagen del propietario si es necesario
|
| 952 |
/* $companyUserMapper = CompanyUserMapper::getInstance($this->adapter);
|
952 |
$companyUserMapper = CompanyUserMapper::getInstance($this->adapter);
|
| Línea 953... |
Línea 953... |
| 953 |
$companyUser = $companyUserMapper->fetchOwnerByCompanyId($company->id);
|
953 |
$companyUser = $companyUserMapper->fetchOwnerByCompanyId($company->id);
|
| 954 |
|
954 |
|
| 955 |
if ($companyUser) {
|
955 |
if ($companyUser) {
|
| Línea 956... |
Línea 956... |
| 956 |
$userMapper = UserMapper::getInstance($this->adapter);
|
956 |
$userMapper = UserMapper::getInstance($this->adapter);
|
| 957 |
$user = $userMapper->fetchOne($companyUser->user_id);
|
- |
|
| 958 |
|
- |
|
| 959 |
if ($user) {
|
- |
|
| 960 |
if (!$storage->setCurrentFilename('image')) {
|
- |
|
| 961 |
return new JsonModel([
|
- |
|
| 962 |
'success' => false,
|
- |
|
| 963 |
'data' => 'ERROR_UPLOAD_FILE' . ' ' . $storage->getCurrentFilename()
|
- |
|
| 964 |
]);
|
957 |
$user = $userMapper->fetchOne($companyUser->user_id);
|
| 965 |
}
|
- |
|
| 966 |
|
958 |
|
| 967 |
// Copiar la imagen del perfil para la imagen principal
|
959 |
if ($user) {
|
| Línea 968... |
Línea 960... |
| 968 |
$user_source = $storage->getTmpFilename();
|
960 |
// Copiar la imagen del perfil para la imagen principal
|
| 969 |
$user_filename = 'user-' . uniqid() . '.png';
|
961 |
$user_filename = 'user-' . uniqid() . '.png';
|
| 970 |
$target_filename_user = $storage->composePathToFilename(Storage::TYPE_USER, $user->uuid, $user_filename);
|
962 |
$target_filename_user = $storage->composePathToFilename(Storage::TYPE_USER, $user->uuid, $user_filename);
|
| 971 |
|
963 |
|
| Línea 972... |
Línea 964... |
| 972 |
// Copiar la imagen del perfil para la imagen principal
|
964 |
// Copiar la imagen del perfil para la imagen principal
|
| 973 |
if (!$storage->uploadImageResize($user_source, $target_filename_user, $target_width, $target_height)) {
|
965 |
if (!$storage->copyFile($source, $target_filename_user)) {
|
| Línea 983... |
Línea 975... |
| 983 |
$user->image = $user_filename;
|
975 |
$user->image = $user_filename;
|
| 984 |
if (!$userMapper->update($user)) {
|
976 |
if (!$userMapper->update($user)) {
|
| 985 |
return $this->_createSimpleErrorResponse('ERROR_THERE_WAS_AN_ERROR');
|
977 |
return $this->_createSimpleErrorResponse('ERROR_THERE_WAS_AN_ERROR');
|
| 986 |
}
|
978 |
}
|
| 987 |
}
|
979 |
}
|
| 988 |
} */
|
980 |
}
|
| Línea 989... |
Línea 981... |
| 989 |
|
981 |
|
| 990 |
// Registrar la actualización de la imagen
|
982 |
// Registrar la actualización de la imagen
|
| Línea 991... |
Línea 983... |
| 991 |
$this->logger->info('Se actualizo la imagen de la empresa: ' . $company->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|
983 |
$this->logger->info('Se actualizo la imagen de la empresa: ' . $company->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|