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

fix sql #51

Merged
merged 2 commits into from
Feb 10, 2024
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
26 changes: 16 additions & 10 deletions core/modules/facture/doc/doc_easydoc_invoice_html.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
}
$label_payment_conditions = '';
if ($object->cond_reglement_code) {
$label_payment_conditions = ($outputlangs->transnoentities("PaymentCondition" . $object->cond_reglement_code) != 'PaymentCondition' . $object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition" . $object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);

Check warning on line 362 in core/modules/facture/doc/doc_easydoc_invoice_html.modules.php

View workflow job for this annotation

GitHub Actions / build

Line exceeds 300 characters; contains 386 characters
$label_payment_conditions = str_replace('\n', "\n", $label_payment_conditions);
if ($object->deposit_percent > 0) {
$label_payment_conditions = str_replace('__DEPOSIT_PERCENT__', $object->deposit_percent, $label_payment_conditions);
Expand Down Expand Up @@ -558,15 +558,21 @@
}
$substitutions['payments'] = [];
// Loop on each payment
$sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num";
$sql .= ", pf.amount as amount, pf.multicurrency_amount,";
$sql .= " cp.code, ba.ref as bankref";
$sql .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON pf.fk_paiement = p.rowid";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_paiement AS cp ON p.fk_paiement = cp.id AND cp.entity IN (" . getEntity('c_paiement') . ")";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank as b ON p.fk_bank = b.rowid";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_account as ba ON b.fk_account = ba.rowid";
$sql .= " WHERE pf.fk_facture = " . ((int) $object->id);
// $sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
// $sql .= " cp.code, ba.ref as bankref";
// $sql .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf";
// $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON pf.fk_paiement = p.rowid";
// $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_paiement AS cp ON p.fk_paiement = cp.id AND cp.entity IN (" . getEntity('c_paiement') . ")";
// $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank as b ON p.fk_bank = b.rowid";
// $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_account as ba ON b.fk_account = ba.rowid";
// $sql .= " WHERE pf.fk_facture = " . ((int) $object->id);
// $sql .= " ORDER BY p.datep";
$sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
$sql .= " cp.code";
$sql .= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf, " . MAIN_DB_PREFIX . "paiement as p";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_paiement as cp ON p.fk_paiement = cp.id";
$sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = " . ((int) $object->id);
// $sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = 1";
$sql .= " ORDER BY p.datep";

$resql = $this->db->query($sql);
Expand All @@ -581,7 +587,7 @@
'num' => $obj->num,
'total_ttc' => $obj->amount,
'multicurrency_total_ttc' => $obj->multicurrency_amount,
'bankref' => $obj->bankref,
//'bankref' => $obj->bankref,
];
$i++;
}
Expand Down
Loading