text changes to registration mail content
[namibia] / module / Stock / src / Stock / Controller / StockController.php
1 <?php
2 namespace Stock\Controller;
3
4
5 class StockController extends \Zend\Mvc\Controller\AbstractActionController
6 {
7
8         public function updateAction()
9         {
10                 \Utility\Registry::setServiceManager($this->serviceLocator);
11                 \Utility\Registry::addDynamicConfig(
12                         \Utility\Registry::getEntityManager()
13                                 ->getRepository('Config\Entity\Config')
14                                 ->find(1)
15                                 ->toArray()
16                 );
17                 $service = new \Stock\Service\Import();
18                 $service->setWorkflow($this->serviceLocator->get('Stock'));
19                 $filename = $this->getRequest()->getParam('filename');
20                 $service->scriptUpdateVehicleData($filename);
21                 return "\n";
22         }
23
24     public function bulkImportAction()
25     {
26         \Utility\Registry::setServiceManager($this->serviceLocator);
27         \Utility\Registry::addDynamicConfig(
28             \Utility\Registry::getEntityManager()
29                 ->getRepository('Config\Entity\Config')
30                 ->find(1)
31                 ->toArray()
32         );
33         $service = new \Stock\Service\BulkImport();
34         $service->setWorkflow($this->serviceLocator->get('Stock'));
35         $filename = $this->getRequest()->getParam('filename');
36         $importType = $this->getRequest()->getParam('importType');
37         $userId = $this->getRequest()->getParam('userId');
38         $companyId = $this->getRequest()->getParam('companyId');
39         $service->scriptUpdateVehicleData($filename,$importType,$userId,$companyId);
40         return "\n";
41     }
42
43         public function pushChangeAction()
44         {
45                 \Utility\Registry::setServiceManager($this->serviceLocator);
46                 \Utility\Registry::addDynamicConfig(
47                         \Utility\Registry::getEntityManager()
48                                 ->getRepository('Config\Entity\Config')
49                                 ->find(1)
50                                 ->toArray()
51                 );
52                 $service = new \Stock\Service\Stock();
53                 $service->setWorkflow($this->serviceLocator->get('Stock'));
54                 $changeCode = $this->getRequest()->getParam('changeCode');
55                 $id         = $this->getRequest()->getParam('id');
56                 $skipId     = $this->getRequest()->getParam('skipId');
57                 $service->pushChange($changeCode, $id, $skipId);
58                 return "\n";
59         }
60
61         public function imageUploadAction()
62         {
63                 \Utility\Registry::setServiceManager($this->serviceLocator);
64                 \Utility\Registry::addDynamicConfig(
65                         \Utility\Registry::getEntityManager()
66                                 ->getRepository('Config\Entity\Config')
67                                 ->find(1)
68                                 ->toArray()
69                 );
70                 $service = new \Stock\Service\Stock();
71                 $service->setWorkflow($this->serviceLocator->get('Stock'));
72                 $service->uploadImages();
73                 return "\n";
74         }
75
76     public function cleanUpStockAndValuationDatabaseAction()
77     {
78         \Utility\Registry::setServiceManager($this->serviceLocator);
79         \Utility\Registry::addDynamicConfig(
80             \Utility\Registry::getEntityManager()
81                 ->getRepository('Config\Entity\Config')
82                 ->find(1)
83                 ->toArray()
84         );
85
86         $valuationDate          = $this->getRequest()->getParam('valuationDate');
87         $stockDate              = $this->getRequest()->getParam('stockDate');
88
89         $service = new \Stock\Service\Stock();
90         $service->setWorkflow($this->serviceLocator->get('Stock'));
91         $service->cleanUpStockAndValuationDatabase($valuationDate,$stockDate);
92     }
93
94     public function cleanUpStockAndValuationDatabaseWorkerAction()
95     {
96         \Utility\Registry::setServiceManager($this->serviceLocator);
97         \Utility\Registry::addDynamicConfig(
98             \Utility\Registry::getEntityManager()
99                 ->getRepository('Config\Entity\Config')
100                 ->find(1)
101                 ->toArray()
102         );
103
104         $id             = $this->getRequest()->getParam('id');
105         $currentStatus  = $this->getRequest()->getParam('currentStatus');
106         $table  = $this->getRequest()->getParam('table');
107
108         $service = new \Stock\Service\Stock();
109         $service->setWorkflow($this->serviceLocator->get('Stock'));
110         $service->cleanUpStockAndValuationDatabaseWorker($id,$currentStatus,$table);
111     }
112
113     public function exportDataForGemsAction()
114     {
115         \Utility\Registry::setServiceManager($this->serviceLocator);
116         \Utility\Registry::addDynamicConfig(
117             \Utility\Registry::getEntityManager()
118                 ->getRepository('Config\Entity\Config')
119                 ->find(1)
120                 ->toArray()
121         );
122
123         $service = new \Stock\Service\Stock();
124         $service->setWorkflow($this->serviceLocator->get('Stock'));
125         $service->exportDataForGems();
126     }
127
128 }