本文整理汇总了PHP中Orders::getCustomer方法的典型用法代码示例。如果您正苦于以下问题:PHP Orders::getCustomer方法的具体用法?PHP Orders::getCustomer怎么用?PHP Orders::getCustomer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orders
的用法示例。
在下文中一共展示了Orders::getCustomer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activate
/**
* activate
* Activate an order item
* @param $orderItemId
* @return true|false
*/
public static function activate($orderItemId)
{
Shineisp_Commons_Utilities::log(__METHOD__ . " - Activate Detail ID #" . $orderItemId);
$orderItemId = intval($orderItemId);
if ($orderItemId < 1) {
// missing order item id from arguments
return false;
}
// Get OrderItem
$ordersItem = self::find($orderItemId);
$ordersItem = $ordersItem->toArray();
$OrderItem = array_shift($ordersItem);
if (!$OrderItem) {
// order item not found
return false;
}
// Get customerId related to this order
$customerId = Orders::getCustomer($OrderItem['order_id']);
/*
* START ACTIVATIONS CODE
*/
$upgrade = Orders::isUpgrade($OrderItem['order_id']);
$upgrade_uuid = false;
if ($upgrade !== false) {
$orderItem = OrdersItems::getDetail($upgrade);
Shineisp_Commons_Utilities::logs(__METHOD__ . " - OITEM::" . print_r($orderItem, true));
$oldOrderId = $orderItem['order_id'];
Orders::set_status($oldOrderId, Statuses::id("changed", "orders"));
// Close the old order ::status changed
OrdersItems::set_status($upgrade, Statuses::id("changed", "orders"));
$upgrade_uuid = $orderItem['uuid'];
// log
Shineisp_Commons_Utilities::logs(__METHOD__ . " - Order changed from #" . $oldOrderId . " to #" . $OrderItem['order_id']);
}
if (empty($OrderItem['parameters'])) {
Shineisp_Commons_Utilities::logs(__METHOD__ . " - Order items setup parameters empty");
return false;
}
// Is this an hosting? execute panel task
// TODO: this should call an hook or an even bound to the panel
if (isset($OrderItem['Products']) && isset($OrderItem['Products']['type']) && $OrderItem['Products']['type'] == 'hosting') {
Shineisp_Commons_Utilities::logs(__METHOD__ . " Hosting task queued");
PanelsActions::AddTask($customerId, $OrderItem['detail_id'], "fullProfile", $OrderItem['parameters']);
return true;
}
// Is this a domain? execute domain task
if (isset($OrderItem['tld_id']) && intval($OrderItem['tld_id']) > 0) {
$parameters = json_decode($OrderItem['parameters']);
if (empty($parameters->domain)) {
Shineisp_Commons_Utilities::logs(__METHOD__ . " Domain has been not set in the order detail #{$orderItemId}");
return false;
}
// Create the domain record
$domain = Domains::Create($parameters->domain, intval($OrderItem['tld_id']), intval($customerId), $orderItemId);
// Create the domain task
if (!empty($parameters->domain) && !empty($parameters->action)) {
$domains[] = array('domain' => $parameters->domain, 'action' => $parameters->action);
$retval = DomainsTasks::AddTasks($domains);
Shineisp_Commons_Utilities::logs(__METHOD__ . " Domain task queued");
}
return $retval;
}
}
示例2: addpayment
/**
* addpayment
* Add a payment information to a order
* @param integer $orderid
* @param string $transactionid
* @param integer $bankid
* @param boolean $status
* @param float $amount
*/
public static function addpayment($orderid, $transactionid, $bankid, $status, $amount, $paymentdate = null, $customer_id = null, $payment_description = null)
{
$payment = new Payments();
// We make a double check to properly manage "null" output coming from Shineisp_Commons_Utilities::formatDateIn
if (!empty($paymentdate)) {
$paymentdate = Shineisp_Commons_Utilities::formatDateIn($paymentdate);
}
$paymentdate = !empty($paymentdate) ? $paymentdate : date('Y-m-d H:i:s');
// Set the payment data
$payment->order_id = $orderid;
$payment->bank_id = $bankid;
$payment->reference = $transactionid;
$payment->confirmed = 0;
$payment->income = $amount;
// Additional fields for Orders::saveAll()
$payment->paymentdate = $paymentdate;
$payment->customer_id = isset($customer_id) ? intval($customer_id) : intval(Orders::getCustomer($orderid));
$payment->description = isset($payment_description) ? $payment_description : null;
$save = $payment->trySave();
if ($save) {
Shineisp_Commons_Utilities::logs("Payments::addPayment(): save ok");
// Confirm payment, if needed. Invoices::confirm() will activate order.
if ($status) {
self::confirm($orderid, $status);
}
}
return $save;
}