Browse Source

FD3-528 Solucionado añadiendo chequeo previo. Al realizar PUT no es requerido clientId. Al realizar POST si.

Maxi Schvindt 7 years ago
parent
commit
4a914af87e
1 changed files with 12 additions and 9 deletions
  1. 12 9
      src/FTTHBundle/Form/ONUType.php

+ 12 - 9
src/FTTHBundle/Form/ONUType.php

@@ -54,15 +54,18 @@ class ONUType extends AbstractType
 
                 $data = $event->getData();
 
-                $clientID = $data['clientId'];
-
-                if (is_array($clientID) and $this->webservice) {
-                    $clientID["disableTenancy"] = 1;
-                    $remote_data = $this->webservice->getData("client", $clientID);
-                    if (count($remote_data) === 1) {
-                        $data["clientId"] = $remote_data[0]["id"];
-                    } else {
-                        unset($data["clientId"]);
+                if(isset($data['clientId'])) {
+
+                    $clientID = $data['clientId'];
+                    
+                    if (is_array($clientID) and $this->webservice) {
+                        $clientID["disableTenancy"] = 1;
+                        $remote_data = $this->webservice->getData("client", $clientID);
+                        if (count($remote_data) === 1) {
+                            $data["clientId"] = $remote_data[0]["id"];
+                        } else {
+                            unset($data["clientId"]);
+                        }
                     }
                 }