Skip to content

Commit

Permalink
Avoid multiple relations saving on non save tasks. Fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
f-liva committed Nov 22, 2014
1 parent e89a137 commit ffe721a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/lib_f0f-nnrelation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<authorUrl>http://www.federicoliva.info</authorUrl>
<copyright>(C) 2014 Federico Liva</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>1.1.0</version>
<version>1.1.1</version>
<packager>Federico Liva</packager>
<packagerurl>https://www.federicoliva.info</packagerurl>

Expand Down
6 changes: 6 additions & 0 deletions library/tables/nnrelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public function onAfterStore(&$table)
$key = $table->getConfigProviderKey() . '.relations';
$relations = $table->getConfigProvider()->get($key, array());

// Abandon the process if not a save task
if (!in_array($input->getWord('task'), array('apply', 'save', 'savenew')))
{
return true;
}

// For each relation check relative field
foreach ($relations as $relation)
{
Expand Down

0 comments on commit ffe721a

Please sign in to comment.