本文整理汇总了PHP中Transaction::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Transaction::add方法的具体用法?PHP Transaction::add怎么用?PHP Transaction::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
public function start($auth = NULL)
{
$args = func_get_args();
if ($auth == Transaction::SIGNATURE) {
if ($this->lock) {
return FALSE;
}
$this->txn = TRUE;
return (bool) $this->__call(__FUNCTION__, array());
}
Transaction::start();
if (!Transaction::add($this)) {
return FALSE;
}
return TRUE;
}
示例2: date
}
echo "test";
//echo date_format(date_add(DateTime::createFromFormat('d/m/Y', date("d/m/Y")),date_interval_create_from_date_string("5 years")),"d/m/Y");
echo date("d/m/Y");
$a = Item::search(["item_id" => 2]);
print_r($a);
$sql = "UPDATE item_copy SET item_copy_status=1;";
DB::getInstance()->directUpdate($sql);
$data = array("id" => null, "purpose" => "sdasd", "comment" => "asdsdf", "member_id" => 16);
$salt = '5&JDDlwz%Rwh!t2Yg-Igae@QxPzFTSId';
$enc_pass = md5($salt . 'admin');
echo "paswowkjhkfjw";
DB::getInstance()->directUpdate("UPDATE member SET member_password='{$enc_pass}' WHERE member_nic='000000000';");
$t = new Transaction();
$t->create($data);
$t->add();
print_r(DB::getInstance()->search("schedule", ["semester_no" => 2]));
print_r(Schedule::search(["semester_no" => 2]));
echo isset($_SESSION["basket"]);
?>
<html>
<script type="text/javascript">
function display(msg){
alert(msg);
}
</script>
</html>
<!DOCTYPE HTML>
示例3: renderForm
//.........这里部分代码省略.........
$arrUserData['text']['contact_surname']['length'] = 255;
$arrUserData['text']['contact_surname']['mandatory'] = 1;
$arrUserData['text']['contact_company']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_COMPANY'];
$arrUserData['text']['contact_company']['value'] = $arrFieldValues['contact_company'];
$arrUserData['text']['contact_company']['length'] = 255;
$arrUserData['text']['contact_company']['mandatory'] = 0;
$arrUserData['text']['contact_street']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_STREET'];
$arrUserData['text']['contact_street']['value'] = $arrFieldValues['contact_street'];
$arrUserData['text']['contact_street']['length'] = 255;
$arrUserData['text']['contact_street']['mandatory'] = 1;
$arrUserData['text']['contact_postcode']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_POSTCODE'];
$arrUserData['text']['contact_postcode']['value'] = $arrFieldValues['contact_postcode'];
$arrUserData['text']['contact_postcode']['length'] = 255;
$arrUserData['text']['contact_postcode']['mandatory'] = 1;
$arrUserData['text']['contact_place']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_PLACE'];
$arrUserData['text']['contact_place']['value'] = $arrFieldValues['contact_place'];
$arrUserData['text']['contact_place']['length'] = 255;
$arrUserData['text']['contact_place']['mandatory'] = 1;
$arrUserData['selection']['contact_country']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_COUNTRY'];
$arrUserData['selection']['contact_country']['value'] = $arrFieldValues['contact_country'];
$arrUserData['selection']['contact_country']['options'] = $this->arrCountries;
$arrUserData['selection']['contact_country']['mandatory'] = 1;
$arrUserData['text']['contact_phone']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_PHONE'];
$arrUserData['text']['contact_phone']['value'] = $arrFieldValues['contact_phone'];
$arrUserData['text']['contact_phone']['length'] = 255;
$arrUserData['text']['contact_phone']['mandatory'] = 1;
$arrUserData['email']['contact_email']['name'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_EMAIL'];
$arrUserData['email']['contact_email']['value'] = $arrFieldValues['contact_email'];
$arrUserData['email']['contact_email']['length'] = 255;
$arrUserData['email']['contact_email']['mandatory'] = 1;
$arrFieldsToHighlight = $this->validateUserData($arrUserData);
if (empty($arrFieldsToHighlight)) {
//validation was successful. now add a new transaction.
$id = $this->objTransaction->add(self::WAITING, $arrUserData['text']['invoice_number']['value'], $arrUserData['selection']['invoice_currency']['value'], $arrUserData['numeric']['invoice_amount']['value'], $arrUserData['selection']['contact_title']['value'], $arrUserData['text']['contact_forename']['value'], $arrUserData['text']['contact_surname']['value'], $arrUserData['text']['contact_company']['value'], $arrUserData['text']['contact_street']['value'], $arrUserData['text']['contact_postcode']['value'], $arrUserData['text']['contact_place']['value'], $arrUserData['selection']['contact_country']['value'], $arrUserData['text']['contact_phone']['value'], $arrUserData['email']['contact_email']['value']);
if ($id) {
$objSettingsYellowpay = new SettingsYellowpay($objDatabase);
$arrYellowpay = $objSettingsYellowpay->get();
$arrOrder = array('ORDERID' => $id, 'AMOUNT' => intval($arrFieldValues['invoice_amount'] * 100), 'CURRENCY' => $this->arrCurrencies[$arrFieldValues['invoice_currency']], 'PARAMPLUS' => 'section=Checkout');
$arrSettings['postfinance_shop_id']['value'] = $arrYellowpay['pspid'];
$arrSettings['postfinance_hash_signature_in']['value'] = $arrYellowpay['sha_in'];
$arrSettings['postfinance_authorization_type']['value'] = $arrYellowpay['operation'];
$arrSettings['postfinance_use_testserver']['value'] = $arrYellowpay['testserver'];
$landingPage = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page')->findOneByModuleCmdLang('Checkout', '', FRONTEND_LANG_ID);
$this->objTemplate->setVariable('CHECKOUT_YELLOWPAY_FORM', \Yellowpay::getForm($arrOrder, $_ARRAYLANG['TXT_CHECKOUT_START_PAYMENT'], false, $arrSettings, $landingPage));
if (\Yellowpay::$arrError) {
$this->arrStatusMessages['error'][] = $_ARRAYLANG['TXT_CHECKOUT_FAILED_TO_INITIALISE_YELLOWPAY'];
} else {
$this->arrStatusMessages['ok'][] = $_ARRAYLANG['TXT_CHECKOUT_ENTRY_SAVED_SUCCESSFULLY'];
}
$this->objTemplate->hideBlock('form');
$this->objTemplate->touchBlock('redirect');
return;
} else {
$this->arrStatusMessages['error'][] = $_ARRAYLANG['TXT_CHECKOUT_ENTRY_SAVED_ERROR'];
}
}
} else {
//get passed data
$arrFieldValues['invoice_number'] = !empty($_REQUEST['invoice_number']) ? $_REQUEST['invoice_number'] : '';
$arrFieldValues['invoice_currency'] = !empty($_REQUEST['invoice_currency']) ? $_REQUEST['invoice_currency'] : '';
$arrFieldValues['invoice_amount'] = !empty($_REQUEST['invoice_amount']) ? $_REQUEST['invoice_amount'] : '';
$arrFieldValues['contact_title'] = !empty($_REQUEST['contact_title']) ? $_REQUEST['contact_title'] : '';
$arrFieldValues['contact_forename'] = !empty($_REQUEST['contact_forename']) ? $_REQUEST['contact_forename'] : '';
$arrFieldValues['contact_surname'] = !empty($_REQUEST['contact_surname']) ? $_REQUEST['contact_surname'] : '';
$arrFieldValues['contact_company'] = !empty($_REQUEST['contact_company']) ? $_REQUEST['contact_company'] : '';
$arrFieldValues['contact_street'] = !empty($_REQUEST['contact_street']) ? $_REQUEST['contact_street'] : '';
示例4: header
require_once 'core/init.php';
$member_role = $_SESSION['roles'];
if (in_array("Laboratory Assistant", $member_role)) {
} else {
header('location:restricted_page.php');
}
if (isset($_SESSION["basket"]) && isset($_SESSION["items"])) {
$state = true;
DB::getInstance()->startTr();
$newTransaction = new Transaction();
$rdate = $_POST["expected_return_date"];
$member = $_SESSION["member_details"]["id"];
$data = array("id" => null, "purpose" => $_POST["purpose"], "borrow_comment" => $_POST["comments"], "return_comment" => null, "member_id" => $_SESSION["member_details"]["id"], "borrowed_date" => date("Y-m-d"), "expected_return_date" => $_POST["expected_return_date"]);
$newTransaction->create($data);
if ($newTransaction->add()) {
$transaction_id = DB::getInstance()->getLastId();
foreach ($_SESSION["basket"] as $key => $value) {
$newItemTransaction = new ItemTransaction();
$data = array("item_copy_id" => $value["item_copy_id"], "transaction_id" => $transaction_id, "borrowed_quantity" => $value["quantity"], "returned_date" => null, "returned_quantity" => null, "status" => 0);
$newItemTransaction->create($data);
if ($newItemTransaction->add()) {
$sql = "UPDATE item_copy SET item_copy_status=0 WHERE item_copy_id='" . $value["item_copy_id"] . "';";
if (!DB::getInstance()->directUpdate($sql)) {
$state = false;
break;
}
} else {
$state = false;
break;
}