Skip to content
Snippets Groups Projects
Commit e9a0a8ca authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V1.6.1: Fix issues with updated/moved language files (need to remove old files...

V1.6.1: Fix issues with updated/moved language files (need to remove old files from global language dir)

Created and install ordernumber.script.php to run code on plugin update; Also removes the mysql table upon deinstallation.
parent a749f114
No related branches found
No related tags found
No related merge requests found
BASE=ordernumber BASE=ordernumber
PLUGINTYPE=vmshopper PLUGINTYPE=vmshopper
VERSION=1.6 VERSION=1.6.1
PLUGINFILES=$(BASE).php $(BASE).xml index.html PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
# TRANSDIR=../../../administrator/language/ # TRANSDIR=../../../administrator/language/
# TRANSLATIONS=$(call wildcard,$(TRANSDIR)/*/*.plg_$(PLUGINTYPE)_$(BASE).sys.ini) # TRANSLATIONS=$(call wildcard,$(TRANSDIR)/*/*.plg_$(PLUGINTYPE)_$(BASE).sys.ini)
TRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).sys.ini) language/index.html $(call wildcard,language/**/index.html) TRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).sys.ini) language/index.html $(call wildcard,language/**/index.html)
......
...@@ -106,7 +106,7 @@ class plgVmShopperOrdernumber extends vmShopperPlugin { ...@@ -106,7 +106,7 @@ class plgVmShopperOrdernumber extends vmShopperPlugin {
function plgVmOnUpdateOrderBEShopper($_orderID) {} function plgVmOnUpdateOrderBEShopper($_orderID) {}
/* Replace the format variables, match[1] is the variable name, match[2] and match[3] are only used for random fields */ /* Replace the format variables, match[1] is the variable name, match[2] and match[3] are only used for random fields */
/* Type 0 means order number, type 1 means invoice number, type 2 means customer number */ /* Type 0 means order number, type 1 means invoice number, type 2 means customer number, 3 means order password */
function replace_fields ($fmt, $nrtype, $details) { function replace_fields ($fmt, $nrtype, $details) {
// Match variables for the form random[type][count] and everything else. // Match variables for the form random[type][count] and everything else.
// This makes it possible to handle "random" just like any other type! // This makes it possible to handle "random" just like any other type!
...@@ -172,7 +172,7 @@ class plgVmShopperOrdernumber extends vmShopperPlugin { ...@@ -172,7 +172,7 @@ class plgVmShopperOrdernumber extends vmShopperPlugin {
// Is order password customization enabled? // Is order password customization enabled?
if ($this->params->get('customize_order_password')) { if ($this->params->get('customize_order_password')) {
$fmt = $this->params->get ('order_password_format', "[randomHex8]"); $fmt = $this->params->get ('order_password_format', "[randomHex8]");
$passwd = $this->replace_fields ($fmt, $orderDetails); $passwd = $this->replace_fields ($fmt, 3, $orderDetails);
$orderDetails->order_pass = $passwd; $orderDetails->order_pass = $passwd;
} }
} }
......
<?php
defined('_JEXEC') or die('Restricted access');
class plgVmShopperOrdernumberInstallerScript
{
/**
* Constructor
*
* @param JAdapterInstance $adapter The object responsible for running this script
*/
// public function __constructor(JAdapterInstance $adapter);
/**
* Called before any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install)
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
// public function preflight($route, JAdapterInstance $adapter);
/**
* Called after any type of action
*
* @param string $route Which action is happening (install|uninstall|discover_install)
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
// public function postflight($route, JAdapterInstance $adapter);
/**
* Called on installation
*
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function install(JAdapterInstance $adapter)
{
// enabling plugin
$db =& JFactory::getDBO();
$db->setQuery('update #__extensions set enabled = 1 where type = "plugin" and element = "ordernumber" and folder = "vmshopper"');
$db->query();
return True;
}
/**
* Called on update
*
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function update(JAdapterInstance $adapter)
{
jimport( 'joomla.filesystem.file' );
JFile::delete( JPATH_ROOT . DS . "administrator" . DS . "language" . DS . "en-GB" . DS . "en-GB.plg_vmshopper_ordernumber.sys.ini");
JFile::delete( JPATH_ROOT . DS . "administrator" . DS . "language" . DS . "de-DE" . DS . "de-DE.plg_vmshopper_ordernumber.sys.ini");
return true;
}
/**
* Called on uninstallation
*
* @param JAdapterInstance $adapter The object responsible for running this script
*/
public function uninstall(JAdapterInstance $adapter)
{
// Remove plugin table
$db =& JFactory::getDBO();
$db->setQuery('DROP TABLE `#__virtuemart_shopper_plg_ordernumber`;');
$db->query();
}
}
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<authorUrl>http://www.kainhofer.com/</authorUrl> <authorUrl>http://www.kainhofer.com/</authorUrl>
<copyright>Copyright (C) 2012-2013 Reinhold Kainhofer. All rights reserved.</copyright> <copyright>Copyright (C) 2012-2013 Reinhold Kainhofer. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license> <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license>
<version>1.6.0</version> <version>1.6.1</version>
<releaseDate>2013-01-09</releaseDate> <releaseDate>2013-01-09</releaseDate>
<releaseType>Minor update</releaseType> <releaseType>Minor update</releaseType>
<downloadUrl>http://www.kainhofer.com/virtuemart-2-extensions/vm2-ordernumber-plugin.html</downloadUrl> <downloadUrl>http://www.kainhofer.com/virtuemart-2-extensions/vm2-ordernumber-plugin.html</downloadUrl>
...@@ -16,9 +16,11 @@ ...@@ -16,9 +16,11 @@
<files> <files>
<filename plugin="ordernumber">ordernumber.php</filename> <filename plugin="ordernumber">ordernumber.php</filename>
<filename>index.html</filename> <filename>ordernumber.script.php</filename>
<filename>index.html</filename>
<folder>language</folder> <folder>language</folder>
</files> </files>
<scriptfile>ordernumber.script.php</scriptfile>
<config> <config>
<fields name="params"> <fields name="params">
<fieldset name="basic"> <fieldset name="basic">
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment