Changeset 8633

Show
Ignore:
Timestamp:
01/17/10 06:28:07 (3 years ago)
Author:
mbrevda
Message:

re #4007

  • Add conditional gui for legace_email support
  • modify variables/sql statements to remove 'fax' prefix from column

headers

  • DB need to be modified as follows: ' ALTER TABLE fax_incoming DROP

COLUMN faxenabled, CHANGE faxdetection detection varchar(20), CHANGE
faxdetectionwait detectionwait varchar(5), CHANGE faxdestination
destination varchar(50);'

  • To add legacy_email field do: 'ALTER TABLE fax_incoming ADD COLUMN

legacy_email varchar(50) default null;'

  • Install script updated to reflect new db schema
  • If you do not feel compfertable updating the db, just uninstall the

fax module, do sn svn update, and reinstall

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.7/fax/functions.inc.php

    r8631 r8633  
    211211    } 
    212212    $fax=fax_get_incoming($extension,$cidnum); 
    213     if($fax){ 
    214       foreach($fax as $key => $value){ 
    215         if(substr($key,0,3)=='fax'){ 
    216           $fax[substr($key,3)]=$value; 
    217           unset($key); 
    218         } 
    219       } 
    220     } 
    221213  }else{ 
    222214  $fax=null; 
     
    281273    } 
    282274    $html.='</select></td></tr>'; 
    283     $html.='';//legecay fax stuff goes here 
    284     $html.='<tr><td><a href="#" class="info">'._("Fax Destination").'<span>'._('Where to send the call if we detect that its a fax').'.</span></a>:</td>'; 
    285     $html.='</tr>'; 
    286     $html.=$fax_detect?drawselects(isset($fax['destination'])?$fax['destination']:null,'FAX'):''; 
     275    if($fax['legacy_email']){ 
     276      $html.='<tr><td><a href="#" class="info">'._("Fax Email Destination").'<span>'._('Address to email faxes to on fax detection.<br />PLEASE NOTE: In current versions of FreePBX, you can set the fax destination from a list of destination as you would pick destinations in other areas of FreePBX. This email option has been migrated from the legecay fax implementation in FreePBX prior to version 2.7. To upgrade this option to the full destination list, please enter \'clear\' in this field and hit submit. You will then be upgraded. THIS PROCEDURE IS NON REVERSABEL!!').'.</span></a>:</td>'; 
     277      $html.='<td><input name="faxlegacyemail" value="'.$fax['legacy_email'].'"></td></tr>'; 
     278    }else{ 
     279      $html.='<tr><td><a href="#" class="info">'._("Fax Destination").'<span>'._('Where to send the call if we detect that its a fax').'.</span></a>:</td></tr>'; 
     280      $html.=$fax_detect?drawselects(isset($fax['destination'])?$fax['destination']:null,'FAX'):''; 
     281    } 
    287282    $html.='</table>'; 
    288283    $html.='<table>'; 
     
    323318  $extension=isset($_REQUEST['extension'])?$_REQUEST['extension']:''; 
    324319  $extdisplay=isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:''; 
    325   $faxenabled=isset($_REQUEST['faxenabled'])?$_REQUEST['faxenabled']:''; 
    326   $faxdetection=isset($_REQUEST['faxdetection'])?$_REQUEST['faxdetection']:''; 
    327   $faxdetectionwait=isset($_REQUEST['faxdetectionwait'])?$_REQUEST['faxdetectionwait']:''; 
     320  $enabled=isset($_REQUEST['faxenabled'])?$_REQUEST['faxenabled']:''; 
     321  $detection=isset($_REQUEST['faxdetection'])?$_REQUEST['faxdetection']:''; 
     322  $detectionwait=isset($_REQUEST['faxdetectionwait'])?$_REQUEST['faxdetectionwait']:''; 
    328323  $dest=(isset($_REQUEST['gotoFAX'])?$_REQUEST['gotoFAX'].'FAX':null); 
    329324  $dest=isset($_REQUEST[$dest])?$_REQUEST[$dest]:''; 
    330  
     325  $legacy_email=isset($_REQUEST['egacy_email'])?$_REQUEST['egacy_email']:''; 
     326  if($legacy_email=='clear'){$legacy_email=null;} 
     327   
    331328  if ($display == 'did' && isset($action) && $action!=''){ 
    332329    fax_delete_incoming($extdisplay); //remove mature entry on edit or delete 
    333     if (($action == 'edtIncoming'||$action == 'addIncoming')&& $faxenabled=='true'){ 
    334       fax_save_incoming($cidnum,$extension,$faxenabled,$faxdetection,$faxdetectionwait,$dest); 
    335  
    336   } 
    337 } 
    338  
    339  
    340 function fax_save_incoming($cidnum,$extension,$faxenabled,$faxdetection,$faxdetectionwait,$dest){ 
    341   global $db; 
    342   sql("INSERT INTO fax_incoming (cidnum, extension, faxenabled, faxdetection, faxdetectionwait, faxdestination) VALUES ('".$db->escapeSimple($cidnum)."', '".$db->escapeSimple($extension)."', '".$db->escapeSimple($faxenabled)."', '".$db->escapeSimple($faxdetection)."', '".$db->escapeSimple($faxdetectionwait)."', '".$db->escapeSimple($dest)."')"); 
     330    if (($action == 'edtIncoming'||$action == 'addIncoming')&& $enabled=='true'){ 
     331      fax_save_incoming($cidnum,$extension,$enabled,$detection,$detectionwait,$dest,$legacy_email); 
     332 
     333  } 
     334} 
     335 
     336 
     337function fax_save_incoming($cidnum,$extension,$enabled,$detection,$detectionwait,$dest,$legacy_email){ 
     338  global $db; 
     339  sql("INSERT INTO fax_incoming (cidnum, extension, enabled, detection, detectionwait, destination, legacy_email) VALUES ('".$db->escapeSimple($cidnum)."', '".$db->escapeSimple($extension)."', '".$db->escapeSimple($faxenabled)."', '".$db->escapeSimple($faxdetection)."', '".$db->escapeSimple($faxdetectionwait)."', '".$db->escapeSimple($dest)."','".$db->escapeSimple($legacy_email)."')"); 
    343340} 
    344341 
  • modules/branches/2.7/fax/install.php

    r8588 r8633  
    1313  `cidnum` varchar(20) default NULL, 
    1414  `extension` varchar(20) default NULL, 
    15   `faxenabled` varchar(15) default NULL, 
    16   `faxdetection` varchar(20) default NULL, 
    17   `faxdetectionwait` varchar(5) default NULL, 
    18   `faxdestination` varchar(50) default NULL 
     15  `detection` varchar(20) default NULL, 
     16  `detectionwait` varchar(5) default NULL, 
     17  `destination` varchar(50) default NULL, 
     18  `legacy_email` varchar(50) default NULL, 
    1919)'; 
    2020