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

V1.90: Add a field to display all current counter values from the database; No editing yet, though

parent cb55562a
No related branches found
No related tags found
No related merge requests found
BASE=ordernumber BASE=ordernumber
PLUGINTYPE=vmshopper PLUGINTYPE=vmshopper
VERSION=1.14 VERSION=1.90
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
SYSTRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).*sys.ini) SYSTRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).*sys.ini)
NONSYSTRANSLATIONS=${SYSTRANSLATIONS:%.sys.ini=%.ini} NONSYSTRANSLATIONS=${SYSTRANSLATIONS:%.sys.ini=%.ini}
TRANSLATIONS=$(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) $(call wildcard,language/*/index.html) language/index.html TRANSLATIONS=$(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) $(call wildcard,language/*/index.html) language/index.html
FIELDS=$(call wildcard,fields/*.php)
ZIPFILE=plg_$(PLUGINTYPE)_$(BASE)_v$(VERSION).zip ZIPFILE=plg_$(PLUGINTYPE)_$(BASE)_v$(VERSION).zip
all: zip all: zip
...@@ -16,8 +17,7 @@ $(NONSYSTRANSLATIONS): %.ini: %.sys.ini ...@@ -16,8 +17,7 @@ $(NONSYSTRANSLATIONS): %.ini: %.sys.ini
zip: $(PLUGINFILES) $(TRANSLATIONS) $(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) zip: $(PLUGINFILES) $(TRANSLATIONS) $(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS)
@echo "Packing all files into distribution file $(ZIPFILE):" @echo "Packing all files into distribution file $(ZIPFILE):"
@zip -r $(ZIPFILE) $(PLUGINFILES) @zip -r $(ZIPFILE) $(PLUGINFILES) $(TRANSLATIONS) $(FIELDS)
@zip -r $(ZIPFILE) $(TRANSLATIONS)
clean: clean:
rm -f $(ZIPFILE) rm -f $(ZIPFILE)
<?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
...@@ -45,3 +45,7 @@ PLG_ORDERNUMBER_CUSTOMERNR_COUNTER_DESC="Choose whether you want one global coun ...@@ -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="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_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
...@@ -45,3 +45,7 @@ PLG_ORDERNUMBER_CUSTOMERNR_COUNTER_DESC="Choose whether you want one global coun ...@@ -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="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_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
...@@ -223,6 +223,19 @@ class plgVmShopperOrdernumber extends vmShopperPlugin { ...@@ -223,6 +223,19 @@ class plgVmShopperOrdernumber extends vmShopperPlugin {
return $data; 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... /* 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: */ This function simply is a public wrapper to make this function available to the installer on all VM versions: */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<authorUrl>http://www.open-tools.net/</authorUrl> <authorUrl>http://www.open-tools.net/</authorUrl>
<copyright>Copyright (C) 2012-2014 Reinhold Kainhofer. All rights reserved.</copyright> <copyright>Copyright (C) 2012-2014 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.14</version> <version>1.90</version>
<releaseDate>2014-10-05</releaseDate> <releaseDate>2014-10-05</releaseDate>
<releaseType>Minor update</releaseType> <releaseType>Minor update</releaseType>
<downloadUrl>http://www.open-tools.net/virtuemart-2-extensions/vm2-ordernumber-plugin.html</downloadUrl> <downloadUrl>http://www.open-tools.net/virtuemart-2-extensions/vm2-ordernumber-plugin.html</downloadUrl>
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
<filename plugin="ordernumber">ordernumber.php</filename> <filename plugin="ordernumber">ordernumber.php</filename>
<filename>ordernumber.script.php</filename> <filename>ordernumber.script.php</filename>
<filename>index.html</filename> <filename>index.html</filename>
<folder>language</folder> <folder>language</folder>
<folder>fields</folder>
</files> </files>
<scriptfile>ordernumber.script.php</scriptfile> <scriptfile>ordernumber.script.php</scriptfile>
<languages folder="language"> <languages folder="language">
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
</languages> </languages>
<!-- Joomla 2.5 & 3.0 config --> <!-- Joomla 2.5 & 3.0 config -->
<config> <config>
<fields name="params"> <fields name="params" addfieldpath="/plugins/vmshopper/ordernumber/fields">
<fieldset name="basic"> <fieldset name="basic">
<field name="order_options" type="spacer" label="PLG_ORDERNUMBER_ORDERNR" /> <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"> <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 @@ ...@@ -42,6 +43,7 @@
<option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option> <option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option>
<option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option> <option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option>
</field> </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" /> <field name="password_options" type="spacer" label="PLG_ORDERNUMBER_PASSWD" />
...@@ -62,6 +64,7 @@ ...@@ -62,6 +64,7 @@
<option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option> <option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option>
<option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option> <option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option>
</field> </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="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"> <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 @@ ...@@ -74,6 +77,7 @@
<option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option> <option value="1">PLG_ORDERNUMBER_COUNTER_GLOBAL</option>
<option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option> <option value="0">PLG_ORDERNUMBER_COUNTER_PERFORMAT</option>
</field> </field>
<field name="customer_number_allcounters" type="VmOrdernumberCounters" label="PLG_ORDERNUMBER_ORDERNR_ALLCOUNTERS" countertype="2" />
</fieldset> </fieldset>
</fields> </fields>
</config> </config>
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment