Commit Graph

639 Commits

Author SHA1 Message Date
Ingo Schommer
892b772d1c Merge pull request #2616 from Zauberfisch/3.1
Check if remote class exists in DataObject->getRemoteJoinField()
2013-12-19 11:05:13 -08:00
Sean Harvey
8ea8789ba7 Merge pull request #2721 from froog/year_fix
FIX: Year.php getDefaultOptions now fixed, sets key as year. Also added YearTest unit test.
2013-12-18 21:55:48 -08:00
Jayden Seric
0b24d520f9 Update SQLQuery.php
Updated `SQLQuery` class code examples for functions `setOrderBy` and `addOrderBy` to use their new names.
2013-12-18 10:00:31 +11:00
Daniel Pickering
94c19e349a FIX: Year.php getDefaultOptions now fixed, sets key as year. Also added YearTest unit test. 2013-12-16 03:29:29 +00:00
Ingo Schommer
c811556ea5 Removed debug code 2013-12-13 10:04:26 +01:00
Ingo Schommer
be5484b1d2 Leave original ValidationException intact in write()
If we want DataObject->validate() to be used instead of
the form layer, we should allow for validation errors
to be passed through unchanged to the controller layer
so we can present them to the user. The context of
which class is written should be apparent from the stacktrace
of the exception.
2013-12-11 00:41:05 +01:00
Will Rossiter
20e082d00e Tidy up enum matching where classname is missing 2013-12-07 12:18:58 +13:00
Will Rossiter
ed61dd848e Separate out SS_Query and MySQLQuery from their Database classes
Coding conventions state one class per file (unless it uses an _ to indicate related classes.
2013-11-28 11:55:25 +13:00
Ingo Schommer
305fea8163 Merge pull request #2660 from icecaster/patch-1
Scaffolded Enum Search fields dont offer a null selection
2013-11-22 11:55:56 -08:00
Ingo Schommer
70207b0c98 Merge pull request #2626 from Zauberfisch/filterByCallback
filterByCallback added to SS_Filterable interface and implemented in ArrayList
2013-11-21 05:34:36 -08:00
Zauberfisch
d9b74874fc added filterByCallback() to interface SS_Filterable and all implementing classes 2013-11-21 13:03:18 +00:00
Will Rossiter
0e89c4b6cd API: Implement SS_Map::push() to append values.
FIX: SS_Map::count() not taking into account additional firstItems
2013-11-18 20:38:57 +13:00
Tim
2e369ecc53 FIX: scaffolded search field null selection by default
Enum search fields should default to having an empty string set
2013-11-13 15:13:27 +13:00
Zauberfisch
4b138cfe0b Check if remote class exists in DataObject->getRemoteJoinField() 2013-11-09 22:43:30 +00:00
Damian Mooyman
c74f7e7640 BUG Fixes issue where items could be deleted from a has_many relation by an entirely unrelated HasManyList calling delete on that item. 2013-11-01 11:39:13 +13:00
Damian Mooyman
22f5f4d644 BUG Fix undefined index ID 2013-10-30 10:34:09 +13:00
Ingo Schommer
dfabd54bdb Fixed support for single stage in Versioned
This used to work in 2.4, so is considered a regression.
To test, simply add a Versioned("Stage") extension to
some record in 2.4 vs. 3.1.
2013-10-24 17:09:17 +02:00
Ingo Schommer
ed6e45610f Merge pull request #2572 from Zauberfisch/api-getRemoteJoinField-enhancement-2570
API: DataObject->getRemoteJoinField() no longer defaults to ParentID but throws an exception instead
2013-10-23 13:59:37 -07:00
Andrew Short
156bb87d57 FIX: Move stage choosing into a pre-request filter.
This ensures that the correct stage is selected, even if the request
does not come through the model as controller system. This fixes an
issue where custom controllers would always be on the "Stage" stage.
2013-10-23 18:29:13 +13:00
Zauberfisch
32bb98b0d7 API: DataObject->getRemoteJoinField() no longer defaults to ParentID but throws an exception instead 2013-10-21 04:11:00 +00:00
Zauberfisch
8de1ce4a56 array check to ensure getRemoteJoinField() gets an array from Config::inst()->get($remoteClass, 'has_one') (related issue: #2570) 2013-10-21 04:04:28 +00:00
Ingo Schommer
1bcd4c9a6a Merge pull request #2531 from ajshort/pull-5
Correct some incorrect PHPDoc definitions.
2013-10-13 01:36:16 -07:00
Andrew Short
c082dc3bd1 Correct some incorrect PHPDoc definitions. 2013-10-13 18:59:53 +11:00
Ingo Schommer
795d3e4b3b Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	dev/install/install.php5
	docs/en/index.md
	tests/core/CoreTest.php
2013-10-07 16:18:20 +02:00
Sean Harvey
8b2e1f2e7c Merge pull request #2328 from chillu/pulls/versioned-archivemode-validation
Validate 'archiveDate' user data in Versioned
2013-10-03 14:33:22 -07:00
Damian Mooyman
afaf7f6b4e BUG Sort column order maintained correctly when using expressions in SQLQuery and DataQuery 2013-10-03 14:20:31 +13:00
Ingo Schommer
f18ece11ca Revert "Fixes silverstripe/silverstripe-framework#1910: shortcodes not parsed in RSS feeds"
This reverts commit 306281ed44.
Breaks HTMLTextTest
2013-09-30 22:40:47 +02:00
Ingo Schommer
b291f3d0cd Merge pull request #2446 from jamesgoodmandia/rss-feed-placeholders
Fixes silverstripe/silverstripe-framework#1910: shortcodes not parsed in...
2013-09-30 13:01:19 -07:00
Andrew Short
43fab1088a Add a getter for the HasManyList foreign key. 2013-09-27 15:06:55 +10:00
James Goodman
306281ed44 Fixes silverstripe/silverstripe-framework#1910: shortcodes not parsed in RSS feeds 2013-09-23 16:20:06 +12:00
Ingo Schommer
b9e205abbf Allow <link/> in HTMLText->exists() (fixes #850) 2013-09-18 11:39:29 +02:00
Ingo Schommer
ba5984e2bf Only compare array notations in SQLQuery->getOrderedJoins()
If more than two $from were added through SQLQuery->addFrom(),
the getOrderedJoins() comparison kicks in. It assumes all $from
parts are in array notation, which isn't always the case.
For legacy reasons, and because we don't have full API support,
you can still add literal joins through addFrom('INNER JOIN ...').
On PHP 5.3, the ordering comparison still works because it
allows array access in strings, with string rather than numeric indexes.
Thankfully that's no longer supported in PHP 5.4.
2013-09-17 22:08:48 +02:00
Russell Michell
3aaa12f114 FIX: Fixes #2398
- hasAmount() failed to return true for values <= 0.99 and >= 0.01
- Added unit tests
2013-09-13 12:21:21 +12:00
Ingo Schommer
03d1d58148 Merge remote-tracking branch 'origin/3.0' into 3.1
Conflicts:
	admin/code/SecurityAdmin.php
	css/AssetUploadField.css
	docs/en/topics/configuration.md
	security/PermissionRole.php
2013-09-12 17:33:36 +02:00
Ingo Schommer
c2b312d76f Merge remote-tracking branch 'origin/3.1.0' into 3.1 2013-09-12 17:24:42 +02:00
Ingo Schommer
5e0315dc62 Safety note on DataObject::validation_enabled 2013-09-12 15:42:43 +02:00
Ingo Schommer
cb517fda9e Safety note on DataObject::$validation_enabled 2013-09-12 15:42:36 +02:00
Sean Harvey
95bb799e6f BUG Fixing SQLQuery::aggregate() adding ORDER BY when no limit.
DataQuery::initialiseQuery() will add a default sort to a query,
and when calling up an aggregate it will make a query like this
which doesn't make sense:

SELECT MAX("LastEdited") FROM "Member" ORDER BY "ID"

In this case there is no need to add the ORDER BY, and it will
break databases like MSSQL in cases such as
GenericTemplateGlobalProvider
which provides a default List() function for adding aggregates
into SSViewer template cacheblocks.

If we add a limit, however, then it does make sense:

SELECT MAX("LastEdited") FROM "Member" ORDER BY "ID" LIMIT 10

This fixes SQLQuery::aggregate() to NOT add an ORDER BY to an
aggregate call if there is no limit.
2013-09-06 18:11:11 +12:00
Johannes Hammersen, x75
b8495da5d9 BUG Cached images stored in wrong folder
If multiple image manipulations are performend the resulting cached image is stored in assets/_resampled because the cached version of the image has no ParentID, which cacheFilename needs to set the correct path.
2013-08-26 10:16:42 +02:00
Ingo Schommer
4a3a88710f Merge remote-tracking branch 'origin/3.1.0' into 3.1
Conflicts:
	dev/BehatFixtureFactory.php
	model/Hierarchy.php
	tests/behat/features/bootstrap/FeatureContext.php
	tests/core/CoreTest.php
2013-08-22 13:00:25 +02:00
Ingo Schommer
40c239076b Merge remote-tracking branch 'origin/3.0' into 3.1.0
Conflicts:
	model/Hierarchy.php
2013-08-22 12:55:47 +02:00
Simon Welsh
c66cc952d2 Correct line length and indentation 2013-08-21 21:27:16 +12:00
Simon Welsh
151baeede1 Correct line length and indentation 2013-08-21 18:54:05 +12:00
Ingo Schommer
a6da1f5570 Merge pull request #2294 from wilr/fixgridexport
FIX: Remove limit on GridField export
2013-08-20 14:08:18 -07:00
Will Rossiter
c7bdfcd76a Merge pull request #2293 from robert-h-curry/empty-arraylist
Preempt fatal errors when making some function calls on an empty ArrayList
2013-08-17 16:53:48 -07:00
Ingo Schommer
74f65540a2 Validate 'archiveDate' user data in Versioned
Not a security issue as such, since the user input is sanitized
before being used in Versioned->augmentSQL(). But it shouldn't
reach the session state either, since that's commonly assumed
to be sanitized data, and it leaves unnecessary room for error.

strtotime() has fairly loose validation rules around dates,
but its a good "first line of defence".
2013-08-15 22:17:38 +02:00
Ingo Schommer
0e40b779c9 UTF8 defaults for MySQLDatabase->createDatabase()
Doesn't have much effect in practice, because charset and collation
are already hardcoded on an ALTER TABLE level (field definitions),
which take priority. Since most MySQL installs will still default
to a latin1 encoding, this propagates to the table though,
confusing devs and in some cases causing wrong data.

Example: A MSSQL->MySQL DB migration tool used the table metadata
to determine the charset, creating encoding issues.

In terms of hardcoding, we don't really support anything other than UTF8,
and the field-level settings are already hardcoded.

We should probably remove the field-specific settings and rely
on the DB defaults, but that's a sensitive API change
(need to set on existing DBs during upgrade).
2013-08-15 12:49:15 +02:00
Will Rossiter
65d96e8d7c FIX: Remove limit on GridField export
Allow DataList::limit() to take a null value to remove the limit.

Added tests for limit(). Note the one failure, currently the ORM doesn't support unlimited values with an offset.
2013-08-05 19:59:12 +12:00
Robert Curry
d69520bd70 Preempt fatal errors when making some function calls on an empty ArrayList
The function "first" on ArrayList uses the PHP function "reset", which
returns false if there aren't any elements in the array. Two functions
inside ArrayList use this function, "canFilterBy" and "byID". I've
changed these functions to catch the possibility of a false return from
first().
2013-08-05 15:47:58 +12:00
Damian Mooyman
b3ca4a275b BUG Fixed divide by zero with SetRatioSize on missing image file
Fixes issue #2047
2013-07-23 11:24:48 +12:00