Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit 7c245c57 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: copy erp entity, plugin param added

Übergeordneter c22fa25b
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!140Update 'next-4.x' with latest changes from 'main',!117Next 3.x
......@@ -6,8 +6,8 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_copyEntity',
function ($uuid, $processKeepStatus) {
$Instance = (new QUI\ERP\Processes())->getEntity($uuid);
function ($uuid, $processKeepStatus, $entityPlugin) {
$Instance = (new QUI\ERP\Processes())->getEntity($uuid, $entityPlugin);
if (!($Instance instanceof QUI\ERP\ErpCopyInterface)) {
throw new QUI\Exception('This entity can not be copied!');
......@@ -24,6 +24,6 @@ function ($uuid, $processKeepStatus) {
return $Copy->toArray();
},
['uuid', 'processKeepStatus'],
['uuid', 'processKeepStatus', 'entityPlugin'],
'Permission::checkAdminUser'
);
......@@ -6,11 +6,11 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_erp_ajax_getEntity',
function ($uuid) {
$Instance = (new QUI\ERP\Processes())->getEntity($uuid);
function ($uuid, $entityPlugin) {
$Instance = (new QUI\ERP\Processes())->getEntity($uuid, $entityPlugin);
return $Instance->toArray();
},
['uuid'],
['uuid', 'entityPlugin'],
'Permission::checkAdminUser'
);
......@@ -30,6 +30,7 @@ define('package/quiqqer/erp/bin/backend/controls/dialogs/CopyErpEntityDialog', [
options: {
hash: false,
entityPlugin: false, // kann übergeben werden um sicherzustellen das die entität auch wirklich aus diesem plugin kommt
maxHeight: 400,
maxWidth: 700,
......@@ -60,6 +61,7 @@ define('package/quiqqer/erp/bin/backend/controls/dialogs/CopyErpEntityDialog', [
QUIAjax.get('package_quiqqer_erp_ajax_getEntity', resolve, {
'package': 'quiqqer/erp',
uuid: this.getAttribute('hash'),
entityPlugin: this.getAttribute('entityPlugin'),
onError: reject
});
});
......@@ -156,6 +158,7 @@ define('package/quiqqer/erp/bin/backend/controls/dialogs/CopyErpEntityDialog', [
}, {
'package': 'quiqqer/erp',
uuid: this.getAttribute('hash'),
entityPlugin: this.getAttribute('entityPlugin'),
processKeepStatus: Copy.value,
onError: () => {
this.fireEvent('error', [self]);
......
......@@ -38,63 +38,69 @@ class Processes
/**
* @throws Exception
*/
public function getEntity($entityHash): ErpEntityInterface
public function getEntity($entityHash, $entityPlugin = false): ErpEntityInterface
{
//'quiqqer/booking',
try {
} catch (\Exception) {
if ($entityPlugin === false || $entityPlugin === 'quiqqer/booking') {
try {
// @todo quiqqer/booking
} catch (\Exception) {
}
}
//'quiqqer/contracts',
try {
return QUI\ERP\Accounting\Contracts\Handler::getInstance()->get($entityHash);
} catch (\Exception) {
if ($entityPlugin === false || $entityPlugin === 'quiqqer/contracts') {
try {
return QUI\ERP\Accounting\Contracts\Handler::getInstance()->get($entityHash);
} catch (\Exception) {
}
}
//'quiqqer/delivery-notes',
try {
} catch (\Exception) {
if ($entityPlugin === false || $entityPlugin === 'quiqqer/delivery-notes') {
try {
// @todo quiqqer/delivery-notes
} catch (\Exception) {
}
}
//'quiqqer/invoice',
try {
return QUI\ERP\Accounting\Invoice\Handler::getInstance()->getInvoiceByHash($entityHash);
} catch (\Exception) {
if ($entityPlugin === false || $entityPlugin === 'quiqqer/invoice') {
try {
return QUI\ERP\Accounting\Invoice\Handler::getInstance()->getInvoiceByHash($entityHash);
} catch (\Exception) {
}
}
//'quiqqer/offers',
try {
return QUI\ERP\Accounting\Offers\Handler::getInstance()->getOfferByHash($entityHash);
} catch (\Exception) {
if ($entityPlugin === false || $entityPlugin === 'quiqqer/offers') {
try {
return QUI\ERP\Accounting\Offers\Handler::getInstance()->getOfferByHash($entityHash);
} catch (\Exception) {
}
}
//'quiqqer/order',
try {
return QUI\ERP\Order\Handler::getInstance()->getOrderByHash($entityHash);
} catch (\Exception) {
if ($entityPlugin === false || $entityPlugin === 'quiqqer/order') {
try {
return QUI\ERP\Order\Handler::getInstance()->getOrderByHash($entityHash);
} catch (\Exception) {
}
}
//'quiqqer/purchasing',
try {
} catch (\Exception) {
if ($entityPlugin === false || $entityPlugin === 'quiqqer/purchasing') {
try {
// @todo quiqqer/purchasing
} catch (\Exception) {
}
}
//'quiqqer/salesorders'
try {
return QUI\ERP\SalesOrders\Handler::getSalesOrderByHash($entityHash);
} catch (\Exception) {
}
throw new Exception(
[
'quiqqer/erp',
'exception.entity.not.found',
[
'hash' => $entityHash
]
],
404
);
if ($entityPlugin === false || $entityPlugin === 'quiqqer/salesorders') {
try {
return QUI\ERP\SalesOrders\Handler::getSalesOrderByHash($entityHash);
} catch (\Exception) {
}
}
throw new Exception([
'quiqqer/erp',
'exception.entity.not.found',
['hash' => $entityHash]
], 404);
}
/**
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren