Ignore:
Timestamp:
Jan 7, 2014, 4:40:51 PM (11 years ago)
Author:
maron
Message:
  • Fixed: Update LastImport only if is imported version higher then all ready imported
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Import/Import.php

    r720 r723  
    230230          }
    231231          $Output .= '<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />';
    232           $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
     232          $this->UpdateLastVersion();
    233233        }
    234234        // else $Output .= ShowMessage('Již importován pro verzi '.$this->Version['Version'], MESSAGE_CRITICAL);
     
    387387      }   
    388388      $Output .= '<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />';
    389       $System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
     389      $this->UpdateLastVersion();
    390390    }
    391391    $Output .= '<strong>Dokončeno.</strong>';
     
    520520    }
    521521    $Output = '<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />';
    522     $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
     522    $this->UpdateLastVersion();
    523523    return($Output);
    524524  }
     525  function UpdateLastVersion() {
     526    $DbResult = $this->System->Database->query('SELECT * FROM `Group` WHERE `Id`='.$this->Group['Id']);
     527    $Version = $DbResult->fetch_assoc(); 
     528    if ($Version['LastVersion'] < $this->Version['BuildNumber'])
     529      $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
     530  }
    525531}
Note: See TracChangeset for help on using the changeset viewer.