$expressionText = ""; foreach ($paymentTerm->LicenseTextLink as $licenseTextLink) { $expressionText .= $textArray[(string) $licenseTextLink["href"]] . "\n\n"; } $expressionObj->documentText = $expressionText; $expressionObj->lastUpdateDate = "0000-00-00 00:00:00"; $expressionObj->productionUseInd = "0"; $expressionObj->save(); $expressionID = $expressionObj->primaryKey; } } if ($_POST['generalTerms'] === "on") { foreach ($xml->GeneralTerms->GeneralTerm as $generalTerm) { //get the expressionTypeID -- create expressionType if necessary $expression = preg_replace('/^onixPL\\:/s', '', $generalTerm->GeneralTermType); $index = searchForShortName($expression, $expressionTypeArray); if ($index !== null) { $expressionTypeID = $expressionTypeArray[$index]['expressionTypeID']; $expressionTypeObj = new ExpressionType(new NamedArguments(array('primaryKey' => $expressionTypeID))); } else { $expressionTypeObj = new ExpressionType(); $expressionTypeObj->shortName = $expression; $expressionTypeObj->noteType = "Internal"; $expressionTypeObj->save(); $expressionTypeID = $expressionTypeObj->primaryKey; $expressionTypeArray = $expressionTypeObj->allAsArray(); $expressionTypeInserted++; } $expressionObj = new Expression(); $expressionObj->documentID = $documentID; $expressionObj->expressionTypeID = $expressionTypeID;
} } // If Subject is mapped, check to see if it exists $generalDetailSubjectLinkIDArray = array(); foreach ($jsonData['subject'] as $subject) { $generalSubjectID = null; if ($subject['column'] === "") { continue; } if ($subject['delimiter'] !== "") { $subjectArray = array_map('trim', explode($subject['delimiter'], $data[intval($subject['column']) - 1])); } else { $subjectArray = array(trim($data[intval($subject['column']) - 1])); } foreach ($subjectArray as $currentSubject) { $index = searchForShortName($currentSubject, $generalSubjectArray); if ($index !== null) { $generalSubjectID = $generalSubjectArray[$index]['generalSubjectID']; } else { if ($index === null && $currentSubject != '') { $generalSubjectObj = new GeneralSubject(); $generalSubjectObj->shortName = $currentSubject; $generalSubjectObj->save(); $generalSubjectID = $generalSubjectObj->primaryKey; $generalSubjectArray = $generalSubjectObj->allAsArray(); $generalSubjectInserted++; } } if ($generalSubjectID !== null) { $generalDetailSubjectLinkObj = new GeneralDetailSubjectLink(); $generalDetailID = $generalDetailSubjectLinkObj->getGeneralDetailID($generalSubjectID, -1);