|
@@ -6,6 +6,10 @@ use Base\AdminBundle\Checks\CheckParametersAsURL;
|
|
|
use Buzz\Message\RequestInterface as HttpRequestInterface;
|
|
|
use Doctrine\ORM\EntityRepository;
|
|
|
use FTTHBundle\Entity\NAP;
|
|
|
+use FTTHBundle\Entity\ONU;
|
|
|
+use FTTHBundle\Factory\ExceptionFactory;
|
|
|
+use FTTHBundle\Service\ClientService;
|
|
|
+use FTTHBundle\Utils\ONUStateEnum;
|
|
|
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery;
|
|
|
use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
|
@@ -22,7 +26,9 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|
|
use FTTHBundle\Entity\ONUTemplate;
|
|
|
use FTTHBundle\Form\ServicePortType;
|
|
|
use FTTHBundle\Utils\OLTModelMark;
|
|
|
+use WebserviceBundle\Services\Webservice;
|
|
|
use WorkflowBundle\Admin\WorkflowBaseAdmin;
|
|
|
+use Exception;
|
|
|
|
|
|
class ONUAdmin extends WorkflowBaseAdmin
|
|
|
{
|
|
@@ -739,9 +745,23 @@ class ONUAdmin extends WorkflowBaseAdmin
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param ONU $onu
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
public function prePersist($onu)
|
|
|
{
|
|
|
$onu->setOlt($onu->getNap()->getOlt());
|
|
|
+ $webService = $this->get("webservice");
|
|
|
+ if($webService instanceof Webservice){
|
|
|
+ try{
|
|
|
+ $clientService = new ClientService($webService, $this->getConfigurationPool()->getContainer());
|
|
|
+ $clientService->setStateOnu($onu);
|
|
|
+ }catch (Exception $ex){
|
|
|
+ ExceptionFactory::make($ex->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -839,13 +859,28 @@ class ONUAdmin extends WorkflowBaseAdmin
|
|
|
$order->setClientExternalId($clients[$clientId]['externalId']);
|
|
|
$order->setClientId($clients[$clientId]['name']);
|
|
|
}
|
|
|
- }
|
|
|
+ }//
|
|
|
|
|
|
$datasourceit = $this->getModelManager()->getDataSourceIterator($datagrid, $this->getExportFields());
|
|
|
|
|
|
return $datasourceit;
|
|
|
}
|
|
|
|
|
|
+ //Get a client from api/clients in base
|
|
|
+ private function getClient($id){
|
|
|
+ $container = $this->getConfigurationPool()->getContainer();
|
|
|
+
|
|
|
+ die("OK");
|
|
|
+
|
|
|
+ /*if ($container->hasParameter('client') && $id) {
|
|
|
+ $webservice = $this->get("webservice");
|
|
|
+ $filters = array("qb-ids" => $id, 'qb-criteria' => true);
|
|
|
+ $clients = $webservice->getData($this->getParameter('client'), $filters);
|
|
|
+ var_dump($clients);
|
|
|
+ exit;
|
|
|
+ }*/
|
|
|
+ }
|
|
|
+
|
|
|
// Get all clientsIDs and get data from api/clients.json in base
|
|
|
private function getClients($datagrid)
|
|
|
{
|