Merge lp:~simonsp/ocsinventory-ocsreports/fix-sort-tag-page into lp:ocsinventory-ocsreports/stable-1.3

Proposed by Paul W. Simons
Status: Needs review
Proposed branch: lp:~simonsp/ocsinventory-ocsreports/fix-sort-tag-page
Merge into: lp:ocsinventory-ocsreports/stable-1.3
Diff against target: 35 lines (+12/-13)
1 file modified
preferences.php (+12/-13)
To merge this branch: bzr merge lp:~simonsp/ocsinventory-ocsreports/fix-sort-tag-page
Reviewer Review Type Date Requested Status
OCS Inventory Dev Team Pending
Review via email: mp+21291@code.launchpad.net

Description of the change

This fixes an issue where the tag would silently not sort as can be seen in ver 1.02, and fixes the issue where sorting on Computer count causes an SQL error which can be seen after revision 6 in ocsreports-stable.

The security fix in revision number 6 escaped the quotes in $_POST and $_GET. This caused the sql to break when trying to sort on the tag page by Computer count.

Code was put in place to handle sorting of Computer count differently. This patch removes that code so that sorting on Computer count doesn't send the language file entry as the contents to be sorted, eg. "Computer count" (with the quotes), and instead treats it the way all other sorts are treated.

I checked the trunk branch, and this bug does not exist there. The trunk properly sorts on the tag page.

To post a comment you must log in.

Unmerged revisions

48. By Paul W. Simons

This fixes an issue where the tag would silently not sort as can be seen in ver 1.02, and fixes the issue where sorting on Computer count causes an SQL error which can be seen after revision 6 in ocsreports-stable.

The security fix in revision number 6 escaped the quotes in $_POST and $_GET. This caused the sql to break when trying to sort on the tag page by Computer count.

Code was put in place to handle sorting of Computer count differently. This patch removes that code so that sorting on Computer count doesn't send the language file entry as the contents to be sorted, eg. "Computer count" (with the quotes), and instead treats it the way all other sorts are treated.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'preferences.php'
2--- preferences.php 2010-02-10 16:14:58 +0000
3+++ preferences.php 2010-03-12 21:55:22 +0000
4@@ -584,19 +584,18 @@
5 $isDateTime[$colname->name] =($colname->type == "datetime" || $colname->type == "timestamp" ? 1 : 0);
6
7 if($sortable) {
8- if( ! in_array($colname->name, array($l->g(28)) ) ) {// Not grouping requests
9- $vraiNomChamp = array_search( $colname->name, $_SESSION["storedRequest"]->select );
10-
11- /*if( ! $vraiNomChamp ) {
12- $ind = array_search( $colname->name, $_SESSION["currentRegistry"] );
13- $vraiNomChamp = urlencode("\"".$_SESSION["currentRegistry"][$ind]."\"");
14- }*/
15-
16- if( ! $vraiNomChamp )
17- $vraiNomChamp = array_search( $colname->name, $_SESSION["currentFieldList"] );
18- }
19- else
20- $vraiNomChamp = "\"".$colname->name."\"";
21+ //With the security fix (Revisions 5,6 stable) not sorting on group requests
22+ //will actually cause sql errors, and not display the page. Just allow group
23+ //request sorting.
24+ $vraiNomChamp = array_search( $colname->name, $_SESSION["storedRequest"]->select );
25+
26+ /*if( ! $vraiNomChamp ) {
27+ $ind = array_search( $colname->name, $_SESSION["currentRegistry"] );
28+ $vraiNomChamp = urlencode("\"".$_SESSION["currentRegistry"][$ind]."\"");
29+ }*/
30+
31+ if( ! $vraiNomChamp )
32+ $vraiNomChamp = array_search( $colname->name, $_SESSION["currentFieldList"] );
33 //echo "if( $vraiNomChamp == ".$_SESSION["c"]." || \"\'\".".$colname->name.".\"\'\" == ".$_SESSION["c"]." ) \";";
34 echo "<td align='center'><table><tr><td>";
35 $hrefSort = "<a href=index.php?$pref&c=".urlencode($vraiNomChamp)."&a=$a&rev=1&page=1>";

Subscribers

People subscribed via source and target branches

to status/vote changes: