Fixes
All checks were successful
Gitea Actions / Run-Tests-On-Arm64 (push) Successful in 5m33s
Gitea Actions / Run-Tests-On-Amd64 (push) Successful in 14m29s

This commit is contained in:
Thomas 2025-03-07 21:18:30 +01:00
parent 15a0c5cadb
commit 197b387006
14 changed files with 169 additions and 22 deletions

View File

@ -3,6 +3,8 @@ version: '3.7'
services:
php-fpm:
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/php-fpm-${ENV?}:${TAG?}
environment:
- APP_ENV=prod
build:
context: ../
# platforms:
@ -15,6 +17,8 @@ services:
- TARGET_PHP_VERSION=${PHP_VERSION?}
php-cron:
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/php-cron-${ENV?}:${TAG?}
environment:
- APP_ENV=prod
build:
context: ../
# platforms:
@ -28,6 +32,8 @@ services:
web:
image: ${DOCKER_REGISTRY?}/${DOCKER_NAMESPACE?}/web-${ENV?}:${TAG?}
environment:
- APP_ENV=prod
build:
context: ../../
# platforms:

View File

@ -155,6 +155,8 @@ FROM base as prod
COPY --from=codebase --chown=$APP_USER_NAME:$APP_GROUP_NAME /codebase $APP_CODE_PATH
ENV APP_ENV=prod
FROM base as ci
COPY --from=codebase --chown=$APP_USER_NAME:$APP_GROUP_NAME /codebase $APP_CODE_PATH
@ -169,3 +171,5 @@ RUN echo "root ALL=(ALL) NOPASSWD: ALL " | tee -a "/etc/sudoers.d/users" && \
echo "${APP_USER_NAME} ALL=(ALL) NOPASSWD: ALL " | tee -a "/etc/sudoers.d/users"
RUN pecl install xdebug
ENV APP_ENV=dev

View File

@ -5,5 +5,5 @@ BASH_ENV=/container.env
* * * * * root chmod -R 0777 /data/www/old/market/steplayouter >> /var/log/cron.log 2>&1
* * * * * root chmod -R 0777 /data/www/new/web/uploads/media >> /var/log/cron.log 2>&1
* * * * * root chmod -R 0777 /data/www/new/web/media >> /var/log/cron.log 2>&1
* * * * * www-data cd /data/www/new/web && /usr/local/bin/php /data/www/new/bin/console --env=prod application:queue:do >> /var/log/cron.log 2>&1
* * * * * www-data cd /data/www/new/web && /usr/local/bin/php /data/www/new/bin/console application:queue:do >> /var/log/cron.log 2>&1
#

View File

@ -33,7 +33,7 @@ ifeq ($(ENV),prod)
else ifeq ($(ENV),ci)
DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_CI_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL_CI) -f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL)
else ifeq ($(ENV),local)
DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_DEV) -f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL)
DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL) -f $(DOCKER_COMPOSE_FILE_LOCAL_DEV)
endif
# We need a couple of environment variables for docker compose so we define a make variable that we can

View File

@ -4,7 +4,7 @@ APP_SECRET=347829efiubvf347fbisdc27f
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
DATABASE_URL=mysql://psc:Wichtig1@mysql:3306/psc
DATABASE_URL=mysql://root:Wichtig1@mysql:3306/psc
###< doctrine/doctrine-bundle ###
###> doctrine/mongodb-odm-bundle ###

View File

@ -31,7 +31,6 @@ use PSC\Shop\EntityBundle\Entity\ContactRole;
use PSC\Shop\EntityBundle\Entity\Product;
use PSC\Shop\EntityBundle\Entity\Role;
use PSC\Shop\EntityBundle\Entity\ShopContact;
use PSC\Shop\OrderBundle\Form\Backend\Upload\DeleteType;
use PSC\Shop\QueueBundle\Event\EventManager;
use PSC\Shop\QueueBundle\Service\Event\Manager;
use PSC\System\PluginBundle\Form\Chain\Field;

View File

@ -0,0 +1,57 @@
<?php
namespace PSC\Shop\QueueBundle\Event\Contact;
use PSC\Shop\QueueBundle\Event\Event;
use PSC\Shop\QueueBundle\Help\Shop;
class Login extends Event
{
/** @var string */
protected $contact;
public function getType()
{
return 'contact_login';
}
public function getDescription()
{
return 'Kunde hat sich angemeldet';
}
public function getData()
{
return array(
'contact' => $this->contact
);
}
public function setData($data)
{
$this->contact = $data['contact'];
}
/**
* @return string
*/
public function getContact()
{
return $this->contact;
}
/**
* @param string $contact
*/
public function setContact($contact)
{
$this->contact = $contact;
}
public function getHelp()
{
return [[
Shop::getColumn(),
\PSC\Shop\QueueBundle\Help\Contact::getColumn(),
]];
}
}

View File

@ -75,6 +75,9 @@ services:
PSC\Shop\QueueBundle\Event\Contact\Password\Reset\Finish:
tags:
- { name: events }
PSC\Shop\QueueBundle\Event\Contact\Login:
tags:
- { name: events }
PSC\Shop\QueueBundle\Event\Contact\Create:
tags:
- { name: events }

View File

@ -312,7 +312,7 @@ class Mail implements QueueInterface, ConfigurableElementInterface
return true;
}
if ($event instanceof UnLock || $event instanceof \PSC\Shop\QueueBundle\Event\Contact\Create) {
if ($event instanceof UnLock || $event instanceof \PSC\Shop\QueueBundle\Event\Contact\Create || $event instanceof \PSC\Shop\QueueBundle\Event\Contact\Login) {
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
/** @var Contact $contact */
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
@ -349,9 +349,17 @@ class Mail implements QueueInterface, ConfigurableElementInterface
if ($html) {
$message->html($html->render($params));
}
$this->_logService->createLogEntry($shop, new Contact(), LogEntry::INFO, PSCShopQueueBundle::class, $queue->getName(), "Login Mail send", [
'message' => $message->getTextBody(),
'from' => $from->render($params),
'to' => $to->render($params),
'subject' => $subject->render($params)
]);
$this->_mailer->send($message);
} catch (\Exception $e) {
$this->_logService->createLogEntry($shop, new Contact(), LogEntry::ERROR, PSCShopQueueBundle::class, $queue->getName(), "Login Mail error", [
'error' => $e->getMessage()
]);
$this->_error = $e->getMessage();
return false;
}

View File

@ -12,6 +12,7 @@ use PSC\Libraries\AceEditorBundle\Form\Extension\AceEditorType;
use PSC\Shop\EntityBundle\Document\Queue;
use PSC\Shop\QueueBundle\Event\EventInterface;
use PSC\Shop\QueueBundle\Event\Order\Create;
use PSC\Shop\QueueBundle\Event\Contact\Login;
use PSC\Shop\QueueBundle\Event\Position\Printpartner\Notify;
use PSC\System\PluginBundle\Event\EveryRun;
use PSC\System\SettingsBundle\Service\TemplateVars;
@ -137,6 +138,39 @@ class Url implements QueueInterface, ConfigurableElementInterface
$messageString = $messageTemplate->render($templateVars->getTwigVars());
file_put_contents('/tmp/test.json', $messageString);
$res = $client->request(
'POST',
$urlString,
[
'headers' => [
'Accept' => 'application/json',
],
'json' => json_decode($messageString)
]
);
}
if ($event instanceof Login) {
$client = new Client();
$urlTemplate = $this->_template->createTemplate($doc->getUrl());
$messageTemplate = $this->_template->createTemplate($doc->getMessage());
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
/** @var Contact $contact */
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
/** @var \PSC\Shop\EntityBundle\Document\Contact $contactObj */
$contactObj = $this->_doctrine_mongodb
->getRepository('PSC\Shop\EntityBundle\Document\Contact')
->findOneBy(array('uid' => (string) $contact->getId()));
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
/** @var Shop $shop */
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
$params = array(
'contact' => $contact,
'contactDoc' => $contactObj,
'shop' => $shop,
);
$urlString = $urlTemplate->render($params);
$messageString = $messageTemplate->render($params);
$res = $client->request(
'POST',
$urlString,

View File

@ -55,7 +55,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
);*/
$cacheDriver = new Doctrine_Cache_Array();
if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'test') {
$dsn = 'mysql:dbname=psc_test;host=mysql';
$dsn = 'mysql:dbname=psc;host=mysql';
$user = 'psc';
$password = 'psc';
} elseif (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'dev') {

View File

@ -28,7 +28,8 @@
*/
abstract class BaseCreditSystem extends Doctrine_Record
{
public function setTableDefinition() {
public function setTableDefinition()
{
$this->setTableName('credit_system');
$this->hasColumn('id', 'integer', 8, array(
'primary' => true,
@ -100,13 +101,18 @@ abstract class BaseCreditSystem extends Doctrine_Record
'type' => 'float',
'length' => '25',
));
$this->hasColumn('min_basket_value', 'float', 25, array(
'type' => 'float',
'length' => '25',
));
$this->hasColumn('more', 'boolean', 1);
$this->hasColumn('product_id', 'string', 255);
$this->hasColumn('articlegroup_id', 'string', 255);
$this->hasColumn('pre_code', 'string', 255);
}
public function setUp() {
public function setUp()
{
parent::setUp();
$this->hasOne('Install', array(
'local' => 'install_id',

View File

@ -2117,6 +2117,7 @@ class BasketController extends TP_Controller_Action
}
$creditSystemUUID = $creditSystemRecord->id;
$creditSystemValue = $creditSystemRecord->wert;
$creditSystemMinBasketValue = $creditSystemRecord->min_basket_value;
$creditSystemPercent = (bool)$creditSystemRecord->percent;
$creditSystemPayment = (bool)$creditSystemRecord->payment;
$creditSystemShipping = (bool)$creditSystemRecord->shipping;
@ -2323,6 +2324,12 @@ class BasketController extends TP_Controller_Action
$this->view->productnetto = $netto;
$this->view->gutschein = false;
if ($creditSystemMinBasketValue > 0 && $creditSystemMinBasketValue > ($netto+$mwert)) {
$this->view->priorityMessenger('Warenwert zu niedrig', 'success');
$basket->setGutschein("");
$creditSystemValue=0;
}
if ($basket->getGutschein() != "") {
$this->view->gutscheincode = $basket->getGutschein();
$this->view->gutschein = $creditSystemRecord;

View File

@ -2,7 +2,6 @@
class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
{
/**
* $_identity - Identity value
*
@ -110,15 +109,39 @@ class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
$row->save();
$_identity = $row->toArray(true);
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
$dbMongo = TP_Mongo::getInstance();
$dbMongo->Job->insertOne(array(
"shop" => $shop['id'],
"event" => "contact_login",
"data" => [ "contact" => $row->uuid ],
"created" => new MongoDB\BSON\UTCDateTime(),
"updated" => new MongoDB\BSON\UTCDateTime()
));
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
} elseif (function_exists('password_verify') && password_verify($this->_credential, $row->password) && !$this->_apiLogin) {
$_identity = $row->toArray(true);
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
$dbMongo = TP_Mongo::getInstance();
$dbMongo->Job->insertOne(array(
"shop" => $shop['id'],
"event" => "contact_login",
"data" => [ "contact" => $row->uuid ],
"created" => new MongoDB\BSON\UTCDateTime(),
"updated" => new MongoDB\BSON\UTCDateTime()
));
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
} elseif ($this->_apiLogin) {
$_identity = $row->toArray(true);
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname'];
$dbMongo = TP_Mongo::getInstance();
$dbMongo->Job->insertOne(array(
"shop" => $shop['id'],
"event" => "contact_login",
"data" => [ "contact" => $row->uuid ],
"created" => new MongoDB\BSON\UTCDateTime(),
"updated" => new MongoDB\BSON\UTCDateTime()
));
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank'));
} else {
return new Zend_Auth_Result(false, $_identity, array('Passwort falsch!'));