Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SC_Fpdf::setOrderData() Fatal error #1135 #1144

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 33 additions & 30 deletions data/class/SC_Fpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,39 +236,42 @@

$arrTaxableTotal = [];
$defaultTaxRule = SC_Helper_TaxRule_Ex::getTaxRule();
// 購入商品情報
for ($i = 0; $i < count($this->arrDisp['quantity']); $i++) {
// 購入数量
$data[0] = $this->arrDisp['quantity'][$i];

// 税込金額(単価)
$data[1] = $this->arrDisp['price'][$i] + SC_Helper_TaxRule_Ex::calcTax($this->arrDisp['price'][$i], $this->arrDisp['tax_rate'][$i], $this->arrDisp['tax_rule'][$i]);

// 小計(商品毎)
$data[2] = $data[0] * $data[1];

$arrOrder[$i][0] = $this->arrDisp['product_name'][$i].' / ';
$arrOrder[$i][0] .= $this->arrDisp['product_code'][$i].' / ';
if ($this->arrDisp['classcategory_name1'][$i]) {
$arrOrder[$i][0] .= ' [ '.$this->arrDisp['classcategory_name1'][$i];
if ($this->arrDisp['classcategory_name2'][$i] == '') {
$arrOrder[$i][0] .= ' ]';
} else {
$arrOrder[$i][0] .= ' * '.$this->arrDisp['classcategory_name2'][$i].' ]';
$i = 0;

Check warning on line 239 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L239

Added line #L239 was not covered by tests
// 受注明細情報
if (isset($this->arrDisp['quantity']) && is_array($this->arrDisp['quantity'])) {
for (; $i < count($this->arrDisp['quantity']); $i++) {

Check warning on line 242 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L241-L242

Added lines #L241 - L242 were not covered by tests
// 購入数量
$data[0] = $this->arrDisp['quantity'][$i];

Check warning on line 244 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L244

Added line #L244 was not covered by tests

// 税込金額(単価)
$data[1] = $this->arrDisp['price'][$i] + SC_Helper_TaxRule_Ex::calcTax($this->arrDisp['price'][$i], $this->arrDisp['tax_rate'][$i], $this->arrDisp['tax_rule'][$i]);

Check warning on line 247 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L247

Added line #L247 was not covered by tests

// 小計(商品毎)
$data[2] = $data[0] * $data[1];

Check warning on line 250 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L250

Added line #L250 was not covered by tests

$arrOrder[$i][0] = $this->arrDisp['product_name'][$i].' / ';
$arrOrder[$i][0] .= $this->arrDisp['product_code'][$i].' / ';
if ($this->arrDisp['classcategory_name1'][$i]) {
$arrOrder[$i][0] .= ' [ '.$this->arrDisp['classcategory_name1'][$i];
if ($this->arrDisp['classcategory_name2'][$i] == '') {
$arrOrder[$i][0] .= ' ]';

Check warning on line 257 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L252-L257

Added lines #L252 - L257 were not covered by tests
} else {
$arrOrder[$i][0] .= ' * '.$this->arrDisp['classcategory_name2'][$i].' ]';

Check warning on line 259 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L259

Added line #L259 was not covered by tests
}
}
}

// 標準税率より低い税率は軽減税率として※を付与
if ($this->arrDisp['tax_rate'][$i] < $defaultTaxRule['tax_rate']) {
$arrOrder[$i][0] .= ' ※';
}
$arrOrder[$i][1] = number_format($data[0]);
$arrOrder[$i][2] = number_format($data[1]).$monetary_unit;
$arrOrder[$i][3] = number_format($data[2]).$monetary_unit;
if (array_key_exists($this->arrDisp['tax_rate'][$i], $arrTaxableTotal) === false) {
$arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] = 0;
// 標準税率より低い税率は軽減税率として※を付与
if ($this->arrDisp['tax_rate'][$i] < $defaultTaxRule['tax_rate']) {
$arrOrder[$i][0] .= ' ※';

Check warning on line 265 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L264-L265

Added lines #L264 - L265 were not covered by tests
}
$arrOrder[$i][1] = number_format($data[0]);
$arrOrder[$i][2] = number_format($data[1]).$monetary_unit;
$arrOrder[$i][3] = number_format($data[2]).$monetary_unit;
if (array_key_exists($this->arrDisp['tax_rate'][$i], $arrTaxableTotal) === false) {
$arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] = 0;

Check warning on line 271 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L267-L271

Added lines #L267 - L271 were not covered by tests
}
$arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] += $data[2];

Check warning on line 273 in data/class/SC_Fpdf.php

View check run for this annotation

Codecov / codecov/patch

data/class/SC_Fpdf.php#L273

Added line #L273 was not covered by tests
}
$arrTaxableTotal[$this->arrDisp['tax_rate'][$i]] += $data[2];
}

$arrOrder[$i][0] = '';
Expand Down
Loading