Add Plugin Sort Collectlayouter
This commit is contained in:
parent
a9fd3632df
commit
f76ad94d81
@ -20,6 +20,12 @@ class Contact
|
|||||||
#[OA\Property(type: 'string')]
|
#[OA\Property(type: 'string')]
|
||||||
private string $uuid = "";
|
private string $uuid = "";
|
||||||
|
|
||||||
|
#[OA\Property(type: 'string', format: 'date')]
|
||||||
|
private ?\DateTime $updated = null;
|
||||||
|
|
||||||
|
#[OA\Property(type: 'string', format: 'date')]
|
||||||
|
private ?\DateTime $created = null;
|
||||||
|
|
||||||
#[OA\Property(type: 'boolean')]
|
#[OA\Property(type: 'boolean')]
|
||||||
private bool $locked = false;
|
private bool $locked = false;
|
||||||
|
|
||||||
@ -502,4 +508,20 @@ class Contact
|
|||||||
{
|
{
|
||||||
$this->countryCode = $countryCode;
|
$this->countryCode = $countryCode;
|
||||||
}
|
}
|
||||||
|
public function setCreated(\DateTime $created): void
|
||||||
|
{
|
||||||
|
$this->created = $created;
|
||||||
|
}
|
||||||
|
public function getCreated(): ?\DateTime
|
||||||
|
{
|
||||||
|
return $this->created;
|
||||||
|
}
|
||||||
|
public function setUpdated(\DateTime $updated): void
|
||||||
|
{
|
||||||
|
$this->updated = $updated;
|
||||||
|
}
|
||||||
|
public function getUpdated(): ?\DateTime
|
||||||
|
{
|
||||||
|
return $this->updated;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,10 +147,12 @@ class Contact
|
|||||||
}
|
}
|
||||||
$contact->setAccount($account);
|
$contact->setAccount($account);
|
||||||
|
|
||||||
$contact->setUUId((string)$contactEntity->getUuid());
|
$contact->setUuid((string)$contactEntity->getUuid());
|
||||||
$contact->setEMail((string)$contactEntity->getEmail());
|
$contact->setEmail((string)$contactEntity->getEmail());
|
||||||
$contact->setUid((int)$contactEntity->getUid());
|
$contact->setUid((int)$contactEntity->getUid());
|
||||||
$contact->setUsername((string)$contactEntity->getEmail());
|
$contact->setUsername((string)$contactEntity->getEmail());
|
||||||
|
$contact->setCreated($contactEntity->getCreatedAt());
|
||||||
|
$contact->setUpdated($contactEntity->getUpdatedAt());
|
||||||
$contact->setCustomerNumber((string)$contactDoc->getKundenNr());
|
$contact->setCustomerNumber((string)$contactDoc->getKundenNr());
|
||||||
|
|
||||||
$contact->setLocked((bool)$contactEntity->isLocked());
|
$contact->setLocked((bool)$contactEntity->isLocked());
|
||||||
|
|||||||
@ -79,74 +79,74 @@ class UserController extends AbstractController
|
|||||||
];
|
];
|
||||||
|
|
||||||
$titleEnable = array_values(array_filter($docData, function ($elm) {
|
$titleEnable = array_values(array_filter($docData, function ($elm) {
|
||||||
if($elm['name'] == 'data[title][enable]') {
|
if ($elm['name'] == 'data[title][enable]') {
|
||||||
return $elm;
|
return $elm;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(count($titleEnable) && $titleEnable[0]['value'] == 1) {
|
if (count($titleEnable) && $titleEnable[0]['value'] == 1) {
|
||||||
$data['titleEnable'] = true;
|
$data['titleEnable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos2Enable = array_values(array_filter($docData, function ($elm) {
|
$pos2Enable = array_values(array_filter($docData, function ($elm) {
|
||||||
if($elm['name'] == 'data[position2][enable]') {
|
if ($elm['name'] == 'data[position2][enable]') {
|
||||||
return $elm;
|
return $elm;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(count($pos2Enable) && $pos2Enable[0]['value'] == 1) {
|
if (count($pos2Enable) && $pos2Enable[0]['value'] == 1) {
|
||||||
$data['abteilungEnable'] = true;
|
$data['abteilungEnable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$pos3Enable = array_values(array_filter($docData, function ($elm) {
|
$pos3Enable = array_values(array_filter($docData, function ($elm) {
|
||||||
if($elm['name'] == 'data[position3][enable]') {
|
if ($elm['name'] == 'data[position3][enable]') {
|
||||||
return $elm;
|
return $elm;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(count($pos3Enable) && $pos3Enable[0]['value'] == 1) {
|
if (count($pos3Enable) && $pos3Enable[0]['value'] == 1) {
|
||||||
$data['functionEnable'] = true;
|
$data['functionEnable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$officeEnable = array_values(array_filter($docData, function ($elm) {
|
$officeEnable = array_values(array_filter($docData, function ($elm) {
|
||||||
if($elm['name'] == 'data[office][enable]') {
|
if ($elm['name'] == 'data[office][enable]') {
|
||||||
return $elm;
|
return $elm;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(count($officeEnable) && $officeEnable[0]['value'] == 1) {
|
if (count($officeEnable) && $officeEnable[0]['value'] == 1) {
|
||||||
$data['company2Enable'] = true;
|
$data['company2Enable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fonEnable = array_values(array_filter($docData, function ($elm) {
|
$fonEnable = array_values(array_filter($docData, function ($elm) {
|
||||||
if($elm['name'] == 'data[fon][enable]') {
|
if ($elm['name'] == 'data[fon][enable]') {
|
||||||
return $elm;
|
return $elm;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(count($fonEnable) && $fonEnable[0]['value'] == 1) {
|
if (count($fonEnable) && $fonEnable[0]['value'] == 1) {
|
||||||
$data['phoneEnable'] = true;
|
$data['phoneEnable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mobileEnable = array_values(array_filter($docData, function ($elm) {
|
$mobileEnable = array_values(array_filter($docData, function ($elm) {
|
||||||
if($elm['name'] == 'data[mobile][enable]') {
|
if ($elm['name'] == 'data[mobile][enable]') {
|
||||||
return $elm;
|
return $elm;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(count($mobileEnable) && $mobileEnable[0]['value'] == 1) {
|
if (count($mobileEnable) && $mobileEnable[0]['value'] == 1) {
|
||||||
$data['mobileEnable'] = true;
|
$data['mobileEnable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$faxEnable = array_values(array_filter($docData, function ($elm) {
|
$faxEnable = array_values(array_filter($docData, function ($elm) {
|
||||||
if($elm['name'] == 'data[fax][enable]') {
|
if ($elm['name'] == 'data[fax][enable]') {
|
||||||
return $elm;
|
return $elm;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(count($faxEnable) && $faxEnable[0]['value'] == 1) {
|
if (count($faxEnable) && $faxEnable[0]['value'] == 1) {
|
||||||
$data['faxEnable'] = true;
|
$data['faxEnable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,43 +190,43 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
|
|
||||||
$docData = [];
|
$docData = [];
|
||||||
if(isset($data['titleEnable']) && $data['titleEnable']) {
|
if (isset($data['titleEnable']) && $data['titleEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[title][enable]',
|
'name' => 'data[title][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['abteilungEnable']) && $data['abteilungEnable']) {
|
if (isset($data['abteilungEnable']) && $data['abteilungEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[position2][enable]',
|
'name' => 'data[position2][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['functionEnable']) && $data['functionEnable']) {
|
if (isset($data['functionEnable']) && $data['functionEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[position3][enable]',
|
'name' => 'data[position3][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['company2Enable']) && $data['company2Enable']) {
|
if (isset($data['company2Enable']) && $data['company2Enable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[office][enable]',
|
'name' => 'data[office][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['phoneEnable']) && $data['phoneEnable']) {
|
if (isset($data['phoneEnable']) && $data['phoneEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[fon][enable]',
|
'name' => 'data[fon][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['mobileEnable']) && $data['mobileEnable']) {
|
if (isset($data['mobileEnable']) && $data['mobileEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[mobile][enable]',
|
'name' => 'data[mobile][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['faxEnable']) && $data['faxEnable']) {
|
if (isset($data['faxEnable']) && $data['faxEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[fax][enable]',
|
'name' => 'data[fax][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
@ -261,7 +261,7 @@ class UserController extends AbstractController
|
|||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
$contactExists = false;
|
$contactExists = false;
|
||||||
if($form->isSubmitted()) {
|
if ($form->isSubmitted()) {
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
|
|
||||||
$contactEx = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
$contactEx = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
||||||
@ -269,7 +269,7 @@ class UserController extends AbstractController
|
|||||||
->setParameter('username', $data['email'])->setParameter('shop', $selectedShop->getUID())
|
->setParameter('username', $data['email'])->setParameter('shop', $selectedShop->getUID())
|
||||||
->getQuery()->getOneOrNullResult();
|
->getQuery()->getOneOrNullResult();
|
||||||
|
|
||||||
if($contactEx) {
|
if ($contactEx) {
|
||||||
$contactExists = true;
|
$contactExists = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -342,43 +342,43 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
|
|
||||||
$docData = [];
|
$docData = [];
|
||||||
if(isset($data['titleEnable']) && $data['titleEnable']) {
|
if (isset($data['titleEnable']) && $data['titleEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[title][enable]',
|
'name' => 'data[title][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['abteilungEnable']) && $data['abteilungEnable']) {
|
if (isset($data['abteilungEnable']) && $data['abteilungEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[position2][enable]',
|
'name' => 'data[position2][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['functionEnable']) && $data['functionEnable']) {
|
if (isset($data['functionEnable']) && $data['functionEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[position3][enable]',
|
'name' => 'data[position3][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['company2Enable']) && $data['company2Enable']) {
|
if (isset($data['company2Enable']) && $data['company2Enable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[office][enable]',
|
'name' => 'data[office][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['phoneEnable']) && $data['phoneEnable']) {
|
if (isset($data['phoneEnable']) && $data['phoneEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[fon][enable]',
|
'name' => 'data[fon][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['mobileEnable']) && $data['mobileEnable']) {
|
if (isset($data['mobileEnable']) && $data['mobileEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[mobile][enable]',
|
'name' => 'data[mobile][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if(isset($data['faxEnable']) && $data['faxEnable']) {
|
if (isset($data['faxEnable']) && $data['faxEnable']) {
|
||||||
$docData[] = [
|
$docData[] = [
|
||||||
'name' => 'data[fax][enable]',
|
'name' => 'data[fax][enable]',
|
||||||
'value' => '1'
|
'value' => '1'
|
||||||
@ -405,11 +405,11 @@ class UserController extends AbstractController
|
|||||||
#[Route('/list/{productUuid}/{orderBy}/{sort}', name: 'plugin_custom_psc_collectlayouter_user_list')]
|
#[Route('/list/{productUuid}/{orderBy}/{sort}', name: 'plugin_custom_psc_collectlayouter_user_list')]
|
||||||
public function list(Request $request, string $productUuid = 'none', $orderBy = 'uid', $sort = 'asc'): array
|
public function list(Request $request, string $productUuid = 'none', $orderBy = 'uid', $sort = 'asc'): array
|
||||||
{
|
{
|
||||||
if($this->getUser() == null || !$this->getUser()->getIsSek()) {
|
if ($this->getUser() == null || !$this->getUser()->getIsSek()) {
|
||||||
throw new AccessDeniedException("Not Sek");
|
throw new AccessDeniedException("Not Sek");
|
||||||
}
|
}
|
||||||
$product = false;
|
$product = false;
|
||||||
if($productUuid != "none") {
|
if ($productUuid != "none") {
|
||||||
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $productUuid]);
|
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $productUuid]);
|
||||||
|
|
||||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
||||||
@ -456,33 +456,33 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
$ids = [];
|
$ids = [];
|
||||||
|
|
||||||
foreach($qb->getQuery()->execute() as $row) {
|
foreach ($qb->getQuery()->execute() as $row) {
|
||||||
$ids[] = (int)$row->getUid();
|
$ids[] = (int)$row->getUid();
|
||||||
}
|
}
|
||||||
|
|
||||||
$contacts = [];
|
$contacts = [];
|
||||||
if($productDoc) {
|
if ($productDoc) {
|
||||||
$accountMode = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterAccountFilter');
|
$accountMode = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterAccountFilter');
|
||||||
$accountSelect = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterOrdersAccount');
|
$accountSelect = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterOrdersAccount');
|
||||||
if($accountMode == 1) {
|
if ($accountMode == 1) {
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
||||||
->orderBy('contact.' . $orderBy, $sort)
|
->orderBy('contact.' . $orderBy, $sort)
|
||||||
->leftJoin('contact.shops', 'shop')
|
->leftJoin('contact.shops', 'shop')
|
||||||
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
||||||
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
||||||
}elseif($accountMode == 2) {
|
} elseif ($accountMode == 2) {
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
||||||
->orderBy('contact.' . $orderBy, $sort)
|
->orderBy('contact.' . $orderBy, $sort)
|
||||||
->leftJoin('contact.shops', 'shop')
|
->leftJoin('contact.shops', 'shop')
|
||||||
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $this->getUser()->getAccount())->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $this->getUser()->getAccount())->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
||||||
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
||||||
}elseif($accountMode == 3) {
|
} elseif ($accountMode == 3) {
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
||||||
->orderBy('contact.' . $orderBy, $sort)
|
->orderBy('contact.' . $orderBy, $sort)
|
||||||
->leftJoin('contact.shops', 'shop')
|
->leftJoin('contact.shops', 'shop')
|
||||||
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $accountSelect)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $accountSelect)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
||||||
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
||||||
}elseif($accountMode == 4) {
|
} elseif ($accountMode == 4) {
|
||||||
$accounts = [];
|
$accounts = [];
|
||||||
$accounts[] = $accountSelect;
|
$accounts[] = $accountSelect;
|
||||||
$accounts = $this->getAccountsForAccount($accounts, $accountSelect);
|
$accounts = $this->getAccountsForAccount($accounts, $accountSelect);
|
||||||
@ -491,7 +491,7 @@ class UserController extends AbstractController
|
|||||||
->leftJoin('contact.shops', 'shop')
|
->leftJoin('contact.shops', 'shop')
|
||||||
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
||||||
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
||||||
}elseif($accountMode == 5) {
|
} elseif ($accountMode == 5) {
|
||||||
$accounts = [];
|
$accounts = [];
|
||||||
$accounts[] = $this->getUser()->getAccount();
|
$accounts[] = $this->getUser()->getAccount();
|
||||||
$accounts = $this->getAccountsForAccount($accounts, $this->getUser()->getAccount());
|
$accounts = $this->getAccountsForAccount($accounts, $this->getUser()->getAccount());
|
||||||
@ -501,7 +501,7 @@ class UserController extends AbstractController
|
|||||||
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())
|
||||||
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute();
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')
|
||||||
->orderBy('contact.' . $orderBy, $sort)
|
->orderBy('contact.' . $orderBy, $sort)
|
||||||
->leftJoin('contact.shops', 'shop')
|
->leftJoin('contact.shops', 'shop')
|
||||||
@ -511,8 +511,8 @@ class UserController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$temp = [];
|
$temp = [];
|
||||||
foreach($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
if(count($contact->getShopContact()) == 1) {
|
if (count($contact->getShopContact()) == 1) {
|
||||||
$contactObj = new \PSC\Shop\ContactBundle\Model\Contact();
|
$contactObj = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||||
$this->contactTransformer->fromDb($contactObj, $contact);
|
$this->contactTransformer->fromDb($contactObj, $contact);
|
||||||
$temp[] = $contactObj;
|
$temp[] = $contactObj;
|
||||||
@ -521,7 +521,7 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
return array(
|
return array(
|
||||||
'contacts' => $temp,
|
'contacts' => $temp,
|
||||||
'sort' => $sort,
|
'sort' => $sort == 'asc' ? 'desc' : 'asc',
|
||||||
'orderBy' => $orderBy,
|
'orderBy' => $orderBy,
|
||||||
'basket' => $basket,
|
'basket' => $basket,
|
||||||
'productUuid' => $productUuid,
|
'productUuid' => $productUuid,
|
||||||
@ -531,32 +531,32 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
$contacts = [];
|
$contacts = [];
|
||||||
if($productDoc) {
|
if ($productDoc) {
|
||||||
$accountMode = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterAccountFilter');
|
$accountMode = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterAccountFilter');
|
||||||
$accountSelect = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterOrdersAccount');
|
$accountSelect = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterOrdersAccount');
|
||||||
if($accountMode == 1) {
|
if ($accountMode == 1) {
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
||||||
}elseif($accountMode == 2) {
|
} elseif ($accountMode == 2) {
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $this->getUser()->getAccount())->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $this->getUser()->getAccount())->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
||||||
}elseif($accountMode == 3) {
|
} elseif ($accountMode == 3) {
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $accountSelect)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $accountSelect)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
||||||
}elseif($accountMode == 4) {
|
} elseif ($accountMode == 4) {
|
||||||
$accounts = [];
|
$accounts = [];
|
||||||
$accounts[] = $accountSelect;
|
$accounts[] = $accountSelect;
|
||||||
$accounts = $this->getAccountsForAccount($accounts, $accountSelect);
|
$accounts = $this->getAccountsForAccount($accounts, $accountSelect);
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
||||||
}elseif($accountMode == 5) {
|
} elseif ($accountMode == 5) {
|
||||||
$accounts = [];
|
$accounts = [];
|
||||||
$accounts[] = $this->getUser()->getAccount();
|
$accounts[] = $this->getUser()->getAccount();
|
||||||
$accounts = $this->getAccountsForAccount($accounts, $this->getUser()->getAccount());
|
$accounts = $this->getAccountsForAccount($accounts, $this->getUser()->getAccount());
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
$contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute();
|
||||||
}
|
}
|
||||||
$temp = [];
|
$temp = [];
|
||||||
foreach($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
if(count($contact->getShopContact()) == 1) {
|
if (count($contact->getShopContact()) == 1) {
|
||||||
$contactObj = new \PSC\Shop\ContactBundle\Model\Contact();
|
$contactObj = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||||
$this->contactTransformer->fromDb($contactObj, $contact);
|
$this->contactTransformer->fromDb($contactObj, $contact);
|
||||||
$temp[] = $contactObj;
|
$temp[] = $contactObj;
|
||||||
@ -565,7 +565,7 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
return array(
|
return array(
|
||||||
'contacts' => $temp,
|
'contacts' => $temp,
|
||||||
'sort' => $sort,
|
'sort' => $sort == 'asc' ? 'desc' : 'asc',
|
||||||
'orderBy' => $orderBy,
|
'orderBy' => $orderBy,
|
||||||
'basket' => $basket,
|
'basket' => $basket,
|
||||||
'productUuid' => $productUuid,
|
'productUuid' => $productUuid,
|
||||||
@ -582,7 +582,7 @@ class UserController extends AbstractController
|
|||||||
$contact = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uuid' => $contactUuid));
|
$contact = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uuid' => $contactUuid));
|
||||||
|
|
||||||
$copyContact = $contactService->copy($contact);
|
$copyContact = $contactService->copy($contact);
|
||||||
if($productUuid != "") {
|
if ($productUuid != "") {
|
||||||
return $this->redirectToRoute('plugin_custom_psc_collectlayouter_collect', ['productUuid' => $productUuid, 'contactUuid' => $copyContact->getUuid(), 'mode' => 2]);
|
return $this->redirectToRoute('plugin_custom_psc_collectlayouter_collect', ['productUuid' => $productUuid, 'contactUuid' => $copyContact->getUuid(), 'mode' => 2]);
|
||||||
}
|
}
|
||||||
return $this->redirectToRoute('plugin_custom_psc_collectlayouter_user_edit', ['productUuid' => $productUuid, 'contactUuid' => $copyContact->getUuid()]);
|
return $this->redirectToRoute('plugin_custom_psc_collectlayouter_user_edit', ['productUuid' => $productUuid, 'contactUuid' => $copyContact->getUuid()]);
|
||||||
@ -621,10 +621,10 @@ class UserController extends AbstractController
|
|||||||
$vcard->addName($contact->getLastname(), $contact->getFirstname(), "", "", "");
|
$vcard->addName($contact->getLastname(), $contact->getFirstname(), "", "", "");
|
||||||
$vcard->addCompany($contact->getCompany());
|
$vcard->addCompany($contact->getCompany());
|
||||||
$title = $contact->getPosition();
|
$title = $contact->getPosition();
|
||||||
if($contact->getAbteilung() != "") {
|
if ($contact->getAbteilung() != "") {
|
||||||
$title = $title . ', ' . $contact->getAbteilung();
|
$title = $title . ', ' . $contact->getAbteilung();
|
||||||
}
|
}
|
||||||
if($contact->getFunction() != "") {
|
if ($contact->getFunction() != "") {
|
||||||
$title = $title . ', ' . $contact->getFunction();
|
$title = $title . ', ' . $contact->getFunction();
|
||||||
}
|
}
|
||||||
$vcard->addJobtitle($title);
|
$vcard->addJobtitle($title);
|
||||||
@ -640,7 +640,7 @@ class UserController extends AbstractController
|
|||||||
private function getAccountsForAccount(array $accounts, $accountSelect)
|
private function getAccountsForAccount(array $accounts, $accountSelect)
|
||||||
{
|
{
|
||||||
$accountsEntity = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Account')->findBy(array('parent' => $accountSelect));
|
$accountsEntity = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Account')->findBy(array('parent' => $accountSelect));
|
||||||
foreach($accountsEntity as $accountEntity) {
|
foreach ($accountsEntity as $accountEntity) {
|
||||||
$accounts[] = $accountEntity->getId();
|
$accounts[] = $accountEntity->getId();
|
||||||
$accounts = $this->getAccountsForAccount($accounts, $accountEntity->getId());
|
$accounts = $this->getAccountsForAccount($accounts, $accountEntity->getId());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,6 +141,19 @@ enum ElementBinding: int
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSortField(): string
|
||||||
|
{
|
||||||
|
return match($this) {
|
||||||
|
self::none => "",
|
||||||
|
self::UsernameLogin => 'username',
|
||||||
|
self::UsernameLogin => 'username',
|
||||||
|
self::Company => 'company',
|
||||||
|
self::Firstname => 'firstname',
|
||||||
|
self::Lastname => 'lastname',
|
||||||
|
default => ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public function getField(Contact $contact): string
|
public function getField(Contact $contact): string
|
||||||
{
|
{
|
||||||
return match($this) {
|
return match($this) {
|
||||||
|
|||||||
@ -19,9 +19,15 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th style=""><a href="{{ path("plugin_custom_psc_collectlayouter_user_list", { productUuid: productUuid, orderBy: 'updatedAt', sort: sort }) }}">aktualisiert am</a></th>
|
||||||
{% for setting in settings.getListSetting %}
|
{% for setting in settings.getListSetting %}
|
||||||
<th style="">{{ setting.label }}</th>
|
<th style="">
|
||||||
|
{% if setting.binding.getSortField() != "" %}
|
||||||
|
<a href="{{ path("plugin_custom_psc_collectlayouter_user_list", { productUuid: productUuid, orderBy: setting.binding.getSortField(), sort: sort }) }}">{{ setting.label }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ setting.label }}
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<th style=""></th>
|
<th style=""></th>
|
||||||
<th style=""></th>
|
<th style=""></th>
|
||||||
@ -36,6 +42,7 @@
|
|||||||
{% for contact in contacts %}
|
{% for contact in contacts %}
|
||||||
{% if contact.layouterData.firstname != 'Vorname' and contact.layouterData.lastname != 'Nachname' and contact.layouterData.firstname != 'anonym' and contact.layouterData.lastname != 'anonym' %}
|
{% if contact.layouterData.firstname != 'Vorname' and contact.layouterData.lastname != 'Nachname' and contact.layouterData.firstname != 'anonym' and contact.layouterData.lastname != 'anonym' %}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td style="">{{ contact.updated|date("d.m.Y") }}</td>
|
||||||
{% for setting in settings.getListSetting %}
|
{% for setting in settings.getListSetting %}
|
||||||
<td style="">{{ setting.binding.getField(contact) }}</td>
|
<td style="">{{ setting.binding.getField(contact) }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user