Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #10296: Problem with 0 equals empty string fixed
- Loading branch information
1 parent
f1fbdbb
commit 29bb025
Showing
1 changed file
with
17 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -594,23 +594,29 @@ function getGroupSum($surveyid, $lang) | |
|
||
|
||
/** | ||
* getMaxGroupOrder($surveyid) queries the database for the maximum sortorder of a group and returns the next higher one. | ||
* | ||
* @param mixed $surveyid | ||
*/ | ||
* Queries the database for the maximum sortorder of a group and returns the next higher one. | ||
* | ||
* @param string|int $surveyid | ||
* @return int | ||
*/ | ||
function getMaxGroupOrder($surveyid) | ||
{ | ||
$s_lang = Survey::model()->findByPk($surveyid)->language; | ||
$queryResult = QuestionGroup::model()->find(array( | ||
'order' => 'group_order desc', | ||
'limit' => '1' | ||
)); | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
olleharstedt
Author
Contributor
|
||
//$max_sql = "SELECT max( group_order ) AS max FROM ".db_table_name('groups')." WHERE sid =$surveyid AND language='{$s_lang}'" ; | ||
$query = QuestionGroup::model()->find(array('order' => 'group_order desc')); | ||
$current_max = !is_null($query) ? $query->group_order : ''; | ||
$current_max = !is_null($queryResult) ? $queryResult->group_order : ""; | ||
|
||
if($current_max!="") | ||
if($current_max !== "") | ||
{ | ||
$current_max += 1; | ||
return $current_max; | ||
} | ||
else | ||
{ | ||
return ++$current_max ; | ||
return 0; | ||
} | ||
else return "0" ; | ||
} | ||
|
||
|
||
|
You are pulling the maximum group order from ALL groups in the whole system - shouldn't this be limited to the current survey?