Open Source Training Seminar FreePBX Paid Support

Ticket #1659 (closed Bugs: fixed)

Opened 2 years ago

Last modified 1 year ago

Patch to fix #1487 Queue number 0

Reported by: naftali5 Assigned to: naftali5
Priority: major Milestone: 2.3
Component: Queues Version: 2.3-branch
Keywords: Cc:
Confirmation: SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

this is a fix for #1487

I also took the liberty to comment out the check for an extension beginning with 0 eg. 01234, as it was blocked not as a matter of concept, but because of the same bug. (two typos and one mistake)

firstly the sql table has to be fixed. as there is no install.sql or install.php, i decided not to make one, but to post the sql here.

ALTER TABLE `queues` CHANGE `id` `id` VARCHAR( 45 ) NOT NULL DEFAULT '-1'

i chose 45 as the field size to match the extensions table.

the diff follows

Index: page.queues.php
===================================================================
--- page.queues.php     (revision 3557)
+++ page.queues.php     (working copy)
@@ -151,7 +151,7 @@
        <h2><?php echo _("Add Queue"); ?></h2>
 <?php } ?>

-<?php          if ($extdisplay){ ?>
+<?php          if ($extdisplay != ''){ ?>
        <p><?php echo $delButton ?></p>
 <?php          } ?>
        <form autocomplete="off" name="editQ" action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
@@ -160,7 +160,7 @@
        <table>
        <tr><td colspan="2"><h5><?php echo ($extdisplay ? _("Edit Queue") : _("Add Queue")) ?><hr></h5></td></tr>
        <tr>
-<?php          if ($extdisplay){ ?>
+<?php          if ($extdisplay != ''){ ?>
                <input type="hidden" name="account" value="<?php echo $extdisplay; ?>">
 <?php          } else { ?>
                <td><a href="#" class="info"><?php echo _("queue number:")?><span><?php echo _("Use this number to dial into the queue, or transfer callers to this number to put them into the queue.<br><br>Agents will dial this queue number plus * to log onto the queue, and this queue number plus ** to log out of the queue.<br><br>For example, if the queue number is 123:<br><br><b>123* = log in<br>123** = log out</b>")?></span></a></td>
@@ -535,7 +535,7 @@
                 }
                 whichitem++;
         }
-
+/*
         var gotoType = theForm.elements[ "goto0" ].value;
         if (gotoType == 'custom') {
                 var gotoVal = theForm.elements[ "custom0"].value;
@@ -544,12 +544,13 @@
                                                <?php echo "alert('"._("Custom Goto contexts must contain the string \"custom\".  ie: custom-app,s,1")."')"?>;
                 }
         }
-
+*/
         $account = theForm.account.value;
         if ($account == "") {
                 <?php echo "alert('"._("Queue Number must not be blank")."')"?>;
                 bad="true";
         }
+/*
        else if ($account == "0") {
                 <?php echo "alert('"._("Queue Number can not be 0")."')"?>;
                 bad="true";
@@ -558,7 +559,7 @@
                 <?php echo "alert('"._("Queue numbers with more than one digit cannot begin with 0")."')"?>;
                 bad="true";
         }
-
+*/
         if ($queuename == "") {
                 <?php echo "alert('"._("Queue name must not be blank")."')"?>;
                 bad="true";

while i was at it, i removed the javascript check for the word custom in the goto, because thanks to groogs that is no longer required.

hope noone gets upset that i set it as major... but shimi is right, it should be a blocker.

Change History

01/08/07 21:05:04 changed by naftali5

what is this doing in newinstall.sql?!?

--
-- Table structure for table `queues`
--

DROP TABLE IF EXISTS `queues`;
CREATE TABLE `queues` (
  `id` bigint(11) NOT NULL default '-1',
  `keyword` varchar(20) NOT NULL default '',
  `data` varchar(150) NOT NULL default '',
  `flags` int(1) NOT NULL default '0',
  PRIMARY KEY  (`id`,`keyword`,`data`)
) ENGINE=MyISAM;

actually not the only module which doesn't handle its own table. probably still left from pre-module days. but it needs to be fixed as above.

ALTER TABLE `queues` CHANGE `id` `id` VARCHAR( 45 ) NOT NULL DEFAULT '-1'

and i'm not sure where to put it. so i'm leaving that up to you.

01/08/07 22:30:38 changed by naftali5

put a hold on this... I found another bug.

01/08/07 23:09:00 changed by naftali5

ok, the above diff should be replaced with this one. one got by me the first time.

Index: page.queues.php
===================================================================
--- page.queues.php     (revision 3557)
+++ page.queues.php     (working copy)
@@ -151,16 +151,16 @@
        <h2><?php echo _("Add Queue"); ?></h2>
 <?php } ?>

-<?php          if ($extdisplay){ ?>
+<?php          if ($extdisplay != ''){ ?>
        <p><?php echo $delButton ?></p>
 <?php          } ?>
        <form autocomplete="off" name="editQ" action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
        <input type="hidden" name="display" value="<?php echo $dispnum?>">
-       <input type="hidden" name="action" value="<?php echo ($extdisplay ? 'edit' : 'add') ?>">
+       <input type="hidden" name="action" value="<?php echo (($extdisplay != '') ? 'edit' : 'add') ?>">
        <table>
        <tr><td colspan="2"><h5><?php echo ($extdisplay ? _("Edit Queue") : _("Add Queue")) ?><hr></h5></td></tr>
        <tr>
-<?php          if ($extdisplay){ ?>
+<?php          if ($extdisplay != ''){ ?>
                <input type="hidden" name="account" value="<?php echo $extdisplay; ?>">
 <?php          } else { ?>
                <td><a href="#" class="info"><?php echo _("queue number:")?><span><?php echo _("Use this number to dial into the queue, or transfer callers to this number to put them into the queue.<br><br>Agents will dial this queue number plus * to log onto the queue, and this queue number plus ** to log out of the queue.<br><br>For example, if the queue number is 123:<br><br><b>123* = log in<br>123** = log out</b>")?></span></a></td>
@@ -535,7 +535,7 @@
                 }
                 whichitem++;
         }
-
+/*
         var gotoType = theForm.elements[ "goto0" ].value;
         if (gotoType == 'custom') {
                 var gotoVal = theForm.elements[ "custom0"].value;
@@ -544,12 +544,13 @@
                                                <?php echo "alert('"._("Custom Goto contexts must contain the string \"custom\".  ie: custom-app,s,1")."')"?>;
                 }
         }
-
+*/
         $account = theForm.account.value;
         if ($account == "") {
                 <?php echo "alert('"._("Queue Number must not be blank")."')"?>;
                 bad="true";
         }
+/*
        else if ($account == "0") {
                 <?php echo "alert('"._("Queue Number can not be 0")."')"?>;
                 bad="true";
@@ -558,7 +559,7 @@
                 <?php echo "alert('"._("Queue numbers with more than one digit cannot begin with 0")."')"?>;
                 bad="true";
         }
-
+*/
         if ($queuename == "") {
                 <?php echo "alert('"._("Queue name must not be blank")."')"?>;
                 bad="true";

also the retrieve script has to be changed.

Index: retrieve_queues_conf_from_mysql.pl
===================================================================
--- retrieve_queues_conf_from_mysql.pl  (revision 3557)
+++ retrieve_queues_conf_from_mysql.pl  (working copy)
@@ -57,7 +57,7 @@
        $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
 }

-$statement = "SELECT keyword,data from $table_name where id=0 and keyword <> 'account'";
+$statement = "SELECT keyword,data from $table_name where id='-1' and keyword <> 'account'";
 my $result = $dbh->selectall_arrayref($statement);
 unless ($result) {
   # check for errors after every single database call
@@ -99,7 +99,7 @@
        my $account = @{ $row }[0];
        my $id = @{ $row }[1];
        print EXTEN "[$account]\n";
-       $statement = "SELECT keyword,data from $table_name where id=$id and keyword <> 'account' order by flags";
+       $statement = "SELECT keyword,data from $table_name where id='$id' and keyword <> 'account' order by flags";
        my $result = $dbh->selectall_arrayref($statement);
        unless ($result) {
                # check for errors after every single database call

and just to have everything in one post, here is the sql which must be run.

ALTER TABLE `queues` CHANGE `id` `id` VARCHAR( 45 ) NOT NULL DEFAULT '-1'

02/06/07 10:25:15 changed by naftali5

  • owner set to naftali5.
  • status changed from new to assigned.
  • engine_version changed.
  • svn_rev changed.

partially fixed in 2.2 branch in r3744

06/30/07 09:36:05 changed by p_lindheimer

  • type changed from Patches to Bugs.

changing to a bug to review and apply in 2.3 as necessary

06/30/07 09:40:05 changed by p_lindheimer

  • version changed from 2.2 to 2.3-branch.

08/02/07 05:22:51 changed by p_lindheimer

  • status changed from assigned to closed.
  • resolution set to fixed.
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads