} } } $foCon->deleteFeatureForOffer($offerId); } } if (isset($_POST['features'])) { if (!isset($featureIds)) { $featureIds = array(); } foreach ($_POST['features'] as $featureId) { $featureIds[] = $featureId; } } if (!isset($editResult)) { $result = $offerCon->updateOffer($offerId, $_POST['txtSellerId'], $_POST['txtCarId'], $_POST['txtDescription'], $_POST['txtStatus'], $_POST['txtPreferredPrice']); if ($result->errorInfo()[2] == null) { if (isset($media)) { $imageErrors = array(); foreach ($media as &$image) { $imageInsert['result'] = $mediaCon->insertMedia($image['dbName'], $image['filePath'], $offerId); if ($imageInsert['result']->errorInfo()[2] != null) { $imageErrors[$image['name']] = $imageInsert['result']->errorInfo()[2]; } } if (!empty($imageErrors)) { $editResult = array('images' => $imageErrors); } } if (isset($featureIds)) { $featureErrors = array();
$offerCon = new OfferController(); $featureCon = new FeatureController(); $foCon = new Feature_OfferController(); $mediaCon = new MediaController(); $carCon = new CarController(); $makeCon = new MakeController(); $modelCon = new ModelController(); $saleCon = new SaleController(); $empCon = new EmployeeController(); if (isset($_POST['hdnAction'])) { if ($_POST['hdnAction'] == 'insert') { $result = $saleCon->insertSale($_POST['txtOfferId'], $_POST['txtEmpId'], $_POST['txtBuyerId'], $_POST['txtDeductions'], $_POST['txtTotal']); if ($result->errorInfo()[2] == null) { $offer = $offerCon->getOffer($_POST['txtOfferId']); $offer = $offer->fetch(); $result = $offerCon->updateOffer($offer['offer_id'], $offer['seller_id'], $offer['car_id'], $offer['description'], 'sold', $offer['preferred_price']); if ($result->errorInfo()[2] == null) { $addResult = true; } else { $addResult = $result->errorInfo()[2]; } } else { $addResult = $result->errorInfo()[2]; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8">