diff --git a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php
index 8c0b6ea65e..29b4a9fa11 100644
--- a/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php
+++ b/lib/Alchemy/Phrasea/Command/Developer/JsFixtures.php
@@ -37,14 +37,10 @@ class JsFixtures extends Command
copy($dbRefPath, '/tmp/db.sqlite');
- try {
- $sbasId = current($this->container['phraseanet.appbox']->get_databoxes())->get_sbas_id();
- $this->writeResponse($output, 'GET', '/login/', '/home/login/index.html');
- $this->writeResponse($output, 'GET', '/admin/fields/'.$sbasId , '/admin/fields/index.html', true);
- $this->writeResponse($output, 'GET', '/admin/task-manager/tasks', '/admin/task-manager/index.html', true);
- } catch (\Exception $e) {
- throw $e;
- }
+ $sbasId = current($this->container['phraseanet.appbox']->get_databoxes())->get_sbas_id();
+ $this->writeResponse($output, 'GET', '/login/', '/home/login/index.html');
+ $this->writeResponse($output, 'GET', '/admin/fields/'.$sbasId , '/admin/fields/index.html', true);
+ $this->writeResponse($output, 'GET', '/admin/task-manager/tasks', '/admin/task-manager/index.html', true);
$this->copy($output, [
['source' => 'login/common/templates.html.twig', 'target' => 'home/login/templates.html'],
diff --git a/lib/Alchemy/Phrasea/Command/Developer/RegenerateSqliteDb.php b/lib/Alchemy/Phrasea/Command/Developer/RegenerateSqliteDb.php
index 0d6d1859a9..9b2e74bfcb 100644
--- a/lib/Alchemy/Phrasea/Command/Developer/RegenerateSqliteDb.php
+++ b/lib/Alchemy/Phrasea/Command/Developer/RegenerateSqliteDb.php
@@ -186,6 +186,7 @@ class RegenerateSqliteDb extends Command
private function insertLazaretFiles(EntityManager $em, \Pimple $DI)
{
$session = new LazaretSession();
+ $session->setUser($DI['user']);
$em->persist($session);
$em->flush();
diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Collection.php b/lib/Alchemy/Phrasea/Controller/Admin/Collection.php
index 64ea4d20dc..f6a3dc3792 100644
--- a/lib/Alchemy/Phrasea/Controller/Admin/Collection.php
+++ b/lib/Alchemy/Phrasea/Controller/Admin/Collection.php
@@ -11,6 +11,7 @@
namespace Alchemy\Phrasea\Controller\Admin;
+use Alchemy\Phrasea\Exception\RuntimeException;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
@@ -176,41 +177,45 @@ class Collection implements ControllerProviderInterface
public function setOrderAdmins(Application $app, Request $request, $bas_id)
{
$success = false;
+ $admins = array_values($request->request->get('admins', []));
- if (count($admins = $request->request->get('admins', [])) > 0) {
- $newAdmins = [];
+ if (count($admins) === 0) {
+ $app->abort(400, 'No admins provided.');
+ }
+ if (!is_array($admins)) {
+ $app->abort(400, 'Admins must be an array.');
+ }
+
+ $admins = array_map(function ($usrId) use ($app) {
+ if (null === $user = $app['manipulator.user']->getRepository()->find($usrId)) {
+ throw new RuntimeException(sprintf('Invalid usrId %s provided.', $usrId));
+ }
+
+ return $user;
+ }, $admins);
+
+ $conn = $app['phraseanet.appbox']->get_connection();
+ $conn->beginTransaction();
+
+ try {
+ $userQuery = new \User_Query($app);
+
+ $result = $userQuery->on_base_ids([$bas_id])
+ ->who_have_right(['order_master'])
+ ->execute()->get_results();
+
+ foreach ($result as $user) {
+ $app['acl']->get($user)->update_rights_to_base($bas_id, ['order_master' => false]);
+ }
foreach ($admins as $admin) {
- $newAdmins[] = $admin;
- }
-
- if (count($newAdmins) > 0) {
- $conn = $app['phraseanet.appbox']->get_connection();
- $conn->beginTransaction();
-
- try {
- $userQuery = new \User_Query($app);
-
- $result = $userQuery->on_base_ids([$bas_id])
- ->who_have_right(['order_master'])
- ->execute()->get_results();
-
- foreach ($result as $user) {
- $app['acl']->get($user)->update_rights_to_base($bas_id, ['order_master' => false]);
- }
-
- foreach (array_filter($newAdmins) as $admin) {
- if (null !== $user = $app['manipulator.user']->getRepository()->find($admin)) {
- $app['acl']->get($user)->update_rights_to_base($bas_id, ['order_master' => true]);
- }
- }
- $conn->commit();
-
- $success = true;
- } catch (\Exception $e) {
- $conn->rollBack();
- }
+ $app['acl']->get($admin)->update_rights_to_base($bas_id, ['order_master' => true]);
}
+ $conn->commit();
+ $success = true;
+ } catch (\Exception $e) {
+ $conn->rollBack();
+ throw $e;
}
return $app->redirectPath('admin_display_collection', [
diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php b/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php
index 66c027cb9b..b3d4c5060b 100644
--- a/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php
+++ b/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php
@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Controller\Admin;
use Alchemy\Phrasea\Notification\Receiver;
use Alchemy\Phrasea\Notification\Mail\MailTest;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
+use Alchemy\Phrasea\Exception\RuntimeException;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -146,18 +147,24 @@ class Dashboard implements ControllerProviderInterface
*/
public function addAdmins(Application $app, Request $request)
{
- if (count($admins = $request->request->get('admins', [])) > 0) {
- if (!in_array($app['authentication']->getUser()->getId(), $admins)) {
- $admins[] = $app['authentication']->getUser()->getId();
+ $admins = $request->request->get('admins', []);
+ if (count($admins) === 0 || !is_array($admins)) {
+ $app->abort(400, '"admins" parameter must contains at least one value.');
+ }
+ if (!in_array($app['authentication']->getUser()->getId(), $admins)) {
+ $admins[] = $app['authentication']->getUser()->getId();
+ }
+
+ $admins = array_map(function ($usrId) use ($app) {
+ if (null === $user = $app['manipulator.user']->getRepository()->find($usrId)) {
+ throw new RuntimeException(sprintf('Invalid usrId %s provided.', $usrId));
}
- if ($admins > 0) {
- $app['manipulator.user']->promote(array_filter(array_map(function ($id) use ($app) {
- return $app['manipulator.user']->getRepository()->find($id);
- }, $admins)));
- $app['manipulator.acl']->resetAdminRights($app['manipulator.user']->getRepository()->findAdmins());
- }
- }
+ return $user;
+ }, $admins);
+
+ $app['manipulator.user']->promote($admins);
+ $app['manipulator.acl']->resetAdminRights($admins);
return $app->redirectPath('admin_dashbord');
}
diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Users.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php
index fe18a25c5e..51f6359efa 100644
--- a/lib/Alchemy/Phrasea/Controller/Admin/Users.php
+++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php
@@ -243,7 +243,7 @@ class Users implements ControllerProviderInterface
$datas[] = [
'email' => $user->getEmail() ? : '',
'login' => $user->getLogin() ? : '',
- 'name' => $user->getDisplayName($app['translator']) ? : '',
+ 'name' => $user->getDisplayName(),
'id' => $user->getId(),
];
}
@@ -366,7 +366,7 @@ class Users implements ControllerProviderInterface
$currentUsr = null;
$table = ['users' => [], 'coll' => []];
- foreach ($app['phraseanet.native-query']->getUsersRegistrationDemand($basList) as $row) {
+ foreach ($app['EM.native-query']->getUsersRegistrationDemand($basList) as $row) {
$user = $row[0];
if ($user->getId() !== $currentUsr) {
@@ -693,7 +693,7 @@ class Users implements ControllerProviderInterface
}
$basList = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['manage']));
- $models = $app['phraseanet.native-query']->getModelForUser($app['authentication']->getUser(), $basList);
+ $models = $app['EM.native-query']->getModelForUser($app['authentication']->getUser(), $basList);
return $app['twig']->render('/admin/user/import/view.html.twig', [
'nb_user_to_add' => $nbUsrToAdd,
diff --git a/lib/Alchemy/Phrasea/Controller/Client/Baskets.php b/lib/Alchemy/Phrasea/Controller/Client/Baskets.php
index 908efcb89d..9e80571d1d 100644
--- a/lib/Alchemy/Phrasea/Controller/Client/Baskets.php
+++ b/lib/Alchemy/Phrasea/Controller/Client/Baskets.php
@@ -180,7 +180,7 @@ class Baskets implements ControllerProviderInterface
}
$basketCollections = $baskets->partition(function ($key, $basket) {
- return (Boolean) $basket->getPusherId();
+ return null !== $basket->getPusher();
});
return $app['twig']->render('client/baskets.html.twig', [
diff --git a/lib/Alchemy/Phrasea/Controller/Lightbox.php b/lib/Alchemy/Phrasea/Controller/Lightbox.php
index d7c89695b8..e198cda1ce 100644
--- a/lib/Alchemy/Phrasea/Controller/Lightbox.php
+++ b/lib/Alchemy/Phrasea/Controller/Lightbox.php
@@ -221,9 +221,9 @@ class Lightbox implements ControllerProviderInterface
$app['EM']->flush();
}
- if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['authentication']->getUser(), $app)->getIsAware() === false) {
+ if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['authentication']->getUser())->getIsAware() === false) {
$basket = $app['EM']->merge($basket);
- $basket->getValidation()->getParticipant($app['authentication']->getUser(), $app)->setIsAware(true);
+ $basket->getValidation()->getParticipant($app['authentication']->getUser())->setIsAware(true);
$app['EM']->flush();
}
@@ -268,9 +268,9 @@ class Lightbox implements ControllerProviderInterface
$app['EM']->flush();
}
- if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['authentication']->getUser(), $app)->getIsAware() === false) {
+ if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['authentication']->getUser())->getIsAware() === false) {
$basket = $app['EM']->merge($basket);
- $basket->getValidation()->getParticipant($app['authentication']->getUser(), $app)->setIsAware(true);
+ $basket->getValidation()->getParticipant($app['authentication']->getUser())->setIsAware(true);
$app['EM']->flush();
}
@@ -350,7 +350,7 @@ class Lightbox implements ControllerProviderInterface
$basket_element = $repository->findUserElement($sselcont_id, $app['authentication']->getUser());
- $validationDatas = $basket_element->getUserValidationDatas($app['authentication']->getUser(), $app);
+ $validationDatas = $basket_element->getUserValidationDatas($app['authentication']->getUser());
$validationDatas->setNote($note);
@@ -400,11 +400,11 @@ class Lightbox implements ControllerProviderInterface
, $app['authentication']->getUser()
);
/* @var $basket_element BasketElement */
- $validationDatas = $basket_element->getUserValidationDatas($app['authentication']->getUser(), $app);
+ $validationDatas = $basket_element->getUserValidationDatas($app['authentication']->getUser());
if (!$basket_element->getBasket()
->getValidation()
- ->getParticipant($app['authentication']->getUser(), $app)->getCanAgree()) {
+ ->getParticipant($app['authentication']->getUser())->getCanAgree()) {
throw new ControllerException('You can not agree on this');
}
@@ -412,7 +412,7 @@ class Lightbox implements ControllerProviderInterface
$participant = $basket_element->getBasket()
->getValidation()
- ->getParticipant($app['authentication']->getUser(), $app);
+ ->getParticipant($app['authentication']->getUser());
$app['EM']->merge($basket_element);
@@ -446,14 +446,14 @@ class Lightbox implements ControllerProviderInterface
throw new ControllerException('There is no validation session attached to this basket');
}
- if (!$basket->getValidation()->getParticipant($app['authentication']->getUser(), $app)->getCanAgree()) {
+ if (!$basket->getValidation()->getParticipant($app['authentication']->getUser())->getCanAgree()) {
throw new ControllerException('You have not right to agree');
}
$agreed = false;
/* @var $basket Basket */
foreach ($basket->getElements() as $element) {
- if (null !== $element->getUserValidationDatas($app['authentication']->getUser(), $app)->getAgreement()) {
+ if (null !== $element->getUserValidationDatas($app['authentication']->getUser())->getAgreement()) {
$agreed = true;
}
}
@@ -463,7 +463,7 @@ class Lightbox implements ControllerProviderInterface
}
/* @var $basket Basket */
- $participant = $basket->getValidation()->getParticipant($app['authentication']->getUser(), $app);
+ $participant = $basket->getValidation()->getParticipant($app['authentication']->getUser());
$expires = new \DateTime('+10 days');
$url = $app->url('lightbox', ['LOG' => $app['tokens']->getUrlToken(
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/BasketController.php b/lib/Alchemy/Phrasea/Controller/Prod/BasketController.php
index fa8165a603..b85ce05f0a 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/BasketController.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/BasketController.php
@@ -99,8 +99,8 @@ class BasketController implements ControllerProviderInterface
}
if ($basket->getValidation()) {
- if ($basket->getValidation()->getParticipant($app['authentication']->getUser(), $app)->getIsAware() === false) {
- $basket->getValidation()->getParticipant($app['authentication']->getUser(), $app)->setIsAware(true);
+ if ($basket->getValidation()->getParticipant($app['authentication']->getUser())->getIsAware() === false) {
+ $basket->getValidation()->getParticipant($app['authentication']->getUser())->setIsAware(true);
$app['EM']->flush();
}
}
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Export.php b/lib/Alchemy/Phrasea/Controller/Prod/Export.php
index 91b93f2618..51d617b63c 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Export.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Export.php
@@ -232,7 +232,7 @@ class Export implements ControllerProviderInterface
$url = $app->url('prepare_download', ['token' => $token, 'anonymous']);
- $emitter = new Emitter($app['authentication']->getUser()->getDisplayName($app['translator']), $app['authentication']->getUser()->getEmail());
+ $emitter = new Emitter($app['authentication']->getUser()->getDisplayName(), $app['authentication']->getUser()->getEmail());
foreach ($destMails as $key => $mail) {
try {
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Order.php b/lib/Alchemy/Phrasea/Controller/Prod/Order.php
index add39c8cae..f7c53fe43c 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Order.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Order.php
@@ -263,7 +263,7 @@ class Order implements ControllerProviderInterface
$basketElement->setRecord($record);
$basketElement->setBasket($basket);
- $orderElement->setOrderMasterId($app['authentication']->getUser()->getId());
+ $orderElement->setOrderMaster($app['authentication']->getUser());
$orderElement->setDeny(false);
$orderElement->getOrder()->setBasket($basket);
@@ -329,7 +329,7 @@ class Order implements ControllerProviderInterface
$elements = $request->request->get('elements', []);
foreach ($order->getElements() as $orderElement) {
if (in_array($orderElement->getId(),$elements)) {
- $orderElement->setOrderMasterId($app['authentication']->getUser()->getId());
+ $orderElement->setOrderMaster($app['authentication']->getUser());
$orderElement->setDeny(true);
$app['EM']->persist($orderElement);
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php
index e26b51ddc6..c249d73bef 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Push.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php
@@ -40,7 +40,7 @@ class Push implements ControllerProviderInterface
'firstname' => $user->getFirstName(),
'lastname' => $user->getLastName(),
'email' => $user->getEmail(),
- 'display_name' => $user->getDisplayName($app['translator']),
+ 'display_name' => $user->getDisplayName(),
'subtitle' => implode(', ', $subtitle),
];
};
@@ -162,7 +162,7 @@ class Push implements ControllerProviderInterface
try {
$pusher = new RecordHelper\Push($app, $app['request']);
- $push_name = $request->request->get('name', $app->trans('Push from %user%', ['%user%' => $app['authentication']->getUser()->getDisplayName($app['translator'])]));
+ $push_name = $request->request->get('name', $app->trans('Push from %user%', ['%user%' => $app['authentication']->getUser()->getDisplayName()]));
$push_description = $request->request->get('push_description');
$receivers = $request->request->get('participants');
@@ -234,7 +234,7 @@ class Push implements ControllerProviderInterface
'from_email' => $app['authentication']->getUser()->getEmail(),
'to' => $user_receiver->getId(),
'to_email' => $user_receiver->getEmail(),
- 'to_name' => $user_receiver->getDisplayName($app['translator']),
+ 'to_name' => $user_receiver->getDisplayName(),
'url' => $url,
'accuse' => $receipt,
'message' => $request->request->get('message'),
@@ -278,7 +278,7 @@ class Push implements ControllerProviderInterface
try {
$pusher = new RecordHelper\Push($app, $app['request']);
- $validation_name = $request->request->get('name', $app->trans('Validation from %user%', ['%user%' => $app['authentication']->getUser()->getDisplayName($app['translator'])]));
+ $validation_name = $request->request->get('name', $app->trans('Validation from %user%', ['%user%' => $app['authentication']->getUser()->getDisplayName()]));
$validation_description = $request->request->get('validation_description');
$participants = $request->request->get('participants');
@@ -364,7 +364,7 @@ class Push implements ControllerProviderInterface
}
try {
- $Participant = $Validation->getParticipant($participant_user, $app);
+ $Participant = $Validation->getParticipant($participant_user);
continue;
} catch (NotFoundHttpException $e) {
@@ -429,7 +429,7 @@ class Push implements ControllerProviderInterface
'from_email' => $app['authentication']->getUser()->getEmail(),
'to' => $participant_user->getId(),
'to_email' => $participant_user->getEmail(),
- 'to_name' => $participant_user->getDisplayName($app['translator']),
+ 'to_name' => $participant_user->getDisplayName(),
'url' => $url,
'accuse' => $receipt,
'message' => $request->request->get('message'),
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php
index 88f21659ea..78e32df93a 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php
@@ -92,7 +92,7 @@ class UsrLists implements ControllerProviderInterface
foreach ($list->getOwners() as $owner) {
$owners[] = [
'usr_id' => $owner->getUser()->getId(),
- 'display_name' => $owner->getUser()->getDisplayName($app['translator']),
+ 'display_name' => $owner->getUser()->getDisplayName(),
'position' => $owner->getUser()->getActivity(),
'job' => $owner->getUser()->getJob(),
'company' => $owner->getUser()->getCompany(),
@@ -104,7 +104,7 @@ class UsrLists implements ControllerProviderInterface
foreach ($list->getEntries() as $entry) {
$entries[] = [
'usr_id' => $entry->getUser()->getId(),
- 'display_name' => $entry->getUser()->getDisplayName($app['translator']),
+ 'display_name' => $entry->getUser()->getDisplayName(),
'position' => $entry->getUser()->getActivity(),
'job' => $entry->getUser()->getJob(),
'company' => $entry->getUser()->getCompany(),
@@ -203,7 +203,7 @@ class UsrLists implements ControllerProviderInterface
foreach ($list->getOwners() as $owner) {
$owners[] = [
'usr_id' => $owner->getUser()->getId(),
- 'display_name' => $owner->getUser()->getDisplayName($app['translator']),
+ 'display_name' => $owner->getUser()->getDisplayName(),
'position' => $owner->getUser()->getActivity(),
'job' => $owner->getUser()->getJob(),
'company' => $owner->getUser()->getCompany(),
@@ -215,7 +215,7 @@ class UsrLists implements ControllerProviderInterface
foreach ($list->getEntries() as $entry) {
$entries[] = [
'usr_id' => $entry->getUser()->getId(),
- 'display_name' => $entry->getUser()->getDisplayName($app['translator']),
+ 'display_name' => $entry->getUser()->getDisplayName(),
'position' => $entry->getUser()->getActivity(),
'job' => $entry->getUser()->getJob(),
'company' => $entry->getUser()->getCompany(),
@@ -372,7 +372,7 @@ class UsrLists implements ControllerProviderInterface
foreach ($request->request->get('usr_ids') as $usr_id) {
$user_entry = $app['manipulator.user']->getRepository()->find($usr_id);
- if ($list->has($user_entry, $app))
+ if ($list->has($user_entry))
continue;
$entry = new UsrListEntry();
diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php
index 687ec13898..5313885f83 100644
--- a/lib/Alchemy/Phrasea/Controller/Root/Login.php
+++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php
@@ -364,6 +364,10 @@ class Login implements ControllerProviderInterface
$user = $app['manipulator.user']->createUser($data['login'], $data['password'], $data['email'], false);
+ if (isset($data['geonameid'])) {
+ $app['manipulator.user']->setGeonameId($user, $data['geonameid']);
+ }
+
foreach ([
'gender' => 'setGender',
'firstname' => 'setFirstName',
@@ -375,13 +379,8 @@ class Login implements ControllerProviderInterface
'job' => 'setJob',
'company' => 'setCompany',
'position' => 'setActivity',
- 'geonameid' => 'setGeonameId',
] as $property => $method) {
if (isset($data[$property])) {
- if ($property === 'geonameid') {
- $app['manipulator.user']->setGeonameId($user, $data[$property]);
- continue;
- }
call_user_func([$user, $method], $data[$property]);
}
}
@@ -866,7 +865,7 @@ class Login implements ControllerProviderInterface
$app['events-manager']->trigger('__VALIDATION_REMINDER__', [
'to' => $participantId,
'ssel_id' => $basketId,
- 'from' => $validationSession->getInitiatorId(),
+ 'from' => $validationSession->getInitiator()->getId(),
'validate_id' => $validationSession->getId(),
'url' => $app->url('lightbox_validation', ['basket' => $basketId, 'LOG' => $token]),
]);
diff --git a/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php
index b0eead5f2c..135c30f81d 100644
--- a/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php
+++ b/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Model\MonologSQLLogger;
+use Alchemy\Phrasea\Model\NativeQueryProvider;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\FileCacheReader;
@@ -155,6 +156,10 @@ class ORMServiceProvider implements ServiceProviderInterface
return $em;
});
+
+ $app['EM.native-query'] = $app->share(function ($app) {
+ return new NativeQueryProvider($app['EM']);
+ });
}
public function boot(Application $app)
diff --git a/lib/Alchemy/Phrasea/Core/Provider/PhraseanetServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/PhraseanetServiceProvider.php
index 7b460b646b..0a655cb4c2 100644
--- a/lib/Alchemy/Phrasea/Core/Provider/PhraseanetServiceProvider.php
+++ b/lib/Alchemy/Phrasea/Core/Provider/PhraseanetServiceProvider.php
@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Authentication\ACLProvider;
-use Alchemy\Phrasea\Model\NativeQueryProvider;
use Alchemy\Phrasea\Security\Firewall;
use Silex\Application as SilexApplication;
use Silex\ServiceProviderInterface;
@@ -40,10 +39,6 @@ class PhraseanetServiceProvider implements ServiceProviderInterface
return new ACLProvider($app);
});
- $app['phraseanet.native-query'] = $app->share(function ($app) {
- return new NativeQueryProvider($app['EM']);
- });
-
$app['phraseanet.appbox-register'] = $app->share(function ($app) {
return new \appbox_register($app['phraseanet.appbox']);
});
diff --git a/lib/Alchemy/Phrasea/Model/Entities/AggregateToken.php b/lib/Alchemy/Phrasea/Model/Entities/AggregateToken.php
index ef8314c8d2..afb1e361e5 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/AggregateToken.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/AggregateToken.php
@@ -28,7 +28,7 @@ class AggregateToken
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -54,7 +54,7 @@ class AggregateToken
*
* @return AggregateToken
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
@@ -91,5 +91,4 @@ class AggregateToken
{
return $this->value;
}
-
}
diff --git a/lib/Alchemy/Phrasea/Model/Entities/Basket.php b/lib/Alchemy/Phrasea/Model/Entities/Basket.php
index 0eebb810ad..7fa1a5c84c 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/Basket.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/Basket.php
@@ -44,7 +44,7 @@ class Basket
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -56,9 +56,12 @@ class Basket
private $is_read = false;
/**
- * @ORM\Column(type="integer", nullable=true)
- */
- private $pusher_id;
+ * @ORM\ManyToOne(targetEntity="User")
+ * @ORM\JoinColumn(name="pusher_id", referencedColumnName="id")
+ *
+ * @return User
+ **/
+ private $pusher;
/**
* @ORM\Column(type="boolean")
@@ -93,8 +96,6 @@ class Basket
*/
private $order;
- private $pusher;
-
/**
* Constructor
*/
@@ -164,7 +165,7 @@ class Basket
*
* @return Basket
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
@@ -203,39 +204,23 @@ class Basket
}
/**
- * Set pusher_id
+ * @param User $user
*
- * @param integer $pusherId
- * @return Basket
+ * @return $this
*/
- public function setPusherId($pusherId)
+ public function setPusher(User $user = null)
{
- $this->pusher_id = $pusherId;
+ $this->pusher = $user;
return $this;
}
/**
- * Get pusher_id
- *
- * @return integer
+ * @return mixed
*/
- public function getPusherId()
+ public function getPusher()
{
- return $this->pusher_id;
- }
-
- public function setPusher(User $user)
- {
- $this->setPusherId($user->getId());
- $this->pusher = $user;
- }
-
- public function getPusher(Application $app)
- {
- if ($this->getPusherId()) {
- return $app['manipulator.user']->getRepository()->find($this->getPusherId());
- }
+ return $this->pusher;
}
/**
diff --git a/lib/Alchemy/Phrasea/Model/Entities/BasketElement.php b/lib/Alchemy/Phrasea/Model/Entities/BasketElement.php
index 1c1430dd6d..71e6e3c9b6 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/BasketElement.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/BasketElement.php
@@ -279,10 +279,10 @@ class BasketElement
*
* @return ValidationData
*/
- public function getUserValidationDatas(User $user, Application $app)
+ public function getUserValidationDatas(User $user)
{
foreach ($this->validation_datas as $validationData) {
- if ($validationData->getParticipant($app)->getUser()->getId() == $user->getId()) {
+ if ($validationData->getParticipant()->getUser()->getId() == $user->getId()) {
return $validationData;
}
}
diff --git a/lib/Alchemy/Phrasea/Model/Entities/FeedPublisher.php b/lib/Alchemy/Phrasea/Model/Entities/FeedPublisher.php
index 12a4abcac7..ba7d30b1c4 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/FeedPublisher.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/FeedPublisher.php
@@ -29,7 +29,7 @@ class FeedPublisher
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -67,7 +67,7 @@ class FeedPublisher
*
* @return FeedPublisher
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/FeedToken.php b/lib/Alchemy/Phrasea/Model/Entities/FeedToken.php
index 2e05099ef5..09e43ebe88 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/FeedToken.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/FeedToken.php
@@ -28,7 +28,7 @@ class FeedToken
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -60,7 +60,7 @@ class FeedToken
*
* @return FeedToken
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/FtpCredential.php b/lib/Alchemy/Phrasea/Model/Entities/FtpCredential.php
index 41f63409c2..536c276af6 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/FtpCredential.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/FtpCredential.php
@@ -29,7 +29,7 @@ class FtpCredential
/**
* @ORM\OneToOne(targetEntity="User", inversedBy="ftpCredential")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
**/
private $user;
@@ -105,7 +105,7 @@ class FtpCredential
*
* @return FtpCredential
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/FtpExport.php b/lib/Alchemy/Phrasea/Model/Entities/FtpExport.php
index a58431db06..335dd7a0df 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/FtpExport.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/FtpExport.php
@@ -90,7 +90,7 @@ class FtpExport
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -148,7 +148,7 @@ class FtpExport
*
* @return FtpExport
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/LazaretSession.php b/lib/Alchemy/Phrasea/Model/Entities/LazaretSession.php
index 9644fbac79..f3c83c9ba3 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/LazaretSession.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/LazaretSession.php
@@ -29,7 +29,7 @@ class LazaretSession
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -76,7 +76,7 @@ class LazaretSession
*
* @return LazaretSession
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/Order.php b/lib/Alchemy/Phrasea/Model/Entities/Order.php
index 9198694e09..28acc582ff 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/Order.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/Order.php
@@ -29,7 +29,7 @@ class Order
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -89,7 +89,7 @@ class Order
*
* @return Order
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/OrderElement.php b/lib/Alchemy/Phrasea/Model/Entities/OrderElement.php
index 516d548573..d5277abf55 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/OrderElement.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/OrderElement.php
@@ -38,9 +38,12 @@ class OrderElement
private $recordId;
/**
- * @ORM\Column(type="integer", nullable=true, name="order_master_id")
- */
- private $orderMasterId;
+ * @ORM\ManyToOne(targetEntity="User")
+ * @ORM\JoinColumn(name="order_master", referencedColumnName="id")
+ *
+ * @return User
+ **/
+ private $orderMaster;
/**
* @ORM\Column(type="boolean", nullable=true)
@@ -64,44 +67,23 @@ class OrderElement
}
/**
- * Set order_master_id
+ * @param User $user
*
- * @param integer $orderMasterId
- * @return OrderElement
+ * @return $this
*/
- public function setOrderMasterId($orderMasterId)
+ public function setOrderMaster(User $user = null)
{
- $this->orderMasterId = $orderMasterId;
+ $this->orderMaster = $user;
return $this;
}
/**
- * Get order_master_id
- *
- * @return integer
+ * @return mixed
*/
- public function getOrderMasterId()
+ public function getOrderMaster()
{
- return $this->orderMasterId;
- }
-
- /**
- *
- * Returns the username matching to the order_master_id
- *
- * @param Application $app
- * @return string
- */
- public function getOrderMasterName(Application $app)
- {
- if (isset($this->orderMasterId) && null !== $this->orderMasterId) {
- $user = $app['manipulator.user']->getRepository()->find($this->orderMasterId);
-
- return $user->getFirstName();
- }
-
- return null;
+ return $this->orderMaster;
}
/**
diff --git a/lib/Alchemy/Phrasea/Model/Entities/Session.php b/lib/Alchemy/Phrasea/Model/Entities/Session.php
index ce87bfc732..cf7b58b036 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/Session.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/Session.php
@@ -15,7 +15,7 @@ use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
- * @ORM\Table(name="Sessions")
+ * @ORM\Table(name="Sessions", indexes={@ORM\index(name="user_id", columns={"user_id"})})
* @ORM\Entity(repositoryClass="Alchemy\Phrasea\Model\Repositories\SessionRepository")
*/
class Session
@@ -29,7 +29,7 @@ class Session
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -121,7 +121,7 @@ class Session
*
* @return Session
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/StoryWZ.php b/lib/Alchemy/Phrasea/Model/Entities/StoryWZ.php
index c60a75bd9b..c7fdd93a3a 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/StoryWZ.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/StoryWZ.php
@@ -41,7 +41,7 @@ class StoryWZ
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -124,7 +124,7 @@ class StoryWZ
*
* @return StoryWZ
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/User.php b/lib/Alchemy/Phrasea/Model/Entities/User.php
index 3e5018f4e8..94b3745d27 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/User.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/User.php
@@ -27,6 +27,7 @@ use Symfony\Component\Translation\TranslatorInterface;
* indexes={
* @ORM\index(name="login", columns={"login"}),
* @ORM\index(name="mail", columns={"email"}),
+ * @ORM\index(name="model_of", columns={"model_of"}),
* @ORM\index(name="salted_password", columns={"salted_password"}),
* @ORM\index(name="admin", columns={"admin"}),
* @ORM\index(name="guest", columns={"guest"})
@@ -1030,7 +1031,7 @@ class User
/**
* @return string
*/
- public function getDisplayName(TranslatorInterface $translator = null)
+ public function getDisplayName()
{
if ($this->isTemplate()) {
return $this->getLogin();
@@ -1044,6 +1045,10 @@ class User
return $this->email;
}
+ if ('' !== trim($this->getLogin())) {
+ return $this->getLogin();
+ }
+
return 'Unnamed user';
}
}
diff --git a/lib/Alchemy/Phrasea/Model/Entities/UserNotificationSetting.php b/lib/Alchemy/Phrasea/Model/Entities/UserNotificationSetting.php
index 0777315684..17c3af0955 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/UserNotificationSetting.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/UserNotificationSetting.php
@@ -33,7 +33,7 @@ class UserNotificationSetting
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="notificationSettings")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
**/
private $user;
@@ -80,7 +80,7 @@ class UserNotificationSetting
*
* @return UserNotificationSetting
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/UserQuery.php b/lib/Alchemy/Phrasea/Model/Entities/UserQuery.php
index 549589828b..3013271e71 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/UserQuery.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/UserQuery.php
@@ -29,7 +29,7 @@ class UserQuery
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="queries")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
**/
private $user;
@@ -65,7 +65,7 @@ class UserQuery
*
* @return UserQuery
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/UserSetting.php b/lib/Alchemy/Phrasea/Model/Entities/UserSetting.php
index 07784b279e..5d1a9d2534 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/UserSetting.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/UserSetting.php
@@ -33,7 +33,7 @@ class UserSetting
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="settings")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
**/
private $user;
@@ -80,7 +80,7 @@ class UserSetting
*
* @return UserSetting
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/UsrAuthProvider.php b/lib/Alchemy/Phrasea/Model/Entities/UsrAuthProvider.php
index 600b6e3294..0b46296e27 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/UsrAuthProvider.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/UsrAuthProvider.php
@@ -32,7 +32,7 @@ class UsrAuthProvider
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -75,7 +75,7 @@ class UsrAuthProvider
*
* @return usrAuthprovider
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/UsrList.php b/lib/Alchemy/Phrasea/Model/Entities/UsrList.php
index e4ace3a2fd..a68547e0eb 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/UsrList.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/UsrList.php
@@ -242,10 +242,10 @@ class UsrList
* @param User $user
* @return boolean
*/
- public function has(User $user, Application $app)
+ public function has(User $user)
{
return $this->entries->exists(
- function ($key, $entry) use ($user, $app) {
+ function ($key, $entry) use ($user) {
return $entry->getUser()->getId() === $user->getId();
}
);
diff --git a/lib/Alchemy/Phrasea/Model/Entities/UsrListEntry.php b/lib/Alchemy/Phrasea/Model/Entities/UsrListEntry.php
index 9d3e19ed79..b3391b1f83 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/UsrListEntry.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/UsrListEntry.php
@@ -29,7 +29,7 @@ class UsrListEntry
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -68,7 +68,7 @@ class UsrListEntry
*
* @return UsrListEntry
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php b/lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php
index 036993ec68..d607b95535 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php
@@ -33,7 +33,7 @@ class UsrListOwner
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -77,7 +77,7 @@ class UsrListOwner
*
* @return UsrListowner
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/ValidationParticipant.php b/lib/Alchemy/Phrasea/Model/Entities/ValidationParticipant.php
index efcbc1f302..564c9f6b88 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/ValidationParticipant.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/ValidationParticipant.php
@@ -82,7 +82,7 @@ class ValidationParticipant
/**
* @ORM\ManyToOne(targetEntity="User")
- * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
+ * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*
* @return User
**/
@@ -93,7 +93,7 @@ class ValidationParticipant
*
* @return AggregateToken
*/
- public function setUser(User $user = null)
+ public function setUser(User $user)
{
$this->user = $user;
diff --git a/lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php b/lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php
index 2f32c8a6e7..2e3cd5590c 100644
--- a/lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php
+++ b/lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php
@@ -30,9 +30,12 @@ class ValidationSession
private $id;
/**
- * @ORM\Column(type="integer")
- */
- private $initiator_id;
+ * @ORM\ManyToOne(targetEntity="User")
+ * @ORM\JoinColumn(name="initiator_id", referencedColumnName="id", nullable=false)
+ *
+ * @return User
+ **/
+ private $initiator;
/**
* @Gedmo\Timestampable(on="create")
@@ -81,14 +84,13 @@ class ValidationSession
}
/**
- * Set initiator_id
+ * @param User $user
*
- * @param integer $initiatorId
- * @return ValidationSession
+ * @return $this
*/
- public function setInitiatorId($initiatorId)
+ public function setInitiator(User $user)
{
- $this->initiator_id = $initiatorId;
+ $this->initiator = $user;
return $this;
}
@@ -98,28 +100,19 @@ class ValidationSession
*
* @return integer
*/
- public function getInitiatorId()
+ public function getInitiator()
{
return $this->initiator_id;
}
+ /**
+ * @param User $user
+ *
+ * @return boolean
+ */
public function isInitiator(User $user)
{
- return $this->getInitiatorId() == $user->getId();
- }
-
- public function setInitiator(User $user)
- {
- $this->initiator_id = $user->getId();
-
- return;
- }
-
- public function getInitiator(Application $app)
- {
- if ($this->initiator_id) {
- return $app['manipulator.user']->getRepository()->find($this->initiator_id);
- }
+ return $this->getInitiator()->getId() == $user->getId();
}
/**
@@ -267,10 +260,10 @@ class ValidationSession
return $app->trans('Vous avez envoye cette demande a %n% utilisateurs', ['%n%' => count($this->getParticipants()) - 1]);
}
} else {
- if ($this->getParticipant($user, $app)->getCanSeeOthers()) {
- return $app->trans('Processus de validation recu de %user% et concernant %n% utilisateurs', ['%user%' => $this->getInitiator($app)->getDisplayName($app['translator']), '%n%' => count($this->getParticipants()) - 1]);
+ if ($this->getParticipant($user)->getCanSeeOthers()) {
+ return $app->trans('Processus de validation recu de %user% et concernant %n% utilisateurs', ['%user%' => $this->getInitiator($app)->getDisplayName(), '%n%' => count($this->getParticipants()) - 1]);
} else {
- return $app->trans('Processus de validation recu de %user%', ['%user%' => $this->getInitiator($app)->getDisplayName($app['translator'])]);
+ return $app->trans('Processus de validation recu de %user%', ['%user%' => $this->getInitiator($app)->getDisplayName()]);
}
}
}
@@ -280,7 +273,7 @@ class ValidationSession
*
* @return ValidationParticipant
*/
- public function getParticipant(User $user, Application $app)
+ public function getParticipant(User $user)
{
foreach ($this->getParticipants() as $participant) {
if ($participant->getUser()->getId() == $user->getId()) {
diff --git a/lib/Alchemy/Phrasea/Model/NativeQueryProvider.php b/lib/Alchemy/Phrasea/Model/NativeQueryProvider.php
index 9bf8e5dc62..8ea422c27d 100644
--- a/lib/Alchemy/Phrasea/Model/NativeQueryProvider.php
+++ b/lib/Alchemy/Phrasea/Model/NativeQueryProvider.php
@@ -2,7 +2,7 @@
/*
* This file is part of Phraseanet
*
- * (c) 2005-2013 Alchemy
+ * (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php
index dbf7d3823d..493c3b7e35 100644
--- a/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php
+++ b/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php
@@ -124,7 +124,7 @@ class BasketRepository extends EntityRepository
* @param User $user
* @return Basket
*/
- public function findUserBasket(Application $app, $basket_id, User $user, $requireOwner)
+ public function findUserBasket($basket_id, User $user, $requireOwner)
{
$dql = 'SELECT b
FROM Alchemy\Phrasea\Model\Entities\Basket b
@@ -146,7 +146,7 @@ class BasketRepository extends EntityRepository
if ($basket->getValidation() && !$requireOwner) {
try {
- $basket->getValidation()->getParticipant($user, $app);
+ $basket->getValidation()->getParticipant($user);
$participant = true;
} catch (\Exception $e) {
diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewOrder.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewOrder.php
index 823830cf43..c56b901d14 100644
--- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewOrder.php
+++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewOrder.php
@@ -46,7 +46,7 @@ class MailInfoNewOrder extends AbstractMail
throw new LogicException('You must set a user before calling getMessage()');
}
- return $this->app->trans('%user% has ordered documents', ['%user%' => $this->user->getDisplayName($this->app['translator'])]);
+ return $this->app->trans('%user% has ordered documents', ['%user%' => $this->user->getDisplayName()]);
}
/**
diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderCancelled.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderCancelled.php
index 76a35d67af..a8da22facb 100644
--- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderCancelled.php
+++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderCancelled.php
@@ -62,7 +62,7 @@ class MailInfoOrderCancelled extends AbstractMail
}
return $this->app->trans('%user% a refuse %quantity% elements de votre commande', [
- '%user%' => $this->deliverer->getDisplayName($this->app['translator']),
+ '%user%' => $this->deliverer->getDisplayName(),
'%quantity%' => $this->quantity,
]);
}
diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderDelivered.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderDelivered.php
index da3bbf2232..a976be10a2 100644
--- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderDelivered.php
+++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderDelivered.php
@@ -63,7 +63,7 @@ class MailInfoOrderDelivered extends AbstractMail
throw new LogicException('You must set a deliverer before calling getMessage');
}
- return $this->app->trans('%user% vous a delivre votre commande, consultez la en ligne a l\'adresse suivante', ['%user%' => $this->deliverer->getDisplayName($this->app['translator'])]);
+ return $this->app->trans('%user% vous a delivre votre commande, consultez la en ligne a l\'adresse suivante', ['%user%' => $this->deliverer->getDisplayName()]);
}
/**
diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoPushReceived.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoPushReceived.php
index c978f43124..e658c3833d 100644
--- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoPushReceived.php
+++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoPushReceived.php
@@ -62,7 +62,7 @@ class MailInfoPushReceived extends AbstractMailWithLink
}
return
- $this->app->trans('You just received a push containing %quantity% documents from %user%', ['%quantity%' => count($this->basket->getElements()), '%user%' => $this->pusher->getDisplayName($this->app['translator'])])
+ $this->app->trans('You just received a push containing %quantity% documents from %user%', ['%quantity%' => count($this->basket->getElements()), '%user%' => $this->pusher->getDisplayName()])
. "\n" . $this->message;
}
diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationDone.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationDone.php
index e81184ec11..057de54c78 100644
--- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationDone.php
+++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationDone.php
@@ -54,7 +54,7 @@ class MailInfoValidationDone extends AbstractMailWithLink
}
return $this->app->trans('push::mail:: Rapport de validation de %user% pour %title%', [
- '%user%' => $this->user->getDisplayName($this->app['translator']),
+ '%user%' => $this->user->getDisplayName(),
'%title%' => $this->title,
]);
}
@@ -69,7 +69,7 @@ class MailInfoValidationDone extends AbstractMailWithLink
}
return $this->app->trans('%user% has just sent its validation report, you can now see it', [
- '%user%' => $this->user->getDisplayName($this->app['translator']),
+ '%user%' => $this->user->getDisplayName(),
]);
}
diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationRequest.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationRequest.php
index 2d9b01365a..2aa87739c8 100644
--- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationRequest.php
+++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationRequest.php
@@ -60,7 +60,7 @@ class MailInfoValidationRequest extends AbstractMailWithLink
throw new LogicException('You must set a title before calling getSubject');
}
- return $this->app->trans("Validation request from %user% for '%title%'", ['%user%' => $this->user->getDisplayName($this->app['translator']), '%title%' => $this->title]);
+ return $this->app->trans("Validation request from %user% for '%title%'", ['%user%' => $this->user->getDisplayName(), '%title%' => $this->title]);
}
/**
diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/DeleteUsrIdFieldMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/DeleteUsrIdFieldMigration.php
index 1af2248243..740e5897df 100644
--- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/DeleteUsrIdFieldMigration.php
+++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/DeleteUsrIdFieldMigration.php
@@ -1,5 +1,14 @@
add(
- new Term($user->getDisplayName($this->app['translator']), '', $this, $user->getId())
+ new Term($user->getDisplayName(), '', $this, $user->getId())
);
}
@@ -98,7 +98,7 @@ class UserProvider implements ControlProviderInterface
throw new \Exception('User unknown');
}
- return $user->getDisplayName($this->app['translator']);
+ return $user->getDisplayName();
}
/**
diff --git a/lib/classes/API/V1/adapter.php b/lib/classes/API/V1/adapter.php
index 7f84e28826..d306481223 100644
--- a/lib/classes/API/V1/adapter.php
+++ b/lib/classes/API/V1/adapter.php
@@ -1363,7 +1363,7 @@ class API_V1_adapter extends API_V1_Abstract
$choices[] = [
'validation_user' => [
'usr_id' => $user->getId(),
- 'usr_name' => $user->getDisplayName($this->app['translator']),
+ 'usr_name' => $user->getDisplayName(),
'confirmed' => $participant->getIsConfirmed(),
'can_agree' => $participant->getCanAgree(),
'can_see_others' => $participant->getCanSeeOthers(),
@@ -1778,7 +1778,7 @@ class API_V1_adapter extends API_V1_Abstract
'created_on' => $basket->getCreated()->format(DATE_ATOM),
'description' => (string) $basket->getDescription(),
'name' => $basket->getName(),
- 'pusher_usr_id' => $basket->getPusherId(),
+ 'pusher_usr_id' => $basket->getPusher()->getId(),
'updated_on' => $basket->getUpdated()->format(DATE_ATOM),
'unread' => !$basket->getIsRead(),
'validation_basket' => !!$basket->getValidation()
@@ -1793,7 +1793,7 @@ class API_V1_adapter extends API_V1_Abstract
$users[] = [
'usr_id' => $user->getId(),
- 'usr_name' => $user->getDisplayName($this->app['translator']),
+ 'usr_name' => $user->getDisplayName(),
'confirmed' => $participant->getIsConfirmed(),
'can_agree' => $participant->getCanAgree(),
'can_see_others' => $participant->getCanSeeOthers(),
@@ -1812,7 +1812,7 @@ class API_V1_adapter extends API_V1_Abstract
'validation_users' => $users,
'expires_on' => $expires_on_atom,
'validation_infos' => $basket->getValidation()->getValidationString($this->app, $this->app['authentication']->getUser()),
- 'validation_confirmed' => $basket->getValidation()->getParticipant($this->app['authentication']->getUser(), $this->app)->getIsConfirmed(),
+ 'validation_confirmed' => $basket->getValidation()->getParticipant($this->app['authentication']->getUser())->getIsConfirmed(),
'validation_initiator' => $basket->getValidation()->isInitiator($this->app['authentication']->getUser()),
], $ret
);
diff --git a/lib/classes/eventsmanager/notify/autoregister.php b/lib/classes/eventsmanager/notify/autoregister.php
index 312c340a64..241aa2cd6e 100644
--- a/lib/classes/eventsmanager/notify/autoregister.php
+++ b/lib/classes/eventsmanager/notify/autoregister.php
@@ -50,7 +50,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
$mailColl = [];
try {
- $rs = $this->app['phraseanet.native-query']->getAdminsOfBases(array_keys($base_ids));
+ $rs = $this->app['EM.native-query']->getAdminsOfBases(array_keys($base_ids));
foreach ($rs as $row) {
$user = $row[0];
@@ -129,7 +129,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
}
$ret = [
- 'text' => $this->app->trans('%user% s\'est enregistre sur une ou plusieurs %before_link% scollections %after_link%', ['%user%' => $user->getDisplayName($this->app['translator']), '%before_link%' => '', '%after_link%' => ' '])
+ 'text' => $this->app->trans('%user% s\'est enregistre sur une ou plusieurs %before_link% scollections %after_link%', ['%user%' => $user->getDisplayName(), '%before_link%' => '', '%after_link%' => ' '])
, 'class' => ''
];
diff --git a/lib/classes/eventsmanager/notify/order.php b/lib/classes/eventsmanager/notify/order.php
index 78710d8e98..3320e36825 100644
--- a/lib/classes/eventsmanager/notify/order.php
+++ b/lib/classes/eventsmanager/notify/order.php
@@ -140,7 +140,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
return [];
}
- $sender = $user->getDisplayName($this->app['translator']);
+ $sender = $user->getDisplayName();
$ret = [
'text' => $this->app->trans('%user% a passe une %opening_link% commande %end_link%', [
diff --git a/lib/classes/eventsmanager/notify/orderdeliver.php b/lib/classes/eventsmanager/notify/orderdeliver.php
index 11b189dbfe..1770a74a48 100644
--- a/lib/classes/eventsmanager/notify/orderdeliver.php
+++ b/lib/classes/eventsmanager/notify/orderdeliver.php
@@ -148,12 +148,12 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
return [];
}
- $sender = $user->getDisplayName($this->app['translator']);
+ $sender = $user->getDisplayName();
try {
$repository = $this->app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket');
- $basket = $repository->findUserBasket($this->app, $ssel_id, $this->app['authentication']->getUser(), false);
+ $basket = $repository->findUserBasket($ssel_id, $this->app['authentication']->getUser(), false);
} catch (Exception $e) {
return [];
}
diff --git a/lib/classes/eventsmanager/notify/ordernotdelivered.php b/lib/classes/eventsmanager/notify/ordernotdelivered.php
index e7e6530907..7e00b75a65 100644
--- a/lib/classes/eventsmanager/notify/ordernotdelivered.php
+++ b/lib/classes/eventsmanager/notify/ordernotdelivered.php
@@ -111,7 +111,7 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac
return [];
}
- $sender = $user->getDisplayName($this->app['translator']);
+ $sender = $user->getDisplayName();
$ret = [
'text' => $this->app->trans('%user% a refuse la livraison de %quantity% document(s) pour votre commande', ['%user%' => $sender, '%quantity%' => $n])
diff --git a/lib/classes/eventsmanager/notify/push.php b/lib/classes/eventsmanager/notify/push.php
index 93752575db..a9faa1ea28 100644
--- a/lib/classes/eventsmanager/notify/push.php
+++ b/lib/classes/eventsmanager/notify/push.php
@@ -123,7 +123,7 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
return [];
}
- $sender = $user->getDisplayName($this->app['translator']);
+ $sender = $user->getDisplayName();
$ret = [
'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', ['%user%' => $sender, '%before_link%' => 'app->url('admin', ['section' => 'registrations']) . '" target="_blank">', '%after_link%' => ' '])
diff --git a/lib/classes/eventsmanager/notify/uploadquarantine.php b/lib/classes/eventsmanager/notify/uploadquarantine.php
index 95d1d1861a..a5d2ea32bd 100644
--- a/lib/classes/eventsmanager/notify/uploadquarantine.php
+++ b/lib/classes/eventsmanager/notify/uploadquarantine.php
@@ -74,7 +74,7 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
//Sender
if (null !== $user = $lazaretFile->getSession()->getUser()) {
$sender = $domXML->createElement('sender');
- $sender->appendChild($domXML->createTextNode($user->getDisplayName($this->app['translator'])));
+ $sender->appendChild($domXML->createTextNode($user->getDisplayName()));
$root->appendChild($sender);
$this->notifyUser($user, $datas);
diff --git a/lib/classes/eventsmanager/notify/validate.php b/lib/classes/eventsmanager/notify/validate.php
index 01fd1e2e00..a1bb639794 100644
--- a/lib/classes/eventsmanager/notify/validate.php
+++ b/lib/classes/eventsmanager/notify/validate.php
@@ -141,7 +141,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
return [];
}
- $sender = $user->getDisplayName($this->app['translator']);
+ $sender = $user->getDisplayName();
try {
$basket = $this->app['converter.basket']->convert($ssel_id);
diff --git a/lib/classes/eventsmanager/notify/validationdone.php b/lib/classes/eventsmanager/notify/validationdone.php
index b9da40a410..2281791891 100644
--- a/lib/classes/eventsmanager/notify/validationdone.php
+++ b/lib/classes/eventsmanager/notify/validationdone.php
@@ -135,12 +135,12 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
return [];
}
- $sender = $registered_user->getDisplayName($this->app['translator']);
+ $sender = $registered_user->getDisplayName();
try {
$repository = $this->app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket');
- $basket = $repository->findUserBasket($this->app, $ssel_id, $this->app['authentication']->getUser(), false);
+ $basket = $repository->findUserBasket($ssel_id, $this->app['authentication']->getUser(), false);
} catch (Exception $e) {
return [];
}
diff --git a/lib/classes/eventsmanager/notify/validationreminder.php b/lib/classes/eventsmanager/notify/validationreminder.php
index 9688998995..18758168cb 100644
--- a/lib/classes/eventsmanager/notify/validationreminder.php
+++ b/lib/classes/eventsmanager/notify/validationreminder.php
@@ -140,7 +140,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
return [];
}
- $sender = $user->getDisplayName($this->app['translator']);
+ $sender = $user->getDisplayName();
try {
$basket = $this->app['converter.basket']->convert($ssel_id);
diff --git a/lib/classes/module/console/checkExtension.php b/lib/classes/module/console/checkExtension.php
index b9017dc94b..993c8812eb 100644
--- a/lib/classes/module/console/checkExtension.php
+++ b/lib/classes/module/console/checkExtension.php
@@ -50,7 +50,7 @@ class module_console_checkExtension extends Command
$output->writeln(
sprintf(
"\nWill do the check with user %s (%s)\n"
- , $TestUser->getDisplayName($this->container['translator'])
+ , $TestUser->getDisplayName()
, $TestUser->getEmail()
)
);
diff --git a/lib/classes/module/report/activity.php b/lib/classes/module/report/activity.php
index 57afa36d14..2fdef6aee9 100644
--- a/lib/classes/module/report/activity.php
+++ b/lib/classes/module/report/activity.php
@@ -295,7 +295,7 @@ class module_report_activity extends module_report
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $login = $this->app['manipulator.user']->getRepository()->find($usr)->getDisplayName($this->app['translator']);
+ $login = $this->app['manipulator.user']->getRepository()->find($usr)->getDisplayName();
$this->setChamp($rs);
diff --git a/lib/classes/module/report/add.php b/lib/classes/module/report/add.php
index cea19ffc9d..2835f20e91 100644
--- a/lib/classes/module/report/add.php
+++ b/lib/classes/module/report/add.php
@@ -78,7 +78,7 @@ class module_report_add extends module_report
$caption = $value;
if ($field == "getter") {
if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) {
- $caption = $user->getDisplayName($this->app['translator']);
+ $caption = $user->getDisplayName();
}
} elseif ($field == 'date')
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
diff --git a/lib/classes/module/report/edit.php b/lib/classes/module/report/edit.php
index e012eda51f..97b94320de 100644
--- a/lib/classes/module/report/edit.php
+++ b/lib/classes/module/report/edit.php
@@ -78,7 +78,7 @@ class module_report_edit extends module_report
$caption = $value;
if ($field == "getter") {
if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) {
- $caption = $user->getDisplayName($this->app['translator']);
+ $caption = $user->getDisplayName();
}
} elseif ($field == 'date') {
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
diff --git a/lib/classes/module/report/push.php b/lib/classes/module/report/push.php
index 7a15034f00..fdae8ecc96 100644
--- a/lib/classes/module/report/push.php
+++ b/lib/classes/module/report/push.php
@@ -79,7 +79,7 @@ class module_report_push extends module_report
$caption = $value;
if ($field == "getter") {
if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) {
- $caption = $user->getDisplayName($this->app['translator']);
+ $caption = $user->getDisplayName();
}
} elseif ($field == 'date') {
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
diff --git a/lib/classes/module/report/sent.php b/lib/classes/module/report/sent.php
index 7231bbec71..539841519b 100644
--- a/lib/classes/module/report/sent.php
+++ b/lib/classes/module/report/sent.php
@@ -79,7 +79,7 @@ class module_report_sent extends module_report
$caption = $value;
if ($field == "getter") {
if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) {
- $caption = $user->getDisplayName($this->app['translator']);
+ $caption = $user->getDisplayName();
}
} elseif ($field == 'date') {
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
diff --git a/lib/classes/module/report/validate.php b/lib/classes/module/report/validate.php
index 1bc48a33ed..6063552db4 100644
--- a/lib/classes/module/report/validate.php
+++ b/lib/classes/module/report/validate.php
@@ -79,7 +79,7 @@ class module_report_validate extends module_report
$caption = $value;
if ($field == "getter") {
if (null !== $user = $this->app['manipulator.user']->getRepository()->find($value)) {
- $caption = $user->getDisplayName($this->app['translator']);
+ $caption = $user->getDisplayName();
}
} elseif ($field == 'date') {
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
diff --git a/lib/classes/patch/320alpha4b.php b/lib/classes/patch/320alpha4b.php
index 9d3b8076a6..109635ab42 100644
--- a/lib/classes/patch/320alpha4b.php
+++ b/lib/classes/patch/320alpha4b.php
@@ -99,7 +99,7 @@ class patch_320alpha4b implements patchInterface
$entry = new FeedEntry();
$entry->setAuthorEmail($user->getEmail());
- $entry->setAuthorName($user->getDisplayName($app['translator']));
+ $entry->setAuthorName($user->getDisplayName());
$entry->setFeed($feed);
$entry->setPublisher($publishers->first());
$entry->setTitle($row['name']);
@@ -187,11 +187,11 @@ class patch_320alpha4b implements patchInterface
if ( ! array_key_exists($user_key, self::$feeds) || ! isset(self::$feeds[$user_key][$feed_key])) {
if ($homelink == '1')
- $title = $user->getDisplayName($app['translator']) . ' - ' . 'homelink Feed';
+ $title = $user->getDisplayName() . ' - ' . 'homelink Feed';
elseif ($pub_restrict == '1')
- $title = $user->getDisplayName($app['translator']) . ' - ' . 'private Feed';
+ $title = $user->getDisplayName() . ' - ' . 'private Feed';
else
- $title = $user->getDisplayName($app['translator']) . ' - ' . 'public Feed';
+ $title = $user->getDisplayName() . ' - ' . 'public Feed';
$feed = new Feed();
$publisher = new FeedPublisher();
diff --git a/lib/classes/record/orderElement.php b/lib/classes/record/orderElement.php
index 90d0260de1..1b372d7dda 100644
--- a/lib/classes/record/orderElement.php
+++ b/lib/classes/record/orderElement.php
@@ -54,7 +54,7 @@ class record_orderElement extends record_adapter
if ($this->order_master_id) {
$user = $this->app['manipulator.user']->getRepository()->find($this->order_master_id);
- return $user->getDisplayName($this->app['translator']);
+ return $user->getDisplayName();
}
return '';
diff --git a/lib/classes/set/export.php b/lib/classes/set/export.php
index 3360f253c8..72cf34f837 100644
--- a/lib/classes/set/export.php
+++ b/lib/classes/set/export.php
@@ -57,7 +57,7 @@ class set_export extends set_abstract
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket');
/* @var $repository Alchemy\Phrasea\Model\Repositories\BasketRepository */
- $Basket = $repository->findUserBasket($this->app, $sstid, $app['authentication']->getUser(), false);
+ $Basket = $repository->findUserBasket($sstid, $app['authentication']->getUser(), false);
$this->exportName = str_replace([' ', '\\', '/'], '_', $Basket->getName()) . "_" . date("Y-n-d");
foreach ($Basket->getElements() as $basket_element) {
diff --git a/lib/classes/set/exportftp.php b/lib/classes/set/exportftp.php
index 2055746d64..a667d4a498 100644
--- a/lib/classes/set/exportftp.php
+++ b/lib/classes/set/exportftp.php
@@ -39,7 +39,7 @@ class set_exportftp extends set_export
$text_mail_receiver = "Bonjour,\n"
. "L'utilisateur "
- . $this->app['authentication']->getUser()->getDisplayName($this->app['translator']) . " (login : " . $this->app['authentication']->getUser()->getLogin() . ") "
+ . $this->app['authentication']->getUser()->getDisplayName() . " (login : " . $this->app['authentication']->getUser()->getLogin() . ") "
. "a fait un transfert FTP sur le serveur ayant comme adresse \""
. $host . "\" avec le login \"" . $login . "\" "
. "et pour repertoire de destination \""
diff --git a/templates/mobile/api/auth/end_user_authorization.html.twig b/templates/mobile/api/auth/end_user_authorization.html.twig
index 8879ccc436..c4f018345d 100644
--- a/templates/mobile/api/auth/end_user_authorization.html.twig
+++ b/templates/mobile/api/auth/end_user_authorization.html.twig
@@ -55,7 +55,7 @@
{% else %}
{% if app['authentication'].getUser() is not none %}
- {% set username = '' ~ app['authentication'].getUser().getDisplayName(app['translator']) ~ ' ' %}
+ {% set username = '' ~ app['authentication'].getUser().getDisplayName() ~ ' ' %}
{% trans with {'%username%' : username} %}Hello %username%{% endtrans %}
diff --git a/templates/mobile/api/auth/native_app_access_token.html.twig b/templates/mobile/api/auth/native_app_access_token.html.twig
index b63c8e2461..1f14e59fcd 100644
--- a/templates/mobile/api/auth/native_app_access_token.html.twig
+++ b/templates/mobile/api/auth/native_app_access_token.html.twig
@@ -38,7 +38,7 @@
{% if app['authentication'].getUser() is not none %}
- {% set username = '' ~ app['authentication'].getUser().getDisplayName(app['translator']) ~ ' ' %}
+ {% set username = '' ~ app['authentication'].getUser().getDisplayName() ~ ' ' %}
{% trans with {'%username%' : username} %}Hello %username%{% endtrans %}
diff --git a/templates/mobile/lightbox/basket_element.html.twig b/templates/mobile/lightbox/basket_element.html.twig
index 9736e9a1bb..a4dafe5794 100644
--- a/templates/mobile/lightbox/basket_element.html.twig
+++ b/templates/mobile/lightbox/basket_element.html.twig
@@ -36,11 +36,11 @@
{{ thumbnail.format100percent(record.get_preview()) }}
{% if basket_element.getBasket().getValidation() %}
- {% if basket_element.getBasket().getValidation().getParticipant(app['authentication'].getUser(), app).getCanAgree() %}
+ {% if basket_element.getBasket().getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %}
-
+
{{ 'validation:: OUI' | trans }}
-
+
{{ 'validation:: NON' | trans }}
{% endif %}
diff --git a/templates/mobile/lightbox/note_form.html.twig b/templates/mobile/lightbox/note_form.html.twig
index 2305266399..0cedce20d1 100644
--- a/templates/mobile/lightbox/note_form.html.twig
+++ b/templates/mobile/lightbox/note_form.html.twig
@@ -19,7 +19,7 @@
diff --git a/templates/mobile/lightbox/sc_note.html.twig b/templates/mobile/lightbox/sc_note.html.twig
index 7d1a0ba2c6..0114bd0b9d 100644
--- a/templates/mobile/lightbox/sc_note.html.twig
+++ b/templates/mobile/lightbox/sc_note.html.twig
@@ -7,7 +7,7 @@
{% endif %}
- {{ validationDatas.getParticipant().getUser().getDisplayName(app['translator']) }}
+ {{ validationDatas.getParticipant().getUser().getDisplayName() }}
{% if validationDatas.getNote() != '' %}
{{ 'validation:: note' | trans }} : {{ validationDatas.getNote()|nl2br }}
diff --git a/templates/mobile/lightbox/validate.html.twig b/templates/mobile/lightbox/validate.html.twig
index 0caa81edec..5a6dc9463a 100644
--- a/templates/mobile/lightbox/validate.html.twig
+++ b/templates/mobile/lightbox/validate.html.twig
@@ -4,7 +4,7 @@
{% block javascript %}
@@ -30,8 +30,8 @@
{% for basket_element in basket.getElements() %}
- {% if basket_element.getBasket().getValidation() and basket_element.getBasket().getValidation().getParticipant(app['authentication'].getUser(), app).getCanAgree() %}
-
+ {% if basket_element.getBasket().getValidation() and basket_element.getBasket().getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %}
+
{% endif %}
@@ -43,7 +43,7 @@
- {% if basket.getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanAgree() %}
+ {% if basket.getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %}
{{ 'validation::envoyer mon rapport' | trans }}
diff --git a/templates/web/account/authorized_apps.html.twig b/templates/web/account/authorized_apps.html.twig
index e7b785f7a0..5d902759db 100644
--- a/templates/web/account/authorized_apps.html.twig
+++ b/templates/web/account/authorized_apps.html.twig
@@ -25,7 +25,7 @@
{% if application.get_creator() is not none %}
- {% set user_name = application.get_creator().getDisplayName(app['translator']) %}
+ {% set user_name = application.get_creator().getDisplayName() %}
{% trans with {'%user_name%' : user_name} %}par %user_name%{% endtrans %}
{% endif%}
diff --git a/templates/web/admin/collection/collection.html.twig b/templates/web/admin/collection/collection.html.twig
index 6d9bb0ba35..694365e328 100644
--- a/templates/web/admin/collection/collection.html.twig
+++ b/templates/web/admin/collection/collection.html.twig
@@ -44,7 +44,7 @@
- {{ user.getDisplayName(app['translator']) }}
+ {{ user.getDisplayName() }}
{% endfor %}
diff --git a/templates/web/admin/connected-users.html.twig b/templates/web/admin/connected-users.html.twig
index a59381f208..11f53ce058 100644
--- a/templates/web/admin/connected-users.html.twig
+++ b/templates/web/admin/connected-users.html.twig
@@ -10,7 +10,7 @@
- {{ 'admin::compte-utilisateur nom' | trans }} : {{ user.getDisplayName(app['translator']) }}
+ {{ 'admin::compte-utilisateur nom' | trans }} : {{ user.getDisplayName() }}
{{ 'admin::compte-utilisateur societe' | trans }} : {{ user.getCompany() }}
@@ -102,9 +102,9 @@
{% if row.getId() == app['session'].get('session_id') %}
- {{ row.getUser().getDisplayName(app['translator']) }}
+ {{ row.getUser().getDisplayName() }}
{% else %}
- {{ row.getUser().getDisplayName(app['translator']) }}
+ {{ row.getUser().getDisplayName() }}
{% endif %}
diff --git a/templates/web/admin/editusers.html.twig b/templates/web/admin/editusers.html.twig
index 22a57e66a0..50e45fcb87 100644
--- a/templates/web/admin/editusers.html.twig
+++ b/templates/web/admin/editusers.html.twig
@@ -118,7 +118,7 @@
{{ 'Reglages:: reglages d inscitpition automatisee' | trans }}
{% endif %}
{% else %}
- {% set display_name = main_user.getDisplayName(app['translator']) %}
+ {% set display_name = main_user.getDisplayName() %}
{% trans with {'%display_name%' : display_name} %}Edition des droits de %display_name%{% endtrans %}
{% endif %}
{% else %}
diff --git a/templates/web/admin/publications/fiche.html.twig b/templates/web/admin/publications/fiche.html.twig
index 28c0904838..b3f950d723 100644
--- a/templates/web/admin/publications/fiche.html.twig
+++ b/templates/web/admin/publications/fiche.html.twig
@@ -143,7 +143,7 @@
{{ publisher.getUser().getId() }}
- {{ publisher.getUser().getDisplayName(app['translator']) }}
+ {{ publisher.getUser().getDisplayName() }}
{{ publisher.getUser().getEmail() }}
diff --git a/templates/web/api/auth/end_user_authorization.html.twig b/templates/web/api/auth/end_user_authorization.html.twig
index 69dc0ca404..6bbabd0d4f 100644
--- a/templates/web/api/auth/end_user_authorization.html.twig
+++ b/templates/web/api/auth/end_user_authorization.html.twig
@@ -55,7 +55,7 @@
{% else %}
{% if user is not none %}
- {% set username = '' ~ app['authentication'].getUser().getDisplayName(app['translator']) ~ ' ' %}
+ {% set username = '' ~ app['authentication'].getUser().getDisplayName() ~ ' ' %}
{% trans with {'%username%' : username} %}Hello %username%{% endtrans %}
diff --git a/templates/web/api/auth/native_app_access_token.html.twig b/templates/web/api/auth/native_app_access_token.html.twig
index 9dff59a42e..9a6b41a04d 100644
--- a/templates/web/api/auth/native_app_access_token.html.twig
+++ b/templates/web/api/auth/native_app_access_token.html.twig
@@ -38,7 +38,7 @@
{% if user is not none %}
- {% set username = '' ~ app['authentication'].getUser().getDisplayName(app['translator']) ~ ' ' %}
+ {% set username = '' ~ app['authentication'].getUser().getDisplayName() ~ ' ' %}
{% trans with {'%username%' : username} %}Hello %username%{% endtrans %}
diff --git a/templates/web/client/baskets.html.twig b/templates/web/client/baskets.html.twig
index 18c8e97df7..58905dc014 100644
--- a/templates/web/client/baskets.html.twig
+++ b/templates/web/client/baskets.html.twig
@@ -59,8 +59,8 @@
- {% if selected_basket is not none and selected_basket.getPusher(app) is not none %}
- {% set pusher_name = selected_basket.getPusher(app).getDisplayName(app['translator']) %}
+ {% if selected_basket is not none and selected_basket.getPusher() is not none %}
+ {% set pusher_name = selected_basket.getPusher().getDisplayName() %}
{% trans with {'%pusher_name%' : pusher_name} %}paniers:: panier emis par %pusher_name%{% endtrans %}
diff --git a/templates/web/lightbox/IE6/agreement_box.html.twig b/templates/web/lightbox/IE6/agreement_box.html.twig
index 82c15c910d..0916bcb1e9 100644
--- a/templates/web/lightbox/IE6/agreement_box.html.twig
+++ b/templates/web/lightbox/IE6/agreement_box.html.twig
@@ -18,7 +18,7 @@
{% for validation_data in basket_element.getValidationDatas() %}
- {% if basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanSeeOthers() or validation_data.getParticipant().getUser() == app['authentication'].getUser() %}
+ {% if basket.getValidation().getParticipant(app['authentication'].getUser()).getCanSeeOthers() or validation_data.getParticipant().getUser() == app['authentication'].getUser() %}
{% if validation_data.getAgreement() == true %}
{% set classuser = 'agree' %}
{% elseif validation_data.getAgreement() is null %}
@@ -27,19 +27,19 @@
{% set classuser = 'disagree' %}
{% endif %}
{% set participant = validation_data.getParticipant().getUser() %}
- {{participant.getDisplayName(app['translator'])}}
+ {{participant.getDisplayName()}}
{% endif %}
{% endfor %}
{% endif %}
- {% if basket_element and basket_element.getBasket().getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanAgree() %}
+ {% if basket_element and basket_element.getBasket().getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %}
- {% set agreement = basket_element.getUserValidationDatas(app['authentication'].getUser(), app).getAgreement() %}
+ {% set agreement = basket_element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() %}
{{ 'validation:: OUI' | trans }}
diff --git a/templates/web/lightbox/IE6/basket_options.html.twig b/templates/web/lightbox/IE6/basket_options.html.twig
index 236b4d1f82..69a23f9c66 100644
--- a/templates/web/lightbox/IE6/basket_options.html.twig
+++ b/templates/web/lightbox/IE6/basket_options.html.twig
@@ -1,4 +1,4 @@
-{% if basket.getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanAgree() %}
+{% if basket.getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %}
{{ 'validation::envoyer mon rapport' | trans }}
diff --git a/templates/web/lightbox/IE6/index.html.twig b/templates/web/lightbox/IE6/index.html.twig
index 05fb189266..140feea12c 100644
--- a/templates/web/lightbox/IE6/index.html.twig
+++ b/templates/web/lightbox/IE6/index.html.twig
@@ -54,7 +54,7 @@
{% if basket.getValidation().isFinished() %}
{{ '(validation) session terminee' | trans }}
- {% elseif basket.getValidation().getParticipant(app['authentication'].getUser(), app).getIsConfirmed() %}
+ {% elseif basket.getValidation().getParticipant(app['authentication'].getUser()).getIsConfirmed() %}
{{ '(validation) envoyee' | trans }}
{% else %}
{{ '(validation) a envoyer' | trans }}
diff --git a/templates/web/lightbox/IE6/sc_container.html.twig b/templates/web/lightbox/IE6/sc_container.html.twig
index 4013d91409..5814819831 100644
--- a/templates/web/lightbox/IE6/sc_container.html.twig
+++ b/templates/web/lightbox/IE6/sc_container.html.twig
@@ -9,9 +9,9 @@
{% if basket.getValidation() %}
+ class="agree_button {%if element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() == false or element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() is null %}not_decided{%endif%} agree_{{element.getId()}}" />
+ class="disagree_button {%if element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() == true or element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() is null %}not_decided{%endif%} disagree_{{element.getId()}}" />
{% endif %}
{{thumbnail.format(element.getRecord(app).get_thumbnail,114,85, '', true, false)}}
diff --git a/templates/web/lightbox/agreement_box.html.twig b/templates/web/lightbox/agreement_box.html.twig
index 08b922696d..45cb7eb7cd 100644
--- a/templates/web/lightbox/agreement_box.html.twig
+++ b/templates/web/lightbox/agreement_box.html.twig
@@ -16,7 +16,7 @@
{{ basket.getValidation().getValidationString(app, app['authentication'].getUser()) }}
{% for choice in basket_element.getValidationDatas() %}
- {% if basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanSeeOthers() or choice.getParticipant().getUser() == app['authentication'].getUser() %}
+ {% if basket.getValidation().getParticipant(app['authentication'].getUser()).getCanSeeOthers() or choice.getParticipant().getUser() == app['authentication'].getUser() %}
{% if choice.getAgreement() == true %}
{% set classuser = 'agree' %}
{% elseif choice.getAgreement() is null %}
@@ -25,17 +25,17 @@
{% set classuser = 'disagree' %}
{% endif %}
{% set participant = choice.getParticipant().getUser() %}
- {{participant.getDisplayName(app['translator'])}}
+ {{participant.getDisplayName()}}
{% endif %}
{% endfor %}
{% endif %}
-{% if basket_element and basket_element.getBasket().getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanAgree() %}
+{% if basket_element and basket_element.getBasket().getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %}
- {% set agreement = basket_element.getUserValidationDatas(app['authentication'].getUser(), app).getAgreement() %}
+ {% set agreement = basket_element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() %}
{{ 'validation:: OUI' | trans }}
diff --git a/templates/web/lightbox/basket_content_report.html.twig b/templates/web/lightbox/basket_content_report.html.twig
index 80d9003e23..8e7a689793 100644
--- a/templates/web/lightbox/basket_content_report.html.twig
+++ b/templates/web/lightbox/basket_content_report.html.twig
@@ -33,7 +33,7 @@
{% set imguser = '
' %}
{% set styleuser = '' %}
{% endif %}
-
{{imguser|raw}} {{validationDatas.getParticipant().getUser().getDisplayName(app['translator'])}}
+
{{imguser|raw}} {{validationDatas.getParticipant().getUser().getDisplayName()}}
{% if validationDatas.getNote() != '' %}
: {{validationDatas.getNote()|nl2br}}
{% endif %}
diff --git a/templates/web/lightbox/basket_options.html.twig b/templates/web/lightbox/basket_options.html.twig
index a63a868ee5..c7e192c5df 100644
--- a/templates/web/lightbox/basket_options.html.twig
+++ b/templates/web/lightbox/basket_options.html.twig
@@ -1,4 +1,4 @@
-{% if basket.getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser(), app).getCanAgree() %}
+{% if basket.getValidation() and basket.getValidation().getParticipant(app['authentication'].getUser()).getCanAgree() %}
{{ 'validation::envoyer mon rapport' | trans }}
diff --git a/templates/web/lightbox/index.html.twig b/templates/web/lightbox/index.html.twig
index 8a62d5d1cb..0e02ee14f5 100644
--- a/templates/web/lightbox/index.html.twig
+++ b/templates/web/lightbox/index.html.twig
@@ -55,7 +55,7 @@
{% if basket.getValidation().isFinished() %}
{{ '(validation) session terminee' | trans }}
- {% elseif basket.getValidation().getParticipant(app['authentication'].getUser(), app).getIsConfirmed() %}
+ {% elseif basket.getValidation().getParticipant(app['authentication'].getUser()).getIsConfirmed() %}
{{ '(validation) envoyee' | trans }}
{% else %}
{{ '(validation) a envoyer' | trans }}
diff --git a/templates/web/lightbox/sc_container.html.twig b/templates/web/lightbox/sc_container.html.twig
index 85de49b0a0..10c5552ea1 100644
--- a/templates/web/lightbox/sc_container.html.twig
+++ b/templates/web/lightbox/sc_container.html.twig
@@ -10,9 +10,9 @@
{% if basket.getValidation() %}
+ class="agree_button {%if element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() == false or element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() is null %}not_decided{%endif%} agree_{{element.getId()}}" />
+ class="disagree_button {%if element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() == true or element.getUserValidationDatas(app['authentication'].getUser()).getAgreement() is null %}not_decided{%endif%} disagree_{{element.getId()}}" />
{% endif %}
{{thumbnail.format(element.getRecord(app).get_thumbnail,114,85, '', true, false)}}
diff --git a/templates/web/lightbox/sc_note.html.twig b/templates/web/lightbox/sc_note.html.twig
index b8623181fb..6cb5af36a9 100644
--- a/templates/web/lightbox/sc_note.html.twig
+++ b/templates/web/lightbox/sc_note.html.twig
@@ -10,14 +10,14 @@
{% if validationDatas.getNote() != '' %}
- {{validationDatas.getParticipant().getUser().getDisplayName(app['translator'])}}
+ {{validationDatas.getParticipant().getUser().getDisplayName()}}
: {{ validationDatas.getNote()|nl2br }}
{% endif %}
{% endfor %}
- {{basket_element.getUserValidationDatas(app['authentication'].getUser(), app).getNote()}}
+ {{basket_element.getUserValidationDatas(app['authentication'].getUser()).getNote()}}