The problem is, I don't know that it's the code that's the problem. It's still working fine for any of the client files that were in existence
before the upgrade to FM 12. The error is only coming up with any of the clients that have been added
since the upgrade. Basically, it's telling me that new client files don't exist in the database, which they do, but it's finding the old client files perfectly and behaving just as it should for those. But here's the code for the applicable pages...
New Case Page:
<?php require_once('Connections/Warranty_table.php'); ?>
<?php
$found_records_find = $Warranty_table->newFindCommand('Cases_Detail');
$found_records_findCriterions = array('_kf_CustomerID'=>$_REQUEST['__kp_CustomerID'],);
foreach($found_records_findCriterions as $key=>$value) {
$found_records_find->AddFindCriterion($key,$value);
}
fmsSetPage($found_records_find,'found_records',10);
$found_records_result = $found_records_find->execute();
if(FileMaker::isError($found_records_result)) fmsTrapError($found_records_result,"error.php");
fmsSetLastPage($found_records_result,'found_records',10);
$found_records_row = current($found_records_result->getRecords());
$found_records__CUSTOMERS_portal = fmsRelatedRecord($found_records_row, 'CUSTOMERS');
$found_records__ITEMCODES_portal = fmsRelatedRecord($found_records_row, 'ITEMCODES');
$found_records__casesCASESsameCustomer_portal = fmsRelatedRecord($found_records_row, 'cases_CASES_sameCustomer');
$found_records__NOTEScreatenew_portal = fmsRelatedRecord($found_records_row, 'NOTES_createnew');
$found_records__NOTES_portal = fmsRelatedRecord($found_records_row, 'NOTES');
$found_records__WORKORDER_portal = fmsRelatedRecord($found_records_row, 'WORKORDER');
<form action="new_case_response.php" method="post" name="new_case" id="new_case">
<table>
<tr>
<td colspan="2" align="right"><h3><strong>Customer ID:</strong> <?php echo $found_records_row->getField('_kf_CustomerID',0); ?></h3></td>
</tr>
<tr>
<td width="100px"><strong>Invoice Number:</strong></td>
<td><input type="text" name="Invoice_Number" value="" /></td>
</tr>
<td><strong>Purchaser Name:</strong></td>
<td><input name="Purchaser_Name" type="text" value="" size="40" /></td>
<tr>
<td><strong>Date Of Purchase:</strong></td>
<td><input type="text" name="Date_Of_Purchase" value="" /><br />(mm/dd/yyyy)</td>
</tr>
<tr>
<td><strong>Furniture Type:</strong></td>
<td><select name="Furniture_Type2" id="Furniture_Type">
<?php
foreach(fmsValueListItems2($Warranty_table,'Cases_Detail','Furniture Type',"",null,"") as $list_item) {
if(html_entity_decode($list_item[0]) == "") {
echo "<option value=\"{$list_item[0]}\" selected=\"selected\">{$list_item[1]}</option>\n";
} else {
echo "<option value=\"{$list_item[0]}\">{$list_item[1]}</option>\n";
}
}
fmsValueListCustomChoice(null);
?>
</select></td>
</tr>
<tr>
<td><strong>Warranty Protection Code:</strong></td>
<td><input type="text" name="Warranty_Item_Code" value="" /></td>
</tr>
<tr>
<td colspan="2">Examples: CA-GWEND or WC-GWCP01</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><strong>Problem & Cause:</strong><br />
Please be specific in describing the problem(s). List <strong>EACH</strong> item that has a problem by name or item code. Describe <strong>WHAT</strong> the problem is, <strong>WHERE</strong> it is located as if you are standing and facing the front of the item, <strong>HOW</strong> the problem was caused, and any other relevant information such as size or what cleaning products you have already used. </td>
</tr>
<tr>
<td colspan="2"><textarea name="Problem" cols="135" rows="7"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="new_case_submit" value="Next" />
<input name="__kp_CustomerID" type="hidden" value="<?php echo $found_records_row->getField('_kf_CustomerID'); ?>" id="_kf_CustomerID"></td>
</tr>
</table>
</form>
<p> </p>
</div>
<!-- End Page Body -->
</body>
</html>
PHP for the New Case Handling Page:
<?php require_once('Connections/Warranty_table.php'); ?>
<?php $new_case_add = $Warranty_table->newAddCommand('Cases_Detail');
$new_case_fields = array('Invoice Number'=>$_REQUEST['Invoice_Number'],'Date Of Purchase'=>$_REQUEST['Date_Of_Purchase'],'Furniture Type'=>@($_REQUEST['Furniture_Type2']),'Warranty Item Code'=>$_REQUEST['Warranty_Item_Code'],'Problem'=>$_REQUEST['Problem'],'_kf_CustomerID'=>$_REQUEST['__kp_CustomerID'],'Purchaser_Name'=>$_REQUEST['Purchaser_Name'],'Status'=>'Online',);
foreach($new_case_fields as $key=>$value) {
$new_case_add->setField($key,$value);
}
$new_case_result = $new_case_add->execute();
if(FileMaker::isError($new_case_result)) fmsTrapError($new_case_result,"error.php");
$new_case_row = current($new_case_result->getRecords());
Client Profile Page:
<?php require_once('Connections/Warranty_table.php'); ?>
<?php
$customer_find = $Warranty_table->newFindCommand('Customers_Detail');
$customer_findCriterions = array('Email'=>'=='.fmsEscape($_SESSION["Warranty_table_tableLogin"]["user"]),'Password'=>'=='.fmsEscape($_SESSION["Warranty_table_tableLogin"]["pass"]),);
foreach($customer_findCriterions as $key=>$value) {
$customer_find->AddFindCriterion($key,$value);
}
fmsSetPage($customer_find,'customer',10);
$customer_result = $customer_find->execute();
if(FileMaker::isError($customer_result)) fmsTrapError($customer_result,"error.php");
fmsSetLastPage($customer_result,'customer',10);
$customer_row = current($customer_result->getRecords());
$customer__WORKORDER_portal = fmsRelatedRecord($customer_row, 'WORKORDER');
$customer__CASES_portal = fmsRelatedRecord($customer_row, 'CASES');
<h2><?php echo $customer_row->getField('CustomerName'); ?>
</h2>
<p>Welcome to your Customer Profile Page! Below you will see all of your personal information that you have entered. If there are any mistakes or if you need to update your information, you can click on Edit Profile. <br /><br />
<a href="new_case.php?__kp_CustomerID=<?php echo $customer_row->getField('__kp_CustomerID'); ?>"><input type="submit" name="new_case" id="new_case" value="Create New Case"></a>
<br />
</p>
</div>
<table align="center" name="results_table" style="background-color: #000000; width: 600px;" cellspacing="1">
<tr>
<th bgcolor="#EEEEEE" width="135" align="left">Customer ID</th>
<td bgcolor="#FFFFFF" colspan="5"><?php echo $customer_row->getField('__kp_CustomerID'); ?></td>
</tr>
<tr>
<th bgcolor="#EEEEEE" align="left">Customer Name</th>
<td bgcolor="#FFFFFF" colspan="5"><?php echo $customer_row->getField('CustomerName'); ?></td>
</tr>
<tr>
<th bgcolor="#EEEEEE" align="left">Alternate Contact</th>
<td bgcolor="#FFFFFF" colspan="5"><?php echo $customer_row->getField('AlternateContact'); ?></td>
</tr>
<tr>
<th bgcolor="#EEEEEE" align="left">Phone Number</th>
<td bgcolor="#FFFFFF" colspan="5"><?php echo $customer_row->getField('CustPhone'); ?></td>
</tr>
<tr>
<th bgcolor="#EEEEEE" align="left">Alt. Phone Number</th>
<td bgcolor="#FFFFFF" colspan="5"><?php echo $customer_row->getField('Alternate_Phone'); ?></td>
</tr>
<tr>
<th bgcolor="#EEEEEE" align="left">Email</th>
<td bgcolor="#FFFFFF" colspan="5"><?php echo $customer_row->getField('Email'); ?></td>
</tr>
<tr>
<th bgcolor="#EEEEEE" align="left">Address</th>
<td bgcolor="#FFFFFF" colspan="5"><?php echo $customer_row->getField('Address'); ?></td>
</tr>
<tr>
<th bgcolor="#EEEEEE" align="left">City</th>
<td bgcolor="#FFFFFF" width="225"><?php echo $customer_row->getField('City'); ?></td>
<th bgcolor="#EEEEEE" align="left">State</th>
<td bgcolor="#FFFFFF" width="35"><?php echo $customer_row->getField('State'); ?></td>
<th bgcolor="#EEEEEE" align="left">Zip Code</th>
<td bgcolor="#FFFFFF" width="75"><?php echo $customer_row->getField('Zip Code'); ?></td>
</tr>
<tr>
<th bgcolor="#EEEEEE" align="left">Password</th>
<td bgcolor="FFFFFF"><?php echo $customer_row->getField('Password'); ?></td>
<td cellpadding="2px" colspan="4" align="center" bgcolor="#FFFFFF"><a href="edit_profile.php?__kp_CustomerID=<?php echo $customer_row->getField('__kp_CustomerID'); ?>"> Edit Profile Info</a></td>
</tr>
</table>