mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Clean code
This commit is contained in:
@@ -154,7 +154,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT c.id, c.libelle as label,";
|
||||
$sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
|
||||
$sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode as period, cs.date_ech, cs.amount as total,";
|
||||
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
|
||||
$sql .= " pct.code as payment_code,";
|
||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
|
||||
@@ -168,8 +168,8 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
||||
$sql .= " AND cs.entity IN (".getEntity("tax").")";
|
||||
if ($year > 0) {
|
||||
$sql .= " AND (";
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
// If period defined, we use it as dat criteria, if not we use date echeance,
|
||||
// so we are compatible when period is not mandatory
|
||||
$sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= ")";
|
||||
@@ -190,9 +190,10 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Date
|
||||
$date = $obj->periode;
|
||||
$date = $obj->period;
|
||||
if (empty($date)) {
|
||||
$date = $obj->date_ech;
|
||||
}
|
||||
@@ -284,8 +285,8 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON ptva.fk_typepaiement = pct.id";
|
||||
$sql .= " WHERE pv.entity IN (".getEntity("tax").")";
|
||||
if ($year > 0) {
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
// If period defined, we use it as dat criteria, if not we use date echeance,
|
||||
// so we are compatible when period is not mandatory
|
||||
$sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
}
|
||||
if (preg_match('/^pv\./', $sortfield) || preg_match('/^ptva\./', $sortfield)) {
|
||||
@@ -409,8 +410,8 @@ while ($j < $numlt) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."localtax as pv";
|
||||
$sql .= " WHERE pv.entity = ".$conf->entity." AND localtaxtype = ".((int) $j);
|
||||
if ($year > 0) {
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
// If period defined, we use it as dat criteria, if not we use date echeance,
|
||||
// so we are compatible when period is not mandatory
|
||||
$sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
}
|
||||
if (preg_match('/^pv/', $sortfield)) {
|
||||
|
||||
Reference in New Issue
Block a user