From 3eedf18344b074b2cec5d9ce91cb76a75fe88ca4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jul 2022 11:53:00 +0200 Subject: [PATCH] Debug v16 --- htdocs/compta/bank/class/account.class.php | 2 +- .../bank/class/paymentvarious.class.php | 51 +++++-------------- htdocs/compta/bank/various_payment/card.php | 4 +- htdocs/compta/bank/various_payment/list.php | 2 + .../install/mysql/migration/15.0.0-16.0.0.sql | 2 + .../tables/llx_loan_schedule-loan.key.sql | 20 ++++++++ .../mysql/tables/llx_loan_schedule-loan.sql | 2 +- htdocs/loan/payment/payment.php | 4 +- htdocs/loan/schedule.php | 29 +++++------ htdocs/projet/class/project.class.php | 2 +- 10 files changed, 60 insertions(+), 58 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_loan_schedule-loan.key.sql diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 7a7097ecb71..21a082e9491 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -2390,7 +2390,7 @@ class AccountLine extends CommonObject $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("Transaction").':
'; + $label = img_picto('', $this->picto).' '.$langs->trans("BankTransactionLine").':
'; $label .= ''.$langs->trans("Ref").': '.$this->ref; $linkstart = ''; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 8bad5dbebd0..48ea553abf0 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -606,45 +606,20 @@ class PaymentVarious extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable - global $langs; - - if ($mode == 0) { - return $langs->trans($this->statuts[$status]); - } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$status]); - } elseif ($mode == 2) { - if ($status == 0) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); - } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); - } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); - } - } elseif ($mode == 3) { - if ($status == 0 && !empty($this->statuts_short[$status])) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); - } elseif ($status == 1 && !empty($this->statuts_short[$status])) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); - } elseif ($status == 2 && !empty($this->statuts_short[$status])) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); - } - } elseif ($mode == 4) { - if ($status == 0 && !empty($this->statuts_short[$status])) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); - } elseif ($status == 1 && !empty($this->statuts_short[$status])) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); - } elseif ($status == 2 && !empty($this->statuts_short[$status])) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); - } - } elseif ($mode == 5) { - if ($status == 0 && !empty($this->statuts_short[$status])) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); - } elseif ($status == 1 && !empty($this->statuts_short[$status])) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); - } elseif ($status == 2 && !empty($this->statuts_short[$status])) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); - } + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { + global $langs; + //$langs->load("mymodule@mymodule"); + /*$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); + $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');*/ } + + $statusType = 'status'.$status; + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 95d5ffa0e9e..b135daa8f00 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -584,6 +584,8 @@ if ($id) { $morehtmlref .= ''; $linkback = ''.$langs->trans("BackToList").''; + $morehtmlright = ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '
'; @@ -613,7 +615,7 @@ if ($id) { } print ''.$langs->trans("Sens").''.$sens.''; - print ''.$langs->trans("Amount").''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).''; + print ''.$langs->trans("Amount").''.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).''; // Accountancy code print ''; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index f75ce6d4471..1118fcab70a 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -537,6 +537,8 @@ if ($resql) { $totalarray = array(); $totalarray['nbfield'] = 0; $totalarray['val']['total_cred'] = 0; + $totalarray['val']['total_deb'] = 0; + while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 0e2bde5c784..2131f1a4061 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -667,3 +667,5 @@ ALTER TABLE llx_cronjob DROP INDEX uk_cronjob; ALTER TABLE llx_cronjob ADD UNIQUE INDEX uk_cronjob (label, entity); ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; + +ALTER TABLE llx_loan_schedule ADD UNIQUE INDEX uk_loan_schedule_ref (fk_loan, datep); diff --git a/htdocs/install/mysql/tables/llx_loan_schedule-loan.key.sql b/htdocs/install/mysql/tables/llx_loan_schedule-loan.key.sql new file mode 100644 index 00000000000..8d47d879a2d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_loan_schedule-loan.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2022 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + +ALTER TABLE llx_loan_schedule ADD UNIQUE INDEX uk_loan_schedule_ref (fk_loan, datep); + diff --git a/htdocs/install/mysql/tables/llx_loan_schedule-loan.sql b/htdocs/install/mysql/tables/llx_loan_schedule-loan.sql index dd68a426e61..0e3eba210a8 100644 --- a/htdocs/install/mysql/tables/llx_loan_schedule-loan.sql +++ b/htdocs/install/mysql/tables/llx_loan_schedule-loan.sql @@ -23,7 +23,7 @@ create table llx_loan_schedule fk_loan integer, datec datetime, -- creation date tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - datep datetime, -- payment date + datep datetime, -- payment date expected amount_capital double(24,8) DEFAULT 0, amount_insurance double(24,8) DEFAULT 0, amount_interest double(24,8) DEFAULT 0, diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index ac2b967593c..a8d4269ddfe 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -293,6 +293,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans("PaymentMode").''; + print img_picto('', 'money-bill-alt', 'class="pictofixedwidth"'); $form->select_types_paiements(GETPOSTISSET("paymenttype") ? GETPOST("paymenttype", 'alphanohtml') : $loan->fk_typepayment, "paymenttype"); print "\n"; print ''; @@ -300,10 +301,11 @@ if ($action == 'create') { print ''; print ''.$langs->trans('AccountToDebit').''; print ''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $loan->accountid, "accountid", 0, 'courant = '.Account::TYPE_CURRENT, 1); // Show opend bank account list print ''; - // Number + // Number print ''.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print ''; diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index 0944142bc1c..cd5faa1afe3 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -234,17 +234,16 @@ if (count($echeances->lines) > 0) { print ''; } +//print_fiche_titre($langs->trans("FinancialCommitment")); +print '
'; + print '
'; print ''; -print ''; + $colspan = 6; if (count($echeances->lines) > 0) { $colspan++; } -print ''; -print ''; print ''; print ''; @@ -276,10 +275,10 @@ if ($object->nbterm > 0 && count($echeances->lines) == 0) { print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''."\n"; $i++; $capital = $cap_rest; @@ -300,15 +299,15 @@ if ($object->nbterm > 0 && count($echeances->lines) == 0) { print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; if (empty($line->fk_bank)) { - print ''; + print ''; } else { - print ''; + print ''; } - print ''; + print ''; print ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 4d851b86270..8c48b7b1ae6 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1294,7 +1294,7 @@ class Project extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref;
'; -print $langs->trans("FinancialCommitment"); -print '
'.$langs->trans("Term").'
'.$i.''.dol_print_date(dol_time_plus_duree($object->datestart, $i - 1, 'm'), 'day').''.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1, -1, -1, $conf->currency).''.price($int, 0, '', 1, -1, -1, $conf->currency).''.price($cap_rest).''.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1, -1, -1, $conf->currency).''.price($int, 0, '', 1, -1, -1, $conf->currency).''.price($cap_rest).'
'.$i.''.dol_print_date($line->datep, 'day').''.price($insu, 0, '', 1, -1, -1, $conf->currency).''.price($int, 0, '', 1, -1, -1, $conf->currency).''.price($insu, 0, '', 1, -1, -1, $conf->currency).''.price($int, 0, '', 1, -1, -1, $conf->currency).''.price($mens, 0, '', 1, -1, -1, $conf->currency).''.price($mens, 0, '', 1, -1, -1, $conf->currency).''.price($cap_rest, 0, '', 1, -1, -1, $conf->currency).''.price($cap_rest, 0, '', 1, -1, -1, $conf->currency).''; if (!empty($line->fk_bank)) { print $langs->trans('Paid'); @@ -316,7 +315,7 @@ if ($object->nbterm > 0 && count($echeances->lines) == 0) { print ' ('.img_object($langs->trans("Payment"), "payment").' '.$line->fk_payment_loan.')'; } } elseif (!$printed) { - print ''.$langs->trans('DoPayment').''; + print ''.$langs->trans('DoPayment').''; $printed = true; } print '