/** * @param String $productType Valid values are defined in the database: quickbooks_item_supplements.product_type. * @param String $size Valid values are defined in the database: quickbooks_item_supplements.size. * @param String $idBase A quickbooks_items.id with everything before the "-" (e.g., 1400 for 1400-1) * @param String $imageType Valid values include: Label, Label1, CaseLabel, Marketing1, Marketing2, Marketing3, and Packaged * @return True of False if the image exists of not */ function doesProductImageExist($productType, $size, $idBase, $imageType) { return file_exists(getProductImagePath($productType, $size, $idBase, $imageType)); }
unset($packToRowMap[1]); // Sort the array keys (which are the pack values) in numerica ascending order. ksort($packToRowMap); foreach ($packToRowMap as $pack => $multipleItemRow) { // Create the "Group Information" panel for each pack value. $groupInformationComponents = array(); array_push($groupInformationComponents, getExtComponent("Item Number", $multipleItemRow[$itemNumberKey])); array_push($groupInformationComponents, getExtComponent("UPC", getEncodedUpcCode($multipleItemRow[$upcKey]))); array_push($groupInformationComponents, getExtComponent("Gross Weight (lbs.)", $multipleItemRow[$grossWeightLbKey])); array_push($groupInformationComponents, getExtComponent("Pack / Unit (oz.)", "{$multipleItemRow[$packKey]} / {$multipleItemRow[$unitWeightOzKey]}")); array_push($groupInformationComponents, getExtComponent("Case Cube", $multipleItemRow[$caseCubeKey])); array_push($groupInformationComponents, getExtComponent("Ti x Hi", "{$multipleItemRow[$casesPerPalletLayerKey]} / {$multipleItemRow[$caseLayersPerPalletKey]}")); array_push($groupInformationComponents, getExtComponent("Case (L'' X W'' X H'')", $multipleItemRow[$caseDimensionsKey])); array_push($groupInformationComponents, getExtComponent("Production Code", $multipleItemRow[$productionCodeKey])); if (doesProductImageExist($productType, $size, $idBase, "CaseLabel")) { array_push($imageFilePaths, getProductImagePath($productType, $size, $idBase, "CaseLabel")); array_push($groupInformationComponents, getExtComponent("Case Label", getProductImageHtml($productType, $size, $idBase, "CaseLabel"))); } $groupInformationPanel = getExtFormPanel("Group Information ({$pack})", $groupInformationComponents); array_push($extPanels, $groupInformationPanel); } // Determine whether a PDF needs to be generated for this product or not. $pdfPath = getPdfPath($productType, $size); $pdfExists = true; if (file_exists($pdfPath)) { // Since the file exists, we need to determine if it has outdated information. $pdfLastModifiedTime = filemtime($pdfPath); $pdfLastModifiedTimeKey = "pdfLastModifiedTime"; $quickBooksItemIdQuery = createSqlQuery("SELECT qbi.id", ", FROM_UNIXTIME({$pdfLastModifiedTime}) as '{$pdfLastModifiedTimeKey}'", ", qbi.last_modified_time as '{$qbiLastModifiedTimeKey}'", ", qbis.last_modified_time as '{$qbisLastModifiedTimeKey}'", ", nl.last_modified_time as '{$nlLastModifiedTimeKey}'", ", si.last_modified_time as '{$siLastModifiedTimeKey}'", ", pc.last_modified_time as '{$pcLastModifiedTimeKey}'", ", ks.last_modified_time as '{$ksLastModifiedTimeKey}'", "FROM (((((quickbooks_items qbi", "LEFT JOIN quickbooks_item_supplements qbis ON qbi.quickbooks_item_supplement_id = qbis.id)", "LEFT JOIN nutrition_labels nl ON qbis.nutrition_label_id = nl.id)", "LEFT JOIN storage_infos si ON qbis.storage_info_id = si.id)", "LEFT JOIN production_codes pc ON qbis.production_code_id = pc.id)", "LEFT JOIN kosher_statuses ks ON qbis.kosher_status_id = ks.id)", "WHERE qbi.id LIKE '{$idBase}-%'", "AND (qbi.last_modified_time > FROM_UNIXTIME({$pdfLastModifiedTime})", "OR qbis.last_modified_time > FROM_UNIXTIME({$pdfLastModifiedTime})", "OR nl.last_modified_time > FROM_UNIXTIME({$pdfLastModifiedTime})", "OR si.last_modified_time > FROM_UNIXTIME({$pdfLastModifiedTime})", "OR pc.last_modified_time > FROM_UNIXTIME({$pdfLastModifiedTime})", "OR ks.last_modified_time > FROM_UNIXTIME({$pdfLastModifiedTime}))"); $result = queryDb($quickBooksItemIdQuery); if (mysql_num_rows($result) == 0) {