diff --git a/LICENCE b/LICENCE index 6516df4..46a69c8 100755 --- a/LICENCE +++ b/LICENCE @@ -3,7 +3,7 @@ is, unless otherwise specified, released under the MIT licence as follows: ----- begin license block ----- -Copyright 2008-2012 Alistair Kearney, Allen Chang, Scott Hughes +Copyright 2008-2014 Alistair Kearney, Allen Chang, Scott Hughes Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index f02b512..0d29742 100755 --- a/README.md +++ b/README.md @@ -1,12 +1,5 @@ # Number Field -- Version: 1.6.1 -- Author: Symphony Team (team@symphony-cms.com) -- Release Date: 25th February, 2013 -- Requirements: Symphony 2.3.2 - -## Overview - Input field that provides built-in number validation and numeric sorting. ## Installation diff --git a/extension.meta.xml b/extension.meta.xml index 3c5de79..ec2e939 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -1,19 +1,22 @@ - + Number Field Dedicated number storage https://github.com/symphonycms/numberfield - http://symphony-cms.com/discuss/thread/144/ + http://getsymphony.com/discuss/thread/144/ Field Types Symphony Team - http://symphony-cms.com + http://getsymphony.com + + - Support Symphony 2.5+ + - Update `ImportableField` support - Add Russian language diff --git a/fields/field.number.php b/fields/field.number.php index be69ad0..29d3b94 100755 --- a/fields/field.number.php +++ b/fields/field.number.php @@ -161,7 +161,7 @@ public function prepareImportValue($data, $mode, $entry_id = null) { */ public function getExportModes() { return array( - 'getUnformatted' => ExportableField::UNFORMATTED, + 'getUnformatted' => ExportableField::UNFORMATTED, 'getPostdata' => ExportableField::POSTDATA ); } @@ -192,6 +192,52 @@ public function prepareExportValue($data, $mode, $entry_id = null) { Filtering: -------------------------------------------------------------------------*/ + /** + * Returns the keywords that this field supports for filtering. Note + * that no filter will do a simple 'straight' match on the value. + * + * @since Symphony 2.6.0 + * @return array + */ + public function fetchFilterableOperators() + { + return array( + array( + 'title' => 'is', + 'filter' => ' ', + 'help' => __('Find values that are an exact match for the given number.') + ), + array( + 'title' => 'less than', + 'filter' => 'less than ', + 'help' => __('Less than %s', array('$x')) + ), + array( + 'title' => 'equal to or less than', + 'filter' => 'equal to or less than ', + 'help' => __('Equal to or less than %s', array('$x')) + ), + array( + 'title' => 'greater than', + 'filter' => 'greater than ', + 'help' => __('Greater than %s', array('$x')) + ), + array( + 'title' => 'equal to or greater than', + 'filter' => 'equal to or greater than ', + 'help' => __('Equal to or greater than %s', array('$x')) + ), + array( + 'title' => 'between', + 'filter' => 'x to y', + 'help' => __('Find values between two values with, %s to %s', array( + '$x', + '$y' + )) + ), + ); + } + public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false) { $field_id = $this->get('id'); $expression = " `t$field_id`.`value` "; @@ -205,7 +251,7 @@ public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = fal } // Equal to or less/greater than X - else if(preg_match('/^(equal to or )?(less|greater) than (-?(?:\d+(?:\.\d+)?|\.\d+))$/i', $data[0], $match)) { + else if(preg_match('/^(equal to or )?(less|greater) than\s*(-?(?:\d+(?:\.\d+)?|\.\d+))$/i', $data[0], $match)) { switch($match[2]) { case 'less': @@ -229,7 +275,7 @@ public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = fal } // Look for <=/< or >=/> symbols - else if(preg_match('/^(=?[<>]=?) (-?(?:\d+(?:\.\d+)?|\.\d+))$/i', $data[0], $match)) { + else if(preg_match('/^(=?[<>]=?)\s*(-?(?:\d+(?:\.\d+)?|\.\d+))$/i', $data[0], $match)) { $joins .= " LEFT JOIN `tbl_entries_data_$field_id` AS `t$field_id` ON (`e`.`id` = `t$field_id`.entry_id) "; $where .= sprintf(