Skip to content
Permalink
Browse files Browse the repository at this point in the history
Also includes a better fix for 12f9465
  • Loading branch information
mbeccati committed Dec 15, 2014
1 parent 6347632 commit 2be73f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
23 changes: 3 additions & 20 deletions lib/max/Admin/UI/Field/PublisherIdField.php
Expand Up @@ -24,8 +24,6 @@ class Admin_UI_PublisherIdField extends Admin_UI_Field
{
function display()
{
global $session, $list_filters;

if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER))
{
echo "<input type='hidden' name='{$this->_name}' value='".OA_Permission::getEntityId()."'>";
Expand All @@ -34,21 +32,8 @@ function display()
{
$aPublishers = Admin_UI_PublisherIdField::phpAds_getPublisherArray('name');

// if no default publisher set, set it to the first id in the array
// - this is to ensure that we'll know which publisher to filter any other
// dropdowns by even if no publisher is selected yet
if (!isset($session['prefs']['GLOBALS']['report_publisher'])) {
$list_filters['publisher'] = key($aPublishers);
} else {
$list_filters['publisher'] = $session['prefs']['GLOBALS']['report_publisher'];

}

echo "<input type='hidden' name='submit_type' value=''>";
echo "<input type='hidden' name='changed_field' value=''>";
echo "<input type='hidden' name='refresh_page' value='".htmlspecialchars($_SERVER['REQUEST_URI'])."'>";
echo "
<select name='{$this->_name}' tabindex='".($this->_tabIndex++)."' onchange=\"form.submit_type.value='change';form.changed_field.value='publisher';submit();\" >";
<select name='{$this->_name}' tabindex='".($this->_tabIndex++)."'>";
foreach ($aPublishers as $publisherId => $aPublisher) {
$selected = $publisherId == $this->getValue() ? " selected='selected'" : '';
echo "
Expand All @@ -59,9 +44,6 @@ function display()
}
}

/**
* @todo Handle cases where user is not Admin, Agency or Advertiser
*/
function _getPublisherArray($orderBy = null)
{
$conf = $GLOBALS['_MAX']['CONF'];
Expand All @@ -75,7 +57,7 @@ function _getPublisherArray($orderBy = null)
"SELECT affiliateid,name".
" FROM ".$conf['table']['prefix'].$conf['table']['affiliates'].
" WHERE agencyid=".OA_Permission::getEntityId();
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
} elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
$query =
"SELECT affiliateid,name".
" FROM ".$conf['table']['prefix'].$conf['table']['affiliates'].
Expand All @@ -92,6 +74,7 @@ function _getPublisherArray($orderBy = null)

return ($affiliateArray);
}

}

?>
14 changes: 0 additions & 14 deletions www/admin/report-generate.php
Expand Up @@ -20,20 +20,6 @@

global $session;

if (isset($_REQUEST['submit_type']) && $_REQUEST['submit_type'] == 'change') {
// Store any values we need to pass to the next page
switch ($_REQUEST['changed_field']) {
case 'publisher' :
if (isset($_REQUEST['publisherId'])) {
$session['prefs']['GLOBALS']['report_publisher'] = $_REQUEST['publisherId'];
phpAds_SessionDataStore();
}
default :
break;
}
echo "<script type='text/javascript'>window.location='".$_REQUEST['refresh_page']."'</script>";
}

// If the report is for a "specific" period, store the period for later user
if (!is_null($_GET['period_preset']) && ($_GET['period_preset'] == 'specific')) {
if (!is_null($_GET['period_start'])) {
Expand Down

0 comments on commit 2be73f9

Please sign in to comment.