From 42d5b3b55c7a3974d9cafbafd486b3a7e5c44ded Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 16 May 2019 01:07:38 +0200 Subject: [PATCH] Added the feature that loads the company global values when creating a new component, if they are set. --- README.md | 2 +- admin/README.txt | 2 +- admin/models/joomla_component.php | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3da9b4583..9c6490ec9 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ TODO + *Version*: 2.9.18 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **206374** ++ *Line count*: **206387** + *Field count*: **1136** + *File count*: **1344** + *Folder count*: **209** diff --git a/admin/README.txt b/admin/README.txt index 3da9b4583..9c6490ec9 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -150,7 +150,7 @@ TODO + *Version*: 2.9.18 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **206374** ++ *Line count*: **206387** + *Field count*: **1136** + *File count*: **1344** + *Folder count*: **209** diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index 5900dd346..e79d0f450 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -407,7 +407,20 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); } } - + + // Only load these values if no id is found + if (0 == $id) + { + // get components global params + $params = JComponentHelper::getParams('com_componentbuilder'); + // set company defaults + $form->setValue('companyname', null, $params->get('export_company', '')); + $form->setValue('author', null, $params->get('export_owner', '')); + $form->setValue('email', null, $params->get('export_email', '')); + $form->setValue('website', null, $params->get('export_website', '')); + $form->setValue('copyright', null, $params->get('export_copyright', 'Copyright (C) 2015. All Rights Reserved')); + $form->setValue('license', null, $params->get('export_license', 'GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html')); + } return $form; }