diff --git a/Makefile b/Makefile index 5f5f06d72aaf725ffd5929c30d56321deb0eabd4..2bc6e55d6d5771e3a76ec8543fcf3db8a6fa3101 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,13 @@ BASE=ordernumber PLUGINTYPE=vmshopper -VERSION=1.14 +VERSION=1.90 PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html SYSTRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).*sys.ini) NONSYSTRANSLATIONS=${SYSTRANSLATIONS:%.sys.ini=%.ini} TRANSLATIONS=$(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) $(call wildcard,language/*/index.html) language/index.html +FIELDS=$(call wildcard,fields/*.php) ZIPFILE=plg_$(PLUGINTYPE)_$(BASE)_v$(VERSION).zip all: zip @@ -16,8 +17,7 @@ $(NONSYSTRANSLATIONS): %.ini: %.sys.ini zip: $(PLUGINFILES) $(TRANSLATIONS) $(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) @echo "Packing all files into distribution file $(ZIPFILE):" - @zip -r $(ZIPFILE) $(PLUGINFILES) - @zip -r $(ZIPFILE) $(TRANSLATIONS) + @zip -r $(ZIPFILE) $(PLUGINFILES) $(TRANSLATIONS) $(FIELDS) clean: rm -f $(ZIPFILE) diff --git a/fields/vmordernumbercounters.php b/fields/vmordernumbercounters.php new file mode 100644 index 0000000000000000000000000000000000000000..bf1a24d3754c5d0a1742dbd1eff50fcae2db40a2 --- /dev/null +++ b/fields/vmordernumbercounters.php @@ -0,0 +1,83 @@ +<?php +defined('_JEXEC') or die(); +/** + * + * @package VirtueMart + * @subpackage Plugins - Fields + * @author Reinhold Kainhofer, Open Tools + * @link http://www.open-tools.net + * @copyright Copyright (c) 2014 Reinhold Kainhofer. All rights reserved. + * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php + * VirtueMart is free software. This version may have been modified pursuant + * to the GNU General Public License, and as distributed it includes or + * is derivative of works licensed under the GNU General Public License or + * other free or open source software licenses. + */ + +defined('DS') or define('DS', DIRECTORY_SEPARATOR); + +class JFormFieldVmOrdernumberCounters extends JFormField { + var $_name = 'vmOrdernumberCounters'; + + protected $countertype; + + public function __get($name) + { + switch ($name) + { + case 'countertype': + return $this->$name; + } + + return parent::__get($name); + } + + public function __set($name, $value) + { + switch ($name) + { + case 'countertype': + $this->$name = (string) $value; + break; + + default: + parent::__set($name, $value); + } + } + + public function setup(SimpleXMLElement $element, $value, $group = null) + { + $return = parent::setup($element, $value, $group); + + if ($return) { + $this->countertype = (string) $this->element['countertype']; + } + + return $return; + } + + protected function getInput() { + // Look up the current counters + $db = JFactory::getDBO(); + $db->setQuery('SELECT `number_format`, `count` FROM `#__virtuemart_shopper_plg_ordernumber` WHERE `number_type`='.(string)$this->countertype . ' ORDER BY `number_format`;' ); + $counters = $db->loadObjectList(); +// JFactory::getApplication()->enqueueMessage("<pre>All counters: ".print_r($counters, 1)."</pre>", 'error'); + // Joomla 2.x uses <li> for the params and float:left on the controls, so we need to add that too + $version = new JVersion(); + $float = ""; + if (version_compare(JVERSION, '3.0', 'lt')) { + $float = "float: left; "; + } + + $ret = "<table border=\"1\" style=\"border: 1px solid dark-gray; border-collapse: collapse; display: inline-table; $float\"><tr><th>".JText::_('PLG_ORDERNUMBER_COUNTERLIST_HEADER_COUNTER')."</th><th>".JText::_('PLG_ORDERNUMBER_COUNTERLIST_HEADER_VALUE'). "</th></tr>"; + $ret .= "<colgroup><col ><col style=\"text-align: center\" ></colgroup>"; + foreach ($counters as $c) { + if ($c->number_format=="") { + $c->number_format = JText::_ ('PLG_ORDERNUMBER_COUNTERLIST_GLOBAL'); + } + $ret .= "<tr><td>" . (string)$c->number_format . "</td><td>" . (string)$c->count . "</td></tr>"; + } + $ret .= "</table>"; + return $ret; + } +} \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_vmshopper_ordernumber.ini b/language/en-GB/en-GB.plg_vmshopper_ordernumber.ini index 1d9313e990fd8852cf3541c9d334ddf349224e16..fc4bdf76edd99e4e71dd0a607582c23b30ebeb17 100644 --- a/language/en-GB/en-GB.plg_vmshopper_ordernumber.ini +++ b/language/en-GB/en-GB.plg_vmshopper_ordernumber.ini @@ -45,3 +45,7 @@ PLG_ORDERNUMBER_CUSTOMERNR_COUNTER_DESC="Choose whether you want one global coun PLG_ORDERNUMBER_CUSTOMERNR_PADDING="Minimum digits for the counter" PLG_ORDERNUMBER_CUSTOMERNR_PADDING_DESC="Select the minimum number of digits that the counter shall display. The value of the counter will be left-padded with 0 to have this minimum number of digits. If the counter is already larger than this number, no padding will occur" +PLG_ORDERNUMBER_ORDERNR_ALLCOUNTERS="All counter values" +PLG_ORDERNUMBER_COUNTERLIST_GLOBAL="<i>Global counter</i>" +PLG_ORDERNUMBER_COUNTERLIST_HEADER_COUNTER="Counter format/name" +PLG_ORDERNUMBER_COUNTERLIST_HEADER_VALUE="Counter value" \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_vmshopper_ordernumber.sys.ini b/language/en-GB/en-GB.plg_vmshopper_ordernumber.sys.ini index 1d9313e990fd8852cf3541c9d334ddf349224e16..fc4bdf76edd99e4e71dd0a607582c23b30ebeb17 100644 --- a/language/en-GB/en-GB.plg_vmshopper_ordernumber.sys.ini +++ b/language/en-GB/en-GB.plg_vmshopper_ordernumber.sys.ini @@ -45,3 +45,7 @@ PLG_ORDERNUMBER_CUSTOMERNR_COUNTER_DESC="Choose whether you want one global coun PLG_ORDERNUMBER_CUSTOMERNR_PADDING="Minimum digits for the counter" PLG_ORDERNUMBER_CUSTOMERNR_PADDING_DESC="Select the minimum number of digits that the counter shall display. The value of the counter will be left-padded with 0 to have this minimum number of digits. If the counter is already larger than this number, no padding will occur" +PLG_ORDERNUMBER_ORDERNR_ALLCOUNTERS="All counter values" +PLG_ORDERNUMBER_COUNTERLIST_GLOBAL="<i>Global counter</i>" +PLG_ORDERNUMBER_COUNTERLIST_HEADER_COUNTER="Counter format/name" +PLG_ORDERNUMBER_COUNTERLIST_HEADER_VALUE="Counter value" \ No newline at end of file diff --git a/ordernumber.php b/ordernumber.php index cba1aa218aeac7f0eef59796031209baad1cf826..61b04ebf0054e6299b6e2e6c98878a165e18f7c9 100644 --- a/ordernumber.php +++ b/ordernumber.php @@ -223,6 +223,19 @@ class plgVmShopperOrdernumber extends vmShopperPlugin { return $data; } } + + + /** + * plgVmOnSelfCallBE ... Called to execute some plugin action in the backend (e.g. set/reset dl counter, show statistics etc.) + */ +/* function plgVmOnSelfCallBE($type, $name, &$output) { + if ($name != $this->_name || $type != 'vmshopper') return false; + vmDebug('plgVmOnSelfCallBE'); + + $db = JFactory::getDBO(); + $nullDate = $db->getNullDate(); + }*/ + /* In versions before VM 2.6.8, the onStoreInstallPluginTable function was protected, so the installer couldn't call it to create the plugin table... This function simply is a public wrapper to make this function available to the installer on all VM versions: */ diff --git a/ordernumber.xml b/ordernumber.xml index 98c860b2cf0ceef06ef862a3876a4d2ba88a51ff..e702bd7df099c675b568c4e07c16b42900ad05dd 100644 --- a/ordernumber.xml +++ b/ordernumber.xml @@ -7,7 +7,7 @@ <authorUrl>http://www.open-tools.net/</authorUrl> <copyright>Copyright (C) 2012-2014 Reinhold Kainhofer. All rights reserved.</copyright> <license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license> - <version>1.14</version> + <version>1.90</version> <releaseDate>2014-10-05</releaseDate> <releaseType>Minor update</releaseType> <downloadUrl>http://www.open-tools.net/virtuemart-2-extensions/vm2-ordernumber-plugin.html</downloadUrl> @@ -18,7 +18,8 @@ <filename plugin="ordernumber">ordernumber.php</filename> <filename>ordernumber.script.php</filename> <filename>index.html</filename> - <folder>language</folder> + <folder>language</folder> + <folder>fields</folder> </files> <scriptfile>ordernumber.script.php</scriptfile> <languages folder="language"> @@ -29,7 +30,7 @@ </languages> <!-- Joomla 2.5 & 3.0 config --> <config> - <fields name="params"> + <fields name="params" addfieldpath="/plugins/vmshopper/ordernumber/fields"> <fieldset name="basic"> <field name="order_options" type="spacer" label="PLG_ORDERNUMBER_ORDERNR" /> <field name="customize_order_number" type="radio" default="0" class="btn-group btn-group-yesno" label="PLG_ORDERNUMBER_ORDERNR_CUSTOMIZE" description="PLG_ORDERNUMBER_ORDERNR_CUSTOMIZE_DESC"> @@ -42,6 +43,7 @@ <option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option> <option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option> </field> + <field name="order_number_allcounters" type="VmOrdernumberCounters" label="PLG_ORDERNUMBER_ORDERNR_ALLCOUNTERS" countertype="0" /> <field name="password_options" type="spacer" label="PLG_ORDERNUMBER_PASSWD" /> @@ -62,6 +64,7 @@ <option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option> <option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option> </field> + <field name="invoice_number_allcounters" type="VmOrdernumberCounters" label="PLG_ORDERNUMBER_ORDERNR_ALLCOUNTERS" countertype="1" /> <field name="customer_options" type="spacer" label="PLG_ORDERNUMBER_CUSTOMERNR" /> <field name="customize_customer_number" type="radio" default="0" class="btn-group btn-group-yesno" label="PLG_ORDERNUMBER_CUSTOMERNR_CUSTOMIZE" description="PLG_ORDERNUMBER_CUSTOMERNR_CUSTOMIZE_DESC"> @@ -74,6 +77,7 @@ <option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option> <option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option> </field> + <field name="customer_number_allcounters" type="VmOrdernumberCounters" label="PLG_ORDERNUMBER_ORDERNR_ALLCOUNTERS" countertype="2" /> </fieldset> </fields> </config> diff --git a/releases/plg_vmshopper_ordernumber_v1.90.zip b/releases/plg_vmshopper_ordernumber_v1.90.zip new file mode 100644 index 0000000000000000000000000000000000000000..2c59c7fe06bd0c46d7d1a431d03632a702e5aca7 Binary files /dev/null and b/releases/plg_vmshopper_ordernumber_v1.90.zip differ