Add some minor adjustments

Fix CS

Fix CS

Fix CS
This commit is contained in:
Nicolas Le Goff
2013-02-12 15:19:20 +01:00
parent 0cbaa17b25
commit c3f8e70fe5
14 changed files with 60 additions and 32 deletions

View File

@@ -38,7 +38,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
public function buildSql()
{
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(':action' => $this->action), $filter['params']);
if ($this->groupby == false) {
@@ -87,7 +87,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
public function sqlDistinctValByField($field)
{
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(':action' => $this->action), $filter['params']);
$this->sql = "
@@ -103,6 +103,6 @@ class module_report_sqlaction extends module_report_sql implements module_report
AND (d.action = :action)
) AS tt " . ($this->filter->getOrderFilter() ? $this->filter->getOrderFilter() : '');
return array('sql' => $this->sql, 'params' => $this->params);
return array('sql' => $this->sql, 'params' => $this->params);
}
}

View File

@@ -21,7 +21,7 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
public function buildSql()
{
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
if ($this->groupby == false) {
@@ -76,7 +76,7 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
public function sqlDistinctValByField($field)
{
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
$this->sql = '
@@ -88,6 +88,6 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
WHERE (' . $filter['sql'] . ')
) AS tt ORDER BY val ASC';
return array('sql' => $this->sql, 'params' => $this->params);
return array('sql' => $this->sql, 'params' => $this->params);
}
}

View File

@@ -25,7 +25,7 @@ class module_report_sqldownload extends module_report_sql implements module_repo
public function buildSql()
{
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
if ($this->groupby == false) {
@@ -96,7 +96,7 @@ class module_report_sqldownload extends module_report_sql implements module_repo
public function sqlDistinctValByField($field)
{
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
$this->sql = '
@@ -116,6 +116,6 @@ class module_report_sqldownload extends module_report_sql implements module_repo
$this->sql .= $this->filter->getOrderFilter() ? : '';
$this->sql .= $this->filter->getLimitFilter() ? : '';
return array('sql' => $this->sql, 'params' => $this->params);
return array('sql' => $this->sql, 'params' => $this->params);
}
}

View File

@@ -32,7 +32,7 @@ class module_report_sqlfilter
public static function constructDateFilter($dmin, $dmax)
{
return array(
'sql' => ($dmin && $dmax ? ' log_date.date > :date_min AND log_date.date < :date_max ' : false)
'sql' => ($dmin && $dmax ? ' log_date.date > :date_min AND log_date.date < :date_max ' : false)
, 'params' => ($dmin && $dmax ? array(':date_min' => $dmin, ':date_max' => $dmax) : array())
);
}
@@ -43,7 +43,7 @@ class module_report_sqlfilter
$coll_filter = array();
foreach (array_filter(explode(',', $list_coll_id)) as $val) {
$val = \phrasea::collFromBas($app, $val);
if (!!$val) {
if ($val) {
$coll_filter[] = 'log_colls.coll_id = ' . $val;
}
}
@@ -77,7 +77,7 @@ class module_report_sqlfilter
}
$finalfilter .= ' log.site = :log_site';
return array('sql' => $finalfilter, 'params' => $params);
return array('sql' => $finalfilter, 'params' => $params);
}
public function getGvSitFilter()
@@ -90,12 +90,12 @@ class module_report_sqlfilter
$params[':log_site_gv_filter'] = $this->app['phraseanet.registry']->get('GV_sit');
}
return array('sql' => $sql, 'params' => $params);
return array('sql' => $sql, 'params' => $params);
}
public function getUserIdFilter($id)
{
return array('sql' => "log.usrid = :usr_id_filter", 'params' => array(':usr_id_filter' => $id));
return array('sql' => "log.usrid = :usr_id_filter", 'params' => array(':usr_id_filter' => $id));
}
public function getDateFilter()
@@ -170,7 +170,7 @@ class module_report_sqlfilter
$n ++;
}
$filter_user = array('sql' => implode(' AND ', $filter), 'params' => $params);
$filter_user = array('sql' => implode(' AND ', $filter), 'params' => $params);
$this->filter['user'] = $filter_user;
}
@@ -197,7 +197,7 @@ class module_report_sqlfilter
}
}
$this->filter['collection'] = array('sql' => ' (' . implode(' OR ', array_unique($coll_filter)) . ') ', 'params' => array());
$this->filter['collection'] = array('sql' => ' (' . implode(' OR ', array_unique($coll_filter)) . ') ', 'params' => array());
}
return;
@@ -215,7 +215,7 @@ class module_report_sqlfilter
$params[":record_fil" . $n] = phrasea::collFromBas($this->app, $val);
$n ++;
}
$this->filter['record'] = array('sql' => implode(' OR ', $dl_coll_filter), 'params' => $params);
$this->filter['record'] = array('sql' => implode(' OR ', $dl_coll_filter), 'params' => $params);
}
return;

View File

@@ -21,7 +21,7 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
public function buildSql()
{
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
if ($this->groupby == false) {
@@ -62,7 +62,7 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
public function sqlDistinctValByField($field)
{
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
$this->params = array_merge(array(), $filter['params']);
$this->sql = "
@@ -76,6 +76,6 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
) as tt
ORDER BY tt.val ASC";
return array('sql' => $this->sql, 'params' => $this->params);
return array('sql' => $this->sql, 'params' => $this->params);
}
}

View File

@@ -75,28 +75,38 @@ class patch_380a3 implements patchInterface
DECLARE i INT DEFAULT 0;
DECLARE dest_coll_id INT;
DECLARE done INT DEFAULT 0;
DECLARE cur1 CURSOR FOR SELECT l.id, l.coll_list FROM log l LEFT JOIN log_colls lc ON (lc.log_id = l.id) WHERE (lc.log_id IS NULL) AND coll_list != '';
DECLARE result_set CURSOR FOR
SELECT l.id, l.coll_list
FROM log l
LEFT JOIN log_colls lc ON (lc.log_id = l.id)
WHERE (lc.log_id IS NULL) AND coll_list != '';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN cur1;
OPEN result_set;
read_loop: LOOP
FETCH cur1 INTO l_log_id, l_coll_list;
FETCH result_set INTO l_log_id, l_coll_list;
IF done THEN
LEAVE read_loop;
END IF;
SET occurance = (SELECT LENGTH(l_coll_list) - LENGTH(REPLACE(l_coll_list, bound, ''))+1);
SET i=1;
START TRANSACTION;
WHILE i <= occurance DO
SET dest_coll_id = (SELECT REPLACE(SUBSTRING(SUBSTRING_INDEX(l_coll_list, bound, i), LENGTH(SUBSTRING_INDEX(l_coll_list, bound, i - 1)) + 1), ',', ''));
SET dest_coll_id = (SELECT REPLACE(
SUBSTRING(
SUBSTRING_INDEX(l_coll_list, bound, i),
LENGTH(SUBSTRING_INDEX(l_coll_list, bound, i - 1)) + 1
),
',',
''
));
IF dest_coll_id > 0 THEN
INSERT INTO log_colls VALUES (null, l_log_id, dest_coll_id);
END IF;
END IF;
SET i = i + 1;
END WHILE;
COMMIT;
END LOOP;
CLOSE cur1;
CLOSE result_set;
END;";
$stmt = $conn->prepare($procedure);

View File

@@ -489,7 +489,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
*/
public function move_to_collection(collection $collection, appbox $appbox)
{
if ($collection->get_base_id() === $this->get_collection()->get_base_id()) {
if ($this->get_collection()->get_base_id() === $collection->get_base_id()) {
return $this;
}

View File

@@ -25,6 +25,9 @@ require_once __DIR__ . "/../../vendor/autoload.php";
$app = new Application();
/**
* @todo Remove this in next refactor
*/
$event = new GetResponseEvent($app, Request::createFromGlobals(), HttpKernelInterface::MASTER_REQUEST);
$app->addLocale($event);

View File

@@ -24,7 +24,9 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
require_once __DIR__ . "/../../vendor/autoload.php";
$app = new Application();
/**
* @todo Remove this in next refactor
*/
$event = new GetResponseEvent($app, Request::createFromGlobals(), HttpKernelInterface::MASTER_REQUEST);
$app->addLocale($event);

View File

@@ -76,7 +76,9 @@ foreach ($popbases as $key => $val) {
$selection[$id_sbas]['liste'] = $liste;
$app = new Application();
/**
* @todo Remove this in next refactor
*/
$event = new GetResponseEvent($app, Request::createFromGlobals(), HttpKernelInterface::MASTER_REQUEST);
$app->addLocale($event);

View File

@@ -56,7 +56,9 @@ $parm = $request->get_parms("dmin", // date minimal of the reporting
$app = new Application();
/**
* @todo Remove this in next refactor
*/
$event = new GetResponseEvent($app, Request::createFromGlobals(), HttpKernelInterface::MASTER_REQUEST);
$app->addLocale($event);

View File

@@ -23,8 +23,11 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
require_once __DIR__ . "/../../vendor/autoload.php";
$app = new Application('dev');
$app = new Application();
/**
* @todo Remove this in next refactor
*/
$event = new GetResponseEvent($app, Request::createFromGlobals(), HttpKernelInterface::MASTER_REQUEST);
$app->addLocale($event);

View File

@@ -24,6 +24,9 @@ require_once __DIR__ . "/../../vendor/autoload.php";
$app = new Application();
/**
* @todo Remove this in next refactor
*/
$event = new GetResponseEvent($app, Request::createFromGlobals(), HttpKernelInterface::MASTER_REQUEST);
$app->addLocale($event);

View File

@@ -58,6 +58,9 @@ $param = $request->get_parms(
$app = new Application();
/**
* @todo Remove this in next refactor
*/
$event = new GetResponseEvent($app, Request::createFromGlobals(), HttpKernelInterface::MASTER_REQUEST);
$app->addLocale($event);