From da517a2c2361752f9fa4c3e425d813ab9af767e5 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Wed, 3 Oct 2018 10:12:43 +0100
Subject: [PATCH] FIX #8407 type_id mandatory only for res_letterbox

---
 src/app/resource/controllers/ResController.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/app/resource/controllers/ResController.php b/src/app/resource/controllers/ResController.php
index b704fa0cec1..ee5f8af67a8 100755
--- a/src/app/resource/controllers/ResController.php
+++ b/src/app/resource/controllers/ResController.php
@@ -77,7 +77,11 @@ class ResController
             return $response->withStatus(400)->withJson(['errors' => 'Bad Request']);
         }
 
-        $mandatoryColumns = ['type_id'];
+        $mandatoryColumns = [];
+        if ($data['table'] == 'res_letterbox') {
+            array_push($mandatoryColumns, 'type_id');
+        }
+
         foreach ($data['data'] as $value) {
             foreach ($mandatoryColumns as $columnKey => $column) {
                 if ($column == $value['column'] && !empty($value['value'])) {
-- 
GitLab