本文整理汇总了PHP中Transaction::Save方法的典型用法代码示例。如果您正苦于以下问题:PHP Transaction::Save方法的具体用法?PHP Transaction::Save怎么用?PHP Transaction::Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction::Save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Send
public function Send(Transaction $trans)
{
if (is_null($trans->id)) {
$trans->Save();
}
$result = self::result($trans);
$obj = is_object($trans->metadata) ? clone $trans->metadata : new \stdClass();
$obj->network_test = 'false';
$obj->x_response_code = '1';
$obj->x_amount = sprintf('%.2f', $trans->amount);
$obj->TransactionCardType = self::card_type($result->type);
$obj->CardHoldersName = $trans->name;
$obj->x_trans_id = $trans->id;
$obj->x_MD5_Hash = self::hash($trans);
$retr = self::send_impl($trans, $obj);
$trans->Save();
return $retr;
}
示例2: Transaction
$arrCheckedAssetCode[] = $strAssetCode;
}
if (!$blnError && $objNewAsset instanceof Asset) {
$objAssetArray[] = $objNewAsset;
}
} else {
$strWarning .= "Please enter an asset code.<br />";
}
}
if (!$blnError) {
// There is a 1 to Many relationship between Transaction and AssetTransaction so each Transaction can have many AssetTransactions.
$objTransaction = new Transaction();
$objTransaction->EntityQtypeId = EntityQtype::Asset;
$objTransaction->TransactionTypeId = 3;
// Check Out
$objTransaction->Save();
$intDestinationLocationId = 1;
// Check Out
foreach ($objAssetArray as $objAsset) {
$objAssetTransaction = new AssetTransaction();
$objAssetTransaction->AssetId = $objAsset->AssetId;
$objAssetTransaction->TransactionId = $objTransaction->TransactionId;
$objAssetTransaction->SourceLocationId = $objAsset->LocationId;
$objAssetTransaction->DestinationLocationId = $intDestinationLocationId;
$objAssetTransaction->Save();
$objAsset->LocationId = $intDestinationLocationId;
$objAsset->CheckedOutFlag = true;
$objAsset->Save();
}
$strWarning .= "Your transaction has successfully completed<br /><a href='index.php'>Main Menu</a> | <a href='asset_menu.php'>Manage Assets</a><br />";
//Remove that flag when transaction is compelete or exists some errors
示例3: btnCompleteShipment_Click
protected function btnCompleteShipment_Click($strFormId, $strControlId, $strParameter)
{
$blnError = false;
if ($this->objAssetTransactionArray && $this->objInventoryTransactionArray) {
$intEntityQtypeId = EntityQtype::AssetInventory;
} elseif ($this->objAssetTransactionArray) {
$intEntityQtypeId = EntityQtype::Asset;
} elseif ($this->objInventoryTransactionArray) {
$intEntityQtypeId = EntityQtype::Inventory;
} else {
$blnError = true;
$this->btnCompleteShipment->Warning = 'There are no assets or inventory in this shipment.';
}
if ($this->objAssetTransactionArray) {
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
if ($objAssetTransaction->Asset instanceof Asset) {
$arrAssetTransactions = AssetTransaction::LoadArrayByAssetId($objAssetTransaction->Asset->AssetId, array(QQ::OrderBy(QQN::AssetTransaction()->CreationDate, false)));
if (count($arrAssetTransactions) > 0) {
$intLastTransactionId = $arrAssetTransactions[0]->TransactionId;
$transaction = Transaction::load($intLastTransactionId);
if ($transaction->TransactionTypeId == 6 && $transaction->Shipment->ShippedFlag) {
$blnError = true;
$this->btnCompleteShipment->Warning = $objAssetTransaction->Asset->__toStringWithLink() . ' already shipped.';
}
}
}
}
}
if (!$blnError) {
try {
// Get an instance of the database
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
if (!$this->blnEditMode) {
// this is a new shipment so save the transaction & shipment before completing
// Create the new transaction object and save it
$this->objTransaction = new Transaction();
$this->objTransaction->EntityQtypeId = $intEntityQtypeId;
$this->objTransaction->TransactionTypeId = 6;
$this->objTransaction->Note = $this->txtNote->Text;
$this->objTransaction->Save();
$this->UpdateShipmentFields();
$this->objShipment->Save(true);
if ($this->arrCustomFields) {
// Save the values from all of the custom field controls to save the shipment
CustomField::SaveControls($this->objShipment->objCustomFieldArray, $this->blnEditMode, $this->arrCustomFields, $this->objShipment->ShipmentId, 10);
}
}
// Create receipt transaction for internal shipment
if ($this->objShipment->ToCompanyId == $this->objShipment->FromCompanyId) {
$this->receiveInternalShipmentTransaction = new Transaction();
$this->receiveInternalShipmentTransaction->EntityQtypeId = $intEntityQtypeId;
$this->receiveInternalShipmentTransaction->TransactionTypeId = 7;
$note = sprintf('This receipt was automatically created when creating internal shipment Number %s. ', $this->objShipment->ShipmentNumber);
$this->receiveInternalShipmentTransaction->Note = $note . $this->txtNote->Text;
$this->receiveInternalShipmentTransaction->Save();
// Create a new receipt
$objInternalReceipt = new Receipt();
$objInternalReceipt->TransactionId = $this->receiveInternalShipmentTransaction->TransactionId;
// The receipt will mimic the shipment information
$objInternalReceipt->FromCompanyId = $this->objShipment->FromCompanyId;
$objInternalReceipt->FromContactId = $this->objShipment->FromContactId;
$objInternalReceipt->ToContactId = $this->objShipment->ToContactId;
$objInternalReceipt->ToAddressId = $this->objShipment->ToAddressId;
$objInternalReceipt->ReceivedFlag = 0;
$objInternalReceipt->ReceiptNumber = Receipt::LoadNewReceiptNumber();
$objInternalReceipt->Save();
}
if ($intEntityQtypeId == EntityQtype::AssetInventory || $intEntityQtypeId == EntityQtype::Asset) {
$objTransaction = '';
$objReceipt = '';
$objNewAssetTransactionArray = array();
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
$objNewAssetTransactionArray[$objAssetTransaction->Asset->AssetCode] = $objAssetTransaction;
}
// Assign a destinationLocation to the AssetTransaction, and change the Location of the asset
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
if ($objAssetTransaction->Asset instanceof Asset) {
// LocationId #2 == Shipped
$DestinationLocationId = 2;
if ($objAssetTransaction->ScheduleReceiptFlag && $objAssetTransaction->Asset->LinkedFlag) {
$objAssetTransaction = $objNewAssetTransactionArray[$objAssetTransaction->Asset->AssetCode];
}
$objAssetTransaction->Asset->LocationId = $DestinationLocationId;
$objAssetTransaction->Asset->Save();
if (!$this->blnEditMode) {
// Assign the TransactionId
$objAssetTransaction->TransactionId = $this->objTransaction->TransactionId;
}
$objAssetTransaction->DestinationLocationId = $DestinationLocationId;
// No any actions with linked items (LinkedFlag = 1) which have been scheduled for receipt
if ($objAssetTransaction->ScheduleReceiptFlag && !$objAssetTransaction->Asset->LinkedFlag) {
if ($objAssetTransaction->NewAsset && $objAssetTransaction->NewAsset instanceof Asset && $objAssetTransaction->NewAsset->AssetId == null) {
// We have to create the new asset before we can
$objReceiptAsset = new Asset();
$objReceiptAsset->AssetModelId = $objAssetTransaction->NewAsset->AssetModelId;
$objReceiptAsset->LocationId = $objAssetTransaction->NewAsset->LocationId;
if ($objAssetTransaction->NewAsset->AssetCode == '') {
$objReceiptAsset->AssetCode = Asset::GenerateAssetCode();
//.........这里部分代码省略.........
示例4: Process
public function Process(Transaction $trans)
{
if (is_null($trans->id)) {
$trans->Save();
}
$result = new BeanstreamResult();
$result->request = \CivicInfoBC\Form::Encode(array('requestType' => 'BACKEND', 'merchant_id' => $this->merchant_id, 'trnOrderNumber' => $trans->id, 'trnAmount' => sprintf('%.2f', $trans->amount), 'trnCardOwner' => $trans->name, 'singleUseToken' => $trans->token));
$trans->beanstream = $result;
$retr = $this->perform_request($trans);
if ($retr) {
$retr = $this->parse_response($trans);
}
$trans->Save();
return $retr;
}
示例5: btnCompleteShipment_Click
protected function btnCompleteShipment_Click($strFormId, $strControlId, $strParameter)
{
$blnError = false;
if ($this->objAssetTransactionArray && $this->objInventoryTransactionArray) {
$intEntityQtypeId = EntityQtype::AssetInventory;
} elseif ($this->objAssetTransactionArray) {
$intEntityQtypeId = EntityQtype::Asset;
} elseif ($this->objInventoryTransactionArray) {
$intEntityQtypeId = EntityQtype::Inventory;
} else {
$blnError = true;
$this->btnCompleteShipment->Warning = 'There are no assets or inventory in this shipment.';
}
// If Courier is Fedex, validate Fedex inputs
if ($this->objShipment->CourierId === 1) {
if (!$this->lstPackageType->SelectedValue) {
$blnError = true;
$this->lblPackageType->Warning = "Please select a package type.";
$this->lstPackageType->Warning = "Please select a package type.";
}
if (!$this->txtPackageWeight->Text) {
$blnError = true;
$this->lblPackageWeight->Warning = "Please enter a weight for this package.";
$this->txtPackageWeight->Warning = "Please enter a weight for this package.";
}
//if (!$this->lstWeightUnit->SelectedValue) {
// $blnError = true;
// $this->lstWeightUnit->Warning = "Please select a weight unit.";
//}
//if (!$this->txtValue->Text) {
// $blnError = true;
// $this->txtValue->Warning = "Please enter a value.";
//}
//if (!$this->lstCurrencyUnit->SelectedValue) {
// $blnError = true;
// $this->lstCurrencyUnit->Warning = "Please select a currency type.";
//}
}
if (!$blnError) {
try {
// Get an instance of the database
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
if (!$this->blnEditMode) {
// this is a new shipment so save the transaction & shipment before completing
// Create the new transaction object and save it
$this->objTransaction = new Transaction();
$this->objTransaction->EntityQtypeId = $intEntityQtypeId;
$this->objTransaction->TransactionTypeId = 6;
$this->objTransaction->Note = $this->txtNote->Text;
$this->objTransaction->Save();
$this->UpdateShipmentFields();
$this->objShipment->Save(true);
if ($this->arrCustomFields) {
// Save the values from all of the custom field controls to save the shipment
CustomField::SaveControls($this->objShipment->objCustomFieldArray, $this->blnEditMode, $this->arrCustomFields, $this->objShipment->ShipmentId, 10);
}
// If the courier is FedEx, create new fedexShipment
if ($this->lstCourier->SelectedValue === 1) {
if (!$this->objFedexShipment instanceof FedexShipment) {
$this->objFedexShipment = new FedexShipment();
}
$this->objFedexShipment->ShipmentId = $this->objShipment->ShipmentId;
$this->UpdateFedexFields();
$this->objFedexShipment->Save(true);
}
}
// If courier is FedEx, initiate communication with FedEx
if (!$blnError && $this->objShipment->CourierId == 1) {
if (!$this->FedEx()) {
$blnError = true;
$objDatabase->TransactionRollback();
return;
}
}
if ($intEntityQtypeId == EntityQtype::AssetInventory || $intEntityQtypeId == EntityQtype::Asset) {
$objTransaction = '';
$objReceipt = '';
$objNewAssetTransactionArray = array();
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
$objNewAssetTransactionArray[$objAssetTransaction->Asset->AssetCode] = $objAssetTransaction;
}
// Assign a destinationLocation to the AssetTransaction, and change the Location of the asset
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
if ($objAssetTransaction->Asset instanceof Asset) {
// LocationId #2 == Shipped
$DestinationLocationId = 2;
if ($objAssetTransaction->ScheduleReceiptFlag && $objAssetTransaction->Asset->LinkedFlag) {
$objAssetTransaction = $objNewAssetTransactionArray[$objAssetTransaction->Asset->AssetCode];
}
$objAssetTransaction->Asset->LocationId = $DestinationLocationId;
$objAssetTransaction->Asset->Save();
if (!$this->blnEditMode) {
// Assign the TransactionId
$objAssetTransaction->TransactionId = $this->objTransaction->TransactionId;
}
$objAssetTransaction->DestinationLocationId = $DestinationLocationId;
// No any actions with linked items (LinkedFlag = 1) which have been scheduled for receipt
if ($objAssetTransaction->ScheduleReceiptFlag && !$objAssetTransaction->Asset->LinkedFlag) {
//.........这里部分代码省略.........
示例6: user
$trans->email = $_SESSION['user']['email'];
$trans->name = $_SESSION['user']['name'];
$trans->family = $_SESSION['user']['family'];
} else {
$u = new user();
$trans->user = $u->Get_Guest_ID();
$trans->email = '';
$trans->name = '';
$trans->family = '';
}
$trans->orderid = $_POST['orderid'];
$trans->bank = 1;
$trans->date = date('Y-m-d H:i:s');
$trans->status = 0;
$trans->au = $st['authority'];
$trns_id = $trans->Save();
$invoice->set_transaction($invc_num, $trns_id);
// go to bank gateqay
//exit;
$gt->Redirect_GateWay($st['authority'], $st['status']);
} else {
//gateway error
$app = new AppController();
$app->Erro(LANG::T('Gateway Error'));
}
} else {
if ($_POST['paymentype'] == 'credit') {
//check has credit
$unit = strtolower($_SESSION['currency_unit']);
$credit = intval($_SESSION['user'][$unit . '_credit']);
if (isset($_SESSION['user']['id']) && $credit > 0 && $totalamont <= $credit) {