|
Posted by Wescotte on 02/23/06 19:54
Create_Batch.php file
Function Create_Batch($Batch_Number, $EDI_Data)
{
switch( Detect_Type_of_EDI_File($EDI_Data) ) {
case "FDX":
include "EDI_Fedex.php";
echo "AFTER INCLUDE CHECK COMPANY NAME ($COMPANY_NAME_ID)<br>";
if ( !Extract_EDI_Data($Batch_Number, $EDI_Data) )
return false;
echo "AFTER BATCH CREATION CHECK COMPANY NAME
($COMPANY_NAME_ID)<br>";
break;
case "DHL":
include "EDI_DHL.php";
if ( !Extract_EDI_Data($Batch_Number, $EDI_Data) )
return false;
break;
default:
echo "ERROR! Unable to detect EDI file type <BR>";
return false;
break;
}
return !Duplicate_Batch_Found($Batch_Number);
}
EDI_Fedex.php file
<?php
include "EDI_STD_Functions.php";
$CURRENT_CHARGE = array();
$EDI_REFERENCE = "";
$PAYMENT_TYPE = "WIRE";
$COMPANY_NAME_ID = "FDX";
echo "OUTSIDE FUNCTION CHECK COMPANY NAME($COMPANY_NAME_ID)<br>";
$VENDOR_NUMBER = "97139";
Function Extract_EDI_Data($Batch_Number, $EDI_Data)
{
global $COMPANY_NAME_ID;
echo "INSIDE FUNCTION CHECK COMPANY NAME ($COMPANY_NAME_ID)<br>";
}
OUTPUT:
OUTSIDE FUNCTION CHECK COMPANY NAME(FDX)
AFTER INCLUDE CHECK COMPANY NAME (FDX)
INSIDE FUNCTION CHECK COMPANY NAME ()
AFTER BATCH CREATION CHECK COMPANY NAME (FDX)
If I use the global $COMPANY_NAME_ID; $COMPANY_NAME_ID = "FDX"; it
works for all 4 cases.
I did a FIND "$COMPANY_NAME_ID" * > search.txt
and here's the output from my entire source directory. There is no
other instances where I use this variable name so I'm completely
baffled as to what is causing this issue. I actually wrote a test case
matching the case 1 and 2 I spoke about above and both functioned
correctly.
---------- CLOSE_BATCH.PHP
---------- CONSTANTS.PHP
---------- CREATE_BATCH.PHP
echo "AFTER INCLUDE CHECK COMPANY NAME ($COMPANY_NAME_ID)<br>";
echo "AFTER BATCH CREATION CHECK COMPANY NAME
($COMPANY_NAME_ID)<br>";
---------- CREATE_EDI_TABLES.PHP
---------- CREATE_WIRE_FORM.PHP
---------- EDI_DHL.PHP
global $COMPANY_NAME_ID; $COMPANY_NAME_ID = "DHL";
global $COMPANY_NAME_ID, $EDI_REFERENCE, $REMITTANCE_EMAIL_ADDRESS;
echo "Creating remit file for $COMPANY_NAME_ID";
$query = "SELECT BATCHNUM FROM $TABLE_HEADER WHERE COMPID =
'$COMPANY_NAME_ID' AND PAYREF = '$Pay_Ref' AND PAYDATE = '$Pay_Date'";
echo "ERROR: Nothing to remit for Company: $COMPANY_NAME_ID PayRef:
$Pay_ref Date: $Pay_Date<br>";
$COMPANY_NAME_ID = "DHL";
return ( Build_Header_Detail($Batch_Number, $COMPANY_NAME_ID,
$EDI_REFERENCE) );
---------- EDI_FEDEX.PHP
$COMPANY_NAME_ID = "FDX";
echo "OUTSIDE FUNCTION CHECK COMPANY NAME($COMPANY_NAME_ID)<br>";
global $COMPANY_NAME_ID, $REMITTANCE_FILE_PATH, $REMITTANCE_FILE_NAME;
echo "Creating remit file for $COMPANY_NAME_ID";
$query = "SELECT BATCHNUM FROM $TABLE_HEADER WHERE COMPID =
'$COMPANY_NAME_ID' AND PAYREF = '$Pay_Ref' AND PAYDATE = '$Pay_Date'";
echo "ERROR: Nothing to remit for Company: $COMPANY_NAME_ID PayRef:
$Pay_ref Date: $Pay_Date<br>";
global $COMPANY_NAME_ID;
echo "INSIDE FUNCTION CHECK COMPANY NAME ($COMPANY_NAME_ID)<br>";
return ( Build_Header_Detail($Batch_Number, $COMPANY_NAME_ID,
$EDI_REFERENCE) );
---------- EDI_STD_FUNCTIONS.PHP
---------- FREIGHT_EDI.JS
---------- FREIGHT_EDI.PHP
---------- FREIGHT_EDI_DISPLAYBATCH.PHP
---------- GENERATE_GL_DATA.PHP
---------- GET_FEDEX_EDI_FILES.PHP
---------- OPEN_BATCH.PHP
---------- PAY_VENDOR.PHP
---------- PRINT_PAYMENT_FORM.PHP
---------- SAVE_BATCH.PHP
---------- SEARCH.TXT
---------- SENDREMIT.BAT
---------- SPLIT_CHARGE.HTML
---------- TOOLBAR_FREIGHT_EDI.HTML
---------- TOOLBAR_WORK_BATCH.HTML
---------- VALIDATE_GL_DATA.PHP
---------- WIRETRANSFERFORM.HTML
---------- WIRETRANSFERFORM.HTML.BACKUP
---------- WIRETRANSFORMLAYOUT.XLS
---------- WORK_BATCH.PHP
[Back to original message]
|