added new field trio article number

This commit is contained in:
Luca Haid
2025-05-07 16:39:15 +02:00
parent b67cc642a3
commit 86e1983dc2
4 changed files with 32 additions and 2 deletions

View File

@@ -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],

View File

@@ -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;

View File

@@ -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";

View 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();
}
}
}
}