Shipping note add direct url create
This commit is contained in:
@@ -16,6 +16,7 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
['key' => 'deliveryAddressPLZ', 'text' => 'PLZ', 'required' => true, 'regex' => '/^\d{4}$/'],
|
||||
['key' => 'deliveryAddressCity', 'text' => 'Stadt', 'required' => true, 'required_length' => 3],
|
||||
['key' => 'trackingNumber', 'text' => 'Trackingnummer', 'required' => false, 'modal' => false],
|
||||
['key' => 'positions', 'text' => 'Positionen', 'required' => false, 'table' => false],
|
||||
['key' => 'create', 'text' => 'Erstellt', 'required' => true, 'modal' => false, 'filter' => 'datetime'],
|
||||
['key' => 'createBy', 'text' => 'Erstellt von', 'required' => true, 'table' => ['filter' => 'select'], 'modal' => ['type' => 'select', 'items' => []]],
|
||||
['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']]
|
||||
@@ -65,7 +66,8 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
return ['value' => intval($user->id), 'text' => $user->name];
|
||||
}, UserModel::search());
|
||||
|
||||
$this->columns[11]['modal']['items'] = $users;
|
||||
$createByIndex = array_search('createBy', array_column($this->columns, 'key'));
|
||||
$this->columns[$createByIndex]['modal']['items'] = $users;
|
||||
}
|
||||
|
||||
protected function createShippingNote() {
|
||||
@@ -77,7 +79,9 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
|
||||
$existingShippingNote = WarehouseShippingNoteModel::getAll(['eShopOrderId' => $id]);
|
||||
if (!empty($existingShippingNote)) {
|
||||
self::returnJson(['success' => false, 'message' => 'Für diese Bestellung existiert bereits ein Lieferschein', 'shippingNoteId' => $existingShippingNote[0]->id]);
|
||||
self::returnJson(['success' => false,
|
||||
'message' => 'Für diese Bestellung existiert bereits ein Lieferschein',
|
||||
'shippingNoteId' => $existingShippingNote[0]->id]);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -286,7 +290,8 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
}
|
||||
|
||||
protected function getAllOrderItemsPerOrder(): array {
|
||||
$items = WarehouseEShopOrderItemModel::getAll();
|
||||
if (isset($_GET['orderId'])) return WarehouseEShopOrderItemModel::getAll(['orderId' => $_GET['orderId']]);
|
||||
else $items = WarehouseEShopOrderItemModel::getAll();
|
||||
$articles = WarehouseArticleModel::getAll();
|
||||
$articlePackets = WarehouseArticlePacketModel::getAll();
|
||||
|
||||
@@ -397,6 +402,7 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
unset($this->postData['shippingNoteStatus']);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function beforeUpdate($postData): bool {
|
||||
unset($this->postData['shippingNoteStatus']);
|
||||
(new WarehouseHistoryController)->create($postData, $this->mod);
|
||||
@@ -444,17 +450,17 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
}
|
||||
|
||||
protected function readGLSEmailAction() {
|
||||
function decode_utf8($str){
|
||||
function decode_utf8($str) {
|
||||
# paterns
|
||||
$err="(=\?.{10,13}q\?_?|\?\=)";
|
||||
$err = "(=\?.{10,13}q\?_?|\?\=)";
|
||||
$pat = "/=([0-9A-F]{2})/";
|
||||
$cha="'.chr(hexdec(";
|
||||
$cha = "'.chr(hexdec(";
|
||||
# erase null signs in string
|
||||
$str = str_replace("\x00", "", $str);
|
||||
# to decode with eval and replace
|
||||
eval("\$str='".
|
||||
preg_replace($pat,$cha."'$1')).'",$str)
|
||||
."';");
|
||||
eval("\$str='" .
|
||||
preg_replace($pat, $cha . "'$1')).'", $str)
|
||||
. "';");
|
||||
# return
|
||||
return $str;
|
||||
}
|
||||
@@ -585,4 +591,71 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
|
||||
$result = [];
|
||||
}
|
||||
|
||||
protected function updatePositionAction() {
|
||||
$json = json_decode(file_get_contents('php://input'), true);
|
||||
$id = intval($json['id']);
|
||||
$articleId = $json['articleId'] ? intval($json['articleId']) : null;
|
||||
$articlePacketId = $json['articlePacketId'] ? intval($json['articlePacketId']) : null;
|
||||
$quantity = intval($json['quantity']);
|
||||
|
||||
if (!$id || !$quantity) {
|
||||
self::returnJson(['success' => false, 'message' => 'Ungültige Daten']);
|
||||
die();
|
||||
}
|
||||
|
||||
$position = (array) WarehouseEShopOrderItemModel::get($id);
|
||||
if (!$position) {
|
||||
self::returnJson(['success' => false, 'message' => 'Position nicht gefunden']);
|
||||
die();
|
||||
}
|
||||
|
||||
$position['articleId'] = $articleId;
|
||||
$position['articlePacketId'] = $articlePacketId;
|
||||
$position['quantity'] = $quantity;
|
||||
WarehouseEShopOrderItemModel::update($position);
|
||||
|
||||
self::returnJson(['success' => true, 'position' => $position]);
|
||||
}
|
||||
|
||||
protected function deletePositionAction() {
|
||||
$json = json_decode(file_get_contents('php://input'), true);
|
||||
$id = intval($json['id']);
|
||||
|
||||
if (!$id) {
|
||||
self::returnJson(['success' => false, 'message' => 'Keine ID angegeben']);
|
||||
die();
|
||||
}
|
||||
|
||||
$position = WarehouseEShopOrderItemModel::get($id);
|
||||
if (!$position) {
|
||||
self::returnJson(['success' => false, 'message' => 'Position nicht gefunden']);
|
||||
die();
|
||||
}
|
||||
|
||||
WarehouseEShopOrderItemModel::delete($id);
|
||||
self::returnJson(['success' => true, 'message' => 'Position gelöscht']);
|
||||
}
|
||||
|
||||
protected function addPositionAction() {
|
||||
$json = json_decode(file_get_contents('php://input'), true);
|
||||
$orderId = intval($json['orderId']);
|
||||
$articleId = $json['articleId'] ? intval($json['articleId']) : null;
|
||||
$articlePacketId = $json['articlePacketId'] ? intval($json['articlePacketId']) : null;
|
||||
$quantity = intval($json['quantity']);
|
||||
|
||||
if (!$orderId || !$quantity) {
|
||||
self::returnJson(['success' => false, 'message' => 'Ungültige Daten']);
|
||||
die();
|
||||
}
|
||||
|
||||
$position = WarehouseEShopOrderItemModel::create(['orderId' => $orderId,
|
||||
'articleId' => $articleId,
|
||||
'articlePacketId' => $articlePacketId,
|
||||
'quantity' => $quantity]);
|
||||
|
||||
$position = (array) WarehouseEShopOrderItemModel::get($position);
|
||||
|
||||
self::returnJson(['success' => true, 'position' => $position]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user