Browse Source

Ref api#3 Improve in the Service Ports functionality in the system.

Maximiliano Schvindt 6 years ago
parent
commit
e4c982a367

+ 3 - 2
src/FTTHBundle/Admin/ONUAdmin.php

@@ -119,6 +119,7 @@ class ONUAdmin extends WorkflowBaseAdmin
         $id = $subject->getId();
         $readonly = is_null($id) ? false : 'readonly';
         $disabled = is_null($id) ? false : 'disabled';
+        $servicePortAdd = is_null($id) ? true : false;
         $flashbag = $this->get('session')->getFlashBag();
         if ($id) {
             $flashbag->add('warning', $this->trans('warning.disabled.fields'));
@@ -293,8 +294,8 @@ class ONUAdmin extends WorkflowBaseAdmin
                 ->with('Huawei', ['class' => "col-md-12 {$hidden['Huawei']} olt_mark Huawei"])
                     ->add('servicePorts', CollectionType::class, array(
                         'entry_type' => "FTTHBundle\\Form\\ServicePortType",
-                        'allow_add' => true,
-                        'allow_delete' => true,
+                        'allow_add' => $servicePortAdd,
+                        'allow_delete' => false,
                         'required' => false,
                         'by_reference' => false,
                         'disabled' => $disabled,

+ 2 - 2
src/FTTHBundle/Entity/ONU.php

@@ -748,9 +748,9 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     public function addServicePort(\FTTHBundle\Entity\ServicePort $servicePort)
     {
-        $servicePort->setOnu($this);
-        $servicePort->setOlt($this->olt);
         $this->servicePorts[] = $servicePort;
+        $servicePort->setOnu($this);
+        $servicePort->setOlt($this->nap->getOlt());
 
         return $this;
     }

File diff suppressed because it is too large
+ 1 - 1
src/FTTHBundle/Resources/translations/FTTHBundle.es.yml