当前位置: 首页>>代码示例>>PHP>>正文


PHP shopFunctionsF::getInvoiceName方法代码示例

本文整理汇总了PHP中shopFunctionsF::getInvoiceName方法的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctionsF::getInvoiceName方法的具体用法?PHP shopFunctionsF::getInvoiceName怎么用?PHP shopFunctionsF::getInvoiceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shopFunctionsF的用法示例。


在下文中一共展示了shopFunctionsF::getInvoiceName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInvoicePDF

 function getInvoicePDF($orderDetails = 0, $viewName = 'invoice', $layout = 'invoice', $format = 'html', $force = false)
 {
     // 		$force = true;
     $path = tsmConfig::get('forSale_path', 0);
     if (empty($path)) {
         vmError('No path set to store invoices');
         return false;
     } else {
         $path .= shopFunctionsF::getInvoiceFolderName() . DS;
         if (!file_exists($path)) {
             vmError('Path wrong to store invoices, folder invoices does not exist ' . $path);
             return false;
         } else {
             if (!is_writable($path)) {
                 vmError('Cannot store pdf, directory not writeable ' . $path);
                 return false;
             }
         }
     }
     $orderModel = tmsModel::getModel('orders');
     $invoiceNumberDate = array();
     if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) {
         return false;
     }
     if (!empty($invoiceNumberDate[0])) {
         $invoiceNumber = $invoiceNumberDate[0];
     } else {
         $invoiceNumber = FALSE;
     }
     if (!$invoiceNumber or empty($invoiceNumber)) {
         vmError('Cant create pdf, createInvoiceNumber failed');
         return 0;
     }
     if (shopFunctionsF::InvoiceNumberReserved($invoiceNumber)) {
         return 0;
     }
     //$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_', 'vm'.$layout.'_'.$invoiceNumber.'.pdf');
     $path .= shopFunctionsF::getInvoiceName($invoiceNumber, $layout) . '.pdf';
     if (file_exists($path) and !$force) {
         return $path;
     }
     //We come from the be, so we need to load the FE language
     tsmConfig::loadJLang('com_virtuemart', true);
     $this->addViewPath(VMPATH_SITE . DS . 'views');
     $view = $this->getView($viewName, $format);
     $this->writeJs = false;
     $view->addTemplatePath(VMPATH_SITE . DS . 'views' . DS . $viewName . DS . 'tmpl');
     if (!class_exists('VmTemplate')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
     }
     $template = VmTemplate::loadVmTemplateStyle();
     $templateName = VmTemplate::setTemplate($template);
     if (!empty($templateName)) {
         $TemplateOverrideFolder = JPATH_SITE . DS . "templates" . DS . $templateName . DS . "html" . DS . "com_virtuemart" . DS . "invoice";
         if (file_exists($TemplateOverrideFolder)) {
             $view->addTemplatePath($TemplateOverrideFolder);
         }
     }
     $view->invoiceNumber = $invoiceNumberDate[0];
     $view->invoiceDate = $invoiceNumberDate[1];
     $view->orderDetails = $orderDetails;
     $view->uselayout = $layout;
     $view->showHeaderFooter = false;
     $vendorModel = tmsModel::getModel('vendor');
     $virtuemart_vendor_id = 1;
     //We could set this automatically by the vendorId stored in the order.
     $vendor = $vendorModel->getVendor($virtuemart_vendor_id);
     $metadata = array('title' => tsmText::sprintf('COM_VIRTUEMART_INVOICE_TITLE', $vendor->vendor_store_name, $view->invoiceNumber, $orderDetails['details']['BT']->order_number), 'keywords' => tsmText::_('COM_VIRTUEMART_INVOICE_CREATOR'));
     return VmPdf::createVmPdf($view, $path, 'F', $metadata);
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:70,代码来源:invoice.php

示例2: renameInvoice

 /** Rename Invoice  (when an order is deleted)
  *
  * @author Valérie Isaksen
  * @author Max Milbers
  * @param $order_id Id of the order
  * @return boolean true if deleted successful, false if there was a problem
  */
 function renameInvoice($order_id)
 {
     $table = $this->getTable('invoices');
     $table->load($order_id, 'virtuemart_order_id');
     if (empty($table->invoice_number)) {
         return false;
     }
     if (!class_exists('shopFunctionsF')) {
         require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
     }
     // rename invoice pdf file
     $path = shopFunctions::getInvoicePath(VmConfig::get('forSale_path', 0));
     $name = shopFunctionsF::getInvoiceName($table->invoice_number);
     $invoice_name_src = $path . DS . $name . '.pdf';
     if (!file_exists($invoice_name_src)) {
         // may be it was already deleted when changing order items
         $data['invoice_number'] = $table->invoice_number;
         //$data['invoice_number'] = $data['invoice_number'].' not found.';
     } else {
         $date = date("Ymd");
         // We change the invoice number in the invoice table only. The order's invoice number is not modified!
         $data['invoice_number'] = $table->invoice_number . '_' . $date . '_' . $table->order_status;
         // We the sanitized file name as the invoice number might contain strange characters like 2015/01.
         $invoice_name_dst = $path . DS . $name . '_deprecated' . $date . '_' . $table->order_status . '.pdf';
         if (!class_exists('JFile')) {
             require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
         }
         if (!JFile::move($invoice_name_src, $invoice_name_dst)) {
             vmError('Could not rename Invoice ' . $invoice_name_src . ' to ' . $invoice_name_dst);
         }
     }
     $table = $this->getTable('invoices');
     $table->bindChecknStore($data);
     return true;
 }
开发者ID:thumbs-up-sign,项目名称:TuVanDuAn,代码行数:42,代码来源:orders.php


注:本文中的shopFunctionsF::getInvoiceName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。