本文整理汇总了PHP中ShopFunctions::InvoiceNumberReserved方法的典型用法代码示例。如果您正苦于以下问题:PHP ShopFunctions::InvoiceNumberReserved方法的具体用法?PHP ShopFunctions::InvoiceNumberReserved怎么用?PHP ShopFunctions::InvoiceNumberReserved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShopFunctions
的用法示例。
在下文中一共展示了ShopFunctions::InvoiceNumberReserved方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createInvoiceNumber
function createInvoiceNumber($orderDetails, &$invoiceNumber)
{
$orderDetails = (array) $orderDetails;
$db = JFactory::getDBO();
if (!isset($orderDetails['virtuemart_order_id'])) {
vmWarn('createInvoiceNumber $orderDetails has no virtuemart_order_id ', $orderDetails);
vmdebug('createInvoiceNumber $orderDetails has no virtuemart_order_id ', $orderDetails);
}
$q = 'SELECT * FROM `#__virtuemart_invoices` WHERE `virtuemart_order_id`= "' . $orderDetails['virtuemart_order_id'] . '" ';
// AND `order_status` = "'.$orderDetails->order_status.'" ';
$db->setQuery($q);
$result = $db->loadAssoc();
// vmdebug('my createInvoiceNumber $q '.$q,$result);
if (!class_exists('ShopFunctions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
}
if (!$result or empty($result['invoice_number'])) {
$data['virtuemart_order_id'] = $orderDetails['virtuemart_order_id'];
$data['order_status'] = $orderDetails['order_status'];
$data['virtuemart_vendor_id'] = $orderDetails['virtuemart_vendor_id'];
JPluginHelper::importPlugin('vmshopper');
JPluginHelper::importPlugin('vmpayment');
$dispatcher = JDispatcher::getInstance();
// plugin returns invoice number, 0 if it does not want an invoice number to be created by Vm
$plg_datas = $dispatcher->trigger('plgVmOnUserInvoice', array($orderDetails, &$data));
foreach ($plg_datas as $plg_data) {
// $data = array_merge($plg_data,$data);
}
if (!isset($data['invoice_number'])) {
// check the default configuration
$orderstatusForInvoice = VmConfig::get('inv_os', array());
if (!is_array($orderstatusForInvoice)) {
$orderstatusForInvoice = array($orderstatusForInvoice);
}
//for backward compatibility 2.0.8e
$pdfInvoice = (int) VmConfig::get('pdf_invoice', 0);
// backwards compatible
$force_create_invoice = JRequest::getInt('create_invoice', 0);
// florian : added if pdf invoice are enabled
if (in_array($orderDetails['order_status'], $orderstatusForInvoice) or $pdfInvoice == 1 or $force_create_invoice == 1) {
$q = 'SELECT COUNT(1) FROM `#__virtuemart_invoices` WHERE `virtuemart_vendor_id`= "' . $orderDetails['virtuemart_vendor_id'] . '" ';
// AND `order_status` = "'.$orderDetails->order_status.'" ';
$db->setQuery($q);
$count = $db->loadResult() + 1;
if (empty($data['invoice_number'])) {
//$variable_fixed=sprintf("%05s",$num_rows);
$date = date("Y-m-d");
// $date = JFactory::getDate()->toMySQL();
$data['invoice_number'] = str_replace('-', '', substr($date, 2, 8)) . substr(md5($orderDetails['order_number'] . $orderDetails['order_status']), 0, 3) . '0' . $count;
}
} else {
return false;
}
}
$table = $this->getTable('invoices');
$table->bindChecknStore($data);
$invoiceNumber = array($table->invoice_number, $table->created_on);
} elseif (ShopFunctions::InvoiceNumberReserved($result['invoice_number'])) {
$invoiceNumber = array($result['invoice_number'], $result['created_on']);
return true;
} else {
$invoiceNumber = array($result['invoice_number'], $result['created_on']);
}
return true;
}
示例2: display
public function display($tpl = null)
{
$document = JFactory::getDocument();
VmConfig::loadJLang('com_virtuemart_shoppers', true);
//We never want that the cart is indexed
$document->setMetaData('robots', 'NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET');
if (empty($this->uselayout)) {
$layout = JRequest::getWord('layout', 'mail');
} else {
$layout = $this->uselayout;
}
switch ($layout) {
case 'invoice':
$this->doctype = $layout;
$title = JText::_('COM_VIRTUEMART_INVOICE');
break;
case 'deliverynote':
$this->doctype = $layout;
$layout = 'invoice';
$title = JText::_('COM_VIRTUEMART_DELIVERYNOTE');
break;
case 'confirmation':
$this->doctype = $layout;
$layout = 'confirmation';
$title = JText::_('COM_VIRTUEMART_CONFIRMATION');
break;
case 'mail':
if (VmConfig::get('order_mail_html')) {
$layout = 'mail_html';
} else {
$layout = 'mail_raw';
}
}
$this->setLayout($layout);
$tmpl = JRequest::getWord('tmpl');
$print = false;
if ($tmpl) {
$print = true;
}
$this->assignRef('print', $print);
$this->format = JRequest::getWord('format', 'html');
if ($layout == 'invoice') {
$document->setTitle(JText::_('COM_VIRTUEMART_INVOICE'));
}
$order_print = false;
if ($print and $this->format == 'html') {
$order_print = true;
}
$orderModel = VmModel::getModel('orders');
$orderDetails = $this->orderDetails;
if ($orderDetails == 0) {
$orderDetails = $orderModel->getMyOrderDetails();
if (!$orderDetails or empty($orderDetails['details'])) {
echo JText::_('COM_VIRTUEMART_CART_ORDER_NOTFOUND');
return;
}
}
if (empty($orderDetails['details'])) {
echo JText::_('COM_VIRTUEMART_ORDER_NOTFOUND');
return 0;
}
if (!empty($orderDetails['details']['BT']->order_language)) {
$jlang = JFactory::getLanguage();
$jlang->load('com_virtuemart', JPATH_SITE, $orderDetails['details']['BT']->order_language, true);
$jlang->load('com_virtuemart_shoppers', JPATH_SITE, $orderDetails['details']['BT']->order_language, true);
$jlang->load('com_virtuemart_orders', JPATH_SITE, $orderDetails['details']['BT']->order_language, true);
}
$this->assignRef('orderDetails', $orderDetails);
// if it is order print, invoice number should not be created, either it is there, either it has not been created
if (empty($this->invoiceNumber) and !$order_print) {
$invoiceNumberDate = array();
if ($orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
if (ShopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) {
if ($this->uselayout != 'mail') {
$document->setTitle(JText::_('COM_VIRTUEMART_PAYMENT_INVOICE'));
return;
}
}
$this->invoiceNumber = $invoiceNumberDate[0];
$this->invoiceDate = $invoiceNumberDate[1];
if (!$this->invoiceNumber or empty($this->invoiceNumber)) {
vmError('Cant create pdf, createInvoiceNumber failed');
if ($this->uselayout != 'mail') {
return;
}
}
} else {
// Could OR should not create Invoice Number, createInvoiceNumber failed
if ($this->uselayout != 'mail') {
return;
}
}
}
//Todo multix
$vendorId = 1;
$emailCurrencyId = $orderDetails['details']['BT']->user_currency_id;
$exchangeRate = FALSE;
if (!class_exists('vmPSPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
}
//.........这里部分代码省略.........
示例3: display
public function display($tpl = null)
{
$jinput = JFactory::getApplication()->input;
$pdfTest = $jinput->get('print', 0, 'INT');
if (empty($this->uselayout)) {
$layout = JRequest::getWord('layout', 'mail');
} else {
$layout = $this->uselayout;
}
switch ($layout) {
case 'invoice':
$this->doctype = $layout;
$title = JText::_('COM_VIRTUEMART_INVOICE');
break;
case 'deliverynote':
$this->doctype = $layout;
$layout = 'invoice';
$title = JText::_('COM_VIRTUEMART_DELIVERYNOTE');
break;
case 'confirmation':
$this->doctype = $layout;
$layout = 'confirmation';
$title = JText::_('COM_VIRTUEMART_CONFIRMATION');
break;
case 'mail':
if (VmConfig::get('order_mail_html')) {
$layout = 'mail_html';
} else {
$layout = 'mail_raw';
}
}
$this->setLayout($layout);
$tmpl = $jinput->get('tmpl', '', 'WORD');
$this->print = false;
if ($tmpl) {
$this->print = true;
}
$this->format = $jinput->get('format', 'html', 'WORD');
if ($layout == 'invoice') {
$this->document->setTitle(JText::_('COM_VIRTUEMART_INVOICE'));
}
$order_print = false;
if ($this->print and $this->format == 'html') {
$order_print = true;
}
$orderModel = VmModel::getModel('orders');
$orderDetails = $this->orderDetails;
if ($orderDetails == 0) {
$orderDetails = $orderModel->getMyOrderDetails();
if (!$orderDetails or empty($orderDetails['details'])) {
echo JText::_('COM_VIRTUEMART_CART_ORDER_NOTFOUND');
return;
}
}
if (empty($orderDetails['details'])) {
echo JText::_('COM_VIRTUEMART_ORDER_NOTFOUND');
return 0;
}
// if it is order print, invoice number should not be created, either it is there, either it has not been created
if (empty($this->invoiceNumber) and !$order_print) {
$invoiceNumberDate = array();
if ($orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
if (ShopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) {
if ($this->uselayout != 'mail') {
$this->document->setTitle(JText::_('COM_VIRTUEMART_PAYMENT_INVOICE'));
return;
}
}
$this->invoiceNumber = $invoiceNumberDate[0];
$this->invoiceDate = $invoiceNumberDate[1];
if (!$this->invoiceNumber or empty($this->invoiceNumber)) {
vmError('Cant create pdf, createInvoiceNumber failed');
if ($this->uselayout != 'mail') {
return;
}
}
} else {
// Could OR should not create Invoice Number, createInvoiceNumber failed
if ($this->uselayout != 'mail') {
return;
}
}
}
$company = empty($orderDetails['details']['BT']->company) ? "" : $orderDetails['details']['BT']->company . ", ";
$shopperName = $company . $orderDetails['details']['BT']->title . ' ' . $orderDetails['details']['BT']->first_name . ' ' . $orderDetails['details']['BT']->last_name;
$this->shopperName = $shopperName;
//Todo multix
$vendorId = 1;
$emailCurrencyId = 0;
$exchangeRate = FALSE;
JLoader::register('vmPSPlugin', JPATH_VM_PLUGINS . '/vmpsplugin.php');
JPluginHelper::importPlugin('vmpayment');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('plgVmgetEmailCurrency', array($orderDetails['details']['BT']->virtuemart_paymentmethod_id, $orderDetails['details']['BT']->virtuemart_order_id, &$emailCurrencyId));
JLoader::register('CurrencyDisplay', JPATH_VM_ADMINISTRATOR . '/helpers/currencydisplay.php');
$currency = CurrencyDisplay::getInstance($emailCurrencyId, $vendorId);
if ($emailCurrencyId) {
$currency->exchangeRateShopper = $orderDetails['details']['BT']->user_currency_rate;
}
$this->currency = $currency;
//.........这里部分代码省略.........
示例4: display
public function display($tpl = null)
{
$document = JFactory::getDocument();
if (empty($this->uselayout)) {
$layout = JRequest::getWord('layout', 'mail');
} else {
$layout = $this->uselayout;
}
if ($layout == 'mail') {
if (VmConfig::get('order_mail_html')) {
$layout = 'mail_html';
} else {
$layout = 'mail_raw';
}
}
$this->setLayout($layout);
$tmpl = JRequest::getWord('tmpl');
$print = false;
if ($tmpl) {
$print = true;
}
$this->assignRef('print', $print);
$this->format = JRequest::getWord('format', 'html');
if ($layout == 'invoice') {
$document->setTitle(JText::_('COM_VIRTUEMART_INVOICE'));
}
$order_print = false;
if ($print and $this->format == 'html') {
$order_print = true;
}
$orderModel = VmModel::getModel('orders');
$orderDetails = $this->orderDetails;
if ($orderDetails == 0) {
// If the user is not logged in, we will check the order number and order pass
if ($orderPass = JRequest::getString('order_pass', false) and $orderNumber = JRequest::getString('order_number', false)) {
$orderId = $orderModel->getOrderIdByOrderPass($orderNumber, $orderPass);
if (empty($orderId)) {
echo 'Invalid order_number/password ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
return 0;
}
$orderDetails = $orderModel->getOrder($orderId);
}
if ($orderDetails == 0) {
$_currentUser = JFactory::getUser();
$cuid = $_currentUser->get('id');
// If the user is logged in, we will check if the order belongs to him
$virtuemart_order_id = JRequest::getInt('virtuemart_order_id', 0);
if (!$virtuemart_order_id) {
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber(JRequest::getString('order_number'));
}
$orderDetails = $orderModel->getOrder($virtuemart_order_id);
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
if (!Permissions::getInstance()->check("admin")) {
if (!empty($orderDetails['details']['BT']->virtuemart_user_id)) {
if ($orderDetails['details']['BT']->virtuemart_user_id != $cuid) {
echo 'view ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
return;
}
}
}
}
}
if (empty($orderDetails['details'])) {
echo JText::_('COM_VIRTUEMART_ORDER_NOTFOUND');
return 0;
}
$this->assignRef('orderDetails', $orderDetails);
// if it is order print, invoice number should not be created, either it is there, either it has not been created
if (empty($this->invoiceNumber) and !$order_print) {
$invoiceNumberDate = array();
if ($orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
if (ShopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) {
if ($this->uselayout != 'mail') {
$document->setTitle(JText::_('COM_VIRTUEMART_PAYMENT_INVOICE'));
return;
}
}
$this->invoiceNumber = $invoiceNumberDate[0];
$this->invoiceDate = $invoiceNumberDate[1];
if (!$this->invoiceNumber or empty($this->invoiceNumber)) {
vmError('Cant create pdf, createInvoiceNumber failed');
if ($this->uselayout != 'mail') {
return;
}
}
} else {
// Could OR should not create Invoice Number, createInvoiceNumber failed
if ($this->uselayout != 'mail') {
return;
}
}
}
$company = empty($orderDetails['details']['BT']->company) ? "" : $orderDetails['details']['BT']->company . ", ";
$shopperName = $company . $orderDetails['details']['BT']->title . ' ' . $orderDetails['details']['BT']->first_name . ' ' . $orderDetails['details']['BT']->last_name;
$this->assignRef('shopperName', $shopperName);
//Todo multix
$vendorId = 1;
$emailCurrencyId = 0;
//.........这里部分代码省略.........
示例5: createInvoiceNumber
function createInvoiceNumber($orderDetails, &$invoiceNumber)
{
$orderDetails = (array) $orderDetails;
$db = JFactory::getDBO();
if (!isset($orderDetails['tsmart_order_id'])) {
vmWarn('createInvoiceNumber $orderDetails has no tsmart_order_id ', $orderDetails);
vmdebug('createInvoiceNumber $orderDetails has no tsmart_order_id ', $orderDetails);
}
$q = 'SELECT * FROM `#__tsmart_invoices` WHERE `tsmart_order_id`= "' . $orderDetails['tsmart_order_id'] . '" ';
// AND `order_status` = "'.$orderDetails->order_status.'" ';
$db->setQuery($q);
$result = $db->loadAssoc();
if (!class_exists('ShopFunctions')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
}
if (!$result or empty($result['invoice_number'])) {
$data['tsmart_order_id'] = $orderDetails['tsmart_order_id'];
$data['order_status'] = $orderDetails['order_status'];
$data['tsmart_vendor_id'] = $orderDetails['tsmart_vendor_id'];
JPluginHelper::importPlugin('vmshopper');
JPluginHelper::importPlugin('vmpayment');
$dispatcher = JDispatcher::getInstance();
// plugin returns invoice number, 0 if it does not want an invoice number to be created by Vm
$plg_datas = $dispatcher->trigger('plgVmOnUserInvoice', array($orderDetails, &$data));
if (!isset($data['invoice_number'])) {
// check the default configuration
$orderstatusForInvoice = tsmConfig::get('inv_os', array('C'));
if (!is_array($orderstatusForInvoice)) {
$orderstatusForInvoice = array($orderstatusForInvoice);
}
//for backward compatibility 2.0.8e
$pdfInvoice = (int) tsmConfig::get('pdf_invoice', 0);
// backwards compatible
$force_create_invoice = vRequest::getCmd('create_invoice', -1);
// florian : added if pdf invoice are enabled
if (in_array($orderDetails['order_status'], $orderstatusForInvoice) or $pdfInvoice == 1 or $force_create_invoice == $orderDetails['order_create_invoice_pass']) {
$q = 'SELECT COUNT(1) FROM `#__tsmart_invoices` WHERE `tsmart_vendor_id`= "' . $orderDetails['tsmart_vendor_id'] . '" ';
// AND `order_status` = "'.$orderDetails->order_status.'" ';
$db->setQuery($q);
$count = $db->loadResult() + 1;
if (empty($data['invoice_number'])) {
$date = date("Y-m-d");
if (!class_exists('tsmCrypt')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'tsmcrypt.php';
}
$data['invoice_number'] = str_replace('-', '', substr($date, 2, 8)) . tsmCrypt::getHumanToken(4) . '0' . $count;
}
} else {
return false;
}
}
$table = $this->getTable('invoices');
$table->bindChecknStore($data);
$invoiceNumber = array($table->invoice_number, $table->created_on);
} elseif (ShopFunctions::InvoiceNumberReserved($result['invoice_number'])) {
$invoiceNumber = array($result['invoice_number'], $result['created_on']);
return true;
} else {
$invoiceNumber = array($result['invoice_number'], $result['created_on']);
}
return true;
}