Fixes
This commit is contained in:
parent
a2fc107f26
commit
9937165710
@ -2,20 +2,22 @@ import "./css/backend.css"
|
||||
import Alpine from 'alpinejs';
|
||||
import persist from '@alpinejs/persist'
|
||||
import $ from 'jquery'
|
||||
window.$ = window.jQuery = $;
|
||||
import 'summernote/dist/summernote-lite.js'
|
||||
import 'summernote/dist/summernote-lite.min.css'
|
||||
import '../backend/dashboard/js/summernote/mediabundle.plugin.js'
|
||||
import { initTabs } from 'david-ai';
|
||||
// Initialize tabs functionality
|
||||
initTabs();
|
||||
import { registerVueControllerComponents } from '@symfony/ux-vue';
|
||||
registerVueControllerComponents()
|
||||
import { startStimulusApp } from '@symfony/stimulus-bundle';
|
||||
const app = startStimulusApp();
|
||||
Alpine.plugin(persist)
|
||||
|
||||
// Import PSC modules
|
||||
import { order } from './js/order.js';
|
||||
import { multiselect } from './js/multiselect.js';
|
||||
|
||||
window.$ = window.jQuery = $;
|
||||
// Initialize tabs functionality
|
||||
initTabs();
|
||||
registerVueControllerComponents()
|
||||
const app = startStimulusApp();
|
||||
Alpine.plugin(persist)
|
||||
|
||||
// Initialize PSC global object
|
||||
window.psc = window.psc || {};
|
||||
window.psc.order = new order();
|
||||
@ -49,3 +51,39 @@ Alpine.start();
|
||||
// Initialize PSC modules
|
||||
window.psc.order.init();
|
||||
window.psc.multiselect.init();
|
||||
|
||||
const initSummernote = () => {
|
||||
if (!$.fn?.summernote) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(document).on('blur', '.note-codable', function () {
|
||||
const codeviewHtml = $(this).val();
|
||||
const $summernoteTextarea = $(this).closest('.note-editor').siblings('textarea');
|
||||
$summernoteTextarea.val(codeviewHtml);
|
||||
});
|
||||
|
||||
const toolbar = [
|
||||
['style', ['style']],
|
||||
['font', ['bold', 'italic', 'underline', 'clear']],
|
||||
['fontsize', ['fontsize']],
|
||||
['color', ['color']],
|
||||
['para', ['ul', 'ol', 'paragraph']],
|
||||
['height', ['height']],
|
||||
['table', ['table']],
|
||||
['insert', ['link', 'hr', 'image']],
|
||||
['view', ['fullscreen', 'codeview']],
|
||||
['help', ['help']],
|
||||
];
|
||||
|
||||
if (typeof window.mediaBundleBrowser === 'function') {
|
||||
toolbar.push(['media', ['media']]);
|
||||
}
|
||||
|
||||
$('.summernote').summernote({
|
||||
height: 400,
|
||||
toolbar,
|
||||
});
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initSummernote);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet, reOrder, reOrderOrder, reOrderPos }, orderUuid) => `
|
||||
<td colspan="12" class="px-6 py-4 bg-gray-50" style="${psc.order.get_pos_bg_color(status)}">
|
||||
<div class="px-6 py-4 bg-gray-50" style="${psc.order.get_pos_bg_color(status)}">
|
||||
<div class="grid grid-cols-12 gap-4 w-full" id="row-${uuid}">
|
||||
<div class="col-span-1">
|
||||
<span class="text-xs font-semibold text-gray-700">Pos:</span>
|
||||
@ -8,9 +8,8 @@ const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos
|
||||
<div class="col-span-4">
|
||||
<span class="text-xs font-semibold text-gray-700">Produkt:</span>
|
||||
<div>
|
||||
${
|
||||
(product => product.originalProduct ? `<a href="/apps/backend/product/edit/index/${product.originalProduct.uuid}" class="text-psc-500 hover:underline">${product.originalProduct.title}</a>` : `<a href="/apps/backend/product/edit/index/${product.uuid}" class="text-psc-500 hover:underline">${product.title}</a>` )(product)
|
||||
}
|
||||
${(product => product.originalProduct ? `<a href="/apps/backend/product/edit/index/${product.originalProduct.uuid}" class="text-psc-500 hover:underline">${product.originalProduct.title}</a>` : `<a href="/apps/backend/product/edit/index/${product.uuid}" class="text-psc-500 hover:underline">${product.title}</a>`)(product)
|
||||
}
|
||||
<br/><span class="text-xs text-gray-600">ArtNr intern: ${product.nrIntern}</span><br/>
|
||||
${psc.order.get_special_product_options(product.specialProductTypeObject)}
|
||||
</div>
|
||||
@ -21,13 +20,13 @@ const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos
|
||||
</div>
|
||||
<div class="col-span-2">
|
||||
<span class="text-xs font-semibold text-gray-700">Kunden Info:</span>
|
||||
<div class="text-sm">${customerInfo}${(reOrder? `<br/><strong class="text-yellow-600">Ist eine Nachbestellung</strong>`:``)}</div>
|
||||
<div class="text-sm">${customerInfo}${(reOrder ? `<br/><strong class="text-yellow-600">Ist eine Nachbestellung</strong>` : ``)}</div>
|
||||
</div>
|
||||
<div class="col-span-2">
|
||||
<span class="text-xs font-semibold text-gray-700">Preis:</span>
|
||||
<div class="text-right whitespace-nowrap">
|
||||
${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet/100)}<br/>
|
||||
<strong>(${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross/100)})</strong>
|
||||
${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet / 100)}<br/>
|
||||
<strong>(${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross / 100)})</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-1">
|
||||
@ -45,7 +44,7 @@ const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</div>
|
||||
`;
|
||||
|
||||
const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet }, orderUuid) => `
|
||||
@ -58,9 +57,8 @@ const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketFiel
|
||||
<div class="flex-1">
|
||||
<span class="text-xs font-semibold text-gray-700">Produkt:</span>
|
||||
<div>
|
||||
${
|
||||
(product => product.originalProduct ? `<a href="/apps/backend/product/edit/index/${product.originalProduct.uuid}" class="text-psc-500 hover:underline">${product.originalProduct.title}</a>` : `<a href="/apps/backend/product/edit/index/${product.uuid}" class="text-psc-500 hover:underline">${product.title}</a>` )(product)
|
||||
}
|
||||
${(product => product.originalProduct ? `<a href="/apps/backend/product/edit/index/${product.originalProduct.uuid}" class="text-psc-500 hover:underline">${product.originalProduct.title}</a>` : `<a href="/apps/backend/product/edit/index/${product.uuid}" class="text-psc-500 hover:underline">${product.title}</a>`)(product)
|
||||
}
|
||||
<br/><span class="text-xs text-gray-600">ArtNr intern: ${product.nrIntern}</span><br/>
|
||||
${psc.order.get_special_product_options(product.specialProductTypeObject)}
|
||||
</div>
|
||||
@ -75,7 +73,7 @@ const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketFiel
|
||||
</div>
|
||||
<div class="flex-none w-32 text-right">
|
||||
<span class="text-xs font-semibold text-gray-700">Preis:</span>
|
||||
<div class="whitespace-nowrap">${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet/100)} <strong>(${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross/100)})</strong></div>
|
||||
<div class="whitespace-nowrap">${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet / 100)} <strong>(${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross / 100)})</strong></div>
|
||||
</div>
|
||||
<div class="flex-none w-24">
|
||||
<span class="text-xs font-semibold text-gray-700">Status:</span>
|
||||
@ -109,7 +107,7 @@ export class order {
|
||||
init_dropdowns() {
|
||||
// Initialize all status dropdowns (both in main table and details)
|
||||
$(document).off('click.orderDropdown');
|
||||
$(document).on('click.orderDropdown', '.relative.inline-block button', function(e) {
|
||||
$(document).on('click.orderDropdown', '.relative.inline-block button', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var $dropdown = $(this).next('div');
|
||||
@ -122,7 +120,7 @@ export class order {
|
||||
});
|
||||
|
||||
// Close dropdowns when clicking outside
|
||||
$(document).on('click.orderDropdown', function(e) {
|
||||
$(document).on('click.orderDropdown', function (e) {
|
||||
if (!$(e.target).closest('.relative.inline-block').length) {
|
||||
$('.relative.inline-block div[class*="absolute"]').addClass('hidden');
|
||||
}
|
||||
@ -130,19 +128,19 @@ export class order {
|
||||
}
|
||||
|
||||
get_special_product_options(specialProductTypeObject) {
|
||||
if(specialProductTypeObject.typ != 6) {
|
||||
if (specialProductTypeObject.typ != 6) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '<table>' + specialProductTypeObject.options.map(elm => {
|
||||
if(elm.type != 'hidden') {
|
||||
if (elm.type != 'hidden') {
|
||||
return Order_List_Pos_Calc_Option(elm);
|
||||
}
|
||||
}).join('') + '</table>';
|
||||
}
|
||||
|
||||
load_status() {
|
||||
if(jwt_token != "") {
|
||||
if (jwt_token != "") {
|
||||
$.ajax({
|
||||
url: "/apps/api/system/status",
|
||||
contentType: "application/json",
|
||||
@ -160,26 +158,26 @@ export class order {
|
||||
|
||||
bind_buttons() {
|
||||
$('.toogle_list_detail_view').off();
|
||||
$('.toogle_list_detail_view').on('click', function() {
|
||||
$('.toogle_list_detail_view').on('click', function () {
|
||||
var uuid = $(this).data().uuid;
|
||||
var $icon = $(this);
|
||||
if($('#rows-' + uuid).children().length > 0) {
|
||||
$('#rows-' + uuid).html('');
|
||||
if ($('#rows-' + uuid + ' td').children().length > 0) {
|
||||
$('#rows-' + uuid + ' td').html('');
|
||||
$icon.removeClass('fa-minus').addClass('fa-plus');
|
||||
}else{
|
||||
} else {
|
||||
psc.order.load_detail(uuid);
|
||||
$icon.removeClass('fa-plus').addClass('fa-minus');
|
||||
}
|
||||
});
|
||||
|
||||
$('.toogle_list_simple_detail_view').off();
|
||||
$('.toogle_list_simple_detail_view').on('click', function() {
|
||||
$('.toogle_list_simple_detail_view').on('click', function () {
|
||||
var uuid = $(this).data().uuid;
|
||||
var $icon = $(this);
|
||||
if($('#rows-' + uuid).children().length > 0) {
|
||||
$('#rows-' + uuid).html('');
|
||||
if ($('#rows-' + uuid + ' td').children().length > 0) {
|
||||
$('#rows-' + uuid + ' td').html('');
|
||||
$icon.removeClass('fa-minus').addClass('fa-plus');
|
||||
}else{
|
||||
} else {
|
||||
psc.order.load_detail(uuid, true);
|
||||
$icon.removeClass('fa-plus').addClass('fa-minus');
|
||||
}
|
||||
@ -199,17 +197,17 @@ export class order {
|
||||
data: JSON.stringify({
|
||||
uuid: orderUuid
|
||||
}),
|
||||
success: function(result) {
|
||||
success: function (result) {
|
||||
psc.order.build_details(orderUuid, result, simple);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
build_details(orderUuid, result, simple = false) {
|
||||
if(simple) {
|
||||
$('#rows-' + result.uuid).html(result.positions.map(x => Order_List_Detail_Simple(x, orderUuid)).join(''));
|
||||
}else{
|
||||
$('#rows-' + result.uuid).html(result.positions.map(x => Order_List_Detail(x, orderUuid)).join(''));
|
||||
if (simple) {
|
||||
$('#rows-' + result.uuid + ' td').html(result.positions.map(x => Order_List_Detail_Simple(x, orderUuid)).join(''));
|
||||
} else {
|
||||
$('#rows-' + result.uuid + ' td').html(result.positions.map(x => Order_List_Detail(x, orderUuid)).join(''));
|
||||
result.positions.map(x => this.loadPluginDetails(x));
|
||||
|
||||
}
|
||||
@ -225,7 +223,7 @@ export class order {
|
||||
"Authorization": "Bearer " + jwt_token
|
||||
},
|
||||
method: 'GET',
|
||||
success: function(result) {
|
||||
success: function (result) {
|
||||
$('#row-' + pos.uuid).append(result.html);
|
||||
}
|
||||
})
|
||||
@ -234,7 +232,7 @@ export class order {
|
||||
bind_status_buttons() {
|
||||
// Bind status change buttons for positions
|
||||
$('.switch_pos').off();
|
||||
$('.switch_pos').on('click', function() {
|
||||
$('.switch_pos').on('click', function () {
|
||||
|
||||
var orderUuid = $(this).data().orderUuid;
|
||||
var posUuid = $(this).data().posUuid;
|
||||
@ -251,8 +249,8 @@ export class order {
|
||||
status: status,
|
||||
}),
|
||||
method: 'POST',
|
||||
success: function(result) {
|
||||
$('#rows-' + orderUuid).html('');
|
||||
success: function (result) {
|
||||
$('#rows-' + orderUuid + ' td').html('');
|
||||
psc.order.load_detail(orderUuid);
|
||||
}
|
||||
});
|
||||
@ -266,7 +264,7 @@ export class order {
|
||||
*/
|
||||
const found = psc.order.status_pos.find(stat => stat.code == status);
|
||||
|
||||
if(found && found.color != "") {
|
||||
if (found && found.color != "") {
|
||||
return 'background-color: ' + found.color;
|
||||
}
|
||||
|
||||
@ -278,11 +276,11 @@ export class order {
|
||||
{% if orderStatuse.getPosStatusColor(pos.status) != '' %}background-color: {{ orderStatuse.getPosStatusColor(pos.status) }}{% endif %}"
|
||||
*/
|
||||
const found = psc.order.status_pos.find(stat => stat.code == status);
|
||||
if(found) {
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
|
||||
return {internalName: 'notFound'};
|
||||
return { internalName: 'notFound' };
|
||||
|
||||
}
|
||||
|
||||
@ -292,10 +290,10 @@ export class order {
|
||||
class="{% if pos.status == 170 %}bg-lightdark{% elseif pos.status == 200 or pos.status == 210 %}bg-lightsuccess{% else %}bg-lightdanger{% endif %}
|
||||
*/
|
||||
|
||||
if(status == 170) {
|
||||
if (status == 170) {
|
||||
return 'bg-lightdark';
|
||||
}
|
||||
if(status == 200 || status == 210) {
|
||||
if (status == 200 || status == 210) {
|
||||
return 'bg-lightsuccess';
|
||||
}
|
||||
|
||||
|
||||
@ -210,6 +210,7 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{% do form.save.setRendered %}
|
||||
{{ form_end(form) }}
|
||||
</div>
|
||||
{{ summernote_mediabundle_init('default') }}
|
||||
|
||||
@ -214,6 +214,7 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{% do form.save.setRendered %}
|
||||
{{ form_end(form) }}
|
||||
{{ summernote_mediabundle_init() }}
|
||||
|
||||
@ -248,4 +249,3 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="rows-{{ order.uuid }}"></tr>
|
||||
<tr id="rows-{{ order.uuid }}"><td colspan="12"></div></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -15,20 +15,14 @@ namespace PSC\Shop\ProductBundle\Controller\Backend\Product;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use PSC\Shop\EntityBundle\Entity\Motiv;
|
||||
use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use PSC\Shop\EntityBundle\Entity\Stockbooking;
|
||||
use PSC\Shop\ProductBundle\Form\Backend\StockbookingSettingsType;
|
||||
use PSC\Shop\ProductBundle\Form\Backend\StockbookingType;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
/**
|
||||
* StockController fürs Backend
|
||||
@ -38,27 +32,19 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
class StockController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* add
|
||||
*
|
||||
* @template()
|
||||
*
|
||||
* @param Request $request Request
|
||||
* @param Shop $shopService
|
||||
* @param EntityManagerInterface $entityManager
|
||||
* @param PaginatorInterface $paginator
|
||||
* @param string $product Uuid
|
||||
*
|
||||
* @return array|View
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
*/
|
||||
#[Template('@PSCShopProduct/backend/product/stock/index.html.twig')]
|
||||
#[Route(path: '/stock/index/{product}', name: 'backend_production_product_stock_index')]
|
||||
public function indexAction(Request $request, Shop $shopService, EntityManagerInterface $entityManager, PaginatorInterface $paginator, $product)
|
||||
{
|
||||
|
||||
public function indexAction(
|
||||
Request $request,
|
||||
Shop $shopService,
|
||||
EntityManagerInterface $entityManager,
|
||||
PaginatorInterface $paginator,
|
||||
$product,
|
||||
) {
|
||||
$selectedShop = $shopService->getSelectedShop();
|
||||
$product = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $product, 'shop' => $selectedShop));
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $product, 'shop' => $selectedShop));
|
||||
$form = $this->createForm(StockbookingSettingsType::class, $product);
|
||||
$formAdd = $this->createForm(StockbookingType::class, new Stockbooking($product->getUid()));
|
||||
$form->handleRequest($request);
|
||||
@ -68,40 +54,29 @@ class StockController extends AbstractController
|
||||
}
|
||||
|
||||
$userRepository = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Stockbooking');
|
||||
$qb = $userRepository->createQueryBuilder('stock')
|
||||
$qb = $userRepository
|
||||
->createQueryBuilder('stock')
|
||||
->andWhere('stock.product = :product_id')
|
||||
->leftJoin('stock.contact', 'c')
|
||||
->setParameter("product_id", $product->getUid())
|
||||
->setParameter('product_id', $product->getUid())
|
||||
->orderBy('stock.created', 'DESC');
|
||||
$pagination = $paginator->paginate($qb, $request->query->getInt('page', 1), 20, array('distinct' => false));
|
||||
return array(
|
||||
'form' => $form->createView(),
|
||||
'formAdd' => $formAdd->createView(),
|
||||
'product' => $product,
|
||||
'pagination' => $pagination
|
||||
'pagination' => $pagination,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* add
|
||||
*
|
||||
* @template()
|
||||
*
|
||||
* @param Request $request Request
|
||||
* @param Shop $shopService
|
||||
* @param EntityManagerInterface $entityManager
|
||||
* @param string $product Uuid
|
||||
*
|
||||
* @return View|\Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
*/
|
||||
#[Template('@PSCShopProduct/backend/product/stock/add.html.twig')]
|
||||
#[Route(path: '/stock/add/{product}', name: 'backend_production_product_stock_add')]
|
||||
public function addAction(Request $request, Shop $shopService, EntityManagerInterface $entityManager, $product)
|
||||
{
|
||||
|
||||
$selectedShop = $shopService->getSelectedShop();
|
||||
$product = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $product, 'shop' => $selectedShop));
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $product, 'shop' => $selectedShop));
|
||||
$booking = new Stockbooking($product->getUid());
|
||||
$form = $this->createForm(StockbookingType::class, $booking);
|
||||
$form->handleRequest($request);
|
||||
@ -114,6 +89,7 @@ class StockController extends AbstractController
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute("backend_production_product_stock_index", array("product" => $product->getUuid()));
|
||||
return $this->redirectToRoute('backend_production_product_stock_index', array('product' =>
|
||||
$product->getUuid()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,47 +2,66 @@
|
||||
|
||||
namespace Plugin\Custom\Albertbauer\Useredit\Controller;
|
||||
|
||||
use Plugin\Custom\Albertbauer\Useredit\Form\UserType;
|
||||
use Plugin\Custom\Albertbauer\Useredit\Form\UsernewType;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use FOS\JsRoutingBundle\Controller\Controller as ControllerController;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Plugin\Custom\Albertbauer\Useredit\Form\UsernewType;
|
||||
use Plugin\Custom\Albertbauer\Useredit\Form\UserType;
|
||||
use PSC\Shop\EntityBundle\Entity\Contact;
|
||||
use PSC\Shop\EntityBundle\Entity\ContactRole;
|
||||
use PSC\Shop\EntityBundle\Entity\ShopContact;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
#[Route("/useredit")]
|
||||
#[Route('/useredit')]
|
||||
class UsereditController extends AbstractController
|
||||
{
|
||||
#[Template('@PluginCustomAlbertbauerUsereditController/useredit/update.html.twig')]
|
||||
#[Route("/update", name: "psc_plugin_update_load")]
|
||||
public function updateAction(Request $request, DocumentManager $documentManager, EntityManagerInterface $entityManager, \Symfony\Component\Security\Core\Security $security)
|
||||
{
|
||||
#[Template('@PluginCustomAlbertbauerUseredit/useredit/update.html.twig')]
|
||||
#[Route('/update', name: 'psc_plugin_update_load')]
|
||||
public function updateAction(
|
||||
Request $request,
|
||||
DocumentManager $documentManager,
|
||||
EntityManagerInterface $entityManager,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
) {
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Contact $user */
|
||||
$user = $documentManager->getRepository('PSC\Shop\EntityBundle\Document\Contact')->findOneBy(array('uid' => (string)$security->getToken()->getUser()->getUid()));
|
||||
$user = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Contact')
|
||||
->findOneBy(array('uid' => (string) $tokenStorage->getToken()->getUser()->getUid()));
|
||||
$products = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findByUid(array(2455, 2469));
|
||||
|
||||
$contacts = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.products', 'products')->andwhere('products.uid = :product_id')->setParameter("product_id", 352)->getQuery()->execute();
|
||||
$contacts = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->createQueryBuilder('contact')
|
||||
->leftJoin('contact.products', 'products')
|
||||
->andwhere('products.uid = :product_id')
|
||||
->setParameter('product_id', 352)
|
||||
->getQuery()
|
||||
->execute();
|
||||
foreach ($contacts as $contact) {
|
||||
|
||||
$contact->setProducts($products);
|
||||
$dms->persist($contact);
|
||||
|
||||
|
||||
}
|
||||
$dms->flush();
|
||||
$filter = "uid";
|
||||
$asc = "DESC";
|
||||
$sort = "2455";
|
||||
$filter = 'uid';
|
||||
$asc = 'DESC';
|
||||
$sort = '2455';
|
||||
return array(
|
||||
'allContakt' => $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.products', 'products')->orderBy('contact.' . $filter, $asc)->andwhere('products.uid = :product_id')->setParameter("product_id", $sort)->getQuery()->execute(),
|
||||
'allContakt' => $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->createQueryBuilder('contact')
|
||||
->leftJoin('contact.products', 'products')
|
||||
->orderBy('contact.' . $filter, $asc)
|
||||
->andwhere('products.uid = :product_id')
|
||||
->setParameter('product_id', $sort)
|
||||
->getQuery()
|
||||
->execute(),
|
||||
'user' => $user,
|
||||
'sort' => $sort,
|
||||
'asc' => $asc,
|
||||
@ -50,20 +69,24 @@ class UsereditController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
#[Template('@PluginCustomAlbertbauerUsereditController/useredit/index.html.twig')]
|
||||
#[Route("/edit/{uid}", name: "psc_plugin_useredit_load")]
|
||||
public function indexAction(Request $request, DocumentManager $documentManager, EntityManagerInterface $entityManager, $uid)
|
||||
{
|
||||
#[Template('@PluginCustomAlbertbauerUseredit/useredit/index.html.twig')]
|
||||
#[Route('/edit/{uid}', name: 'psc_plugin_useredit_load')]
|
||||
public function indexAction(
|
||||
Request $request,
|
||||
DocumentManager $documentManager,
|
||||
EntityManagerInterface $entityManager,
|
||||
$uid,
|
||||
) {
|
||||
$save = false;
|
||||
$allContakt = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uuid' => $uid));
|
||||
$allContakt = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->findOneBy(array('uuid' => $uid));
|
||||
|
||||
$form = $this->createForm(UserType::class, $allContakt);
|
||||
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$products = new ArrayCollection();
|
||||
$products->add($allContakt->getProducts());
|
||||
$allContakt->setProductsOrg([$products]);
|
||||
@ -76,14 +99,18 @@ class UsereditController extends AbstractController
|
||||
|
||||
return array(
|
||||
'form' => $form->createView(),
|
||||
'save' => $save
|
||||
'save' => $save,
|
||||
);
|
||||
}
|
||||
|
||||
#[Template('@PluginCustomAlbertbauerUsereditController/useredit/new.html.twig')]
|
||||
#[Route("/new", name: "psc_plugin_usernew_load")]
|
||||
public function newAction(Request $request, Shop $shopService, DocumentManager $documentManager, EntityManagerInterface $entityManager)
|
||||
{
|
||||
#[Template('@PluginCustomAlbertbauerUseredit/useredit/new.html.twig')]
|
||||
#[Route('/new', name: 'psc_plugin_usernew_load')]
|
||||
public function newAction(
|
||||
Request $request,
|
||||
Shop $shopService,
|
||||
DocumentManager $documentManager,
|
||||
EntityManagerInterface $entityManager,
|
||||
) {
|
||||
$save = false;
|
||||
|
||||
$allContakt = new Contact();
|
||||
@ -93,7 +120,6 @@ class UsereditController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
$selectedAccount = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Account')->findOneByUid(1);
|
||||
|
||||
$allContakt->setInstallId(1);
|
||||
@ -133,36 +159,43 @@ class UsereditController extends AbstractController
|
||||
$entityManager->clear();
|
||||
|
||||
$save = true;
|
||||
|
||||
}
|
||||
|
||||
return array(
|
||||
'form' => $form->createView(),
|
||||
'save' => $save
|
||||
'save' => $save,
|
||||
);
|
||||
}
|
||||
|
||||
#[Template('@PluginCustomAlbertbauerUsereditController/useredit/list.html.twig')]
|
||||
#[Route("/list/{filter}/{asc}/{sort}", name: "psc_plugin_userlist_load")]
|
||||
public function listAction(Request $request, Shop $shopService, DocumentManager $documentManager, EntityManagerInterface $entityManager, $filter, $asc, $sort, \Symfony\Component\Security\Core\Security $security)
|
||||
{
|
||||
#[Template('@PluginCustomAlbertbauerUseredit/useredit/list.html.twig')]
|
||||
#[Route('/list/{filter}/{asc}/{sort}', name: 'psc_plugin_userlist_load')]
|
||||
public function listAction(
|
||||
Request $request,
|
||||
Shop $shopService,
|
||||
DocumentManager $documentManager,
|
||||
EntityManagerInterface $entityManager,
|
||||
$filter,
|
||||
$asc,
|
||||
$sort,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
) {
|
||||
$newarray = $request->request->all();
|
||||
if (isset($newarray["q"])) {
|
||||
$firstname = "%" . $newarray["q"] . "%";
|
||||
$lastname = "%" . $newarray["q"] . "%";
|
||||
$username = "%" . $newarray["q"] . "%";
|
||||
$company = "%" . $newarray["q"] . "%";
|
||||
$street = "%" . $newarray["q"] . "%";
|
||||
$houseNumber = "%" . $newarray["q"] . "%";
|
||||
$zip = "%" . $newarray["q"] . "%";
|
||||
$city = "%" . $newarray["q"] . "%";
|
||||
$fax = "%" . $newarray["q"] . "%";
|
||||
$mobile = "%" . $newarray["q"] . "%";
|
||||
$country = "%" . $newarray["q"] . "%";
|
||||
$phone = "%" . $newarray["q"] . "%";
|
||||
if (isset($newarray['q'])) {
|
||||
$firstname = '%' . $newarray['q'] . '%';
|
||||
$lastname = '%' . $newarray['q'] . '%';
|
||||
$username = '%' . $newarray['q'] . '%';
|
||||
$company = '%' . $newarray['q'] . '%';
|
||||
$street = '%' . $newarray['q'] . '%';
|
||||
$houseNumber = '%' . $newarray['q'] . '%';
|
||||
$zip = '%' . $newarray['q'] . '%';
|
||||
$city = '%' . $newarray['q'] . '%';
|
||||
$fax = '%' . $newarray['q'] . '%';
|
||||
$mobile = '%' . $newarray['q'] . '%';
|
||||
$country = '%' . $newarray['q'] . '%';
|
||||
$phone = '%' . $newarray['q'] . '%';
|
||||
|
||||
if ($filter == "all") {
|
||||
$filter = "uuid";
|
||||
if ($filter == 'all') {
|
||||
$filter = 'uuid';
|
||||
} else {
|
||||
$filter = $filter;
|
||||
}
|
||||
@ -172,59 +205,103 @@ class UsereditController extends AbstractController
|
||||
$sortiert = array($sort);
|
||||
}
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Contact $user */
|
||||
$user = $documentManager->getRepository('PSC\Shop\EntityBundle\Document\Contact')->findOneBy(array('uid' => (string)$security->getToken()->getUser()->getUid()));
|
||||
$user = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Contact')
|
||||
->findOneBy(array('uid' => (string) $tokenStorage->getToken()->getUser()->getUid()));
|
||||
return array(
|
||||
'allContakt' => $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
||||
'allContakt' => $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->createQueryBuilder('contact')
|
||||
->orderBy('contact.' . $filter, $asc)
|
||||
->leftJoin('contact.products', 'products')
|
||||
->andwhere('contact.firstname Like :firstname')->setParameter("firstname", $firstname)
|
||||
->orwhere('contact.lastname Like :lastname')->setParameter("lastname", $lastname)
|
||||
->orwhere('contact.username Like :username')->setParameter("username", $username)
|
||||
->orwhere('contact.company Like :company')->setParameter("company", $company)
|
||||
->orwhere('contact.houseNumber Like :houseNumber')->setParameter("houseNumber", $houseNumber)
|
||||
->orwhere('contact.zip Like :zip')->setParameter("zip", $zip)
|
||||
->orwhere('contact.city Like :city')->setParameter("city", $city)
|
||||
->orwhere('contact.phone Like :phone')->setParameter("phone", $phone)
|
||||
->orwhere('contact.fax Like :fax')->setParameter("fax", $fax)
|
||||
->orwhere('contact.mobile Like :mobile')->setParameter("mobile", $mobile)
|
||||
->orwhere('contact.country Like :country')->setParameter("country", $country)->getQuery()->execute(),
|
||||
->andwhere('contact.firstname Like :firstname')
|
||||
->setParameter('firstname', $firstname)
|
||||
->orwhere('contact.lastname Like :lastname')
|
||||
->setParameter('lastname', $lastname)
|
||||
->orwhere('contact.username Like :username')
|
||||
->setParameter('username', $username)
|
||||
->orwhere('contact.company Like :company')
|
||||
->setParameter('company', $company)
|
||||
->orwhere('contact.houseNumber Like :houseNumber')
|
||||
->setParameter('houseNumber', $houseNumber)
|
||||
->orwhere('contact.zip Like :zip')
|
||||
->setParameter('zip', $zip)
|
||||
->orwhere('contact.city Like :city')
|
||||
->setParameter('city', $city)
|
||||
->orwhere('contact.phone Like :phone')
|
||||
->setParameter('phone', $phone)
|
||||
->orwhere('contact.fax Like :fax')
|
||||
->setParameter('fax', $fax)
|
||||
->orwhere('contact.mobile Like :mobile')
|
||||
->setParameter('mobile', $mobile)
|
||||
->orwhere('contact.country Like :country')
|
||||
->setParameter('country', $country)
|
||||
->getQuery()
|
||||
->execute(),
|
||||
'user' => $user,
|
||||
'sort' => $sort,
|
||||
'asc' => $asc,
|
||||
'filter' => $filter,
|
||||
);
|
||||
//->andwhere('products.uid IN (:product_id)')->setParameter("product_id", $sortiert), //Wenn nur auf Kunden mit Produkte gesucht werden soll.
|
||||
|
||||
//->andwhere('products.uid IN (:product_id)')->setParameter("product_id", $sortiert), //Wenn nur auf Kunden mit Produkte gesucht werden soll.
|
||||
} else {
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Contact $user */
|
||||
$user = $documentManager->getRepository('PSC\Shop\EntityBundle\Document\Contact')->findOneBy(array('uid' => (string)$security->getToken()->getUser()->getUid()));
|
||||
//var_dump($filter);
|
||||
//var_dump($sort);
|
||||
if ($filter == "all" and $sort == 0) {
|
||||
$user = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Contact')
|
||||
->findOneBy(array('uid' => (string) $tokenStorage->getToken()->getUser()->getUid()));
|
||||
//var_dump($filter);
|
||||
//var_dump($sort);
|
||||
if ($filter == 'all' and $sort == 0) {
|
||||
return array(
|
||||
'allContakt' => $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shops')->orderBy('contact.uid', $asc)->andwhere('shops.uid = :shop_id')->setParameter("shop_id", $shopService->getShopByDomain())->getQuery()->execute(),
|
||||
'allContakt' => $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->createQueryBuilder('contact')
|
||||
->leftJoin('contact.shops', 'shops')
|
||||
->orderBy('contact.uid', $asc)
|
||||
->andwhere('shops.uid = :shop_id')
|
||||
->setParameter('shop_id', $shopService->getShopByDomain())
|
||||
->getQuery()
|
||||
->execute(),
|
||||
'user' => $user,
|
||||
'sort' => $sort,
|
||||
'asc' => $asc,
|
||||
'filter' => $filter,
|
||||
);
|
||||
} else if ($filter != "all" and $sort == 0) {
|
||||
} else if ($filter != 'all' and $sort == 0) {
|
||||
return array(
|
||||
'allContakt' => $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shops')->orderBy('contact.' . $filter, $asc)->andwhere('shops.uid = :shop_id')->setParameter("shop_id", $shopService->getShopByDomain())->getQuery()->execute(),
|
||||
'allContakt' => $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->createQueryBuilder('contact')
|
||||
->leftJoin('contact.shops', 'shops')
|
||||
->orderBy('contact.' . $filter, $asc)
|
||||
->andwhere('shops.uid = :shop_id')
|
||||
->setParameter('shop_id', $shopService->getShopByDomain())
|
||||
->getQuery()
|
||||
->execute(),
|
||||
'user' => $user,
|
||||
'sort' => $sort,
|
||||
'asc' => $asc,
|
||||
'filter' => $filter,
|
||||
);
|
||||
} else {
|
||||
//var_dump($filter);
|
||||
//var_dump($sort);
|
||||
if ($filter == "all") {
|
||||
$filter = "uid";
|
||||
//var_dump($filter);
|
||||
//var_dump($sort);
|
||||
if ($filter == 'all') {
|
||||
$filter = 'uid';
|
||||
} else {
|
||||
$filter = $filter;
|
||||
}
|
||||
return array(
|
||||
'allContakt' => $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.products', 'products')->orderBy('contact.' . $filter, $asc)->andwhere('products.uid = :product_id')->setParameter("product_id", $sort)->getQuery()->execute(),
|
||||
'allContakt' => $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->createQueryBuilder('contact')
|
||||
->leftJoin('contact.products', 'products')
|
||||
->orderBy('contact.' . $filter, $asc)
|
||||
->andwhere('products.uid = :product_id')
|
||||
->setParameter('product_id', $sort)
|
||||
->getQuery()
|
||||
->execute(),
|
||||
'user' => $user,
|
||||
'sort' => $sort,
|
||||
'asc' => $asc,
|
||||
@ -234,11 +311,13 @@ class UsereditController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
#[Template('@PluginCustomAlbertbauerUsereditController/useredit/out.html.twig')]
|
||||
#[Route("/out/{uid}", name: "psc_plugin_userout_load")]
|
||||
#[Template('@PluginCustomAlbertbauerUseredit/useredit/out.html.twig')]
|
||||
#[Route('/out/{uid}', name: 'psc_plugin_userout_load')]
|
||||
public function outAction(EntityManagerInterface $entityManager, $uid)
|
||||
{
|
||||
$selfuuid = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uuid' => $uid));
|
||||
$selfuuid = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->findOneBy(array('uuid' => $uid));
|
||||
$selfuuid->setLocked(1);
|
||||
$entityManager->flush();
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class StartController extends AbstractController
|
||||
{
|
||||
@ -29,7 +29,7 @@ class StartController extends AbstractController
|
||||
private readonly DocumentManager $documentManager,
|
||||
) {}
|
||||
|
||||
#[Template('@PluginCustomHugContactControllerBackend/start/start.html.twig')]
|
||||
#[Template('@PluginCustomHugContact/backend/start/start.html.twig')]
|
||||
#[Route('/start', name: 'plugin_custom_hug_contact_importer_start')]
|
||||
public function start(
|
||||
Request $request,
|
||||
|
||||
@ -17,8 +17,8 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
class StartController extends AbstractController
|
||||
{
|
||||
#[Route("/start/{lkenn}", name: "plugin_custom_krueger_Erlkonten_load")]
|
||||
#[Template('@PluginCustomKruegerErlkontenController/start/start.html.twig')]
|
||||
public function startAction($lkenn, DocumentManager $documentManager, EntityManagerInterface $entityManager, \Symfony\Component\Security\Core\Security $security)
|
||||
#[Template('@PluginCustomKruegerErlkonten/start/start.html.twig')]
|
||||
public function startAction($lkenn, DocumentManager $documentManager, EntityManagerInterface $entityManager)
|
||||
{
|
||||
$article = file_get_contents("/data/www/old/data/packages/import/ERLKonten.xml");
|
||||
$xml = simplexml_load_string($article, 'SimpleXMLElement', LIBXML_NOWARNING);
|
||||
|
||||
@ -12,15 +12,16 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
#[Route("/megalithuser")]
|
||||
class StartController extends AbstractController
|
||||
{
|
||||
#[Route("/start", name: "plugin_custom_krueger_megalithusernew_load")]
|
||||
#[Template('@PluginCustomKruegerMegalithuserController/start/start.html.twig')]
|
||||
public function startAction(DocumentManager $documentManager, EntityManagerInterface $entityManager, \Symfony\Component\Security\Core\Security $security)
|
||||
#[Template('@PluginCustomKruegerMegalithuser/start/start.html.twig')]
|
||||
public function startAction(DocumentManager $documentManager, EntityManagerInterface $entityManager, TokenStorageInterface $tokenStorage)
|
||||
{
|
||||
$allContakt = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uid' => (string)$security->getUser()->getUid()));
|
||||
$allContakt = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uid' => (string)$tokenStorage->getToken()->getUser()->getUid()));
|
||||
$replacePhone = str_replace(" ", "", $this->getUser()->getPhone());
|
||||
$replacePhone = str_replace("/", "", $replacePhone);
|
||||
$replacePhone = str_replace("-", "", $replacePhone);
|
||||
|
||||
@ -12,15 +12,16 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
#[Route("/userlk")]
|
||||
class StartController extends AbstractController
|
||||
{
|
||||
#[Route("/start", name: "plugin_custom_krueger_Userlknew_load")]
|
||||
#[Template('@PluginCustomKruegerUserlkController/start/start.html.twig')]
|
||||
public function startAction(DocumentManager $documentManager, EntityManagerInterface $entityManager, \Symfony\Component\Security\Core\Security $security)
|
||||
#[Template('@PluginCustomKruegerUserlk/start/start.html.twig')]
|
||||
public function startAction(DocumentManager $documentManager, EntityManagerInterface $entityManager, TokenStorageInterface $tokenStorage)
|
||||
{
|
||||
$allContakt = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uid' => (string)$security->getUser()->getUid()));
|
||||
$allContakt = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uid' => (string)$tokenStorage->getToken()->getUser()->getUid()));
|
||||
if($allContakt->getCountry() == "D") {
|
||||
$allContakt->setCountry("DE");
|
||||
}
|
||||
|
||||
25
src/new/var/plugins/Custom/Mail/Partials/Plugin.php
Normal file
25
src/new/var/plugins/Custom/Mail/Partials/Plugin.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\Mail\Partials;
|
||||
|
||||
use PSC\System\PluginBundle\Plugin\Base;
|
||||
|
||||
class Plugin extends Base implements \PSC\System\PluginBundle\Interfaces\Plugin
|
||||
{
|
||||
protected $name = 'Mail Partials';
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return Plugin::Frontend;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return 'Mail Partials';
|
||||
}
|
||||
|
||||
public function getVersion()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
TESTTEST
|
||||
@ -20,7 +20,7 @@ use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class DesignController extends AbstractController
|
||||
{
|
||||
@ -28,7 +28,7 @@ class DesignController extends AbstractController
|
||||
private Design $designService,
|
||||
) {}
|
||||
|
||||
#[Template('@PluginCustomPSCR2_PitchprintControllerBackend/design/edit.html.twig')]
|
||||
#[Template('@PluginCustomPSCR2_Pitchprint/backend/design/edit.html.twig')]
|
||||
#[Route('/design/edit/{uuid}/{folder}', name: 'psc_plugin_pitchprint_r2_backend_design_edit')]
|
||||
public function editAction(
|
||||
Request $request,
|
||||
|
||||
@ -1,84 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\PSC\R2_Pitchprint\Controller\Frontend;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use Plugin\Custom\PSC\CollectLayouter\Dto\Preview\Input;
|
||||
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
||||
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
||||
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
||||
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
||||
use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/designer')]
|
||||
class DesignerController extends AbstractController
|
||||
{
|
||||
#[Template()]
|
||||
#[Template('@PluginCustomPSCR2_Pitchprint/frontend/designer/start.html.twig')]
|
||||
#[Route('/start/{productId}', name: 'plugin_custom_psc_pitchprint_r2_start')]
|
||||
public function startAction(Shop $shopService,EntityManagerInterface $entityManager, DocumentManager $documentManager, string $productId)
|
||||
{
|
||||
public function startAction(
|
||||
Shop $shopService,
|
||||
EntityManagerInterface $entityManager,
|
||||
DocumentManager $documentManager,
|
||||
string $productId,
|
||||
) {
|
||||
/** @var Product $product */
|
||||
$product = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productId));
|
||||
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
->findOneBy(array('uid' => (string) $product->getUid()));
|
||||
return [
|
||||
'shopDoc' => $shopService->getMongoShopByDomain(),
|
||||
'product' => $product,
|
||||
'productDoc' => $productDoc
|
||||
'productDoc' => $productDoc,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
#[Template()]
|
||||
#[Template('@PluginCustomPSCR2_Pitchprint/frontend/designer/load.html.twig')]
|
||||
#[Route('/load/{productId}/{layouterId}', name: 'plugin_custom_psc_pitchprint_r2_load')]
|
||||
public function loadAction(Shop $shopService,EntityManagerInterface $entityManager, DocumentManager $documentManager, string $productId, string $layouterId)
|
||||
{
|
||||
public function loadAction(
|
||||
Shop $shopService,
|
||||
EntityManagerInterface $entityManager,
|
||||
DocumentManager $documentManager,
|
||||
string $productId,
|
||||
string $layouterId,
|
||||
) {
|
||||
/** @var Product $product */
|
||||
$product = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productId));
|
||||
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
->findOneBy(array('uid' => (string) $product->getUid()));
|
||||
|
||||
$layoutDesignData = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterId));
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')
|
||||
->findOneBy(array('uuid' => $layouterId));
|
||||
|
||||
return [
|
||||
'shopDoc' => $shopService->getMongoShopByDomain(),
|
||||
'product' => $product,
|
||||
'productDoc' => $productDoc,
|
||||
'layouterId' => $layouterId,
|
||||
'projectId' => $layoutDesignData->getDesign()['projectId']
|
||||
'projectId' => $layoutDesignData->getDesign()['projectId'],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
#[Route('/save', name: 'plugin_custom_psc_pitchprint_r2_save')]
|
||||
public function saveAction(Request $request, EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
$uuid = $request->get("layouter");
|
||||
$articleUuid = $request->get("article");
|
||||
$projectId = $request->get("projectId");
|
||||
$previews = $request->get("previews");
|
||||
$uuid = $request->get('layouter');
|
||||
$articleUuid = $request->get('article');
|
||||
$projectId = $request->get('projectId');
|
||||
$previews = $request->get('previews');
|
||||
|
||||
$layoutDesignData = new Layoutdesigndata();
|
||||
$layoutDesignData->setUuid($uuid);
|
||||
@ -97,13 +97,13 @@ class DesignerController extends AbstractController
|
||||
#[Route('/update', name: 'plugin_custom_psc_pitchprint_r2_update')]
|
||||
public function updateAction(Request $request, EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
$uuid = $request->get("layouter");
|
||||
$projectId = $request->get("projectId");
|
||||
$previews = $request->get("previews");
|
||||
$uuid = $request->get('layouter');
|
||||
$projectId = $request->get('projectId');
|
||||
$previews = $request->get('previews');
|
||||
|
||||
$layoutDesignData = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $uuid));
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')
|
||||
->findOneBy(array('uuid' => $uuid));
|
||||
|
||||
$layoutDesignData->setDesign(['projectId' => $projectId, 'previews' => $previews]);
|
||||
|
||||
@ -115,6 +115,5 @@ class DesignerController extends AbstractController
|
||||
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -4,7 +4,6 @@ namespace Plugin\Custom\PSC\R2_Sendcloud\Controller\Backend;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
|
||||
use Plugin\Custom\PSC\R2_Sendcloud\Form\ParcelsForm;
|
||||
use Plugin\Custom\PSC\R2_Sendcloud\Form\SearchForm;
|
||||
use Plugin\Custom\PSC\R2_Sendcloud\Model\Parcel;
|
||||
@ -12,35 +11,39 @@ use Plugin\Custom\PSC\R2_Sendcloud\Model\Parcels;
|
||||
use PSC\Shop\EntityBundle\Document\Shop;
|
||||
use PSC\Shop\OrderBundle\Service\Order;
|
||||
use PSC\System\SettingsBundle\Service\Status;
|
||||
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class OrderController extends AbstractController
|
||||
{
|
||||
#[Template('@PluginCustomPSCR2_SendcloudControllerBackend/order/index.html.twig')]
|
||||
#[Template('@PluginCustomPSCR2_Sendcloud/backend/order/index.html.twig')]
|
||||
#[Route('/list', name: 'psc_shop_r2_sendcloud_backend_list_index')]
|
||||
public function indexAction(\PSC\System\SettingsBundle\Service\Shop $shopService,
|
||||
EntityManagerInterface $entityManager,
|
||||
Request $request,
|
||||
Session $session,
|
||||
FilterBuilderUpdaterInterface $query_builder_updater,
|
||||
Status $statusService,
|
||||
\PSC\Shop\OrderBundle\Service\Order $orderService,
|
||||
PaginatorInterface $paginator)
|
||||
{
|
||||
public function indexAction(
|
||||
\PSC\System\SettingsBundle\Service\Shop $shopService,
|
||||
EntityManagerInterface $entityManager,
|
||||
Request $request,
|
||||
Session $session,
|
||||
FilterBuilderUpdaterInterface $query_builder_updater,
|
||||
Status $statusService,
|
||||
\PSC\Shop\OrderBundle\Service\Order $orderService,
|
||||
PaginatorInterface $paginator,
|
||||
) {
|
||||
$selectedShop = $shopService->getSelectedShop();
|
||||
$userRepository = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order');
|
||||
$qb = $userRepository->createQueryBuilder('orders')
|
||||
$qb = $userRepository
|
||||
->createQueryBuilder('orders')
|
||||
->leftJoin('orders.contact', 'contact')
|
||||
->leftJoin('orders.invoiceAddress', 'invoiceAddress')
|
||||
->orderBy('orders.uid', 'desc');
|
||||
$qbCount = $userRepository->createQueryBuilder('orders')
|
||||
$qbCount = $userRepository
|
||||
->createQueryBuilder('orders')
|
||||
->select('count(orders.uid)')
|
||||
->leftJoin('orders.contact', 'contact')
|
||||
->leftJoin('orders.invoiceAddress', 'invoiceAddress')
|
||||
@ -61,18 +64,21 @@ class OrderController extends AbstractController
|
||||
$session->set('order_sort_page', $request->get('page', 1));
|
||||
}
|
||||
|
||||
$qb->andWhere('orders.shop = :shop_id')
|
||||
->setParameter("shop_id", $selectedShop->getUid());
|
||||
$qbCount->andWhere('orders.shop = :shop_id')
|
||||
->setParameter("shop_id", $selectedShop->getUid());
|
||||
$qb->andWhere('orders.shop = :shop_id')->setParameter('shop_id', $selectedShop->getUid());
|
||||
$qbCount->andWhere('orders.shop = :shop_id')->setParameter('shop_id', $selectedShop->getUid());
|
||||
$query = $qb->getQuery();
|
||||
$count = $qbCount->getQuery()->getSingleScalarResult();
|
||||
$query->setHint('knp_paginator.count', $count);
|
||||
$pagination = $paginator->paginate($query, $request->query->getInt('page', $session->get('order_sort_page', 1)), 30, [
|
||||
'defaultSortFieldName' => $session->get('order_sort_field', 'orders.uid'),
|
||||
'defaultSortDirection' => $session->get('order_sort_direction', 'desc'),
|
||||
'distinct' => false
|
||||
]);
|
||||
$pagination = $paginator->paginate(
|
||||
$query,
|
||||
$request->query->getInt('page', $session->get('order_sort_page', 1)),
|
||||
30,
|
||||
[
|
||||
'defaultSortFieldName' => $session->get('order_sort_field', 'orders.uid'),
|
||||
'defaultSortDirection' => $session->get('order_sort_direction', 'desc'),
|
||||
'distinct' => false,
|
||||
],
|
||||
);
|
||||
return array(
|
||||
'pagination' => $pagination,
|
||||
'orderStatuse' => $statusService,
|
||||
@ -81,22 +87,27 @@ class OrderController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
#[Template('@PluginCustomPSCR2_SendcloudControllerBackend/order/send.html.twig')]
|
||||
#[Template('@PluginCustomPSCR2_Sendcloud/backend/order/send.html.twig')]
|
||||
#[Route('/send/{uuid}', name: 'psc_shop_r2_sendcloud_backend_send')]
|
||||
public function sendAction(\PSC\System\SettingsBundle\Service\Shop $shopService, Order $orderService, Request $request, SerializerInterface $serializer, string $uuid): array|RedirectResponse
|
||||
{
|
||||
public function sendAction(
|
||||
\PSC\System\SettingsBundle\Service\Shop $shopService,
|
||||
Order $orderService,
|
||||
Request $request,
|
||||
SerializerInterface $serializer,
|
||||
string $uuid,
|
||||
): array|RedirectResponse {
|
||||
$order = $orderService->getOrderByUuid($uuid);
|
||||
if($value = $order->getPluginSettingModule('sendcloud', 'parcels')) {
|
||||
if ($value = $order->getPluginSettingModule('sendcloud', 'parcels')) {
|
||||
$parcels = $serializer->deserialize($value, Parcels::class, 'json');
|
||||
if($parcels->isFinish()) {
|
||||
if ($parcels->isFinish()) {
|
||||
return $this->redirectToRoute('psc_shop_r2_sendcloud_backend_sendshipping', ['uuid' => $uuid]);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$parcel = new Parcel();
|
||||
$parcel->setDeliveryAddress($order->getDeliveryAddress());
|
||||
if($order->getSenderAddress()->getZip() != "") {
|
||||
if ($order->getSenderAddress()->getZip() != '') {
|
||||
$parcel->setSenderAddress($order->getSenderAddress());
|
||||
}else{
|
||||
} else {
|
||||
$parcel->setSenderAddress($shopService->getMongoSelectedShop()->getSenderAddress());
|
||||
}
|
||||
$parcel->setWeight($order->getWeight());
|
||||
@ -106,11 +117,11 @@ class OrderController extends AbstractController
|
||||
|
||||
$form = $this->createForm(ParcelsForm::class, $parcels);
|
||||
$form->handleRequest($request);
|
||||
if($form->isSubmitted() && $form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$parcels->setSaved(true);
|
||||
$order->setPluginSettingModule('sendcloud', 'parcels', $serializer->serialize($parcels, 'json'));
|
||||
$orderService->storeOrder($order);
|
||||
}else{
|
||||
} else {
|
||||
$order->setPluginSettingModule('sendcloud', 'parcels', $serializer->serialize($parcels, 'json'));
|
||||
$orderService->storeOrder($order);
|
||||
}
|
||||
@ -121,4 +132,5 @@ class OrderController extends AbstractController
|
||||
'form' => $form->createView(),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ namespace Plugin\Custom\PSC\R2_Sendcloud\Controller\Backend;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
|
||||
use Picqer\Carriers\SendCloud\DocumentDownloader;
|
||||
use Picqer\Carriers\SendCloud\SendCloudApiException;
|
||||
use Plugin\Custom\PSC\R2_Sendcloud\Form\ParcelsForm;
|
||||
@ -15,6 +14,7 @@ use Plugin\Custom\PSC\R2_Sendcloud\Model\Parcels;
|
||||
use PSC\Shop\EntityBundle\Document\Shop;
|
||||
use PSC\Shop\OrderBundle\Service\Order;
|
||||
use PSC\System\SettingsBundle\Service\Status;
|
||||
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
@ -22,30 +22,39 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class SendController extends AbstractController
|
||||
{
|
||||
#[Template('@PluginCustomPSCR2_SendcloudControllerBackend/send/sendshipping.html.twig')]
|
||||
#[Template('@PluginCustomPSCR2_Sendcloud/backend/send/sendshipping.html.twig')]
|
||||
#[Route('/sendshipping/{uuid}', name: 'psc_shop_r2_sendcloud_backend_sendshipping')]
|
||||
public function sendshipping(\PSC\System\SettingsBundle\Service\Shop $shopService, Order $orderService, Request $request, SerializerInterface $serializer, \PSC\Shop\QueueBundle\Service\Event\Manager $eventManagerService, string $uuid): array
|
||||
{
|
||||
public function sendshipping(
|
||||
\PSC\System\SettingsBundle\Service\Shop $shopService,
|
||||
Order $orderService,
|
||||
Request $request,
|
||||
SerializerInterface $serializer,
|
||||
\PSC\Shop\QueueBundle\Service\Event\Manager $eventManagerService,
|
||||
string $uuid,
|
||||
): array {
|
||||
$order = $orderService->getOrderByUuid($uuid);
|
||||
if($value = $order->getPluginSettingModule('sendcloud', 'parcels')) {
|
||||
if ($value = $order->getPluginSettingModule('sendcloud', 'parcels')) {
|
||||
/** @var Parcels $parcels */
|
||||
$parcels = $serializer->deserialize($value, Parcels::class, 'json');
|
||||
|
||||
$shop = $shopService->getMongoSelectedShop();
|
||||
|
||||
$connection = new \Picqer\Carriers\SendCloud\Connection($shop->getPluginSettingModule('r2sendcloud', 'publicKey'), $shop->getPluginSettingModule('r2sendcloud', 'secretKey'));
|
||||
$connection = new \Picqer\Carriers\SendCloud\Connection(
|
||||
$shop->getPluginSettingModule('r2sendcloud', 'publicKey'),
|
||||
$shop->getPluginSettingModule('r2sendcloud', 'secretKey'),
|
||||
);
|
||||
$sendcloudClient = new \Picqer\Carriers\SendCloud\SendCloud($connection);
|
||||
|
||||
$temp = [];
|
||||
$shouldBeSaved = false;
|
||||
/** @var Parcel $parcel */
|
||||
foreach($parcels->getParcels() as $parcel) {
|
||||
if($parcel->getExternalId() != "") {
|
||||
foreach ($parcels->getParcels() as $parcel) {
|
||||
if ($parcel->getExternalId() != '') {
|
||||
$sp = $sendcloudClient->parcels()->find($parcel->getExternalId());
|
||||
$parcel->setStatus($sp->status['message']);
|
||||
$temp[] = $parcel;
|
||||
@ -53,13 +62,15 @@ class SendController extends AbstractController
|
||||
}
|
||||
$sendCloudParcel = $sendcloudClient->parcels();
|
||||
$sendCloudParcel->shipping_method = $parcel->getShippingId();
|
||||
$sendCloudParcel->name = $parcel->getDeliveryAddress()->getFirstname() . ' ' . $parcel->getDeliveryAddress()->getLastname();
|
||||
$sendCloudParcel->name =
|
||||
$parcel->getDeliveryAddress()->getFirstname() . ' ' . $parcel->getDeliveryAddress()->getLastname();
|
||||
$sendCloudParcel->company_name = $parcel->getDeliveryAddress()->getCompany();
|
||||
$sendCloudParcel->address = $parcel->getDeliveryAddress()->getStreet() . " " . $parcel->getDeliveryAddress()->getHouseNumber();
|
||||
$sendCloudParcel->address =
|
||||
$parcel->getDeliveryAddress()->getStreet() . ' ' . $parcel->getDeliveryAddress()->getHouseNumber();
|
||||
$sendCloudParcel->city = $parcel->getDeliveryAddress()->getCity();
|
||||
$sendCloudParcel->postal_code = $parcel->getDeliveryAddress()->getZip();
|
||||
$sendCloudParcel->country = $parcel->getDeliveryAddress()->getCountry();
|
||||
if($order->isSendDataToShipping()) {
|
||||
if ($order->isSendDataToShipping()) {
|
||||
$sendCloudParcel->email = $parcel->getDeliveryAddress()->getEmail();
|
||||
}
|
||||
$sendCloudParcel->order_number = $order->getAlias();
|
||||
@ -72,7 +83,8 @@ class SendController extends AbstractController
|
||||
|
||||
$sendCloudParcel->apply_shipping_rules = false;
|
||||
|
||||
$sendCloudParcel->from_name = $parcel->getSenderAddress()->getFirstname() . ' ' . $parcel->getSenderAddress()->getLastname();
|
||||
$sendCloudParcel->from_name =
|
||||
$parcel->getSenderAddress()->getFirstname() . ' ' . $parcel->getSenderAddress()->getLastname();
|
||||
$sendCloudParcel->from_company_name = substr($parcel->getSenderAddress()->getCompany(), 0, 35);
|
||||
$sendCloudParcel->from_address_1 = $parcel->getSenderAddress()->getStreet();
|
||||
$sendCloudParcel->from_house_number = $parcel->getSenderAddress()->getHouseNumber();
|
||||
@ -92,7 +104,7 @@ class SendController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
if(count($temp) > 0 && $shouldBeSaved) {
|
||||
if (count($temp) > 0 && $shouldBeSaved) {
|
||||
$parcels->setFinish(true);
|
||||
$parcels->setParcels($temp);
|
||||
$order->setStatus($shop->getPluginSettingModule('r2sendcloud', 'status'));
|
||||
@ -111,29 +123,40 @@ class SendController extends AbstractController
|
||||
return [
|
||||
'parcels' => $parcels,
|
||||
'order' => $order,
|
||||
'shouldBeSaved' => $shouldBeSaved
|
||||
'shouldBeSaved' => $shouldBeSaved,
|
||||
];
|
||||
}
|
||||
|
||||
#[Route('/label/{uuid}/{sendcloudId}', name: 'psc_shop_r2_sendcloud_backend_label')]
|
||||
public function label(\PSC\System\SettingsBundle\Service\Shop $shopService, Order $orderService, Request $request, SerializerInterface $serializer, string $uuid, string $sendcloudId): StreamedResponse
|
||||
{
|
||||
public function label(
|
||||
\PSC\System\SettingsBundle\Service\Shop $shopService,
|
||||
Order $orderService,
|
||||
Request $request,
|
||||
SerializerInterface $serializer,
|
||||
string $uuid,
|
||||
string $sendcloudId,
|
||||
): StreamedResponse {
|
||||
$shop = $shopService->getMongoSelectedShop();
|
||||
$connection = new \Picqer\Carriers\SendCloud\Connection($shop->getPluginSettingModule('r2sendcloud', 'publicKey'), $shop->getPluginSettingModule('r2sendcloud', 'secretKey'));
|
||||
$connection = new \Picqer\Carriers\SendCloud\Connection(
|
||||
$shop->getPluginSettingModule('r2sendcloud', 'publicKey'),
|
||||
$shop->getPluginSettingModule('r2sendcloud', 'secretKey'),
|
||||
);
|
||||
$sendcloudClient = new \Picqer\Carriers\SendCloud\SendCloud($connection);
|
||||
|
||||
$labelUrl = $sendcloudClient->parcels()->find($sendcloudId)->getPrimaryLabelUrl();
|
||||
$documentDownloader = new DocumentDownloader($connection);
|
||||
$labelContents = $documentDownloader->getDocument($labelUrl, 'pdf');
|
||||
$response = new StreamedResponse(function () use ($labelContents) {
|
||||
|
||||
echo $labelContents;
|
||||
});
|
||||
$response->headers->set('Content-Type', 'application/pdf');
|
||||
$response->headers->set('Cache-Control', '');
|
||||
$response->headers->set('Content-Length', strlen($labelContents));
|
||||
$response->headers->set('Last-Modified', gmdate('D, d M Y H:i:s'));
|
||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'label_' . $sendcloudId . '.pdf');
|
||||
$contentDisposition = $response->headers->makeDisposition(
|
||||
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
|
||||
'label_' . $sendcloudId . '.pdf',
|
||||
);
|
||||
$response->headers->set('Content-Disposition', $contentDisposition);
|
||||
$response->prepare($request);
|
||||
return $response;
|
||||
|
||||
@ -3,29 +3,20 @@
|
||||
namespace Plugin\Custom\PSC\TemplateprintLayouter\Api\Backend;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use OpenApi\Annotations as OA;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use Plugin\Custom\PSC\TemplateprintLayouter\Dto\Backend\AttachLayouterToOrderPosition\Output;
|
||||
use PSC\Shop\EntityBundle\Entity\Orderpos;
|
||||
use PSC\Shop\EntityBundle\Repository\OrderposRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class AttachLayoutToOrderPosition extends AbstractController
|
||||
{
|
||||
/**
|
||||
* attach layouter design to an order position
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="response",
|
||||
* @OA\JsonContent(ref=@Model(type=\Plugin\Custom\PSC\TemplateprintLayouter\Dto\Backend\AttachLayouterToOrderPosition\Output::class))
|
||||
* )
|
||||
* @OA\Tag(name="Plugin/Custom/psc/TemplateprintLayouter/Basket")
|
||||
*/
|
||||
#[RequestBody(description: 'content', content: new JsonContent(ref: Input::class))]
|
||||
#[Response(response: 200, description: 'return shippings', content: new JsonContent(ref: Output::class))]
|
||||
#[Tag('Plugin/Custom/psc/TemplateprintLayouter/Basket')]
|
||||
#[Route(path: '/order/attach/{posUuid}/{layouterUuid}', methods: ['GET'])]
|
||||
public function attach(string $posUuid, string $layouterUuid, OrderposRepository $orderposRepository): JsonResponse
|
||||
{
|
||||
@ -40,11 +31,11 @@ class AttachLayoutToOrderPosition extends AbstractController
|
||||
mkdir('/data/www/old/market/templateprint/basket/' . $pos->getOrder()->getUID() . '/' . $pos->getPos());
|
||||
copy(
|
||||
'/data/www/old/market/templateprint/user/' . $layouterUuid . '/final.pdf',
|
||||
'/data/www/old/market/templateprint/basket/' .
|
||||
$pos->getOrder()->getUID() .
|
||||
'/' .
|
||||
$pos->getPos() .
|
||||
'/final.pdf',
|
||||
'/data/www/old/market/templateprint/basket/'
|
||||
. $pos->getOrder()->getUID()
|
||||
. '/'
|
||||
. $pos->getPos()
|
||||
. '/final.pdf',
|
||||
);
|
||||
$output->success = true;
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
namespace Plugin\Custom\PSC\TemplateprintLayouter\Api\Basket;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||
use OpenApi\Annotations as OA;
|
||||
use OpenApi\Attributes\RequestBody;
|
||||
use OpenApi\Attributes\Response;
|
||||
use OpenApi\Attributes\Tag;
|
||||
use Plugin\Custom\PSC\TemplateprintLayouter\Dto\Basket\Add\Input;
|
||||
use Plugin\Custom\PSC\TemplateprintLayouter\Dto\Basket\Add\Output;
|
||||
use PSC\Shop\EntityBundle\Entity\Contact;
|
||||
@ -14,7 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class Add extends AbstractController
|
||||
@ -28,21 +28,9 @@ class Add extends AbstractController
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* change temp basketitem
|
||||
* @deprecated
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="basket",
|
||||
* @OA\JsonContent(ref=@Model(type=\Plugin\Custom\PSC\TemplateprintLayouter\Dto\Basket\Add\Output::class))
|
||||
* )
|
||||
* @OA\RequestBody(
|
||||
* description="This is a request body",
|
||||
* @Model(type=\Plugin\Custom\PSC\TemplateprintLayouter\Dto\Basket\Add\Input::class))
|
||||
* )
|
||||
* @OA\Tag(name="Plugin/Custom/psc/TemplateprintLayouter/Basket")
|
||||
*/
|
||||
#[RequestBody(content: new JsonContent(ref: new Model(type: Input::class)))]
|
||||
#[Response(response: 200, description: 'basket', content: new JsonContent(ref: new Model(type: Output::class)))]
|
||||
#[Tag('Plugin/Custom/psc/TemplateprintLayouter/Basket')]
|
||||
#[Route(path: '/legacy/add', methods: ['POST'])]
|
||||
public function add(#[MapRequestPayload] Input $data): JsonResponse
|
||||
{
|
||||
@ -65,20 +53,20 @@ class Add extends AbstractController
|
||||
$basepath = 'http://' . $_SERVER['SERVER_NAME'];
|
||||
|
||||
if (
|
||||
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ||
|
||||
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'
|
||||
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
|
||||
|| isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'
|
||||
) {
|
||||
$basepath = 'https://' . $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
$output = new Output();
|
||||
$output->success = true;
|
||||
$output->genUrl =
|
||||
'http://tp:8080/w2p/batch?w2pinframeredirect=true&w2pproductid=' .
|
||||
$data->product .
|
||||
'&w2puserid=' .
|
||||
$data->contact .
|
||||
'&ARTID=' .
|
||||
$this->encryptDocker([
|
||||
'http://tp:8080/w2p/batch?w2pinframeredirect=true&w2pproductid='
|
||||
. $data->product
|
||||
. '&w2puserid='
|
||||
. $data->contact
|
||||
. '&ARTID='
|
||||
. $this->encryptDocker([
|
||||
'title' => $contact->getFirstname() . ' ' . $contact->getLastname(),
|
||||
'userid' => $data->contact,
|
||||
'basketposid' => $itemId,
|
||||
@ -88,9 +76,9 @@ class Add extends AbstractController
|
||||
'load' => 4,
|
||||
'SERVER' => $basepath,
|
||||
'LAYOUTERID' => Uuid::uuid4()->toString(),
|
||||
]) .
|
||||
'&time=' .
|
||||
time();
|
||||
])
|
||||
. '&time='
|
||||
. time();
|
||||
|
||||
return $this->json($output);
|
||||
|
||||
@ -115,27 +103,27 @@ class Add extends AbstractController
|
||||
{
|
||||
$crypttext = openssl_encrypt(http_build_query($data), 'AES-128-ECB', self::$key);
|
||||
if (
|
||||
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ||
|
||||
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'
|
||||
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
|
||||
|| isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'
|
||||
) {
|
||||
return (
|
||||
str_replace('+', 'PLUS', base64_encode($crypttext)) .
|
||||
'&URL=' .
|
||||
urlencode($url) .
|
||||
'&WEBHOST=' .
|
||||
urlencode('https://' . $_SERVER['SERVER_NAME']) .
|
||||
'&SAVEHOST=' .
|
||||
urlencode($saveHost)
|
||||
str_replace('+', 'PLUS', base64_encode($crypttext))
|
||||
. '&URL='
|
||||
. urlencode($url)
|
||||
. '&WEBHOST='
|
||||
. urlencode('https://' . $_SERVER['SERVER_NAME'])
|
||||
. '&SAVEHOST='
|
||||
. urlencode($saveHost)
|
||||
);
|
||||
}
|
||||
return (
|
||||
str_replace('+', 'PLUS', base64_encode($crypttext)) .
|
||||
'&URL=' .
|
||||
urlencode($url) .
|
||||
'&WEBHOST=' .
|
||||
urlencode('http://' . $_SERVER['SERVER_NAME']) .
|
||||
'&SAVEHOST=' .
|
||||
urlencode($saveHost)
|
||||
str_replace('+', 'PLUS', base64_encode($crypttext))
|
||||
. '&URL='
|
||||
. urlencode($url)
|
||||
. '&WEBHOST='
|
||||
. urlencode('http://' . $_SERVER['SERVER_NAME'])
|
||||
. '&SAVEHOST='
|
||||
. urlencode($saveHost)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/gallery')]
|
||||
class GalleryController extends AbstractController
|
||||
@ -96,4 +96,3 @@ class GalleryController extends AbstractController
|
||||
return new RedirectResponse('http://web/apps/' . $media->getUrl());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
namespace Plugin\System\Ariba\Auth\Form;
|
||||
|
||||
use Plugin\System\PSC\CaptchaFox\Form\Group\CaptchaFox;
|
||||
use PSC\Shop\EntityBundle\Document\Shop;
|
||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
@ -15,7 +15,7 @@ class ShopSettings implements Field
|
||||
{
|
||||
public function getTemplate()
|
||||
{
|
||||
return '@PluginSystemAribaAuth/form/shop_settings.html.twig';
|
||||
return '@PluginSystemAribaAuth/shop_settings.html.twig';
|
||||
}
|
||||
|
||||
public function getModule()
|
||||
@ -32,9 +32,13 @@ class ShopSettings implements Field
|
||||
|
||||
public function formPostSetData(FormEvent $event)
|
||||
{
|
||||
/** @var Shop $data */
|
||||
$data = $event->getData();
|
||||
$event->getForm()->get('ariba')->get('secretkey')->setData($data->getPluginSettingModule('ariba', 'secretkey'));
|
||||
$event
|
||||
->getForm()
|
||||
->get('ariba')
|
||||
->get('createContact')
|
||||
->setData($data->getPluginSettingModule('ariba', 'createContact'));
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
@ -44,17 +48,21 @@ class ShopSettings implements Field
|
||||
'required' => false,
|
||||
'mapped' => false,
|
||||
]);
|
||||
$builder->add('createContact', CheckboxType::class, [
|
||||
'label' => 'Create Contact if not exists',
|
||||
'required' => false,
|
||||
'mapped' => false,
|
||||
]);
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return AribaAuth::GROUP_ID;
|
||||
return AuthGroup::GROUP_ID;
|
||||
}
|
||||
|
||||
public function formPreSubmit(FormEvent $event)
|
||||
{
|
||||
// TODO: Implement formPreSubmit() method.
|
||||
}
|
||||
|
||||
public function formPreSetData(FormEvent $event)
|
||||
@ -63,17 +71,16 @@ class ShopSettings implements Field
|
||||
|
||||
public function formSubmit(FormEvent $event)
|
||||
{
|
||||
/** @var Shop $data */
|
||||
$data = $event->getData();
|
||||
$data->setPluginSettingModule(
|
||||
'captchafox',
|
||||
'ariba',
|
||||
'secretkey',
|
||||
$event->getForm()->get('captchafox')->get('secretkey')->getData(),
|
||||
$event->getForm()->get('ariba')->get('secretkey')->getData(),
|
||||
);
|
||||
$data->setPluginSettingModule(
|
||||
'captchafox',
|
||||
'publickey',
|
||||
$event->getForm()->get('captchafox')->get('publickey')->getData(),
|
||||
'ariba',
|
||||
'createContact',
|
||||
$event->getForm()->get('ariba')->get('createContact')->getData(),
|
||||
);
|
||||
$event->setData($data);
|
||||
}
|
||||
|
||||
@ -7,4 +7,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
{{ form_label(form.ariba.createContact) }}
|
||||
<div class="col-md-12">
|
||||
{{ form_widget(form.ariba.createContact, {attr: {'class': 'form-control'}}) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
info:
|
||||
datum: 16.12.2025
|
||||
release: 2.3
|
||||
datum: 03.02.2026
|
||||
release: 2.3.2
|
||||
|
||||
@ -1686,6 +1686,10 @@ class BasketController extends TP_Controller_Action
|
||||
$this->view->paymentwertbrutto,
|
||||
$this->view->versandbrutto,
|
||||
$mwertalle,
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
);
|
||||
}
|
||||
$this->view->shippingtype_extra_label = $basket->getShippingtypeExtraLabel();
|
||||
@ -5307,7 +5311,7 @@ class BasketController extends TP_Controller_Action
|
||||
'updated' => new MongoDB\BSON\UTCDateTime(),
|
||||
));
|
||||
|
||||
// $basket->clear();
|
||||
$basket->clear();
|
||||
|
||||
$this->view->priorityMessenger('Order created', 'success');
|
||||
|
||||
|
||||
@ -945,8 +945,7 @@ class UserController extends TP_Controller_Action
|
||||
}
|
||||
|
||||
if (
|
||||
isset($formData['rech']['rech-self_mobile']) &&
|
||||
isset($formData['rech']['rech-self_mobile']['lv'])
|
||||
isset($formData['rech']['rech-self_mobile']) && isset($formData['rech']['rech-self_mobile']['lv'])
|
||||
) {
|
||||
$contact->self_mobile_lv = $formData['rech']['rech-self_mobile']['lv'];
|
||||
$contact->self_mobile_vorwahl = $formData['rech']['rech-self_mobile']['vorwahl'];
|
||||
@ -1110,9 +1109,9 @@ class UserController extends TP_Controller_Action
|
||||
$contact->vonwo = $formData['login']['vonwo'];
|
||||
|
||||
if (
|
||||
isset($formData['login']) &&
|
||||
isset($formData['login']['newsletter']) &&
|
||||
$formData['login']['newsletter'] == 1
|
||||
isset($formData['login'])
|
||||
&& isset($formData['login']['newsletter'])
|
||||
&& $formData['login']['newsletter'] == 1
|
||||
) {
|
||||
$contact->newsletter = 1;
|
||||
} else {
|
||||
@ -1323,8 +1322,8 @@ class UserController extends TP_Controller_Action
|
||||
|
||||
if (!$this->_getParam('uuid')) {
|
||||
if (
|
||||
in_array('1', $formData['type']) ||
|
||||
!is_array($formData['type']) && $formData['type'] == 1
|
||||
in_array('1', $formData['type'])
|
||||
|| !is_array($formData['type']) && $formData['type'] == 1
|
||||
) {
|
||||
$cs = $contactaddress->copy();
|
||||
$cs->uuid = '';
|
||||
@ -1351,8 +1350,8 @@ class UserController extends TP_Controller_Action
|
||||
);
|
||||
}
|
||||
if (
|
||||
in_array('2', $formData['type']) ||
|
||||
!is_array($formData['type']) && $formData['type'] == 2
|
||||
in_array('2', $formData['type'])
|
||||
|| !is_array($formData['type']) && $formData['type'] == 2
|
||||
) {
|
||||
$cs = $contactaddress->copy();
|
||||
$cs->uuid = '';
|
||||
@ -1379,8 +1378,8 @@ class UserController extends TP_Controller_Action
|
||||
);
|
||||
}
|
||||
if (
|
||||
in_array('3', $formData['type']) ||
|
||||
!is_array($formData['type']) && $formData['type'] == 3
|
||||
in_array('3', $formData['type'])
|
||||
|| !is_array($formData['type']) && $formData['type'] == 3
|
||||
) {
|
||||
$cs = $contactaddress->copy();
|
||||
$cs->uuid = '';
|
||||
@ -1576,8 +1575,8 @@ class UserController extends TP_Controller_Action
|
||||
$formData = $this->getRequest()->getParams();
|
||||
|
||||
if (
|
||||
$form->isValid($formData) &&
|
||||
(isset($formData['type']) || $this->_getParam('mode', false) || $this->_getParam('uuid'))
|
||||
$form->isValid($formData)
|
||||
&& (isset($formData['type']) || $this->_getParam('mode', false) || $this->_getParam('uuid'))
|
||||
) {
|
||||
if ($this->_getParam('uuid')) {
|
||||
$contactaddress = Doctrine_Query::create()
|
||||
@ -2237,9 +2236,9 @@ class UserController extends TP_Controller_Action
|
||||
$shippingtypes = Doctrine_Query::create()
|
||||
->from('Shippingtype c')
|
||||
->where(
|
||||
'c.shop_id = ? AND c.enable = 1 AND (c.private = 0 OR (c.private = 1 AND c.id in (' .
|
||||
implode(',', $shippingtypeids) .
|
||||
'))) AND weight_from = 0 AND weight_to = 0 AND price_from = 0 AND price_to = 0',
|
||||
'c.shop_id = ? AND c.enable = 1 AND (c.private = 0 OR (c.private = 1 AND c.id in ('
|
||||
. implode(',', $shippingtypeids)
|
||||
. '))) AND weight_from = 0 AND weight_to = 0 AND price_from = 0 AND price_to = 0',
|
||||
array(
|
||||
$this->shop->id,
|
||||
),
|
||||
@ -2250,9 +2249,9 @@ class UserController extends TP_Controller_Action
|
||||
$payments = Doctrine_Query::create()
|
||||
->from('Paymenttype c')
|
||||
->where(
|
||||
'c.shop_id = ? AND c.enable = 1 AND (c.private = 0 OR (c.private = 1 AND c.id in (' .
|
||||
implode(',', $paymenttypeids) .
|
||||
')))',
|
||||
'c.shop_id = ? AND c.enable = 1 AND (c.private = 0 OR (c.private = 1 AND c.id in ('
|
||||
. implode(',', $paymenttypeids)
|
||||
. ')))',
|
||||
array(
|
||||
$this->shop->id,
|
||||
),
|
||||
@ -2440,9 +2439,9 @@ class UserController extends TP_Controller_Action
|
||||
$newsletter = $this->user->newsletter;
|
||||
|
||||
if (
|
||||
isset($formData['login']) &&
|
||||
isset($formData['login']['newsletter']) &&
|
||||
$formData['login']['newsletter'] == 1
|
||||
isset($formData['login'])
|
||||
&& isset($formData['login']['newsletter'])
|
||||
&& $formData['login']['newsletter'] == 1
|
||||
) {
|
||||
$this->user->newsletter = 1;
|
||||
$this->user->self_newsletter = 1;
|
||||
@ -2452,9 +2451,9 @@ class UserController extends TP_Controller_Action
|
||||
}
|
||||
|
||||
if (
|
||||
isset($formData['rech']) &&
|
||||
isset($formData['rech']['newsletter']) &&
|
||||
$formData['rech']['newsletter'] == 1
|
||||
isset($formData['rech'])
|
||||
&& isset($formData['rech']['newsletter'])
|
||||
&& $formData['rech']['newsletter'] == 1
|
||||
) {
|
||||
$this->user->newsletter = 1;
|
||||
$this->user->self_newsletter = 1;
|
||||
@ -2463,9 +2462,9 @@ class UserController extends TP_Controller_Action
|
||||
$this->user->self_newsletter = 0;
|
||||
}
|
||||
if (
|
||||
isset($formData['rech']) &&
|
||||
isset($formData['rech']['self_newsletter']) &&
|
||||
$formData['rech']['self_newsletter'] == 1
|
||||
isset($formData['rech'])
|
||||
&& isset($formData['rech']['self_newsletter'])
|
||||
&& $formData['rech']['self_newsletter'] == 1
|
||||
) {
|
||||
$this->user->newsletter = 1;
|
||||
$this->user->self_newsletter = 1;
|
||||
@ -2847,10 +2846,9 @@ class UserController extends TP_Controller_Action
|
||||
->leftJoin('p.Article a')
|
||||
->leftJoin('p.OrdersposConfirmContact c')
|
||||
->leftJoin('p.Orders o');
|
||||
$rows->where(
|
||||
'c.contact_id = ? AND p.status >= 90 AND p.status <= 120 AND p.status != 110 AND p.status != 120',
|
||||
array(intval($user['id'])),
|
||||
);
|
||||
$rows->where('c.contact_id = ? AND p.status >= 90 AND p.status <= 120 AND p.status != 110 AND p.status != 120', array(intval(
|
||||
$user['id'],
|
||||
)));
|
||||
|
||||
$rows->orderBy('o.created DESC');
|
||||
|
||||
@ -3006,9 +3004,9 @@ class UserController extends TP_Controller_Action
|
||||
if ($this->_request->isPost()) {
|
||||
$formData = $this->_request->getPost();
|
||||
if (
|
||||
$this->_getParam('name') != 'Benutzername' &&
|
||||
$this->_getParam('name') != '' &&
|
||||
$form->isValid($formData)
|
||||
$this->_getParam('name') != 'Benutzername'
|
||||
&& $this->_getParam('name') != ''
|
||||
&& $form->isValid($formData)
|
||||
) {
|
||||
$user = Doctrine_Query::create()
|
||||
->from('Contact as c')
|
||||
@ -3107,10 +3105,7 @@ class UserController extends TP_Controller_Action
|
||||
|
||||
if ($this->_request->isPost()) {
|
||||
$externalValidation = true;
|
||||
if ($this->shop->getPluginSettings(
|
||||
module: 'friendlycaptcha',
|
||||
name: 'secret',
|
||||
)) {
|
||||
if ($this->shop->getPluginSettings(module: 'friendlycaptcha', name: 'secret')) {
|
||||
$externalValidation = false;
|
||||
|
||||
$service_url = 'http://web/apps/api/plugin/system/psc/friendlycaptcha/validate';
|
||||
@ -3198,9 +3193,9 @@ class UserController extends TP_Controller_Action
|
||||
$contact->bank_bic = $formData['bank']['bank_bic'];
|
||||
}
|
||||
if (
|
||||
isset($formData['rech']) &&
|
||||
isset($formData['rech']['newsletter']) &&
|
||||
$formData['rech']['newsletter'] == 1
|
||||
isset($formData['rech'])
|
||||
&& isset($formData['rech']['newsletter'])
|
||||
&& $formData['rech']['newsletter'] == 1
|
||||
) {
|
||||
$contact->newsletter = 1;
|
||||
$contact->self_newsletter = 1;
|
||||
@ -3210,9 +3205,9 @@ class UserController extends TP_Controller_Action
|
||||
}
|
||||
|
||||
if (
|
||||
isset($formData['rech']) &&
|
||||
isset($formData['rech']['self_newsletter']) &&
|
||||
$formData['rech']['self_newsletter'] == 1
|
||||
isset($formData['rech'])
|
||||
&& isset($formData['rech']['self_newsletter'])
|
||||
&& $formData['rech']['self_newsletter'] == 1
|
||||
) {
|
||||
$contact->newsletter = 1;
|
||||
$contact->self_newsletter = 1;
|
||||
@ -3399,15 +3394,15 @@ class UserController extends TP_Controller_Action
|
||||
}
|
||||
|
||||
if (
|
||||
isset($config->user->captcha) &&
|
||||
(
|
||||
$this->install->id == 7 ||
|
||||
$this->install->id == 9 ||
|
||||
$this->install->id == 2 ||
|
||||
$this->shop->uid == '0001-54bb35a3-52722492-1144-4b2a493d' ||
|
||||
$this->shop->uid == '0001-578b5c52-52b8666e-115d-f0ee2bd2' ||
|
||||
$this->shop->uid == '45678uhggfrt67'
|
||||
)
|
||||
isset($config->user->captcha)
|
||||
&& (
|
||||
$this->install->id == 7
|
||||
|| $this->install->id == 9
|
||||
|| $this->install->id == 2
|
||||
|| $this->shop->uid == '0001-54bb35a3-52722492-1144-4b2a493d'
|
||||
|| $this->shop->uid == '0001-578b5c52-52b8666e-115d-f0ee2bd2'
|
||||
|| $this->shop->uid == '45678uhggfrt67'
|
||||
)
|
||||
) {
|
||||
$form->addSubForm(new Zend_Form_SubForm($config->user->captcha), 'captcha');
|
||||
if (isset($form->captcha->cp)) {
|
||||
@ -3437,10 +3432,7 @@ class UserController extends TP_Controller_Action
|
||||
|
||||
if ($this->_request->isPost()) {
|
||||
$externalValidation = true;
|
||||
if ($this->shop->getPluginSettings(
|
||||
module: 'friendlycaptcha',
|
||||
name: 'secret',
|
||||
)) {
|
||||
if ($this->shop->getPluginSettings(module: 'friendlycaptcha', name: 'secret')) {
|
||||
$externalValidation = false;
|
||||
|
||||
$service_url = 'http://web/apps/api/plugin/system/psc/friendlycaptcha/validate';
|
||||
@ -3463,17 +3455,17 @@ class UserController extends TP_Controller_Action
|
||||
|
||||
if (
|
||||
(
|
||||
$this->_getParam('externalValidation', false) ||
|
||||
isset($_SESSION['lieferja']) &&
|
||||
(
|
||||
!isset($formData['rech']['lieferja']) ||
|
||||
isset($formData['rech']['lieferja']) &&
|
||||
$_SESSION['lieferja'] == $formData['rech']['lieferja']
|
||||
)
|
||||
) &&
|
||||
$externalValidation &&
|
||||
$form->isValid($formData) &&
|
||||
($this->_getParam('quote', false) || $this->_getParam('quote', false) == '')
|
||||
$this->_getParam('externalValidation', false)
|
||||
|| isset($_SESSION['lieferja'])
|
||||
&& (
|
||||
!isset($formData['rech']['lieferja'])
|
||||
|| isset($formData['rech']['lieferja'])
|
||||
&& $_SESSION['lieferja'] == $formData['rech']['lieferja']
|
||||
)
|
||||
)
|
||||
&& $externalValidation
|
||||
&& $form->isValid($formData)
|
||||
&& ($this->_getParam('quote', false) || $this->_getParam('quote', false) == '')
|
||||
) {
|
||||
$contact = new Contact();
|
||||
|
||||
@ -3590,9 +3582,9 @@ class UserController extends TP_Controller_Action
|
||||
$contact->vonwo = $formData['login']['vonwo'];
|
||||
|
||||
if (
|
||||
isset($formData['login']) &&
|
||||
isset($formData['login']['newsletter']) &&
|
||||
$formData['login']['newsletter'] == 1
|
||||
isset($formData['login'])
|
||||
&& isset($formData['login']['newsletter'])
|
||||
&& $formData['login']['newsletter'] == 1
|
||||
) {
|
||||
$contact->newsletter = 1;
|
||||
$contact->self_newsletter = 1;
|
||||
@ -3602,18 +3594,18 @@ class UserController extends TP_Controller_Action
|
||||
}
|
||||
|
||||
if (
|
||||
isset($formData['login']) &&
|
||||
isset($formData['login']['collecting_orders']) &&
|
||||
$formData['login']['collecting_orders'] == 1
|
||||
isset($formData['login'])
|
||||
&& isset($formData['login']['collecting_orders'])
|
||||
&& $formData['login']['collecting_orders'] == 1
|
||||
) {
|
||||
$contact->collecting_orders = 1;
|
||||
} else {
|
||||
$contact->collecting_orders = 0;
|
||||
}
|
||||
if (
|
||||
isset($formData['login']) &&
|
||||
isset($formData['login']['is_sek']) &&
|
||||
$formData['login']['is_sek'] == 1
|
||||
isset($formData['login'])
|
||||
&& isset($formData['login']['is_sek'])
|
||||
&& $formData['login']['is_sek'] == 1
|
||||
) {
|
||||
$contact->is_sek = 1;
|
||||
} else {
|
||||
@ -3621,9 +3613,9 @@ class UserController extends TP_Controller_Action
|
||||
}
|
||||
|
||||
if (
|
||||
isset($formData['rech']) &&
|
||||
isset($formData['rech']['newsletter']) &&
|
||||
$formData['rech']['newsletter'] == 1
|
||||
isset($formData['rech'])
|
||||
&& isset($formData['rech']['newsletter'])
|
||||
&& $formData['rech']['newsletter'] == 1
|
||||
) {
|
||||
$contact->newsletter = 1;
|
||||
$contact->self_newsletter = 1;
|
||||
@ -3633,9 +3625,9 @@ class UserController extends TP_Controller_Action
|
||||
}
|
||||
|
||||
if (
|
||||
isset($formData['rech']) &&
|
||||
isset($formData['rech']['self_newsletter']) &&
|
||||
$formData['rech']['self_newsletter'] == 1
|
||||
isset($formData['rech'])
|
||||
&& isset($formData['rech']['self_newsletter'])
|
||||
&& $formData['rech']['self_newsletter'] == 1
|
||||
) {
|
||||
$contact->newsletter = 1;
|
||||
$contact->self_newsletter = 1;
|
||||
@ -4204,10 +4196,12 @@ class UserController extends TP_Controller_Action
|
||||
|
||||
public function xmlloginAction()
|
||||
{
|
||||
$aribaSecret = $this->shop->getPluginSettings('ariba', 'secretkey');
|
||||
$createContact = $this->shop->getPluginSettings('ariba', 'createContact');
|
||||
if ($this->_request->getParam('contact', false)) {
|
||||
$vars = explode('*', $this->_request->getParam('contact', false));
|
||||
if (count($vars) == 1) {
|
||||
if ('nsWXSoLmx8TNEjdE8fbn' != $this->_request->getParam('apikey', false)) {
|
||||
if ($aribaSecret != $this->_request->getParam('apikey', false)) {
|
||||
die('Not allowed');
|
||||
}
|
||||
|
||||
@ -4216,7 +4210,7 @@ class UserController extends TP_Controller_Action
|
||||
$_authAdapter->setIdentity($vars[0]);
|
||||
$result = Zend_Auth::getInstance()->authenticate($_authAdapter);
|
||||
} else {
|
||||
if ('nsWXSoLmx8TNEjdE8fbn' != $vars[1]) {
|
||||
if ($aribaSecret != $vars[1]) {
|
||||
die('Not allowed');
|
||||
}
|
||||
|
||||
@ -4243,6 +4237,11 @@ class UserController extends TP_Controller_Action
|
||||
if ($this->_request->isPost()) {
|
||||
$formData = $this->_request->getPost();
|
||||
$xml = simplexml_load_string(file_get_contents('php://input'));
|
||||
|
||||
if ($aribaSecret != (string) $xml->Header->Sender->Credential->SharedSecret) {
|
||||
die('not allowed');
|
||||
}
|
||||
|
||||
$basepath = 'https://' . $_SERVER['SERVER_NAME'];
|
||||
|
||||
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
|
||||
@ -4256,45 +4255,137 @@ class UserController extends TP_Controller_Action
|
||||
))
|
||||
->fetchOne();
|
||||
|
||||
if ($createContact && !$contact) {
|
||||
$contact = new Contact();
|
||||
|
||||
if ($this->shop->getContactOwnNumber()) {
|
||||
$templates = array('template' => $this->shop->getContactNumberPattern());
|
||||
$twig = new \Twig\Environment(new \Twig\Loader\ArrayLoader($templates));
|
||||
|
||||
$contact->setKundenNr($twig->render('template', array('number' =>
|
||||
$this->shop->getContactNumberStart())));
|
||||
$this->shop->setContactNumberStart($this->shop->getContactNumberStart() + 1);
|
||||
$this->shop->saveMongo();
|
||||
}
|
||||
|
||||
$contact->name = (string) $xml->Request->PunchOutSetupRequest->Extrinsic[1];
|
||||
$contact->self_email = (string) $xml->Request->PunchOutSetupRequest->Extrinsic[1];
|
||||
|
||||
$contact->newsletter = 0;
|
||||
$contact->self_newsletter = 0;
|
||||
|
||||
$contact->collecting_orders = 0;
|
||||
$contact->is_sek = 0;
|
||||
$contact->liefer = 0;
|
||||
|
||||
$Buchstaben = array(
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f',
|
||||
'g',
|
||||
'h',
|
||||
'k',
|
||||
'm',
|
||||
'n',
|
||||
'p',
|
||||
'q',
|
||||
'r',
|
||||
's',
|
||||
't',
|
||||
'u',
|
||||
'v',
|
||||
'w',
|
||||
'x',
|
||||
'y',
|
||||
'z',
|
||||
);
|
||||
$Zahlen = array('2', '3', '4', '5', '6', '7', '8', '9');
|
||||
|
||||
$Laenge = 6;
|
||||
|
||||
for ($i = 0, $Passwort = ''; strlen($Passwort) < $Laenge; $i++) {
|
||||
if (rand(0, 2) == 0 && isset($Buchstaben)) {
|
||||
$Passwort .= $Buchstaben[rand(0, count($Buchstaben))];
|
||||
} elseif (rand(0, 2) == 1 && isset($Zahlen)) {
|
||||
if (isset($Zahlen[rand(0, count($Zahlen))])) {
|
||||
$Passwort .= $Zahlen[rand(0, count($Zahlen))];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$contact->password = password_hash($Passwort, PASSWORD_DEFAULT);
|
||||
$contact->created = date('Y-m-d');
|
||||
$contact->updated = date('Y-m-d');
|
||||
$locale = Zend_Registry::get('locale');
|
||||
$contact->language = $locale->getLanguage() . '_' . $locale->getRegion();
|
||||
$contact->hash = $Passwort;
|
||||
$contact->enable = true;
|
||||
$contact->Install = $this->shop->Install;
|
||||
$contact->account_id = $this->shop->default_account;
|
||||
|
||||
$contact->save();
|
||||
$contact->saveMongo();
|
||||
|
||||
$shopcontact = new ShopContact();
|
||||
$shopcontact->Contact = $contact;
|
||||
$shopcontact->Shop = $this->shop;
|
||||
$shopcontact->save();
|
||||
|
||||
$roles = new Zend_Config_Ini(APPLICATION_PATH . '/configs/roles.ini', APPLICATION_ENV);
|
||||
foreach ($roles->contact as $row) {
|
||||
$rolecontact = new ContactRole();
|
||||
$rolecontact->Contact = $contact;
|
||||
$rolecontact->role_id = $row;
|
||||
$rolecontact->save();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$createContact && !$contact) {
|
||||
die('not found');
|
||||
}
|
||||
|
||||
$payloadId = $xml['payloadID'];
|
||||
$timestamp = $xml['timestamp'];
|
||||
|
||||
if ($contact) {
|
||||
echo
|
||||
'<?xml version="1.0"?>' .
|
||||
'<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">' .
|
||||
'<cXML xml:lang="de" payloadID="' .
|
||||
$payloadId .
|
||||
'" timestamp="' .
|
||||
$timestamp .
|
||||
'">' .
|
||||
'<Response>' .
|
||||
'<Status code="200" text="success"/>' .
|
||||
'<PunchOutSetupResponse>' .
|
||||
'<StartPage>' .
|
||||
'<URL>' .
|
||||
$basepath .
|
||||
'/user/xmllogin?contact=' .
|
||||
$contact->id .
|
||||
'*' .
|
||||
'nsWXSoLmx8TNEjdE8fbn' .
|
||||
'*' .
|
||||
urlencode((string) $xml->Request->PunchOutSetupRequest->BrowserFormPost->URL) .
|
||||
'*' .
|
||||
urlencode((string) $xml->Header->From->Credential->Identity) .
|
||||
'*' .
|
||||
urlencode((string) $xml->Header->To->Credential->Identity) .
|
||||
'*' .
|
||||
urlencode((string) $xml->Header->Sender->Credential['domain']) .
|
||||
'*' .
|
||||
urlencode((string) $xml->Header->Sender->Credential->Identity) .
|
||||
'*' .
|
||||
urlencode((string) $xml->Request->PunchOutSetupRequest->BuyerCookie) .
|
||||
'</URL>' .
|
||||
'</StartPage>' .
|
||||
'</PunchOutSetupResponse>' .
|
||||
'</Response>' .
|
||||
'</cXML>'
|
||||
'<?xml version="1.0"?>'
|
||||
. '<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">'
|
||||
. '<cXML xml:lang="de" payloadID="'
|
||||
. $payloadId
|
||||
. '" timestamp="'
|
||||
. $timestamp
|
||||
. '">'
|
||||
. '<Response>'
|
||||
. '<Status code="200" text="success"/>'
|
||||
. '<PunchOutSetupResponse>'
|
||||
. '<StartPage>'
|
||||
. '<URL>'
|
||||
. $basepath
|
||||
. '/user/xmllogin?contact='
|
||||
. $contact->id
|
||||
. '*'
|
||||
. $aribaSecret
|
||||
. '*'
|
||||
. urlencode((string) $xml->Request->PunchOutSetupRequest->BrowserFormPost->URL)
|
||||
. '*'
|
||||
. urlencode((string) $xml->Header->From->Credential->Identity)
|
||||
. '*'
|
||||
. urlencode((string) $xml->Header->To->Credential->Identity)
|
||||
. '*'
|
||||
. urlencode((string) $xml->Header->Sender->Credential['domain'])
|
||||
. '*'
|
||||
. urlencode((string) $xml->Header->Sender->Credential->Identity)
|
||||
. '*'
|
||||
. urlencode((string) $xml->Request->PunchOutSetupRequest->BuyerCookie)
|
||||
. '</URL>'
|
||||
. '</StartPage>'
|
||||
. '</PunchOutSetupResponse>'
|
||||
. '</Response>'
|
||||
. '</cXML>'
|
||||
;
|
||||
} else {
|
||||
echo 'failure';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user