first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,234 @@
<?php
/**
* SOTESHOP/stShopInfoPlugin
*
* Ten plik należy do aplikacji stShopInfoPlugin 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 stShopInfoPlugin
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: actions.class.php 4651 2009-02-04 12:51:04Z pawel $
* @author Paweł Byszewski <pawel.byszewski@sote.pl>
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Klasa stShopInfoBackendActions
*
* @package stShopInfoPlugin
* @subpackage actions
*/
class stShopInfoBackendActions extends autoStShopInfoBackendActions
{
/**
* Wyświetlanie formularza danych sklepu
*/
public function executeIndex()
{
return $this->redirect('@stShopInfoPlugin?action=config');
}
public function validateConfig()
{
$request = $this->getRequest();
$i18n = $this->getContext()->getI18N();
if ($request->getMethod() == sfRequest::POST)
{
$data = $this->getRequestParameter('config');
if ($request->hasError('config{town}') || $request->hasError('config{code}'))
{
$request->setError('config{code_town}', $i18n->__('Proszę uzupełnić pole.'));
$request->removeError('config{town}');
$request->removeError('config{code}');
}
if ($request->hasError('config{street}') || $request->hasError('config{house}'))
{
$request->setError('config{address}', $i18n->__('Proszę uzupełnić pole.'));
$request->removeError('config{street}');
$request->removeError('config{house}');
}
}
return !$request->hasErrors();
}
/**
* Wyświetlanie informacji o licencji
*/
public function executeRegister()
{
$this->config = stConfig::getInstance($this->getContext(), 'stRegister');
$this->menu_items = $this->getMenuItems();
$this->showChangeLicenseButton = false;
if (stLicense::isOpen()) $this->showChangeLicenseButton = true;
$i18n = $this->getContext()->getI18N();
$this->getBreadcrumbsBuilder()->getDefaultBreadcrumbs()->add($i18n->__('Informacje o licencji'));
}
/**
* Wyświetlanie zmiany numeru licencji
*/
public function executeChangeLicense()
{
$this->config = stConfig::getInstance($this->getContext(), 'stRegister');
$this->menu_items = $this->getMenuItems();
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
$license = $this->getRequest()->getParameter('license_number');
$this->config->set('license', trim($license));
$this->config->save();
$stLicense = new stLicense($license);
$stLicense->activateInSote();
$this->setFlash('notice', 'Twoje zmiany zostały zapisane');
}
}
/**
* Walidacja numeru licencji
*/
public function validateChangeLicense()
{
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
$i18n = $this->getContext()->getI18N();
$license = $this->getRequest()->getParameter('license_number');
if (!$license)
{
$this->getRequest()->setError('license_number', $i18n->__('Proszę uzupełnić pole.'));
return false;
}
$params = array(
'min' => 29,
'min_error' => $i18n->__('Proszę sprawdzić czy numer licencji oraz jego format są poprawne.<br/>Numer licencji powinien zawierać 29 znaków w formacie xxxx-xxxx-xxxx-xxxx-xxxx-xxxx.'),
'max' => 29,
'max_error' => $i18n->__('Proszę sprawdzić czy numer licencji oraz jego format są poprawne.<br/>Numer licencji powinien zawierać 29 znaków w formacie xxxx-xxxx-xxxx-xxxx-xxxx-xxxx.'),
);
$sfStringValidator = new sfStringValidator();
$sfStringValidator->initialize($this->getContext(), $params);
if (!$sfStringValidator->execute($license, $error))
{
$this->getRequest()->setError('license_number', $error);
return false;
}
if (stLicense::isCommercial())
{
$this->getRequest()->setError('license_number', $i18n->__('Nie można zmienić numeru licencji wersji komercyjnej.'));
return false;
}
$stLicense = new stLicense($license);
if ($stLicense->getType() !== stLicense::LICENSE_TYPE_COMMERCIAL)
{
$this->getRequest()->setError('license_number', $i18n->__('Numer licencji wersji Open może zostać zmieniony tylko na numer licencji wersji komercyjnej.'));
return false;
}
if (!$stLicense->checkInSote())
{
$this->getRequest()->setError('license_number', $i18n->__('Numer licencji jest nieprawidłowy.'));
return false;
}
}
return true;
}
/**
* Akcja w przypadku błędu w uzupełnianiu pól
*/
public function handleErrorChangeLicense()
{
$this->config = stConfig::getInstance($this->getContext(), 'stRegister');
$this->menu_items = $this->getMenuItems();
$this->labels = array('license_number' => $this->getContext()->getI18n()->__('Numer licencji'));
return sfView::SUCCESS;
}
/**
* {@inheritDoc}
*/
protected function getConfigLabels()
{
$labels = parent::getConfigLabels();
$i18n = $this->getContext()->getI18N();
$labels['config{code}'] = $i18n->__('Kod pocztowy');
$labels['config{town}'] = $i18n->__('Miasto');
$labels['config{street}'] = $i18n->__('Ulica');
$labels['config{house}'] = $i18n->__('Numer domu');
return $labels;
}
protected function getMenuItems()
{
$i18n = $this->getContext()->getI18N();
return array(
'stShopInfoBackend/index' => $i18n->__('Informacje o sklepie'),
'stShopInfoBackend/register' => $i18n->__('Informacje o licencji')
);
}
protected function updateConfigFromRequest()
{
parent::updateConfigFromRequest();
$data = $this->getRequestParameter('config');
if (isset($data['code']))
{
$this->config->set('code', $data['code']);
}
if (isset($data['town']))
{
$this->config->set('town', $data['town']);
}
if (isset($data['street']))
{
$this->config->set('street', $data['street']);
}
if (isset($data['house']))
{
$this->config->set('house', $data['house']);
}
if (isset($data['flat']))
{
$this->config->set('flat', $data['flat']);
}
}
}

View File

@@ -0,0 +1,7 @@
<?php
class stShopInfoBackendComponents extends autoStShopInfoBackendComponents
{
}
?>

View File

@@ -0,0 +1,35 @@
generator:
class: stAdminGenerator
param:
model_class: false
theme: simple
label: Informacje o sklepie
route: @stShopInfoPlugin
icon: stShopInfoPlugin
documentation:
pl: https://www.sote.pl/docs/informacje-o-sklepie
en: https://www.soteshop.com/docs/shop_info
config:
use_stylesheet: [backend/stShopInfoPlugin.css]
title: Konfiguracja
menu:
display: [config, register]
fields:
config: {name: Konfiguracja, action: "@stShopInfoPlugin?action=config"}
register: {name: Informacje o licencji, action: "@stShopInfoPlugin?action=register"}
display:
"NONE": [company, _address, _code_town, _country, phone, show_phone, fax, bank, email, nip]
fields:
company: {name: "Nazwa sprzedawcy / Firma", required: true}
address: {name: "Adres", required: true}
code_town: {name: "Kod pocztowy, miasto", required: true}
phone: {name: "Telefon"}
country: {name: "Kraj", help: "Kraj, w którym siedzibę ma Twoja firma", required: true}
show_phone: {name: "Pokaż telefon", help: "Telefon jest widoczny wyłącznie dla urządzeń mobilnych", type: checkbox_tag}
fax: {name: "Fax"}
bank: {name: "Rachunek bankowy"}
email: {name: "Kontaktowy adres e-mail", required: true}
nip: {name: "NIP"}
actions:
_save: {name: "Zapisz"}

View File

@@ -0,0 +1,5 @@
<?php
class stShopInfoBackendBreadcrumbsBuilder extends autoStShopInfoBackendBreadcrumbsBuilder
{
}

View File

@@ -0,0 +1,6 @@
<div class="flex-container">
<?php echo input_tag('config[street]', $config->get('street'), array('class' => $config->get('street') ? 'not-required list_tooltip' : 'list_tooltip', 'placeholder' => __('Ulica'))) ?>
<?php echo input_tag('config[house]', $config->get('house'), array('class' => $config->get('house') ? 'not-required list_tooltip' : 'list_tooltip', 'title' => __('Numer domu'))) ?>
<span class="separator">/</span>
<?php echo input_tag('config[flat]', $config->get('flat'), array('title' => __('Numer mieszkania'), 'class' => 'list_tooltip')) ?>
</div>

View File

@@ -0,0 +1,4 @@
<div class="flex-container">
<?php echo input_tag('config[code]', $config->get('code'), array('class' => $config->get('code') ? 'not-required' : '', 'placeholder' => __('Kod pocztowy'))) ?>
<?php echo input_tag('config[town]', $config->get('town'), array('class' => $config->get('town') ? 'not-required' : '', 'placeholder' => __('Miasto'))) ?>
</div>

View File

@@ -0,0 +1,3 @@
<?php
use_helper('Countries');
echo st_countries_select_tag('config[country]', $config->get('country'), array('iso' => true, 'all' => true, 'include_custom' => __('Wybierz')));

View File

@@ -0,0 +1,18 @@
<?php $routing = sfRouting::getInstance(); ?>
<?php $module = stConfiguration::getInstance()->getDesktopModule($sf_context->getModuleName()); ?>
<div class="list-menu">
<ul>
<?php foreach ($items as $action => $name): $url = url_for($action) ?>
<li class="<?php echo $selected_item_path == $url ? 'selected' : 'none' ?>"><a href="<?php echo $url ?>"<?php if ($url[0] != '/'): ?> target="_blank"<?php endif ?>><?php echo $name ?></a></li>
<?php endforeach; ?>
<li>
<?php if (sfContext::getInstance()->getUser()->getCulture() == 'pl_PL'): ?>
<a href="https://www.sote.pl/docs/informacje-o-sklepie" target="_blank"><?php echo __('Dokumentacja'); ?></a>
<?php else: ?>
<a href="https://www.soteshop.com/docs/shop_info" target="_blank"><?php echo __('Documentation'); ?></a>
<?php endif; ?>
</li>
</ul>
</div>
<div class="clr"></div>

View File

@@ -0,0 +1,35 @@
<?php use_helper('I18N', 'stAdminGenerator', 'Validation');?>
<?php use_stylesheet('backend/stShopInfoPlugin.css');?>
<?php echo st_get_admin_head('stShopInfoPlugin', __('Informacje o licencji'), __('Informacje o sklepie'), array());?>
<?php echo st_get_component('stAdminGenerator', 'menu', array('items' => $menu_items)) ?>
<?php if ($sf_flash->has('notice')):?>
<div class="save-ok" style="margin: 10px;">
<h2><?php echo __($sf_flash->get('notice'), array(), 'stAdminGeneratorPlugin');?></h2>
</div>
<?php endif;?>
<?php if ($sf_request->hasErrors()):?>
<div class="form-errors" style="margin: 10px;">
<h2><?php echo __('Popraw dane w formularzu.', array(), 'stAdminGeneratorPlugin');?></h2>
<dl>
<dd><?php echo $sf_request->getError('license_number');?></dd>
</dl>
</div>
<?php endif;?>
<?php echo form_tag('shop_info/changeLicense', array('id' => 'sf_admin_edit_form', 'name' => 'sf_admin_edit_form'));?>
<div id="sf_admin_content_edit" style="margin: 10px; min-height: 50px; border: 1px solid #ccc; padding: 10px;">
<div class=" <?php if($sf_request->hasError('license_number')):?> form-error<?php endif;?>" style="text-align: center; font-family: Helvetica,Arial,sans-serif; font-size: 12px; padding-top: 15px;">
<?php echo label_for('license_number', __('Numer licencji'), array('class' => 'required'));?>:
<?php if($sf_request->hasErrors()):?>
<?php echo input_tag('license_number', $sf_params->get('license_number'), array('size' => 30, 'style' => 'vertical-align: middle'));?>
<?php else:?>
<?php echo input_tag('license_number', $config->get('license'), array('size' => 30, 'style' => 'vertical-align: middle'));?>
<?php endif;?>
<br class="st_clear_all" />
</div>
</div>
<?php echo st_get_admin_actions_head('style="margin-top: 0px; margin-right: 10px; float: right"');?>
<?php echo st_get_admin_action('save', __('Zapisz', array(), 'stAdminGeneratorPlugin'), null, array('name' => 'save'));?>
<?php echo st_get_admin_actions_foot();?>
</form>
<?php echo st_get_admin_foot();?>

View File

@@ -0,0 +1,40 @@
<?php use_helper('stAdminGenerator', 'I18N', 'Date', 'Validation') ?>
<?php use_stylesheet('backend/beta/style.css'); ?>
<?php // use_stylesheet('backend/stShopInfoPlugin.css'); ?>
<?php echo st_get_admin_head('stShopInfoPlugin', __('Informacje o sklepie')) ?>
<?php st_view_slot_start('application-menu') ?>
<?php st_include_component('stShopInfoBackend', 'listMenu') ?>
<?php st_view_slot_end() ?>
<?php echo form_tag('stShopInfoBackend/index', array('id' => 'sf_admin_config_form', 'name' => 'sf_admin_config_form', 'class' => 'admin_form'));?>
<?php st_include_partial('stAdminGenerator/message', array('labels' => $labels));?>
<fieldset>
<div class="content">
<?php echo st_admin_get_form_field('st_shop_info[company]', __('Nazwa sprzedawcy / Firma'), $config->get('company'), 'input_tag') ?>
<?php echo st_admin_get_form_field('st_shop_info[nip]', __('NIP'), $config->get('nip'), 'input_tag') ?>
<?php echo st_admin_get_form_field('address', __('Ulica, nr domu'), $config, '_address') ?>
<?php echo st_admin_get_form_field('code_town', __('Kod pocztowy, miasto'), $config, '_code_town') ?>
<?php echo st_admin_get_form_field('st_shop_info[phone]', __('Telefon'), $config->get('phone')) ?>
<?php echo st_admin_get_form_field('st_shop_info[show_phone]', __('Pokaż telefon'), 1, 'checkbox_tag', array('checked' => $config->get('show_phone'), 'help' => __('Telefon jest widoczny wyłącznie dla urządzeń mobilnych'))) ?>
<?php echo st_admin_get_form_field('st_shop_info[bank]', __('Rachunek bankowy'), $config->get('bank')) ?>
<?php echo st_admin_get_form_field('st_shop_info[email]', __('Kontaktowy adres e-mail'), $config->get('email')) ?>
</div>
</fieldset>
<div id="config_actions">
<?php echo st_get_admin_actions_head() ?>
<?php echo st_get_admin_action('save', __('Zapisz', array(), 'stAdminGeneratorPlugin'), null, 'name=save') ?>
<?php echo st_get_admin_actions_foot() ?>
</div>
</form>
<div class="clr"></div>
<?php echo st_get_admin_foot() ?>
<script type="text/javascript">
jQuery(function($) {
$(document).ready(function() {
$('#config_actions').stickyBox();
fieldsetVisibility();
});
});
</script>

View File

@@ -0,0 +1,11 @@
<?php
use_helper('I18N', 'stAdminGenerator');
echo st_get_partial('header', array('title' => __('Informacje o licencji')));
echo st_get_partial('config_menu');
echo tag('div', array('class' => 'admin_form'), true);
st_admin_section_start();
echo st_admin_get_form_field('license', __('Numer licencji'), $config->get('license'), 'plain');
st_admin_section_end();
echo '</div>';
echo st_get_partial('footer');
?>

View File

@@ -0,0 +1,22 @@
fields:
config{company}:
required:
msg: Proszę uzupełnić pole.
config{country}:
required:
msg: Proszę uzupełnić pole.
config{email}:
required:
msg: Proszę uzupełnić pole.
config{code}:
required:
msg: Proszę uzupełnić pole.
config{town}:
required:
msg: Proszę uzupełnić pole.
config{street}:
required:
msg: Proszę uzupełnić pole.
config{house}:
required:
msg: Proszę uzupełnić pole.