From 1b93f19f394dae0fc595782edcf9e26fba54a71a Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Mon, 25 Feb 2019 17:33:34 +0100
Subject: [PATCH] FEAT #9105 History with basket name

---
 src/app/action/controllers/ActionMethodController.php   | 5 +++--
 src/app/resource/controllers/ResourceListController.php | 4 ++--
 test/unitTests/app/action/ActionControllerTest.php      | 1 -
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/app/action/controllers/ActionMethodController.php b/src/app/action/controllers/ActionMethodController.php
index 0ea75bf7ff4..b0392253774 100644
--- a/src/app/action/controllers/ActionMethodController.php
+++ b/src/app/action/controllers/ActionMethodController.php
@@ -25,9 +25,10 @@ class ActionMethodController
 
     public static function terminateAction(array $aArgs)
     {
-        ValidatorModel::notEmpty($aArgs, ['id', 'resources']);
+        ValidatorModel::notEmpty($aArgs, ['id', 'resources', 'basketName']);
         ValidatorModel::intVal($aArgs, ['id']);
         ValidatorModel::arrayType($aArgs, ['resources']);
+        ValidatorModel::stringType($aArgs, ['basketName']);
 
         $set = ['locker_user_id' => null, 'locker_time' => null, 'modification_date' => 'CURRENT_TIMESTAMP'];
 
@@ -49,7 +50,7 @@ class ActionMethodController
                     'recordId'  => $resource,
                     'eventType' => 'ACTION#' . $resource,
                     'eventId'   => $aArgs['id'],
-                    'info'      => $action['label_action']
+                    'info'      => "{$aArgs['basketName']} : {$action['label_action']}"
                 ]);
 
                 //TODO M2M
diff --git a/src/app/resource/controllers/ResourceListController.php b/src/app/resource/controllers/ResourceListController.php
index 34c2782f188..f93ec597f38 100644
--- a/src/app/resource/controllers/ResourceListController.php
+++ b/src/app/resource/controllers/ResourceListController.php
@@ -571,7 +571,7 @@ class ResourceListController
             return $response->withStatus($errors['code'])->withJson(['errors' => $errors['errors']]);
         }
 
-        $basket = BasketModel::getById(['id' => $aArgs['basketId'], 'select' => ['basket_clause', 'basket_id']]);
+        $basket = BasketModel::getById(['id' => $aArgs['basketId'], 'select' => ['basket_clause', 'basket_id', 'basket_name']]);
         $group = GroupModel::getById(['id' => $aArgs['groupId'], 'select' => ['group_id']]);
         $actionGroupBasket = ActionGroupBasketModel::get([
             'select'    => [1],
@@ -630,7 +630,7 @@ class ResourceListController
                 ActionMethodController::$method(['id' => $aArgs['actionId'], 'resId' => $resId]);
             }
         }
-        ActionMethodController::terminateAction(['id' => $aArgs['actionId'], 'resources' => $body['resources']]);
+        ActionMethodController::terminateAction(['id' => $aArgs['actionId'], 'resources' => $body['resources'], 'basketName' => $basket['basket_name']]);
 
         return $response->withStatus(204);
     }
diff --git a/test/unitTests/app/action/ActionControllerTest.php b/test/unitTests/app/action/ActionControllerTest.php
index 4524de7b063..a929e9d0070 100755
--- a/test/unitTests/app/action/ActionControllerTest.php
+++ b/test/unitTests/app/action/ActionControllerTest.php
@@ -80,7 +80,6 @@ class ActionsControllerTest extends TestCase
         $this->assertSame('index_mlb', $responseBody->action->action_page);
         $this->assertSame(true, $responseBody->action->history);
         $this->assertSame('apps', $responseBody->action->origin);
-        $this->assertSame(false, $responseBody->action->create_id);
 
         // FAIL READ
         $actionController = new \Action\controllers\ActionController();
-- 
GitLab