Ejemplo n.º 1
0
 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());
     }
 }
Ejemplo n.º 2
0
 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());
     }
 }
Ejemplo n.º 3
0
 public static function saveGateway(&$gateway)
 {
     return parent::saveObject('payment_gateways', $gateway);
 }
Ejemplo n.º 4
0
 public static function saveTax($taxInfo)
 {
     parent::saveObject('taxes', $taxInfo);
 }
Ejemplo n.º 5
0
 public static function savePromotionCode($promotionCode)
 {
     parent::saveObject('promotions', $promotionCode);
 }