first commit
This commit is contained in:
320
apps/backend/modules/stMigration/actions/actions.class.php
Normal file
320
apps/backend/modules/stMigration/actions/actions.class.php
Normal file
@@ -0,0 +1,320 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SOTESHOP/stMigration
|
||||
*
|
||||
* Ten plik należy do aplikacji stMigration opartej na licencji (Professional License SOTE).
|
||||
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
|
||||
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
|
||||
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
|
||||
*
|
||||
* @package stMigration
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: actions.class.php 1417 2009-05-27 10:01:46Z marcin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Akcja aplikacji stMigration
|
||||
*
|
||||
* @author Marcin Butlak <marcin.butlak@sote.pl>
|
||||
* @package stMigration
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stMigrationActions extends stAdminGeneratorActions
|
||||
{
|
||||
|
||||
public function executeProcess()
|
||||
{
|
||||
$erase_count = 0;
|
||||
|
||||
$migration = $this->getRequestParameter('migration');
|
||||
|
||||
$this->forward404Unless($migration, 'Brak danych migracyjnych...');
|
||||
|
||||
list($plugin, $migrationType) = explode(':', $migration['type']);
|
||||
|
||||
$migrations = stMigration::getConfiguration($plugin, $migrationType);
|
||||
|
||||
stMigrationProgressBar::cleanSession();
|
||||
|
||||
$this->getUser()->setAttribute('database', $migration, 'soteshop/stMigrationProgressBar');
|
||||
|
||||
$this->getUser()->setAttribute('migration', $migrations, 'soteshop/stMigrationProgressBar');
|
||||
|
||||
$record_count = $this->getUser()->getAttribute('all_data_count', 0, 'soteshop/stMigrationProgressBar');
|
||||
|
||||
if (!$record_count)
|
||||
{
|
||||
$data_retriever = stMigrationDataRetriever::getInstance($migration);
|
||||
|
||||
$record_count = 0;
|
||||
|
||||
if (isset($migrations['migration']['_attributes']['imports']))
|
||||
{
|
||||
foreach ($migrations['migration']['_attributes']['imports'] as $import)
|
||||
{
|
||||
if (!isset($migrations['migration'][$import]))
|
||||
{
|
||||
$definions = array_keys($migrations['migration']);
|
||||
|
||||
unset($definions[0]);
|
||||
|
||||
throw new sfException(sprintf('Brak definicji importu migration.%s. Dostępne definicje: "%s"', $import, implode(', ', $definions)));
|
||||
}
|
||||
|
||||
$source = $migrations['migration'][$import]['params']['source'];
|
||||
|
||||
$record_count += $data_retriever->countAllRecords(isset($source['count_query']) ? $source['count_query'] : $source['query']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($migrations['migration'] as $config)
|
||||
{
|
||||
$source = $config['params']['source'];
|
||||
$record_count += $data_retriever->countAllRecords(isset($source['count_query']) ? $source['count_query'] : $source['query']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($migration['erase_data']))
|
||||
{
|
||||
$cleanup = array();
|
||||
|
||||
if (isset($migrations['migration']['_attributes']['cleanup']))
|
||||
{
|
||||
$cleanup = $migrations['migration']['_attributes']['cleanup'];
|
||||
}
|
||||
elseif (isset($migrations['cleanup']))
|
||||
{
|
||||
$cleanup = $migrations['cleanup'];
|
||||
}
|
||||
|
||||
foreach ($cleanup as $modelName)
|
||||
{
|
||||
$c = new Criteria();
|
||||
|
||||
if ($modelName == 'sfGuardUser')
|
||||
{
|
||||
$c->addJoin(sfGuardUserGroupPeer::USER_ID, sfGuardUserPeer::ID);
|
||||
|
||||
$c->addJoin(sfGuardUserGroupPeer::GROUP_ID, sfGuardGroupPeer::ID);
|
||||
|
||||
$c->add(sfGuardGroupPeer::NAME, 'user');
|
||||
}
|
||||
elseif ($modelName == 'sfAsset')
|
||||
{
|
||||
$c->add(sfAssetPeer::FILENAME, 'no_image.png', Criteria::NOT_LIKE);
|
||||
}
|
||||
elseif ($modelName == 'sfAssetFolder')
|
||||
{
|
||||
|
||||
$criterion = $c->getNewCriterion(sfAssetFolderPeer::NAME, 'media', Criteria::NOT_LIKE);
|
||||
|
||||
$criterion->addAnd($c->getNewCriterion(sfAssetFolderPeer::NAME, 'products', Criteria::NOT_LIKE));
|
||||
|
||||
$criterion->addAnd($c->getNewCriterion(sfAssetFolderPeer::NAME, 'categories', Criteria::NOT_LIKE));
|
||||
|
||||
$criterion->addAnd($c->getNewCriterion(sfAssetFolderPeer::NAME, 'shares', Criteria::NOT_LIKE));
|
||||
|
||||
$c->addDescendingOrderByColumn(sfAssetFolderPeer::RELATIVE_PATH);
|
||||
|
||||
$c->add($criterion);
|
||||
}
|
||||
elseif ($modelName == 'Category')
|
||||
{
|
||||
$c->add(CategoryPeer::PARENT_ID, null, Criteria::ISNULL);
|
||||
}
|
||||
elseif ($modelName == 'ProductOptionsValue')
|
||||
{
|
||||
$c->add(ProductOptionsValuePeer::PRODUCT_OPTIONS_VALUE_ID, null, Criteria::ISNULL);
|
||||
}
|
||||
|
||||
$erase_count += call_user_func($modelName . 'Peer::doCount', $c);
|
||||
}
|
||||
|
||||
$this->getUser()->setAttribute('cleanList', $cleanup, 'soteshop/stMigrationProgressBar');
|
||||
|
||||
$this->getUser()->setAttribute('cleanList-count', $erase_count, 'soteshop/stMigrationProgressBar');
|
||||
|
||||
$this->action = "cleanup";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->action = "process";
|
||||
}
|
||||
|
||||
$this->record_count = $record_count + $erase_count;
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
$this->getBreadcrumbs()->add($i18n->__('Konfiguracja'));
|
||||
}
|
||||
|
||||
public function executeIndex()
|
||||
{
|
||||
$this->getLabels();
|
||||
|
||||
$plugins = stMigration::getRegisteredPlugins();
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
$migration_options = array();
|
||||
|
||||
foreach ($plugins as $plugin => $config)
|
||||
{
|
||||
foreach ($config['migrations'] as $migration => $title)
|
||||
{
|
||||
$migration_options[$plugin . ':' . $migration] = $i18n->__($title);
|
||||
}
|
||||
}
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
$this->getBreadcrumbs()->add($i18n->__('Konfiguracja'));
|
||||
|
||||
$this->migration_options = $migration_options;
|
||||
}
|
||||
|
||||
public function handleErrorProcess()
|
||||
{
|
||||
|
||||
return $this->forward('stMigration', 'index');
|
||||
}
|
||||
|
||||
public function validateProcess()
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), $this->getModuleName());
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
$return = true;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
$migration = $this->getRequestParameter('migration');
|
||||
|
||||
$data_retriever = stMigrationDataRetriever::getInstance($migration);
|
||||
|
||||
|
||||
if ($migration['woo_prefix']==""){
|
||||
|
||||
$error_info = $i18n->__('Brak prefixu bazy danych');
|
||||
$error = sprintf($error_info, $migration['woo_prefix']);
|
||||
$this->getRequest()->setError('database_connection', $error);
|
||||
$this->getRequest()->setError('migration{woo_prefix}', $error);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
$data_retriever->getDatabaseConnection();
|
||||
|
||||
|
||||
|
||||
try {
|
||||
|
||||
$query = "SELECT * FROM ".$migration['woo_prefix']."posts";
|
||||
|
||||
$data = $data_retriever->getDatabaseConnection();
|
||||
|
||||
$stm = $data->prepareStatement($query);
|
||||
|
||||
$result = $stm->executeQuery();
|
||||
|
||||
|
||||
} catch(Exception $e) {
|
||||
|
||||
$error_info = $i18n->__('Zły prefix bazy danych');
|
||||
$error = sprintf($error_info, $migration['woo_prefix']);
|
||||
|
||||
$error_db = $i18n->__('Zweryfikuj podane dane dostępowe.');
|
||||
|
||||
$this->getRequest()->setError('database_connection', $error_db);
|
||||
$this->getRequest()->setError('migration{woo_prefix}', $error);
|
||||
|
||||
$return = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (sfDatabaseException $e)
|
||||
{
|
||||
if (strpos($e->getMessage(), 'connect failed') !== false)
|
||||
{
|
||||
$ip_addr = gethostbyname($this->getRequest()->getHost());
|
||||
|
||||
$error = $i18n->__('Zweryfikuj podane dane dostępowe.');
|
||||
$error_info = $i18n->__('Jeżeli dane są prawidłowe skontaktuj się z administratorem serwera "%s", na którym znajduje się importowany sklep i poproś aby umożliwił dostęp do bazy danych o nazwie "%s" na adres IP "%s" dla użytkownika "%s"');
|
||||
|
||||
if ($migration['host'] != 'localhost')
|
||||
{
|
||||
$error .= sprintf($error_info, $migration['host'], $migration['database'], $ip_addr, $migration['username']);
|
||||
}
|
||||
}
|
||||
elseif (strpos($e->getMessage(), 'no such database') !== false)
|
||||
{
|
||||
$error_info = $i18n->__('Baza danych "%s" nie istnieje');
|
||||
$error = sprintf($error_info, $migration['database']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
|
||||
$this->getRequest()->setError('database_connection', $error);
|
||||
|
||||
$return = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!is_numeric($migration['woo_tax'])){
|
||||
|
||||
$error_info = $i18n->__('Pole musi zawierać wartość numeryczną');
|
||||
$error = sprintf($error_info, $migration['woo_tax']);
|
||||
$this->getRequest()->setError('database_connection', $error);
|
||||
$this->getRequest()->setError('migration{woo_tax}', $error);
|
||||
|
||||
$return = false;
|
||||
}
|
||||
|
||||
if ($migration['woo_tax']==""){
|
||||
|
||||
$error_info = $i18n->__('Brak stawki VAT');
|
||||
$error = sprintf($error_info, $migration['woo_tax']);
|
||||
$this->getRequest()->setError('database_connection', $error);
|
||||
$this->getRequest()->setError('migration{woo_tax}', $error);
|
||||
|
||||
$return = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function getLabels()
|
||||
{
|
||||
$this->labels = array('migration{erase_data}' => 'Usuń dane', 'migration{www}' => 'Adres sklepu', 'migration{database}' => 'Baza danych', 'migration{type}' => 'Importuj z', 'migration{host}' => 'Host', 'migration{port}' => 'Port', 'migration{username}' => 'Nazwa użytkownika', 'migration{password}' => 'Hasło', 'database_connection' => 'Połączenie z bazą danych', 'migration{woo_prefix}' => 'Prefix bazy Wordpress', 'migration{woo_tax}' => 'Stawka VAT', 'migration{woo_photo}' => 'Przenieś zdjęcia');
|
||||
}
|
||||
|
||||
protected function getBreadcrumbs(){
|
||||
if (null === $this->breadcrumbs)
|
||||
{
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
$this->breadcrumbs = parent::getBreadcrumbs();
|
||||
$this->breadcrumbs->add($i18n->__('Migracja danych'), '@stMigration');
|
||||
}
|
||||
|
||||
return $this->breadcrumbs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class stMigrationComponents extends sfComponents
|
||||
{
|
||||
|
||||
public function executeListMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
26
apps/backend/modules/stMigration/config/config.php
Normal file
26
apps/backend/modules/stMigration/config/config.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stMigration
|
||||
*
|
||||
* Ten plik należy do aplikacji stMigration opartej na licencji (Professional License SOTE).
|
||||
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
|
||||
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
|
||||
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
|
||||
*
|
||||
* @package stMigration
|
||||
* @subpackage configs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: config.php 617 2009-04-09 13:02:31Z michal $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Konfiguracja aplikacji stMigration
|
||||
*
|
||||
* @author Marcin Butlak <marcin.butlak@sote.pl>
|
||||
* @package stMigration
|
||||
* @subpackage configs
|
||||
*/
|
||||
stPluginHelper::addRouting('stMigration', '/migration/:action/*', 'stMigration', null, 'backend');
|
||||
stPluginHelper::addRouting('stMigrationDefault', '/migration', 'stMigration', 'index', 'backend');
|
||||
?>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stMigration
|
||||
*
|
||||
* Ten plik należy do aplikacji stMigration opartej na licencji (Professional License SOTE).
|
||||
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
|
||||
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
|
||||
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
|
||||
*
|
||||
* @package stMigration
|
||||
* @subpackage libs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: stUrlValidator.class.php 617 2009-04-09 13:02:31Z michal $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Walidacja aplikacji stMigration
|
||||
*
|
||||
* @author Marcin Butlak <marcin.butlak@sote.pl>
|
||||
* @package stMigration
|
||||
* @subpackage libs
|
||||
*/
|
||||
class stUrlValidator extends sfUrlValidator
|
||||
{
|
||||
public function execute(&$value, &$error)
|
||||
{
|
||||
if (!parent::execute($value, $error))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$b = new sfWebBrowser();
|
||||
|
||||
$exists = true;
|
||||
|
||||
try
|
||||
{
|
||||
$response = $b->get($value);
|
||||
|
||||
$exists = $response->getResponseCode() == 200;
|
||||
|
||||
if (!$exists && sfConfig::get('sf_debug'))
|
||||
{
|
||||
$logger = sfLogger::getInstance();
|
||||
$logger->err('{stUrlValidator} '.$b->getResponseText());
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
if (sfConfig::get('sf_debug'))
|
||||
{
|
||||
$logger = sfLogger::getInstance();
|
||||
$logger->err('{stUrlValidator} '.$e->getMessage());
|
||||
}
|
||||
|
||||
$exists = false;
|
||||
}
|
||||
|
||||
if (!$exists)
|
||||
{
|
||||
$error = $this->getParameterHolder()->get('domain_error');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function initialize($context, $parameters = null)
|
||||
{
|
||||
parent::initialize($context, $parameters);
|
||||
|
||||
$this->getParameterHolder()->set('domain_error', 'Podany adres nie istnieje');
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php if ($sf_request->hasErrors()): ?>
|
||||
<div class="form-errors" style="margin: 10px;">
|
||||
<h2>
|
||||
<span class="svg-icon svg-icon-error" style="-webkit-mask-image: url(/images/backend/icons/svg/error.svg?v=2); mask-image: url(/images/backend/icons/svg/error.svg?v=2); " title=""></span>
|
||||
<?php echo __('Popraw dane w formularzu.', null, 'stAdminGeneratorPlugin') ?>
|
||||
</h2>
|
||||
<dl>
|
||||
<?php foreach ($sf_request->getErrorNames() as $name): ?>
|
||||
<dt><?php echo __($labels[$name]) ?></dt>
|
||||
<dd><?php echo $sf_request->getError($name) ?></dd>
|
||||
<?php endforeach; ?>
|
||||
</dl>
|
||||
</div>
|
||||
<?php elseif ($sf_flash->has('notice')): ?>
|
||||
<div class="save-ok" style="margin: 10px;">
|
||||
<h2><?php echo __($sf_flash->get('notice')) ?></h2>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($sf_flash->has('warning')): ?>
|
||||
<div class="form-errors" style="margin: 10px;">
|
||||
<h2><?php echo __($sf_flash->get('warning')) ?></h2>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
19
apps/backend/modules/stMigration/templates/_listMenu.php
Normal file
19
apps/backend/modules/stMigration/templates/_listMenu.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<div class="list-menu">
|
||||
<ul>
|
||||
|
||||
<li class="selected">
|
||||
<?php echo link_to(__('Konfiguracja'),'stMigration/index')?>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<?php if (sfContext::getInstance()->getUser()->getCulture() == 'pl_PL'): ?>
|
||||
<a href="https://www.sote.pl/docs/migacja_danych" target="_blank"><?php echo __('Dokumentacja'); ?></a>
|
||||
<?php else: ?>
|
||||
<a href="https://www.soteshop.com/docs/data_migration" target="_blank"><?php echo __('Documentation'); ?></a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="clr"></div>
|
||||
203
apps/backend/modules/stMigration/templates/indexSuccess.php
Normal file
203
apps/backend/modules/stMigration/templates/indexSuccess.php
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php use_helper('Form', 'Validation', 'I18N', 'stAdminGenerator') ?>
|
||||
|
||||
<?php echo st_get_admin_head('stMigration', __('Konfiguracja'), __('Import danych z zewnętrznych systemów')) ?>
|
||||
<div id="sf_admin_content" class="admin-content-edit">
|
||||
|
||||
<?php st_view_slot_start('application-menu') ?>
|
||||
<?php st_include_component('stMigration', 'listMenu') ?>
|
||||
<?php st_view_slot_end() ?>
|
||||
|
||||
<?php st_include_partial('stMigration/index_messages', array('labels' => $labels)) ?>
|
||||
|
||||
<?php echo form_tag('stMigration/process', array('id' => 'admin_config_form', 'name' => 'admin_config_form', 'class' => 'admin_form'));?>
|
||||
<fieldset>
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[type]', __($labels['migration{type}'])) ?>
|
||||
<div class="field<?php if ($sf_request->hasError('migration{type}')): ?> form-error<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{type}')): ?>
|
||||
<?php echo form_error('migration{type}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo select_tag('migration[type]', options_for_select($migration_options, $sf_request->getParameter('migration[type]'))) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[www]', __($labels['migration{www}']) . "<a href='#'' class='help' title='" . __('Adres www przenoszonego sklepu') . "'></a>", 'class="required"') ?>
|
||||
<div class="field<?php if ($sf_request->hasError('migration{www}')): ?> form-error<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{www}')): ?>
|
||||
<?php echo form_error('migration{www}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('migration[www]', $sf_request->getParameter('migration[www]', 'https://'), array('size' => 31)); ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[erase_data]', __($labels['migration{erase_data}']) . "<a href='#'' class='help' title='" . __('Dotychczasowe dane w sklepie w nowej wersji zostaną skasowane przed rozpoczęciem migracji.') . "'></a>") ?>
|
||||
|
||||
<div class="field<?php if ($sf_request->hasError('migration{erase_data}')): ?> form-error<?php endif; ?> checkbox">
|
||||
<?php if ($sf_request->hasError('migration{erase_data}')): ?>
|
||||
<?php echo form_error('migration{erase_data}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo st_admin_checkbox_tag('migration[erase_data]', true, $sf_request->getParameter('migration[erase_data]')) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<h2><?php echo __('Baza danych przenoszonego sklepu');?></h2>
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[host]', __($labels['migration{host}']), 'class="required"') ?>
|
||||
<div class="field<?php if ($sf_request->hasError('migration{host}')): ?> form-error<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{host}')): ?>
|
||||
<?php echo form_error('migration{host}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('migration[host]', $sf_request->getParameter('migration[host]', 'localhost'), array('size' => 31)) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[port]', __($labels['migration{port}']), 'class="required"') ?>
|
||||
<div class="field <?php if ($sf_request->hasError('migration{port}')): ?> form-error<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{port}')): ?>
|
||||
<?php echo form_error('migration{port}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('migration[port]', $sf_request->getParameter('migration[port]', 3306), 'size=5') ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[database]', __($labels['migration{database}']), 'class="required"') ?>
|
||||
|
||||
<div class="field<?php if ($sf_request->hasError('migration{database}')): ?> form-error<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{database}')): ?>
|
||||
<?php echo form_error('migration{database}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('migration[database]', $sf_request->getParameter('migration[database]'), array('size' => 31)) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[username]', __($labels['migration{username}']), 'class="required"') ?>
|
||||
|
||||
<div class="field <?php if ($sf_request->hasError('migration{username}')): ?> form-error"<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{username}')): ?>
|
||||
<?php echo form_error('migration{username}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('migration[username]', $sf_request->getParameter('migration[username]'), array('size' => 31)) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[password]', __($labels['migration{password}'])) ?>
|
||||
<div class="field <?php if ($sf_request->hasError('migration{password}')): ?> form-error<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{password}')): ?>
|
||||
<?php echo form_error('migration{password}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_password_tag('migration[password]', null, 'autocomplete="off"') ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="woo-prefix-row" class="row" style="display: none;">
|
||||
<?php echo label_for('migration[woo_prefix]', __($labels['migration{woo_prefix}']), 'class="required"') ?>
|
||||
|
||||
<div class="field <?php if ($sf_request->hasError('migration{woo_prefix}')): ?> form-error"<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{woo_prefix}')): ?>
|
||||
<?php echo form_error('migration{woo_prefix}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('migration[woo_prefix]', $sf_request->getParameter('migration[woo_prefix]', 'wp_'), array('size' => 5)) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset id="woo-config">
|
||||
<h2><?php echo __('Konfiguracja danych WooCommerce');?></h2>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[woo_photo]', __($labels['migration{woo_photo}'])) ?>
|
||||
<div class="chosen-container">
|
||||
|
||||
<?php
|
||||
$woo_photo['all'] = __("Wszystkie załączone");
|
||||
$woo_photo['main'] = __("Tylko główne");
|
||||
?>
|
||||
<?php echo select_tag('migration[woo_photo]', options_for_select($woo_photo, $sf_request->getParameter('migration[woo_photo]'))) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<?php echo label_for('migration[woo_tax]', __($labels['migration{woo_tax}']), 'class="required"') ?>
|
||||
|
||||
<div class="field <?php if ($sf_request->hasError('migration{woo_tax}')): ?> form-error"<?php endif; ?>">
|
||||
<?php if ($sf_request->hasError('migration{woo_tax}')): ?>
|
||||
<?php echo form_error('migration{woo_tax}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('migration[woo_tax]', $sf_request->getParameter('migration[woo_tax]', '23'), array('size' => 2)) ?> %
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php echo stSocketView::openComponents('stMigration.custom.Content'); ?>
|
||||
<div id="config_actions">
|
||||
<?php echo st_get_admin_actions_head() ?>
|
||||
<?php echo st_get_admin_action('save', __('Importuj')) ?>
|
||||
<?php echo st_get_admin_actions_foot() ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php echo st_get_admin_foot() ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
showFields();
|
||||
|
||||
$('#migration_type').change(function() {
|
||||
|
||||
showFields();
|
||||
});
|
||||
|
||||
|
||||
function showFields(){
|
||||
|
||||
$option = $('#migration_type option:selected').val();
|
||||
|
||||
console.log($option);
|
||||
|
||||
if ($option == "appMigrationWoocommercePlugin:woo") {
|
||||
$('#woo-prefix-row').show();
|
||||
$('#woo-config').show();
|
||||
}else{
|
||||
$('#woo-prefix-row').hide();
|
||||
$('#woo-config').hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php use_helper('stProgressBar'); ?>
|
||||
|
||||
<?php use_helper('Form', 'Validation', 'I18N', 'stAdminGenerator') ?>
|
||||
|
||||
<?php echo st_get_admin_head('stMigration', __('Import danych'), __('Import danych z zewnętrznych systemów')) ?>
|
||||
<?php st_view_slot_start('application-menu') ?>
|
||||
<?php st_include_component('stMigration', 'listMenu') ?>
|
||||
<?php st_view_slot_end() ?>
|
||||
<div id="sf_admin_content" class="admin-content-edit">
|
||||
<div class="admin_form">
|
||||
<fieldset>
|
||||
<div class="content">
|
||||
<?php echo progress_bar('stMigration', 'stMigrationProgressBar', $action, $record_count, __('Import produktów', null, 'stMigration')); ?>
|
||||
<div id="stMigration-multiProgressBar"></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo st_get_admin_foot() ?>
|
||||
23
apps/backend/modules/stMigration/validate/process.yml
Normal file
23
apps/backend/modules/stMigration/validate/process.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
fields:
|
||||
migration{database}:
|
||||
required:
|
||||
msg: Wartość nie może być pusta
|
||||
migration{host}:
|
||||
required:
|
||||
msg: Wartość nie może być pusta
|
||||
migration{username}:
|
||||
required:
|
||||
msg: Wartość nie może być pusta
|
||||
migration{port}:
|
||||
required:
|
||||
msg: Wartość nie może być pusta
|
||||
sfNumberValidator:
|
||||
nan_error: Podana wartość nie jest liczbą
|
||||
type_error: Podana wartość nie jest liczbą całkowitą
|
||||
type: integer
|
||||
migration{www}:
|
||||
required:
|
||||
msg: Wartość nie może być pusta
|
||||
stUrlValidator:
|
||||
url_error: "Podany adres posiada nieprawidłowy format (przykład: https://example.com)"
|
||||
|
||||
Reference in New Issue
Block a user