Open Source Training Seminar FreePBX Paid Support

Ticket #1882 (closed Bugs: wontfix)

Opened 1 year ago

Last modified 1 year ago

retrieve_op_conf_from_mysql.pl sort order wrong

Reported by: andrew4455 Assigned to: p_lindheimer
Priority: minor Milestone: 2.3
Component: Flash Operator Panel Version: 2.3-branch
Keywords: fop sort Cc:
Confirmation: SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

The option FOPSORT in /etc/amportal.conf can be defined as either extension or lastname.
When set to lastname, the sort doesn't work, for two reasons. The original regex doesn't do a great job, and $b_var is never assigned.

Sorry not in diff format, I've made lots of other mods.

sub by_lastname {
        $a_var = $a->[0];
        $b_var = $b->[0];
        ($a_firstname,$a_lastname)=$a_var=~/^\s*([0-9A-Za-z_\-\s.]*)\s+([^0-9][0-9A-Za-z_\-.]*).*$/;
        ($b_firstname,$b_lastname)=$b_var=~/^\s*([0-9A-Za-z_\-\s.]*)\s+([^0-9][0-9A-Za-z_\-.]*).*$/;
        if (!$a_lastname) {$a_lastname=$a_var;}
        if (!$b_lastname) {$b_lastname=$b_var;}
        $sortResult=lc $a_lastname cmp lc $b_lastname;
        if ($sortResult == 0)
        { $sortResult=lc $a_firstname cmp lc $b_firstname }
        return $sortResult;
        }

Change History

06/09/07 03:14:14 changed by p_lindheimer

  • version changed from 2.2.1 to 2.3-branch.

06/30/07 09:20:12 changed by p_lindheimer

  • owner set to lazytt.

this is the diff, can someone confirm if this is ok to put in this change and close this bugg.

Index: retrieve_op_conf_from_mysql.pl
===================================================================
--- retrieve_op_conf_from_mysql.pl      (revision 4264)
+++ retrieve_op_conf_from_mysql.pl      (working copy)
@@ -425,12 +425,13 @@
 
 sub by_lastname {
        $a_var = $a->[0];
-       ($a_firstname,$a_lastname)=$a_var=~/^\s*([0-9A-Za-z_.]*)\s+([0-9A-Za-z_.]*).*$/;
-       ($b_firstname,$b_lastname)=$b_var=~/^\s*([0-9A-Za-z_.]*)\s+([0-9A-Za-z_.]*).*$/;
+       $b_var = $b->[0];
+       ($a_firstname,$a_lastname)=$a_var=~/^\s*([0-9A-Za-z_\-\s.]*)\s+([^0-9][0-9A-Za-z_\-.]*).*$/;
+       ($b_firstname,$b_lastname)=$b_var=~/^\s*([0-9A-Za-z_\-\s.]*)\s+([^0-9][0-9A-Za-z_\-.]*).*$/;
        if (!$a_lastname) {$a_lastname=$a_var;}
        if (!$b_lastname) {$b_lastname=$b_var;}
        $sortResult=lc $a_lastname cmp lc $b_lastname;
-       if ($sortResult == 0) 
+       if ($sortResult == 0)
        { $sortResult=lc $a_firstname cmp lc $b_firstname }
        return $sortResult;
 }

06/30/07 09:22:21 changed by p_lindheimer

r4281 - lazytt, can you confirm this is ok so I can backport it to 2.2 branch. Add comment and close if all is good.

07/15/07 12:39:55 changed by lazytt

  • owner changed from lazytt to p_lindheimer.

Phil- the patch doesn't work. When I apply the changes manually, it still doesnt sort alphabetically. Here are my changes in case you want to double check them:

sub by_lastname {
	$a_var = $a->[0];
	$b_var = $b->[0];
	($a_firstname,$a_lastname)=$a_var=~/^\s*([0-9A-Za-z_\-\s.]*)\s+([^0-9][0-9A-Za-z_\-.]*).*$/;
       ($b_firstname,$b_lastname)=$b_var=~/^\s*([0-9A-Za-z_\-\s.]*)\s+([^0-9][0-9A-Za-z_\-.]*).*$/;
	if (!$a_lastname) {$a_lastname=$a_var;}
	if (!$b_lastname) {$b_lastname=$b_var;}
	$sortResult=lc $a_lastname cmp lc $b_lastname;
	if ($sortResult == 0) 
	{ $sortResult=lc $a_firstname cmp lc $b_firstname }
	return $sortResult;
}

07/16/07 04:40:43 changed by lazytt

  • status changed from new to closed.
  • resolution set to wontfix.

Never mind - this has nothing to do with Phil. The patch simply doesnt work. Im going to close the ticket for now. andrew4455, if you can provide more info, feel free to reopen.

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads