bug fix in commodity custome code

This commit is contained in:
Hesabix 2025-08-04 13:51:04 +00:00
parent 532ca041f6
commit 63b6654cc8
4 changed files with 41 additions and 5 deletions

View file

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250804133410 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE commodity CHANGE code code VARCHAR(255) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE commodity CHANGE code code BIGINT NOT NULL');
}
}

View file

@ -33,7 +33,7 @@ class Commodity
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $des;
#[ORM\Column(type: 'bigint')]
#[ORM\Column(type: 'string', length: 255)]
private $code;
#[ORM\Column(nullable: true)]

View file

@ -99,6 +99,7 @@ class twigFunctions
$numberOfUnits = floor($hash / $unit);
return $numberOfUnits . ' ' . $text;
}
return '0 کیلوهش';
}
public function getHesabixLastVersionNumber(): string
@ -111,7 +112,8 @@ class twigFunctions
public function systemSettings()
{
return $this->em->getRepository(Settings::class)->findAll()[0];
$settings = $this->em->getRepository(Settings::class)->findAll();
return $settings[0] ?? null;
}
public function getCurrentUrl()
@ -123,14 +125,16 @@ class twigFunctions
{
// اگر پلاگین accpro فعال نباشد، مقدار پیش‌فرض را برمی‌گرداند
if (!$pluginService->isActive('accpro', $bid)) {
return $side === 'left' ? $this->getStaticData('system', 'footerLeft') : $this->getStaticData('system', 'footerRight');
$defaultText = $side === 'left' ? $this->getStaticData('system', 'footerLeft') : $this->getStaticData('system', 'footerRight');
return $defaultText ?? '';
}
// دریافت تنظیمات چاپ
$printOptions = $this->em->getRepository(PrintOptions::class)->findOneBy(['bid' => $bid]);
if (!$printOptions) {
return $side === 'left' ? $this->getStaticData('system', 'footerLeft') : $this->getStaticData('system', 'footerRight');
$defaultText = $side === 'left' ? $this->getStaticData('system', 'footerLeft') : $this->getStaticData('system', 'footerRight');
return $defaultText ?? '';
}
// دریافت متن پانویس بر اساس سمت
@ -138,7 +142,8 @@ class twigFunctions
// اگر متن null یا خالی باشد، مقدار پیش‌فرض را برمی‌گرداند
if ($footerText === null || $footerText === '') {
return $side === 'left' ? $this->getStaticData('system', 'footerLeft') : $this->getStaticData('system', 'footerRight');
$defaultText = $side === 'left' ? $this->getStaticData('system', 'footerLeft') : $this->getStaticData('system', 'footerRight');
return $defaultText ?? '';
}
return $footerText;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 136 KiB