本文整理汇总了PHP中shopFunctions::getInvoicePath方法的典型用法代码示例。如果您正苦于以下问题:PHP shopFunctions::getInvoicePath方法的具体用法?PHP shopFunctions::getInvoicePath怎么用?PHP shopFunctions::getInvoicePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shopFunctions
的用法示例。
在下文中一共展示了shopFunctions::getInvoicePath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteInvoice
/** Delete Invoice when an item is updated
*
* @author Valérie Isaksen
* @param $order_id Id of the order
* @return boolean true if deleted successful, false if there was a problem
*/
function deleteInvoice($order_id)
{
$db = JFactory::getDBO();
$q = 'SELECT * FROM `#__virtuemart_invoices` WHERE `virtuemart_order_id`= "' . $order_id . '" ';
$db->setQuery($q);
$data = $db->loadAssoc();
if (!$data or empty($data['invoice_number'])) {
return true;
}
// rename invoice pdf file
$invoice_prefix = 'vminvoice_';
$path = shopFunctions::getInvoicePath(VmConfig::get('forSale_path', 0));
$invoice_name_src = $path . DS . $invoice_prefix . $data['invoice_number'] . '.pdf';
if (!file_exists($invoice_name_src)) {
// was already deleted by a previoous change
return;
}
if (!class_exists('JFile')) {
require JPATH_VM_LIBRARIES . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
}
if (!JFile::delete($invoice_name_src)) {
vmError('Could not delete Invoice ' . $invoice_name_src);
}
}
示例2: renameInvoice
/** Rename Invoice Number (when it is deleted, or modified
*
* @author Valérie Isaksen
* @param $order_id Id of the order
* @return boolean true if deleted successful, false if there was a problem
*/
function renameInvoice($order_id)
{
$db = JFactory::getDBO();
$q = 'SELECT * FROM `#__virtuemart_invoices` WHERE `virtuemart_order_id`= "' . $order_id . '" ';
$db->setQuery($q);
$data = $db->loadAssoc();
if (!$data or empty($data['invoice_number'])) {
return true;
}
// rename invoice pdf file
$invoice_prefix = 'vminvoice_';
$path = shopFunctions::getInvoicePath(VmConfig::get('forSale_path', 0));
$invoice_name_src = $path . DS . $invoice_prefix . $data['invoice_number'] . '.pdf';
if (!file_exists($invoice_name_src)) {
vmError('Invoice ' . $invoice_name_src . ' does not exist');
}
$date = date("Ymd");
$data['invoice_number'] = $data['invoice_number'] . '_' . $date;
$invoice_name_dst = $path . $data['invoice_number'] . '.pdf';
if (!class_exists('JFile')) {
require JPATH_VM_LIBRARIES . '/joomla/filesystem/file.php';
}
if (!JFile::move($invoice_name_src, $invoice_name_dst)) {
vmError('Could not rename Invoice ' . $invoice_name_src . 'to ' . $invoice_name_dst);
}
// update the invoice table
$table = $this->getTable('invoices');
$table->bindChecknStore($data);
return true;
}
示例3: deleteInvoice
/** Delete Invoice when an item is updated
*
* @author Valérie Isaksen
* @param $order_id Id of the order
* @return boolean true if deleted successful, false if there was a problem
*/
function deleteInvoice($order_id ) {
$db = JFactory::getDBO();
$q = 'SELECT * FROM `#__virtuemart_invoices` WHERE `virtuemart_order_id`= "'.$order_id.'" ';
$db->setQuery($q);
$data = $db->loadAssoc();
if(!$data or empty($data['invoice_number']) ){
return true;
}
// rename invoice pdf file
$invoice_prefix='vminvoice_';
$path = shopFunctions::getInvoicePath(VmConfig::get('forSale_path',0));
$invoice_name_src = $path.DS.$invoice_prefix.$data['invoice_number'].'.pdf';
if(!file_exists($invoice_name_src)){
// may be it was already deleted when changing order items
$data['invoice_number'] = $data['invoice_number'].' not found.';
} else {
$date = date("Ymd");
$data['invoice_number'] = $data['invoice_number'].'_'.$date;
$invoice_name_dst = $path.DS.$data['invoice_number'].'.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;
}
示例4: 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;
}