added new field trio article number
This commit is contained in:
@@ -7,6 +7,7 @@ class WarehouseArticlePacketController extends TTCrud {
|
||||
// @formatter:off
|
||||
protected array $columns = [
|
||||
['key' => 'title', 'text' => 'Titel', 'required' => true],
|
||||
['key' => 'externalArticleNumber', 'text' => 'Artikel Nummer Trio', 'required' => true],
|
||||
['key' => 'description', 'text' => 'Beschreibung', 'required' => true],
|
||||
['key' => 'category', 'text' => 'Kategorie', 'required' => true],
|
||||
['key' => 'overrideSellPrice', 'text' => 'Überschriebener Verkaufspreis', 'required' => false, 'modal' => ['type' => 'number'], 'table' => false],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class WarehouseArticlePacketModel extends TTCrudBaseModel {
|
||||
public int $id;
|
||||
public string $title;
|
||||
public string $externalArticleNumber;
|
||||
public string $description;
|
||||
public string $category;
|
||||
public ?float $overrideSellPrice;
|
||||
|
||||
@@ -166,10 +166,10 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
$articlePacket = $item->articlePacketId ? array_search($item->articlePacketId, array_column($articlePackets, 'id')) : null;
|
||||
|
||||
$articleExtRef = $articleDistributor[array_search($item->articleId, array_column($articleDistributor, 'articleId'))];
|
||||
$articleExtRef = $articleExtRef->externalArticleNumber ?? null;
|
||||
$articleExtRef = $item->articleId ? $articleExtRef->externalArticleNumber : (!empty($articlePacket->externalArticleNumber) ? $articlePacket->externalArticleNumber : null);
|
||||
$articleTitle = $item->articleId ? $articles[$article]->title : $articlePackets[$articlePacket]->title;
|
||||
$quantity = $item->quantity;
|
||||
$body .= $item->articleId ? "$quantity x $articleExtRef ($articleTitle)\n" : "$quantity x $articleTitle\n";
|
||||
$body .= $articleExtRef !== null ? "$quantity x $articleExtRef ($articleTitle)\n" : "$quantity x $articleTitle\n";
|
||||
}
|
||||
$body .= "\n\n";
|
||||
$body .= "CSV der Bestellung ist im Anhang.\n\n";
|
||||
|
||||
28
db/migrations/20250507160000_warehouse_modify_21.php
Normal file
28
db/migrations/20250507160000_warehouse_modify_21.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php /** @noinspection ALL */
|
||||
declare(strict_types = 1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class WarehouseModify21 extends AbstractMigration {
|
||||
public function up(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$WarehouseArticlePacket = $this->table("WarehouseArticlePacket");
|
||||
if (!$WarehouseArticlePacket->hasColumn("externalArticleNumber")) {
|
||||
$WarehouseArticlePacket
|
||||
->addColumn("externalArticleNumber", "string", ["limit" => 255, "null" => true])
|
||||
->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void {
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$WarehouseArticlePacket = $this->table("WarehouseArticlePacket");
|
||||
if ($WarehouseArticlePacket->hasColumn("externalArticleNumber")) {
|
||||
$WarehouseArticlePacket
|
||||
->removeColumn("externalArticleNumber")
|
||||
->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user