Esempio n. 1
0
 public static function getMarkupForInsertionOrder($ad_campaign_id, $config, $cached = true)
 {
     $InsertionOrderMarkupFactory = \_factory\InsertionOrderMarkup::get_instance();
     $params = array();
     $params["InsertionOrderID"] = $ad_campaign_id;
     if ($cached === true) {
         $ad_campaign_markup = $InsertionOrderMarkupFactory->get_row_cached($config, $params);
     } else {
         $ad_campaign_markup = $InsertionOrderMarkupFactory->get_row($params);
     }
     return $ad_campaign_markup;
 }
Esempio n. 2
0
 /**
  * 
  * @return Ambigous <\Zend\Http\Response, \Zend\Stdlib\ResponseInterface>
  */
 public function changecampaignmarkupAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if (!$this->auth->isSuperAdmin($this->config_handle)) {
         die("You do not have permission to access this page");
     }
     $campaign_id = $this->getRequest()->getQuery('markupcampaignid');
     $campaign_markup = $this->getRequest()->getQuery('campaign-markup');
     $InsertionOrderMarkupFactory = \_factory\InsertionOrderMarkup::get_instance();
     $params = array();
     $params["InsertionOrderID"] = $campaign_id;
     $InsertionOrderMarkup = $InsertionOrderMarkupFactory->get_row($params);
     $campaign_markup = floatval($campaign_markup) / 100;
     if ($campaign_markup <= 0) {
         die("Campaign Markup can not be less than or equal to zero percent");
     }
     if ($campaign_markup >= 1) {
         die("Campaign Markup can not be greater than or equal to one hundred percent");
     }
     $campaign_markup = sprintf("%1.2f", $campaign_markup);
     $_InsertionOrderMarkup = new \model\InsertionOrderMarkup();
     $_InsertionOrderMarkup->InsertionOrderID = $campaign_id;
     $_InsertionOrderMarkup->MarkupRate = $campaign_markup;
     if ($InsertionOrderMarkup != null) {
         $InsertionOrderMarkupFactory->updateInsertionOrderMarkup($_InsertionOrderMarkup);
     } else {
         $InsertionOrderMarkupFactory->insertInsertionOrderMarkup($_InsertionOrderMarkup);
     }
     return $this->redirect()->toRoute('private-exchange');
 }