mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 12:02:24 +09:00
Fixed condition group bug - if there are more condition groups and the first doesn't get displayed, the pipe of the next is printed even though it shouldn't have been.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8607 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ff679cc517
commit
0c63c32b10
4 changed files with 42 additions and 2 deletions
|
|
@ -190,8 +190,15 @@
|
||||||
function getWhereString($with_values = true){
|
function getWhereString($with_values = true){
|
||||||
$where = '';
|
$where = '';
|
||||||
if(count($this->conditions) > 0){
|
if(count($this->conditions) > 0){
|
||||||
|
$condition_count = 0;
|
||||||
foreach($this->conditions as $conditionGroup){
|
foreach($this->conditions as $conditionGroup){
|
||||||
$where .= $conditionGroup->toString($with_values);
|
$condition_string = $conditionGroup->toString($with_values);
|
||||||
|
if($condition_string !== '') $condition_count++;
|
||||||
|
if($condition_count === 1){
|
||||||
|
$conditionGroup->setPipe("");
|
||||||
|
$condition_string = $conditionGroup->toString($with_values);
|
||||||
|
}
|
||||||
|
$where .= $condition_string;
|
||||||
}
|
}
|
||||||
if(trim($where) == '') return '';
|
if(trim($where) == '') return '';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
$this->pipe = $pipe;
|
$this->pipe = $pipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setPipe($pipe){
|
||||||
|
$this->pipe = $pipe;
|
||||||
|
}
|
||||||
|
|
||||||
function toString($with_value = true){
|
function toString($with_value = true){
|
||||||
if($this->pipe !== "")
|
if($this->pipe !== "")
|
||||||
$group = $this->pipe .' (';
|
$group = $this->pipe .' (';
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,18 @@
|
||||||
$output = executeQuery('module.getSiteInfo', $args);
|
$output = executeQuery('module.getSiteInfo', $args);
|
||||||
$this->assertTrue(is_a($output, 'Object'));
|
$this->assertTrue(is_a($output, 'Object'));
|
||||||
$this->assertEquals(0, $output->error);
|
$this->assertEquals(0, $output->error);
|
||||||
var_dump($output);
|
}
|
||||||
|
|
||||||
|
function test_document_getDocumentList_pagination(){
|
||||||
|
$args->sort_index = 'list_order';
|
||||||
|
$args->order_type = 'asc';
|
||||||
|
$args->page = 1;
|
||||||
|
$args->list_count = 30;
|
||||||
|
$args->page_count = 10;
|
||||||
|
$args->s_member_srl = 4;
|
||||||
|
|
||||||
|
$output = executeQuery('document.getDocumentList', $args);
|
||||||
|
$this->assertEquals(0, $output->error, $output->message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -177,4 +177,22 @@
|
||||||
// $this->assertTrue($output->page == 5);
|
// $this->assertTrue($output->page == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_document_getDocumentList(){
|
||||||
|
$xml_file = _XE_PATH_ . "modules/document/queries/getDocumentList.xml";
|
||||||
|
$argsString = '$args->sort_index = \'list_order\';
|
||||||
|
$args->order_type = \'asc\';
|
||||||
|
$args->page = 1;
|
||||||
|
$args->list_count = 30;
|
||||||
|
$args->page_count = 10;
|
||||||
|
$args->s_member_srl = 4;';
|
||||||
|
$expected = 'select *
|
||||||
|
from "xe_documents" as "documents"
|
||||||
|
where "member_srl" = 4
|
||||||
|
order by "list_order" asc
|
||||||
|
limit 0, 30';
|
||||||
|
$this->_test($xml_file, $argsString, $expected);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue