- get('core.edit')): ?>
+ get('region.edit')): ?>
escape($item->name); ?>
checked_out): ?>
name, $item->checked_out_time, 'regions.', $canCheckin); ?>
diff --git a/admin/layouts/help_document/details_above.php b/admin/layouts/help_document/details_above.php
new file mode 100644
index 0000000..9880405
--- /dev/null
+++ b/admin/layouts/help_document/details_above.php
@@ -0,0 +1,42 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = array(
+ 'title',
+ 'alias'
+);
+
+?>
+
diff --git a/admin/layouts/help_document/details_fullwidth.php b/admin/layouts/help_document/details_fullwidth.php
new file mode 100644
index 0000000..9a2b4cc
--- /dev/null
+++ b/admin/layouts/help_document/details_fullwidth.php
@@ -0,0 +1,48 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'content'
+);
+
+?>
+
diff --git a/admin/layouts/help_document/details_left.php b/admin/layouts/help_document/details_left.php
new file mode 100644
index 0000000..462661a
--- /dev/null
+++ b/admin/layouts/help_document/details_left.php
@@ -0,0 +1,58 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'target',
+ 'groups',
+ 'location',
+ 'admin_view',
+ 'site_view'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/help_document/details_right.php b/admin/layouts/help_document/details_right.php
new file mode 100644
index 0000000..0fc5d0e
--- /dev/null
+++ b/admin/layouts/help_document/details_right.php
@@ -0,0 +1,56 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'type',
+ 'url',
+ 'article'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/help_document/details_under.php b/admin/layouts/help_document/details_under.php
new file mode 100644
index 0000000..ac835f3
--- /dev/null
+++ b/admin/layouts/help_document/details_under.php
@@ -0,0 +1,41 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = array(
+ 'not_required'
+);
+
+?>
+
diff --git a/admin/layouts/help_document/index.html b/admin/layouts/help_document/index.html
new file mode 100644
index 0000000..fa6d84e
--- /dev/null
+++ b/admin/layouts/help_document/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/layouts/help_document/publishing.php b/admin/layouts/help_document/publishing.php
new file mode 100644
index 0000000..a8d2a6d
--- /dev/null
+++ b/admin/layouts/help_document/publishing.php
@@ -0,0 +1,58 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$app = JFactory::getApplication();
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'created',
+ 'created_by',
+ 'modified',
+ 'modified_by'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/help_document/publlshing.php b/admin/layouts/help_document/publlshing.php
new file mode 100644
index 0000000..a93233d
--- /dev/null
+++ b/admin/layouts/help_document/publlshing.php
@@ -0,0 +1,60 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$app = JFactory::getApplication();
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'published',
+ 'ordering',
+ 'access',
+ 'version',
+ 'hits',
+ 'id'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/location/settings_above.php b/admin/layouts/location/settings_above.php
new file mode 100644
index 0000000..d2fd54d
--- /dev/null
+++ b/admin/layouts/location/settings_above.php
@@ -0,0 +1,42 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = array(
+ 'name',
+ 'region'
+);
+
+?>
+
diff --git a/admin/layouts/location/settings_fullwidth.php b/admin/layouts/location/settings_fullwidth.php
new file mode 100644
index 0000000..a0b76e5
--- /dev/null
+++ b/admin/layouts/location/settings_fullwidth.php
@@ -0,0 +1,49 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'note_set_area',
+ 'area'
+);
+
+?>
+
diff --git a/admin/layouts/location/support_groups_fullwidth.php b/admin/layouts/location/support_groups_fullwidth.php
new file mode 100644
index 0000000..ad3a4ee
--- /dev/null
+++ b/admin/layouts/location/support_groups_fullwidth.php
@@ -0,0 +1,155 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+// set the defaults
+$items = $displayData->vvwsupport_groups;
+$user = JFactory::getUser();
+$id = $displayData->item->id;
+$edit = "index.php?option=com_supportgroups&view=support_groups&task=support_group.edit";
+$ref = ($id) ? "&ref=location&refid=".$id : "";
+$new = "index.php?option=com_supportgroups&view=support_group&layout=edit".$ref;
+$can = SupportgroupsHelper::getActions('support_group');
+
+?>
+
diff --git a/admin/layouts/payment/details_above.php b/admin/layouts/payment/details_above.php
new file mode 100644
index 0000000..c1d0df5
--- /dev/null
+++ b/admin/layouts/payment/details_above.php
@@ -0,0 +1,41 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = array(
+ 'support_group'
+);
+
+?>
+
diff --git a/admin/layouts/region/details_left.php b/admin/layouts/payment/details_left.php
similarity index 97%
rename from admin/layouts/region/details_left.php
rename to admin/layouts/payment/details_left.php
index dce05e7..78a923d 100644
--- a/admin/layouts/region/details_left.php
+++ b/admin/layouts/payment/details_left.php
@@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
- 'name'
+ 'year'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
diff --git a/admin/layouts/region/details_right.php b/admin/layouts/payment/details_right.php
similarity index 97%
rename from admin/layouts/region/details_right.php
rename to admin/layouts/payment/details_right.php
index 5c07834..16a246f 100644
--- a/admin/layouts/region/details_right.php
+++ b/admin/layouts/payment/details_right.php
@@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
- 'country'
+ 'amount'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
diff --git a/admin/layouts/payment/index.html b/admin/layouts/payment/index.html
new file mode 100644
index 0000000..fa6d84e
--- /dev/null
+++ b/admin/layouts/payment/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/layouts/payment/publishing.php b/admin/layouts/payment/publishing.php
new file mode 100644
index 0000000..a8d2a6d
--- /dev/null
+++ b/admin/layouts/payment/publishing.php
@@ -0,0 +1,58 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$app = JFactory::getApplication();
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'created',
+ 'created_by',
+ 'modified',
+ 'modified_by'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/payment/publlshing.php b/admin/layouts/payment/publlshing.php
new file mode 100644
index 0000000..a93233d
--- /dev/null
+++ b/admin/layouts/payment/publlshing.php
@@ -0,0 +1,60 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$app = JFactory::getApplication();
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'published',
+ 'ordering',
+ 'access',
+ 'version',
+ 'hits',
+ 'id'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/region/locations_fullwidth.php b/admin/layouts/region/locations_fullwidth.php
new file mode 100644
index 0000000..f7d1761
--- /dev/null
+++ b/admin/layouts/region/locations_fullwidth.php
@@ -0,0 +1,127 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+// set the defaults
+$items = $displayData->vvxlocations;
+$user = JFactory::getUser();
+$id = $displayData->item->id;
+$edit = "index.php?option=com_supportgroups&view=locations&task=location.edit";
+$ref = ($id) ? "&ref=region&refid=".$id : "";
+$new = "index.php?option=com_supportgroups&view=location&layout=edit".$ref;
+$can = SupportgroupsHelper::getActions('location');
+
+?>
+
diff --git a/admin/layouts/region/settings_left.php b/admin/layouts/region/settings_left.php
new file mode 100644
index 0000000..4482cc3
--- /dev/null
+++ b/admin/layouts/region/settings_left.php
@@ -0,0 +1,54 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'name'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/region/settings_right.php b/admin/layouts/region/settings_right.php
new file mode 100644
index 0000000..90edc8b
--- /dev/null
+++ b/admin/layouts/region/settings_right.php
@@ -0,0 +1,54 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'country'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/support_group/details_above.php b/admin/layouts/support_group/details_above.php
new file mode 100644
index 0000000..97e976a
--- /dev/null
+++ b/admin/layouts/support_group/details_above.php
@@ -0,0 +1,41 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = array(
+ 'name'
+);
+
+?>
+
diff --git a/admin/layouts/support_group/details_left.php b/admin/layouts/support_group/details_left.php
index dce05e7..b25fab4 100644
--- a/admin/layouts/support_group/details_left.php
+++ b/admin/layouts/support_group/details_left.php
@@ -30,7 +30,9 @@ defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
- 'name'
+ 'phone',
+ 'location',
+ 'clinic'
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();
diff --git a/admin/layouts/support_group/details_right.php b/admin/layouts/support_group/details_right.php
new file mode 100644
index 0000000..6086b0c
--- /dev/null
+++ b/admin/layouts/support_group/details_right.php
@@ -0,0 +1,59 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = $displayData->get('fields') ?: array(
+ 'male',
+ 'male_children',
+ 'male_art',
+ 'female',
+ 'female_children',
+ 'female_art'
+);
+
+$hiddenFields = $displayData->get('hidden_fields') ?: array();
+
+foreach ($fields as $field)
+{
+ $field = is_array($field) ? $field : array($field);
+ foreach ($field as $f)
+ {
+ if ($form->getField($f))
+ {
+ if (in_array($f, $hiddenFields))
+ {
+ $form->setFieldAttribute($f, 'type', 'hidden');
+ }
+
+ echo $form->renderField($f);
+ break;
+ }
+ }
+}
diff --git a/admin/layouts/support_group/details_under.php b/admin/layouts/support_group/details_under.php
new file mode 100644
index 0000000..b5bfe87
--- /dev/null
+++ b/admin/layouts/support_group/details_under.php
@@ -0,0 +1,41 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+$form = $displayData->getForm();
+
+$fields = array(
+ 'area'
+);
+
+?>
+
diff --git a/admin/layouts/support_group/payments_fullwidth.php b/admin/layouts/support_group/payments_fullwidth.php
new file mode 100644
index 0000000..2849ce7
--- /dev/null
+++ b/admin/layouts/support_group/payments_fullwidth.php
@@ -0,0 +1,133 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+
+defined('_JEXEC') or die('Restricted access');
+
+// set the defaults
+$items = $displayData->vvvpayments;
+$user = JFactory::getUser();
+$id = $displayData->item->id;
+$edit = "index.php?option=com_supportgroups&view=payments&task=payment.edit";
+$ref = ($id) ? "&ref=support_group&refid=".$id : "";
+$new = "index.php?option=com_supportgroups&view=payment&layout=edit".$ref;
+$can = SupportgroupsHelper::getActions('payment');
+
+?>
+
diff --git a/admin/models/clinic.php b/admin/models/clinic.php
new file mode 100644
index 0000000..61659bf
--- /dev/null
+++ b/admin/models/clinic.php
@@ -0,0 +1,888 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+use Joomla\Registry\Registry;
+
+// import Joomla modelform library
+jimport('joomla.application.component.modeladmin');
+
+/**
+ * Supportgroups Clinic Model
+ */
+class SupportgroupsModelClinic extends JModelAdmin
+{
+ /**
+ * @var string The prefix to use with controller messages.
+ * @since 1.6
+ */
+ protected $text_prefix = 'COM_SUPPORTGROUPS';
+
+ /**
+ * The type alias for this content type.
+ *
+ * @var string
+ * @since 3.2
+ */
+ public $typeAlias = 'com_supportgroups.clinic';
+
+ /**
+ * Returns a Table object, always creating it
+ *
+ * @param type $type The table type to instantiate
+ * @param string $prefix A prefix for the table class name. Optional.
+ * @param array $config Configuration array for model. Optional.
+ *
+ * @return JTable A database object
+ *
+ * @since 1.6
+ */
+ public function getTable($type = 'clinic', $prefix = 'SupportgroupsTable', $config = array())
+ {
+ return JTable::getInstance($type, $prefix, $config);
+ }
+
+ /**
+ * Method to get a single record.
+ *
+ * @param integer $pk The id of the primary key.
+ *
+ * @return mixed Object on success, false on failure.
+ *
+ * @since 1.6
+ */
+ public function getItem($pk = null)
+ {
+ if ($item = parent::getItem($pk))
+ {
+ if (!empty($item->params))
+ {
+ // Convert the params field to an array.
+ $registry = new Registry;
+ $registry->loadString($item->params);
+ $item->params = $registry->toArray();
+ }
+
+ if (!empty($item->metadata))
+ {
+ // Convert the metadata field to an array.
+ $registry = new Registry;
+ $registry->loadString($item->metadata);
+ $item->metadata = $registry->toArray();
+ }
+
+ if (!empty($item->id))
+ {
+ $item->tags = new JHelperTags;
+ $item->tags->getTagIds($item->id, 'com_supportgroups.clinic');
+ }
+ }
+
+ return $item;
+ }
+
+ /**
+ * Method to get the record form.
+ *
+ * @param array $data Data for the form.
+ * @param boolean $loadData True if the form is to load its own data (default case), false if not.
+ *
+ * @return mixed A JForm object on success, false on failure
+ *
+ * @since 1.6
+ */
+ public function getForm($data = array(), $loadData = true)
+ { // Get the form.
+ $form = $this->loadForm('com_supportgroups.clinic', 'clinic', array('control' => 'jform', 'load_data' => $loadData));
+
+ if (empty($form))
+ {
+ return false;
+ }
+
+ $jinput = JFactory::getApplication()->input;
+
+ // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ if ($jinput->get('a_id'))
+ {
+ $id = $jinput->get('a_id', 0, 'INT');
+ }
+ // The back end uses id so we use that the rest of the time and set it to 0 by default.
+ else
+ {
+ $id = $jinput->get('id', 0, 'INT');
+ }
+
+ $user = JFactory::getUser();
+
+ // Check for existing item.
+ // Modify the form based on Edit State access controls.
+ if ($id != 0 && (!$user->authorise('clinic.edit.state', 'com_supportgroups.clinic.' . (int) $id))
+ || ($id == 0 && !$user->authorise('clinic.edit.state', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('ordering', 'disabled', 'true');
+ $form->setFieldAttribute('published', 'disabled', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('ordering', 'filter', 'unset');
+ $form->setFieldAttribute('published', 'filter', 'unset');
+ }
+ // If this is a new item insure the greated by is set.
+ if (0 == $id)
+ {
+ // Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // Modify the form based on Edit Creaded By access controls.
+ if ($id != 0 && (!$user->authorise('clinic.edit.created_by', 'com_supportgroups.clinic.' . (int) $id))
+ || ($id == 0 && !$user->authorise('clinic.edit.created_by', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('created_by', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('created_by', 'readonly', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('created_by', 'filter', 'unset');
+ }
+ // Modify the form based on Edit Creaded Date access controls.
+ if ($id != 0 && (!$user->authorise('clinic.edit.created', 'com_supportgroups.clinic.' . (int) $id))
+ || ($id == 0 && !$user->authorise('clinic.edit.created', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('created', 'disabled', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('created', 'filter', 'unset');
+ }
+ // Modify the form based on Edit Name access controls.
+ if ($id != 0 && (!$user->authorise('clinic.edit.name', 'com_supportgroups.clinic.' . (int) $id))
+ || ($id == 0 && !$user->authorise('clinic.edit.name', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('name', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('name', 'readonly', 'true');
+ if (!$form->getValue('name'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('name', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('name', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Phone access controls.
+ if ($id != 0 && (!$user->authorise('clinic.edit.phone', 'com_supportgroups.clinic.' . (int) $id))
+ || ($id == 0 && !$user->authorise('clinic.edit.phone', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('phone', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('phone', 'readonly', 'true');
+ if (!$form->getValue('phone'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('phone', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('phone', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Note Set Area access controls.
+ if ($id != 0 && (!$user->authorise('clinic.edit.note_set_area', 'com_supportgroups.clinic.' . (int) $id))
+ || ($id == 0 && !$user->authorise('clinic.edit.note_set_area', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('note_set_area', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('note_set_area', 'readonly', 'true');
+ if (!$form->getValue('note_set_area'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('note_set_area', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('note_set_area', 'required', 'false');
+ }
+ }
+ // Only load these values if no id is found
+ if (0 == $id)
+ {
+ // Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
+
+ return $form;
+ }
+
+ /**
+ * Method to get the script that have to be included on the form
+ *
+ * @return string script files
+ */
+ public function getScript()
+ {
+ return 'administrator/components/com_supportgroups/models/forms/clinic.js';
+ }
+
+ /**
+ * Method to test whether a record can be deleted.
+ *
+ * @param object $record A record object.
+ *
+ * @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
+ *
+ * @since 1.6
+ */
+ protected function canDelete($record)
+ {
+ if (!empty($record->id))
+ {
+ if ($record->published != -2)
+ {
+ return;
+ }
+
+ $user = JFactory::getUser();
+ // The record has been set. Check the record permissions.
+ return $user->authorise('clinic.delete', 'com_supportgroups.clinic.' . (int) $record->id);
+ }
+ return false;
+ }
+
+ /**
+ * Method to test whether a record can have its state edited.
+ *
+ * @param object $record A record object.
+ *
+ * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
+ *
+ * @since 1.6
+ */
+ protected function canEditState($record)
+ {
+ $user = JFactory::getUser();
+ $recordId = (!empty($record->id)) ? $record->id : 0;
+
+ if ($recordId)
+ {
+ // The record has been set. Check the record permissions.
+ $permission = $user->authorise('clinic.edit.state', 'com_supportgroups.clinic.' . (int) $recordId);
+ if (!$permission && !is_null($permission))
+ {
+ return false;
+ }
+ }
+ // In the absense of better information, revert to the component permissions.
+ return $user->authorise('clinic.edit.state', 'com_supportgroups');
+ }
+
+ /**
+ * Method override to check if you can edit an existing record.
+ *
+ * @param array $data An array of input data.
+ * @param string $key The name of the key for the primary key.
+ *
+ * @return boolean
+ * @since 2.5
+ */
+ protected function allowEdit($data = array(), $key = 'id')
+ {
+ // Check specific edit permission then general edit permission.
+ $user = JFactory::getUser();
+
+ return $user->authorise('clinic.edit', 'com_supportgroups.clinic.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('clinic.edit', 'com_supportgroups');
+ }
+
+ /**
+ * Prepare and sanitise the table data prior to saving.
+ *
+ * @param JTable $table A JTable object.
+ *
+ * @return void
+ *
+ * @since 1.6
+ */
+ protected function prepareTable($table)
+ {
+ $date = JFactory::getDate();
+ $user = JFactory::getUser();
+
+ if (isset($table->name))
+ {
+ $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
+ }
+
+ if (isset($table->alias) && empty($table->alias))
+ {
+ $table->generateAlias();
+ }
+
+ if (empty($table->id))
+ {
+ $table->created = $date->toSql();
+ // set the user
+ if ($table->created_by == 0 || empty($table->created_by))
+ {
+ $table->created_by = $user->id;
+ }
+ // Set ordering to the last item if not set
+ if (empty($table->ordering))
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select('MAX(ordering)')
+ ->from($db->quoteName('#__supportgroups_clinic'));
+ $db->setQuery($query);
+ $max = $db->loadResult();
+
+ $table->ordering = $max + 1;
+ }
+ }
+ else
+ {
+ $table->modified = $date->toSql();
+ $table->modified_by = $user->id;
+ }
+
+ if (!empty($table->id))
+ {
+ // Increment the items version number.
+ $table->version++;
+ }
+ }
+
+ /**
+ * Method to get the data that should be injected in the form.
+ *
+ * @return mixed The data for the form.
+ *
+ * @since 1.6
+ */
+ protected function loadFormData()
+ {
+ // Check the session for previously entered form data.
+ $data = JFactory::getApplication()->getUserState('com_supportgroups.edit.clinic.data', array());
+
+ if (empty($data))
+ {
+ $data = $this->getItem();
+ }
+
+ return $data;
+ }
+
+ /**
+ * Method to get the unique fields of this table.
+ *
+ * @return mixed An array of field names, boolean false if none is set.
+ *
+ * @since 3.0
+ */
+ protected function getUniqeFields()
+ {
+ return false;
+ }
+
+ /**
+ * Method to delete one or more records.
+ *
+ * @param array &$pks An array of record primary keys.
+ *
+ * @return boolean True if successful, false if an error occurs.
+ *
+ * @since 12.2
+ */
+ public function delete(&$pks)
+ {
+ if (!parent::delete($pks))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Method to perform batch operations on an item or a set of items.
+ *
+ * @param array $commands An array of commands to perform.
+ * @param array $pks An array of item ids.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return boolean Returns true on success, false on failure.
+ *
+ * @since 12.2
+ */
+ public function batch($commands, $pks, $contexts)
+ {
+ // Sanitize ids.
+ $pks = array_unique($pks);
+ JArrayHelper::toInteger($pks);
+
+ // Remove any values of zero.
+ if (array_search(0, $pks, true))
+ {
+ unset($pks[array_search(0, $pks, true)]);
+ }
+
+ if (empty($pks))
+ {
+ $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
+ return false;
+ }
+
+ $done = false;
+
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('clinic');
+ $this->batchSet = true;
+
+ if (!$this->canDo->get('core.batch'))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
+ return false;
+ }
+
+ if ($this->type == false)
+ {
+ $type = new JUcmType;
+ $this->type = $type->getTypeByAlias($this->typeAlias);
+ }
+
+ $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
+
+ if (!empty($commands['move_copy']))
+ {
+ $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
+
+ if ($cmd == 'c')
+ {
+ $result = $this->batchCopy($commands, $pks, $contexts);
+
+ if (is_array($result))
+ {
+ foreach ($result as $old => $new)
+ {
+ $contexts[$new] = $contexts[$old];
+ }
+ $pks = array_values($result);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
+ {
+ return false;
+ }
+
+ $done = true;
+ }
+
+ if (!$done)
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
+
+ return false;
+ }
+
+ // Clear the cache
+ $this->cleanCache();
+
+ return true;
+ }
+
+ /**
+ * Batch copy items to a new category or current.
+ *
+ * @param integer $values The new values.
+ * @param array $pks An array of row IDs.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return mixed An array of new IDs on success, boolean false on failure.
+ *
+ * @since 12.2
+ */
+ protected function batchCopy($values, $pks, $contexts)
+ {
+ if (empty($this->batchSet))
+ {
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('clinic');
+ }
+
+ if (!$this->canDo->get('clinic.create') && !$this->canDo->get('clinic.batch'))
+ {
+ return false;
+ }
+
+ // get list of uniqe fields
+ $uniqeFields = $this->getUniqeFields();
+ // remove move_copy from array
+ unset($values['move_copy']);
+
+ // make sure published is set
+ if (!isset($values['published']))
+ {
+ $values['published'] = 0;
+ }
+ elseif (isset($values['published']) && !$this->canDo->get('clinic.edit.state'))
+ {
+ $values['published'] = 0;
+ }
+
+ $newIds = array();
+
+ // Parent exists so let's proceed
+ while (!empty($pks))
+ {
+ // Pop the first ID off the stack
+ $pk = array_shift($pks);
+
+ $this->table->reset();
+
+ // only allow copy if user may edit this item.
+
+ if (!$this->user->authorise('clinic.edit', $contexts[$pk]))
+
+ {
+
+ // Not fatal error
+
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+
+ continue;
+
+ }
+
+ // Check that the row actually exists
+ if (!$this->table->load($pk))
+ {
+ if ($error = $this->table->getError())
+ {
+ // Fatal error
+ $this->setError($error);
+
+ return false;
+ }
+ else
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+ }
+
+ $this->table->name = $this->generateUniqe('name',$this->table->name);
+
+ // insert all set values
+ if (SupportgroupsHelper::checkArray($values))
+ {
+ foreach ($values as $key => $value)
+ {
+ if (strlen($value) > 0 && isset($this->table->$key))
+ {
+ $this->table->$key = $value;
+ }
+ }
+ }
+
+ // update all uniqe fields
+ if (SupportgroupsHelper::checkArray($uniqeFields))
+ {
+ foreach ($uniqeFields as $uniqeField)
+ {
+ $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
+ }
+ }
+
+ // Reset the ID because we are making a copy
+ $this->table->id = 0;
+
+ // TODO: Deal with ordering?
+ // $this->table->ordering = 1;
+
+ // Check the row.
+ if (!$this->table->check())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ if (!empty($this->type))
+ {
+ $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
+ }
+
+ // Store the row.
+ if (!$this->table->store())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ // Get the new item ID
+ $newId = $this->table->get('id');
+
+ // Add the new ID to the array
+ $newIds[$pk] = $newId;
+ }
+
+ // Clean the cache
+ $this->cleanCache();
+
+ return $newIds;
+ }
+
+ /**
+ * Batch move items to a new category
+ *
+ * @param integer $value The new category ID.
+ * @param array $pks An array of row IDs.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return boolean True if successful, false otherwise and internal error is set.
+ *
+ * @since 12.2
+ */
+ protected function batchMove($values, $pks, $contexts)
+ {
+ if (empty($this->batchSet))
+ {
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('clinic');
+ }
+
+ if (!$this->canDo->get('clinic.edit') && !$this->canDo->get('clinic.batch'))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
+ return false;
+ }
+
+ // make sure published only updates if user has the permission.
+ if (isset($values['published']) && !$this->canDo->get('clinic.edit.state'))
+ {
+ unset($values['published']);
+ }
+ // remove move_copy from array
+ unset($values['move_copy']);
+
+ // Parent exists so we proceed
+ foreach ($pks as $pk)
+ {
+ if (!$this->user->authorise('clinic.edit', $contexts[$pk]))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
+
+ return false;
+ }
+
+ // Check that the row actually exists
+ if (!$this->table->load($pk))
+ {
+ if ($error = $this->table->getError())
+ {
+ // Fatal error
+ $this->setError($error);
+
+ return false;
+ }
+ else
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+ }
+
+ // insert all set values.
+ if (SupportgroupsHelper::checkArray($values))
+ {
+ foreach ($values as $key => $value)
+ {
+ // Do special action for access.
+ if ('access' == $key && strlen($value) > 0)
+ {
+ $this->table->$key = $value;
+ }
+ elseif (strlen($value) > 0 && isset($this->table->$key))
+ {
+ $this->table->$key = $value;
+ }
+ }
+ }
+
+
+ // Check the row.
+ if (!$this->table->check())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ if (!empty($this->type))
+ {
+ $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
+ }
+
+ // Store the row.
+ if (!$this->table->store())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+ }
+
+ // Clean the cache
+ $this->cleanCache();
+
+ return true;
+ }
+
+ /**
+ * Method to save the form data.
+ *
+ * @param array $data The form data.
+ *
+ * @return boolean True on success.
+ *
+ * @since 1.6
+ */
+ public function save($data)
+ {
+ $input = JFactory::getApplication()->input;
+ $filter = JFilterInput::getInstance();
+
+ // set the metadata to the Item Data
+ if (isset($data['metadata']) && isset($data['metadata']['author']))
+ {
+ $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
+
+ $metadata = new JRegistry;
+ $metadata->loadArray($data['metadata']);
+ $data['metadata'] = (string) $metadata;
+ }
+
+ // Set the Params Items to data
+ if (isset($data['params']) && is_array($data['params']))
+ {
+ $params = new JRegistry;
+ $params->loadArray($data['params']);
+ $data['params'] = (string) $params;
+ }
+
+ // Alter the uniqe field for save as copy
+ if ($input->get('task') == 'save2copy')
+ {
+ // Automatic handling of other uniqe fields
+ $uniqeFields = $this->getUniqeFields();
+ if (SupportgroupsHelper::checkArray($uniqeFields))
+ {
+ foreach ($uniqeFields as $uniqeField)
+ {
+ $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
+ }
+ }
+ }
+
+ if (parent::save($data))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method to generate a uniqe value.
+ *
+ * @param string $field name.
+ * @param string $value data.
+ *
+ * @return string New value.
+ *
+ * @since 3.0
+ */
+ protected function generateUniqe($field,$value)
+ {
+
+ // set field value uniqe
+ $table = $this->getTable();
+
+ while ($table->load(array($field => $value)))
+ {
+ $value = JString::increment($value);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Method to change the title & alias.
+ *
+ * @param string $title The title.
+ *
+ * @return array Contains the modified title and alias.
+ *
+ */
+ protected function _generateNewTitle($title)
+ {
+
+ // Alter the title
+ $table = $this->getTable();
+
+ while ($table->load(array('title' => $title)))
+ {
+ $title = JString::increment($title);
+ }
+
+ return $title;
+ }
+}
diff --git a/admin/models/clinics.php b/admin/models/clinics.php
new file mode 100644
index 0000000..05db89e
--- /dev/null
+++ b/admin/models/clinics.php
@@ -0,0 +1,373 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the Joomla modellist library
+jimport('joomla.application.component.modellist');
+
+/**
+ * Clinics Model
+ */
+class SupportgroupsModelClinics extends JModelList
+{
+ public function __construct($config = array())
+ {
+ if (empty($config['filter_fields']))
+ {
+ $config['filter_fields'] = array(
+ 'a.id','id',
+ 'a.published','published',
+ 'a.ordering','ordering',
+ 'a.created_by','created_by',
+ 'a.modified_by','modified_by',
+ 'a.name','name',
+ 'a.phone','phone'
+ );
+ }
+
+ parent::__construct($config);
+ }
+
+ /**
+ * Method to auto-populate the model state.
+ *
+ * @return void
+ */
+ protected function populateState($ordering = null, $direction = null)
+ {
+ $app = JFactory::getApplication();
+
+ // Adjust the context to support modal layouts.
+ if ($layout = $app->input->get('layout'))
+ {
+ $this->context .= '.' . $layout;
+ }
+ $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
+ $this->setState('filter.name', $name);
+
+ $phone = $this->getUserStateFromRequest($this->context . '.filter.phone', 'filter_phone');
+ $this->setState('filter.phone', $phone);
+
+ $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
+ $this->setState('filter.sorting', $sorting);
+
+ $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
+ $this->setState('filter.access', $access);
+
+ $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
+ $this->setState('filter.search', $search);
+
+ $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
+ $this->setState('filter.published', $published);
+
+ $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
+ $this->setState('filter.created_by', $created_by);
+
+ $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
+ $this->setState('filter.created', $created);
+
+ // List state information.
+ parent::populateState($ordering, $direction);
+ }
+
+ /**
+ * Method to get an array of data items.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getItems()
+ {
+ // check in items
+ $this->checkInNow();
+
+ // load parent items
+ $items = parent::getItems();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('clinic.access', 'com_supportgroups.clinic.' . (int) $item->id) && $user->authorise('clinic.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
+
+ // return items
+ return $items;
+ }
+
+ /**
+ * Method to build an SQL query to load the list data.
+ *
+ * @return string An SQL query
+ */
+ protected function getListQuery()
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_item table
+ $query->from($db->quoteName('#__supportgroups_clinic', 'a'));
+
+ // Filter by published state
+ $published = $this->getState('filter.published');
+ if (is_numeric($published))
+ {
+ $query->where('a.published = ' . (int) $published);
+ }
+ elseif ($published === '')
+ {
+ $query->where('(a.published = 0 OR a.published = 1)');
+ }
+
+ // Join over the asset groups.
+ $query->select('ag.title AS access_level');
+ $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
+ // Filter by access level.
+ if ($access = $this->getState('filter.access'))
+ {
+ $query->where('a.access = ' . (int) $access);
+ }
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+ // Filter by search.
+ $search = $this->getState('filter.search');
+ if (!empty($search))
+ {
+ if (stripos($search, 'id:') === 0)
+ {
+ $query->where('a.id = ' . (int) substr($search, 3));
+ }
+ else
+ {
+ $search = $db->quote('%' . $db->escape($search, true) . '%');
+ $query->where('(a.name LIKE '.$search.' OR a.phone LIKE '.$search.')');
+ }
+ }
+
+
+ // Add the list ordering clause.
+ $orderCol = $this->state->get('list.ordering', 'a.id');
+ $orderDirn = $this->state->get('list.direction', 'asc');
+ if ($orderCol != '')
+ {
+ $query->order($db->escape($orderCol . ' ' . $orderDirn));
+ }
+
+ return $query;
+ }
+
+ /**
+ * Method to get list export data.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getExportData($pks)
+ {
+ // setup the query
+ if (SupportgroupsHelper::checkArray($pks))
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_clinic table
+ $query->from($db->quoteName('#__supportgroups_clinic', 'a'));
+ $query->where('a.id IN (' . implode(',',$pks) . ')');
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+
+ // Order the results by ordering
+ $query->order('a.ordering ASC');
+
+ // Load the items
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ $items = $db->loadObjectList();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('clinic.access', 'com_supportgroups.clinic.' . (int) $item->id) && $user->authorise('clinic.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ // unset the values we don't want exported.
+ unset($item->asset_id);
+ unset($item->checked_out);
+ unset($item->checked_out_time);
+ }
+ }
+ // Add headers to items array.
+ $headers = $this->getExImPortHeaders();
+ if (SupportgroupsHelper::checkObject($headers))
+ {
+ array_unshift($items,$headers);
+ }
+ return $items;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Method to get header.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getExImPortHeaders()
+ {
+ // Get a db connection.
+ $db = JFactory::getDbo();
+ // get the columns
+ $columns = $db->getTableColumns("#__supportgroups_clinic");
+ if (SupportgroupsHelper::checkArray($columns))
+ {
+ // remove the headers you don't import/export.
+ unset($columns['asset_id']);
+ unset($columns['checked_out']);
+ unset($columns['checked_out_time']);
+ $headers = new stdClass();
+ foreach ($columns as $column => $type)
+ {
+ $headers->{$column} = $column;
+ }
+ return $headers;
+ }
+ return false;
+ }
+
+ /**
+ * Method to get a store id based on model configuration state.
+ *
+ * @return string A store id.
+ *
+ */
+ protected function getStoreId($id = '')
+ {
+ // Compile the store id.
+ $id .= ':' . $this->getState('filter.id');
+ $id .= ':' . $this->getState('filter.search');
+ $id .= ':' . $this->getState('filter.published');
+ $id .= ':' . $this->getState('filter.ordering');
+ $id .= ':' . $this->getState('filter.created_by');
+ $id .= ':' . $this->getState('filter.modified_by');
+ $id .= ':' . $this->getState('filter.name');
+ $id .= ':' . $this->getState('filter.phone');
+
+ return parent::getStoreId($id);
+ }
+
+ /**
+ * Build an SQL query to checkin all items left checked out longer then a set time.
+ *
+ * @return a bool
+ *
+ */
+ protected function checkInNow()
+ {
+ // Get set check in time
+ $time = JComponentHelper::getParams('com_supportgroups')->get('check_in');
+
+ if ($time)
+ {
+
+ // Get a db connection.
+ $db = JFactory::getDbo();
+ // reset query
+ $query = $db->getQuery(true);
+ $query->select('*');
+ $query->from($db->quoteName('#__supportgroups_clinic'));
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ // Get Yesterdays date
+ $date = JFactory::getDate()->modify($time)->toSql();
+ // reset query
+ $query = $db->getQuery(true);
+
+ // Fields to update.
+ $fields = array(
+ $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
+ $db->quoteName('checked_out') . '=0'
+ );
+
+ // Conditions for which records should be updated.
+ $conditions = array(
+ $db->quoteName('checked_out') . '!=0',
+ $db->quoteName('checked_out_time') . '<\''.$date.'\''
+ );
+
+ // Check table
+ $query->update($db->quoteName('#__supportgroups_clinic'))->set($fields)->where($conditions);
+
+ $db->setQuery($query);
+
+ $db->execute();
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/admin/models/country.php b/admin/models/country.php
index 1152b1e..51de7b7 100644
--- a/admin/models/country.php
+++ b/admin/models/country.php
@@ -101,7 +101,7 @@ class SupportgroupsModelCountry extends JModelAdmin
$item->tags->getTagIds($item->id, 'com_supportgroups.country');
}
}
- $this->countryvvvv = $item->id;
+ $this->countryvvvy = $item->id;
return $item;
}
@@ -111,7 +111,7 @@ class SupportgroupsModelCountry extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
- public function getVvvregions()
+ public function getVvyregions()
{
// Get the user object.
$user = JFactory::getUser();
@@ -129,15 +129,15 @@ class SupportgroupsModelCountry extends JModelAdmin
$query->select($db->quoteName('g.name','country_name'));
$query->join('LEFT', $db->quoteName('#__supportgroups_country', 'g') . ' ON (' . $db->quoteName('a.country') . ' = ' . $db->quoteName('g.id') . ')');
- // Filter by countryvvvv global.
- $countryvvvv = $this->countryvvvv;
- if (is_numeric($countryvvvv ))
+ // Filter by countryvvvy global.
+ $countryvvvy = $this->countryvvvy;
+ if (is_numeric($countryvvvy ))
{
- $query->where('a.country = ' . (int) $countryvvvv );
+ $query->where('a.country = ' . (int) $countryvvvy );
}
- elseif (is_string($countryvvvv))
+ elseif (is_string($countryvvvy))
{
- $query->where('a.country = ' . $db->quote($countryvvvv));
+ $query->where('a.country = ' . $db->quote($countryvvvy));
}
else
{
@@ -168,6 +168,23 @@ class SupportgroupsModelCountry extends JModelAdmin
if ($db->getNumRows())
{
$items = $db->loadObjectList();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('region.access', 'com_supportgroups.region.' . (int) $item->id) && $user->authorise('region.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
return $items;
}
return false;
diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php
new file mode 100644
index 0000000..c87a4b6
--- /dev/null
+++ b/admin/models/fields/articles.php
@@ -0,0 +1,115 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the list field type
+jimport('joomla.form.helper');
+JFormHelper::loadFieldClass('list');
+
+/**
+ * Articles Form Field class for the Supportgroups component
+ */
+class JFormFieldArticles extends JFormFieldList
+{
+ /**
+ * The articles field type.
+ *
+ * @var string
+ */
+ public $type = 'articles';
+ /**
+ * Override to add new button
+ *
+ * @return string The field input markup.
+ *
+ * @since 3.2
+ */
+ protected function getInput()
+ {
+ // see if we should add buttons
+ $setButton = $this->getAttribute('button');
+ // get html
+ $html = parent::getInput();
+ // if true set button
+ if ($setButton === 'true')
+ {
+ $user = JFactory::getUser();
+ // only add if user allowed to create article
+ if ($user->authorise('core.create', 'com_supportgroups'))
+ {
+ // get the input from url
+ $jinput = JFactory::getApplication()->input;
+ // get the view name & id
+ $values = $jinput->getArray(array(
+ 'id' => 'int',
+ 'view' => 'word'
+ ));
+ // check if new item
+ $ref = '';
+ if (!is_null($values['id']) && strlen($values['view']))
+ {
+ // only load referal if not new item.
+ $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ }
+ // build the button
+ $button = '
+ ' . JText::_('COM_SUPPORTGROUPS_NEW') . '';
+ // return the button attached to input field
+ return $html . $button;
+ }
+ }
+ return $html;
+ }
+
+ /**
+ * Method to get a list of options for a list input.
+ *
+ * @return array An array of JHtml options.
+ */
+ public function getOptions()
+ {
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias')));
+ $query->from($db->quoteName('#__content', 'a'));
+ $query->where($db->quoteName('a.state') . ' = 1');
+ $query->order('a.title ASC');
+ $db->setQuery((string)$query);
+ $items = $db->loadObjectList();
+ $options = array();
+ if ($items)
+ {
+ $options[] = JHtml::_('select.option', '', 'Select an Article');
+ foreach($items as $item)
+ {
+ $options[] = JHtml::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')');
+ }
+ }
+ return $options;
+ }
+}
diff --git a/admin/models/fields/clinics.php b/admin/models/fields/clinics.php
new file mode 100644
index 0000000..2b6c368
--- /dev/null
+++ b/admin/models/fields/clinics.php
@@ -0,0 +1,115 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the list field type
+jimport('joomla.form.helper');
+JFormHelper::loadFieldClass('list');
+
+/**
+ * Clinics Form Field class for the Supportgroups component
+ */
+class JFormFieldClinics extends JFormFieldList
+{
+ /**
+ * The clinics field type.
+ *
+ * @var string
+ */
+ public $type = 'clinics';
+ /**
+ * Override to add new button
+ *
+ * @return string The field input markup.
+ *
+ * @since 3.2
+ */
+ protected function getInput()
+ {
+ // see if we should add buttons
+ $setButton = $this->getAttribute('button');
+ // get html
+ $html = parent::getInput();
+ // if true set button
+ if ($setButton === 'true')
+ {
+ $user = JFactory::getUser();
+ // only add if user allowed to create clinic
+ if ($user->authorise('clinic.create', 'com_supportgroups'))
+ {
+ // get the input from url
+ $jinput = JFactory::getApplication()->input;
+ // get the view name & id
+ $values = $jinput->getArray(array(
+ 'id' => 'int',
+ 'view' => 'word'
+ ));
+ // check if new item
+ $ref = '';
+ if (!is_null($values['id']) && strlen($values['view']))
+ {
+ // only load referal if not new item.
+ $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ }
+ // build the button
+ $button = '
+ ' . JText::_('COM_SUPPORTGROUPS_NEW') . '';
+ // return the button attached to input field
+ return $html . $button;
+ }
+ }
+ return $html;
+ }
+
+ /**
+ * Method to get a list of options for a list input.
+ *
+ * @return array An array of JHtml options.
+ */
+ public function getOptions()
+ {
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('a.id','a.name'),array('id','clinic_name')));
+ $query->from($db->quoteName('#__supportgroups_clinic', 'a'));
+ $query->where($db->quoteName('a.published') . ' = 1');
+ $query->order('a.name ASC');
+ $db->setQuery((string)$query);
+ $items = $db->loadObjectList();
+ $options = array();
+ if ($items)
+ {
+ $options[] = JHtml::_('select.option', '', 'Select a clinic');
+ foreach($items as $item)
+ {
+ $options[] = JHtml::_('select.option', $item->id, $item->clinic_name);
+ }
+ }
+ return $options;
+ }
+}
diff --git a/admin/models/fields/locations.php b/admin/models/fields/locations.php
new file mode 100644
index 0000000..ebf8c45
--- /dev/null
+++ b/admin/models/fields/locations.php
@@ -0,0 +1,119 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the list field type
+jimport('joomla.form.helper');
+JFormHelper::loadFieldClass('list');
+
+/**
+ * Locations Form Field class for the Supportgroups component
+ */
+class JFormFieldLocations extends JFormFieldList
+{
+ /**
+ * The locations field type.
+ *
+ * @var string
+ */
+ public $type = 'locations';
+ /**
+ * Override to add new button
+ *
+ * @return string The field input markup.
+ *
+ * @since 3.2
+ */
+ protected function getInput()
+ {
+ // see if we should add buttons
+ $setButton = $this->getAttribute('button');
+ // get html
+ $html = parent::getInput();
+ // if true set button
+ if ($setButton === 'true')
+ {
+ $user = JFactory::getUser();
+ // only add if user allowed to create location
+ if ($user->authorise('location.create', 'com_supportgroups'))
+ {
+ // get the input from url
+ $jinput = JFactory::getApplication()->input;
+ // get the view name & id
+ $values = $jinput->getArray(array(
+ 'id' => 'int',
+ 'view' => 'word'
+ ));
+ // check if new item
+ $ref = '';
+ if (!is_null($values['id']) && strlen($values['view']))
+ {
+ // only load referal if not new item.
+ $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ }
+ // build the button
+ $button = '
+ ' . JText::_('COM_SUPPORTGROUPS_NEW') . '';
+ // return the button attached to input field
+ return $html . $button;
+ }
+ }
+ return $html;
+ }
+
+ /**
+ * Method to get a list of options for a list input.
+ *
+ * @return array An array of JHtml options.
+ */
+ public function getOptions()
+ {
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('a.id','a.name','b.name','c.codetwo'),array('id','location_name','region','country')));
+ $query->from($db->quoteName('#__supportgroups_location', 'a'));
+ $query->join('LEFT', '#__supportgroups_region AS b ON b.id = a.region');
+ $query->join('LEFT', '#__supportgroups_country AS c ON c.id = b.country');
+ $query->where($db->quoteName('a.published') . ' = 1');
+ $query->order('c.codetwo ASC');
+ $query->order('b.name ASC');
+ $query->order('a.name ASC');
+ $db->setQuery((string)$query);
+ $items = $db->loadObjectList();
+ $options = array();
+ if ($items)
+ {
+ $options[] = JHtml::_('select.option', '', 'Select a location');
+ foreach($items as $item)
+ {
+ $options[] = JHtml::_('select.option', $item->id, $item->location_name.' ('.$item->region.' - '.$item->country.')');
+ }
+ }
+ return $options;
+ }
+}
diff --git a/admin/models/fields/regions.php b/admin/models/fields/regions.php
index 8ccd593..615be0f 100644
--- a/admin/models/fields/regions.php
+++ b/admin/models/fields/regions.php
@@ -59,7 +59,7 @@ class JFormFieldRegions extends JFormFieldList
{
$user = JFactory::getUser();
// only add if user allowed to create region
- if ($user->authorise('core.create', 'com_supportgroups'))
+ if ($user->authorise('region.create', 'com_supportgroups'))
{
// get the input from url
$jinput = JFactory::getApplication()->input;
diff --git a/admin/models/fields/supportgroups.php b/admin/models/fields/supportgroups.php
new file mode 100644
index 0000000..ba25a20
--- /dev/null
+++ b/admin/models/fields/supportgroups.php
@@ -0,0 +1,115 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the list field type
+jimport('joomla.form.helper');
+JFormHelper::loadFieldClass('list');
+
+/**
+ * Supportgroups Form Field class for the Supportgroups component
+ */
+class JFormFieldSupportgroups extends JFormFieldList
+{
+ /**
+ * The supportgroups field type.
+ *
+ * @var string
+ */
+ public $type = 'supportgroups';
+ /**
+ * Override to add new button
+ *
+ * @return string The field input markup.
+ *
+ * @since 3.2
+ */
+ protected function getInput()
+ {
+ // see if we should add buttons
+ $setButton = $this->getAttribute('button');
+ // get html
+ $html = parent::getInput();
+ // if true set button
+ if ($setButton === 'true')
+ {
+ $user = JFactory::getUser();
+ // only add if user allowed to create support_group
+ if ($user->authorise('support_group.create', 'com_supportgroups'))
+ {
+ // get the input from url
+ $jinput = JFactory::getApplication()->input;
+ // get the view name & id
+ $values = $jinput->getArray(array(
+ 'id' => 'int',
+ 'view' => 'word'
+ ));
+ // check if new item
+ $ref = '';
+ if (!is_null($values['id']) && strlen($values['view']))
+ {
+ // only load referal if not new item.
+ $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ }
+ // build the button
+ $button = '
+ ' . JText::_('COM_SUPPORTGROUPS_NEW') . '';
+ // return the button attached to input field
+ return $html . $button;
+ }
+ }
+ return $html;
+ }
+
+ /**
+ * Method to get a list of options for a list input.
+ *
+ * @return array An array of JHtml options.
+ */
+ public function getOptions()
+ {
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('a.id','a.name'),array('id','support_group_name')));
+ $query->from($db->quoteName('#__supportgroups_support_group', 'a'));
+ $query->where($db->quoteName('a.published') . ' = 1');
+ $query->order('a.name ASC');
+ $db->setQuery((string)$query);
+ $items = $db->loadObjectList();
+ $options = array();
+ if ($items)
+ {
+ $options[] = JHtml::_('select.option', '', 'Select a support group');
+ foreach($items as $item)
+ {
+ $options[] = JHtml::_('select.option', $item->id, $item->support_group_name);
+ }
+ }
+ return $options;
+ }
+}
diff --git a/admin/models/forms/clinic.js b/admin/models/forms/clinic.js
new file mode 100644
index 0000000..27fa76f
--- /dev/null
+++ b/admin/models/forms/clinic.js
@@ -0,0 +1,25 @@
+/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
+ __ __ _ _____ _ _ __ __ _ _ _
+ \ \ / / | | | __ \ | | | | | \/ | | | | | | |
+ \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
+ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
+ \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
+ \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
+ | |
+ |_|
+/-------------------------------------------------------------------------------------------------------------------------------/
+
+ @version 1.0.3
+ @build 6th March, 2016
+ @created 24th February, 2016
+ @package Support Groups
+ @subpackage clinic.js
+ @author Llewellyn van der Merwe
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+
diff --git a/admin/models/forms/clinic.xml b/admin/models/forms/clinic.xml
new file mode 100644
index 0000000..59e3e1d
--- /dev/null
+++ b/admin/models/forms/clinic.xml
@@ -0,0 +1,196 @@
+
+
\ No newline at end of file
diff --git a/admin/models/forms/help_document.js b/admin/models/forms/help_document.js
new file mode 100644
index 0000000..3ca519c
--- /dev/null
+++ b/admin/models/forms/help_document.js
@@ -0,0 +1,311 @@
+/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
+ __ __ _ _____ _ _ __ __ _ _ _
+ \ \ / / | | | __ \ | | | | | \/ | | | | | | |
+ \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
+ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
+ \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
+ \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
+ | |
+ |_|
+/-------------------------------------------------------------------------------------------------------------------------------/
+
+ @version 1.0.3
+ @build 6th March, 2016
+ @created 24th February, 2016
+ @package Support Groups
+ @subpackage help_document.js
+ @author Llewellyn van der Merwe
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// Some Global Values
+jform_vvvvvvyvvz_required = false;
+jform_vvvvvvzvwa_required = false;
+jform_vvvvvwavwb_required = false;
+jform_vvvvvwbvwc_required = false;
+
+// Initial Script
+jQuery(document).ready(function()
+{
+ var location_vvvvvvw = jQuery("#jform_location input[type='radio']:checked").val();
+ vvvvvvw(location_vvvvvvw);
+
+ var location_vvvvvvx = jQuery("#jform_location input[type='radio']:checked").val();
+ vvvvvvx(location_vvvvvvx);
+
+ var type_vvvvvvy = jQuery("#jform_type").val();
+ vvvvvvy(type_vvvvvvy);
+
+ var type_vvvvvvz = jQuery("#jform_type").val();
+ vvvvvvz(type_vvvvvvz);
+
+ var type_vvvvvwa = jQuery("#jform_type").val();
+ vvvvvwa(type_vvvvvwa);
+
+ var target_vvvvvwb = jQuery("#jform_target input[type='radio']:checked").val();
+ vvvvvwb(target_vvvvvwb);
+});
+
+// the vvvvvvw function
+function vvvvvvw(location_vvvvvvw)
+{
+ // set the function logic
+ if (location_vvvvvvw == 1)
+ {
+ jQuery('#jform_admin_view').closest('.control-group').show();
+ }
+ else
+ {
+ jQuery('#jform_admin_view').closest('.control-group').hide();
+ }
+}
+
+// the vvvvvvx function
+function vvvvvvx(location_vvvvvvx)
+{
+ // set the function logic
+ if (location_vvvvvvx == 2)
+ {
+ jQuery('#jform_site_view').closest('.control-group').show();
+ }
+ else
+ {
+ jQuery('#jform_site_view').closest('.control-group').hide();
+ }
+}
+
+// the vvvvvvy function
+function vvvvvvy(type_vvvvvvy)
+{
+ if (isSet(type_vvvvvvy) && type_vvvvvvy.constructor !== Array)
+ {
+ var temp_vvvvvvy = type_vvvvvvy;
+ var type_vvvvvvy = [];
+ type_vvvvvvy.push(temp_vvvvvvy);
+ }
+ else if (!isSet(type_vvvvvvy))
+ {
+ var type_vvvvvvy = [];
+ }
+ var type = type_vvvvvvy.some(type_vvvvvvy_SomeFunc);
+
+
+ // set this function logic
+ if (type)
+ {
+ jQuery('#jform_url').closest('.control-group').show();
+ if (jform_vvvvvvyvvz_required)
+ {
+ updateFieldRequired('url',0);
+ jQuery('#jform_url').prop('required','required');
+ jQuery('#jform_url').attr('aria-required',true);
+ jQuery('#jform_url').addClass('required');
+ jform_vvvvvvyvvz_required = false;
+ }
+
+ }
+ else
+ {
+ jQuery('#jform_url').closest('.control-group').hide();
+ if (!jform_vvvvvvyvvz_required)
+ {
+ updateFieldRequired('url',1);
+ jQuery('#jform_url').removeAttr('required');
+ jQuery('#jform_url').removeAttr('aria-required');
+ jQuery('#jform_url').removeClass('required');
+ jform_vvvvvvyvvz_required = true;
+ }
+ }
+}
+
+// the vvvvvvy Some function
+function type_vvvvvvy_SomeFunc(type_vvvvvvy)
+{
+ // set the function logic
+ if (type_vvvvvvy == 3)
+ {
+ return true;
+ }
+ return false;
+}
+
+// the vvvvvvz function
+function vvvvvvz(type_vvvvvvz)
+{
+ if (isSet(type_vvvvvvz) && type_vvvvvvz.constructor !== Array)
+ {
+ var temp_vvvvvvz = type_vvvvvvz;
+ var type_vvvvvvz = [];
+ type_vvvvvvz.push(temp_vvvvvvz);
+ }
+ else if (!isSet(type_vvvvvvz))
+ {
+ var type_vvvvvvz = [];
+ }
+ var type = type_vvvvvvz.some(type_vvvvvvz_SomeFunc);
+
+
+ // set this function logic
+ if (type)
+ {
+ jQuery('#jform_article').closest('.control-group').show();
+ if (jform_vvvvvvzvwa_required)
+ {
+ updateFieldRequired('article',0);
+ jQuery('#jform_article').prop('required','required');
+ jQuery('#jform_article').attr('aria-required',true);
+ jQuery('#jform_article').addClass('required');
+ jform_vvvvvvzvwa_required = false;
+ }
+
+ }
+ else
+ {
+ jQuery('#jform_article').closest('.control-group').hide();
+ if (!jform_vvvvvvzvwa_required)
+ {
+ updateFieldRequired('article',1);
+ jQuery('#jform_article').removeAttr('required');
+ jQuery('#jform_article').removeAttr('aria-required');
+ jQuery('#jform_article').removeClass('required');
+ jform_vvvvvvzvwa_required = true;
+ }
+ }
+}
+
+// the vvvvvvz Some function
+function type_vvvvvvz_SomeFunc(type_vvvvvvz)
+{
+ // set the function logic
+ if (type_vvvvvvz == 1)
+ {
+ return true;
+ }
+ return false;
+}
+
+// the vvvvvwa function
+function vvvvvwa(type_vvvvvwa)
+{
+ if (isSet(type_vvvvvwa) && type_vvvvvwa.constructor !== Array)
+ {
+ var temp_vvvvvwa = type_vvvvvwa;
+ var type_vvvvvwa = [];
+ type_vvvvvwa.push(temp_vvvvvwa);
+ }
+ else if (!isSet(type_vvvvvwa))
+ {
+ var type_vvvvvwa = [];
+ }
+ var type = type_vvvvvwa.some(type_vvvvvwa_SomeFunc);
+
+
+ // set this function logic
+ if (type)
+ {
+ jQuery('#jform_content-lbl').closest('.control-group').show();
+ if (jform_vvvvvwavwb_required)
+ {
+ updateFieldRequired('content',0);
+ jQuery('#jform_content').prop('required','required');
+ jQuery('#jform_content').attr('aria-required',true);
+ jQuery('#jform_content').addClass('required');
+ jform_vvvvvwavwb_required = false;
+ }
+
+ }
+ else
+ {
+ jQuery('#jform_content-lbl').closest('.control-group').hide();
+ if (!jform_vvvvvwavwb_required)
+ {
+ updateFieldRequired('content',1);
+ jQuery('#jform_content').removeAttr('required');
+ jQuery('#jform_content').removeAttr('aria-required');
+ jQuery('#jform_content').removeClass('required');
+ jform_vvvvvwavwb_required = true;
+ }
+ }
+}
+
+// the vvvvvwa Some function
+function type_vvvvvwa_SomeFunc(type_vvvvvwa)
+{
+ // set the function logic
+ if (type_vvvvvwa == 2)
+ {
+ return true;
+ }
+ return false;
+}
+
+// the vvvvvwb function
+function vvvvvwb(target_vvvvvwb)
+{
+ // set the function logic
+ if (target_vvvvvwb == 1)
+ {
+ jQuery('#jform_groups').closest('.control-group').show();
+ if (jform_vvvvvwbvwc_required)
+ {
+ updateFieldRequired('groups',0);
+ jQuery('#jform_groups').prop('required','required');
+ jQuery('#jform_groups').attr('aria-required',true);
+ jQuery('#jform_groups').addClass('required');
+ jform_vvvvvwbvwc_required = false;
+ }
+
+ }
+ else
+ {
+ jQuery('#jform_groups').closest('.control-group').hide();
+ if (!jform_vvvvvwbvwc_required)
+ {
+ updateFieldRequired('groups',1);
+ jQuery('#jform_groups').removeAttr('required');
+ jQuery('#jform_groups').removeAttr('aria-required');
+ jQuery('#jform_groups').removeClass('required');
+ jform_vvvvvwbvwc_required = true;
+ }
+ }
+}
+
+// update required fields
+function updateFieldRequired(name,status)
+{
+ var not_required = jQuery('#jform_not_required').val();
+
+ if(status == 1)
+ {
+ if (isSet(not_required) && not_required != 0)
+ {
+ not_required = not_required+','+name;
+ }
+ else
+ {
+ not_required = ','+name;
+ }
+ }
+ else
+ {
+ if (isSet(not_required) && not_required != 0)
+ {
+ not_required = not_required.replace(','+name,'');
+ }
+ }
+
+ jQuery('#jform_not_required').val(not_required);
+}
+
+// the isSet function
+function isSet(val)
+{
+ if ((val != undefined) && (val != null) && 0 !== val.length){
+ return true;
+ }
+ return false;
+}
diff --git a/admin/models/forms/help_document.xml b/admin/models/forms/help_document.xml
new file mode 100644
index 0000000..ef2c63b
--- /dev/null
+++ b/admin/models/forms/help_document.xml
@@ -0,0 +1,253 @@
+
+
\ No newline at end of file
diff --git a/admin/models/forms/location.xml b/admin/models/forms/location.xml
index 2350a18..16853c5 100644
--- a/admin/models/forms/location.xml
+++ b/admin/models/forms/location.xml
@@ -126,6 +126,7 @@
description="COM_SUPPORTGROUPS_LOCATION_REGION_DESCRIPTION"
class="list_class"
multiple="false"
+ required="true"
button="true"
/>
diff --git a/admin/models/forms/payment.js b/admin/models/forms/payment.js
new file mode 100644
index 0000000..5bcef89
--- /dev/null
+++ b/admin/models/forms/payment.js
@@ -0,0 +1,25 @@
+/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
+ __ __ _ _____ _ _ __ __ _ _ _
+ \ \ / / | | | __ \ | | | | | \/ | | | | | | |
+ \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
+ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
+ \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
+ \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
+ | |
+ |_|
+/-------------------------------------------------------------------------------------------------------------------------------/
+
+ @version 1.0.3
+ @build 6th March, 2016
+ @created 24th February, 2016
+ @package Support Groups
+ @subpackage payment.js
+ @author Llewellyn van der Merwe
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+
diff --git a/admin/models/forms/payment.xml b/admin/models/forms/payment.xml
new file mode 100644
index 0000000..80e889b
--- /dev/null
+++ b/admin/models/forms/payment.xml
@@ -0,0 +1,190 @@
+
+
\ No newline at end of file
diff --git a/admin/models/forms/region.xml b/admin/models/forms/region.xml
index a8307cf..5a0fe22 100644
--- a/admin/models/forms/region.xml
+++ b/admin/models/forms/region.xml
@@ -126,6 +126,7 @@
description="COM_SUPPORTGROUPS_REGION_COUNTRY_DESCRIPTION"
class="list_class"
multiple="false"
+ required="true"
button="false"
/>
diff --git a/admin/models/forms/support_group.xml b/admin/models/forms/support_group.xml
index c002ee7..fdfdf7d 100644
--- a/admin/models/forms/support_group.xml
+++ b/admin/models/forms/support_group.xml
@@ -118,6 +118,133 @@
message="Error! Please add name here."
hint="COM_SUPPORTGROUPS_SUPPORT_GROUP_NAME_HINT"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/models/help_document.php b/admin/models/help_document.php
new file mode 100644
index 0000000..e5d4055
--- /dev/null
+++ b/admin/models/help_document.php
@@ -0,0 +1,942 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+use Joomla\Registry\Registry;
+
+// import Joomla modelform library
+jimport('joomla.application.component.modeladmin');
+
+/**
+ * Supportgroups Help_document Model
+ */
+class SupportgroupsModelHelp_document extends JModelAdmin
+{
+ /**
+ * @var string The prefix to use with controller messages.
+ * @since 1.6
+ */
+ protected $text_prefix = 'COM_SUPPORTGROUPS';
+
+ /**
+ * The type alias for this content type.
+ *
+ * @var string
+ * @since 3.2
+ */
+ public $typeAlias = 'com_supportgroups.help_document';
+
+ /**
+ * Returns a Table object, always creating it
+ *
+ * @param type $type The table type to instantiate
+ * @param string $prefix A prefix for the table class name. Optional.
+ * @param array $config Configuration array for model. Optional.
+ *
+ * @return JTable A database object
+ *
+ * @since 1.6
+ */
+ public function getTable($type = 'help_document', $prefix = 'SupportgroupsTable', $config = array())
+ {
+ return JTable::getInstance($type, $prefix, $config);
+ }
+
+ /**
+ * Method to get a single record.
+ *
+ * @param integer $pk The id of the primary key.
+ *
+ * @return mixed Object on success, false on failure.
+ *
+ * @since 1.6
+ */
+ public function getItem($pk = null)
+ {
+ if ($item = parent::getItem($pk))
+ {
+ if (!empty($item->params))
+ {
+ // Convert the params field to an array.
+ $registry = new Registry;
+ $registry->loadString($item->params);
+ $item->params = $registry->toArray();
+ }
+
+ if (!empty($item->metadata))
+ {
+ // Convert the metadata field to an array.
+ $registry = new Registry;
+ $registry->loadString($item->metadata);
+ $item->metadata = $registry->toArray();
+ }
+
+ if (!empty($item->groups))
+ {
+ // JSON Decode groups.
+ $item->groups = json_decode($item->groups,true);
+ }
+
+ if (!empty($item->id))
+ {
+ $item->tags = new JHelperTags;
+ $item->tags->getTagIds($item->id, 'com_supportgroups.help_document');
+ }
+ }
+
+ return $item;
+ }
+
+ /**
+ * Method to get the record form.
+ *
+ * @param array $data Data for the form.
+ * @param boolean $loadData True if the form is to load its own data (default case), false if not.
+ *
+ * @return mixed A JForm object on success, false on failure
+ *
+ * @since 1.6
+ */
+ public function getForm($data = array(), $loadData = true)
+ { // Get the form.
+ $form = $this->loadForm('com_supportgroups.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData));
+
+ if (empty($form))
+ {
+ return false;
+ }
+
+ $jinput = JFactory::getApplication()->input;
+
+ // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ if ($jinput->get('a_id'))
+ {
+ $id = $jinput->get('a_id', 0, 'INT');
+ }
+ // The back end uses id so we use that the rest of the time and set it to 0 by default.
+ else
+ {
+ $id = $jinput->get('id', 0, 'INT');
+ }
+
+ $user = JFactory::getUser();
+
+ // Check for existing item.
+ // Modify the form based on Edit State access controls.
+ if ($id != 0 && (!$user->authorise('help_document.edit.state', 'com_supportgroups.help_document.' . (int) $id))
+ || ($id == 0 && !$user->authorise('help_document.edit.state', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('ordering', 'disabled', 'true');
+ $form->setFieldAttribute('published', 'disabled', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('ordering', 'filter', 'unset');
+ $form->setFieldAttribute('published', 'filter', 'unset');
+ }
+ // If this is a new item insure the greated by is set.
+ if (0 == $id)
+ {
+ // Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // Modify the form based on Edit Creaded By access controls.
+ if (!$user->authorise('core.edit.created_by', 'com_supportgroups'))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('created_by', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('created_by', 'readonly', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('created_by', 'filter', 'unset');
+ }
+ // Modify the form based on Edit Creaded Date access controls.
+ if (!$user->authorise('core.edit.created', 'com_supportgroups'))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('created', 'disabled', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('created', 'filter', 'unset');
+ }
+ // Only load these values if no id is found
+ if (0 == $id)
+ {
+ // Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
+
+ return $form;
+ }
+
+ /**
+ * Method to get the script that have to be included on the form
+ *
+ * @return string script files
+ */
+ public function getScript()
+ {
+ return 'administrator/components/com_supportgroups/models/forms/help_document.js';
+ }
+
+ /**
+ * Method to test whether a record can be deleted.
+ *
+ * @param object $record A record object.
+ *
+ * @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
+ *
+ * @since 1.6
+ */
+ protected function canDelete($record)
+ {
+ if (!empty($record->id))
+ {
+ if ($record->published != -2)
+ {
+ return;
+ }
+
+ $user = JFactory::getUser();
+ // The record has been set. Check the record permissions.
+ return $user->authorise('help_document.delete', 'com_supportgroups.help_document.' . (int) $record->id);
+ }
+ return false;
+ }
+
+ /**
+ * Method to test whether a record can have its state edited.
+ *
+ * @param object $record A record object.
+ *
+ * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
+ *
+ * @since 1.6
+ */
+ protected function canEditState($record)
+ {
+ $user = JFactory::getUser();
+ $recordId = (!empty($record->id)) ? $record->id : 0;
+
+ if ($recordId)
+ {
+ // The record has been set. Check the record permissions.
+ $permission = $user->authorise('help_document.edit.state', 'com_supportgroups.help_document.' . (int) $recordId);
+ if (!$permission && !is_null($permission))
+ {
+ return false;
+ }
+ }
+ // In the absense of better information, revert to the component permissions.
+ return $user->authorise('help_document.edit.state', 'com_supportgroups');
+ }
+
+ /**
+ * Method override to check if you can edit an existing record.
+ *
+ * @param array $data An array of input data.
+ * @param string $key The name of the key for the primary key.
+ *
+ * @return boolean
+ * @since 2.5
+ */
+ protected function allowEdit($data = array(), $key = 'id')
+ {
+ // Check specific edit permission then general edit permission.
+ $user = JFactory::getUser();
+
+ return $user->authorise('help_document.edit', 'com_supportgroups.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_supportgroups');
+ }
+
+ /**
+ * Prepare and sanitise the table data prior to saving.
+ *
+ * @param JTable $table A JTable object.
+ *
+ * @return void
+ *
+ * @since 1.6
+ */
+ protected function prepareTable($table)
+ {
+ $date = JFactory::getDate();
+ $user = JFactory::getUser();
+
+ if (isset($table->name))
+ {
+ $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
+ }
+
+ if (isset($table->alias) && empty($table->alias))
+ {
+ $table->generateAlias();
+ }
+
+ if (empty($table->id))
+ {
+ $table->created = $date->toSql();
+ // set the user
+ if ($table->created_by == 0 || empty($table->created_by))
+ {
+ $table->created_by = $user->id;
+ }
+ // Set ordering to the last item if not set
+ if (empty($table->ordering))
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select('MAX(ordering)')
+ ->from($db->quoteName('#__supportgroups_help_document'));
+ $db->setQuery($query);
+ $max = $db->loadResult();
+
+ $table->ordering = $max + 1;
+ }
+ }
+ else
+ {
+ $table->modified = $date->toSql();
+ $table->modified_by = $user->id;
+ }
+
+ if (!empty($table->id))
+ {
+ // Increment the items version number.
+ $table->version++;
+ }
+ }
+
+ /**
+ * Method to get the data that should be injected in the form.
+ *
+ * @return mixed The data for the form.
+ *
+ * @since 1.6
+ */
+ protected function loadFormData()
+ {
+ // Check the session for previously entered form data.
+ $data = JFactory::getApplication()->getUserState('com_supportgroups.edit.help_document.data', array());
+
+ if (empty($data))
+ {
+ $data = $this->getItem();
+ }
+
+ return $data;
+ }
+
+ /**
+ * Method to validate the form data.
+ *
+ * @param JForm $form The form to validate against.
+ * @param array $data The data to validate.
+ * @param string $group The name of the field group to validate.
+ *
+ * @return mixed Array of filtered data if valid, false otherwise.
+ *
+ * @see JFormRule
+ * @see JFilterInput
+ * @since 12.2
+ */
+ public function validate($form, $data, $group = null)
+ {
+ // check if the not_required field is set
+ if (SupportgroupsHelper::checkString($data['not_required']))
+ {
+ $requiredFields = (array) explode(',',(string) $data['not_required']);
+ $requiredFields = array_unique($requiredFields);
+ // now change the required field attributes value
+ foreach ($requiredFields as $requiredField)
+ {
+ // make sure there is a string value
+ if (SupportgroupsHelper::checkString($requiredField))
+ {
+ // change to false
+ $form->setFieldAttribute($requiredField, 'required', 'false');
+ // also clear the data set
+ $data[$requiredField] = '';
+ }
+ }
+ }
+ return parent::validate($form, $data, $group);
+ }
+
+ /**
+ * Method to get the unique fields of this table.
+ *
+ * @return mixed An array of field names, boolean false if none is set.
+ *
+ * @since 3.0
+ */
+ protected function getUniqeFields()
+ {
+ return false;
+ }
+
+ /**
+ * Method to delete one or more records.
+ *
+ * @param array &$pks An array of record primary keys.
+ *
+ * @return boolean True if successful, false if an error occurs.
+ *
+ * @since 12.2
+ */
+ public function delete(&$pks)
+ {
+ if (!parent::delete($pks))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Method to perform batch operations on an item or a set of items.
+ *
+ * @param array $commands An array of commands to perform.
+ * @param array $pks An array of item ids.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return boolean Returns true on success, false on failure.
+ *
+ * @since 12.2
+ */
+ public function batch($commands, $pks, $contexts)
+ {
+ // Sanitize ids.
+ $pks = array_unique($pks);
+ JArrayHelper::toInteger($pks);
+
+ // Remove any values of zero.
+ if (array_search(0, $pks, true))
+ {
+ unset($pks[array_search(0, $pks, true)]);
+ }
+
+ if (empty($pks))
+ {
+ $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
+ return false;
+ }
+
+ $done = false;
+
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('help_document');
+ $this->batchSet = true;
+
+ if (!$this->canDo->get('core.batch'))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
+ return false;
+ }
+
+ if ($this->type == false)
+ {
+ $type = new JUcmType;
+ $this->type = $type->getTypeByAlias($this->typeAlias);
+ }
+
+ $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
+
+ if (!empty($commands['move_copy']))
+ {
+ $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
+
+ if ($cmd == 'c')
+ {
+ $result = $this->batchCopy($commands, $pks, $contexts);
+
+ if (is_array($result))
+ {
+ foreach ($result as $old => $new)
+ {
+ $contexts[$new] = $contexts[$old];
+ }
+ $pks = array_values($result);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
+ {
+ return false;
+ }
+
+ $done = true;
+ }
+
+ if (!$done)
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
+
+ return false;
+ }
+
+ // Clear the cache
+ $this->cleanCache();
+
+ return true;
+ }
+
+ /**
+ * Batch copy items to a new category or current.
+ *
+ * @param integer $values The new values.
+ * @param array $pks An array of row IDs.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return mixed An array of new IDs on success, boolean false on failure.
+ *
+ * @since 12.2
+ */
+ protected function batchCopy($values, $pks, $contexts)
+ {
+ if (empty($this->batchSet))
+ {
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('help_document');
+ }
+
+ if (!$this->canDo->get('help_document.create') && !$this->canDo->get('help_document.batch'))
+ {
+ return false;
+ }
+
+ // get list of uniqe fields
+ $uniqeFields = $this->getUniqeFields();
+ // remove move_copy from array
+ unset($values['move_copy']);
+
+ // make sure published is set
+ if (!isset($values['published']))
+ {
+ $values['published'] = 0;
+ }
+ elseif (isset($values['published']) && !$this->canDo->get('help_document.edit.state'))
+ {
+ $values['published'] = 0;
+ }
+
+ $newIds = array();
+
+ // Parent exists so let's proceed
+ while (!empty($pks))
+ {
+ // Pop the first ID off the stack
+ $pk = array_shift($pks);
+
+ $this->table->reset();
+
+ // only allow copy if user may edit this item.
+
+ if (!$this->user->authorise('help_document.edit', $contexts[$pk]))
+
+ {
+
+ // Not fatal error
+
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+
+ continue;
+
+ }
+
+ // Check that the row actually exists
+ if (!$this->table->load($pk))
+ {
+ if ($error = $this->table->getError())
+ {
+ // Fatal error
+ $this->setError($error);
+
+ return false;
+ }
+ else
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+ }
+
+ list($this->table->title, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->title);
+
+ // insert all set values
+ if (SupportgroupsHelper::checkArray($values))
+ {
+ foreach ($values as $key => $value)
+ {
+ if (strlen($value) > 0 && isset($this->table->$key))
+ {
+ $this->table->$key = $value;
+ }
+ }
+ }
+
+ // update all uniqe fields
+ if (SupportgroupsHelper::checkArray($uniqeFields))
+ {
+ foreach ($uniqeFields as $uniqeField)
+ {
+ $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
+ }
+ }
+
+ // Reset the ID because we are making a copy
+ $this->table->id = 0;
+
+ // TODO: Deal with ordering?
+ // $this->table->ordering = 1;
+
+ // Check the row.
+ if (!$this->table->check())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ if (!empty($this->type))
+ {
+ $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
+ }
+
+ // Store the row.
+ if (!$this->table->store())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ // Get the new item ID
+ $newId = $this->table->get('id');
+
+ // Add the new ID to the array
+ $newIds[$pk] = $newId;
+ }
+
+ // Clean the cache
+ $this->cleanCache();
+
+ return $newIds;
+ }
+
+ /**
+ * Batch move items to a new category
+ *
+ * @param integer $value The new category ID.
+ * @param array $pks An array of row IDs.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return boolean True if successful, false otherwise and internal error is set.
+ *
+ * @since 12.2
+ */
+ protected function batchMove($values, $pks, $contexts)
+ {
+ if (empty($this->batchSet))
+ {
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('help_document');
+ }
+
+ if (!$this->canDo->get('help_document.edit') && !$this->canDo->get('help_document.batch'))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
+ return false;
+ }
+
+ // make sure published only updates if user has the permission.
+ if (isset($values['published']) && !$this->canDo->get('help_document.edit.state'))
+ {
+ unset($values['published']);
+ }
+ // remove move_copy from array
+ unset($values['move_copy']);
+
+ // Parent exists so we proceed
+ foreach ($pks as $pk)
+ {
+ if (!$this->user->authorise('help_document.edit', $contexts[$pk]))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
+
+ return false;
+ }
+
+ // Check that the row actually exists
+ if (!$this->table->load($pk))
+ {
+ if ($error = $this->table->getError())
+ {
+ // Fatal error
+ $this->setError($error);
+
+ return false;
+ }
+ else
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+ }
+
+ // insert all set values.
+ if (SupportgroupsHelper::checkArray($values))
+ {
+ foreach ($values as $key => $value)
+ {
+ // Do special action for access.
+ if ('access' == $key && strlen($value) > 0)
+ {
+ $this->table->$key = $value;
+ }
+ elseif (strlen($value) > 0 && isset($this->table->$key))
+ {
+ $this->table->$key = $value;
+ }
+ }
+ }
+
+
+ // Check the row.
+ if (!$this->table->check())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ if (!empty($this->type))
+ {
+ $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
+ }
+
+ // Store the row.
+ if (!$this->table->store())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+ }
+
+ // Clean the cache
+ $this->cleanCache();
+
+ return true;
+ }
+
+ /**
+ * Method to save the form data.
+ *
+ * @param array $data The form data.
+ *
+ * @return boolean True on success.
+ *
+ * @since 1.6
+ */
+ public function save($data)
+ {
+ $input = JFactory::getApplication()->input;
+ $filter = JFilterInput::getInstance();
+
+ // set the metadata to the Item Data
+ if (isset($data['metadata']) && isset($data['metadata']['author']))
+ {
+ $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
+
+ $metadata = new JRegistry;
+ $metadata->loadArray($data['metadata']);
+ $data['metadata'] = (string) $metadata;
+ }
+
+ // Set the groups string to JSON string.
+ if (isset($data['groups']))
+ {
+ $data['groups'] = (string) json_encode($data['groups']);
+ }
+
+ // Set the Params Items to data
+ if (isset($data['params']) && is_array($data['params']))
+ {
+ $params = new JRegistry;
+ $params->loadArray($data['params']);
+ $data['params'] = (string) $params;
+ }
+
+ // Alter the title for save as copy
+ if ($input->get('task') == 'save2copy')
+ {
+ $origTable = clone $this->getTable();
+ $origTable->load($input->getInt('id'));
+
+ if ($data['title'] == $origTable->title)
+ {
+ list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']);
+ $data['title'] = $title;
+ $data['alias'] = $alias;
+ }
+ else
+ {
+ if ($data['alias'] == $origTable->alias)
+ {
+ $data['alias'] = '';
+ }
+ }
+
+ $data['published'] = 0;
+ }
+
+ // Automatic handling of alias for empty fields
+ if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
+ {
+ if ($data['alias'] == null)
+ {
+ if (JFactory::getConfig()->get('unicodeslugs') == 1)
+ {
+ $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']);
+ }
+ else
+ {
+ $data['alias'] = JFilterOutput::stringURLSafe($data['title']);
+ }
+
+ $table = JTable::getInstance('help_document', 'supportgroupsTable');
+
+ if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0))
+ {
+ $msg = JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_SAVE_WARNING');
+ }
+
+ list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']);
+ $data['alias'] = $alias;
+
+ if (isset($msg))
+ {
+ JFactory::getApplication()->enqueueMessage($msg, 'warning');
+ }
+ }
+ }
+
+ // Alter the uniqe field for save as copy
+ if ($input->get('task') == 'save2copy')
+ {
+ // Automatic handling of other uniqe fields
+ $uniqeFields = $this->getUniqeFields();
+ if (SupportgroupsHelper::checkArray($uniqeFields))
+ {
+ foreach ($uniqeFields as $uniqeField)
+ {
+ $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
+ }
+ }
+ }
+
+ if (parent::save($data))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method to generate a uniqe value.
+ *
+ * @param string $field name.
+ * @param string $value data.
+ *
+ * @return string New value.
+ *
+ * @since 3.0
+ */
+ protected function generateUniqe($field,$value)
+ {
+
+ // set field value uniqe
+ $table = $this->getTable();
+
+ while ($table->load(array($field => $value)))
+ {
+ $value = JString::increment($value);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Method to change the title & alias.
+ *
+ * @param string $alias The alias.
+ * @param string $title The title.
+ *
+ * @return array Contains the modified title and alias.
+ *
+ */
+ protected function _generateNewTitle($alias, $title)
+ {
+
+ // Alter the title & alias
+ $table = $this->getTable();
+
+ while ($table->load(array('alias' => $alias)))
+ {
+ $title = JString::increment($title);
+ $alias = JString::increment($alias, 'dash');
+ }
+
+ return array($title, $alias);
+ }
+}
diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php
new file mode 100644
index 0000000..a9ab8ac
--- /dev/null
+++ b/admin/models/help_documents.php
@@ -0,0 +1,479 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the Joomla modellist library
+jimport('joomla.application.component.modellist');
+
+/**
+ * Help_documents Model
+ */
+class SupportgroupsModelHelp_documents extends JModelList
+{
+ public function __construct($config = array())
+ {
+ if (empty($config['filter_fields']))
+ {
+ $config['filter_fields'] = array(
+ 'a.id','id',
+ 'a.published','published',
+ 'a.ordering','ordering',
+ 'a.created_by','created_by',
+ 'a.modified_by','modified_by',
+ 'a.title','title',
+ 'a.type','type',
+ 'a.location','location',
+ 'a.admin_view','admin_view',
+ 'a.site_view','site_view'
+ );
+ }
+
+ parent::__construct($config);
+ }
+
+ /**
+ * Method to auto-populate the model state.
+ *
+ * @return void
+ */
+ protected function populateState($ordering = null, $direction = null)
+ {
+ $app = JFactory::getApplication();
+
+ // Adjust the context to support modal layouts.
+ if ($layout = $app->input->get('layout'))
+ {
+ $this->context .= '.' . $layout;
+ }
+ $title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title');
+ $this->setState('filter.title', $title);
+
+ $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type');
+ $this->setState('filter.type', $type);
+
+ $location = $this->getUserStateFromRequest($this->context . '.filter.location', 'filter_location');
+ $this->setState('filter.location', $location);
+
+ $admin_view = $this->getUserStateFromRequest($this->context . '.filter.admin_view', 'filter_admin_view');
+ $this->setState('filter.admin_view', $admin_view);
+
+ $site_view = $this->getUserStateFromRequest($this->context . '.filter.site_view', 'filter_site_view');
+ $this->setState('filter.site_view', $site_view);
+
+ $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
+ $this->setState('filter.sorting', $sorting);
+
+ $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
+ $this->setState('filter.access', $access);
+
+ $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
+ $this->setState('filter.search', $search);
+
+ $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
+ $this->setState('filter.published', $published);
+
+ $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
+ $this->setState('filter.created_by', $created_by);
+
+ $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
+ $this->setState('filter.created', $created);
+
+ // List state information.
+ parent::populateState($ordering, $direction);
+ }
+
+ /**
+ * Method to get an array of data items.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getItems()
+ {
+ // check in items
+ $this->checkInNow();
+
+ // load parent items
+ $items = parent::getItems();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('help_document.access', 'com_supportgroups.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ // decode groups
+ $groupsArray = json_decode($item->groups, true);
+ if (SupportgroupsHelper::checkArray($groupsArray))
+ {
+ $groupsNames = '';
+ $counter = 0;
+ foreach ($groupsArray as $groups)
+ {
+ if ($counter == 0)
+ {
+ $groupsNames .= SupportgroupsHelper::getGroupName($groups);
+ }
+ else
+ {
+ $groupsNames .= ', '.SupportgroupsHelper::getGroupName($groups);
+ }
+ $counter++;
+ }
+ $item->groups = $groupsNames;
+ }
+ }
+ }
+
+ // set selection value to a translatable value
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ foreach ($items as $nr => &$item)
+ {
+ // convert type
+ $item->type = $this->selectionTranslation($item->type, 'type');
+ // convert location
+ $item->location = $this->selectionTranslation($item->location, 'location');
+ }
+ }
+
+
+ // return items
+ return $items;
+ }
+
+ /**
+ * Method to convert selection values to translatable string.
+ *
+ * @return translatable string
+ */
+ public function selectionTranslation($value,$name)
+ {
+ // Array of type language strings
+ if ($name == 'type')
+ {
+ $typeArray = array(
+ 0 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_SELECT_AN_OPTION',
+ 1 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_JOOMLA_ARTICLE',
+ 2 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_TEXT',
+ 3 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_URL'
+ );
+ // Now check if value is found in this array
+ if (isset($typeArray[$value]) && SupportgroupsHelper::checkString($typeArray[$value]))
+ {
+ return $typeArray[$value];
+ }
+ }
+ // Array of location language strings
+ if ($name == 'location')
+ {
+ $locationArray = array(
+ 1 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_ADMIN',
+ 2 => 'COM_SUPPORTGROUPS_HELP_DOCUMENT_SITE'
+ );
+ // Now check if value is found in this array
+ if (isset($locationArray[$value]) && SupportgroupsHelper::checkString($locationArray[$value]))
+ {
+ return $locationArray[$value];
+ }
+ }
+ return $value;
+ }
+
+ /**
+ * Method to build an SQL query to load the list data.
+ *
+ * @return string An SQL query
+ */
+ protected function getListQuery()
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_item table
+ $query->from($db->quoteName('#__supportgroups_help_document', 'a'));
+
+ // Filter by published state
+ $published = $this->getState('filter.published');
+ if (is_numeric($published))
+ {
+ $query->where('a.published = ' . (int) $published);
+ }
+ elseif ($published === '')
+ {
+ $query->where('(a.published = 0 OR a.published = 1)');
+ }
+
+ // Join over the asset groups.
+ $query->select('ag.title AS access_level');
+ $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
+ // Filter by access level.
+ if ($access = $this->getState('filter.access'))
+ {
+ $query->where('a.access = ' . (int) $access);
+ }
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+ // Filter by search.
+ $search = $this->getState('filter.search');
+ if (!empty($search))
+ {
+ if (stripos($search, 'id:') === 0)
+ {
+ $query->where('a.id = ' . (int) substr($search, 3));
+ }
+ else
+ {
+ $search = $db->quote('%' . $db->escape($search, true) . '%');
+ $query->where('(a.title LIKE '.$search.' OR a.type LIKE '.$search.' OR a.location LIKE '.$search.' OR a.admin_view LIKE '.$search.' OR a.site_view LIKE '.$search.')');
+ }
+ }
+
+ // Filter by Type.
+ if ($type = $this->getState('filter.type'))
+ {
+ $query->where('a.type = ' . $db->quote($db->escape($type, true)));
+ }
+ // Filter by Location.
+ if ($location = $this->getState('filter.location'))
+ {
+ $query->where('a.location = ' . $db->quote($db->escape($location, true)));
+ }
+ // Filter by Admin_view.
+ if ($admin_view = $this->getState('filter.admin_view'))
+ {
+ $query->where('a.admin_view = ' . $db->quote($db->escape($admin_view, true)));
+ }
+ // Filter by Site_view.
+ if ($site_view = $this->getState('filter.site_view'))
+ {
+ $query->where('a.site_view = ' . $db->quote($db->escape($site_view, true)));
+ }
+
+ // Add the list ordering clause.
+ $orderCol = $this->state->get('list.ordering', 'a.id');
+ $orderDirn = $this->state->get('list.direction', 'asc');
+ if ($orderCol != '')
+ {
+ $query->order($db->escape($orderCol . ' ' . $orderDirn));
+ }
+
+ return $query;
+ }
+
+ /**
+ * Method to get list export data.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getExportData($pks)
+ {
+ // setup the query
+ if (SupportgroupsHelper::checkArray($pks))
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_help_document table
+ $query->from($db->quoteName('#__supportgroups_help_document', 'a'));
+ $query->where('a.id IN (' . implode(',',$pks) . ')');
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+
+ // Order the results by ordering
+ $query->order('a.ordering ASC');
+
+ // Load the items
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ $items = $db->loadObjectList();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('help_document.access', 'com_supportgroups.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ // unset the values we don't want exported.
+ unset($item->asset_id);
+ unset($item->checked_out);
+ unset($item->checked_out_time);
+ }
+ }
+ // Add headers to items array.
+ $headers = $this->getExImPortHeaders();
+ if (SupportgroupsHelper::checkObject($headers))
+ {
+ array_unshift($items,$headers);
+ }
+ return $items;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Method to get header.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getExImPortHeaders()
+ {
+ // Get a db connection.
+ $db = JFactory::getDbo();
+ // get the columns
+ $columns = $db->getTableColumns("#__supportgroups_help_document");
+ if (SupportgroupsHelper::checkArray($columns))
+ {
+ // remove the headers you don't import/export.
+ unset($columns['asset_id']);
+ unset($columns['checked_out']);
+ unset($columns['checked_out_time']);
+ $headers = new stdClass();
+ foreach ($columns as $column => $type)
+ {
+ $headers->{$column} = $column;
+ }
+ return $headers;
+ }
+ return false;
+ }
+
+ /**
+ * Method to get a store id based on model configuration state.
+ *
+ * @return string A store id.
+ *
+ */
+ protected function getStoreId($id = '')
+ {
+ // Compile the store id.
+ $id .= ':' . $this->getState('filter.id');
+ $id .= ':' . $this->getState('filter.search');
+ $id .= ':' . $this->getState('filter.published');
+ $id .= ':' . $this->getState('filter.ordering');
+ $id .= ':' . $this->getState('filter.created_by');
+ $id .= ':' . $this->getState('filter.modified_by');
+ $id .= ':' . $this->getState('filter.title');
+ $id .= ':' . $this->getState('filter.type');
+ $id .= ':' . $this->getState('filter.location');
+ $id .= ':' . $this->getState('filter.admin_view');
+ $id .= ':' . $this->getState('filter.site_view');
+
+ return parent::getStoreId($id);
+ }
+
+ /**
+ * Build an SQL query to checkin all items left checked out longer then a set time.
+ *
+ * @return a bool
+ *
+ */
+ protected function checkInNow()
+ {
+ // Get set check in time
+ $time = JComponentHelper::getParams('com_supportgroups')->get('check_in');
+
+ if ($time)
+ {
+
+ // Get a db connection.
+ $db = JFactory::getDbo();
+ // reset query
+ $query = $db->getQuery(true);
+ $query->select('*');
+ $query->from($db->quoteName('#__supportgroups_help_document'));
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ // Get Yesterdays date
+ $date = JFactory::getDate()->modify($time)->toSql();
+ // reset query
+ $query = $db->getQuery(true);
+
+ // Fields to update.
+ $fields = array(
+ $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
+ $db->quoteName('checked_out') . '=0'
+ );
+
+ // Conditions for which records should be updated.
+ $conditions = array(
+ $db->quoteName('checked_out') . '!=0',
+ $db->quoteName('checked_out_time') . '<\''.$date.'\''
+ );
+
+ // Check table
+ $query->update($db->quoteName('#__supportgroups_help_document'))->set($fields)->where($conditions);
+
+ $db->setQuery($query);
+
+ $db->execute();
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/admin/models/location.php b/admin/models/location.php
index 5b33a15..ed35ded 100644
--- a/admin/models/location.php
+++ b/admin/models/location.php
@@ -100,9 +100,98 @@ class SupportgroupsModelLocation extends JModelAdmin
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_supportgroups.location');
}
- }
+ }
+ $this->locationvvvw = $item->id;
return $item;
+ }
+
+ /**
+ * Method to get list data.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getVvwsupport_groups()
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_support_group table
+ $query->from($db->quoteName('#__supportgroups_support_group', 'a'));
+
+ // From the supportgroups_location table.
+ $query->select($db->quoteName('g.name','location_name'));
+ $query->join('LEFT', $db->quoteName('#__supportgroups_location', 'g') . ' ON (' . $db->quoteName('a.location') . ' = ' . $db->quoteName('g.id') . ')');
+
+ // From the supportgroups_clinic table.
+ $query->select($db->quoteName('h.name','clinic_name'));
+ $query->join('LEFT', $db->quoteName('#__supportgroups_clinic', 'h') . ' ON (' . $db->quoteName('a.clinic') . ' = ' . $db->quoteName('h.id') . ')');
+
+ // Filter by locationvvvw global.
+ $locationvvvw = $this->locationvvvw;
+ if (is_numeric($locationvvvw ))
+ {
+ $query->where('a.location = ' . (int) $locationvvvw );
+ }
+ elseif (is_string($locationvvvw))
+ {
+ $query->where('a.location = ' . $db->quote($locationvvvw));
+ }
+ else
+ {
+ $query->where('a.location = -5');
+ }
+
+ // Join over the asset groups.
+ $query->select('ag.title AS access_level');
+ $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
+ // Filter by access level.
+ if ($access = $this->getState('filter.access'))
+ {
+ $query->where('a.access = ' . (int) $access);
+ }
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+
+ // Order the results by ordering
+ $query->order('a.ordering ASC');
+
+ // Load the items
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ $items = $db->loadObjectList();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('support_group.access', 'com_supportgroups.support_group.' . (int) $item->id) && $user->authorise('support_group.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
+ return $items;
+ }
+ return false;
}
/**
@@ -141,8 +230,8 @@ class SupportgroupsModelLocation extends JModelAdmin
// Check for existing item.
// Modify the form based on Edit State access controls.
- if ($id != 0 && (!$user->authorise('core.edit.state', 'com_supportgroups.location.' . (int) $id))
- || ($id == 0 && !$user->authorise('core.edit.state', 'com_supportgroups')))
+ if ($id != 0 && (!$user->authorise('location.edit.state', 'com_supportgroups.location.' . (int) $id))
+ || ($id == 0 && !$user->authorise('location.edit.state', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
@@ -158,7 +247,8 @@ class SupportgroupsModelLocation extends JModelAdmin
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
- if (!$user->authorise('core.edit.created_by', 'com_supportgroups'))
+ if ($id != 0 && (!$user->authorise('location.edit.created_by', 'com_supportgroups.location.' . (int) $id))
+ || ($id == 0 && !$user->authorise('location.edit.created_by', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
@@ -168,7 +258,8 @@ class SupportgroupsModelLocation extends JModelAdmin
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
- if (!$user->authorise('core.edit.created', 'com_supportgroups'))
+ if ($id != 0 && (!$user->authorise('location.edit.created', 'com_supportgroups.location.' . (int) $id))
+ || ($id == 0 && !$user->authorise('location.edit.created', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
@@ -254,7 +345,7 @@ class SupportgroupsModelLocation extends JModelAdmin
$user = JFactory::getUser();
// The record has been set. Check the record permissions.
- return $user->authorise('core.delete', 'com_supportgroups.location.' . (int) $record->id);
+ return $user->authorise('location.delete', 'com_supportgroups.location.' . (int) $record->id);
}
return false;
}
@@ -276,14 +367,14 @@ class SupportgroupsModelLocation extends JModelAdmin
if ($recordId)
{
// The record has been set. Check the record permissions.
- $permission = $user->authorise('core.edit.state', 'com_supportgroups.location.' . (int) $recordId);
+ $permission = $user->authorise('location.edit.state', 'com_supportgroups.location.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// In the absense of better information, revert to the component permissions.
- return parent::canEditState($record);
+ return $user->authorise('location.edit.state', 'com_supportgroups');
}
/**
@@ -298,8 +389,9 @@ class SupportgroupsModelLocation extends JModelAdmin
protected function allowEdit($data = array(), $key = 'id')
{
// Check specific edit permission then general edit permission.
+ $user = JFactory::getUser();
- return JFactory::getUser()->authorise('core.edit', 'com_supportgroups.location.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
+ return $user->authorise('location.edit', 'com_supportgroups.location.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('location.edit', 'com_supportgroups');
}
/**
@@ -531,7 +623,7 @@ class SupportgroupsModelLocation extends JModelAdmin
$this->canDo = SupportgroupsHelper::getActions('location');
}
- if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
+ if (!$this->canDo->get('location.create') && !$this->canDo->get('location.batch'))
{
return false;
}
@@ -546,7 +638,7 @@ class SupportgroupsModelLocation extends JModelAdmin
{
$values['published'] = 0;
}
- elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
+ elseif (isset($values['published']) && !$this->canDo->get('location.edit.state'))
{
$values['published'] = 0;
}
@@ -563,7 +655,7 @@ class SupportgroupsModelLocation extends JModelAdmin
// only allow copy if user may edit this item.
- if (!$this->user->authorise('core.edit', $contexts[$pk]))
+ if (!$this->user->authorise('location.edit', $contexts[$pk]))
{
@@ -680,14 +772,14 @@ class SupportgroupsModelLocation extends JModelAdmin
$this->canDo = SupportgroupsHelper::getActions('location');
}
- if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
+ if (!$this->canDo->get('location.edit') && !$this->canDo->get('location.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
- if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
+ if (isset($values['published']) && !$this->canDo->get('location.edit.state'))
{
unset($values['published']);
}
@@ -697,7 +789,7 @@ class SupportgroupsModelLocation extends JModelAdmin
// Parent exists so we proceed
foreach ($pks as $pk)
{
- if (!$this->user->authorise('core.edit', $contexts[$pk]))
+ if (!$this->user->authorise('location.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
diff --git a/admin/models/locations.php b/admin/models/locations.php
index 367adab..36aa57a 100644
--- a/admin/models/locations.php
+++ b/admin/models/locations.php
@@ -105,7 +105,24 @@ class SupportgroupsModelLocations extends JModelList
$this->checkInNow();
// load parent items
- $items = parent::getItems();
+ $items = parent::getItems();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('location.access', 'com_supportgroups.location.' . (int) $item->id) && $user->authorise('location.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
// return items
return $items;
@@ -233,8 +250,17 @@ class SupportgroupsModelLocations extends JModelList
// set values to display correctly.
if (SupportgroupsHelper::checkArray($items))
{
+ // get user object.
+ $user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
+ $access = ($user->authorise('location.access', 'com_supportgroups.location.' . (int) $item->id) && $user->authorise('location.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
diff --git a/admin/models/payment.php b/admin/models/payment.php
new file mode 100644
index 0000000..bc123e2
--- /dev/null
+++ b/admin/models/payment.php
@@ -0,0 +1,888 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+use Joomla\Registry\Registry;
+
+// import Joomla modelform library
+jimport('joomla.application.component.modeladmin');
+
+/**
+ * Supportgroups Payment Model
+ */
+class SupportgroupsModelPayment extends JModelAdmin
+{
+ /**
+ * @var string The prefix to use with controller messages.
+ * @since 1.6
+ */
+ protected $text_prefix = 'COM_SUPPORTGROUPS';
+
+ /**
+ * The type alias for this content type.
+ *
+ * @var string
+ * @since 3.2
+ */
+ public $typeAlias = 'com_supportgroups.payment';
+
+ /**
+ * Returns a Table object, always creating it
+ *
+ * @param type $type The table type to instantiate
+ * @param string $prefix A prefix for the table class name. Optional.
+ * @param array $config Configuration array for model. Optional.
+ *
+ * @return JTable A database object
+ *
+ * @since 1.6
+ */
+ public function getTable($type = 'payment', $prefix = 'SupportgroupsTable', $config = array())
+ {
+ return JTable::getInstance($type, $prefix, $config);
+ }
+
+ /**
+ * Method to get a single record.
+ *
+ * @param integer $pk The id of the primary key.
+ *
+ * @return mixed Object on success, false on failure.
+ *
+ * @since 1.6
+ */
+ public function getItem($pk = null)
+ {
+ if ($item = parent::getItem($pk))
+ {
+ if (!empty($item->params))
+ {
+ // Convert the params field to an array.
+ $registry = new Registry;
+ $registry->loadString($item->params);
+ $item->params = $registry->toArray();
+ }
+
+ if (!empty($item->metadata))
+ {
+ // Convert the metadata field to an array.
+ $registry = new Registry;
+ $registry->loadString($item->metadata);
+ $item->metadata = $registry->toArray();
+ }
+
+ if (!empty($item->id))
+ {
+ $item->tags = new JHelperTags;
+ $item->tags->getTagIds($item->id, 'com_supportgroups.payment');
+ }
+ }
+
+ return $item;
+ }
+
+ /**
+ * Method to get the record form.
+ *
+ * @param array $data Data for the form.
+ * @param boolean $loadData True if the form is to load its own data (default case), false if not.
+ *
+ * @return mixed A JForm object on success, false on failure
+ *
+ * @since 1.6
+ */
+ public function getForm($data = array(), $loadData = true)
+ { // Get the form.
+ $form = $this->loadForm('com_supportgroups.payment', 'payment', array('control' => 'jform', 'load_data' => $loadData));
+
+ if (empty($form))
+ {
+ return false;
+ }
+
+ $jinput = JFactory::getApplication()->input;
+
+ // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ if ($jinput->get('a_id'))
+ {
+ $id = $jinput->get('a_id', 0, 'INT');
+ }
+ // The back end uses id so we use that the rest of the time and set it to 0 by default.
+ else
+ {
+ $id = $jinput->get('id', 0, 'INT');
+ }
+
+ $user = JFactory::getUser();
+
+ // Check for existing item.
+ // Modify the form based on Edit State access controls.
+ if ($id != 0 && (!$user->authorise('payment.edit.state', 'com_supportgroups.payment.' . (int) $id))
+ || ($id == 0 && !$user->authorise('payment.edit.state', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('ordering', 'disabled', 'true');
+ $form->setFieldAttribute('published', 'disabled', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('ordering', 'filter', 'unset');
+ $form->setFieldAttribute('published', 'filter', 'unset');
+ }
+ // If this is a new item insure the greated by is set.
+ if (0 == $id)
+ {
+ // Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // Modify the form based on Edit Creaded By access controls.
+ if ($id != 0 && (!$user->authorise('payment.edit.created_by', 'com_supportgroups.payment.' . (int) $id))
+ || ($id == 0 && !$user->authorise('payment.edit.created_by', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('created_by', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('created_by', 'readonly', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('created_by', 'filter', 'unset');
+ }
+ // Modify the form based on Edit Creaded Date access controls.
+ if ($id != 0 && (!$user->authorise('payment.edit.created', 'com_supportgroups.payment.' . (int) $id))
+ || ($id == 0 && !$user->authorise('payment.edit.created', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('created', 'disabled', 'true');
+ // Disable fields while saving.
+ $form->setFieldAttribute('created', 'filter', 'unset');
+ }
+ // Modify the form based on Edit Support Group access controls.
+ if ($id != 0 && (!$user->authorise('payment.edit.support_group', 'com_supportgroups.payment.' . (int) $id))
+ || ($id == 0 && !$user->authorise('payment.edit.support_group', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('support_group', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('support_group', 'readonly', 'true');
+ if (!$form->getValue('support_group'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('support_group', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('support_group', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Year access controls.
+ if ($id != 0 && (!$user->authorise('payment.edit.year', 'com_supportgroups.payment.' . (int) $id))
+ || ($id == 0 && !$user->authorise('payment.edit.year', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('year', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('year', 'readonly', 'true');
+ if (!$form->getValue('year'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('year', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('year', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Amount access controls.
+ if ($id != 0 && (!$user->authorise('payment.edit.amount', 'com_supportgroups.payment.' . (int) $id))
+ || ($id == 0 && !$user->authorise('payment.edit.amount', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('amount', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('amount', 'readonly', 'true');
+ if (!$form->getValue('amount'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('amount', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('amount', 'required', 'false');
+ }
+ }
+ // Only load these values if no id is found
+ if (0 == $id)
+ {
+ // Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
+
+ return $form;
+ }
+
+ /**
+ * Method to get the script that have to be included on the form
+ *
+ * @return string script files
+ */
+ public function getScript()
+ {
+ return 'administrator/components/com_supportgroups/models/forms/payment.js';
+ }
+
+ /**
+ * Method to test whether a record can be deleted.
+ *
+ * @param object $record A record object.
+ *
+ * @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
+ *
+ * @since 1.6
+ */
+ protected function canDelete($record)
+ {
+ if (!empty($record->id))
+ {
+ if ($record->published != -2)
+ {
+ return;
+ }
+
+ $user = JFactory::getUser();
+ // The record has been set. Check the record permissions.
+ return $user->authorise('payment.delete', 'com_supportgroups.payment.' . (int) $record->id);
+ }
+ return false;
+ }
+
+ /**
+ * Method to test whether a record can have its state edited.
+ *
+ * @param object $record A record object.
+ *
+ * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
+ *
+ * @since 1.6
+ */
+ protected function canEditState($record)
+ {
+ $user = JFactory::getUser();
+ $recordId = (!empty($record->id)) ? $record->id : 0;
+
+ if ($recordId)
+ {
+ // The record has been set. Check the record permissions.
+ $permission = $user->authorise('payment.edit.state', 'com_supportgroups.payment.' . (int) $recordId);
+ if (!$permission && !is_null($permission))
+ {
+ return false;
+ }
+ }
+ // In the absense of better information, revert to the component permissions.
+ return $user->authorise('payment.edit.state', 'com_supportgroups');
+ }
+
+ /**
+ * Method override to check if you can edit an existing record.
+ *
+ * @param array $data An array of input data.
+ * @param string $key The name of the key for the primary key.
+ *
+ * @return boolean
+ * @since 2.5
+ */
+ protected function allowEdit($data = array(), $key = 'id')
+ {
+ // Check specific edit permission then general edit permission.
+ $user = JFactory::getUser();
+
+ return $user->authorise('payment.edit', 'com_supportgroups.payment.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('payment.edit', 'com_supportgroups');
+ }
+
+ /**
+ * Prepare and sanitise the table data prior to saving.
+ *
+ * @param JTable $table A JTable object.
+ *
+ * @return void
+ *
+ * @since 1.6
+ */
+ protected function prepareTable($table)
+ {
+ $date = JFactory::getDate();
+ $user = JFactory::getUser();
+
+ if (isset($table->name))
+ {
+ $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
+ }
+
+ if (isset($table->alias) && empty($table->alias))
+ {
+ $table->generateAlias();
+ }
+
+ if (empty($table->id))
+ {
+ $table->created = $date->toSql();
+ // set the user
+ if ($table->created_by == 0 || empty($table->created_by))
+ {
+ $table->created_by = $user->id;
+ }
+ // Set ordering to the last item if not set
+ if (empty($table->ordering))
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select('MAX(ordering)')
+ ->from($db->quoteName('#__supportgroups_payment'));
+ $db->setQuery($query);
+ $max = $db->loadResult();
+
+ $table->ordering = $max + 1;
+ }
+ }
+ else
+ {
+ $table->modified = $date->toSql();
+ $table->modified_by = $user->id;
+ }
+
+ if (!empty($table->id))
+ {
+ // Increment the items version number.
+ $table->version++;
+ }
+ }
+
+ /**
+ * Method to get the data that should be injected in the form.
+ *
+ * @return mixed The data for the form.
+ *
+ * @since 1.6
+ */
+ protected function loadFormData()
+ {
+ // Check the session for previously entered form data.
+ $data = JFactory::getApplication()->getUserState('com_supportgroups.edit.payment.data', array());
+
+ if (empty($data))
+ {
+ $data = $this->getItem();
+ }
+
+ return $data;
+ }
+
+ /**
+ * Method to get the unique fields of this table.
+ *
+ * @return mixed An array of field names, boolean false if none is set.
+ *
+ * @since 3.0
+ */
+ protected function getUniqeFields()
+ {
+ return false;
+ }
+
+ /**
+ * Method to delete one or more records.
+ *
+ * @param array &$pks An array of record primary keys.
+ *
+ * @return boolean True if successful, false if an error occurs.
+ *
+ * @since 12.2
+ */
+ public function delete(&$pks)
+ {
+ if (!parent::delete($pks))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Method to perform batch operations on an item or a set of items.
+ *
+ * @param array $commands An array of commands to perform.
+ * @param array $pks An array of item ids.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return boolean Returns true on success, false on failure.
+ *
+ * @since 12.2
+ */
+ public function batch($commands, $pks, $contexts)
+ {
+ // Sanitize ids.
+ $pks = array_unique($pks);
+ JArrayHelper::toInteger($pks);
+
+ // Remove any values of zero.
+ if (array_search(0, $pks, true))
+ {
+ unset($pks[array_search(0, $pks, true)]);
+ }
+
+ if (empty($pks))
+ {
+ $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
+ return false;
+ }
+
+ $done = false;
+
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('payment');
+ $this->batchSet = true;
+
+ if (!$this->canDo->get('core.batch'))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
+ return false;
+ }
+
+ if ($this->type == false)
+ {
+ $type = new JUcmType;
+ $this->type = $type->getTypeByAlias($this->typeAlias);
+ }
+
+ $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
+
+ if (!empty($commands['move_copy']))
+ {
+ $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
+
+ if ($cmd == 'c')
+ {
+ $result = $this->batchCopy($commands, $pks, $contexts);
+
+ if (is_array($result))
+ {
+ foreach ($result as $old => $new)
+ {
+ $contexts[$new] = $contexts[$old];
+ }
+ $pks = array_values($result);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
+ {
+ return false;
+ }
+
+ $done = true;
+ }
+
+ if (!$done)
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
+
+ return false;
+ }
+
+ // Clear the cache
+ $this->cleanCache();
+
+ return true;
+ }
+
+ /**
+ * Batch copy items to a new category or current.
+ *
+ * @param integer $values The new values.
+ * @param array $pks An array of row IDs.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return mixed An array of new IDs on success, boolean false on failure.
+ *
+ * @since 12.2
+ */
+ protected function batchCopy($values, $pks, $contexts)
+ {
+ if (empty($this->batchSet))
+ {
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('payment');
+ }
+
+ if (!$this->canDo->get('payment.create') && !$this->canDo->get('payment.batch'))
+ {
+ return false;
+ }
+
+ // get list of uniqe fields
+ $uniqeFields = $this->getUniqeFields();
+ // remove move_copy from array
+ unset($values['move_copy']);
+
+ // make sure published is set
+ if (!isset($values['published']))
+ {
+ $values['published'] = 0;
+ }
+ elseif (isset($values['published']) && !$this->canDo->get('payment.edit.state'))
+ {
+ $values['published'] = 0;
+ }
+
+ $newIds = array();
+
+ // Parent exists so let's proceed
+ while (!empty($pks))
+ {
+ // Pop the first ID off the stack
+ $pk = array_shift($pks);
+
+ $this->table->reset();
+
+ // only allow copy if user may edit this item.
+
+ if (!$this->user->authorise('payment.edit', $contexts[$pk]))
+
+ {
+
+ // Not fatal error
+
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+
+ continue;
+
+ }
+
+ // Check that the row actually exists
+ if (!$this->table->load($pk))
+ {
+ if ($error = $this->table->getError())
+ {
+ // Fatal error
+ $this->setError($error);
+
+ return false;
+ }
+ else
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+ }
+
+ $this->table->support_group = $this->generateUniqe('support_group',$this->table->support_group);
+
+ // insert all set values
+ if (SupportgroupsHelper::checkArray($values))
+ {
+ foreach ($values as $key => $value)
+ {
+ if (strlen($value) > 0 && isset($this->table->$key))
+ {
+ $this->table->$key = $value;
+ }
+ }
+ }
+
+ // update all uniqe fields
+ if (SupportgroupsHelper::checkArray($uniqeFields))
+ {
+ foreach ($uniqeFields as $uniqeField)
+ {
+ $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
+ }
+ }
+
+ // Reset the ID because we are making a copy
+ $this->table->id = 0;
+
+ // TODO: Deal with ordering?
+ // $this->table->ordering = 1;
+
+ // Check the row.
+ if (!$this->table->check())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ if (!empty($this->type))
+ {
+ $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
+ }
+
+ // Store the row.
+ if (!$this->table->store())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ // Get the new item ID
+ $newId = $this->table->get('id');
+
+ // Add the new ID to the array
+ $newIds[$pk] = $newId;
+ }
+
+ // Clean the cache
+ $this->cleanCache();
+
+ return $newIds;
+ }
+
+ /**
+ * Batch move items to a new category
+ *
+ * @param integer $value The new category ID.
+ * @param array $pks An array of row IDs.
+ * @param array $contexts An array of item contexts.
+ *
+ * @return boolean True if successful, false otherwise and internal error is set.
+ *
+ * @since 12.2
+ */
+ protected function batchMove($values, $pks, $contexts)
+ {
+ if (empty($this->batchSet))
+ {
+ // Set some needed variables.
+ $this->user = JFactory::getUser();
+ $this->table = $this->getTable();
+ $this->tableClassName = get_class($this->table);
+ $this->contentType = new JUcmType;
+ $this->type = $this->contentType->getTypeByTable($this->tableClassName);
+ $this->canDo = SupportgroupsHelper::getActions('payment');
+ }
+
+ if (!$this->canDo->get('payment.edit') && !$this->canDo->get('payment.batch'))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
+ return false;
+ }
+
+ // make sure published only updates if user has the permission.
+ if (isset($values['published']) && !$this->canDo->get('payment.edit.state'))
+ {
+ unset($values['published']);
+ }
+ // remove move_copy from array
+ unset($values['move_copy']);
+
+ // Parent exists so we proceed
+ foreach ($pks as $pk)
+ {
+ if (!$this->user->authorise('payment.edit', $contexts[$pk]))
+ {
+ $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
+
+ return false;
+ }
+
+ // Check that the row actually exists
+ if (!$this->table->load($pk))
+ {
+ if ($error = $this->table->getError())
+ {
+ // Fatal error
+ $this->setError($error);
+
+ return false;
+ }
+ else
+ {
+ // Not fatal error
+ $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
+ continue;
+ }
+ }
+
+ // insert all set values.
+ if (SupportgroupsHelper::checkArray($values))
+ {
+ foreach ($values as $key => $value)
+ {
+ // Do special action for access.
+ if ('access' == $key && strlen($value) > 0)
+ {
+ $this->table->$key = $value;
+ }
+ elseif (strlen($value) > 0 && isset($this->table->$key))
+ {
+ $this->table->$key = $value;
+ }
+ }
+ }
+
+
+ // Check the row.
+ if (!$this->table->check())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+
+ if (!empty($this->type))
+ {
+ $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
+ }
+
+ // Store the row.
+ if (!$this->table->store())
+ {
+ $this->setError($this->table->getError());
+
+ return false;
+ }
+ }
+
+ // Clean the cache
+ $this->cleanCache();
+
+ return true;
+ }
+
+ /**
+ * Method to save the form data.
+ *
+ * @param array $data The form data.
+ *
+ * @return boolean True on success.
+ *
+ * @since 1.6
+ */
+ public function save($data)
+ {
+ $input = JFactory::getApplication()->input;
+ $filter = JFilterInput::getInstance();
+
+ // set the metadata to the Item Data
+ if (isset($data['metadata']) && isset($data['metadata']['author']))
+ {
+ $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
+
+ $metadata = new JRegistry;
+ $metadata->loadArray($data['metadata']);
+ $data['metadata'] = (string) $metadata;
+ }
+
+ // Set the Params Items to data
+ if (isset($data['params']) && is_array($data['params']))
+ {
+ $params = new JRegistry;
+ $params->loadArray($data['params']);
+ $data['params'] = (string) $params;
+ }
+
+ // Alter the uniqe field for save as copy
+ if ($input->get('task') == 'save2copy')
+ {
+ // Automatic handling of other uniqe fields
+ $uniqeFields = $this->getUniqeFields();
+ if (SupportgroupsHelper::checkArray($uniqeFields))
+ {
+ foreach ($uniqeFields as $uniqeField)
+ {
+ $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
+ }
+ }
+ }
+
+ if (parent::save($data))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method to generate a uniqe value.
+ *
+ * @param string $field name.
+ * @param string $value data.
+ *
+ * @return string New value.
+ *
+ * @since 3.0
+ */
+ protected function generateUniqe($field,$value)
+ {
+
+ // set field value uniqe
+ $table = $this->getTable();
+
+ while ($table->load(array($field => $value)))
+ {
+ $value = JString::increment($value);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Method to change the title & alias.
+ *
+ * @param string $title The title.
+ *
+ * @return array Contains the modified title and alias.
+ *
+ */
+ protected function _generateNewTitle($title)
+ {
+
+ // Alter the title
+ $table = $this->getTable();
+
+ while ($table->load(array('title' => $title)))
+ {
+ $title = JString::increment($title);
+ }
+
+ return $title;
+ }
+}
diff --git a/admin/models/payments.php b/admin/models/payments.php
new file mode 100644
index 0000000..3f322aa
--- /dev/null
+++ b/admin/models/payments.php
@@ -0,0 +1,466 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import the Joomla modellist library
+jimport('joomla.application.component.modellist');
+
+/**
+ * Payments Model
+ */
+class SupportgroupsModelPayments extends JModelList
+{
+ public function __construct($config = array())
+ {
+ if (empty($config['filter_fields']))
+ {
+ $config['filter_fields'] = array(
+ 'a.id','id',
+ 'a.published','published',
+ 'a.ordering','ordering',
+ 'a.created_by','created_by',
+ 'a.modified_by','modified_by',
+ 'a.support_group','support_group',
+ 'a.year','year',
+ 'a.amount','amount'
+ );
+ }
+
+ parent::__construct($config);
+ }
+
+ /**
+ * Method to auto-populate the model state.
+ *
+ * @return void
+ */
+ protected function populateState($ordering = null, $direction = null)
+ {
+ $app = JFactory::getApplication();
+
+ // Adjust the context to support modal layouts.
+ if ($layout = $app->input->get('layout'))
+ {
+ $this->context .= '.' . $layout;
+ }
+ $support_group = $this->getUserStateFromRequest($this->context . '.filter.support_group', 'filter_support_group');
+ $this->setState('filter.support_group', $support_group);
+
+ $year = $this->getUserStateFromRequest($this->context . '.filter.year', 'filter_year');
+ $this->setState('filter.year', $year);
+
+ $amount = $this->getUserStateFromRequest($this->context . '.filter.amount', 'filter_amount');
+ $this->setState('filter.amount', $amount);
+
+ $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
+ $this->setState('filter.sorting', $sorting);
+
+ $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
+ $this->setState('filter.access', $access);
+
+ $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
+ $this->setState('filter.search', $search);
+
+ $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
+ $this->setState('filter.published', $published);
+
+ $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
+ $this->setState('filter.created_by', $created_by);
+
+ $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
+ $this->setState('filter.created', $created);
+
+ // List state information.
+ parent::populateState($ordering, $direction);
+ }
+
+ /**
+ * Method to get an array of data items.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getItems()
+ {
+ // check in items
+ $this->checkInNow();
+
+ // load parent items
+ $items = parent::getItems();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('payment.access', 'com_supportgroups.payment.' . (int) $item->id) && $user->authorise('payment.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
+
+ // Try Convert the Amount to the Currency value
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ foreach ($items as $nr => &$item)
+ {
+ // convert to currency here
+ $item->amount = SupportgroupsHelper::setCurrency($item->amount, $item->support_group);
+ }
+ }
+
+ // set selection value to a translatable value
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ foreach ($items as $nr => &$item)
+ {
+ // convert year
+ $item->year = $this->selectionTranslation($item->year, 'year');
+ }
+ }
+
+
+ // return items
+ return $items;
+ }
+
+ /**
+ * Method to convert selection values to translatable string.
+ *
+ * @return translatable string
+ */
+ public function selectionTranslation($value,$name)
+ {
+ // Array of year language strings
+ if ($name == 'year')
+ {
+ $yearArray = array(
+ 0 => 'COM_SUPPORTGROUPS_PAYMENT_SELECT_A_YEAR',
+ 2010 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TEN',
+ 2011 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_ELEVEN',
+ 2012 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWELVE',
+ 2013 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTEEN',
+ 2014 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FOURTEEN',
+ 2015 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FIFTEEN',
+ 2016 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SIXTEEN',
+ 2017 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SEVENTEEN',
+ 2018 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_EIGHTEEN',
+ 2019 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_NINETEEN',
+ 2020 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY',
+ 2021 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_ONE',
+ 2022 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_TWO',
+ 2023 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_THREE',
+ 2024 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FOUR',
+ 2025 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FIVE',
+ 2026 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SIX',
+ 2027 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SEVEN',
+ 2028 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_EIGHT',
+ 2029 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_NINE',
+ 2030 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTY'
+ );
+ // Now check if value is found in this array
+ if (isset($yearArray[$value]) && SupportgroupsHelper::checkString($yearArray[$value]))
+ {
+ return $yearArray[$value];
+ }
+ }
+ return $value;
+ }
+
+ /**
+ * Method to build an SQL query to load the list data.
+ *
+ * @return string An SQL query
+ */
+ protected function getListQuery()
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_item table
+ $query->from($db->quoteName('#__supportgroups_payment', 'a'));
+
+ // From the supportgroups_support_group table.
+ $query->select($db->quoteName('g.name','support_group_name'));
+ $query->join('LEFT', $db->quoteName('#__supportgroups_support_group', 'g') . ' ON (' . $db->quoteName('a.support_group') . ' = ' . $db->quoteName('g.id') . ')');
+
+ // Filter by published state
+ $published = $this->getState('filter.published');
+ if (is_numeric($published))
+ {
+ $query->where('a.published = ' . (int) $published);
+ }
+ elseif ($published === '')
+ {
+ $query->where('(a.published = 0 OR a.published = 1)');
+ }
+
+ // Join over the asset groups.
+ $query->select('ag.title AS access_level');
+ $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
+ // Filter by access level.
+ if ($access = $this->getState('filter.access'))
+ {
+ $query->where('a.access = ' . (int) $access);
+ }
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+ // Filter by search.
+ $search = $this->getState('filter.search');
+ if (!empty($search))
+ {
+ if (stripos($search, 'id:') === 0)
+ {
+ $query->where('a.id = ' . (int) substr($search, 3));
+ }
+ else
+ {
+ $search = $db->quote('%' . $db->escape($search, true) . '%');
+ $query->where('(a.support_group LIKE '.$search.' OR g.name LIKE '.$search.' OR a.year LIKE '.$search.' OR a.amount LIKE '.$search.')');
+ }
+ }
+
+ // Filter by support_group.
+ if ($support_group = $this->getState('filter.support_group'))
+ {
+ $query->where('a.support_group = ' . $db->quote($db->escape($support_group, true)));
+ }
+ // Filter by Year.
+ if ($year = $this->getState('filter.year'))
+ {
+ $query->where('a.year = ' . $db->quote($db->escape($year, true)));
+ }
+
+ // Add the list ordering clause.
+ $orderCol = $this->state->get('list.ordering', 'a.id');
+ $orderDirn = $this->state->get('list.direction', 'asc');
+ if ($orderCol != '')
+ {
+ $query->order($db->escape($orderCol . ' ' . $orderDirn));
+ }
+
+ return $query;
+ }
+
+ /**
+ * Method to get list export data.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getExportData($pks)
+ {
+ // setup the query
+ if (SupportgroupsHelper::checkArray($pks))
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_payment table
+ $query->from($db->quoteName('#__supportgroups_payment', 'a'));
+ $query->where('a.id IN (' . implode(',',$pks) . ')');
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+
+ // Order the results by ordering
+ $query->order('a.ordering ASC');
+
+ // Load the items
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ $items = $db->loadObjectList();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('payment.access', 'com_supportgroups.payment.' . (int) $item->id) && $user->authorise('payment.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ // unset the values we don't want exported.
+ unset($item->asset_id);
+ unset($item->checked_out);
+ unset($item->checked_out_time);
+ }
+ }
+ // Add headers to items array.
+ $headers = $this->getExImPortHeaders();
+ if (SupportgroupsHelper::checkObject($headers))
+ {
+ array_unshift($items,$headers);
+ }
+
+ // Try Convert the Amount to the Currency value
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ foreach ($items as $nr => &$item)
+ {
+ // convert to currency here
+ $item->amount = SupportgroupsHelper::setCurrency($item->amount, $item->support_group);
+ }
+ }
+ return $items;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Method to get header.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getExImPortHeaders()
+ {
+ // Get a db connection.
+ $db = JFactory::getDbo();
+ // get the columns
+ $columns = $db->getTableColumns("#__supportgroups_payment");
+ if (SupportgroupsHelper::checkArray($columns))
+ {
+ // remove the headers you don't import/export.
+ unset($columns['asset_id']);
+ unset($columns['checked_out']);
+ unset($columns['checked_out_time']);
+ $headers = new stdClass();
+ foreach ($columns as $column => $type)
+ {
+ $headers->{$column} = $column;
+ }
+ return $headers;
+ }
+ return false;
+ }
+
+ /**
+ * Method to get a store id based on model configuration state.
+ *
+ * @return string A store id.
+ *
+ */
+ protected function getStoreId($id = '')
+ {
+ // Compile the store id.
+ $id .= ':' . $this->getState('filter.id');
+ $id .= ':' . $this->getState('filter.search');
+ $id .= ':' . $this->getState('filter.published');
+ $id .= ':' . $this->getState('filter.ordering');
+ $id .= ':' . $this->getState('filter.created_by');
+ $id .= ':' . $this->getState('filter.modified_by');
+ $id .= ':' . $this->getState('filter.support_group');
+ $id .= ':' . $this->getState('filter.year');
+ $id .= ':' . $this->getState('filter.amount');
+
+ return parent::getStoreId($id);
+ }
+
+ /**
+ * Build an SQL query to checkin all items left checked out longer then a set time.
+ *
+ * @return a bool
+ *
+ */
+ protected function checkInNow()
+ {
+ // Get set check in time
+ $time = JComponentHelper::getParams('com_supportgroups')->get('check_in');
+
+ if ($time)
+ {
+
+ // Get a db connection.
+ $db = JFactory::getDbo();
+ // reset query
+ $query = $db->getQuery(true);
+ $query->select('*');
+ $query->from($db->quoteName('#__supportgroups_payment'));
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ // Get Yesterdays date
+ $date = JFactory::getDate()->modify($time)->toSql();
+ // reset query
+ $query = $db->getQuery(true);
+
+ // Fields to update.
+ $fields = array(
+ $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
+ $db->quoteName('checked_out') . '=0'
+ );
+
+ // Conditions for which records should be updated.
+ $conditions = array(
+ $db->quoteName('checked_out') . '!=0',
+ $db->quoteName('checked_out_time') . '<\''.$date.'\''
+ );
+
+ // Check table
+ $query->update($db->quoteName('#__supportgroups_payment'))->set($fields)->where($conditions);
+
+ $db->setQuery($query);
+
+ $db->execute();
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/admin/models/region.php b/admin/models/region.php
index 38ec27e..e80060c 100644
--- a/admin/models/region.php
+++ b/admin/models/region.php
@@ -100,9 +100,94 @@ class SupportgroupsModelRegion extends JModelAdmin
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_supportgroups.region');
}
- }
+ }
+ $this->regionvvvx = $item->id;
return $item;
+ }
+
+ /**
+ * Method to get list data.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getVvxlocations()
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_location table
+ $query->from($db->quoteName('#__supportgroups_location', 'a'));
+
+ // From the supportgroups_region table.
+ $query->select($db->quoteName('g.name','region_name'));
+ $query->join('LEFT', $db->quoteName('#__supportgroups_region', 'g') . ' ON (' . $db->quoteName('a.region') . ' = ' . $db->quoteName('g.id') . ')');
+
+ // Filter by regionvvvx global.
+ $regionvvvx = $this->regionvvvx;
+ if (is_numeric($regionvvvx ))
+ {
+ $query->where('a.region = ' . (int) $regionvvvx );
+ }
+ elseif (is_string($regionvvvx))
+ {
+ $query->where('a.region = ' . $db->quote($regionvvvx));
+ }
+ else
+ {
+ $query->where('a.region = -5');
+ }
+
+ // Join over the asset groups.
+ $query->select('ag.title AS access_level');
+ $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
+ // Filter by access level.
+ if ($access = $this->getState('filter.access'))
+ {
+ $query->where('a.access = ' . (int) $access);
+ }
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+
+ // Order the results by ordering
+ $query->order('a.ordering ASC');
+
+ // Load the items
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ $items = $db->loadObjectList();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('location.access', 'com_supportgroups.location.' . (int) $item->id) && $user->authorise('location.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
+ return $items;
+ }
+ return false;
}
/**
@@ -141,8 +226,8 @@ class SupportgroupsModelRegion extends JModelAdmin
// Check for existing item.
// Modify the form based on Edit State access controls.
- if ($id != 0 && (!$user->authorise('core.edit.state', 'com_supportgroups.region.' . (int) $id))
- || ($id == 0 && !$user->authorise('core.edit.state', 'com_supportgroups')))
+ if ($id != 0 && (!$user->authorise('region.edit.state', 'com_supportgroups.region.' . (int) $id))
+ || ($id == 0 && !$user->authorise('region.edit.state', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
@@ -158,7 +243,8 @@ class SupportgroupsModelRegion extends JModelAdmin
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
- if (!$user->authorise('core.edit.created_by', 'com_supportgroups'))
+ if ($id != 0 && (!$user->authorise('region.edit.created_by', 'com_supportgroups.region.' . (int) $id))
+ || ($id == 0 && !$user->authorise('region.edit.created_by', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
@@ -168,7 +254,8 @@ class SupportgroupsModelRegion extends JModelAdmin
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
- if (!$user->authorise('core.edit.created', 'com_supportgroups'))
+ if ($id != 0 && (!$user->authorise('region.edit.created', 'com_supportgroups.region.' . (int) $id))
+ || ($id == 0 && !$user->authorise('region.edit.created', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
@@ -254,7 +341,7 @@ class SupportgroupsModelRegion extends JModelAdmin
$user = JFactory::getUser();
// The record has been set. Check the record permissions.
- return $user->authorise('core.delete', 'com_supportgroups.region.' . (int) $record->id);
+ return $user->authorise('region.delete', 'com_supportgroups.region.' . (int) $record->id);
}
return false;
}
@@ -276,14 +363,14 @@ class SupportgroupsModelRegion extends JModelAdmin
if ($recordId)
{
// The record has been set. Check the record permissions.
- $permission = $user->authorise('core.edit.state', 'com_supportgroups.region.' . (int) $recordId);
+ $permission = $user->authorise('region.edit.state', 'com_supportgroups.region.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// In the absense of better information, revert to the component permissions.
- return parent::canEditState($record);
+ return $user->authorise('region.edit.state', 'com_supportgroups');
}
/**
@@ -298,8 +385,9 @@ class SupportgroupsModelRegion extends JModelAdmin
protected function allowEdit($data = array(), $key = 'id')
{
// Check specific edit permission then general edit permission.
+ $user = JFactory::getUser();
- return JFactory::getUser()->authorise('core.edit', 'com_supportgroups.region.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
+ return $user->authorise('region.edit', 'com_supportgroups.region.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('region.edit', 'com_supportgroups');
}
/**
@@ -531,7 +619,7 @@ class SupportgroupsModelRegion extends JModelAdmin
$this->canDo = SupportgroupsHelper::getActions('region');
}
- if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
+ if (!$this->canDo->get('region.create') && !$this->canDo->get('region.batch'))
{
return false;
}
@@ -546,7 +634,7 @@ class SupportgroupsModelRegion extends JModelAdmin
{
$values['published'] = 0;
}
- elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
+ elseif (isset($values['published']) && !$this->canDo->get('region.edit.state'))
{
$values['published'] = 0;
}
@@ -563,7 +651,7 @@ class SupportgroupsModelRegion extends JModelAdmin
// only allow copy if user may edit this item.
- if (!$this->user->authorise('core.edit', $contexts[$pk]))
+ if (!$this->user->authorise('region.edit', $contexts[$pk]))
{
@@ -680,14 +768,14 @@ class SupportgroupsModelRegion extends JModelAdmin
$this->canDo = SupportgroupsHelper::getActions('region');
}
- if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
+ if (!$this->canDo->get('region.edit') && !$this->canDo->get('region.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
- if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
+ if (isset($values['published']) && !$this->canDo->get('region.edit.state'))
{
unset($values['published']);
}
@@ -697,7 +785,7 @@ class SupportgroupsModelRegion extends JModelAdmin
// Parent exists so we proceed
foreach ($pks as $pk)
{
- if (!$this->user->authorise('core.edit', $contexts[$pk]))
+ if (!$this->user->authorise('region.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
diff --git a/admin/models/regions.php b/admin/models/regions.php
index 53f0d43..e1e19f0 100644
--- a/admin/models/regions.php
+++ b/admin/models/regions.php
@@ -105,7 +105,24 @@ class SupportgroupsModelRegions extends JModelList
$this->checkInNow();
// load parent items
- $items = parent::getItems();
+ $items = parent::getItems();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('region.access', 'com_supportgroups.region.' . (int) $item->id) && $user->authorise('region.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
// return items
return $items;
@@ -233,8 +250,17 @@ class SupportgroupsModelRegions extends JModelList
// set values to display correctly.
if (SupportgroupsHelper::checkArray($items))
{
+ // get user object.
+ $user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
+ $access = ($user->authorise('region.access', 'com_supportgroups.region.' . (int) $item->id) && $user->authorise('region.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
diff --git a/admin/models/support_group.php b/admin/models/support_group.php
index e3bfd5a..6c237ef 100644
--- a/admin/models/support_group.php
+++ b/admin/models/support_group.php
@@ -100,9 +100,158 @@ class SupportgroupsModelSupport_group extends JModelAdmin
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_supportgroups.support_group');
}
- }
+ }
+ $this->support_groupvvvv = $item->id;
return $item;
+ }
+
+ /**
+ * Method to get list data.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
+ public function getVvvpayments()
+ {
+ // Get the user object.
+ $user = JFactory::getUser();
+ // Create a new query object.
+ $db = JFactory::getDBO();
+ $query = $db->getQuery(true);
+
+ // Select some fields
+ $query->select('a.*');
+
+ // From the supportgroups_payment table
+ $query->from($db->quoteName('#__supportgroups_payment', 'a'));
+
+ // From the supportgroups_support_group table.
+ $query->select($db->quoteName('g.name','support_group_name'));
+ $query->join('LEFT', $db->quoteName('#__supportgroups_support_group', 'g') . ' ON (' . $db->quoteName('a.support_group') . ' = ' . $db->quoteName('g.id') . ')');
+
+ // Filter by support_groupvvvv global.
+ $support_groupvvvv = $this->support_groupvvvv;
+ if (is_numeric($support_groupvvvv ))
+ {
+ $query->where('a.support_group = ' . (int) $support_groupvvvv );
+ }
+ elseif (is_string($support_groupvvvv))
+ {
+ $query->where('a.support_group = ' . $db->quote($support_groupvvvv));
+ }
+ else
+ {
+ $query->where('a.support_group = -5');
+ }
+
+ // Join over the asset groups.
+ $query->select('ag.title AS access_level');
+ $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
+ // Filter by access level.
+ if ($access = $this->getState('filter.access'))
+ {
+ $query->where('a.access = ' . (int) $access);
+ }
+ // Implement View Level Access
+ if (!$user->authorise('core.options', 'com_supportgroups'))
+ {
+ $groups = implode(',', $user->getAuthorisedViewLevels());
+ $query->where('a.access IN (' . $groups . ')');
+ }
+
+ // Order the results by ordering
+ $query->order('a.ordering ASC');
+
+ // Load the items
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->getNumRows())
+ {
+ $items = $db->loadObjectList();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('payment.access', 'com_supportgroups.payment.' . (int) $item->id) && $user->authorise('payment.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
+
+ // Try Convert the Amount to the Currency value
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ foreach ($items as $nr => &$item)
+ {
+ // convert to currency here
+ $item->amount = SupportgroupsHelper::setCurrency($item->amount, $item->support_group);
+ }
+ }
+
+ // set selection value to a translatable value
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ foreach ($items as $nr => &$item)
+ {
+ // convert year
+ $item->year = $this->selectionTranslationVvvpayments($item->year, 'year');
+ }
+ }
+
+ return $items;
+ }
+ return false;
+ }
+
+ /**
+ * Method to convert selection values to translatable string.
+ *
+ * @return translatable string
+ */
+ public function selectionTranslationVvvpayments($value,$name)
+ {
+ // Array of year language strings
+ if ($name == 'year')
+ {
+ $yearArray = array(
+ 0 => 'COM_SUPPORTGROUPS_PAYMENT_SELECT_A_YEAR',
+ 2010 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TEN',
+ 2011 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_ELEVEN',
+ 2012 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWELVE',
+ 2013 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTEEN',
+ 2014 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FOURTEEN',
+ 2015 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_FIFTEEN',
+ 2016 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SIXTEEN',
+ 2017 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_SEVENTEEN',
+ 2018 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_EIGHTEEN',
+ 2019 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_NINETEEN',
+ 2020 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY',
+ 2021 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_ONE',
+ 2022 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_TWO',
+ 2023 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_THREE',
+ 2024 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FOUR',
+ 2025 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_FIVE',
+ 2026 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SIX',
+ 2027 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_SEVEN',
+ 2028 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_EIGHT',
+ 2029 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_TWENTY_NINE',
+ 2030 => 'COM_SUPPORTGROUPS_PAYMENT_TWO_THOUSAND_AND_THIRTY'
+ );
+ // Now check if value is found in this array
+ if (isset($yearArray[$value]) && SupportgroupsHelper::checkString($yearArray[$value]))
+ {
+ return $yearArray[$value];
+ }
+ }
+ return $value;
}
/**
@@ -141,8 +290,8 @@ class SupportgroupsModelSupport_group extends JModelAdmin
// Check for existing item.
// Modify the form based on Edit State access controls.
- if ($id != 0 && (!$user->authorise('core.edit.state', 'com_supportgroups.support_group.' . (int) $id))
- || ($id == 0 && !$user->authorise('core.edit.state', 'com_supportgroups')))
+ if ($id != 0 && (!$user->authorise('support_group.edit.state', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.state', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
@@ -158,7 +307,8 @@ class SupportgroupsModelSupport_group extends JModelAdmin
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
- if (!$user->authorise('core.edit.created_by', 'com_supportgroups'))
+ if ($id != 0 && (!$user->authorise('support_group.edit.created_by', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.created_by', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
@@ -168,7 +318,8 @@ class SupportgroupsModelSupport_group extends JModelAdmin
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
- if (!$user->authorise('core.edit.created', 'com_supportgroups'))
+ if ($id != 0 && (!$user->authorise('support_group.edit.created', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.created', 'com_supportgroups')))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
@@ -191,6 +342,134 @@ class SupportgroupsModelSupport_group extends JModelAdmin
$form->setFieldAttribute('name', 'required', 'false');
}
}
+ // Modify the form based on Edit Phone access controls.
+ if ($id != 0 && (!$user->authorise('support_group.edit.phone', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.phone', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('phone', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('phone', 'readonly', 'true');
+ if (!$form->getValue('phone'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('phone', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('phone', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Location access controls.
+ if ($id != 0 && (!$user->authorise('support_group.edit.location', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.location', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('location', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('location', 'readonly', 'true');
+ if (!$form->getValue('location'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('location', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('location', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Clinic access controls.
+ if ($id != 0 && (!$user->authorise('support_group.edit.clinic', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.clinic', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('clinic', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('clinic', 'readonly', 'true');
+ if (!$form->getValue('clinic'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('clinic', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('clinic', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Male access controls.
+ if ($id != 0 && (!$user->authorise('support_group.edit.male', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.male', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('male', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('male', 'readonly', 'true');
+ if (!$form->getValue('male'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('male', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('male', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Female access controls.
+ if ($id != 0 && (!$user->authorise('support_group.edit.female', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.female', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('female', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('female', 'readonly', 'true');
+ if (!$form->getValue('female'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('female', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('female', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Female Art access controls.
+ if ($id != 0 && (!$user->authorise('support_group.edit.female_art', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.female_art', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('female_art', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('female_art', 'readonly', 'true');
+ if (!$form->getValue('female_art'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('female_art', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('female_art', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Male Art access controls.
+ if ($id != 0 && (!$user->authorise('support_group.edit.male_art', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.male_art', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('male_art', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('male_art', 'readonly', 'true');
+ if (!$form->getValue('male_art'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('male_art', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('male_art', 'required', 'false');
+ }
+ }
+ // Modify the form based on Edit Male Children access controls.
+ if ($id != 0 && (!$user->authorise('support_group.edit.male_children', 'com_supportgroups.support_group.' . (int) $id))
+ || ($id == 0 && !$user->authorise('support_group.edit.male_children', 'com_supportgroups')))
+ {
+ // Disable fields for display.
+ $form->setFieldAttribute('male_children', 'disabled', 'true');
+ // Disable fields for display.
+ $form->setFieldAttribute('male_children', 'readonly', 'true');
+ if (!$form->getValue('male_children'))
+ {
+ // Disable fields while saving.
+ $form->setFieldAttribute('male_children', 'filter', 'unset');
+ // Disable fields while saving.
+ $form->setFieldAttribute('male_children', 'required', 'false');
+ }
+ }
// Only load these values if no id is found
if (0 == $id)
{
@@ -238,7 +517,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin
$user = JFactory::getUser();
// The record has been set. Check the record permissions.
- return $user->authorise('core.delete', 'com_supportgroups.support_group.' . (int) $record->id);
+ return $user->authorise('support_group.delete', 'com_supportgroups.support_group.' . (int) $record->id);
}
return false;
}
@@ -260,14 +539,14 @@ class SupportgroupsModelSupport_group extends JModelAdmin
if ($recordId)
{
// The record has been set. Check the record permissions.
- $permission = $user->authorise('core.edit.state', 'com_supportgroups.support_group.' . (int) $recordId);
+ $permission = $user->authorise('support_group.edit.state', 'com_supportgroups.support_group.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// In the absense of better information, revert to the component permissions.
- return parent::canEditState($record);
+ return $user->authorise('support_group.edit.state', 'com_supportgroups');
}
/**
@@ -282,8 +561,9 @@ class SupportgroupsModelSupport_group extends JModelAdmin
protected function allowEdit($data = array(), $key = 'id')
{
// Check specific edit permission then general edit permission.
+ $user = JFactory::getUser();
- return JFactory::getUser()->authorise('core.edit', 'com_supportgroups.support_group.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
+ return $user->authorise('support_group.edit', 'com_supportgroups.support_group.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('support_group.edit', 'com_supportgroups');
}
/**
@@ -515,7 +795,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin
$this->canDo = SupportgroupsHelper::getActions('support_group');
}
- if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
+ if (!$this->canDo->get('support_group.create') && !$this->canDo->get('support_group.batch'))
{
return false;
}
@@ -530,7 +810,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin
{
$values['published'] = 0;
}
- elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
+ elseif (isset($values['published']) && !$this->canDo->get('support_group.edit.state'))
{
$values['published'] = 0;
}
@@ -547,7 +827,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin
// only allow copy if user may edit this item.
- if (!$this->user->authorise('core.edit', $contexts[$pk]))
+ if (!$this->user->authorise('support_group.edit', $contexts[$pk]))
{
@@ -664,14 +944,14 @@ class SupportgroupsModelSupport_group extends JModelAdmin
$this->canDo = SupportgroupsHelper::getActions('support_group');
}
- if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
+ if (!$this->canDo->get('support_group.edit') && !$this->canDo->get('support_group.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
- if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
+ if (isset($values['published']) && !$this->canDo->get('support_group.edit.state'))
{
unset($values['published']);
}
@@ -681,7 +961,7 @@ class SupportgroupsModelSupport_group extends JModelAdmin
// Parent exists so we proceed
foreach ($pks as $pk)
{
- if (!$this->user->authorise('core.edit', $contexts[$pk]))
+ if (!$this->user->authorise('support_group.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
diff --git a/admin/models/support_groups.php b/admin/models/support_groups.php
index cf55bf3..b7a4285 100644
--- a/admin/models/support_groups.php
+++ b/admin/models/support_groups.php
@@ -44,7 +44,12 @@ class SupportgroupsModelSupport_groups extends JModelList
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
- 'a.name','name'
+ 'a.name','name',
+ 'a.phone','phone',
+ 'a.location','location',
+ 'a.clinic','clinic',
+ 'a.male','male',
+ 'a.female','female'
);
}
@@ -66,7 +71,22 @@ class SupportgroupsModelSupport_groups extends JModelList
$this->context .= '.' . $layout;
}
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
- $this->setState('filter.name', $name);
+ $this->setState('filter.name', $name);
+
+ $phone = $this->getUserStateFromRequest($this->context . '.filter.phone', 'filter_phone');
+ $this->setState('filter.phone', $phone);
+
+ $location = $this->getUserStateFromRequest($this->context . '.filter.location', 'filter_location');
+ $this->setState('filter.location', $location);
+
+ $clinic = $this->getUserStateFromRequest($this->context . '.filter.clinic', 'filter_clinic');
+ $this->setState('filter.clinic', $clinic);
+
+ $male = $this->getUserStateFromRequest($this->context . '.filter.male', 'filter_male');
+ $this->setState('filter.male', $male);
+
+ $female = $this->getUserStateFromRequest($this->context . '.filter.female', 'filter_female');
+ $this->setState('filter.female', $female);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
@@ -101,7 +121,24 @@ class SupportgroupsModelSupport_groups extends JModelList
$this->checkInNow();
// load parent items
- $items = parent::getItems();
+ $items = parent::getItems();
+
+ // set values to display correctly.
+ if (SupportgroupsHelper::checkArray($items))
+ {
+ // get user object.
+ $user = JFactory::getUser();
+ foreach ($items as $nr => &$item)
+ {
+ $access = ($user->authorise('support_group.access', 'com_supportgroups.support_group.' . (int) $item->id) && $user->authorise('support_group.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
+ }
+ }
// return items
return $items;
@@ -126,6 +163,14 @@ class SupportgroupsModelSupport_groups extends JModelList
// From the supportgroups_item table
$query->from($db->quoteName('#__supportgroups_support_group', 'a'));
+ // From the supportgroups_location table.
+ $query->select($db->quoteName('g.name','location_name'));
+ $query->join('LEFT', $db->quoteName('#__supportgroups_location', 'g') . ' ON (' . $db->quoteName('a.location') . ' = ' . $db->quoteName('g.id') . ')');
+
+ // From the supportgroups_clinic table.
+ $query->select($db->quoteName('h.name','clinic_name'));
+ $query->join('LEFT', $db->quoteName('#__supportgroups_clinic', 'h') . ' ON (' . $db->quoteName('a.clinic') . ' = ' . $db->quoteName('h.id') . ')');
+
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
@@ -162,10 +207,20 @@ class SupportgroupsModelSupport_groups extends JModelList
else
{
$search = $db->quote('%' . $db->escape($search, true) . '%');
- $query->where('(a.name LIKE '.$search.')');
+ $query->where('(a.name LIKE '.$search.' OR a.phone LIKE '.$search.' OR a.location LIKE '.$search.' OR g.name LIKE '.$search.' OR a.clinic LIKE '.$search.' OR h.name LIKE '.$search.')');
}
}
+ // Filter by location.
+ if ($location = $this->getState('filter.location'))
+ {
+ $query->where('a.location = ' . $db->quote($db->escape($location, true)));
+ }
+ // Filter by clinic.
+ if ($clinic = $this->getState('filter.clinic'))
+ {
+ $query->where('a.clinic = ' . $db->quote($db->escape($clinic, true)));
+ }
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
@@ -220,8 +275,17 @@ class SupportgroupsModelSupport_groups extends JModelList
// set values to display correctly.
if (SupportgroupsHelper::checkArray($items))
{
+ // get user object.
+ $user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
+ $access = ($user->authorise('support_group.access', 'com_supportgroups.support_group.' . (int) $item->id) && $user->authorise('support_group.access', 'com_supportgroups'));
+ if (!$access)
+ {
+ unset($items[$nr]);
+ continue;
+ }
+
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
@@ -282,7 +346,12 @@ class SupportgroupsModelSupport_groups extends JModelList
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');
- $id .= ':' . $this->getState('filter.name');
+ $id .= ':' . $this->getState('filter.name');
+ $id .= ':' . $this->getState('filter.phone');
+ $id .= ':' . $this->getState('filter.location');
+ $id .= ':' . $this->getState('filter.clinic');
+ $id .= ':' . $this->getState('filter.male');
+ $id .= ':' . $this->getState('filter.female');
return parent::getStoreId($id);
}
diff --git a/admin/models/supportgroups.php b/admin/models/supportgroups.php
index 8737ed0..60a23e1 100644
--- a/admin/models/supportgroups.php
+++ b/admin/models/supportgroups.php
@@ -43,29 +43,52 @@ class SupportgroupsModelSupportgroups extends JModelList
$icons = array();
// view groups array
$viewGroups = array(
- 'main' => array('png.support_group.add', 'png.support_groups', 'png.location.add', 'png.locations', 'png.region.add', 'png.regions', 'png.currencies', 'png.countries')
+ 'main' => array('png.support_group.add', 'png.support_groups', 'png.payment.add', 'png.payments', 'png.clinics', 'png.locations', 'png.regions', 'png.countries', 'png.currencies', 'png.help_documents')
);
// view access array
$viewAccess = array(
+ 'support_group.create' => 'support_group.create',
+ 'support_groups.access' => 'support_group.access',
+ 'support_group.access' => 'support_group.access',
'support_groups.submenu' => 'support_group.submenu',
'support_groups.dashboard_list' => 'support_group.dashboard_list',
'support_group.dashboard_add' => 'support_group.dashboard_add',
+ 'payment.create' => 'payment.create',
+ 'payments.access' => 'payment.access',
+ 'payment.access' => 'payment.access',
+ 'payments.submenu' => 'payment.submenu',
+ 'payments.dashboard_list' => 'payment.dashboard_list',
+ 'payment.dashboard_add' => 'payment.dashboard_add',
+ 'clinic.create' => 'clinic.create',
+ 'clinics.access' => 'clinic.access',
+ 'clinic.access' => 'clinic.access',
+ 'clinics.submenu' => 'clinic.submenu',
+ 'clinics.dashboard_list' => 'clinic.dashboard_list',
+ 'location.create' => 'location.create',
+ 'locations.access' => 'location.access',
+ 'location.access' => 'location.access',
'locations.submenu' => 'location.submenu',
'locations.dashboard_list' => 'location.dashboard_list',
- 'location.dashboard_add' => 'location.dashboard_add',
+ 'region.create' => 'region.create',
+ 'regions.access' => 'region.access',
+ 'region.access' => 'region.access',
'regions.submenu' => 'region.submenu',
'regions.dashboard_list' => 'region.dashboard_list',
- 'region.dashboard_add' => 'region.dashboard_add',
+ 'country.create' => 'country.create',
+ 'countries.access' => 'country.access',
+ 'country.access' => 'country.access',
+ 'countries.submenu' => 'country.submenu',
+ 'countries.dashboard_list' => 'country.dashboard_list',
'currency.create' => 'currency.create',
'currencies.access' => 'currency.access',
'currency.access' => 'currency.access',
'currencies.submenu' => 'currency.submenu',
'currencies.dashboard_list' => 'currency.dashboard_list',
- 'country.create' => 'country.create',
- 'countries.access' => 'country.access',
- 'country.access' => 'country.access',
- 'countries.submenu' => 'country.submenu',
- 'countries.dashboard_list' => 'country.dashboard_list');
+ 'help_document.create' => 'help_document.create',
+ 'help_documents.access' => 'help_document.access',
+ 'help_document.access' => 'help_document.access',
+ 'help_documents.submenu' => 'help_document.submenu',
+ 'help_documents.dashboard_list' => 'help_document.dashboard_list');
foreach($viewGroups as $group => $views)
{
$i = 0;
diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql
index c061d5c..02aee11 100644
--- a/admin/sql/install.mysql.utf8.sql
+++ b/admin/sql/install.mysql.utf8.sql
@@ -1,7 +1,83 @@
CREATE TABLE IF NOT EXISTS `#__supportgroups_support_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0',
+ `area` TEXT NOT NULL DEFAULT '',
+ `clinic` INT(11) NOT NULL DEFAULT '0',
+ `female` INT(11) NOT NULL DEFAULT '0',
+ `female_art` INT(11) NOT NULL DEFAULT '0',
+ `female_children` INT(11) NOT NULL DEFAULT '0',
+ `location` INT(11) NOT NULL DEFAULT '0',
+ `male` INT(11) NOT NULL DEFAULT '0',
+ `male_art` INT(11) NOT NULL DEFAULT '0',
+ `male_children` INT(11) NOT NULL DEFAULT '0',
`name` VARCHAR(255) NOT NULL DEFAULT '',
+ `phone` VARCHAR(64) NOT NULL DEFAULT '',
+ `params` TEXT NOT NULL DEFAULT '',
+ `published` tinyint(1) NOT NULL DEFAULT '1',
+ `created_by` int(11) NOT NULL DEFAULT '0',
+ `modified_by` int(11) NOT NULL DEFAULT '0',
+ `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `checked_out` int(11) NOT NULL,
+ `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `version` int(11) NOT NULL DEFAULT '1',
+ `hits` int(11) NOT NULL DEFAULT '0',
+ `access` int(11) DEFAULT NULL,
+ `ordering` int(11) NOT NULL DEFAULT '0',
+ `metakey` TEXT NOT NULL DEFAULT '',
+ `metadesc` TEXT NOT NULL DEFAULT '',
+ `metadata` TEXT NOT NULL DEFAULT '',
+ PRIMARY KEY (`id`),
+ KEY `idx_access` (`access`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_modifiedby` (`modified_by`),
+ KEY `idx_state` (`published`),
+ KEY `idx_name` (`name`),
+ KEY `idx_location` (`location`),
+ KEY `idx_clinic` (`clinic`),
+ KEY `idx_male` (`male`),
+ KEY `idx_female` (`female`),
+ KEY `idx_female_art` (`female_art`),
+ KEY `idx_male_art` (`male_art`),
+ KEY `idx_female_children` (`female_children`),
+ KEY `idx_male_children` (`male_children`)
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS `#__supportgroups_payment` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0',
+ `amount` VARCHAR(100) NOT NULL DEFAULT '0',
+ `support_group` INT(11) NOT NULL DEFAULT '0',
+ `year` INT(11) NOT NULL DEFAULT '0',
+ `params` TEXT NOT NULL DEFAULT '',
+ `published` tinyint(1) NOT NULL DEFAULT '1',
+ `created_by` int(11) NOT NULL DEFAULT '0',
+ `modified_by` int(11) NOT NULL DEFAULT '0',
+ `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `checked_out` int(11) NOT NULL,
+ `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `version` int(11) NOT NULL DEFAULT '1',
+ `hits` int(11) NOT NULL DEFAULT '0',
+ `access` int(11) DEFAULT NULL,
+ `ordering` int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (`id`),
+ KEY `idx_access` (`access`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_modifiedby` (`modified_by`),
+ KEY `idx_state` (`published`),
+ KEY `idx_support_group` (`support_group`),
+ KEY `idx_year` (`year`)
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS `#__supportgroups_clinic` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0',
+ `area` TEXT NOT NULL DEFAULT '',
+ `name` VARCHAR(255) NOT NULL DEFAULT '',
+ `phone` VARCHAR(64) NOT NULL DEFAULT '',
`params` TEXT NOT NULL DEFAULT '',
`published` tinyint(1) NOT NULL DEFAULT '1',
`created_by` int(11) NOT NULL DEFAULT '0',
@@ -87,6 +163,44 @@ CREATE TABLE IF NOT EXISTS `#__supportgroups_region` (
KEY `idx_country` (`country`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
+CREATE TABLE IF NOT EXISTS `#__supportgroups_country` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0',
+ `alias` CHAR(64) NOT NULL DEFAULT '',
+ `codethree` CHAR(7) NOT NULL DEFAULT '',
+ `codetwo` CHAR(7) NOT NULL DEFAULT '',
+ `currency` CHAR(7) NOT NULL DEFAULT '',
+ `name` VARCHAR(255) NOT NULL DEFAULT '',
+ `worldzone` VARCHAR(255) NOT NULL DEFAULT '',
+ `params` TEXT NOT NULL DEFAULT '',
+ `published` tinyint(1) NOT NULL DEFAULT '1',
+ `created_by` int(11) NOT NULL DEFAULT '0',
+ `modified_by` int(11) NOT NULL DEFAULT '0',
+ `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `checked_out` int(11) NOT NULL,
+ `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `version` int(11) NOT NULL DEFAULT '1',
+ `hits` int(11) NOT NULL DEFAULT '0',
+ `access` int(11) DEFAULT NULL,
+ `ordering` int(11) NOT NULL DEFAULT '0',
+ `metakey` TEXT NOT NULL DEFAULT '',
+ `metadesc` TEXT NOT NULL DEFAULT '',
+ `metadata` TEXT NOT NULL DEFAULT '',
+ PRIMARY KEY (`id`),
+ KEY `idx_access` (`access`),
+ KEY `idx_checkout` (`checked_out`),
+ KEY `idx_createdby` (`created_by`),
+ KEY `idx_modifiedby` (`modified_by`),
+ KEY `idx_state` (`published`),
+ KEY `idx_name` (`name`),
+ KEY `idx_currency` (`currency`),
+ KEY `idx_worldzone` (`worldzone`),
+ KEY `idx_codethree` (`codethree`),
+ KEY `idx_codetwo` (`codetwo`),
+ KEY `idx_alias` (`alias`)
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
+
CREATE TABLE IF NOT EXISTS `#__supportgroups_currency` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0',
@@ -127,15 +241,21 @@ CREATE TABLE IF NOT EXISTS `#__supportgroups_currency` (
KEY `idx_alias` (`alias`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
-CREATE TABLE IF NOT EXISTS `#__supportgroups_country` (
+CREATE TABLE IF NOT EXISTS `#__supportgroups_help_document` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0',
+ `admin_view` CHAR(255) NOT NULL DEFAULT '',
`alias` CHAR(64) NOT NULL DEFAULT '',
- `codethree` CHAR(7) NOT NULL DEFAULT '',
- `codetwo` CHAR(7) NOT NULL DEFAULT '',
- `currency` CHAR(7) NOT NULL DEFAULT '',
- `name` VARCHAR(255) NOT NULL DEFAULT '',
- `worldzone` VARCHAR(255) NOT NULL DEFAULT '',
+ `article` TINYINT(1) NOT NULL DEFAULT '0',
+ `content` TEXT NOT NULL DEFAULT '',
+ `groups` TEXT NOT NULL DEFAULT '',
+ `location` TINYINT(1) NOT NULL DEFAULT '0',
+ `not_required` INT(1) NOT NULL DEFAULT '0',
+ `site_view` CHAR(255) NOT NULL DEFAULT '',
+ `target` TINYINT(1) NOT NULL DEFAULT '0',
+ `title` CHAR(64) NOT NULL DEFAULT '',
+ `type` TINYINT(1) NOT NULL DEFAULT '0',
+ `url` VARCHAR(255) NOT NULL DEFAULT '',
`params` TEXT NOT NULL DEFAULT '',
`published` tinyint(1) NOT NULL DEFAULT '1',
`created_by` int(11) NOT NULL DEFAULT '0',
@@ -148,195 +268,22 @@ CREATE TABLE IF NOT EXISTS `#__supportgroups_country` (
`hits` int(11) NOT NULL DEFAULT '0',
`access` int(11) DEFAULT NULL,
`ordering` int(11) NOT NULL DEFAULT '0',
- `metakey` TEXT NOT NULL DEFAULT '',
- `metadesc` TEXT NOT NULL DEFAULT '',
- `metadata` TEXT NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `idx_access` (`access`),
KEY `idx_checkout` (`checked_out`),
KEY `idx_createdby` (`created_by`),
KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`),
- KEY `idx_name` (`name`),
- KEY `idx_currency` (`currency`),
- KEY `idx_worldzone` (`worldzone`),
- KEY `idx_codethree` (`codethree`),
- KEY `idx_codetwo` (`codetwo`),
- KEY `idx_alias` (`alias`)
+ KEY `idx_title` (`title`),
+ KEY `idx_type` (`type`),
+ KEY `idx_location` (`location`),
+ KEY `idx_target` (`target`),
+ KEY `idx_alias` (`alias`),
+ KEY `idx_article` (`article`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
---
--- Dumping data for table `#__supportgroups_currency`
---
-
-INSERT INTO `#__supportgroups_currency` (`id`, `alias`, `codethree`, `decimalplace`, `decimalsymbol`, `name`, `negativestyle`, `numericcode`, `positivestyle`, `symbol`, `thousands`, `params`, `published`, `created_by`, `modified_by`, `created`, `modified`, `checked_out`, `checked_out_time`, `version`, `hits`, `access`, `ordering`) VALUES
-(1, '', 'AED', 2, ',', 'United Arab Emirates dirham', '{sign}{number} {symbol}', 784, '{number} {symbol}', 'د.إ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 23),
-(2, '', 'AFN', 2, ',', 'Afghan afghani', '{sign}{number} {symbol}', 971, '{number} {symbol}', '؋', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 24),
-(3, '', 'ALL', 2, ',', 'Albanian lek', '{sign}{number} {symbol}', 8, '{number} {symbol}', 'Lek', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 25),
-(4, '', 'AMD', 2, ',', 'Armenian dram', '{sign}{number} {symbol}', 51, '{number} {symbol}', 'դր.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 26),
-(5, '', 'ANG', 2, ',', 'Netherlands Antillean gulden', '{sign}{number} {symbol}', 532, '{number} {symbol}', 'ƒ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 27),
-(6, '', 'AOA', 2, ',', 'Angolan kwanza', '{sign}{number} {symbol}', 973, '{number} {symbol}', 'Kz', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 28),
-(7, '', 'ARS', 2, ',', 'Argentine peso', '{sign}{number} {symbol}', 32, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 29),
-(8, '', 'AUD', 2, '.', 'Australian dollar', '{sign}{symbol} {number}', 36, '{symbol} {number}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 5),
-(9, '', 'AWG', 2, ',', 'Aruban florin', '{sign}{number} {symbol}', 533, '{number} {symbol}', 'ƒ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 30),
-(10, '', 'AZN', 2, ',', 'Azerbaijani manat', '{sign}{number} {symbol}', 934, '{number} {symbol}', 'ман', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 31),
-(11, '', 'BAM', 2, ',', 'Bosnia and Herzegovina convert', '{sign}{number} {symbol}', 977, '{number} {symbol}', 'KM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 32),
-(12, '', 'BBD', 2, ',', 'Barbadian dollar', '{sign}{number} {symbol}', 52, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 33),
-(13, '', 'BDT', 2, ',', 'Bangladeshi taka', '{sign}{number} {symbol}', 50, '{number} {symbol}', '৳', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 34),
-(14, '', 'BGN', 2, ',', 'Bulgarian lev', '{sign}{number} {symbol}', 975, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 35),
-(15, '', 'BHD', 2, ',', 'Bahraini dinar', '{sign}{number} {symbol}', 48, '{number} {symbol}', 'ب.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 36),
-(16, '', 'BIF', '', '', 'Burundian franc', '{sign}{number} {symbol}', 108, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 37),
-(17, '', 'BMD', 2, ',', 'Bermudian dollar', '{sign}{number} {symbol}', 60, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 38),
-(18, '', 'BND', 2, ',', 'Brunei dollar', '{sign}{number} {symbol}', 96, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 39),
-(19, '', 'BOB', 2, ',', 'Bolivian boliviano', '{sign}{number} {symbol}', 68, '{number} {symbol}', '$b', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 40),
-(20, '', 'BOV', 2, ',', 'Mvdol', '{sign}{number} {symbol}', 984, '{number} {symbol}', 'BOV', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 41),
-(21, '', 'BRL', 2, '.', 'Brazilian real', '{symbol} {sign}{number}', 986, '{symbol} {number}', 'R$', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 17),
-(22, '', 'BSD', 2, ',', 'Bahamian dollar', '{sign}{number} {symbol}', 44, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 42),
-(23, '', 'BTN', 2, ',', 'Bhutanese ngultrum', '{sign}{number} {symbol}', 64, '{number} {symbol}', 'BTN', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 43),
-(24, '', 'BWP', 2, ',', 'Botswana pula', '{sign}{number} {symbol}', 72, '{number} {symbol}', 'P', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 44),
-(25, '', 'BYR', '', '', 'Belarusian ruble', '{sign}{number} {symbol}', 974, '{number} {symbol}', 'p.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 45),
-(26, '', 'BZD', 2, ',', 'Belize dollar', '{sign}{number} {symbol}', 84, '{number} {symbol}', 'BZ$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 46),
-(27, '', 'CAD', 2, '.', 'Canadian dollar', '{symbol}{sign}{number}', 124, '{symbol}{number}', '$', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 7),
-(28, '', 'CDF', 2, ',', 'Congolese franc', '{sign}{number} {symbol}', 976, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 47),
-(29, '', 'CHE', 2, ',', 'WIR Euro', '{sign}{number} {symbol}', 947, '{number} {symbol}', '€', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 48),
-(30, '', 'CHF', 2, ',', 'Swiss franc', '{sign}{number} {symbol}', 756, '{number} {symbol}', 'CHF', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 6),
-(31, '', 'CHW', 2, ',', 'WIR Franc', '{sign}{number} {symbol}', 948, '{number} {symbol}', 'CHW', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 49),
-(32, '', 'CLF', '', ',', 'Unidad de Fomento', '{sign}{number} {symbol}', 990, '{number} {symbol}', 'CLF', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 50),
-(33, '', 'CLP', 2, ',', 'Chilean peso', '{sign}{number} {symbol}', 152, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 51),
-(34, '', 'CNY', 2, ',', 'Chinese renminbi yuan', '{sign}{number} {symbol}', 156, '{number} {symbol}', '元', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 9),
-(35, '', 'COP', 2, ',', 'Colombian peso', '{sign}{number} {symbol}', 170, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 52),
-(36, '', 'COU', 2, ',', 'Unidad de Valor Real', '{sign}{number} {symbol}', 970, '{number} {symbol}', 'COU', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 53),
-(37, '', 'CRC', 2, ',', 'Costa Rican colón', '{sign}{number} {symbol}', 188, '{number} {symbol}', '₡', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 54),
-(38, '', 'CZK', 2, ',', 'Czech koruna', '{sign}{number} {symbol}', 203, '{number} {symbol}', 'Kč', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 57),
-(39, '', 'CUP', 2, ',', 'Cuban peso', '{sign}{number} {symbol}', 192, '{number} {symbol}', '₱', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 55),
-(40, '', 'CVE', '', '', 'Cape Verdean escudo', '{sign}{number} {symbol}', 132, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 56),
-(41, '', 'DJF', '', '', 'Djiboutian franc', '{sign}{number} {symbol}', 262, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 58),
-(42, '', 'DKK', 2, '.', 'Danish krone', '{symbol}{sign}{number}', 208, '{symbol}{number}', 'kr', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 19),
-(43, '', 'DOP', 2, ',', 'Dominican peso', '{sign}{number} {symbol}', 214, '{number} {symbol}', 'RD$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 59),
-(44, '', 'DZD', 2, ',', 'Algerian dinar', '{sign}{number} {symbol}', 12, '{number} {symbol}', 'د.ج', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 60),
-(45, '', 'EGP', 2, ',', 'Egyptian pound', '{sign}{number} {symbol}', 818, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 61),
-(46, '', 'ERN', 2, ',', 'Eritrean nakfa', '{sign}{number} {symbol}', 232, '{number} {symbol}', 'Nfk', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 62),
-(47, '', 'ETB', 2, ',', 'Ethiopian birr', '{sign}{number} {symbol}', 230, '{number} {symbol}', 'ETB', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 63),
-(48, '', 'EUR', 2, ',', 'Euro', '{sign}{number} {symbol}', 978, '{number} {symbol}', '€', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 2),
-(49, '', 'FJD', 2, ',', 'Fijian dollar', '{sign}{number} {symbol}', 242, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 64),
-(50, '', 'FKP', 2, ',', 'Falkland pound', '{sign}{number} {symbol}', 238, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 65),
-(51, '', 'GBP', 2, '.', 'British pound', '{symbol}{sign}{number}', 826, '{symbol}{number}', '£', ',', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 4),
-(52, '', 'GEL', 2, ',', 'Georgian lari', '{sign}{number} {symbol}', 981, '{number} {symbol}', 'ლ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 66),
-(53, '', 'GHS', 2, ',', 'Ghanaian cedi', '{sign}{number} {symbol}', 936, '{number} {symbol}', '₵', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 67),
-(54, '', 'GIP', 2, ',', 'Gibraltar pound', '{sign}{number} {symbol}', 292, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 68),
-(55, '', 'GMD', 2, ',', 'Gambian dalasi', '{sign}{number} {symbol}', 270, '{number} {symbol}', 'D', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 69),
-(56, '', 'GNF', '', '', 'Guinean franc', '{sign}{number} {symbol}', 324, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 70),
-(57, '', 'GTQ', 2, ',', 'Guatemalan quetzal', '{sign}{number} {symbol}', 320, '{number} {symbol}', 'Q', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 71),
-(58, '', 'GYD', 2, ',', 'Guyanese dollar', '{sign}{number} {symbol}', 328, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 72),
-(59, '', 'HKD', 2, ',', 'Hong Kong dollar', '{sign}{number} {symbol}', 344, '{number} {symbol}', '元', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 13),
-(60, '', 'HNL', 2, ',', 'Honduran lempira', '{sign}{number} {symbol}', 340, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 73),
-(61, '', 'HRK', 2, ',', 'Croatian kuna', '{sign}{number} {symbol}', 191, '{number} {symbol}', 'kn', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 74),
-(62, '', 'HTG', 2, ',', 'Haitian gourde', '{sign}{number} {symbol}', 332, '{number} {symbol}', 'G', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 75),
-(63, '', 'HUF', 2, ',', 'Hungarian forint', '{sign}{number} {symbol}', 348, '{number} {symbol}', 'Ft', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 76),
-(64, '', 'IDR', '', '', 'Indonesian rupiah', '{symbol}{sign}{number}', 360, '{symbol}{number}', 'Rp', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 77),
-(65, '', 'ILS', 2, ',', 'Israeli new sheqel', '{sign}{number} {symbol}', 376, '{number} {symbol}', '₪', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 20),
-(66, '', 'INR', 2, ',', 'Indian rupee', '{sign}{number} {symbol}', 356, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 16),
-(67, '', 'IQD', '', '', 'Iraqi dinar', '{sign}{number} {symbol}', 368, '{number} {symbol}', 'ع.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 78),
-(68, '', 'IRR', 2, ',', 'Iranian rial', '{sign}{number}{symb0l}', 364, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 79),
-(69, '', 'ISK', 2, ',', 'Icelandic króna', '{sign}{number} {symbol}', 352, '{number} {symbol}', 'kr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 80),
-(70, '', 'JMD', 2, ',', 'Jamaican dollar', '{sign}{number} {symbol}', 388, '{number} {symbol}', 'J$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 81),
-(71, '', 'JOD', 2, ',', 'Jordanian dinar', '{sign}{number} {symbol}', 400, '{number} {symbol}', 'د.ا', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 82),
-(72, '', 'JPY', 2, ',', 'Japanese yen', '{sign}{number} {symbol}', 392, '{number} {symbol}', '¥', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 3),
-(73, '', 'KES', 2, ',', 'Kenyan shilling', '{sign}{number} {symbol}', 404, '{number} {symbol}', 'Sh', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 83),
-(74, '', 'KGS', 2, ',', 'Kyrgyzstani som', '{sign}{number} {symbol}', 417, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 84),
-(75, '', 'KHR', 2, ',', 'Cambodian riel', '{sign}{number} {symbol}', 116, '{number} {symbol}', '៛', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 85),
-(76, '', 'KMF', '', '', 'Comorian franc', '{sign}{number} {symbol}', 174, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 86),
-(77, '', 'KPW', '', '', 'North Korean won', '{sign}{number} {symbol}', 408, '{number} {symbol}', '₩', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 87),
-(78, '', 'KRW', '', '', 'South Korean won', '{sign}{number} {symbol}', 410, '{number} {symbol}', '₩', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 21),
-(79, '', 'KWD', 2, ',', 'Kuwaiti dinar', '{sign}{number} {symbol}', 414, '{number} {symbol}', 'د.ك', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 88),
-(80, '', 'KYD', 2, ',', 'Cayman Islands dollar', '{sign}{number} {symbol}', 136, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 89),
-(81, '', 'KZT', 2, ',', 'Kazakhstani tenge', '{sign}{number} {symbol}', 398, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 90),
-(82, '', 'LAK', '', '', 'Lao kip', '{sign}{number} {symbol}', 418, '{number} {symbol}', '₭', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 91),
-(83, '', 'LBP', '', '', 'Lebanese pound', '{sign}{number} {symbol}', 422, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 92),
-(84, '', 'LKR', 2, ',', 'Sri Lankan rupee', '{sign}{number} {symbol}', 144, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 93),
-(85, '', 'LRD', 2, ',', 'Liberian dollar', '{sign}{number} {symbol}', 430, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 94),
-(86, '', 'LSL', 2, ',', 'Lesotho loti', '{sign}{number} {symbol}', 426, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 95),
-(87, '', 'LTL', 2, ',', 'Lithuanian litas', '{sign}{number} {symbol}', 440, '{number} {symbol}', 'Lt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 96),
-(88, '', 'LVL', 2, ',', 'Latvian lats', '{sign}{number} {symbol}', 428, '{number} {symbol}', 'Ls', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 97),
-(89, '', 'LYD', 3, ',', 'Libyan dinar', '{sign}{number} {symbol}', 434, '{number} {symbol}', 'ل.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 98),
-(90, '', 'MAD', 2, ',', 'Moroccan dirham', '{sign}{number} {symbol}', 504, '{number} {symbol}', 'د.م.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 99),
-(91, '', 'MDL', 2, ',', 'Moldovan leu', '{sign}{number} {symbol}', 498, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 100),
-(92, '', 'MGA', 2, ',', 'Malagasy ariary', '{sign}{number} {symbol}', 969, '{number} {symbol}', 'MGA', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 101),
-(93, '', 'MKD', 2, ',', 'Macedonian denar', '{sign}{number} {symbol}', 807, '{number} {symbol}', 'ден', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 102),
-(94, '', 'MMK', 2, ',', 'Myanmar kyat', '{symbol} {sign}{number}', 104, '{number} {symbol}', 'K', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 103),
-(95, '', 'MNT', 2, ',', 'Mongolian tögrög', '{sign}{number} {symbol}', 496, '{number} {symbol}', '₮', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 104),
-(96, '', 'MOP', 1, ',', 'Macanese pataca', '{symbol}{sign}{number}', 446, '{symbol}{number}', 'P', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 105),
-(97, '', 'MRO', 2, ',', 'Mauritanian ouguiya', '{sign}{number} {symbol}', 478, '{number} {symbol}', 'UM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 106),
-(98, '', 'MUR', 2, ',', 'Mauritian rupee', '{sign}{number} {symbol}', 480, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 107),
-(99, '', 'MVR', 2, ',', 'Maldivian rufiyaa', '{sign}{number} {symbol}', 462, '{number} {symbol}', 'ރ.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 108),
-(100, '', 'MWK', 2, ',', 'Malawian kwacha', '{sign}{number} {symbol}', 454, '{number} {symbol}', 'MK', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 109),
-(101, '', 'MXN', 2, ',', 'Mexican peso', '{sign}{number} {symbol}', 484, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 8),
-(102, '', 'MXV', 2, ',', 'Mexican Unid', '{sign}{number} {symbol}', 979, '{number} {symbol}', 'MXV', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 110),
-(103, '', 'MYR', 2, ',', 'Malaysian ringgit', '{sign}{number} {symbol}', 458, '{number} {symbol}', 'RM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 111),
-(104, '', 'MZN', 2, ',', 'Mozambican metical', '{sign}{number} {symbol}', 943, '{number} {symbol}', 'MT', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 112),
-(105, '', 'NAD', 2, ',', 'Namibian dollar', '{symbol} {sign}{number}', 516, '{symbol} {number}', 'N$', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 113),
-(106, '', 'NGN', 2, ',', 'Nigerian naira', '{sign}{number} {symbol}', 566, '{number} {symbol}', '₦', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 114),
-(107, '', 'NIO', 2, ',', 'Nicaraguan córdoba', '{sign}{number} {symbol}', 558, '{number} {symbol}', 'C$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 115),
-(108, '', 'NOK', 2, ',', 'Norwegian krone', '{symbol}{sign}{number}', 578, '{symbol}{number}', 'kr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 18),
-(109, '', 'NPR', 2, ',', 'Nepalese rupee', '{sign}{number} {symbol}', 524, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 116),
-(110, '', 'NZD', 2, ',', 'New Zealand dollar', '{symbol}{sign}{number}', 554, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 10),
-(111, '', 'OMR', 3, '.', 'Omani rial', '{sign}{number} {symbol}', 512, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 117),
-(112, '', 'PAB', 2, ',', 'Panamanian balboa', '{sign}{number} {symbol}', 590, '{number} {symbol}', 'B/.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 118),
-(113, '', 'PEN', 2, ',', 'Peruvian nuevo sol', '{sign}{number} {symbol}', 604, '{number} {symbol}', 'S/.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 119),
-(114, '', 'PGK', 2, ',', 'Papua New Guinean kina', '{sign}{number} {symbol}', 598, '{number} {symbol}', 'K', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 120),
-(115, '', 'PHP', 2, ',', 'Philippine peso', '{sign}{number} {symbol}', 608, '{number} {symbol}', '₱', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 121),
-(116, '', 'PKR', 2, ',', 'Pakistani rupee', '{sign}{number} {symbol}', 586, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 122),
-(117, '', 'PLN', 2, ',', 'Polish Złoty', '{sign}{number} {symbol}', 985, '{number} {symbol}', 'zł', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 123),
-(118, '', 'PYG', '', '', 'Paraguayan guaraní', '{symbol} {sign}{number}', 600, '{symbol} {number}', '₲', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 124),
-(119, '', 'QAR', 2, ',', 'Qatari riyal', '{sign}{number} {symbol}', 634, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 125),
-(120, '', 'RON', 2, ',', 'Romanian leu', '{sign}{number} {symbol}', 946, '{number} {symbol}', 'lei', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 126),
-(121, '', 'RWF', 2, ',', 'Rwandan franc', '{sign}{number} {symbol}', 646, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 128),
-(122, '', 'SAR', 2, ',', 'Saudi riyal', '{sign}{number} {symbol}', 682, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 129),
-(123, '', 'SBD', 2, ',', 'Solomon Islands dollar', '{sign}{number} {symbol}', 90, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 130),
-(124, '', 'SCR', 2, ',', 'Seychellois rupee', '{sign}{number} {symbol}', 690, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 131),
-(125, '', 'SDG', 2, ',', 'Sudanese pound', '{sign}{number} {symbol}', 938, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 132),
-(126, '', 'SEK', 2, ',', 'Swedish krona', '{sign}{number} {symbol}', 752, '{number} {symbol}', 'kr', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 11),
-(127, '', 'SGD', 2, ',', 'Singapore dollar', '{sign}{number} {symbol}', 702, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 14),
-(128, '', 'SHP', 2, ',', 'Saint Helenian pound', '{sign}{number} {symbol}', 654, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 133),
-(129, '', 'SLL', 2, ',', 'Sierra Leonean leone', '{sign}{number} {symbol}', 694, '{number} {symbol}', 'Le', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 134),
-(130, '', 'SOS', 2, ',', 'Somali shilling', '{sign}{number} {symbol}', 706, '{number} {symbol}', 'S', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 135),
-(131, '', 'SRD', 2, ',', 'Surinamese dollar', '{sign}{number} {symbol}', 968, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 136),
-(132, '', 'STD', '', '', 'São Tomé and Príncipe dobra', '{sign}{number} {symbol}', 678, '{number} {symbol}', 'Db', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 137),
-(133, '', 'RUB', 2, ',', 'Russian ruble', '{sign}{number} {symbol}', 643, '{number} {symbol}', 'руб', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 12),
-(134, '', 'SVC', 2, ',', 'Salvadoran colón', '{sign}{number} {symbol}', 222, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 138),
-(135, '', 'SYP', 2, ',', 'Syrian pound', '{sign}{number} {symbol}', 760, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 139),
-(136, '', 'SZL', 2, ',', 'Swazi lilangeni', '{sign}{number} {symbol}', 748, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 140),
-(137, '', 'THB', 2, ',', 'Thai baht', '{sign}{number} {symbol}', 764, '{number} {symbol}', '฿', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 141),
-(138, '', 'TJS', 2, ',', 'Tajikistani somoni', '{sign}{number} {symbol}', 972, '{number} {symbol}', 'ЅМ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 142),
-(139, '', 'TND', 3, ',', 'Tunisian dinar', '{sign}{number} {symbol}', 788, '{number} {symbol}', 'د.ت', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 143),
-(140, '', 'TOP', 2, ',', 'Tongan paʻanga', '{sign}{number} {symbol}', 776, '{number} {symbol}', 'T$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 144),
-(141, '', 'TRY', 2, ',', 'Turkish new lira', '{sign}{number} {symbol}', 949, '{number} {symbol}', 'YTL', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 15),
-(142, '', 'TTD', 2, ',', 'Trinidad and Tobago dollar', '{sign}{number} {symbol}', 780, '{number} {symbol}', 'TT$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 145),
-(143, '', 'TWD', 2, ',', 'New Taiwan dollar', '{sign}{number} {symbol}', 901, '{number} {symbol}', 'NT$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 146),
-(144, '', 'TZS', 2, ',', 'Tanzanian shilling', '{sign}{number} {symbol}', 834, '{number} {symbol}', 'Sh', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 147),
-(145, '', 'UAH', 2, ',', 'Ukrainian hryvnia', '{sign}{number} {symbol}', 980, '{number} {symbol}', '₴', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 148),
-(146, '', 'UGX', 2, ',', 'Ugandan shilling', '{sign}{number} {symbol}', 800, '{number} {symbol}', 'Sh', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 149),
-(147, '', 'USD', 2, '.', 'United States dollar', '{symbol}{sign}{number}', 840, '{symbol}{number}', '$', ',', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 1),
-(148, '', 'UYI', 2, ',', 'Uruguay Peso', '{sign}{number} {symbol}', 940, '{number} {symbol}', 'UYI', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 150),
-(149, '', 'UYU', '', '', 'Uruguayan peso', '{symbol}{sign}{number}', 858, '{symbol} {number}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 151),
-(150, '', 'UZS', 2, ',', 'Uzbekistani som', '{sign}{number} {symbol}', 860, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 152),
-(151, '', 'VEF', 2, ',', 'Venezuelan bolívar', '{sign}{number} {symbol}', 937, '{number} {symbol}', 'Bs', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 153),
-(152, '', 'VND', '', '', 'Vietnamese Dong', '{sign}{number} {symbol}', 704, '{number} {symbol}', '₫', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 154),
-(153, '', 'VUV', 2, ',', 'Vanuatu vatu', '{sign}{number} {symbol}', 548, '{number} {symbol}', 'Vt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 155),
-(154, '', 'WST', 2, ',', 'Samoan tala', '{sign}{number} {symbol}', 882, '{number} {symbol}', 'T', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 156),
-(155, '', 'XAF', '', '', 'Central African CFA franc', '{sign}{number} {symbol}', 950, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 157),
-(156, '', 'XCD', 2, ',', 'East Caribbean dollar', '{sign}{number} {symbol}', 951, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 158),
-(157, '', 'XOF', 2, ',', 'West African CFA franc', '{sign}{number} {symbol}', 952, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 159),
-(158, '', 'XPF', 2, ',', 'CFP franc', '{sign}{number} {symbol}', 953, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 160),
-(159, '', 'YER', 2, ',', 'Yemeni rial', '{sign}{number} {symbol}', 886, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 161),
-(160, '', 'RSD', 2, ',', 'Serbian dinar', '{sign}{number} {symbol}', 941, '{number} {symbol}', 'Дин.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 127),
-(161, 'south-african-rand', 'ZAR', 2, ',', 'South African rand', '{symbol} {sign}{number}', 710, '{symbol} {number}', 'R', '', '', 1, '', 845, '0000-00-00 00:00:00', '2015-08-30 22:07:36', '', '0000-00-00 00:00:00', 2, '', 5, 22),
-(162, '', 'ZMK', 2, ',', 'Zambian kwacha', '{sign}{number} {symbol}', 894, '{number} {symbol}', 'ZK', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 162),
-(163, '', 'ZWD', 2, ',', 'Zimbabwean dollar', '{sign}{number} {symbol}', 932, '{number} {symbol}', 'Z$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 163),
-(164, '', 'ZZZ', 2, ',', 'Reserved', '', '', '', 'O', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 164);
-
--
-- Dumping data for table `#__supportgroups_country`
--
@@ -587,4 +534,174 @@ INSERT INTO `#__supportgroups_country` (`id`, `asset_id`, `alias`, `codethree`,
(243, '', '', 'SRB', 'RS', 'SRB', 'Serbia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''),
(244, '', '', 'MAF', 'MF', 'EUR', 'Sint Maarten (French Antilles)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''),
(245, '', '', 'SXM', 'SX', 'ANG', 'Sint Maarten (Netherlands Antilles)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''),
-(246, '', '', 'ZZZ', 'ZZ', 'ZZZ', 'Reserved', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '');
\ No newline at end of file
+(246, '', '', 'ZZZ', 'ZZ', 'ZZZ', 'Reserved', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '');
+
+--
+-- Dumping data for table `#__supportgroups_currency`
+--
+
+INSERT INTO `#__supportgroups_currency` (`id`, `alias`, `codethree`, `decimalplace`, `decimalsymbol`, `name`, `negativestyle`, `numericcode`, `positivestyle`, `symbol`, `thousands`, `params`, `published`, `created_by`, `modified_by`, `created`, `modified`, `checked_out`, `checked_out_time`, `version`, `hits`, `access`, `ordering`) VALUES
+(1, '', 'AED', 2, ',', 'United Arab Emirates dirham', '{sign}{number} {symbol}', 784, '{number} {symbol}', 'د.إ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 23),
+(2, '', 'AFN', 2, ',', 'Afghan afghani', '{sign}{number} {symbol}', 971, '{number} {symbol}', '؋', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 24),
+(3, '', 'ALL', 2, ',', 'Albanian lek', '{sign}{number} {symbol}', 8, '{number} {symbol}', 'Lek', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 25),
+(4, '', 'AMD', 2, ',', 'Armenian dram', '{sign}{number} {symbol}', 51, '{number} {symbol}', 'դր.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 26),
+(5, '', 'ANG', 2, ',', 'Netherlands Antillean gulden', '{sign}{number} {symbol}', 532, '{number} {symbol}', 'ƒ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 27),
+(6, '', 'AOA', 2, ',', 'Angolan kwanza', '{sign}{number} {symbol}', 973, '{number} {symbol}', 'Kz', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 28),
+(7, '', 'ARS', 2, ',', 'Argentine peso', '{sign}{number} {symbol}', 32, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 29),
+(8, '', 'AUD', 2, '.', 'Australian dollar', '{sign}{symbol} {number}', 36, '{symbol} {number}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 5),
+(9, '', 'AWG', 2, ',', 'Aruban florin', '{sign}{number} {symbol}', 533, '{number} {symbol}', 'ƒ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 30),
+(10, '', 'AZN', 2, ',', 'Azerbaijani manat', '{sign}{number} {symbol}', 934, '{number} {symbol}', 'ман', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 31),
+(11, '', 'BAM', 2, ',', 'Bosnia and Herzegovina convert', '{sign}{number} {symbol}', 977, '{number} {symbol}', 'KM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 32),
+(12, '', 'BBD', 2, ',', 'Barbadian dollar', '{sign}{number} {symbol}', 52, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 33),
+(13, '', 'BDT', 2, ',', 'Bangladeshi taka', '{sign}{number} {symbol}', 50, '{number} {symbol}', '৳', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 34),
+(14, '', 'BGN', 2, ',', 'Bulgarian lev', '{sign}{number} {symbol}', 975, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 35),
+(15, '', 'BHD', 2, ',', 'Bahraini dinar', '{sign}{number} {symbol}', 48, '{number} {symbol}', 'ب.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 36),
+(16, '', 'BIF', '', '', 'Burundian franc', '{sign}{number} {symbol}', 108, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 37),
+(17, '', 'BMD', 2, ',', 'Bermudian dollar', '{sign}{number} {symbol}', 60, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 38),
+(18, '', 'BND', 2, ',', 'Brunei dollar', '{sign}{number} {symbol}', 96, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 39),
+(19, '', 'BOB', 2, ',', 'Bolivian boliviano', '{sign}{number} {symbol}', 68, '{number} {symbol}', '$b', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 40),
+(20, '', 'BOV', 2, ',', 'Mvdol', '{sign}{number} {symbol}', 984, '{number} {symbol}', 'BOV', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 41),
+(21, '', 'BRL', 2, '.', 'Brazilian real', '{symbol} {sign}{number}', 986, '{symbol} {number}', 'R$', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 17),
+(22, '', 'BSD', 2, ',', 'Bahamian dollar', '{sign}{number} {symbol}', 44, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 42),
+(23, '', 'BTN', 2, ',', 'Bhutanese ngultrum', '{sign}{number} {symbol}', 64, '{number} {symbol}', 'BTN', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 43),
+(24, '', 'BWP', 2, ',', 'Botswana pula', '{sign}{number} {symbol}', 72, '{number} {symbol}', 'P', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 44),
+(25, '', 'BYR', '', '', 'Belarusian ruble', '{sign}{number} {symbol}', 974, '{number} {symbol}', 'p.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 45),
+(26, '', 'BZD', 2, ',', 'Belize dollar', '{sign}{number} {symbol}', 84, '{number} {symbol}', 'BZ$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 46),
+(27, '', 'CAD', 2, '.', 'Canadian dollar', '{symbol}{sign}{number}', 124, '{symbol}{number}', '$', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 7),
+(28, '', 'CDF', 2, ',', 'Congolese franc', '{sign}{number} {symbol}', 976, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 47),
+(29, '', 'CHE', 2, ',', 'WIR Euro', '{sign}{number} {symbol}', 947, '{number} {symbol}', '€', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 48),
+(30, '', 'CHF', 2, ',', 'Swiss franc', '{sign}{number} {symbol}', 756, '{number} {symbol}', 'CHF', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 6),
+(31, '', 'CHW', 2, ',', 'WIR Franc', '{sign}{number} {symbol}', 948, '{number} {symbol}', 'CHW', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 49),
+(32, '', 'CLF', '', ',', 'Unidad de Fomento', '{sign}{number} {symbol}', 990, '{number} {symbol}', 'CLF', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 50),
+(33, '', 'CLP', 2, ',', 'Chilean peso', '{sign}{number} {symbol}', 152, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 51),
+(34, '', 'CNY', 2, ',', 'Chinese renminbi yuan', '{sign}{number} {symbol}', 156, '{number} {symbol}', '元', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 9),
+(35, '', 'COP', 2, ',', 'Colombian peso', '{sign}{number} {symbol}', 170, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 52),
+(36, '', 'COU', 2, ',', 'Unidad de Valor Real', '{sign}{number} {symbol}', 970, '{number} {symbol}', 'COU', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 53),
+(37, '', 'CRC', 2, ',', 'Costa Rican colón', '{sign}{number} {symbol}', 188, '{number} {symbol}', '₡', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 54),
+(38, '', 'CZK', 2, ',', 'Czech koruna', '{sign}{number} {symbol}', 203, '{number} {symbol}', 'Kč', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 57),
+(39, '', 'CUP', 2, ',', 'Cuban peso', '{sign}{number} {symbol}', 192, '{number} {symbol}', '₱', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 55),
+(40, '', 'CVE', '', '', 'Cape Verdean escudo', '{sign}{number} {symbol}', 132, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 56),
+(41, '', 'DJF', '', '', 'Djiboutian franc', '{sign}{number} {symbol}', 262, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 58),
+(42, '', 'DKK', 2, '.', 'Danish krone', '{symbol}{sign}{number}', 208, '{symbol}{number}', 'kr', ',', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 19),
+(43, '', 'DOP', 2, ',', 'Dominican peso', '{sign}{number} {symbol}', 214, '{number} {symbol}', 'RD$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 59),
+(44, '', 'DZD', 2, ',', 'Algerian dinar', '{sign}{number} {symbol}', 12, '{number} {symbol}', 'د.ج', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 60),
+(45, '', 'EGP', 2, ',', 'Egyptian pound', '{sign}{number} {symbol}', 818, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 61),
+(46, '', 'ERN', 2, ',', 'Eritrean nakfa', '{sign}{number} {symbol}', 232, '{number} {symbol}', 'Nfk', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 62),
+(47, '', 'ETB', 2, ',', 'Ethiopian birr', '{sign}{number} {symbol}', 230, '{number} {symbol}', 'ETB', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 63),
+(48, '', 'EUR', 2, ',', 'Euro', '{sign}{number} {symbol}', 978, '{number} {symbol}', '€', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 2),
+(49, '', 'FJD', 2, ',', 'Fijian dollar', '{sign}{number} {symbol}', 242, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 64),
+(50, '', 'FKP', 2, ',', 'Falkland pound', '{sign}{number} {symbol}', 238, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 65),
+(51, '', 'GBP', 2, '.', 'British pound', '{symbol}{sign}{number}', 826, '{symbol}{number}', '£', ',', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 4),
+(52, '', 'GEL', 2, ',', 'Georgian lari', '{sign}{number} {symbol}', 981, '{number} {symbol}', 'ლ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 66),
+(53, '', 'GHS', 2, ',', 'Ghanaian cedi', '{sign}{number} {symbol}', 936, '{number} {symbol}', '₵', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 67),
+(54, '', 'GIP', 2, ',', 'Gibraltar pound', '{sign}{number} {symbol}', 292, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 68),
+(55, '', 'GMD', 2, ',', 'Gambian dalasi', '{sign}{number} {symbol}', 270, '{number} {symbol}', 'D', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 69),
+(56, '', 'GNF', '', '', 'Guinean franc', '{sign}{number} {symbol}', 324, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 70),
+(57, '', 'GTQ', 2, ',', 'Guatemalan quetzal', '{sign}{number} {symbol}', 320, '{number} {symbol}', 'Q', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 71),
+(58, '', 'GYD', 2, ',', 'Guyanese dollar', '{sign}{number} {symbol}', 328, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 72),
+(59, '', 'HKD', 2, ',', 'Hong Kong dollar', '{sign}{number} {symbol}', 344, '{number} {symbol}', '元', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 13),
+(60, '', 'HNL', 2, ',', 'Honduran lempira', '{sign}{number} {symbol}', 340, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 73),
+(61, '', 'HRK', 2, ',', 'Croatian kuna', '{sign}{number} {symbol}', 191, '{number} {symbol}', 'kn', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 74),
+(62, '', 'HTG', 2, ',', 'Haitian gourde', '{sign}{number} {symbol}', 332, '{number} {symbol}', 'G', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 75),
+(63, '', 'HUF', 2, ',', 'Hungarian forint', '{sign}{number} {symbol}', 348, '{number} {symbol}', 'Ft', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 76),
+(64, '', 'IDR', '', '', 'Indonesian rupiah', '{symbol}{sign}{number}', 360, '{symbol}{number}', 'Rp', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 77),
+(65, '', 'ILS', 2, ',', 'Israeli new sheqel', '{sign}{number} {symbol}', 376, '{number} {symbol}', '₪', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 20),
+(66, '', 'INR', 2, ',', 'Indian rupee', '{sign}{number} {symbol}', 356, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 16),
+(67, '', 'IQD', '', '', 'Iraqi dinar', '{sign}{number} {symbol}', 368, '{number} {symbol}', 'ع.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 78),
+(68, '', 'IRR', 2, ',', 'Iranian rial', '{sign}{number}{symb0l}', 364, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 79),
+(69, '', 'ISK', 2, ',', 'Icelandic króna', '{sign}{number} {symbol}', 352, '{number} {symbol}', 'kr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 80),
+(70, '', 'JMD', 2, ',', 'Jamaican dollar', '{sign}{number} {symbol}', 388, '{number} {symbol}', 'J$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 81),
+(71, '', 'JOD', 2, ',', 'Jordanian dinar', '{sign}{number} {symbol}', 400, '{number} {symbol}', 'د.ا', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 82),
+(72, '', 'JPY', 2, ',', 'Japanese yen', '{sign}{number} {symbol}', 392, '{number} {symbol}', '¥', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 3),
+(73, '', 'KES', 2, ',', 'Kenyan shilling', '{sign}{number} {symbol}', 404, '{number} {symbol}', 'Sh', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 83),
+(74, '', 'KGS', 2, ',', 'Kyrgyzstani som', '{sign}{number} {symbol}', 417, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 84),
+(75, '', 'KHR', 2, ',', 'Cambodian riel', '{sign}{number} {symbol}', 116, '{number} {symbol}', '៛', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 85),
+(76, '', 'KMF', '', '', 'Comorian franc', '{sign}{number} {symbol}', 174, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 86),
+(77, '', 'KPW', '', '', 'North Korean won', '{sign}{number} {symbol}', 408, '{number} {symbol}', '₩', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 87),
+(78, '', 'KRW', '', '', 'South Korean won', '{sign}{number} {symbol}', 410, '{number} {symbol}', '₩', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 21),
+(79, '', 'KWD', 2, ',', 'Kuwaiti dinar', '{sign}{number} {symbol}', 414, '{number} {symbol}', 'د.ك', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 88),
+(80, '', 'KYD', 2, ',', 'Cayman Islands dollar', '{sign}{number} {symbol}', 136, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 89),
+(81, '', 'KZT', 2, ',', 'Kazakhstani tenge', '{sign}{number} {symbol}', 398, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 90),
+(82, '', 'LAK', '', '', 'Lao kip', '{sign}{number} {symbol}', 418, '{number} {symbol}', '₭', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 91),
+(83, '', 'LBP', '', '', 'Lebanese pound', '{sign}{number} {symbol}', 422, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 92),
+(84, '', 'LKR', 2, ',', 'Sri Lankan rupee', '{sign}{number} {symbol}', 144, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 93),
+(85, '', 'LRD', 2, ',', 'Liberian dollar', '{sign}{number} {symbol}', 430, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 94),
+(86, '', 'LSL', 2, ',', 'Lesotho loti', '{sign}{number} {symbol}', 426, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 95),
+(87, '', 'LTL', 2, ',', 'Lithuanian litas', '{sign}{number} {symbol}', 440, '{number} {symbol}', 'Lt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 96),
+(88, '', 'LVL', 2, ',', 'Latvian lats', '{sign}{number} {symbol}', 428, '{number} {symbol}', 'Ls', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 97),
+(89, '', 'LYD', 3, ',', 'Libyan dinar', '{sign}{number} {symbol}', 434, '{number} {symbol}', 'ل.د', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 98),
+(90, '', 'MAD', 2, ',', 'Moroccan dirham', '{sign}{number} {symbol}', 504, '{number} {symbol}', 'د.م.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 99),
+(91, '', 'MDL', 2, ',', 'Moldovan leu', '{sign}{number} {symbol}', 498, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 100),
+(92, '', 'MGA', 2, ',', 'Malagasy ariary', '{sign}{number} {symbol}', 969, '{number} {symbol}', 'MGA', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 101),
+(93, '', 'MKD', 2, ',', 'Macedonian denar', '{sign}{number} {symbol}', 807, '{number} {symbol}', 'ден', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 102),
+(94, '', 'MMK', 2, ',', 'Myanmar kyat', '{symbol} {sign}{number}', 104, '{number} {symbol}', 'K', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 103),
+(95, '', 'MNT', 2, ',', 'Mongolian tögrög', '{sign}{number} {symbol}', 496, '{number} {symbol}', '₮', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 104),
+(96, '', 'MOP', 1, ',', 'Macanese pataca', '{symbol}{sign}{number}', 446, '{symbol}{number}', 'P', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 105),
+(97, '', 'MRO', 2, ',', 'Mauritanian ouguiya', '{sign}{number} {symbol}', 478, '{number} {symbol}', 'UM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 106),
+(98, '', 'MUR', 2, ',', 'Mauritian rupee', '{sign}{number} {symbol}', 480, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 107),
+(99, '', 'MVR', 2, ',', 'Maldivian rufiyaa', '{sign}{number} {symbol}', 462, '{number} {symbol}', 'ރ.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 108),
+(100, '', 'MWK', 2, ',', 'Malawian kwacha', '{sign}{number} {symbol}', 454, '{number} {symbol}', 'MK', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 109),
+(101, '', 'MXN', 2, ',', 'Mexican peso', '{sign}{number} {symbol}', 484, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 8),
+(102, '', 'MXV', 2, ',', 'Mexican Unid', '{sign}{number} {symbol}', 979, '{number} {symbol}', 'MXV', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 110),
+(103, '', 'MYR', 2, ',', 'Malaysian ringgit', '{sign}{number} {symbol}', 458, '{number} {symbol}', 'RM', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 111),
+(104, '', 'MZN', 2, ',', 'Mozambican metical', '{sign}{number} {symbol}', 943, '{number} {symbol}', 'MT', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 112),
+(105, '', 'NAD', 2, ',', 'Namibian dollar', '{symbol} {sign}{number}', 516, '{symbol} {number}', 'N$', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 113),
+(106, '', 'NGN', 2, ',', 'Nigerian naira', '{sign}{number} {symbol}', 566, '{number} {symbol}', '₦', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 114),
+(107, '', 'NIO', 2, ',', 'Nicaraguan córdoba', '{sign}{number} {symbol}', 558, '{number} {symbol}', 'C$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 115),
+(108, '', 'NOK', 2, ',', 'Norwegian krone', '{symbol}{sign}{number}', 578, '{symbol}{number}', 'kr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 18),
+(109, '', 'NPR', 2, ',', 'Nepalese rupee', '{sign}{number} {symbol}', 524, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 116),
+(110, '', 'NZD', 2, ',', 'New Zealand dollar', '{symbol}{sign}{number}', 554, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 10),
+(111, '', 'OMR', 3, '.', 'Omani rial', '{sign}{number} {symbol}', 512, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 117),
+(112, '', 'PAB', 2, ',', 'Panamanian balboa', '{sign}{number} {symbol}', 590, '{number} {symbol}', 'B/.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 118),
+(113, '', 'PEN', 2, ',', 'Peruvian nuevo sol', '{sign}{number} {symbol}', 604, '{number} {symbol}', 'S/.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 119),
+(114, '', 'PGK', 2, ',', 'Papua New Guinean kina', '{sign}{number} {symbol}', 598, '{number} {symbol}', 'K', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 120),
+(115, '', 'PHP', 2, ',', 'Philippine peso', '{sign}{number} {symbol}', 608, '{number} {symbol}', '₱', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 121),
+(116, '', 'PKR', 2, ',', 'Pakistani rupee', '{sign}{number} {symbol}', 586, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 122),
+(117, '', 'PLN', 2, ',', 'Polish Złoty', '{sign}{number} {symbol}', 985, '{number} {symbol}', 'zł', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 123),
+(118, '', 'PYG', '', '', 'Paraguayan guaraní', '{symbol} {sign}{number}', 600, '{symbol} {number}', '₲', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 124),
+(119, '', 'QAR', 2, ',', 'Qatari riyal', '{sign}{number} {symbol}', 634, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 125),
+(120, '', 'RON', 2, ',', 'Romanian leu', '{sign}{number} {symbol}', 946, '{number} {symbol}', 'lei', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 126),
+(121, '', 'RWF', 2, ',', 'Rwandan franc', '{sign}{number} {symbol}', 646, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 128),
+(122, '', 'SAR', 2, ',', 'Saudi riyal', '{sign}{number} {symbol}', 682, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 129),
+(123, '', 'SBD', 2, ',', 'Solomon Islands dollar', '{sign}{number} {symbol}', 90, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 130),
+(124, '', 'SCR', 2, ',', 'Seychellois rupee', '{sign}{number} {symbol}', 690, '{number} {symbol}', '₨', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 131),
+(125, '', 'SDG', 2, ',', 'Sudanese pound', '{sign}{number} {symbol}', 938, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 132),
+(126, '', 'SEK', 2, ',', 'Swedish krona', '{sign}{number} {symbol}', 752, '{number} {symbol}', 'kr', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 11),
+(127, '', 'SGD', 2, ',', 'Singapore dollar', '{sign}{number} {symbol}', 702, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 14),
+(128, '', 'SHP', 2, ',', 'Saint Helenian pound', '{sign}{number} {symbol}', 654, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 133),
+(129, '', 'SLL', 2, ',', 'Sierra Leonean leone', '{sign}{number} {symbol}', 694, '{number} {symbol}', 'Le', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 134),
+(130, '', 'SOS', 2, ',', 'Somali shilling', '{sign}{number} {symbol}', 706, '{number} {symbol}', 'S', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 135),
+(131, '', 'SRD', 2, ',', 'Surinamese dollar', '{sign}{number} {symbol}', 968, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 136),
+(132, '', 'STD', '', '', 'São Tomé and Príncipe dobra', '{sign}{number} {symbol}', 678, '{number} {symbol}', 'Db', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 137),
+(133, '', 'RUB', 2, ',', 'Russian ruble', '{sign}{number} {symbol}', 643, '{number} {symbol}', 'руб', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 12),
+(134, '', 'SVC', 2, ',', 'Salvadoran colón', '{sign}{number} {symbol}', 222, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 138),
+(135, '', 'SYP', 2, ',', 'Syrian pound', '{sign}{number} {symbol}', 760, '{number} {symbol}', '£', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 139),
+(136, '', 'SZL', 2, ',', 'Swazi lilangeni', '{sign}{number} {symbol}', 748, '{number} {symbol}', 'L', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 140),
+(137, '', 'THB', 2, ',', 'Thai baht', '{sign}{number} {symbol}', 764, '{number} {symbol}', '฿', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 141),
+(138, '', 'TJS', 2, ',', 'Tajikistani somoni', '{sign}{number} {symbol}', 972, '{number} {symbol}', 'ЅМ', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 142),
+(139, '', 'TND', 3, ',', 'Tunisian dinar', '{sign}{number} {symbol}', 788, '{number} {symbol}', 'د.ت', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 143),
+(140, '', 'TOP', 2, ',', 'Tongan paʻanga', '{sign}{number} {symbol}', 776, '{number} {symbol}', 'T$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 144),
+(141, '', 'TRY', 2, ',', 'Turkish new lira', '{sign}{number} {symbol}', 949, '{number} {symbol}', 'YTL', '.', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 15),
+(142, '', 'TTD', 2, ',', 'Trinidad and Tobago dollar', '{sign}{number} {symbol}', 780, '{number} {symbol}', 'TT$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 145),
+(143, '', 'TWD', 2, ',', 'New Taiwan dollar', '{sign}{number} {symbol}', 901, '{number} {symbol}', 'NT$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 146),
+(144, '', 'TZS', 2, ',', 'Tanzanian shilling', '{sign}{number} {symbol}', 834, '{number} {symbol}', 'Sh', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 147),
+(145, '', 'UAH', 2, ',', 'Ukrainian hryvnia', '{sign}{number} {symbol}', 980, '{number} {symbol}', '₴', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 148),
+(146, '', 'UGX', 2, ',', 'Ugandan shilling', '{sign}{number} {symbol}', 800, '{number} {symbol}', 'Sh', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 149),
+(147, '', 'USD', 2, '.', 'United States dollar', '{symbol}{sign}{number}', 840, '{symbol}{number}', '$', ',', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 1),
+(148, '', 'UYI', 2, ',', 'Uruguay Peso', '{sign}{number} {symbol}', 940, '{number} {symbol}', 'UYI', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 150),
+(149, '', 'UYU', '', '', 'Uruguayan peso', '{symbol}{sign}{number}', 858, '{symbol} {number}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 151),
+(150, '', 'UZS', 2, ',', 'Uzbekistani som', '{sign}{number} {symbol}', 860, '{number} {symbol}', 'лв', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 152),
+(151, '', 'VEF', 2, ',', 'Venezuelan bolívar', '{sign}{number} {symbol}', 937, '{number} {symbol}', 'Bs', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 153),
+(152, '', 'VND', '', '', 'Vietnamese Dong', '{sign}{number} {symbol}', 704, '{number} {symbol}', '₫', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 154),
+(153, '', 'VUV', 2, ',', 'Vanuatu vatu', '{sign}{number} {symbol}', 548, '{number} {symbol}', 'Vt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 155),
+(154, '', 'WST', 2, ',', 'Samoan tala', '{sign}{number} {symbol}', 882, '{number} {symbol}', 'T', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 156),
+(155, '', 'XAF', '', '', 'Central African CFA franc', '{sign}{number} {symbol}', 950, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 157),
+(156, '', 'XCD', 2, ',', 'East Caribbean dollar', '{sign}{number} {symbol}', 951, '{number} {symbol}', '$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 158),
+(157, '', 'XOF', 2, ',', 'West African CFA franc', '{sign}{number} {symbol}', 952, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 159),
+(158, '', 'XPF', 2, ',', 'CFP franc', '{sign}{number} {symbol}', 953, '{number} {symbol}', 'Fr', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 160),
+(159, '', 'YER', 2, ',', 'Yemeni rial', '{sign}{number} {symbol}', 886, '{number} {symbol}', '﷼', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 161),
+(160, '', 'RSD', 2, ',', 'Serbian dinar', '{sign}{number} {symbol}', 941, '{number} {symbol}', 'Дин.', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 127),
+(161, 'south-african-rand', 'ZAR', 2, ',', 'South African rand', '{symbol} {sign}{number}', 710, '{symbol} {number}', 'R', '', '', 1, '', 845, '0000-00-00 00:00:00', '2015-08-30 22:07:36', '', '0000-00-00 00:00:00', 2, '', 5, 22),
+(162, '', 'ZMK', 2, ',', 'Zambian kwacha', '{sign}{number} {symbol}', 894, '{number} {symbol}', 'ZK', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 162),
+(163, '', 'ZWD', 2, ',', 'Zimbabwean dollar', '{sign}{number} {symbol}', 932, '{number} {symbol}', 'Z$', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 163),
+(164, '', 'ZZZ', 2, ',', 'Reserved', '', '', '', 'O', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', '', 164);
\ No newline at end of file
diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql
index cb295c5..0c2aa88 100644
--- a/admin/sql/uninstall.mysql.utf8.sql
+++ b/admin/sql/uninstall.mysql.utf8.sql
@@ -1,5 +1,8 @@
DROP TABLE IF EXISTS `#__supportgroups_support_group`;
+DROP TABLE IF EXISTS `#__supportgroups_payment`;
+DROP TABLE IF EXISTS `#__supportgroups_clinic`;
DROP TABLE IF EXISTS `#__supportgroups_location`;
DROP TABLE IF EXISTS `#__supportgroups_region`;
-DROP TABLE IF EXISTS `#__supportgroups_currency`;
DROP TABLE IF EXISTS `#__supportgroups_country`;
+DROP TABLE IF EXISTS `#__supportgroups_currency`;
+DROP TABLE IF EXISTS `#__supportgroups_help_document`;
diff --git a/admin/tables/clinic.php b/admin/tables/clinic.php
new file mode 100644
index 0000000..2729e62
--- /dev/null
+++ b/admin/tables/clinic.php
@@ -0,0 +1,351 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+use Joomla\Registry\Registry;
+
+// import Joomla table library
+jimport('joomla.database.table');
+
+/**
+ * Clinics Table class
+ */
+class SupportgroupsTableClinic extends JTable
+{
+ /**
+ * Ensure the params and metadata in json encoded in the bind method
+ *
+ * @var array
+ * @since 3.3
+ */
+ protected $_jsonEncode = array('params', 'metadata');
+
+ /**
+ * Constructor
+ *
+ * @param object Database connector object
+ */
+ function __construct(&$db)
+ {
+ parent::__construct('#__supportgroups_clinic', 'id', $db);
+
+ // Adding History Options
+ JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_supportgroups.clinic'));
+ }
+
+ public function bind($array, $ignore = '')
+ {
+
+ if (isset($array['params']) && is_array($array['params']))
+ {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = (string) $registry;
+ }
+
+ if (isset($array['metadata']) && is_array($array['metadata']))
+ {
+ $registry = new JRegistry;
+ $registry->loadArray($array['metadata']);
+ $array['metadata'] = (string) $registry;
+ }
+
+ // Bind the rules.
+ if (isset($array['rules']) && is_array($array['rules']))
+ {
+ $rules = new JAccessRules($array['rules']);
+ $this->setRules($rules);
+ }
+ return parent::bind($array, $ignore);
+ }
+
+ /**
+ * Overload the store method for the Clinic table.
+ *
+ * @param boolean Toggle whether null values should be updated.
+ * @return boolean True on success, false on failure.
+ * @since 1.6
+ */
+ public function store($updateNulls = false)
+ {
+ $date = JFactory::getDate();
+ $user = JFactory::getUser();
+
+ if ($this->id)
+ {
+ // Existing item
+ $this->modified = $date->toSql();
+ $this->modified_by = $user->get('id');
+ }
+ else
+ {
+ // New clinic. A clinic created and created_by field can be set by the user,
+ // so we don't touch either of these if they are set.
+ if (!(int) $this->created)
+ {
+ $this->created = $date->toSql();
+ }
+ if (empty($this->created_by))
+ {
+ $this->created_by = $user->get('id');
+ }
+ }
+
+ if (isset($this->alias))
+ {
+ // Verify that the alias is unique
+ $table = JTable::getInstance('clinic', 'SupportgroupsTable');
+
+ if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
+ {
+ $this->setError(JText::_('COM_SUPPORTGROUPS_CLINIC_ERROR_UNIQUE_ALIAS'));
+ return false;
+ }
+ }
+
+ if (isset($this->url))
+ {
+ // Convert IDN urls to punycode
+ $this->url = JStringPunycode::urlToPunycode($this->url);
+ }
+ if (isset($this->website))
+ {
+ // Convert IDN urls to punycode
+ $this->website = JStringPunycode::urlToPunycode($this->website);
+ }
+
+ return parent::store($updateNulls);
+ }
+
+ /**
+ * Overloaded check method to ensure data integrity.
+ *
+ * @return boolean True on success.
+ */
+ public function check()
+ {
+ if (isset($this->alias))
+ {
+ // Generate a valid alias
+ $this->generateAlias();
+
+ $table = JTable::getInstance('clinic', 'supportgroupsTable');
+
+ while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
+ {
+ $this->alias = JString::increment($this->alias, 'dash');
+ }
+ }
+
+ /*
+ * Clean up keywords -- eliminate extra spaces between phrases
+ * and cr (\r) and lf (\n) characters from string.
+ * Only process if not empty.
+ */
+ if (!empty($this->metakey))
+ {
+ // Array of characters to remove.
+ $bad_characters = array("\n", "\r", "\"", "<", ">");
+
+ // Remove bad characters.
+ $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
+
+ // Create array using commas as delimiter.
+ $keys = explode(',', $after_clean);
+ $clean_keys = array();
+
+ foreach ($keys as $key)
+ {
+ // Ignore blank keywords.
+ if (trim($key))
+ {
+ $clean_keys[] = trim($key);
+ }
+ }
+
+ // Put array back together delimited by ", "
+ $this->metakey = implode(", ", $clean_keys);
+ }
+
+ // Clean up description -- eliminate quotes and <> brackets
+ if (!empty($this->metadesc))
+ {
+ // Only process if not empty
+ $bad_characters = array("\"", "<", ">");
+ $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
+ }
+
+ // If we don't have any access rules set at this point just use an empty JAccessRules class
+ if (!$this->getRules())
+ {
+ $rules = $this->getDefaultAssetValues('com_supportgroups.clinic.'.$this->id);
+ $this->setRules($rules);
+ }
+
+ // Set ordering
+ if ($this->published < 0)
+ {
+ // Set ordering to 0 if state is archived or trashed
+ $this->ordering = 0;
+ }
+
+ return true;
+ }
+
+ /**
+ * Gets the default asset values for a component.
+ *
+ * @param $string $component The component asset name to search for
+ *
+ * @return JAccessRules The JAccessRules object for the asset
+ */
+ protected function getDefaultAssetValues($component, $try = true)
+ {
+ // Need to find the asset id by the name of the component.
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select($db->quoteName('id'))
+ ->from($db->quoteName('#__assets'))
+ ->where($db->quoteName('name') . ' = ' . $db->quote($component));
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->loadRowList())
+ {
+ // asset alread set so use saved rules
+ $assetId = (int) $db->loadResult();
+ return JAccess::getAssetRules($assetId);
+ }
+ // try again
+ elseif ($try)
+ {
+ $try = explode('.',$component);
+ $result = $this->getDefaultAssetValues($try[0], false);
+ if ($result instanceof JAccessRules)
+ {
+ if (isset($try[1]))
+ {
+ $_result = (string) $result;
+ $_result = json_decode($_result);
+ foreach ($_result as $name => &$rule)
+ {
+ $v = explode('.', $name);
+ if ($try[1] !== $v[0])
+ {
+ // remove since it is not part of this view
+ unset($_result->$name);
+ }
+ else
+ {
+ // clear the value since we inherit
+ $rule = array();
+ }
+ }
+ // check if there are any view values remaining
+ if (count($_result))
+ {
+ $_result = json_encode($_result);
+ $_result = array($_result);
+ // Instantiate and return the JAccessRules object for the asset rules.
+ $rules = new JAccessRules;
+ $rules->mergeCollection($_result);
+
+ return $rules;
+ }
+ }
+ return $result;
+ }
+ }
+ return JAccess::getAssetRules(0);
+ }
+
+ /**
+ * Method to compute the default name of the asset.
+ * The default name is in the form 'table_name.id'
+ * where id is the value of the primary key of the table.
+ *
+ * @return string
+ * @since 2.5
+ */
+ protected function _getAssetName()
+ {
+ $k = $this->_tbl_key;
+ return 'com_supportgroups.clinic.'.(int) $this->$k;
+ }
+
+ /**
+ * Method to return the title to use for the asset table.
+ *
+ * @return string
+ * @since 2.5
+ */
+ protected function _getAssetTitle()
+ {
+ if (isset($this->title))
+ {
+ return $this->title;
+ }
+ return '';
+ }
+
+ /**
+ * Get the parent asset id for the record
+ *
+ * @return int
+ * @since 2.5
+ */
+ protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
+ {
+ $asset = JTable::getInstance('Asset');
+ $asset->loadByName('com_supportgroups');
+
+ return $asset->id;
+ }
+
+ /**
+ * Generate a valid alias from title / date.
+ * Remains public to be able to check for duplicated alias before saving
+ *
+ * @return string
+ */
+ public function generateAlias()
+ {
+ if (empty($this->alias))
+ {
+ $this->alias = $this->name;
+ }
+
+ $this->alias = JApplication::stringURLSafe($this->alias);
+
+ if (trim(str_replace('-', '', $this->alias)) == '')
+ {
+ $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
+ }
+
+ return $this->alias;
+ }
+
+}
diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php
new file mode 100644
index 0000000..648353d
--- /dev/null
+++ b/admin/tables/help_document.php
@@ -0,0 +1,351 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+use Joomla\Registry\Registry;
+
+// import Joomla table library
+jimport('joomla.database.table');
+
+/**
+ * Help_documents Table class
+ */
+class SupportgroupsTableHelp_document extends JTable
+{
+ /**
+ * Ensure the params and metadata in json encoded in the bind method
+ *
+ * @var array
+ * @since 3.3
+ */
+ protected $_jsonEncode = array('params', 'metadata');
+
+ /**
+ * Constructor
+ *
+ * @param object Database connector object
+ */
+ function __construct(&$db)
+ {
+ parent::__construct('#__supportgroups_help_document', 'id', $db);
+
+ // Adding History Options
+ JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_supportgroups.help_document'));
+ }
+
+ public function bind($array, $ignore = '')
+ {
+
+ if (isset($array['params']) && is_array($array['params']))
+ {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = (string) $registry;
+ }
+
+ if (isset($array['metadata']) && is_array($array['metadata']))
+ {
+ $registry = new JRegistry;
+ $registry->loadArray($array['metadata']);
+ $array['metadata'] = (string) $registry;
+ }
+
+ // Bind the rules.
+ if (isset($array['rules']) && is_array($array['rules']))
+ {
+ $rules = new JAccessRules($array['rules']);
+ $this->setRules($rules);
+ }
+ return parent::bind($array, $ignore);
+ }
+
+ /**
+ * Overload the store method for the Help_document table.
+ *
+ * @param boolean Toggle whether null values should be updated.
+ * @return boolean True on success, false on failure.
+ * @since 1.6
+ */
+ public function store($updateNulls = false)
+ {
+ $date = JFactory::getDate();
+ $user = JFactory::getUser();
+
+ if ($this->id)
+ {
+ // Existing item
+ $this->modified = $date->toSql();
+ $this->modified_by = $user->get('id');
+ }
+ else
+ {
+ // New help_document. A help_document created and created_by field can be set by the user,
+ // so we don't touch either of these if they are set.
+ if (!(int) $this->created)
+ {
+ $this->created = $date->toSql();
+ }
+ if (empty($this->created_by))
+ {
+ $this->created_by = $user->get('id');
+ }
+ }
+
+ if (isset($this->alias))
+ {
+ // Verify that the alias is unique
+ $table = JTable::getInstance('help_document', 'SupportgroupsTable');
+
+ if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
+ {
+ $this->setError(JText::_('COM_SUPPORTGROUPS_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS'));
+ return false;
+ }
+ }
+
+ if (isset($this->url))
+ {
+ // Convert IDN urls to punycode
+ $this->url = JStringPunycode::urlToPunycode($this->url);
+ }
+ if (isset($this->website))
+ {
+ // Convert IDN urls to punycode
+ $this->website = JStringPunycode::urlToPunycode($this->website);
+ }
+
+ return parent::store($updateNulls);
+ }
+
+ /**
+ * Overloaded check method to ensure data integrity.
+ *
+ * @return boolean True on success.
+ */
+ public function check()
+ {
+ if (isset($this->alias))
+ {
+ // Generate a valid alias
+ $this->generateAlias();
+
+ $table = JTable::getInstance('help_document', 'supportgroupsTable');
+
+ while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
+ {
+ $this->alias = JString::increment($this->alias, 'dash');
+ }
+ }
+
+ /*
+ * Clean up keywords -- eliminate extra spaces between phrases
+ * and cr (\r) and lf (\n) characters from string.
+ * Only process if not empty.
+ */
+ if (!empty($this->metakey))
+ {
+ // Array of characters to remove.
+ $bad_characters = array("\n", "\r", "\"", "<", ">");
+
+ // Remove bad characters.
+ $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
+
+ // Create array using commas as delimiter.
+ $keys = explode(',', $after_clean);
+ $clean_keys = array();
+
+ foreach ($keys as $key)
+ {
+ // Ignore blank keywords.
+ if (trim($key))
+ {
+ $clean_keys[] = trim($key);
+ }
+ }
+
+ // Put array back together delimited by ", "
+ $this->metakey = implode(", ", $clean_keys);
+ }
+
+ // Clean up description -- eliminate quotes and <> brackets
+ if (!empty($this->metadesc))
+ {
+ // Only process if not empty
+ $bad_characters = array("\"", "<", ">");
+ $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
+ }
+
+ // If we don't have any access rules set at this point just use an empty JAccessRules class
+ if (!$this->getRules())
+ {
+ $rules = $this->getDefaultAssetValues('com_supportgroups.help_document.'.$this->id);
+ $this->setRules($rules);
+ }
+
+ // Set ordering
+ if ($this->published < 0)
+ {
+ // Set ordering to 0 if state is archived or trashed
+ $this->ordering = 0;
+ }
+
+ return true;
+ }
+
+ /**
+ * Gets the default asset values for a component.
+ *
+ * @param $string $component The component asset name to search for
+ *
+ * @return JAccessRules The JAccessRules object for the asset
+ */
+ protected function getDefaultAssetValues($component, $try = true)
+ {
+ // Need to find the asset id by the name of the component.
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select($db->quoteName('id'))
+ ->from($db->quoteName('#__assets'))
+ ->where($db->quoteName('name') . ' = ' . $db->quote($component));
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->loadRowList())
+ {
+ // asset alread set so use saved rules
+ $assetId = (int) $db->loadResult();
+ return JAccess::getAssetRules($assetId);
+ }
+ // try again
+ elseif ($try)
+ {
+ $try = explode('.',$component);
+ $result = $this->getDefaultAssetValues($try[0], false);
+ if ($result instanceof JAccessRules)
+ {
+ if (isset($try[1]))
+ {
+ $_result = (string) $result;
+ $_result = json_decode($_result);
+ foreach ($_result as $name => &$rule)
+ {
+ $v = explode('.', $name);
+ if ($try[1] !== $v[0])
+ {
+ // remove since it is not part of this view
+ unset($_result->$name);
+ }
+ else
+ {
+ // clear the value since we inherit
+ $rule = array();
+ }
+ }
+ // check if there are any view values remaining
+ if (count($_result))
+ {
+ $_result = json_encode($_result);
+ $_result = array($_result);
+ // Instantiate and return the JAccessRules object for the asset rules.
+ $rules = new JAccessRules;
+ $rules->mergeCollection($_result);
+
+ return $rules;
+ }
+ }
+ return $result;
+ }
+ }
+ return JAccess::getAssetRules(0);
+ }
+
+ /**
+ * Method to compute the default name of the asset.
+ * The default name is in the form 'table_name.id'
+ * where id is the value of the primary key of the table.
+ *
+ * @return string
+ * @since 2.5
+ */
+ protected function _getAssetName()
+ {
+ $k = $this->_tbl_key;
+ return 'com_supportgroups.help_document.'.(int) $this->$k;
+ }
+
+ /**
+ * Method to return the title to use for the asset table.
+ *
+ * @return string
+ * @since 2.5
+ */
+ protected function _getAssetTitle()
+ {
+ if (isset($this->title))
+ {
+ return $this->title;
+ }
+ return '';
+ }
+
+ /**
+ * Get the parent asset id for the record
+ *
+ * @return int
+ * @since 2.5
+ */
+ protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
+ {
+ $asset = JTable::getInstance('Asset');
+ $asset->loadByName('com_supportgroups');
+
+ return $asset->id;
+ }
+
+ /**
+ * Generate a valid alias from title / date.
+ * Remains public to be able to check for duplicated alias before saving
+ *
+ * @return string
+ */
+ public function generateAlias()
+ {
+ if (empty($this->alias))
+ {
+ $this->alias = $this->name;
+ }
+
+ $this->alias = JApplication::stringURLSafe($this->alias);
+
+ if (trim(str_replace('-', '', $this->alias)) == '')
+ {
+ $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
+ }
+
+ return $this->alias;
+ }
+
+}
diff --git a/admin/tables/payment.php b/admin/tables/payment.php
new file mode 100644
index 0000000..d816df6
--- /dev/null
+++ b/admin/tables/payment.php
@@ -0,0 +1,351 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+use Joomla\Registry\Registry;
+
+// import Joomla table library
+jimport('joomla.database.table');
+
+/**
+ * Payments Table class
+ */
+class SupportgroupsTablePayment extends JTable
+{
+ /**
+ * Ensure the params and metadata in json encoded in the bind method
+ *
+ * @var array
+ * @since 3.3
+ */
+ protected $_jsonEncode = array('params', 'metadata');
+
+ /**
+ * Constructor
+ *
+ * @param object Database connector object
+ */
+ function __construct(&$db)
+ {
+ parent::__construct('#__supportgroups_payment', 'id', $db);
+
+ // Adding History Options
+ JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_supportgroups.payment'));
+ }
+
+ public function bind($array, $ignore = '')
+ {
+
+ if (isset($array['params']) && is_array($array['params']))
+ {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = (string) $registry;
+ }
+
+ if (isset($array['metadata']) && is_array($array['metadata']))
+ {
+ $registry = new JRegistry;
+ $registry->loadArray($array['metadata']);
+ $array['metadata'] = (string) $registry;
+ }
+
+ // Bind the rules.
+ if (isset($array['rules']) && is_array($array['rules']))
+ {
+ $rules = new JAccessRules($array['rules']);
+ $this->setRules($rules);
+ }
+ return parent::bind($array, $ignore);
+ }
+
+ /**
+ * Overload the store method for the Payment table.
+ *
+ * @param boolean Toggle whether null values should be updated.
+ * @return boolean True on success, false on failure.
+ * @since 1.6
+ */
+ public function store($updateNulls = false)
+ {
+ $date = JFactory::getDate();
+ $user = JFactory::getUser();
+
+ if ($this->id)
+ {
+ // Existing item
+ $this->modified = $date->toSql();
+ $this->modified_by = $user->get('id');
+ }
+ else
+ {
+ // New payment. A payment created and created_by field can be set by the user,
+ // so we don't touch either of these if they are set.
+ if (!(int) $this->created)
+ {
+ $this->created = $date->toSql();
+ }
+ if (empty($this->created_by))
+ {
+ $this->created_by = $user->get('id');
+ }
+ }
+
+ if (isset($this->alias))
+ {
+ // Verify that the alias is unique
+ $table = JTable::getInstance('payment', 'SupportgroupsTable');
+
+ if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
+ {
+ $this->setError(JText::_('COM_SUPPORTGROUPS_PAYMENT_ERROR_UNIQUE_ALIAS'));
+ return false;
+ }
+ }
+
+ if (isset($this->url))
+ {
+ // Convert IDN urls to punycode
+ $this->url = JStringPunycode::urlToPunycode($this->url);
+ }
+ if (isset($this->website))
+ {
+ // Convert IDN urls to punycode
+ $this->website = JStringPunycode::urlToPunycode($this->website);
+ }
+
+ return parent::store($updateNulls);
+ }
+
+ /**
+ * Overloaded check method to ensure data integrity.
+ *
+ * @return boolean True on success.
+ */
+ public function check()
+ {
+ if (isset($this->alias))
+ {
+ // Generate a valid alias
+ $this->generateAlias();
+
+ $table = JTable::getInstance('payment', 'supportgroupsTable');
+
+ while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
+ {
+ $this->alias = JString::increment($this->alias, 'dash');
+ }
+ }
+
+ /*
+ * Clean up keywords -- eliminate extra spaces between phrases
+ * and cr (\r) and lf (\n) characters from string.
+ * Only process if not empty.
+ */
+ if (!empty($this->metakey))
+ {
+ // Array of characters to remove.
+ $bad_characters = array("\n", "\r", "\"", "<", ">");
+
+ // Remove bad characters.
+ $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
+
+ // Create array using commas as delimiter.
+ $keys = explode(',', $after_clean);
+ $clean_keys = array();
+
+ foreach ($keys as $key)
+ {
+ // Ignore blank keywords.
+ if (trim($key))
+ {
+ $clean_keys[] = trim($key);
+ }
+ }
+
+ // Put array back together delimited by ", "
+ $this->metakey = implode(", ", $clean_keys);
+ }
+
+ // Clean up description -- eliminate quotes and <> brackets
+ if (!empty($this->metadesc))
+ {
+ // Only process if not empty
+ $bad_characters = array("\"", "<", ">");
+ $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
+ }
+
+ // If we don't have any access rules set at this point just use an empty JAccessRules class
+ if (!$this->getRules())
+ {
+ $rules = $this->getDefaultAssetValues('com_supportgroups.payment.'.$this->id);
+ $this->setRules($rules);
+ }
+
+ // Set ordering
+ if ($this->published < 0)
+ {
+ // Set ordering to 0 if state is archived or trashed
+ $this->ordering = 0;
+ }
+
+ return true;
+ }
+
+ /**
+ * Gets the default asset values for a component.
+ *
+ * @param $string $component The component asset name to search for
+ *
+ * @return JAccessRules The JAccessRules object for the asset
+ */
+ protected function getDefaultAssetValues($component, $try = true)
+ {
+ // Need to find the asset id by the name of the component.
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select($db->quoteName('id'))
+ ->from($db->quoteName('#__assets'))
+ ->where($db->quoteName('name') . ' = ' . $db->quote($component));
+ $db->setQuery($query);
+ $db->execute();
+ if ($db->loadRowList())
+ {
+ // asset alread set so use saved rules
+ $assetId = (int) $db->loadResult();
+ return JAccess::getAssetRules($assetId);
+ }
+ // try again
+ elseif ($try)
+ {
+ $try = explode('.',$component);
+ $result = $this->getDefaultAssetValues($try[0], false);
+ if ($result instanceof JAccessRules)
+ {
+ if (isset($try[1]))
+ {
+ $_result = (string) $result;
+ $_result = json_decode($_result);
+ foreach ($_result as $name => &$rule)
+ {
+ $v = explode('.', $name);
+ if ($try[1] !== $v[0])
+ {
+ // remove since it is not part of this view
+ unset($_result->$name);
+ }
+ else
+ {
+ // clear the value since we inherit
+ $rule = array();
+ }
+ }
+ // check if there are any view values remaining
+ if (count($_result))
+ {
+ $_result = json_encode($_result);
+ $_result = array($_result);
+ // Instantiate and return the JAccessRules object for the asset rules.
+ $rules = new JAccessRules;
+ $rules->mergeCollection($_result);
+
+ return $rules;
+ }
+ }
+ return $result;
+ }
+ }
+ return JAccess::getAssetRules(0);
+ }
+
+ /**
+ * Method to compute the default name of the asset.
+ * The default name is in the form 'table_name.id'
+ * where id is the value of the primary key of the table.
+ *
+ * @return string
+ * @since 2.5
+ */
+ protected function _getAssetName()
+ {
+ $k = $this->_tbl_key;
+ return 'com_supportgroups.payment.'.(int) $this->$k;
+ }
+
+ /**
+ * Method to return the title to use for the asset table.
+ *
+ * @return string
+ * @since 2.5
+ */
+ protected function _getAssetTitle()
+ {
+ if (isset($this->title))
+ {
+ return $this->title;
+ }
+ return '';
+ }
+
+ /**
+ * Get the parent asset id for the record
+ *
+ * @return int
+ * @since 2.5
+ */
+ protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
+ {
+ $asset = JTable::getInstance('Asset');
+ $asset->loadByName('com_supportgroups');
+
+ return $asset->id;
+ }
+
+ /**
+ * Generate a valid alias from title / date.
+ * Remains public to be able to check for duplicated alias before saving
+ *
+ * @return string
+ */
+ public function generateAlias()
+ {
+ if (empty($this->alias))
+ {
+ $this->alias = $this->name;
+ }
+
+ $this->alias = JApplication::stringURLSafe($this->alias);
+
+ if (trim(str_replace('-', '', $this->alias)) == '')
+ {
+ $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s");
+ }
+
+ return $this->alias;
+ }
+
+}
diff --git a/admin/views/clinic/submitbutton.js b/admin/views/clinic/submitbutton.js
new file mode 100644
index 0000000..9bcccff
--- /dev/null
+++ b/admin/views/clinic/submitbutton.js
@@ -0,0 +1,49 @@
+/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
+ __ __ _ _____ _ _ __ __ _ _ _
+ \ \ / / | | | __ \ | | | | | \/ | | | | | | |
+ \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
+ \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
+ \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
+ \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
+ | |
+ |_|
+/-------------------------------------------------------------------------------------------------------------------------------/
+
+ @version 1.0.3
+ @build 6th March, 2016
+ @created 24th February, 2016
+ @package Support Groups
+ @subpackage submitbutton.js
+ @author Llewellyn van der Merwe
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+Joomla.submitbutton = function(task)
+{
+ if (task == ''){
+ return false;
+ } else {
+ var isValid=true;
+ var action = task.split('.');
+ if (action[1] != 'cancel' && action[1] != 'close'){
+ var forms = $$('form.form-validate');
+ for (var i=0;i
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
+JHtml::_('behavior.tooltip');
+JHtml::_('behavior.formvalidation');
+JHtml::_('formbehavior.chosen', 'select');
+JHtml::_('behavior.keepalive');
+$componentParams = JComponentHelper::getParams('com_supportgroups');
+?>
+
+
diff --git a/admin/views/clinic/tmpl/index.html b/admin/views/clinic/tmpl/index.html
new file mode 100644
index 0000000..fa6d84e
--- /dev/null
+++ b/admin/views/clinic/tmpl/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/views/clinic/view.html.php b/admin/views/clinic/view.html.php
new file mode 100644
index 0000000..5e0a94a
--- /dev/null
+++ b/admin/views/clinic/view.html.php
@@ -0,0 +1,200 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// import Joomla view library
+jimport('joomla.application.component.view');
+
+/**
+ * Clinic View class
+ */
+class SupportgroupsViewClinic extends JViewLegacy
+{
+ /**
+ * display method of View
+ * @return void
+ */
+ public function display($tpl = null)
+ {
+ // Check for errors.
+ if (count($errors = $this->get('Errors')))
+ {
+ JError::raiseError(500, implode(' ', $errors));
+ return false;
+ }
+
+ // Assign the variables
+ $this->form = $this->get('Form');
+ $this->item = $this->get('Item');
+ $this->script = $this->get('Script');
+ $this->state = $this->get('State');
+ // get action permissions
+ $this->canDo = SupportgroupsHelper::getActions('clinic',$this->item);
+ // get input
+ $jinput = JFactory::getApplication()->input;
+ $this->ref = $jinput->get('ref', 0, 'word');
+ $this->refid = $jinput->get('refid', 0, 'int');
+ $this->referral = '';
+ if ($this->refid)
+ {
+ // return to the item that refered to this item
+ $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
+ }
+ elseif($this->ref)
+ {
+ // return to the list view that refered to this item
+ $this->referral = '&ref='.(string)$this->ref;
+ }
+
+ // Set the toolbar
+ $this->addToolBar();
+
+ // Display the template
+ parent::display($tpl);
+
+ // Set the document
+ $this->setDocument();
+ }
+
+
+ /**
+ * Setting the toolbar
+ */
+ protected function addToolBar()
+ {
+ JFactory::getApplication()->input->set('hidemainmenu', true);
+ $user = JFactory::getUser();
+ $userId = $user->id;
+ $isNew = $this->item->id == 0;
+
+ JToolbarHelper::title( JText::_($isNew ? 'COM_SUPPORTGROUPS_CLINIC_NEW' : 'COM_SUPPORTGROUPS_CLINIC_EDIT'), 'pencil-2 article-add');
+ // Built the actions for new and existing records.
+ if ($this->refid || $this->ref)
+ {
+ if ($this->canDo->get('clinic.create') && $isNew)
+ {
+ // We can create the record.
+ JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE');
+ }
+ elseif ($this->canDo->get('clinic.edit'))
+ {
+ // We can save the record.
+ JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE');
+ }
+ if ($isNew)
+ {
+ // Do not creat but cancel.
+ JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CANCEL');
+ }
+ else
+ {
+ // We can close it.
+ JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CLOSE');
+ }
+ }
+ else
+ {
+ if ($isNew)
+ {
+ // For new records, check the create permission.
+ if ($this->canDo->get('clinic.create'))
+ {
+ JToolBarHelper::apply('clinic.apply', 'JTOOLBAR_APPLY');
+ JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE');
+ JToolBarHelper::custom('clinic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
+ };
+ JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CANCEL');
+ }
+ else
+ {
+ if ($this->canDo->get('clinic.edit'))
+ {
+ // We can save the new record
+ JToolBarHelper::apply('clinic.apply', 'JTOOLBAR_APPLY');
+ JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE');
+ // We can save this record, but check the create permission to see
+ // if we can return to make a new one.
+ if ($this->canDo->get('clinic.create'))
+ {
+ JToolBarHelper::custom('clinic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
+ }
+ }
+ $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('clinic.version'));
+ if ($this->state->params->get('save_history', 1) && $this->canDo->get('clinic.edit') && $canVersion)
+ {
+ JToolbarHelper::versions('com_supportgroups.clinic', $this->item->id);
+ }
+ if ($this->canDo->get('clinic.create'))
+ {
+ JToolBarHelper::custom('clinic.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
+ }
+ JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CLOSE');
+ }
+ }
+ JToolbarHelper::divider();
+ // set help url for this view if found
+ $help_url = SupportgroupsHelper::getHelpUrl('clinic');
+ if (SupportgroupsHelper::checkString($help_url))
+ {
+ JToolbarHelper::help('COM_SUPPORTGROUPS_HELP_MANAGER', false, $help_url);
+ }
+ }
+
+ /**
+ * Escapes a value for output in a view script.
+ *
+ * @param mixed $var The output to escape.
+ *
+ * @return mixed The escaped value.
+ */
+ public function escape($var)
+ {
+ if(strlen($var) > 30)
+ {
+ // use the helper htmlEscape method instead and shorten the string
+ return SupportgroupsHelper::htmlEscape($var, $this->_charset, true, 30);
+ }
+ // use the helper htmlEscape method instead.
+ return SupportgroupsHelper::htmlEscape($var, $this->_charset);
+ }
+
+ /**
+ * Method to set up the document properties
+ *
+ * @return void
+ */
+ protected function setDocument()
+ {
+ $isNew = ($this->item->id < 1);
+ $document = JFactory::getDocument();
+ $document->setTitle(JText::_($isNew ? 'COM_SUPPORTGROUPS_CLINIC_NEW' : 'COM_SUPPORTGROUPS_CLINIC_EDIT'));
+ $document->addStyleSheet(JURI::root() . "administrator/components/com_supportgroups/assets/css/clinic.css");
+ $document->addScript(JURI::root() . $this->script);
+ $document->addScript(JURI::root() . "administrator/components/com_supportgroups/views/clinic/submitbutton.js");
+ JText::script('view not acceptable. Error');
+ }
+}
diff --git a/admin/views/clinics/index.html b/admin/views/clinics/index.html
new file mode 100644
index 0000000..fa6d84e
--- /dev/null
+++ b/admin/views/clinics/index.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/admin/views/clinics/tmpl/default.php b/admin/views/clinics/tmpl/default.php
new file mode 100644
index 0000000..b87186f
--- /dev/null
+++ b/admin/views/clinics/tmpl/default.php
@@ -0,0 +1,99 @@
+
+ @copyright Copyright (C) 2015. All Rights Reserved
+ @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+
+ Support Groups
+
+/-----------------------------------------------------------------------------------------------------------------------------*/
+
+// No direct access to this file
+defined('_JEXEC') or die('Restricted access');
+
+// load tooltip behavior
+JHtml::_('behavior.tooltip');
+JHtml::_('behavior.multiselect');
+JHtml::_('dropdown.init');
+JHtml::_('formbehavior.chosen', 'select');
+
+if ($this->saveOrder)
+{
+ $saveOrderingUrl = 'index.php?option=com_supportgroups&task=clinics.saveOrderAjax&tmpl=component';
+ JHtml::_('sortablelist.sortable', 'clinicList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
+}
+
+?>
+
+ |