diff --git a/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php b/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php index fbcfec1cdb..4d80b28015 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php +++ b/lib/Alchemy/Phrasea/Controller/Api/Oauth2.php @@ -49,7 +49,7 @@ class Oauth2 implements ControllerProviderInterface $params = $oauth2_adapter->getAuthorizationRequestParameters($request); $app_authorized = false; - $errorMessage = false; + $error = $request->get('error', ''); $client = \API_OAuth2_Application::load_from_client_id($app, $params['client_id']); @@ -79,26 +79,24 @@ class Oauth2 implements ControllerProviderInterface $usr_id = $app['auth.native']->getUsrId($request->get("login"), $request->get("password"), $request); if (null === $usr_id) { - $app['session']->getFlashBag()->set('error', _('login::erreur: Erreur d\'authentification')); - return $app->redirectPath('oauth2_authorize'); + return $app->redirectPath('oauth2_authorize', array_merge(array('error' => 'login'), $params)); } } catch (RequireCaptchaException $e) { - return $app->redirectPath('oauth2_authorize', array('error' => 'captcha')); + return $app->redirectPath('oauth2_authorize', array_merge(array('error' => 'captcha'), $params)); } catch (AccountLockedException $e) { - return $app->redirectPath('oauth2_authorize', array('error' => 'account-locked')); + return $app->redirectPath('oauth2_authorize', array_merge(array('error' => 'account-locked'), $params)); } $app['authentication']->openAccount(\User_Adapter::getInstance($usr_id, $app)); + } else { + return new Response($app['twig']->render($template, array('error' => $error, "auth" => $oauth2_adapter))); } - - return new Response($app['twig']->render($template, array("auth" => $oauth2_adapter))); } //check if current client is already authorized by current user $user_auth_clients = \API_OAuth2_Application::load_authorized_app_by_user( - $app - , $app['authentication']->getUser() + $app, $app['authentication']->getUser() ); foreach ($user_auth_clients as $auth_client) { @@ -114,7 +112,7 @@ class Oauth2 implements ControllerProviderInterface if (!$app_authorized && $action_accept === null) { $params = array( "auth" => $oauth2_adapter, - "errorMessage" => $errorMessage, + "error" => $error, ); return new Response($app['twig']->render($template, $params)); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Basket.php b/lib/Alchemy/Phrasea/Controller/Prod/Basket.php index 89b1660637..986c98584e 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Basket.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Basket.php @@ -234,14 +234,22 @@ class Basket implements ControllerProviderInterface { $basket = $app['EM']->getRepository('\Entities\Basket') ->findUserBasket($app, $basket_id, $app['authentication']->getUser(), true); + $basketElement = $app['EM']->getRepository('\Entities\BasketElement') + ->find($basket_element_id); + $ord = $basketElement->getOrd(); foreach ($basket->getElements() as $basket_element) { + if ($basket_element->getOrd() > $ord) { + $basket_element->setOrd($basket_element->getOrd() - 1); + } /* @var $basket_element \Entities\BasketElement */ if ($basket_element->getId() == $basket_element_id) { + $basket->removeElement($basket_element); $app['EM']->remove($basket_element); } } + $app['EM']->persist($basket); $app['EM']->flush(); $data = array( diff --git a/lib/classes/databox/status.php b/lib/classes/databox/status.php index 8dc5da54d6..b51328a3e3 100644 --- a/lib/classes/databox/status.php +++ b/lib/classes/databox/status.php @@ -110,11 +110,11 @@ class databox_status $this->status[$bit]["img_on"] = null; if (is_file($path . "-stat_" . $bit . "_0.gif")) { - $this->status[$bit]["img_off"] = $url . "-stat_" . $bit . "_0.gif"; + $this->status[$bit]["img_off"] = $url . "-stat_" . $bit . "_0.gif?etag=".md5_file($path . "-stat_" . $bit . "_0.gif"); $this->status[$bit]["path_off"] = $path . "-stat_" . $bit . "_0.gif"; } if (is_file($path . "-stat_" . $bit . "_1.gif")) { - $this->status[$bit]["img_on"] = $url . "-stat_" . $bit . "_1.gif"; + $this->status[$bit]["img_on"] = $url . "-stat_" . $bit . "_1.gif?etag=".md5_file($path . "-stat_" . $bit . "_1.gif"); $this->status[$bit]["path_on"] = $path . "-stat_" . $bit . "_1.gif"; } diff --git a/templates/web/api/auth/end_user_authorization.html.twig b/templates/web/api/auth/end_user_authorization.html.twig index dd45fb90ef..0b47e45810 100644 --- a/templates/web/api/auth/end_user_authorization.html.twig +++ b/templates/web/api/auth/end_user_authorization.html.twig @@ -39,8 +39,9 @@ {% for key,value in auth.getParams %} {% endfor %} - {% if errorMessage is defined %} -
{% trans 'Erreur de login / mot de passe' %}
+ {% if error == 'login' %} +{% trans 'Erreur de login / mot de passe' %}
{% endif %}{% trans %} diff --git a/templates/web/client/answers.html.twig b/templates/web/client/answers.html.twig index 06cf2cf43d..a6cfb771d8 100644 --- a/templates/web/client/answers.html.twig +++ b/templates/web/client/answers.html.twig @@ -144,7 +144,7 @@ {% else %}