Re: PHP and RedBack COM objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please note.. some debugging code does exist. Also the server maybe just misconfigured... it comes with no documentation of where to put the .ini file that pairs with the COM object.

Here you go:

<?
//Response.Expires = 0
ini_set("max_execution_time","0");
error_reporting(0);
//' This function demonstrates how to extract values from a multivalued field
function ExtractMultiValues($redField)
{
$strValue = "";
echo $redFiled->Count . " ";
if ($redField->Count > 1){
for($count=1;$count <= $redField->Count;$count++)
{
if (strlen(trim($strValue)) > 0)
$strValue = $strValue . $redField->Value($count-1) . "<br>";
else
$strValue = $redField->Value($count-1) . "<br>";
}
}
else
$strValue = $redField->Value(0);
return $strValue;
}


$oInv = new COM("RedBack.RedObject");
//error_log("Created RedObject\n",3,"d:/php/phpdebug.txt");
$rField = new COM("RedBack.RedField");
//error_log("Created RedField\n",3,"d:/php/phpdebug.txt");
$oInv->Open2("summit", "SBO:GetAllInventory");
//error_log("Opened Summit\n",3,"d:/php/phpdebug.txt");
$oInv->callMethod("GetAllInv_RB");
//error_log("Called GetAllInv_RB\n",3,"d:/php/phpdebug.txt");
?>
<html>
<head>
<title>Test Get All Inventory</title>
</head>
<body>
<form action="" method="post">
<INPUT TYPE="submit" name="logoff" onClick="this.form.action='./GetAllInventory.asp';" VALUE="Select">
<?
//' Now we set the value to a RedField and convert the VMs and SVMs to something the eye can understand
$rField->StringValue = $oInv->internalInventoryIDs;
$strInternalInvIDs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->externalInventoryIDs;
//$strExternalInvIDs = ExtractMultiValues($rField);
$strExternalInvIDs = $rField->Value(0);
print_r(get_object_vars($oInv));
$rField->StringValue = $oInv->descriptions;
$strDescriptions = ExtractMultiValues($rField);
$rField->StringValue = $oInv->typeCodes;
$strTypeCodes = ExtractMultiValues($rField);
$rField->StringValue = $oInv->priceTypes;
$strPriceTypes = ExtractMultiValues($rField);
$rField->StringValue = $oInv->beginningEffectiveDates;
$strBegEffectiveDates = ExtractMultiValues($rField);
$rField->StringValue = $oInv->endingEffectiveDates;
$strEndEffectiveDates = ExtractMultiValues($rField);
$rField->StringValue = $oInv->prices;
$strPrices = ExtractMultiValues($rField);
$rField->StringValue = $oInv->qualifyingVolumes;
$strQualifyingVolumes = ExtractMultiValues($rField);
$rField->StringValue = $oInv->commissionableVolumes;
$strCommissionableVolumes = ExtractMultiValues($rField);
$rField->StringValue = $oInv->taxBases;
$strTaxBases = ExtractMultiValues($rField);
$rField->StringValue = $oInv->vatTaxInclFlgs;
$strVatTaxInclFlgs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->redemptionValues;
$strRedemptionValues = ExtractMultiValues($rField);
$rField->StringValue = $oInv->maxQuantities;
$strMaxQuantities = ExtractMultiValues($rField);
$rField->StringValue = $oInv->suggestedRetailPrices;
$strSuggestedRetailPrices = ExtractMultiValues($rField);
$rField->StringValue = $oInv->vatTaxRetailInclFlgs;
$strVatTaxRetailInclFlgs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->countries;
$strCountries = ExtractMultiValues($rField);
$rField->StringValue = $oInv->shipWeights;
$strShipWeights = ExtractMultiValues($rField);
$rField->StringValue = $oInv->methodsOfMeasure;
$strMethodsOfMeasure = ExtractMultiValues($rField);
$rField->StringValue = $oInv->unitsPerCase;
$strUnitsPerCase = ExtractMultiValues($rField);
$rField->StringValue = $oInv->singleUnitInternalIDs;
$strSingleUnitInternalIDs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->singleUnitExternalIDs;
$strSingleUnitExternalIDs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->singleUnitDescs;
$strSingleUnitDescs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->componentInternalIDs;
$strComponentInteralIDs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->componentExternalIDs;
$strComponentExternalIDs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->componentDescriptions;
$strComponentDescriptions = ExtractMultiValues($rField);
$rField->StringValue = $oInv->componentQuantities;
$strComponentQuantities = ExtractMultiValues($rField);
$rField->StringValue = $oInv->warrantyMonths;
$strWarrantyMonths = ExtractMultiValues($rField);
$rField->StringValue = $oInv->alternateInventoryIDs;
$strAlternateInventoryIDs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->descriptionLongs;
$strDescriptionLongs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->personalizationPromptIDs;
$strPersonalizationPromptIDs = ExtractMultiValues($rField);
$rField->StringValue = $oInv->personalizationPrompts;
$strPersonalizationPrompts = ExtractMultiValues($rField);
$rField->StringValue = $oInv->personalizationPromptMessages;
$strPersonalizationPromptMessages = ExtractMultiValues($rField);
$rField->StringValue = $oInv->personalizationPromptValueTypes;
$strPersonalizationPromptValueTypes = ExtractMultiValues($rField);
$rField->StringValue = $oInv->personalizationPromptTextLength;
$strPersonalizationPromptTextLength = ExtractMultiValues($rField);
$rField->StringValue = $oInv->personalizationPromptMandatoryFlgs;
$strPersonalizationPromptMandatoryFlgs = ExtractMultiValues($rField);
?>
<table border="1">
<tr><td colspan=6 align=center><a href='./index.html'>Back to Index</a></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Internal Inventory IDs:</td><td align=left valign="top"><?= $strInternalInvIDs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">External Inventory ID:</td><td align=left valign="top"><?=$strExternalInvIDs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Descrptions:</td><td align=left valign="top"><?= $strDescriptions;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Type Codes:</td><td align=left valign="top"><?= $strTypeCodes;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Price Types:</td><td align=left valign="top"><?= $strPriceTypes;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Beginning Effective Dates:</td><td align=left valign="top"><?= $strBegEffectiveDates;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Ending Effective Dates:</td><td align=left valign="top"><?= $strEndEffectiveDates;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Prices:</td><td align=left valign="top"><?= $strPrices;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Qualifying Volume:</td><td align=left valign="top"><?= $strQualifyingVolumes;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Commissionable Volume:</td><td align=left valign="top"><?= $strCommissionableVolumes;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Tax Bases:</td><td align=left valign="top"><?= $strTaxBases?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Vat Tax Inclusion Flags:</td><td align=left valign="top"><?= $strVatTaxInclFlgs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Redemption Values:</td><td align=left valign="top"><?= $strRedemptionValues;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Maximum Quantities Allowed:</td><td align=left valign="top"><?= $strMaxQuantities;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Suggested Retail Price:</td><td align=left valign="top"><?= $strSuggestedRetailPrices;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Vat tax Retail Inclusion Flags:</td><td align=left valign="top"><?= $strVatTaxRetailInclFlgs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Countries:</td><td align=left valign="top"><?= $strCountries;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Shipping Weights:</td><td align=left valign="top"><?= $strShipWeights;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Methods of Weight Measure:</td><td align=left valign="top"><?= $strMethodsOfMeasure;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Units per Case:</td><td align=left valign="top"><?= $strUnitsPerCase;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Single Unit Internal IDs:</td><td align=left valign="top"><?= $strSingleUnitInternalIDs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Single Unit External IDs:</td><td align=left valign="top"><?= $strSingleUnitExternalIDs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Single Unit DescriptionsD:</td><td align=left valign="top"><?= $strSingleUnitDescs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Component Internal IDs:</td><td align=left valign="top"><?= $strComponentInteralIDs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Component External IDs:</td><td align=left valign="top"><?= $strComponentExternalIDs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Component Descriptions:</td><td align=left valign="top"><?= $strComponentDescriptions;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Component Quantities:</td><td align=left valign="top"><?= $strComponentQuantities;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Warranty Months:</td><td align=left valign="top"><?= $strWarrantyMonths;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Alternate Inventory IDs:</td><td align=left valign="top"><?= $strAlternateInventoryIDs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Long Descriptions:</td><td align=left valign="top"><?= $strDescriptionLongs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Personalization Prompt IDs:</td><td align=left valign="top"><?= $strPersonalizationPromptIDs;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Personalization Prompts:</td><td align=left valign="top"><?= $strPersonalizationPrompts;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Personalization Prompt Messages:</td><td align=left valign="top"><?= $strPersonalizationPromptMessages;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Personalization Prompt Value Types:</td><td align=left valign="top"><?= $strPersonalizationPromptValueTypes;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Personalization Prompt Text Length:</td><td align=left valign="top"><?= $strPersonalizationPromptTextLength;?></td></tr>
<tr><td width=10>&nbsp;</td><td align=left valign="top">Personalization Prompt Mandatory Flags:</td><td align=left valign="top"><?= $strPersonalizationPromptMandatoryFlgs;?></td></tr>
</table>
</form>
</body>
</html>


Jason Barnett wrote:
Hey Brian, can you just put the code inline?  I didn't get the attachment.



Brian E wrote:

Hello.

I'm trying to access RedBack COM objects (Redback is a garbage DB that one of my clients has purchased) through PHP rather than documented ASP.

I can Create the objects just fine and make the initial Calls to the methods... but when I try to view the String results, I get Object types returning. I am attaching an example code.

Thanks.

Brian

-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux