diff --git a/.settings/org.eclipse.php.core.prefs b/.settings/org.eclipse.php.core.prefs new file mode 100644 index 0000000..bf77573 --- /dev/null +++ b/.settings/org.eclipse.php.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +include_path= diff --git a/README.md b/README.md index aa18ec3..06d3d17 100644 --- a/README.md +++ b/README.md @@ -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* diff --git a/assets/images/ic_superandroid.png b/assets/images/ic_superandroid.png new file mode 100644 index 0000000..39f9e0e Binary files /dev/null and b/assets/images/ic_superandroid.png differ diff --git a/controller.php b/controller.php index b6e8811..2da7ec7 100644 --- a/controller.php +++ b/controller.php @@ -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; } } } diff --git a/controllers/appscontroller.php b/controllers/appscontroller.php index e24c607..87046a0 100644 --- a/controllers/appscontroller.php +++ b/controllers/appscontroller.php @@ -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; diff --git a/controllers/issuescontroller.php b/controllers/issuescontroller.php index f1c4474..f786fb1 100644 --- a/controllers/issuescontroller.php +++ b/controllers/issuescontroller.php @@ -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 !'; @@ -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 !'); diff --git a/includes/appdesc.class.php b/includes/appdesc.class.php index 7c872d3..d6adb85 100644 --- a/includes/appdesc.class.php +++ b/includes/appdesc.class.php @@ -309,6 +309,11 @@ public function buildTranslatedDescription($edit=false) { break; case 'text' : + if (!$edit) { + $s = str_replace(PHP_EOL, '
', $p->value); + + } else { $s = $p->value; } + break; default : $s = $p->value; } diff --git a/includes/charthelper.class.php b/includes/charthelper.class.php index 52e56f9..9641f51 100644 --- a/includes/charthelper.class.php +++ b/includes/charthelper.class.php @@ -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.']'; diff --git a/includes/config.php.tmpl b/includes/config.php.tmpl index 40f4615..c3acbea 100644 --- a/includes/config.php.tmpl +++ b/includes/config.php.tmpl @@ -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', diff --git a/includes/confighelper.class.php b/includes/confighelper.class.php index 1dccb71..945a048 100644 --- a/includes/confighelper.class.php +++ b/includes/confighelper.class.php @@ -31,6 +31,8 @@ class CfgHelper { private $mSendMailOnReportReceived; private $mReportMailRecipients; + private $mReportExceptionDevices; + private $mMailSender; // dashboard options @@ -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']; @@ -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'); @@ -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'], @@ -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; } diff --git a/includes/dbhelper.class.php b/includes/dbhelper.class.php index 1dd0d43..7d2fb58 100644 --- a/includes/dbhelper.class.php +++ b/includes/dbhelper.class.php @@ -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); diff --git a/includes/define.php b/includes/define.php index f813b75..c76c187 100644 --- a/includes/define.php +++ b/includes/define.php @@ -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 diff --git a/includes/issuehelper.php b/includes/issuehelper.php index 6baf988..f2175be 100644 --- a/includes/issuehelper.php +++ b/includes/issuehelper.php @@ -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, @@ -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 @@ -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']; @@ -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); } } \ No newline at end of file diff --git a/index.php b/index.php index e0c1276..51cdd97 100644 --- a/index.php +++ b/index.php @@ -24,7 +24,6 @@ require_once('includes/issue.class.php'); require_once('includes/issuehelper.php'); - // init page $mNavCtl = new NavigationController(); @@ -90,14 +89,15 @@