From 96cb33e792735831057a97e23586863b7c96319c Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Tue, 20 Aug 2024 14:25:24 +0200 Subject: [PATCH] Update --- .idea/.gitignore | 8 + .idea/modules.xml | 8 + .idea/php.xml | 22 ++ .idea/subform-power.iml | 8 + .idea/vcs.xml | 6 + README.md | 24 +-- SubformpowerInstallerPowerloader.php | 65 ++++++ SubformpowerInstallerScript.php | 188 ++++++++++++++---- admin/README.txt | 24 +-- admin/assets/css/admin.css | 4 +- admin/assets/css/countries.css | 4 +- admin/assets/css/country.css | 4 +- admin/assets/css/currencies.css | 4 +- admin/assets/css/currency.css | 4 +- admin/assets/css/dashboard.css | 4 +- admin/assets/js/admin.js | 4 +- admin/config.xml | 35 ++++ admin/forms/country.xml | 16 +- admin/forms/currency.xml | 16 +- .../language/en-GB/en-GB.com_subformpower.ini | 8 +- .../en-GB/en-GB.com_subformpower.sys.ini | 8 + .../layouts/country/currencies_fullwidth.php | 10 +- admin/layouts/country/details_above.php | 4 +- admin/layouts/country/details_left.php | 4 +- admin/layouts/country/details_right.php | 4 +- .../layouts/country/more_stuff_fullwidth.php | 4 +- admin/layouts/country/publishing.php | 4 +- admin/layouts/country/publlshing.php | 4 +- admin/layouts/currency/details_above.php | 6 +- admin/layouts/currency/details_left.php | 4 +- admin/layouts/currency/details_right.php | 4 +- admin/layouts/currency/publishing.php | 4 +- admin/layouts/currency/publlshing.php | 4 +- admin/services/provider.php | 4 +- admin/sql/install.mysql.utf8.sql | 4 +- admin/src/Controller/CountriesController.php | 4 +- admin/src/Controller/CountryController.php | 6 +- admin/src/Controller/CurrenciesController.php | 4 +- admin/src/Controller/CurrencyController.php | 6 +- admin/src/Controller/DisplayController.php | 4 +- admin/src/Controller/ImportController.php | 4 +- .../src/Controller/SubformpowerController.php | 4 +- admin/src/Extension/SubformpowerComponent.php | 4 +- admin/src/Field/CountriesField.php | 4 +- admin/src/Field/CountriesfilterisoField.php | 4 +- .../Field/CountriesfilterisothreeField.php | 4 +- .../src/Field/CountriesfilternumcodeField.php | 4 +- .../Field/CountriesfilterphonecodeField.php | 4 +- .../src/Field/CurrenciesfiltersymbolField.php | 4 +- admin/src/Helper/HeaderCheck.php | 4 +- admin/src/Helper/PowerloaderHelper.php | 4 +- admin/src/Helper/SubformpowerHelper.php | 9 +- admin/src/Model/CountriesModel.php | 6 +- admin/src/Model/CountryModel.php | 4 +- admin/src/Model/CurrenciesModel.php | 14 +- admin/src/Model/CurrencyModel.php | 10 +- admin/src/Model/ImportModel.php | 8 +- admin/src/Model/SubformpowerModel.php | 4 +- admin/src/Rule/GuidRule.php | 4 +- admin/src/Table/CountryTable.php | 4 +- admin/src/Table/CurrencyTable.php | 4 +- admin/src/View/Countries/HtmlView.php | 63 +++++- admin/src/View/Country/HtmlView.php | 87 +++++++- admin/src/View/Currencies/HtmlView.php | 63 +++++- admin/src/View/Currency/HtmlView.php | 87 +++++++- admin/src/View/Import/HtmlView.php | 4 +- admin/src/View/Subformpower/HtmlView.php | 4 +- admin/tmpl/countries/default.php | 4 +- admin/tmpl/countries/default_body.php | 4 +- admin/tmpl/countries/default_foot.php | 4 +- admin/tmpl/countries/default_head.php | 4 +- admin/tmpl/countries/default_toolbar.php | 4 +- admin/tmpl/countries/emptystate.php | 4 +- admin/tmpl/country/default.php | 16 +- admin/tmpl/currencies/default.php | 4 +- admin/tmpl/currencies/default_body.php | 8 +- admin/tmpl/currencies/default_foot.php | 4 +- admin/tmpl/currencies/default_head.php | 6 +- admin/tmpl/currencies/default_toolbar.php | 4 +- admin/tmpl/currencies/emptystate.php | 4 +- admin/tmpl/currency/default.php | 16 +- admin/tmpl/import/default.php | 4 +- admin/tmpl/subformpower/default.php | 4 +- admin/tmpl/subformpower/default_main.php | 4 +- admin/tmpl/subformpower/default_vdm.php | 4 +- .../JCB.Joomla/src/Data/MultiSubform.php | 16 +- .../JCB.Joomla/src/Data/Subform.php | 31 ++- .../Interfaces/Data/MultiSubformInterface.php | 4 +- .../src/Interfaces/Data/SubformInterface.php | 8 +- .../JCB.Joomla/src/Subformpower/Table.php | 12 +- media/js/country.js | 4 +- media/js/currency.js | 4 +- subformpower.xml | 6 +- 93 files changed, 859 insertions(+), 299 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/subform-power.iml create mode 100644 .idea/vcs.xml create mode 100644 SubformpowerInstallerPowerloader.php diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..39e0a42 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..a1827cd --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/subform-power.iml b/.idea/subform-power.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/subform-power.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 2a17919..8d6642b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Subform Power (1.0.0) +# Subform Power (1.0.1) Demonstration of subform super power @@ -8,38 +8,38 @@ Demonstration of subform super power + *Author*: [Oh Martin](mailto:oh@nampharm.com.na) + *Name*: [Subform Power](https://nampharm.com.na) + *First Build*: 24th May, 2024 -+ *Last Build*: 28th June, 2024 -+ *Version*: 1.0.0 ++ *Last Build*: 20th August, 2024 ++ *Version*: 1.0.1 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**69 Hours** or **9 Eight Hour Days** (actual time the author saved - +**71 Hours** or **9 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **24593** -+ *File count*: **229** -+ *Folder count*: **78** ++ *Line count*: **25284** ++ *File count*: **234** ++ *Folder count*: **81** -**45 Hours** or **5 Eight Hour Days** (the actual time the author spent) +**46 Hours** or **6 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @17hours** = codingtime / 4; +> **debugging @18hours** = codingtime / 4; > **planning @10hours** = codingtime / 7; > **mapping @7hours** = codingtime / 10; -> **office @11hours** = codingtime / 6;) +> **office @12hours** = codingtime / 6;) -**114 Hours** or **14 Eight Hour Days** +**117 Hours** or **15 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **2.8 weeks** or **0.6 months** +Project duration: **3 weeks** or **0.6 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) \ No newline at end of file diff --git a/SubformpowerInstallerPowerloader.php b/SubformpowerInstallerPowerloader.php new file mode 100644 index 0000000..66c26d8 --- /dev/null +++ b/SubformpowerInstallerPowerloader.php @@ -0,0 +1,65 @@ + + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die; + +// register additional namespace +spl_autoload_register(function ($class) { + // project-specific base directories and namespace prefix + $search = [ + 'libraries/jcb_powers/JCB.Joomla' => 'JCB\\Joomla' + ]; + // Start the search and load if found + $found = false; + $found_base_dir = ""; + $found_len = 0; + foreach ($search as $base_dir => $prefix) + { + // does the class use the namespace prefix? + $len = strlen($prefix); + if (strncmp($prefix, $class, $len) === 0) + { + // we have a match so load the values + $found = true; + $found_base_dir = $base_dir; + $found_len = $len; + // done here + break; + } + } + // check if we found a match + if (!$found) + { + // not found so move to the next registered autoloader + return; + } + // get the relative class name + $relative_class = substr($class, $found_len); + // replace the namespace prefix with the base directory, replace namespace + // separators with directory separators in the relative class name, append + // with .php + $file = __DIR__ . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); diff --git a/SubformpowerInstallerScript.php b/SubformpowerInstallerScript.php index c4d48ba..6454653 100644 --- a/SubformpowerInstallerScript.php +++ b/SubformpowerInstallerScript.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage SubformpowerInstallerScript.php @@ -23,7 +23,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Installer\InstallerAdapter; use Joomla\CMS\Installer\InstallerScriptInterface; -use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Log\Log; use Joomla\CMS\Version; use Joomla\CMS\HTML\HTMLHelper as Html; @@ -43,7 +42,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * The CMS Application. * - * @var CMSApplication * @since 4.4.2 */ protected $app; @@ -58,7 +56,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * The version number of the extension. * - * @var string + * @var string * @since 3.6 */ protected $release; @@ -66,7 +64,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * The table the parameters are stored in. * - * @var string + * @var string * @since 3.6 */ protected $paramTable; @@ -74,7 +72,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * The extension name. This should be set in the installer script. * - * @var string + * @var string * @since 3.6 */ protected $extension; @@ -82,7 +80,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * A list of files to be deleted * - * @var array + * @var array * @since 3.6 */ protected $deleteFiles = []; @@ -90,7 +88,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * A list of folders to be deleted * - * @var array + * @var array * @since 3.6 */ protected $deleteFolders = []; @@ -98,7 +96,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * A list of CLI script files to be copied to the cli directory * - * @var array + * @var array * @since 3.6 */ protected $cliScriptFiles = []; @@ -106,7 +104,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * Minimum PHP version required to install the extension * - * @var string + * @var string * @since 3.6 */ protected $minimumPhp; @@ -114,7 +112,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface /** * Minimum Joomla! version required to install the extension * - * @var string + * @var string * @since 3.6 */ protected $minimumJoomla; @@ -168,7 +166,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param InstallerAdapter $adapter The adapter calling this method * * @return boolean True on success - * * @since 4.2.0 */ public function install(InstallerAdapter $adapter): bool {return true;} @@ -190,7 +187,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param InstallerAdapter $adapter The adapter calling this method * * @return boolean True on success - * * @since 4.2.0 */ public function uninstall(InstallerAdapter $adapter): bool @@ -226,7 +222,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param InstallerAdapter $adapter The adapter calling this method * * @return boolean True on success - * * @since 4.2.0 */ public function preflight(string $type, InstallerAdapter $adapter): bool @@ -271,7 +266,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param InstallerAdapter $adapter The adapter calling this method * * @return boolean True on success - * * @since 4.2.0 */ public function postflight(string $type, InstallerAdapter $adapter): bool @@ -311,11 +305,11 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface // rules '', // fieldMappings - '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","symbol":"symbol","country":"country","guid":"guid"}}', + '{"common": {"core_content_item_id": "id","core_title": "ext_number","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"ext_number":"ext_number","symbol":"symbol","country":"country","guid":"guid"}}', // router '', // contentHistoryOptions - '{"formFile": "administrator/components/com_subformpower/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__subformpower_country","targetColumn": "guid","displayColumn": "name"}]}' + '{"formFile": "administrator/components/com_subformpower/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","ext_number"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__subformpower_country","targetColumn": "guid","displayColumn": "name"}]}' ); @@ -364,11 +358,11 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface // rules '', // fieldMappings - '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","symbol":"symbol","country":"country","guid":"guid"}}', + '{"common": {"core_content_item_id": "id","core_title": "ext_number","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"ext_number":"ext_number","symbol":"symbol","country":"country","guid":"guid"}}', // router '', // contentHistoryOptions - '{"formFile": "administrator/components/com_subformpower/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__subformpower_country","targetColumn": "guid","displayColumn": "name"}]}' + '{"formFile": "administrator/components/com_subformpower/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","ext_number"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__subformpower_country","targetColumn": "guid","displayColumn": "name"}]}' ); @@ -376,7 +370,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface echo '
-

Upgrade to Version 1.0.0 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 1.0.1 Was Successful! Let us know if anything is not working as expected.

'; } // move CLI files @@ -388,11 +382,84 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface return true; } + /** + * Remove folders with files (with ignore options) + * + * @param string $dir The path to the folder to remove. + * @param array|null $ignore The folders and files to ignore and not remove. + * + * @return bool True if all specified files/folders are removed, false otherwise. + * @since 3.2.2 + */ + protected function removeFolder(string $dir, ?array $ignore = null): bool + { + if (!is_dir($dir)) + { + return false; + } + + $it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS); + $it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); + + // Remove trailing slash + $dir = rtrim($dir, '/'); + + foreach ($it as $file) + { + $filePath = $file->getPathname(); + $relativePath = str_replace($dir . '/', '', $filePath); + + if ($ignore !== null && in_array($relativePath, $ignore, true)) + { + continue; + } + + if ($file->isDir()) + { + Folder::delete($filePath); + } + else + { + File::delete($filePath); + } + } + + // Delete the root folder if there are no ignored files/folders left + if ($ignore === null || $this->isDirEmpty($dir, $ignore)) + { + return Folder::delete($dir); + } + + return true; + } + + /** + * Check if a directory is empty considering ignored files/folders. + * + * @param string $dir The path to the folder to check. + * @param array $ignore The folders and files to ignore. + * + * @return bool True if the directory is empty or contains only ignored items, false otherwise. + * @since 3.2.1 + */ + protected function isDirEmpty(string $dir, array $ignore): bool + { + $it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS); + foreach ($it as $file) + { + $relativePath = str_replace($dir . '/', '', $file->getPathname()); + if (!in_array($relativePath, $ignore, true)) + { + return false; + } + } + return true; + } + /** * Remove the files and folders in the given array from * * @return void - * * @since 3.6 */ protected function removeFiles() @@ -424,7 +491,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * Moves the CLI scripts into the CLI folder in the CMS * * @return void - * * @since 3.6 */ protected function moveCliFiles() @@ -455,7 +521,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $contentHistoryOptions * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function setContentType( string $typeTitle, @@ -517,7 +583,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $textPrefix * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function setActionLogConfig( string $typeTitle, @@ -570,7 +636,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * Set action logs extensions integration * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function setActionLogsExtensions(): void { @@ -611,7 +677,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $rules The component rules * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function setAssetsRules(string $rules): void { @@ -649,7 +715,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $params The component rules * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function setExtensionsParams(string $params): void { @@ -692,7 +758,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $dataType This datatype we will change the rules column to if it to small. * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function setDatabaseAssetsRulesFix(int $accessWorseCase, string $dataType): void { @@ -727,7 +793,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param bool $fields The switch to also remove related field data * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeViewData(string $context, bool $fields = false): void { @@ -750,7 +816,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $context The view context * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeContentTypes(string $context): void { @@ -807,7 +873,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $context The view context * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeFields(string $context): void { @@ -869,7 +935,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param array $ids The view context * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeFieldsValues(string $context, array $ids): void { @@ -900,7 +966,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $context The view context * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeFieldsGroups(string $context): void { @@ -955,7 +1021,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $context The view context * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeViewHistory(string $context): void { @@ -987,7 +1053,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param array $ids The type ids * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeUcmBase(array $ids): void { @@ -1020,7 +1086,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $context The view context * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeUcmContent(string $context): void { @@ -1052,7 +1118,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $context The view context * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeContentItemTagMap(string $context): void { @@ -1087,7 +1153,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * @param string $context The view context * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeActionLogConfig(string $context): void { @@ -1117,7 +1183,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * Remove Asset Table Integrated * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeAssetData(): void { @@ -1145,7 +1211,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * Remove action logs extensions integrated * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeActionLogsExtensions(): void { @@ -1175,7 +1241,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface * Remove remove database fix (if possible) * * @return void - * @since 4.4.2 + * @since 4.4.2 */ protected function removeDatabaseAssetsRulesFix(): void { @@ -1206,6 +1272,44 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface } } + /** + * Ensures that a class in the namespace is available. + * If the class is not already loaded, it attempts to load it via the specified autoloader. + * + * @param string $className The fully qualified name of the class to check. + * + * @return bool True if the class exists or was successfully loaded, false otherwise. + * @since 4.0.1 + */ + protected function classExists(string $className): bool + { + if (class_exists($className, true)) + { + return true; + } + + // Autoloaders to check + $autoloaders = [ + __DIR__ . '/SubformpowerInstallerPowerloader.php', + JPATH_ADMINISTRATOR . '/components/com_subformpower/src/Helper/PowerloaderHelper.php' + ]; + + foreach ($autoloaders as $autoloader) + { + if (file_exists($autoloader)) + { + require_once $autoloader; + + if (class_exists($className, true)) + { + return true; + } + } + } + + return false; + } + /** * Method to move folders into place. * diff --git a/admin/README.txt b/admin/README.txt index 2a17919..8d6642b 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Subform Power (1.0.0) +# Subform Power (1.0.1) Demonstration of subform super power @@ -8,38 +8,38 @@ Demonstration of subform super power + *Author*: [Oh Martin](mailto:oh@nampharm.com.na) + *Name*: [Subform Power](https://nampharm.com.na) + *First Build*: 24th May, 2024 -+ *Last Build*: 28th June, 2024 -+ *Version*: 1.0.0 ++ *Last Build*: 20th August, 2024 ++ *Version*: 1.0.1 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**69 Hours** or **9 Eight Hour Days** (actual time the author saved - +**71 Hours** or **9 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **24593** -+ *File count*: **229** -+ *Folder count*: **78** ++ *Line count*: **25284** ++ *File count*: **234** ++ *Folder count*: **81** -**45 Hours** or **5 Eight Hour Days** (the actual time the author spent) +**46 Hours** or **6 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @17hours** = codingtime / 4; +> **debugging @18hours** = codingtime / 4; > **planning @10hours** = codingtime / 7; > **mapping @7hours** = codingtime / 10; -> **office @11hours** = codingtime / 6;) +> **office @12hours** = codingtime / 6;) -**114 Hours** or **14 Eight Hour Days** +**117 Hours** or **15 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **2.8 weeks** or **0.6 months** +Project duration: **3 weeks** or **0.6 months** > This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) \ No newline at end of file diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 8185c7a..d8806ca 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage admin.css diff --git a/admin/assets/css/countries.css b/admin/assets/css/countries.css index 1831dc4..ecbd9d7 100644 --- a/admin/assets/css/countries.css +++ b/admin/assets/css/countries.css @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage countries.css diff --git a/admin/assets/css/country.css b/admin/assets/css/country.css index 28bef4e..7d66264 100644 --- a/admin/assets/css/country.css +++ b/admin/assets/css/country.css @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage country.css diff --git a/admin/assets/css/currencies.css b/admin/assets/css/currencies.css index 913c9db..ec26b4f 100644 --- a/admin/assets/css/currencies.css +++ b/admin/assets/css/currencies.css @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage currencies.css diff --git a/admin/assets/css/currency.css b/admin/assets/css/currency.css index 40e80fe..50a2d2f 100644 --- a/admin/assets/css/currency.css +++ b/admin/assets/css/currency.css @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage currency.css diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index a2310b1..defacac 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage dashboard.css diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index 16440e5..707338b 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage admin.js diff --git a/admin/config.xml b/admin/config.xml index 9f99f62..8b7b8b8 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -69,6 +69,41 @@ class="readonly" /> +
+ + + + + + + + + + + + + + +
- + - + - + @@ -100,12 +100,12 @@ $can = SubformpowerHelper::getActions('currency'); get('currency.edit')): ?> - escape($item->name); ?> + escape($item->ext_number); ?> checked_out): ?> name, $item->checked_out_time, 'currencies.', $canCheckin); ?> - escape($item->name); ?> + escape($item->ext_number); ?> diff --git a/admin/layouts/country/details_above.php b/admin/layouts/country/details_above.php index e6e6a61..6447281 100644 --- a/admin/layouts/country/details_above.php +++ b/admin/layouts/country/details_above.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage details_above.php diff --git a/admin/layouts/country/details_left.php b/admin/layouts/country/details_left.php index c509420..e3d1d75 100644 --- a/admin/layouts/country/details_left.php +++ b/admin/layouts/country/details_left.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage details_left.php diff --git a/admin/layouts/country/details_right.php b/admin/layouts/country/details_right.php index 290ea44..b0c0d40 100644 --- a/admin/layouts/country/details_right.php +++ b/admin/layouts/country/details_right.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage details_right.php diff --git a/admin/layouts/country/more_stuff_fullwidth.php b/admin/layouts/country/more_stuff_fullwidth.php index da7e5f0..921783b 100644 --- a/admin/layouts/country/more_stuff_fullwidth.php +++ b/admin/layouts/country/more_stuff_fullwidth.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage more_stuff_fullwidth.php diff --git a/admin/layouts/country/publishing.php b/admin/layouts/country/publishing.php index 9c574bf..4440d2d 100644 --- a/admin/layouts/country/publishing.php +++ b/admin/layouts/country/publishing.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage publishing.php diff --git a/admin/layouts/country/publlshing.php b/admin/layouts/country/publlshing.php index e5013ab..1f2274b 100644 --- a/admin/layouts/country/publlshing.php +++ b/admin/layouts/country/publlshing.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage publlshing.php diff --git a/admin/layouts/currency/details_above.php b/admin/layouts/currency/details_above.php index e6e6a61..2dfc438 100644 --- a/admin/layouts/currency/details_above.php +++ b/admin/layouts/currency/details_above.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage details_above.php @@ -35,7 +35,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: [ - 'name' + 'ext_number' ]; // Ensure $fields is treated as an array and count its size. diff --git a/admin/layouts/currency/details_left.php b/admin/layouts/currency/details_left.php index 592b157..08b1428 100644 --- a/admin/layouts/currency/details_left.php +++ b/admin/layouts/currency/details_left.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage details_left.php diff --git a/admin/layouts/currency/details_right.php b/admin/layouts/currency/details_right.php index c2d983f..3e58b3c 100644 --- a/admin/layouts/currency/details_right.php +++ b/admin/layouts/currency/details_right.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage details_right.php diff --git a/admin/layouts/currency/publishing.php b/admin/layouts/currency/publishing.php index 9c574bf..4440d2d 100644 --- a/admin/layouts/currency/publishing.php +++ b/admin/layouts/currency/publishing.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage publishing.php diff --git a/admin/layouts/currency/publlshing.php b/admin/layouts/currency/publlshing.php index e5013ab..1f2274b 100644 --- a/admin/layouts/currency/publlshing.php +++ b/admin/layouts/currency/publlshing.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage publlshing.php diff --git a/admin/services/provider.php b/admin/services/provider.php index f9f6d38..d529e2a 100644 --- a/admin/services/provider.php +++ b/admin/services/provider.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage provider.php diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index d62cd1f..4632ff6 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -37,8 +37,8 @@ CREATE TABLE IF NOT EXISTS `#__subformpower_currency` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `country` VARCHAR(36) NOT NULL DEFAULT '', + `ext_number` INT(10) NOT NULL DEFAULT 0, `guid` VARCHAR(36) NOT NULL DEFAULT '', - `name` VARCHAR(255) NOT NULL DEFAULT '', `symbol` VARCHAR(255) NULL DEFAULT '', `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, @@ -53,7 +53,7 @@ CREATE TABLE IF NOT EXISTS `#__subformpower_currency` ( `access` INT(10) unsigned NOT NULL DEFAULT 0, `ordering` INT(11) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), - KEY `idx_name` (`name`), + KEY `idx_ext_number` (`ext_number`), KEY `idx_country` (`country`), KEY `idx_guid` (`guid`), KEY `idx_access` (`access`), diff --git a/admin/src/Controller/CountriesController.php b/admin/src/Controller/CountriesController.php index ba98426..381379a 100644 --- a/admin/src/Controller/CountriesController.php +++ b/admin/src/Controller/CountriesController.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountriesController.php diff --git a/admin/src/Controller/CountryController.php b/admin/src/Controller/CountryController.php index 5b82f1a..0a86a9e 100644 --- a/admin/src/Controller/CountryController.php +++ b/admin/src/Controller/CountryController.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountryController.php @@ -338,7 +338,7 @@ class CountryController extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param BaseDatabaseModel &$model The data model object. + * @param BaseDatabaseModel $model The data model object. * @param array $validData The validated data. * * @return void diff --git a/admin/src/Controller/CurrenciesController.php b/admin/src/Controller/CurrenciesController.php index 75f54a6..4619062 100644 --- a/admin/src/Controller/CurrenciesController.php +++ b/admin/src/Controller/CurrenciesController.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CurrenciesController.php diff --git a/admin/src/Controller/CurrencyController.php b/admin/src/Controller/CurrencyController.php index 0b4230a..05bb25c 100644 --- a/admin/src/Controller/CurrencyController.php +++ b/admin/src/Controller/CurrencyController.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CurrencyController.php @@ -338,7 +338,7 @@ class CurrencyController extends FormController * Function that allows child controller access to model data * after the data has been saved. * - * @param BaseDatabaseModel &$model The data model object. + * @param BaseDatabaseModel $model The data model object. * @param array $validData The validated data. * * @return void diff --git a/admin/src/Controller/DisplayController.php b/admin/src/Controller/DisplayController.php index fb8b8dd..057247b 100644 --- a/admin/src/Controller/DisplayController.php +++ b/admin/src/Controller/DisplayController.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage DisplayController.php diff --git a/admin/src/Controller/ImportController.php b/admin/src/Controller/ImportController.php index a18c235..8a9d427 100644 --- a/admin/src/Controller/ImportController.php +++ b/admin/src/Controller/ImportController.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage ImportController.php diff --git a/admin/src/Controller/SubformpowerController.php b/admin/src/Controller/SubformpowerController.php index 6059e1e..5c1ec44 100644 --- a/admin/src/Controller/SubformpowerController.php +++ b/admin/src/Controller/SubformpowerController.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage SubformpowerController.php diff --git a/admin/src/Extension/SubformpowerComponent.php b/admin/src/Extension/SubformpowerComponent.php index 309dc8e..e053f90 100644 --- a/admin/src/Extension/SubformpowerComponent.php +++ b/admin/src/Extension/SubformpowerComponent.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage SubformpowerComponent.php diff --git a/admin/src/Field/CountriesField.php b/admin/src/Field/CountriesField.php index 5fb8e48..41f9bbe 100644 --- a/admin/src/Field/CountriesField.php +++ b/admin/src/Field/CountriesField.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountriesField.php diff --git a/admin/src/Field/CountriesfilterisoField.php b/admin/src/Field/CountriesfilterisoField.php index 65669fd..aedf96e 100644 --- a/admin/src/Field/CountriesfilterisoField.php +++ b/admin/src/Field/CountriesfilterisoField.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountriesfilterisoField.php diff --git a/admin/src/Field/CountriesfilterisothreeField.php b/admin/src/Field/CountriesfilterisothreeField.php index 220b1c7..78e7840 100644 --- a/admin/src/Field/CountriesfilterisothreeField.php +++ b/admin/src/Field/CountriesfilterisothreeField.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountriesfilterisothreeField.php diff --git a/admin/src/Field/CountriesfilternumcodeField.php b/admin/src/Field/CountriesfilternumcodeField.php index b51f5bb..1f86520 100644 --- a/admin/src/Field/CountriesfilternumcodeField.php +++ b/admin/src/Field/CountriesfilternumcodeField.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountriesfilternumcodeField.php diff --git a/admin/src/Field/CountriesfilterphonecodeField.php b/admin/src/Field/CountriesfilterphonecodeField.php index 4a9ed91..16be64b 100644 --- a/admin/src/Field/CountriesfilterphonecodeField.php +++ b/admin/src/Field/CountriesfilterphonecodeField.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountriesfilterphonecodeField.php diff --git a/admin/src/Field/CurrenciesfiltersymbolField.php b/admin/src/Field/CurrenciesfiltersymbolField.php index 7f378e2..0343eb0 100644 --- a/admin/src/Field/CurrenciesfiltersymbolField.php +++ b/admin/src/Field/CurrenciesfiltersymbolField.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CurrenciesfiltersymbolField.php diff --git a/admin/src/Helper/HeaderCheck.php b/admin/src/Helper/HeaderCheck.php index 7219962..f488095 100644 --- a/admin/src/Helper/HeaderCheck.php +++ b/admin/src/Helper/HeaderCheck.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage HeaderCheck.php diff --git a/admin/src/Helper/PowerloaderHelper.php b/admin/src/Helper/PowerloaderHelper.php index a785851..a6827cc 100644 --- a/admin/src/Helper/PowerloaderHelper.php +++ b/admin/src/Helper/PowerloaderHelper.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage PowerloaderHelper.php diff --git a/admin/src/Helper/SubformpowerHelper.php b/admin/src/Helper/SubformpowerHelper.php index 31ccc13..a52260e 100644 --- a/admin/src/Helper/SubformpowerHelper.php +++ b/admin/src/Helper/SubformpowerHelper.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage SubformpowerHelper.php @@ -31,7 +31,7 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\Access\Access; use Joomla\CMS\Access\Rules as AccessRules; use Joomla\CMS\Component\ComponentHelper; -use Joomla\CMS\Filesystem\File; +use Joomla\Filesystem\File; use Joomla\CMS\Language\Language; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Object\CMSObject; @@ -43,9 +43,6 @@ use Joomla\Database\DatabaseInterface; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; -use PhpOffice\PhpSpreadsheet\IOFactory; -use PhpOffice\PhpSpreadsheet\Spreadsheet; -use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use JCB\Joomla\Utilities\StringHelper as UtilitiesStringHelper; use JCB\Joomla\Utilities\ObjectHelper; use JCB\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper; diff --git a/admin/src/Model/CountriesModel.php b/admin/src/Model/CountriesModel.php index a27b36e..04f0a70 100644 --- a/admin/src/Model/CountriesModel.php +++ b/admin/src/Model/CountriesModel.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountriesModel.php @@ -421,6 +421,8 @@ class CountriesModel extends ListModel { $query->where('a.id IN (' . implode(',',$pks) . ')'); } + // Get global switch to activate text only export + $export_text_only = ComponentHelper::getParams('com_subformpower')->get('export_text_only', 0); // Implement View Level Access if (!$user->authorise('core.options', 'com_subformpower')) { diff --git a/admin/src/Model/CountryModel.php b/admin/src/Model/CountryModel.php index 76449b9..69e81b5 100644 --- a/admin/src/Model/CountryModel.php +++ b/admin/src/Model/CountryModel.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountryModel.php diff --git a/admin/src/Model/CurrenciesModel.php b/admin/src/Model/CurrenciesModel.php index 46914e4..6e45598 100644 --- a/admin/src/Model/CurrenciesModel.php +++ b/admin/src/Model/CurrenciesModel.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CurrenciesModel.php @@ -350,6 +350,16 @@ class CurrenciesModel extends ListModel { $query->where('a.id IN (' . implode(',',$pks) . ')'); } + // Get global switch to activate text only export + $export_text_only = ComponentHelper::getParams('com_subformpower')->get('export_text_only', 0); + // Add these queries only if text only is required + if ($export_text_only) + { + + // From the subformpower_country table. + $query->select($db->quoteName(['g.name','g.id'],['country','country_id'])); + $query->join('LEFT', $db->quoteName('#__subformpower_country', 'g') . ' ON (' . $db->quoteName('a.country') . ' = ' . $db->quoteName('g.guid') . ')'); + } // Implement View Level Access if (!$user->authorise('core.options', 'com_subformpower')) { diff --git a/admin/src/Model/CurrencyModel.php b/admin/src/Model/CurrencyModel.php index 52f528c..d127ab8 100644 --- a/admin/src/Model/CurrencyModel.php +++ b/admin/src/Model/CurrencyModel.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CurrencyModel.php @@ -70,7 +70,7 @@ class CurrencyModel extends AdminModel 'country' ), 'above' => array( - 'name' + 'ext_number' ) ) ); @@ -697,9 +697,9 @@ class CurrencyModel extends AdminModel } // Only for strings - if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name)) + if (UtilitiesStringHelper::check($this->table->ext_number) && !is_numeric($this->table->ext_number)) { - $this->table->name = $this->generateUnique('name',$this->table->name); + $this->table->ext_number = $this->generateUnique('ext_number',$this->table->ext_number); } // insert all set values diff --git a/admin/src/Model/ImportModel.php b/admin/src/Model/ImportModel.php index d385163..a17a3bc 100644 --- a/admin/src/Model/ImportModel.php +++ b/admin/src/Model/ImportModel.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage ImportModel.php @@ -21,8 +21,8 @@ namespace JCB\Component\Subformpower\Administrator\Model; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; -use Joomla\CMS\Filesystem\File; -use Joomla\CMS\Filesystem\Folder; +use Joomla\Filesystem\File; +use Joomla\Filesystem\Folder; use Joomla\CMS\Filesystem\Path; use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\Installer\InstallerHelper; diff --git a/admin/src/Model/SubformpowerModel.php b/admin/src/Model/SubformpowerModel.php index 5a871ca..b061519 100644 --- a/admin/src/Model/SubformpowerModel.php +++ b/admin/src/Model/SubformpowerModel.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage SubformpowerModel.php diff --git a/admin/src/Rule/GuidRule.php b/admin/src/Rule/GuidRule.php index a5d7e64..88e80ed 100644 --- a/admin/src/Rule/GuidRule.php +++ b/admin/src/Rule/GuidRule.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage GuidRule.php diff --git a/admin/src/Table/CountryTable.php b/admin/src/Table/CountryTable.php index 2ed5c1f..e21feea 100644 --- a/admin/src/Table/CountryTable.php +++ b/admin/src/Table/CountryTable.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CountryTable.php diff --git a/admin/src/Table/CurrencyTable.php b/admin/src/Table/CurrencyTable.php index 25be1a0..c411ad6 100644 --- a/admin/src/Table/CurrencyTable.php +++ b/admin/src/Table/CurrencyTable.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage CurrencyTable.php diff --git a/admin/src/View/Countries/HtmlView.php b/admin/src/View/Countries/HtmlView.php index 0e897df..1cf2be8 100644 --- a/admin/src/View/Countries/HtmlView.php +++ b/admin/src/View/Countries/HtmlView.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage HtmlView.php @@ -25,6 +25,7 @@ use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Form\FormHelper; use Joomla\CMS\Session\Session; use Joomla\CMS\Uri\Uri; +use Joomla\CMS\User\User; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\FileLayout; @@ -46,6 +47,62 @@ use JCB\Joomla\Utilities\StringHelper; */ class HtmlView extends BaseHtmlView { + /** + * The items from the model + * + * @var mixed + * @since 3.10.11 + */ + public mixed $items; + + /** + * The state object + * + * @var mixed + * @since 3.10.11 + */ + public mixed $state; + + /** + * The styles url array + * + * @var array + * @since 5.0.0 + */ + protected array $styles; + + /** + * The scripts url array + * + * @var array + * @since 5.0.0 + */ + protected array $scripts; + + /** + * The actions object + * + * @var object + * @since 3.10.11 + */ + public object $canDo; + + /** + * The return here base64 url + * + * @var string + * @since 3.10.11 + */ + public string $return_here; + + /** + * The user object. + * + * @var User + * @since 3.10.11 + */ + public User $user; + /** * Countries view display method * @@ -62,7 +119,7 @@ class HtmlView extends BaseHtmlView $this->state = $this->get('State'); $this->styles = $this->get('Styles'); $this->scripts = $this->get('Scripts'); - $this->user ??= Factory::getApplication()->getIdentity(); + $this->user ??= $this->getCurrentUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. diff --git a/admin/src/View/Country/HtmlView.php b/admin/src/View/Country/HtmlView.php index 36be57f..348e4ca 100644 --- a/admin/src/View/Country/HtmlView.php +++ b/admin/src/View/Country/HtmlView.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage HtmlView.php @@ -25,6 +25,7 @@ use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Form\FormHelper; use Joomla\CMS\Session\Session; use Joomla\CMS\Uri\Uri; +use Joomla\CMS\User\User; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\FileLayout; @@ -45,6 +46,86 @@ use JCB\Joomla\Utilities\StringHelper; */ class HtmlView extends BaseHtmlView { + /** + * The item from the model + * + * @var mixed + * @since 3.10.11 + */ + public mixed $item; + + /** + * The state object + * + * @var mixed + * @since 3.10.11 + */ + public mixed $state; + + /** + * The form from the model + * + * @var mixed + * @since 3.10.11 + */ + public mixed $form; + + /** + * The toolbar object + * + * @var Toolbar + * @since 3.10.11 + */ + public Toolbar $toolbar; + + /** + * The styles url array + * + * @var array + * @since 5.0.0 + */ + protected array $styles; + + /** + * The scripts url array + * + * @var array + * @since 5.0.0 + */ + protected array $scripts; + + /** + * The actions object + * + * @var object + * @since 3.10.11 + */ + public object $canDo; + + /** + * The origin referral view name + * + * @var string + * @since 3.10.11 + */ + public string $ref; + + /** + * The origin referral item id + * + * @var int + * @since 3.10.11 + */ + public int $refid; + + /** + * The referral url suffix values + * + * @var string + * @since 3.10.11 + */ + public string $referral; + /** * Country view display method * @@ -59,7 +140,7 @@ class HtmlView extends BaseHtmlView $this->params = ComponentHelper::getParams('com_subformpower'); $this->useCoreUI = true; // Assign the variables - $this->form = $this->get('Form'); + $this->form ??= $this->get('Form'); $this->item = $this->get('Item'); $this->styles = $this->get('Styles'); $this->scripts = $this->get('Scripts'); diff --git a/admin/src/View/Currencies/HtmlView.php b/admin/src/View/Currencies/HtmlView.php index 3c60f48..136cb31 100644 --- a/admin/src/View/Currencies/HtmlView.php +++ b/admin/src/View/Currencies/HtmlView.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage HtmlView.php @@ -25,6 +25,7 @@ use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Form\FormHelper; use Joomla\CMS\Session\Session; use Joomla\CMS\Uri\Uri; +use Joomla\CMS\User\User; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\FileLayout; @@ -46,6 +47,62 @@ use JCB\Joomla\Utilities\StringHelper; */ class HtmlView extends BaseHtmlView { + /** + * The items from the model + * + * @var mixed + * @since 3.10.11 + */ + public mixed $items; + + /** + * The state object + * + * @var mixed + * @since 3.10.11 + */ + public mixed $state; + + /** + * The styles url array + * + * @var array + * @since 5.0.0 + */ + protected array $styles; + + /** + * The scripts url array + * + * @var array + * @since 5.0.0 + */ + protected array $scripts; + + /** + * The actions object + * + * @var object + * @since 3.10.11 + */ + public object $canDo; + + /** + * The return here base64 url + * + * @var string + * @since 3.10.11 + */ + public string $return_here; + + /** + * The user object. + * + * @var User + * @since 3.10.11 + */ + public User $user; + /** * Currencies view display method * @@ -62,7 +119,7 @@ class HtmlView extends BaseHtmlView $this->state = $this->get('State'); $this->styles = $this->get('Styles'); $this->scripts = $this->get('Scripts'); - $this->user ??= Factory::getApplication()->getIdentity(); + $this->user ??= $this->getCurrentUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); // Load the active filters. diff --git a/admin/src/View/Currency/HtmlView.php b/admin/src/View/Currency/HtmlView.php index bba09a4..0387ecc 100644 --- a/admin/src/View/Currency/HtmlView.php +++ b/admin/src/View/Currency/HtmlView.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage HtmlView.php @@ -25,6 +25,7 @@ use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Form\FormHelper; use Joomla\CMS\Session\Session; use Joomla\CMS\Uri\Uri; +use Joomla\CMS\User\User; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\FileLayout; @@ -45,6 +46,86 @@ use JCB\Joomla\Utilities\StringHelper; */ class HtmlView extends BaseHtmlView { + /** + * The item from the model + * + * @var mixed + * @since 3.10.11 + */ + public mixed $item; + + /** + * The state object + * + * @var mixed + * @since 3.10.11 + */ + public mixed $state; + + /** + * The form from the model + * + * @var mixed + * @since 3.10.11 + */ + public mixed $form; + + /** + * The toolbar object + * + * @var Toolbar + * @since 3.10.11 + */ + public Toolbar $toolbar; + + /** + * The styles url array + * + * @var array + * @since 5.0.0 + */ + protected array $styles; + + /** + * The scripts url array + * + * @var array + * @since 5.0.0 + */ + protected array $scripts; + + /** + * The actions object + * + * @var object + * @since 3.10.11 + */ + public object $canDo; + + /** + * The origin referral view name + * + * @var string + * @since 3.10.11 + */ + public string $ref; + + /** + * The origin referral item id + * + * @var int + * @since 3.10.11 + */ + public int $refid; + + /** + * The referral url suffix values + * + * @var string + * @since 3.10.11 + */ + public string $referral; + /** * Currency view display method * @@ -59,7 +140,7 @@ class HtmlView extends BaseHtmlView $this->params = ComponentHelper::getParams('com_subformpower'); $this->useCoreUI = true; // Assign the variables - $this->form = $this->get('Form'); + $this->form ??= $this->get('Form'); $this->item = $this->get('Item'); $this->styles = $this->get('Styles'); $this->scripts = $this->get('Scripts'); diff --git a/admin/src/View/Import/HtmlView.php b/admin/src/View/Import/HtmlView.php index e712ae7..4fbac1a 100644 --- a/admin/src/View/Import/HtmlView.php +++ b/admin/src/View/Import/HtmlView.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage HtmlView.php diff --git a/admin/src/View/Subformpower/HtmlView.php b/admin/src/View/Subformpower/HtmlView.php index 8636e8d..bf76612 100644 --- a/admin/src/View/Subformpower/HtmlView.php +++ b/admin/src/View/Subformpower/HtmlView.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage HtmlView.php diff --git a/admin/tmpl/countries/default.php b/admin/tmpl/countries/default.php index 6f953bf..d7f42cb 100644 --- a/admin/tmpl/countries/default.php +++ b/admin/tmpl/countries/default.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default.php diff --git a/admin/tmpl/countries/default_body.php b/admin/tmpl/countries/default_body.php index 41d6fe1..961d8e6 100644 --- a/admin/tmpl/countries/default_body.php +++ b/admin/tmpl/countries/default_body.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_body.php diff --git a/admin/tmpl/countries/default_foot.php b/admin/tmpl/countries/default_foot.php index 2aeba24..155c165 100644 --- a/admin/tmpl/countries/default_foot.php +++ b/admin/tmpl/countries/default_foot.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_foot.php diff --git a/admin/tmpl/countries/default_head.php b/admin/tmpl/countries/default_head.php index 0f7914e..3b89d1c 100644 --- a/admin/tmpl/countries/default_head.php +++ b/admin/tmpl/countries/default_head.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_head.php diff --git a/admin/tmpl/countries/default_toolbar.php b/admin/tmpl/countries/default_toolbar.php index f68b60e..e46e632 100644 --- a/admin/tmpl/countries/default_toolbar.php +++ b/admin/tmpl/countries/default_toolbar.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_toolbar.php diff --git a/admin/tmpl/countries/emptystate.php b/admin/tmpl/countries/emptystate.php index c9879e9..7df10bc 100644 --- a/admin/tmpl/countries/emptystate.php +++ b/admin/tmpl/countries/emptystate.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage emptystate.php diff --git a/admin/tmpl/country/default.php b/admin/tmpl/country/default.php index 1023c82..f43e75d 100644 --- a/admin/tmpl/country/default.php +++ b/admin/tmpl/country/default.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default.php @@ -111,14 +111,10 @@ defined('_JEXEC') or die;
-
-
- form->getFieldset('accesscontrol') as $field): ?> -
- label; echo $field->input;?> -
-
- +
+ +
+ form->getInput('rules'); ?>
diff --git a/admin/tmpl/currencies/default.php b/admin/tmpl/currencies/default.php index 303ba20..a6341ae 100644 --- a/admin/tmpl/currencies/default.php +++ b/admin/tmpl/currencies/default.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default.php diff --git a/admin/tmpl/currencies/default_body.php b/admin/tmpl/currencies/default_body.php index 565b7f1..7207d45 100644 --- a/admin/tmpl/currencies/default_body.php +++ b/admin/tmpl/currencies/default_body.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_body.php @@ -76,12 +76,12 @@ $edit = "index.php?option=com_subformpower&view=currencies&task=currency.edit";
get('currency.edit')): ?> - escape($item->name); ?> + escape($item->ext_number); ?> checked_out): ?> name, $item->checked_out_time, 'currencies.', $canCheckin); ?> - escape($item->name); ?> + escape($item->ext_number); ?>
diff --git a/admin/tmpl/currencies/default_foot.php b/admin/tmpl/currencies/default_foot.php index c3f925f..93a4634 100644 --- a/admin/tmpl/currencies/default_foot.php +++ b/admin/tmpl/currencies/default_foot.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_foot.php diff --git a/admin/tmpl/currencies/default_head.php b/admin/tmpl/currencies/default_head.php index 8221d81..b586377 100644 --- a/admin/tmpl/currencies/default_head.php +++ b/admin/tmpl/currencies/default_head.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_head.php @@ -42,7 +42,7 @@ defined('_JEXEC') or die; - + listDirn, $this->listOrder); ?> diff --git a/admin/tmpl/currencies/default_toolbar.php b/admin/tmpl/currencies/default_toolbar.php index 2c980c6..8880f21 100644 --- a/admin/tmpl/currencies/default_toolbar.php +++ b/admin/tmpl/currencies/default_toolbar.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_toolbar.php diff --git a/admin/tmpl/currencies/emptystate.php b/admin/tmpl/currencies/emptystate.php index 502bceb..f6b6c5e 100644 --- a/admin/tmpl/currencies/emptystate.php +++ b/admin/tmpl/currencies/emptystate.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage emptystate.php diff --git a/admin/tmpl/currency/default.php b/admin/tmpl/currency/default.php index 0b16d21..f6f0a66 100644 --- a/admin/tmpl/currency/default.php +++ b/admin/tmpl/currency/default.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default.php @@ -89,14 +89,10 @@ defined('_JEXEC') or die;
-
-
- form->getFieldset('accesscontrol') as $field): ?> -
- label; echo $field->input;?> -
-
- +
+ +
+ form->getInput('rules'); ?>
diff --git a/admin/tmpl/import/default.php b/admin/tmpl/import/default.php index 6b7e3fc..7b2233e 100644 --- a/admin/tmpl/import/default.php +++ b/admin/tmpl/import/default.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default.php diff --git a/admin/tmpl/subformpower/default.php b/admin/tmpl/subformpower/default.php index 9fe057b..37e8283 100644 --- a/admin/tmpl/subformpower/default.php +++ b/admin/tmpl/subformpower/default.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default.php diff --git a/admin/tmpl/subformpower/default_main.php b/admin/tmpl/subformpower/default_main.php index 257125b..411aba7 100644 --- a/admin/tmpl/subformpower/default_main.php +++ b/admin/tmpl/subformpower/default_main.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_main.php diff --git a/admin/tmpl/subformpower/default_vdm.php b/admin/tmpl/subformpower/default_vdm.php index 023a47b..7cb657a 100644 --- a/admin/tmpl/subformpower/default_vdm.php +++ b/admin/tmpl/subformpower/default_vdm.php @@ -3,8 +3,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage default_vdm.php diff --git a/libraries/jcb_powers/JCB.Joomla/src/Data/MultiSubform.php b/libraries/jcb_powers/JCB.Joomla/src/Data/MultiSubform.php index 4821190..5399cd0 100644 --- a/libraries/jcb_powers/JCB.Joomla/src/Data/MultiSubform.php +++ b/libraries/jcb_powers/JCB.Joomla/src/Data/MultiSubform.php @@ -46,7 +46,7 @@ final class MultiSubform implements MultiSubformInterface /** * Get a subform items * - * @param array $getMap The the map to get the subfrom data + * @param array $getMap The map to get the subfrom data * * Example: * $getMap = [ @@ -94,8 +94,8 @@ final class MultiSubform implements MultiSubformInterface /** * Set a subform items * - * @param array $items The list of items from the subform to set - * @param array $setMap The the map to set the subfrom data + * @param mixed $items The list of items from the subform to set + * @param array $setMap The map to set the subfrom data * * Example: * $items, @@ -117,7 +117,7 @@ final class MultiSubform implements MultiSubformInterface * @return bool * @since 3.2.2 */ - public function set(array $items, array $setMap): bool + public function set(mixed $items, array $setMap): bool { // Validate the core map presence and structure if (!isset($setMap['_core']) || !is_array($setMap['_core']) || !$this->validSetMap($setMap['_core'])) @@ -125,6 +125,12 @@ final class MultiSubform implements MultiSubformInterface return false; } + // catch an empty set + if (!is_array($items)) + { + $items = []; // will delete all existing linked items :( not ideal, but real + } + // Save the core data if (!$this->setSubformData($items, $setMap['_core'])) { @@ -167,7 +173,7 @@ final class MultiSubform implements MultiSubformInterface * Set data based on provided map configuration. * * @param array $items The list of items from the subform to set - * @param array $map The the map to set the subfrom data + * @param array $map The map to set the subfrom data * @param array|null $coreData The core data to be appended with subform data * * @return bool diff --git a/libraries/jcb_powers/JCB.Joomla/src/Data/Subform.php b/libraries/jcb_powers/JCB.Joomla/src/Data/Subform.php index 284d3a9..e4f7f7e 100644 --- a/libraries/jcb_powers/JCB.Joomla/src/Data/Subform.php +++ b/libraries/jcb_powers/JCB.Joomla/src/Data/Subform.php @@ -94,7 +94,7 @@ final class Subform implements SubformInterface /** * Set a subform items * - * @param array $items The list of items from the subform to set + * @param mixed $items The list of items from the subform to set * @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete. * @param string $linkKey The link key on which the items where linked in the child table. * @param string $linkValue The value of the link key in child table. @@ -102,12 +102,17 @@ final class Subform implements SubformInterface * @return bool * @since 3.2.2 */ - public function set(array $items, string $indexKey, string $linkKey, string $linkValue): bool + public function set(mixed $items, string $indexKey, string $linkKey, string $linkValue): bool { $items = $this->process($items, $indexKey, $linkKey, $linkValue); $this->purge($items, $indexKey, $linkKey, $linkValue); + if (empty($items)) + { + return true; // nothing to set (already purged) + } + return $this->items->table($this->getTable())->set( $items, $indexKey ); @@ -142,10 +147,19 @@ final class Subform implements SubformInterface if ($currentIndexValues !== null) { - // Extract the index values from the items array - $activeIndexValues = array_values(array_map(function($item) use ($indexKey) { - return $item[$indexKey] ?? null; - }, $items)); + // Check if the items array is empty + if (empty($items)) + { + // Set activeIndexValues to an empty array if items is empty + $activeIndexValues = []; + } + else + { + // Extract the index values from the items array + $activeIndexValues = array_values(array_map(function($item) use ($indexKey) { + return $item[$indexKey] ?? null; + }, $items)); + } // Find the index values that are no longer in the items array $inactiveIndexValues = array_diff($currentIndexValues, $activeIndexValues); @@ -205,7 +219,7 @@ final class Subform implements SubformInterface /** * Processes an array of arrays based on the specified key. * - * @param array $items Array of arrays to be processed. + * @param mixed $items Array of arrays to be processed. * @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete * @param string $linkKey The link key on which the items where linked in the child table. * @param string $linkValue The value of the link key in child table. @@ -213,8 +227,9 @@ final class Subform implements SubformInterface * @return array The processed array of arrays. * @since 3.2.2 */ - private function process(array $items, string $indexKey, string $linkKey, string $linkValue): array + private function process($items, string $indexKey, string $linkKey, string $linkValue): array { + $items = is_array($items) ? $items : []; foreach ($items as &$item) { $value = $item[$indexKey] ?? ''; diff --git a/libraries/jcb_powers/JCB.Joomla/src/Interfaces/Data/MultiSubformInterface.php b/libraries/jcb_powers/JCB.Joomla/src/Interfaces/Data/MultiSubformInterface.php index 1d6b9a8..1df7f7b 100644 --- a/libraries/jcb_powers/JCB.Joomla/src/Interfaces/Data/MultiSubformInterface.php +++ b/libraries/jcb_powers/JCB.Joomla/src/Interfaces/Data/MultiSubformInterface.php @@ -49,7 +49,7 @@ interface MultiSubformInterface /** * Set a subform items * - * @param array $items The list of items from the subform to set + * @param mixed $items The list of items from the subform to set * @param array $setMap The the map to set the subfrom data * * Example: @@ -72,6 +72,6 @@ interface MultiSubformInterface * @return bool * @since 3.2.2 */ - public function set(array $items, array $setMap): bool; + public function set(mixed $items, array $setMap): bool; } diff --git a/libraries/jcb_powers/JCB.Joomla/src/Interfaces/Data/SubformInterface.php b/libraries/jcb_powers/JCB.Joomla/src/Interfaces/Data/SubformInterface.php index f6a25ea..ac8f8a1 100644 --- a/libraries/jcb_powers/JCB.Joomla/src/Interfaces/Data/SubformInterface.php +++ b/libraries/jcb_powers/JCB.Joomla/src/Interfaces/Data/SubformInterface.php @@ -35,17 +35,17 @@ interface SubformInterface * @param string $linkValue The value of the link key in child table. * @param string $linkKey The link key on which the items where linked in the child table. * @param string $field The parent field name of the subform in the parent view. - * @param array $set The array SET of the keys of each row in the subform. + * @param array $get The array SET of the keys of each row in the subform. * * @return array|null The subform * @since 3.2.2 */ - public function get(string $linkValue, string $linkKey, string $field, array $set): ?array; + public function get(string $linkValue, string $linkKey, string $field, array $get): ?array; /** * Set a subform items * - * @param array $items The list of items from the subform to set + * @param mixed $items The list of items from the subform to set * @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete. * @param string $linkKey The link key on which the items where linked in the child table. * @param string $linkValue The value of the link key in child table. @@ -53,7 +53,7 @@ interface SubformInterface * @return bool * @since 3.2.2 */ - public function set(array $items, string $indexKey, string $linkKey, string $linkValue): bool; + public function set(mixed $items, string $indexKey, string $linkKey, string $linkValue): bool; /** * Get the current active table diff --git a/libraries/jcb_powers/JCB.Joomla/src/Subformpower/Table.php b/libraries/jcb_powers/JCB.Joomla/src/Subformpower/Table.php index b2c218a..d00efcf 100644 --- a/libraries/jcb_powers/JCB.Joomla/src/Subformpower/Table.php +++ b/libraries/jcb_powers/JCB.Joomla/src/Subformpower/Table.php @@ -159,17 +159,17 @@ final class Table extends BaseTable implements Tableinterface ], ], 'currency' => [ - 'name' => [ - 'name' => 'name', - 'label' => 'COM_SUBFORMPOWER_CURRENCY_NAME_LABEL', - 'type' => 'text', + 'ext_number' => [ + 'name' => 'ext_number', + 'label' => 'COM_SUBFORMPOWER_CURRENCY_EXT_NUMBER_LABEL', + 'type' => 'number', 'title' => true, 'list' => 'currencies', 'store' => NULL, 'tab_name' => 'Details', 'db' => [ - 'type' => 'VARCHAR(255)', - 'default' => '', + 'type' => 'INT(10)', + 'default' => '0', 'null_switch' => 'NOT NULL', 'unique_key' => false, 'key' => true, diff --git a/media/js/country.js b/media/js/country.js index 3fc7e39..acaffda 100644 --- a/media/js/country.js +++ b/media/js/country.js @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage country.js diff --git a/media/js/currency.js b/media/js/currency.js index 2805b16..dcfe6a5 100644 --- a/media/js/currency.js +++ b/media/js/currency.js @@ -2,8 +2,8 @@ Nampharm /-------------------------------------------------------------------------------------------------------/ - @version 1.0.0 - @build 28th June, 2024 + @version 1.0.1 + @build 20th August, 2024 @created 24th May, 2024 @package Subform Power @subpackage currency.js diff --git a/subformpower.xml b/subformpower.xml index 082419d..e1a4b35 100644 --- a/subformpower.xml +++ b/subformpower.xml @@ -1,15 +1,15 @@ COM_SUBFORMPOWER - 28th June, 2024 + 20th August, 2024 Oh Martin oh@nampharm.com.na https://nampharm.com.na Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 1.0.0 + 1.0.1 Subform Power (v.1.0.0) +

Subform Power (v.1.0.1)

Demonstration of subform super power

Created by Oh Martin
Development started 24th May, 2024