mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
Merge branch '2.1' into 2.2
This commit is contained in:
commit
3b21e4cf88
@ -151,7 +151,7 @@ class DMS extends Object implements DMSInterface
|
||||
|
||||
public function getDocumentSetsByPage(SiteTree $page)
|
||||
{
|
||||
return $page->DocumentSets();
|
||||
return $page->getDocumentSets();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,14 +55,11 @@ class DMSSiteTreeExtension extends DataExtension
|
||||
/**
|
||||
* Get a list of document sets for the owner page
|
||||
*
|
||||
* @deprecated 3.0 Use DocumentSets() instead.
|
||||
*
|
||||
* @return ArrayList
|
||||
*/
|
||||
public function getDocumentSets()
|
||||
{
|
||||
Deprecation::notice('3.0', 'Use DocumentSets() instead');
|
||||
return $this->owner->hasManyComponent('DocumentSets');
|
||||
return $this->owner->DocumentSets();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +71,7 @@ class DMSSiteTreeExtension extends DataExtension
|
||||
{
|
||||
$documents = ArrayList::create();
|
||||
|
||||
foreach ($this->owner->DocumentSets() as $documentSet) {
|
||||
foreach ($this->getDocumentSets() as $documentSet) {
|
||||
/** @var DocumentSet $documentSet */
|
||||
$documents->merge($documentSet->getDocuments());
|
||||
}
|
||||
|
@ -820,12 +820,12 @@ class DMSDocument extends DataObject implements DMSDocumentInterface
|
||||
new GridFieldDataColumns(),
|
||||
new GridFieldPaginator(30)
|
||||
);
|
||||
|
||||
$versionsGridFieldConfig->getComponentByType('GridFieldDataColumns')
|
||||
->setDisplayFields(Config::inst()->get('DMSDocument_versions', 'display_fields'))
|
||||
->setFieldFormatting(
|
||||
array(
|
||||
'FilenameWithoutID' => '<a target="_blank" class="file-url" href="$Link">'
|
||||
. '$FilenameWithoutID</a>'
|
||||
'FilenameWithoutID' => '<a target=\"_blank\" class=\"file-url\" href=\"$Link\">$FilenameWithoutID</a>'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -12,7 +12,8 @@
|
||||
"silverstripe/framework": "^3.5",
|
||||
"silverstripe/cms": "^3.5",
|
||||
"symbiote/silverstripe-gridfieldextensions": "^2.0",
|
||||
"silverstripe/taxonomy": "^1.2"
|
||||
"silverstripe/taxonomy": "^1.2",
|
||||
"mustangostang/spyc": "<=0.6.2"
|
||||
},
|
||||
"suggest": {
|
||||
"undefinedoffset/sortablegridfield": "Allow documents to be reordered via drag-and-drop"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<% if $DocumentSets %>
|
||||
<% if $getDocumentSets %>
|
||||
<div class="documentsets">
|
||||
<% loop $DocumentSets %>
|
||||
<% loop $getDocumentSets %>
|
||||
<% include DocumentSet %>
|
||||
<% end_loop %>
|
||||
</div>
|
||||
|
@ -50,9 +50,9 @@ class DMSDocumentSetTest extends SapphireTest
|
||||
$ds2 = $this->objFromFixture('DMSDocumentSet', 'ds2');
|
||||
$ds3 = $this->objFromFixture('DMSDocumentSet', 'ds3');
|
||||
|
||||
$this->assertCount(0, $s4->DocumentSets(), 'Page 4 has no document sets associated');
|
||||
$this->assertCount(2, $s1->DocumentSets(), 'Page 1 has 2 document sets');
|
||||
$this->assertEquals(array($ds1->ID, $ds2->ID), $s1->DocumentSets()->column('ID'));
|
||||
$this->assertCount(0, $s4->getDocumentSets(), 'Page 4 has no document sets associated');
|
||||
$this->assertCount(2, $s1->getDocumentSets(), 'Page 1 has 2 document sets');
|
||||
$this->assertEquals(array($ds1->ID, $ds2->ID), $s1->getDocumentSets()->column('ID'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ class DMSEmbargoTest extends SapphireTest
|
||||
$this->assertFalse($doc->isEmbargoed(), "Document is not embargoed");
|
||||
$this->assertTrue($doc->isExpired(), "Document is expired");
|
||||
|
||||
$expireTime = "2019-04-05 11:43:13";
|
||||
$expireTime = "2069-12-12 17:10:13";
|
||||
$doc->expireAtDate($expireTime);
|
||||
$this->assertFalse($doc->isHidden(), "Document is not hidden");
|
||||
$this->assertFalse($doc->isEmbargoed(), "Document is not embargoed");
|
||||
@ -114,7 +114,7 @@ class DMSEmbargoTest extends SapphireTest
|
||||
$this->assertFalse($doc->isEmbargoed(), "Document is not embargoed");
|
||||
$this->assertFalse($doc->isExpired(), "Document is not expired");
|
||||
|
||||
$embargoTime = "2019-04-05 11:43:13";
|
||||
$embargoTime = "2069-12-12 17:10:13";
|
||||
$doc->embargoUntilDate($embargoTime);
|
||||
$this->assertTrue($doc->isHidden(), "Document is hidden");
|
||||
$this->assertTrue($doc->isEmbargoed(), "Document is embargoed");
|
||||
@ -142,7 +142,7 @@ class DMSEmbargoTest extends SapphireTest
|
||||
$doc->Folder = "0";
|
||||
$dID = $doc->write();
|
||||
|
||||
$s1->DocumentSets()->first()->getDocuments()->add($doc);
|
||||
$s1->getDocumentSets()->first()->getDocuments()->add($doc);
|
||||
|
||||
$s1->publish('Stage', 'Live');
|
||||
$s1->doPublish();
|
||||
|
@ -65,9 +65,9 @@ class MigrateToDocumentSetsTaskTest extends SapphireTest
|
||||
$this->assertContains('Skipped: already has a set: 1', $result);
|
||||
|
||||
// Test that some of the relationship records were written correctly
|
||||
$this->assertCount(1, $firstPageSets = $this->objFromFixture('SiteTree', 'one')->DocumentSets());
|
||||
$this->assertCount(1, $firstPageSets = $this->objFromFixture('SiteTree', 'one')->getDocumentSets());
|
||||
$this->assertSame('Default', $firstPageSets->first()->Title);
|
||||
$this->assertCount(1, $this->objFromFixture('SiteTree', 'two')->DocumentSets());
|
||||
$this->assertCount(1, $this->objFromFixture('SiteTree', 'two')->getDocumentSets());
|
||||
|
||||
// With dryrun enabled and being run the second time, nothing should be done
|
||||
$result = $this->runTask(array('action' => 'create-default-document-set', 'dryrun' => '1'));
|
||||
|
Loading…
Reference in New Issue
Block a user