Skip to content

Commit

Permalink
update 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Medialoha committed Apr 17, 2014
1 parent d1d1056 commit 28f6dd1
Show file tree
Hide file tree
Showing 22 changed files with 412 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .settings/org.eclipse.php.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
include_path=
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ Check Git hub repository [here](https://github.com/Medialoha/ACRA-Backend-Tester

## Change Log ##

**Version 1.3.2-Helen**

- *Support devices exception list from which reports will be ignored*
- *New chart: daily sales per month*
- *Sales table can now be filtered and ordered*
- *Some issues fixed (check milestone for more details*

**Version 1.3.0-Helen**

- *Milestones management*
Expand Down
Binary file added assets/images/ic_superandroid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
if (strcmp($key, 'report.packagename.shrink')==0 || strcmp($key, 'report.sendmail')==0) {
$tmpCfg[$key] = $v=='1'?true:false;

} else if (strcmp($key, 'report.exception.devices')==0) {
if (!empty($v)) {
$tmpCfg[$key] = '"'.str_replace(PHP_EOL, '", "' , $v).'"';

} else { $tmpCfg[$key] = ''; }

} else { $tmpCfg[$key] = $v; }
}
}
Expand Down
1 change: 1 addition & 0 deletions controllers/appscontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
if ((empty($code) && $mAppDesc->createEmptyTranslation($_POST['lang-code'], $_POST['lang-name'])) || $mAppDesc->loadTranslation($code, $isTmpl)) {
$tmpArr = explode('{', $tmpl);
$properties = array();
$html = '';

foreach($tmpArr as $r) {
if (empty($r)) continue;
Expand Down
9 changes: 6 additions & 3 deletions controllers/issuescontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
case 'delissues' :
$issueIds = @$_POST['issueIds'];
if (!empty($issueIds)) {
$reportIds = explode(',', $issueIds);
DBHelper::deleteIssues($issueIds);

echo 'O:Issue(s) deleted with success !';
Expand Down Expand Up @@ -197,8 +196,12 @@
break;

//////// UPDATE ISSUE DETAILS
case 'updateIssueDetails' :
$error = DbHelper::exec('UPDATE '.TBL_ISSUES.' SET '.ISSUE_MILESTONE_ID.'='.$_POST['new_milestone'].', '.ISSUE_COMMENT.'="'.$_POST['new_comment'].'" WHERE '.ISSUE_ID.'='.$_POST['issue_id']);
case 'updateIssueDetails' :
$error = DbHelper::exec('UPDATE '.TBL_ISSUES.
' SET '.ISSUE_MILESTONE_ID.'='.(empty($_POST['new_milestone'])?'null':$_POST['new_milestone']).', '.
ISSUE_COMMENT.'="'.addslashes($_POST['new_comment']).'"'.
' WHERE '.ISSUE_ID.'='.$_POST['issue_id']);

if ($error==null) {
Helper::pushAlert(ALERT_SUCCESS, 'Issue updated with success !');

Expand Down
5 changes: 5 additions & 0 deletions includes/appdesc.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ public function buildTranslatedDescription($edit=false) {

break;
case 'text' :
if (!$edit) {
$s = str_replace(PHP_EOL, '<br/>', $p->value);

} else { $s = $p->value; }
break;

default : $s = $p->value;
}
Expand Down
14 changes: 11 additions & 3 deletions includes/charthelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@


class ChartHelper {

public static $COLORS = array("#33B5E5", "#9440ED", "#B4EA34", "#FFB239", "#F04158", "#FFF145");
public static $COLOR_COUNT = 6;



// $arr[i] = array(0=>label, 1=>value)
public static function convertMySQLArrToPieChartJSON($arr, $appendValueToLabel=false) {
$json = '['; $sep = '';
public static function convertMySQLArrToPieChartJSON($arr, $appendValueToLabel=false) {
$json = '['; $sep = ''; $c = 0;
$arr = $arr===null?array():$arr;

foreach($arr as $row) {
$json .= $sep.'{"label":"'.$row[0].($appendValueToLabel?' ('.$row[1].')':'').'","data":'.$row[1].'}'; $sep = ',';
$json .= $sep.'{"label":"'.$row[0].($appendValueToLabel?' ('.$row[1].')':'').'","data":'.$row[1].', color:"'.self::$COLORS[$c].'"}'; $sep = ',';

$c = (++$c)%self::$COLOR_COUNT;
}

return $json.']';
Expand Down
2 changes: 2 additions & 0 deletions includes/config.php.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ $mGlobalCfg = array(
// we use an array of accounts to be able to support multiple accounts in future
'report.basicauth.accounts'=>array(%s),

'report.exception.devices'=>array(%s),

'mail.from.addr'=>'%s',
'mail.from.name'=>'%s',

Expand Down
15 changes: 14 additions & 1 deletion includes/confighelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class CfgHelper {
private $mSendMailOnReportReceived;
private $mReportMailRecipients;

private $mReportExceptionDevices;

private $mMailSender;

// dashboard options
Expand Down Expand Up @@ -77,6 +79,8 @@ private static function createHelperObject() {
$obj->mReportMailRecipients = is_string($mGlobalCfg['report.sendmail.recipients'])?$mGlobalCfg['report.sendmail.recipients']:'';

$obj->mMailSender = array($mGlobalCfg['mail.from.addr'], $mGlobalCfg['mail.from.name']);

$obj->mReportExceptionDevices = $mGlobalCfg['report.exception.devices'];

$obj->mDashboardRefresh = $mGlobalCfg['dashboard.refresh.interval'];
$obj->mDashboardNbNewIssues = $mGlobalCfg['dashboard.issues.nb'];
Expand All @@ -87,7 +91,8 @@ private static function createHelperObject() {
private static function safeGlobalConfig(&$configArr) {
$keys = array('db.host', 'db.name', 'db.port', 'db.user', 'db.pwd', 'tbl.prefix',
'date.format', 'date.timezone',
'report.packagename.shrink', 'report.sendmail', 'report.sendmail.recipients', 'report.basicauth', 'report.basicauth.method', 'report.basicauth.accounts',
'report.packagename.shrink', 'report.sendmail', 'report.sendmail.recipients', 'report.basicauth', 'report.basicauth.method', 'report.basicauth.accounts',
'report.exception.devices',
'mail.from.addr', 'mail.from.name',
'dashboard.refresh.interval', 'dashboard.issues.nb',
'report.tags');
Expand Down Expand Up @@ -183,6 +188,8 @@ public static function writeConfig($arr, $path="") {
$arr['report.basicauth.method'],
$accounts,

$arr['report.exception.devices'],

$arr['mail.from.addr'], $arr['mail.from.name'],

$arr['dashboard.refresh.interval'], $arr['dashboard.issues.nb'],
Expand Down Expand Up @@ -255,6 +262,12 @@ public function shrinkPackageName() { return $this->mShrinkPackageName; }

public function sendMailOnReportReceived() { return $this->mSendMailOnReportReceived; }

public function getReportExceptionDevices() { return is_array($this->mReportExceptionDevices)?$this->mReportExceptionDevices:array(); }

public function isInReportExceptionDevices($deviceId) {
return in_array($deviceId, $this->mReportExceptionDevices);
}

public function getDashboardRefreshIntervalInMillis() { return $this->mDashboardRefresh; }

public function getDashboardNewIssuesToDisplay() { return $this->mDashboardNbNewIssues; }
Expand Down
9 changes: 2 additions & 7 deletions includes/dbhelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,8 @@ public static function fetchNewIssues($limit=null) {
);
}

public static function deleteIssues($ids) {
$where = '';

if (is_array($ids))
$where = ' IN ('.implode(',', $ids).')';
else
$where = '='.$ids;
public static function deleteIssues($ids) {
$where = ' IN ('.(is_array($ids)?implode(',', $ids):$ids).')';

mysqli_query(self::$dbo, 'DELETE FROM '.TBL_REPORTS.' WHERE '.REPORT_ISSUE.$where);
mysqli_query(self::$dbo, 'DELETE FROM '.TBL_ISSUES.' WHERE '.ISSUE_ID.$where);
Expand Down
4 changes: 2 additions & 2 deletions includes/define.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/

define('_APPLICATION_NAME_', 'MAB-LAB');
define('_APPLICATION_VERSION_NAME_', '1.3.1-Helen');
define('_APPLICATION_VERSION_CODE_', 7);
define('_APPLICATION_VERSION_NAME_', '1.3.2-Helen');
define('_APPLICATION_VERSION_CODE_', 8);

define('LOG_SEVERITY', 0); // could be 0=>DEBUG, 1=>INFO, 2=>WARNING, 3=>ERROR

Expand Down
32 changes: 24 additions & 8 deletions includes/issuehelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static function getFilterOptsArr() {
$opts = $_SESSION['issueListOpts'];

} else {
$opts = array('appId'=>-1,
$opts = array('app'=>-1,
'mId'=>-1,
'showArchived'=>false,
'state'=>-1,
Expand All @@ -77,9 +77,23 @@ public static function getFilterOptsArr() {
}

// update opts from get params
foreach ($opts as $k=>$v) {
if (array_key_exists($k, $_GET) && !empty($v))
$opts[$k] = $_GET[$k];
foreach ($opts as $k=>$v) {
if (array_key_exists($k, $_GET)) {
$new_value = $_GET[$k];

if ($k=='state') {
if ($new_value!='')
$opts[$k] = $new_value;

} else {
if (is_numeric($new_value)) {
if ($k=='showArchived') {
$opts[$k] = intval($new_value)==1?true:false;

} else { $opts[$k] = $new_value; }
}
}
}
}

// update session
Expand Down Expand Up @@ -117,8 +131,8 @@ public static function buildIssuesWhereClause($filterOpts) {
// build where clauses
$where = array();

if ($filterOpts['appId']>0)
$where[] = ISSUE_APP_ID.'='.$filterOpts['appId'];
if ($filterOpts['app']>0)
$where[] = ISSUE_APP_ID.'='.$filterOpts['app'];

if ($filterOpts['mId']>0)
$where[] = ISSUE_MILESTONE_ID.'='.$filterOpts['mId'];
Expand All @@ -127,14 +141,16 @@ public static function buildIssuesWhereClause($filterOpts) {
$where[] = ISSUE_STATE.'<>'.ISSUE_STATE_ARCHIVED;
}

if (!empty($filterOpts['state']) && $filterOpts['state']>=0) {
if (isset($filterOpts['state']) && $filterOpts['state']!='' && $filterOpts['state']!='-1') {
$where[] = ISSUE_STATE.' IN ('.$filterOpts['state'].')';
}

if (!empty($filterOpts['priority']) && $filterOpts['priority']>=0) {
if (isset($filterOpts['priority']) && $filterOpts['priority']>=0) {
$where[] = ISSUE_PRIORITY.'='.$filterOpts['priority'];
}

Debug::logd($where);

return count($where)==0?'':implode(' AND ', $where);
}
}
16 changes: 8 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
require_once('includes/issue.class.php');
require_once('includes/issuehelper.php');


// init page
$mNavCtl = new NavigationController();

Expand Down Expand Up @@ -90,14 +89,15 @@
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="#">MAB-LAB</a>
<!-- <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> -->
<!-- <span class="icon-bar"></span> -->
<!-- <span class="icon-bar"></span> -->
<!-- <span class="icon-bar"></span> -->
<!-- </button> -->
<img src="assets/images/ic_superandroid.png" style=" float:left; height:40px;" />
<a class="brand" href="#">&nbsp;MABL</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li <?php echo $mNavCtl->id==PAGE_ID_HOME?'class="active"':''; ?> >
Expand Down
8 changes: 6 additions & 2 deletions install/db-install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%applications` (
# create google play sales and earnings tables
CREATE TABLE IF NOT EXISTS `%PREFIX%googleplay_sales` (
`sale_order_number` bigint(20) NOT NULL,
`sale_order_charged_date` char(10) NOT NULL,
`sale_order_charged_date` datetime NOT NULL,
`sale_charged_timestamp` int(11) NOT NULL,
`sale_financial_status` varchar(25) NOT NULL,
`sale_device_model` varchar(25) NOT NULL,
Expand Down Expand Up @@ -128,4 +128,8 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%milestones` (
`mile_description` text,
`mile_duedate` double DEFAULT NULL,
PRIMARY KEY (`mile_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


# create indexes
CREATE INDEX `idx_reports_report_issue` ON `%PREFIX%reports` (`report_issue`);
3 changes: 3 additions & 0 deletions install/update-to-8/db-update.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE `%PREFIX%googleplay_sales` CHANGE `sale_order_charged_date` `sale_order_charged_date` DATETIME NOT NULL;

CREATE INDEX `idx_reports_report_issue` ON `%PREFIX%reports` (`report_issue`);
22 changes: 22 additions & 0 deletions install/update-to-8/update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
define('DIRECT_ACCESS_CHECK', true);

define('BASE_PATH', '../../');


require_once('../updatehelper.php');

require_once(BASE_PATH.'includes/reporthelper.class.php');


$mUpdateHelper = new UpdateHelper();

$mUpdateHelper->begin();

$mUpdateHelper->applySQLUpdateFile();

$mUpdateHelper->exitOnError();

$mUpdateHelper->printEndStepMsg(true, null, true);

$mUpdateHelper->end();
Loading

0 comments on commit 28f6dd1

Please sign in to comment.