public function service()
 {
     $service_company_id = intval($_REQUEST['service_company_id']);
     if ($this->getUserLevel() === UserGroups::$SERVICE_COMPANY) {
         $requestHistoryManager = RequestHistoryManager::getInstance($this->config, $this->args);
         $customerGivenRequestRecentCountByHours = $requestHistoryManager->getCustomerGivenRequestRecentCountByHours($this->getCustomerLogin(), 24, get_class());
         if ($customerGivenRequestRecentCountByHours > intval($this->getCmsVar('company_revert_price_limit'))) {
             $jsonArr = array('status' => "err", "errText" => $this->getPhrase(557) . ' ' . intval($this->getCmsVar('company_revert_price_limit')));
             echo json_encode($jsonArr);
             return false;
         }
     }
     $serviceCompaniesPriceListManager = ServiceCompaniesPriceListManager::getInstance($this->config, $this->args);
     $ret = $serviceCompaniesPriceListManager->removeCompanyLastPrice($service_company_id);
     if ($ret > 0) {
         $jsonArr = array('status' => "ok");
         echo json_encode($jsonArr);
         return true;
     } else {
         switch ($ret) {
             case -1:
                 $errMessage = "Price doesn't exist!";
                 break;
             default:
                 $errMessage = "You can not revert the price file! You have only 1 price file on pcstore.";
                 break;
         }
         $jsonArr = array('status' => "err", "errText" => "System Error: " . $errMessage);
         echo json_encode($jsonArr);
         return false;
     }
 }
Ejemplo n.º 2
0
 /**
  * Initializes DB mappers
  *
  * @param object $config
  * @param object $args
  * @return
  */
 function __construct($config, $args)
 {
     $this->mapper = CompanyMapper::getInstance();
     $this->config = $config;
     $this->args = $args;
     $this->companyDealersManager = CompanyDealersManager::getInstance($this->config, $this->args);
     $this->requestHistoryManager = RequestHistoryManager::getInstance($this->config, $this->args);
     $this->companiesPriceListManager = CompaniesPriceListManager::getInstance($this->config, $this->args);
 }
Ejemplo n.º 3
0
 public function logRequestInDB()
 {
     if ($this->logRequest()) {
         $requestHistoryManager = RequestHistoryManager::getInstance($this->config, $this->args);
         $cust = $this->getCustomer();
         $requestHistoryManager->addRow($this->getUserLevelString(), $cust ? $cust->getEmail() : '', get_class($this), $_REQUEST);
     }
 }