Skip to content

Commit

Permalink
Merge pull request #200 from infograf768/lang_save_id_client
Browse files Browse the repository at this point in the history
Solving issues with new language save
  • Loading branch information
infograf768 committed Aug 23, 2014
2 parents 8f1eeea + a2990fe commit 14c5004
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
11 changes: 3 additions & 8 deletions component/admin/controllers/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,16 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
$input = JFactory::getApplication()->input;
$client = $input->get('client', '');

if (empty($client))
{
$select = $input->get('filters', array(), 'array');
$client = isset($select['select']['client']) ? $select['select']['client'] : 'site';
}

if (empty($client))
{
$data = $input->get('jform', array(), 'array');
$client = isset($data['client']) ? $data['client'] : 'site';
$client = $data['client'];
}

if (empty($client))
{
$client = 'site';
$select = $input->get('filters', array(), 'array');
$client = isset($select['select']['client']) ? $select['select']['client'] : 'site';
}

$tag = $input->get('tag', '');
Expand Down
10 changes: 10 additions & 0 deletions component/admin/models/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ public function getForm($data = array(), $loadData = true)
// Get the form.
$form = $this->loadForm('com_localise.language', 'language', array('control' => 'jform', 'load_data' => $loadData));

// Make Client field readonly when the file exists
if ($this->getState('language.id'))
{
$form->setFieldAttribute('client', 'readonly', 'true');
}

return $form;
}

Expand Down Expand Up @@ -371,6 +377,10 @@ public function save($data = array())
}

$id = LocaliseHelper::getFileId($path);

// Dummy call to populate state
$this->getState('language.id');

$this->setState('language.id', $id);

// Bind the rules.
Expand Down

0 comments on commit 14c5004

Please sign in to comment.