public static function getMarkupForPublisher($publisher_info_id, $config, $cached = true)
 {
     $PublisherMarkupFactory = \_factory\PublisherMarkup::get_instance();
     $params = array();
     $params["PublisherInfoID"] = $publisher_info_id;
     if ($cached === true) {
         $user_markup = $PublisherMarkupFactory->get_row_cached($config, $params);
     } else {
         $user_markup = $PublisherMarkupFactory->get_row($params);
     }
     return $user_markup;
 }
Beispiel #2
0
 /**
  *
  * @return Ambigous <\Zend\Http\Response, \Zend\Stdlib\ResponseInterface>
  */
 public function changepublishermarkupAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     if ($this->is_admin == false) {
         die("You do not have permission to access this page");
     }
     $publisher_info_id = $this->getRequest()->getQuery('markuppublisherinfoid');
     $publisher_markup = $this->getRequest()->getQuery('publisher-markup');
     $PublisherMarkupFactory = \_factory\PublisherMarkup::get_instance();
     $params = array();
     $params["PublisherInfoID"] = $publisher_info_id;
     $PublisherMarkup = $PublisherMarkupFactory->get_row($params);
     $publisher_markup = floatval($publisher_markup) / 100;
     if ($publisher_markup <= 0) {
         die("Publisher Markup can not be less than or equal to zero percent");
     }
     if ($publisher_markup >= 1) {
         die("Publisher Markup can not be greater than or equal to one hundred percent");
     }
     $publisher_markup = sprintf("%1.2f", $publisher_markup);
     $_PublisherMarkup = new \model\PublisherMarkup();
     $_PublisherMarkup->PublisherInfoID = $publisher_info_id;
     $_PublisherMarkup->MarkupRate = $publisher_markup;
     if ($PublisherMarkup != null) {
         $PublisherMarkupFactory->updatePublisherMarkup($_PublisherMarkup);
     } else {
         $PublisherMarkupFactory->insertPublisherMarkup($_PublisherMarkup);
     }
     return $this->redirect()->toRoute('publisher');
 }