Merge branch 'fronkdev' into 'master'

Address::syncToFibuMerge() knows about > 900000 customer numbers now

See merge request fronk/thetool!179
This commit is contained in:
Frank Schubert
2024-01-18 19:11:13 +00:00
2 changed files with 17 additions and 6 deletions

View File

@@ -123,14 +123,20 @@
<th>Ist primäres Verrechnungskonto</th>
<td><?=($address->fibu_primary_account) ? "<i class='fas fa-check text-success' title='Primäres Verrechnungskonto'></i>" : "<i class='fas fa-xmark text-danger'></i>"?></td>
</tr><tr>
<th>FIBU Verrechnungskonto</th>
<th>Verrechnungskonto</th>
<td><?=$address->fibu_account_number?></td>
</tr><tr>
<th>FIBU Lieferanten Konto</th>
<th>Lieferantenkonto</th>
<td><?=$address->fibu_supplier_number?></td>
</tr><tr>
<th>FIBU Lieferanten Zahlungsziel</th>
<th>Zahlungsziel Lieferant</th>
<td><?=$address->fibu_supplier_due?></td>
</tr><tr>
<th>Lieferant Skontotage</th>
<td><?=$address->fibu_supplier_skonto?></td>
</tr><tr>
<th>Lieferant Skonto %</th>
<td><?=$address->fibu_supplier_skonto_rate?></td>
</tr><tr>
<td colspan="2"><h4>Zusatzdaten</h4></td>
</tr><tr>

View File

@@ -69,12 +69,17 @@ class Address extends mfBaseModel {
$me->loadMe();
if($this->fibu_account_number) {
$fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $this->customer_number]);
$old_custnum = $this->customer_number;
if($old_custnum > 900000) {
$old_custnum -= 900000;
}
$fibumerge = XinonFibuMergeModel::getFirst(["old_custnum" => $old_custnum]);
if(!$fibumerge) {
// create fibu merge
$fibumerge = XinonFibuMergeModel::create([
"source" => "t",
"old_custnum" => $this->customer_number,
"old_custnum" => $old_custnum,
"new_custnum" => $this->fibu_account_number,
"name" => ($this->company) ? $this->company : $this->lastname,
"vorname" => ($this->company) ? "" : $this->firstname,
@@ -87,7 +92,7 @@ class Address extends mfBaseModel {
$fibumerge->save();
return true;
}
if($fibumerge->new_custnum != $this->fibu_account_number) {
$fibumerge->new_custnum = $this->fibu_account_number;
$fibumerge->save();