public static function saveInvoice($invoice) { $serializedItemsDetails['items'] = $invoice->getPropertyValue('items'); $products = isset($serializedItemsDetails['items']['products']) ? $serializedItemsDetails['items']['products'] : array(); $products = implode(',', $products); $invoice->addProperty(array('id' => 'serialized_items_info', 'type' => 'text', 'value' => serialize($serializedItemsDetails), 'is_system' => true)); $invoice->addProperty(array('id' => 'product_sid', 'type' => 'string', 'value' => $products, 'is_system' => true)); $invoice->deleteProperty('items'); $serializedTaxDetails['tax_info'] = $invoice->getPropertyValue('tax_info'); $invoice->addProperty(array('id' => 'serialized_tax_info', 'type' => 'text', 'value' => serialize($serializedTaxDetails), 'is_system' => true)); $invoice->deleteProperty('tax_info'); $user_sid = $invoice->getPropertyValue('user_sid'); $user_info = SJB_UserManager::getUserInfoBySID($user_sid); if (!empty($user_info['parent_sid'])) { $invoice->setPropertyValue('subuser_sid', $user_sid); $invoice->setPropertyValue('user_sid', $user_info['parent_sid']); } $dateProperty = $invoice->getProperty('date'); $value = $dateProperty->getValue(); if (!$dateProperty->type->getConvertToDBDate() && $value != null) { $invoice->setPropertyValue('date', SJB_I18N::getInstance()->getDate($value)); } $invoice->setPropertyValue('sub_total', SJB_I18N::getInstance()->getFloat($invoice->getPropertyValue('sub_total'))); $invoice->setPropertyValue('total', SJB_I18N::getInstance()->getFloat($invoice->getPropertyValue('total'))); parent::saveObject('invoices', $invoice); if ($value == null) { SJB_DB::query('UPDATE `invoices` SET `date`= NOW() WHERE `sid`=?n', $invoice->getSID()); } }
public static function saveTransaction($transaction) { parent::saveObject('transactions', $transaction); $date = $transaction->getPropertyValue('date'); if (empty($date)) { SJB_DB::query('UPDATE `transactions` SET `date`= NOW() WHERE `sid`=?n', $transaction->getSID()); } }
public static function saveGateway(&$gateway) { return parent::saveObject('payment_gateways', $gateway); }
public static function saveTax($taxInfo) { parent::saveObject('taxes', $taxInfo); }
public static function savePromotionCode($promotionCode) { parent::saveObject('promotions', $promotionCode); }