Skip to content

Commit

Permalink
Merge pull request #1633 from SemanticMediaWiki/number
Browse files Browse the repository at this point in the history
NumberValue to check for NULL, refs #1628
  • Loading branch information
mwjames committed Jun 4, 2016
2 parents b334639 + 0bc6631 commit 8831536
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
"smw-sp-searchbyproperty-nonvaluequery": "A list of values that have the property \"$1\" assigned.",
"smw-sp-searchbyproperty-valuequery": "A list of pages that have property \"$1\" with value \"$2\" annotated.",
"smw-datavalue-number-textnotallowed": "\"$1\" can not be assigned to a declared number type with value $2.",
"smw-datavalue-number-nullnotallowed": "\"$1\" returned with a \"NULL\" which is not allowed as number.",
"smw-editpage-annotation-enabled":"This page supports semantic in-text annotations (e.g. <nowiki>\"[[Is specified as::World Heritage Site]]\"</nowiki>) to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the [https://www.semantic-mediawiki.org/wiki/Help:Getting_started getting started], [https://www.semantic-mediawiki.org/wiki/Help:In-text_annotation in-text annotation], or [https://www.semantic-mediawiki.org/wiki/Help:Inline_queries inline queries] help page.",
"smw-editpage-annotation-disabled":"This page is not enabled for semantic in-text annotations due to namespace restrictions. Details about how to enable the namespace is described on the [https://www.semantic-mediawiki.org/wiki/Help:Configuration configuration] help page.",
"smw-editpage-property-annotation-enabled":"This property can be extended using semantic annotations to specify a datatype (e.g. <nowiki>\"[[Has type::Page]]\"</nowiki>) or other supporting declarations (e.g. <nowiki>\"[[Subproperty of::dc:date]]\"</nowiki>). For a description on how to augment this page, see the [https://www.semantic-mediawiki.org/wiki/Help:Property_declaration declaration of a property] or the [https://www.semantic-mediawiki.org/wiki/Help:List_of_datatypes list of available data types] help page.",
Expand Down
2 changes: 2 additions & 0 deletions includes/datavalues/SMW_DV_Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ protected function parseUserValue( $value ) {
$this->addErrorMsg( array( 'smw_infinite', $value ) );
} elseif ( $this->getTypeID() === '_num' && $unit !== '' ) {
$this->addErrorMsg( array( 'smw-datavalue-number-textnotallowed', $unit, $number ) );
} elseif ( $number === null ) {
$this->addErrorMsg( array( 'smw-datavalue-number-nullnotallowed', $value ) ); // #1628
} elseif ( $this->convertToMainUnit( $number, $unit ) === false ) { // so far so good: now convert unit and check if it is allowed
$this->addErrorMsg( array( 'smw_unitnotallowed', $unit ) );
} // note that convertToMainUnit() also sets m_dataitem if valid
Expand Down

0 comments on commit 8831536

Please sign in to comment.