Merge pull request #73 from dhensby/pulls/1.3/backporturlfix

Backport of 68d374
This commit is contained in:
Robbie Averill 2018-08-22 11:51:22 +12:00 committed by GitHub
commit e8fc4fca46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 7 deletions

View File

@ -2,6 +2,8 @@
sudo: false sudo: false
dist: precise
language: php language: php
php: php:
@ -12,14 +14,14 @@ php:
- 7.0 - 7.0
env: env:
- DB=MYSQL CORE_RELEASE=3.2 - DB=MYSQL CORE_RELEASE=3.6
matrix: matrix:
include: include:
- php: 5.6 - php: 5.6
env: DB=MYSQL CORE_RELEASE=3 env: DB=MYSQL CORE_RELEASE=3
- php: 5.6 - php: 5.6
env: DB=PGSQL CORE_RELEASE=3.2 env: DB=PGSQL CORE_RELEASE=3.5
allow_failures: allow_failures:
- php: 7.0 - php: 7.0

View File

@ -59,7 +59,7 @@ class MultiFormObjectDecorator extends DataExtension {
foreach($query->getWhere() as $whereClause) { foreach($query->getWhere() as $whereClause) {
$from = array_values($query->getFrom()); $from = array_values($query->getFrom());
// SQLQuery will automatically add double quotes and single quotes to values, so check against that. // SQLQuery will automatically add double quotes and single quotes to values, so check against that.
if($whereClause == "{$from[0]}.\"MultiFormIsTemporary\" = '1'") { if($whereClause == "{$from[0]}.\"MultiFormIsTemporary\" = '1'" || $whereClause == "{$from[0]}.\"MultiFormIsTemporary\" = 1") {
return true; return true;
} }
} }

View File

@ -141,7 +141,13 @@ class MultiFormStep extends DataObject {
*/ */
public function Link() { public function Link() {
$form = $this->form; $form = $this->form;
return Controller::join_links($form->getDisplayLink(), "?{$form->config()->get_var}={$this->Session()->Hash}"); return Controller::join_links(
$form->getDisplayLink(),
'?' . http_build_query(array(
$form->getGetVar() => $this->Session()->Hash,
'StepID' => $this->ID,
))
);
} }
/** /**

View File

@ -1,7 +1,7 @@
<ul class="stepIndicator current-$CurrentStep.class"> <ul class="stepIndicator current-$CurrentStep.class">
<% loop AllStepsLinear %> <% loop AllStepsLinear %>
<li class="$ClassName<% if LinkingMode %> $LinkingMode<% end_if %><% if FirstLast %> $FirstLast<% end_if %><% if $ExtraClasses %> $ExtraClasses<% end_if %>"> <li class="$ClassName<% if LinkingMode %> $LinkingMode<% end_if %><% if FirstLast %> $FirstLast<% end_if %><% if $ExtraClasses %> $ExtraClasses<% end_if %>">
<% if LinkingMode = current %><% else %><% if ID %><a href="{$Top.URLSegment}/?${Top.GetVar}={$SessionID}&amp;StepID={$ID}"><% end_if %><% end_if %> <% if LinkingMode = current %><% else %><% if ID %><a href="$Link"><% end_if %><% end_if %>
<% if Title %>$Title<% else %>$ClassName<% end_if %> <% if Title %>$Title<% else %>$ClassName<% end_if %>
<% if LinkingMode = current %><% else %><% if ID %></a><% end_if %><% end_if %> <% if LinkingMode = current %><% else %><% if ID %></a><% end_if %><% end_if %>
</li> </li>

View File

@ -8,7 +8,7 @@ class MultiFormObjectDecoratorTest extends SapphireTest {
); );
protected $extraDataObjects = array( protected $extraDataObjects = array(
'MultiFormObjectDecorator_DataObject' 'MultiFormObjectDecorator_DataObject',
); );
public function testTemporaryDataFilteredQuery() { public function testTemporaryDataFilteredQuery() {
@ -16,6 +16,7 @@ class MultiFormObjectDecoratorTest extends SapphireTest {
->map('Name') ->map('Name')
->toArray(); ->toArray();
$this->assertCount(2, $records);
$this->assertContains('Test 1', $records); $this->assertContains('Test 1', $records);
$this->assertContains('Test 2', $records); $this->assertContains('Test 2', $records);
$this->assertNotContains('Test 3', $records); $this->assertNotContains('Test 3', $records);
@ -28,6 +29,7 @@ class MultiFormObjectDecoratorTest extends SapphireTest {
->map('Name') ->map('Name')
->toArray(); ->toArray();
$this->assertCount(1, $records);
$this->assertNotContains('Test 1', $records); $this->assertNotContains('Test 1', $records);
$this->assertNotContains('Test 2', $records); $this->assertNotContains('Test 2', $records);
$this->assertContains('Test 3', $records); $this->assertContains('Test 3', $records);
@ -35,7 +37,7 @@ class MultiFormObjectDecoratorTest extends SapphireTest {
} }
class MultiFormObjectDecorator_DataObject extends DataObject { class MultiFormObjectDecorator_DataObject extends DataObject implements TestOnly {
private static $db = array( private static $db = array(
'Name' => 'Varchar' 'Name' => 'Varchar'