/** * Notifies the customer that the Order Status has been changed * * @author RolandD, Christopher Roussel, Valérie Isaksen, Max Milbers * */ private function notifyCustomer($virtuemart_order_id, $newOrderData = 0) { // vmdebug('notifyCustomer', $newOrderData); if (isset($newOrderData['customer_notified']) && $newOrderData['customer_notified'] == 0) { return true; } if (!class_exists('shopFunctionsF')) { require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } //Important, the data of the order update mails, payments and invoice should //always be in the database, so using getOrder is the right method $orderModel = VmModel::getModel('orders'); $order = $orderModel->getOrder($virtuemart_order_id); $payment_name = $shipment_name = ''; if (!class_exists('vmPSPlugin')) { require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmshipment'); JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_shipmentmethod_id, &$shipment_name)); $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($order['details']['BT']->virtuemart_order_id, $order['details']['BT']->virtuemart_paymentmethod_id, &$payment_name)); $order['shipmentName'] = $shipment_name; $order['paymentName'] = $payment_name; if ($newOrderData != 0) { //We do not really need that $vars['newOrderData'] = (array) $newOrderData; } $vars['orderDetails'] = $order; //$vars['includeComments'] = JRequest::getVar('customer_notified', array()); //I think this is misleading, I think it should always ask for example $vars['newOrderData']['doVendor'] directly //Using this function garantue us that it is always there. If the vendor should be informed should be done by the plugins //We may add later something to the method, defining this better $vars['url'] = 'url'; if (!isset($vars['doVendor'])) { if (!isset($newOrderData['doVendor'])) { $vars['doVendor'] = false; } else { $vars['doVendor'] = $newOrderData['doVendor']; } } $virtuemart_vendor_id = 1; $vendorModel = VmModel::getModel('vendor'); $vendor = $vendorModel->getVendor($virtuemart_vendor_id); $vars['vendor'] = $vendor; $vendorEmail = $vendorModel->getVendorEmail($virtuemart_vendor_id); $vars['vendorEmail'] = $vendorEmail; /* $path = VmConfig::get('forSale_path',0); $orderstatusForInvoice = VmConfig::get('inv_os','C'); $pdfInvoice = VmConfig::get('pdf_invoice', 1); // backwards compatible */ // florian : added if pdf invoice are enabled //if ($this->getInvoiceNumber( $order['details']['BT']->virtuemart_order_id ) ){ $invoiceNumberDate = array(); if ($orderModel->createInvoiceNumber($order['details']['BT'], $invoiceNumberDate)) { $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); //TODO we need an array of orderstatus if (in_array($order['details']['BT']->order_status, $orderstatusForInvoice) or $pdfInvoice == 1 or $force_create_invoice == 1) { if (!shopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) { if (!class_exists('VirtueMartControllerInvoice')) { require_once JPATH_VM_SITE . DS . 'controllers' . DS . 'invoice.php'; } $controller = new VirtueMartControllerInvoice(array('model_path' => JPATH_VM_SITE . DS . 'models', 'view_path' => JPATH_VM_SITE . DS . 'views')); $vars['mediaToSend'][] = $controller->checkStoreInvoice($order); } } } // Send the email if (shopFunctionsF::renderMail('invoice', $order['details']['BT']->email, $vars, null, $vars['doVendor'])) { $string = 'COM_VIRTUEMART_NOTIFY_CUSTOMER_SEND_MSG'; } else { $string = 'COM_VIRTUEMART_NOTIFY_CUSTOMER_ERR_SEND'; } vmInfo(JText::_($string, false) . ' ' . $order['details']['BT']->first_name . ' ' . $order['details']['BT']->last_name . ', ' . $order['details']['BT']->email); return true; }
function getInvoicePDF($orderDetails = 0, $viewName = 'invoice', $layout = 'invoice', $format = 'html', $force = false) { // $force = true; $path = VmConfig::get('forSale_path', 0); if (empty($path)) { vmError('No path set to store invoices'); return false; } else { $path .= shopFunctions::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 = VmModel::getModel('orders'); $invoiceNumberDate = array(); if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) { return 0; } if (!empty($invoiceNumberDate[0])) { $invoiceNumber = $invoiceNumberDate[0]; } else { $invoiceNumber = FALSE; } if (!$invoiceNumber or empty($invoiceNumber)) { vmError('Cant create pdf, createInvoiceNumber failed'); return 0; } if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) { return 0; } $path .= preg_replace('/[^A-Za-z0-9_\\-\\.]/', '_', 'vm' . $layout . '_' . $invoiceNumber . '.pdf'); if (file_exists($path) and !$force) { return $path; } //We come from the be, so we need to load the FE langauge VmConfig::loadJLang('com_virtuemart', true); $this->addViewPath(JPATH_VM_SITE . DS . 'views'); $view = $this->getView($viewName, $format); $this->writeJs = false; $view->addTemplatePath(JPATH_VM_SITE . DS . 'views' . DS . $viewName . DS . 'tmpl'); $vmtemplate = VmConfig::get('vmtemplate', 0); if (!empty($vmtemplate) and $vmtemplate == 'default') { if (JVM_VERSION == 2) { $q = 'SELECT `template` FROM `#__template_styles` WHERE `client_id`="0" AND `home`="1"'; } else { $q = 'SELECT `template` FROM `#__templates_menu` WHERE `client_id`="0" AND `menuid`="0"'; } $db = JFactory::getDbo(); $db->setQuery($q); $templateName = $db->loadResult(); } else { $templateName = shopFunctionsF::setTemplate($vmtemplate); } 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 = VmModel::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' => JText::sprintf('COM_VIRTUEMART_INVOICE_TITLE', $vendor->vendor_store_name, $view->invoiceNumber, $orderDetails['details']['BT']->order_number), 'keywords' => JText::_('COM_VIRTUEMART_INVOICE_CREATOR')); return VmPdf::createVmPdf($view, $path, 'F', $metadata); }
function checkStoreInvoice($orderDetails = 0) { JRequest::setVar('task', 'checkStoreInvoice'); $force = true; // @ini_set( 'max_execution_time', 5 ); $path = VmConfig::get('forSale_path', 0); if ($path === 0) { vmError('No path set to store invoices'); return false; } else { $path .= 'invoices' . 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 = VmModel::getModel('orders'); $invoiceNumberDate = array(); if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) { return 0; } if (!empty($invoiceNumberDate[0])) { $invoiceNumber = $invoiceNumberDate[0]; } else { $invoiceNumber = FALSE; } if (!$invoiceNumber or empty($invoiceNumber)) { vmError('Cant create pdf, createInvoiceNumber failed'); return 0; } if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) { return 0; } $path .= 'vminvoice_' . $invoiceNumber . '.pdf'; if (file_exists($path) and !$force) { return $path; } // $app = JFactory::getApplication('site'); //We come from the be, so we need to load the FE langauge $jlang = JFactory::getLanguage(); $jlang->load('com_virtuemart', JPATH_SITE, 'en-GB', true); $jlang->load('com_virtuemart', JPATH_SITE, $jlang->getDefault(), true); $jlang->load('com_virtuemart', JPATH_SITE, null, true); $this->addViewPath(JPATH_VM_SITE . DS . 'views'); $format = 'html'; $viewName = 'invoice'; $view = $this->getView($viewName, $format); $view->addTemplatePath(JPATH_VM_SITE . DS . 'views' . DS . 'invoice' . DS . 'tmpl'); $view->invoiceNumber = $invoiceNumberDate[0]; $view->invoiceDate = $invoiceNumberDate[1]; $view->orderDetails = $orderDetails; $view->uselayout = 'invoice'; ob_start(); $view->display(); $html = ob_get_contents(); ob_end_clean(); // create new PDF document $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator('Invoice by VirtueMart 2, used library tcpdf'); $pdf->SetAuthor($view->vendor->vendor_name); $pdf->SetTitle(JText::_('COM_VIRTUEMART_INVOICE_TITLE')); $pdf->SetSubject(JText::sprintf('COM_VIRTUEMART_INVOICE_SUBJ', $view->vendor->vendor_store_name)); $pdf->SetKeywords('Invoice by VirtueMart 2'); //virtuemart.cloudaccess.net/index.php?option=com_virtuemart&view=invoice&layout=details&virtuemart_order_id=18&order_number=6e074d9b&order_pass=p_9cb9e2&task=checkStoreInvoice if (empty($view->vendor->images[0])) { vmError('Vendor image given path empty '); } else { if (empty($view->vendor->images[0]->file_url_folder) or empty($view->vendor->images[0]->file_name) or empty($view->vendor->images[0]->file_extension)) { vmError('Vendor image given image is not complete ' . $view->vendor->images[0]->file_url_folder . $view->vendor->images[0]->file_name . '.' . $view->vendor->images[0]->file_extension); vmdebug('Vendor image given image is not complete, the given media', $view->vendor->images[0]); } else { if (!empty($view->vendor->images[0]->file_extension) and strtolower($view->vendor->images[0]->file_extension) == 'png') { vmError('Warning extension of the image is a png, tpcdf has problems with that in the header, choose a jpg or gif'); } else { $imagePath = DS . str_replace('/', DS, $view->vendor->images[0]->file_url_folder . $view->vendor->images[0]->file_name . '.' . $view->vendor->images[0]->file_extension); if (!file_exists(JPATH_ROOT . $imagePath)) { vmError('Vendor image missing ' . $imagePath); } else { $pdf->SetHeaderData($imagePath, 60, $view->vendor->vendor_store_name, $view->vendorAddress); } } } } // set header and footer fonts $pdf->setHeaderFont(array('helvetica', '', 8)); $pdf->setFooterFont(array('helvetica', '', 10)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //TODO include the right file (in libraries/tcpdf/config/lang set some language-dependent strings $l = ''; $pdf->setLanguageArray($l); // set default font subsetting mode $pdf->setFontSubsetting(true); // Set font // dejavusans is a UTF-8 Unicode font, if you only need to // print standard ASCII chars, you can use core fonts like // helvetica or times to reduce file size. $pdf->SetFont('helvetica', '', 8, '', true); // Add a page // This method has several options, check the source code documentation for more information. $pdf->AddPage(); // Set some content to print // $html = // Print text using writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); // Close and output PDF document // This method has several options, check the source code documentation for more information. $pdf->Output($path, 'F'); return $path; }
$print_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'{$print_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\" >"; $print_link .= '<span class="hasTip print_32" title="' . JText::_('COM_VIRTUEMART_PRINT') . '"> </span></a>'; $invoice_link = ''; $deliverynote_link = ''; if (!$order->invoiceNumber) { $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=1'; $invoice_link .= "<a href=\"{$invoice_url}\" >" . '<span class="hasTip invoicenew_32" title="' . JText::_('COM_VIRTUEMART_INVOICE_CREATE') . '"></span></a>'; } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) { $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip invoice_32" title="' . JText::_('COM_VIRTUEMART_INVOICE') . '"></span></a>'; } if (!$order->invoiceNumber) { $deliverynote_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=1'; $deliverynote_link = "<a href=\"{$deliverynote_url}\" >" . '<span class="hasTip deliverynotenew_32" title="' . JText::_('COM_VIRTUEMART_DELIVERYNOTE_CREATE') . '"></span></a>'; } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) { $deliverynote_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip deliverynote_32" title="' . JText::_('COM_VIRTUEMART_DELIVERYNOTE') . '"></span></a>'; } ?> <td><?php echo $print_link; echo $deliverynote_link; echo $invoice_link; ?> </td> <!-- Order date --> <td><?php echo vmJsApi::date($order->created_on, 'LC2', TRUE); ?> </td>
function getInvoicePDF($orderDetails = 0, $viewName = 'invoice', $layout = 'invoice', $format = 'html', $force = false) { JRequest::setVar('task', 'checkStoreInvoice'); $force = true; // @ini_set( 'max_execution_time', 5 ); $path = VmConfig::get('forSale_path', 0); if ($path === 0) { vmError('No path set to store invoices'); return false; } else { $path .= 'invoices/'; 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 = VmModel::getModel('orders'); $invoiceNumberDate = array(); if (!$orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate)) { return 0; } if (!empty($invoiceNumberDate[0])) { $invoiceNumber = $invoiceNumberDate[0]; } else { $invoiceNumber = FALSE; } if (!$invoiceNumber or empty($invoiceNumber)) { vmError('Cant create pdf, createInvoiceNumber failed'); return 0; } if (shopFunctions::InvoiceNumberReserved($invoiceNumber)) { return 0; } $path .= preg_replace('/[^A-Za-z0-9_\\-\\.]/', '_', 'vminvoice_' . $invoiceNumber . '.pdf'); if (file_exists($path) and !$force) { return $path; } // $app = JFactory::getApplication('site'); //We come from the be, so we need to load the FE langauge $jlang = JFactory::getLanguage(); $jlang->load('com_virtuemart', JPATH_SITE, 'en-GB', true); $jlang->load('com_virtuemart', JPATH_SITE, $jlang->getDefault(), true); $jlang->load('com_virtuemart', JPATH_SITE, null, true); $app = JApplication::getInstance('site', array(), 'J'); // $viewLayout = JRequest::getCmd('layout', 'default'); $viewName = 'invoice'; $view = $this->getView($viewName, 'html', '', array('base_path' => $this->basePath, 'layout' => 'invoice')); // attach the document to the view $attributes = array('charset' => 'utf-8', 'lineend' => 'unix', 'tab' => ' ', 'language' => $jlang->getTag(), 'direction' => $jlang->isRTL() ? 'rtl' : 'ltr'); $document = JDocument::getInstance('pdf', $attributes); $view->document = $document; $view->document->setDestination('F'); // render to file $view->document->setPath($path); $viewType = $view->document->getType(); $vmtemplate = VmConfig::get('vmtemplate', 0); if ($vmtemplate === 0 or $vmtemplate == 'default') { $q = 'SELECT `template` FROM `#__template_styles` WHERE `client_id`="0" AND `home`="1"'; $db = JFactory::getDbo(); $db->setQuery($q); $templateName = $db->loadResult(); } else { $templateName = $vmtemplate; } $TemplateOverrideFolder = JPATH_SITE . '/templates' . $templateName . '/html/com_virtuemart/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; ob_start(); $view->display(); // test mode is print2 $html = ob_get_clean(); $view->document->setBuffer($html); // $html must contain the path here $view->document->render(); //var_dump( $this->basePath,$template,$format,$app,$view,$document,$this,$html); jexit(); return $view->document->getPath(); }
?> <tr> <td class="key"><strong><?php echo JText::_('COM_VIRTUEMART_COUPON_CODE'); ?> </strong></td> <td><?php echo $this->orderbt->coupon_code; ?> </td> </tr> <?php } ?> <?php if ($this->orderbt->invoiceNumber and !shopFunctions::InvoiceNumberReserved($this->orderbt->invoiceNumber)) { $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $this->orderbt->virtuemart_order_id . '&order_number=' . $this->orderbt->order_number . '&order_pass='******'COM_VIRTUEMART_INVOICE_PRINT') . "\" href=\"javascript:void window.open('{$invoice_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\" >"; $invoice_link .= $this->orderbt->invoiceNumber . '</a>'; ?> <tr> <td class="key"><strong><?php echo JText::_('COM_VIRTUEMART_INVOICE'); ?> </strong></td> <td><?php echo $invoice_link; ?> </td> </tr> <?php
/** * Notifies the customer that the Order Status has been changed * * @author Christopher Roussel, Valérie Isaksen, Max Milbers * */ public function notifyCustomer($tsmart_order_id, $newOrderData = 0) { if (isset($newOrderData['customer_notified']) && $newOrderData['customer_notified'] == 0) { return true; } if (!class_exists('shopFunctionsF')) { require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php'; } //Important, the data of the order update mails, payments and invoice should //always be in the database, so using getOrder is the right method $orderModel = tmsModel::getModel('orders'); $order = $orderModel->getOrder($tsmart_order_id); $payment_name = $shipment_name = ''; if (!class_exists('vmPSPlugin')) { require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php'; } JPluginHelper::importPlugin('vmshipment'); JPluginHelper::importPlugin('vmpayment'); $dispatcher = JDispatcher::getInstance(); $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($order['details']['BT']->tsmart_order_id, $order['details']['BT']->tsmart_shipmentmethod_id, &$shipment_name)); $returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($order['details']['BT']->tsmart_order_id, $order['details']['BT']->tsmart_paymentmethod_id, &$payment_name)); $order['shipmentName'] = $shipment_name; $order['paymentName'] = $payment_name; if ($newOrderData != 0) { //We do not really need that $vars['newOrderData'] = (array) $newOrderData; } $vars['orderDetails'] = $order; //$vars['includeComments'] = vRequest::getVar('customer_notified', array()); //I think this is misleading, I think it should always ask for example $vars['newOrderData']['doVendor'] directly //Using this function garantue us that it is always there. If the vendor should be informed should be done by the plugins //We may add later something to the method, defining this better $vars['url'] = 'url'; if (!isset($newOrderData['doVendor'])) { $vars['doVendor'] = false; } else { $vars['doVendor'] = $newOrderData['doVendor']; } $tsmart_vendor_id = $order['details']['BT']->tsmart_vendor_id; $vendorModel = tmsModel::getModel('vendor'); $vendor = $vendorModel->getVendor($tsmart_vendor_id); $vars['vendor'] = $vendor; $vendorEmail = $vendorModel->getVendorEmail($tsmart_vendor_id); $vars['vendorEmail'] = $vendorEmail; // florian : added if pdf invoice are enabled $invoiceNumberDate = array(); if ($orderModel->createInvoiceNumber($order['details']['BT'], $invoiceNumberDate)) { $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::getInt('create_invoice', -1); //TODO we need an array of orderstatus if (in_array($order['details']['BT']->order_status, $orderstatusForInvoice) or $pdfInvoice == 1 or $force_create_invoice == 1) { if (!shopFunctions::InvoiceNumberReserved($invoiceNumberDate[0])) { if (!class_exists('tsmartControllerInvoice')) { require VMPATH_SITE . DS . 'controllers' . DS . 'invoice.php'; } $controller = new tsmartControllerInvoice(array('model_path' => VMPATH_SITE . DS . 'models', 'view_path' => VMPATH_SITE . DS . 'views')); $vars['mediaToSend'][] = $controller->getInvoicePDF($order); } } } // Send the email $res = shopFunctionsF::renderMail('invoice', $order['details']['BT']->email, $vars, null, $vars['doVendor'], $this->useDefaultEmailOrderStatus); if (is_object($res) or !$res) { $string = 'com_tsmart_NOTIFY_CUSTOMER_ERR_SEND'; vmdebug('notifyCustomer function shopFunctionsF::renderMail throws JException'); $res = 0; } else { if ($res and $res != -1) { $string = 'com_tsmart_NOTIFY_CUSTOMER_SEND_MSG'; } } if ($res != -1) { vmInfo(tsmText::_($string, false) . ' ' . $order['details']['BT']->first_name . ' ' . $order['details']['BT']->last_name . ', ' . $order['details']['BT']->email); } //quicknDirty to prevent that an email is sent twice $app = JFactory::getApplication(); if ($app->isSite()) { if (!class_exists('tsmartCart')) { require VMPATH_SITE . DS . 'helpers' . DS . 'cart.php'; } $cart = tsmartCart::getCart(); $cart->customer_notified = true; } return true; }
function createPrintLinks($order, &$print_link, &$deliverynote_link, &$invoice_link) { /* Print view URL */ $print_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'{$print_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\" >"; $print_link .= '<span class="hasTip print_32" title="' . vmText::_('COM_VIRTUEMART_PRINT') . '"> </span></a>'; $invoice_link = ''; $deliverynote_link = ''; $pdfDummi = '&d=' . rand(0, 100); if (!$order->invoiceNumber) { $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=' . $order->order_create_invoice_pass . $pdfDummi; $invoice_link .= "<a href=\"{$invoice_url}\" >" . '<span class="hasTip invoicenew_32" title="' . vmText::_('COM_VIRTUEMART_INVOICE_CREATE') . '"></span></a>'; } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) { $invoice_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=invoice&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip invoice_32" title="' . vmText::_('COM_VIRTUEMART_INVOICE') . '"></span></a>'; } if (!$order->invoiceNumber) { $deliverynote_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'&create_invoice=' . $order->order_create_invoice_pass . $pdfDummi; $deliverynote_link = "<a href=\"{$deliverynote_url}\" >" . '<span class="hasTip deliverynotenew_32" title="' . vmText::_('COM_VIRTUEMART_DELIVERYNOTE_CREATE') . '"></span></a>'; } elseif (!shopFunctions::InvoiceNumberReserved($order->invoiceNumber)) { $deliverynote_url = juri::root() . 'index.php?option=com_virtuemart&view=invoice&layout=deliverynote&format=pdf&tmpl=component&virtuemart_order_id=' . $order->virtuemart_order_id . '&order_number=' . $order->order_number . '&order_pass='******'<span class="hasTip deliverynote_32" title="' . vmText::_('COM_VIRTUEMART_DELIVERYNOTE') . '"></span></a>'; } }