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
=== modified file 'preferences.php'
--- preferences.php 2010-02-10 16:14:58 +0000
+++ preferences.php 2010-03-12 21:55:22 +0000
@@ -584,19 +584,18 @@
584 $isDateTime[$colname->name] =($colname->type == "datetime" || $colname->type == "timestamp" ? 1 : 0);584 $isDateTime[$colname->name] =($colname->type == "datetime" || $colname->type == "timestamp" ? 1 : 0);
585585
586 if($sortable) { 586 if($sortable) {
587 if( ! in_array($colname->name, array($l->g(28)) ) ) {// Not grouping requests587 //With the security fix (Revisions 5,6 stable) not sorting on group requests
588 $vraiNomChamp = array_search( $colname->name, $_SESSION["storedRequest"]->select );588 //will actually cause sql errors, and not display the page. Just allow group
589 589 //request sorting.
590 /*if( ! $vraiNomChamp ) {590 $vraiNomChamp = array_search( $colname->name, $_SESSION["storedRequest"]->select );
591 $ind = array_search( $colname->name, $_SESSION["currentRegistry"] );591
592 $vraiNomChamp = urlencode("\"".$_SESSION["currentRegistry"][$ind]."\"");592 /*if( ! $vraiNomChamp ) {
593 }*/593 $ind = array_search( $colname->name, $_SESSION["currentRegistry"] );
594 594 $vraiNomChamp = urlencode("\"".$_SESSION["currentRegistry"][$ind]."\"");
595 if( ! $vraiNomChamp )595 }*/
596 $vraiNomChamp = array_search( $colname->name, $_SESSION["currentFieldList"] ); 596
597 }597 if( ! $vraiNomChamp )
598 else 598 $vraiNomChamp = array_search( $colname->name, $_SESSION["currentFieldList"] );
599 $vraiNomChamp = "\"".$colname->name."\"";
600 //echo "if( $vraiNomChamp == ".$_SESSION["c"]." || \"\'\".".$colname->name.".\"\'\" == ".$_SESSION["c"]." ) \";";599 //echo "if( $vraiNomChamp == ".$_SESSION["c"]." || \"\'\".".$colname->name.".\"\'\" == ".$_SESSION["c"]." ) \";";
601 echo "<td align='center'><table><tr><td>";600 echo "<td align='center'><table><tr><td>";
602 $hrefSort = "<a href=index.php?$pref&c=".urlencode($vraiNomChamp)."&a=$a&rev=1&page=1>";601 $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: