コード例 #1
0
ファイル: ContentLoad.class.php プロジェクト: pars5555/crm
 public function load()
 {
     $searchText = $this->initFilters();
     $searchWhereFilter = [];
     if ($searchText !== false) {
         $searchWhereFilter = ['serial_number', 'like', "'%{$searchText}%'"];
     }
     $sol_searial_numbers = SaleOrderLineSerialNumberManager::getInstance()->selectAdvance('*', $searchWhereFilter, null, null, 0, 1000);
     $saleOrdersDateMappedBySN = $this->getSaleOrdersDatesMappedBySN($sol_searial_numbers);
     $pol_searial_numbers = PurchaseOrderLineSerialNumberManager::getInstance()->selectAdvance('*', $searchWhereFilter, null, null, 0, 1000);
     $purchaseOrdersDateMappedBySN = $this->getPurchaseOrdersDatesMappedBySN($pol_searial_numbers);
     $combinePolAndSolSerialNumbers = $this->combinePolAndSolSerialNumbers($sol_searial_numbers, $pol_searial_numbers);
     $this->addParam('searial_numbers', $combinePolAndSolSerialNumbers);
     $this->addParam('saleOrdersDateMappedBySN', $saleOrdersDateMappedBySN);
     $this->addParam('purchaseOrdersDateMappedBySN', $purchaseOrdersDateMappedBySN);
 }
コード例 #2
0
ファイル: OpenLoad.class.php プロジェクト: pars5555/crm
 public function load()
 {
     $this->initErrorMessages();
     $this->initSuccessMessages();
     $this->addParam('products', ProductManager::getInstance()->selectAdvance('*', [], ['name']));
     $this->addParam('currencies', CurrencyManager::getInstance()->selectAdvance('*', ['active', '=', 1], ['name']));
     $paymentId = NGS()->args()->id;
     $purchaseOrders = PurchaseOrderManager::getInstance()->getPurchaseOrdersFull(['id', '=', $paymentId]);
     if (!empty($purchaseOrders)) {
         $purchaseOrder = $purchaseOrders[0];
         $this->addParam('purchaseOrder', $purchaseOrder);
     }
     $polSerialNumbersDtos = [];
     $purchaseOrderLineIds = $this->getPurchaseOrderLineIds($purchaseOrders);
     if (!empty($purchaseOrderLineIds)) {
         $purchaseOrderLineIdsSql = '(' . implode(',', $purchaseOrderLineIds) . ')';
         $polSerialNumbersDtos = PurchaseOrderLineSerialNumberManager::getInstance()->selectAdvance('*', ['line_id', 'IN', $purchaseOrderLineIdsSql]);
         $polSerialNumbersDtos = $this->mapDtosByLineId($polSerialNumbersDtos);
     }
     $this->addParam("polSerialNumbersDtos", $polSerialNumbersDtos);
 }
コード例 #3
0
 public function service()
 {
     if (!isset(NGS()->args()->purchase_order_id)) {
         $_SESSION['error_message'] = 'Purchase Order ID is missing';
         $this->redirect('purchase/list');
     }
     $purchaseOrderId = intval(NGS()->args()->purchase_order_id);
     if (!isset(NGS()->args()->pols_serial_numbers)) {
         $_SESSION['error_message'] = 'Serial Numbers parameter is missing';
         $this->redirect('purchase/warranty/' . $purchaseOrderId);
     }
     $pols_serial_numbers_json = NGS()->args()->pols_serial_numbers;
     $pols_serial_numbers = json_decode($pols_serial_numbers_json);
     foreach ($pols_serial_numbers as $obj) {
         $pol_id = $obj->pol_id;
         $serial_numbers = $obj->serial_numbers;
         $warranty_months = $obj->warranty_months;
         PurchaseOrderLineSerialNumberManager::getInstance()->setPurchaseOrderListSerialNumbers($pol_id, $serial_numbers, $warranty_months);
     }
     $_SESSION['success_message'] = 'Serial Numbers successfully saved.';
     $this->redirect('purchase/warranty/' . $purchaseOrderId);
 }