[Vtigercrm-developers] Another bug in the PBXManager Migration Scripts...
Alan Lord
alanslists at gmail.com
Mon Sep 7 08:36:38 GMT 2015
Take a look at the block around 1340 in
vtiger-6.3.0/modules/Migration/schema/600_to_610.php...
> //Query to fetch asterisk extension
> $extensionResult = $adb->pquery('SELECT userid, asterisk_extension FROM vtiger_asteriskextensions', array());
> for ($i = 0; $i < $adb->num_rows($extensionResult); $i++) {
> $userId = $adb->query_result($extensionResult, 0, 'userid');
> $extensionNumber = $adb->query_result($extensionResult, 0, 'asterisk_extension');
> $adb->pquery('UPDATE vtiger_users SET phone_crm_extension = ? WHERE id = ?', array($extensionNumber, $userId));
> }
Notice how you have a counter $i for the number of rows found?
Notice how it *not* used to retrieve the results from each row - hint
you set it to 0. So this block of code will update admin's (or the first
user in the system by userid) extension number as many times as there
are users, but not update any other user in the system.
The whole PBXManager migration routine is totally broken. I am amazed
how nobody else seems to have noticed any of this...
Al
More information about the vtigercrm-developers
mailing list