mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Debug v16
This commit is contained in:
parent
0d68c0ba14
commit
75fa3cf643
|
|
@ -281,7 +281,7 @@ class AccountingJournal extends CommonObject
|
|||
}
|
||||
|
||||
$label_link = $this->code;
|
||||
if ($withlabel) {
|
||||
if ($withlabel && !empty($this->label)) {
|
||||
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : '');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ class Account extends CommonObject
|
|||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
|
||||
return -3;
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -630,7 +630,7 @@ class Account extends CommonObject
|
|||
$this->errors = $accline->errors;
|
||||
$this->db->rollback();
|
||||
|
||||
return -2;
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1950,7 +1950,7 @@ if ($action == 'create') {
|
|||
|
||||
// Payments already done (from payment on this expensereport)
|
||||
$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount, p.fk_bank,";
|
||||
$sql .= "c.code as p_code, c.libelle as payment_type,";
|
||||
$sql .= "c.code as payment_code, c.libelle as payment_type,";
|
||||
$sql .= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id";
|
||||
|
|
@ -1969,18 +1969,20 @@ if ($action == 'create') {
|
|||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$paymentexpensereportstatic->id = $objp->rowid;
|
||||
$paymentexpensereportstatic->datepaye = $db->jdate($objp->dp);
|
||||
$paymentexpensereportstatic->datep = $db->jdate($objp->dp);
|
||||
$paymentexpensereportstatic->ref = $objp->rowid;
|
||||
$paymentexpensereportstatic->num_payment = $objp->num_payment;
|
||||
$paymentexpensereportstatic->payment_code = $objp->payment_code;
|
||||
$paymentexpensereportstatic->type_code = $objp->payment_code;
|
||||
$paymentexpensereportstatic->type_label = $objp->payment_type;
|
||||
|
||||
print '<tr class="oddseven">';
|
||||
print '<td>';
|
||||
print $paymentexpensereportstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
||||
$labeltype = $langs->trans("PaymentType".$objp->p_code) != ("PaymentType".$objp->p_code) ? $langs->trans("PaymentType".$objp->p_code) : $objp->payment_type;
|
||||
$labeltype = $langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_type;
|
||||
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
|
||||
// Bank account
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
$bankaccountstatic->ref = $objp->baref;
|
||||
|
|
|
|||
|
|
@ -137,14 +137,17 @@ class PaymentExpenseReport extends CommonObject
|
|||
if (isset($this->note_public)) {
|
||||
$this->note_public = trim($this->note_public);
|
||||
}
|
||||
if (isset($this->note_private)) {
|
||||
$this->note_private = trim($this->note_private);
|
||||
}
|
||||
if (isset($this->fk_bank)) {
|
||||
$this->fk_bank = trim($this->fk_bank);
|
||||
$this->fk_bank = ((int) $this->fk_bank);
|
||||
}
|
||||
if (isset($this->fk_user_creat)) {
|
||||
$this->fk_user_creat = trim($this->fk_user_creat);
|
||||
$this->fk_user_creat = ((int) $this->fk_user_creat);
|
||||
}
|
||||
if (isset($this->fk_user_modif)) {
|
||||
$this->fk_user_modif = trim($this->fk_user_modif);
|
||||
$this->fk_user_modif = ((int) $this->fk_user_modif);
|
||||
}
|
||||
|
||||
$totalamount = 0;
|
||||
|
|
@ -170,7 +173,7 @@ class PaymentExpenseReport extends CommonObject
|
|||
$sql .= " '".$this->db->idate($this->datepaid)."',";
|
||||
$sql .= " ".price2num($totalamount).",";
|
||||
$sql .= " ".((int) $this->fk_typepayment).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".((int) $user->id).",";
|
||||
$sql .= " 0)";
|
||||
$sql .= " 0)"; // fk_bank is ID of transaction into ll_bank
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -540,7 +543,7 @@ class PaymentExpenseReport extends CommonObject
|
|||
);
|
||||
|
||||
// Update fk_bank in llx_paiement.
|
||||
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
||||
// So we wil know the payment that have generated the bank transaction
|
||||
if ($bank_line_id > 0) {
|
||||
$result = $this->update_fk_bank($bank_line_id);
|
||||
if ($result <= 0) {
|
||||
|
|
@ -585,6 +588,7 @@ class PaymentExpenseReport extends CommonObject
|
|||
}
|
||||
} else {
|
||||
$this->error = $acc->error;
|
||||
$this->errors = $acc->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ if ($action == 'add_payment') {
|
|||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!empty($conf->banque->enabled) && !($accountid > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToDebit")), null, 'errors');
|
||||
$error++;
|
||||
|
|
@ -87,14 +88,16 @@ if ($action == 'add_payment') {
|
|||
// Read possible payments
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (substr($key, 0, 7) == 'amount_') {
|
||||
$amounts[$expensereport->fk_user_author] = price2num(GETPOST($key));
|
||||
$total += price2num(GETPOST($key));
|
||||
if (GETPOST($key)) {
|
||||
$amounts[$expensereport->fk_user_author] = price2num(GETPOST($key));
|
||||
$total += price2num(GETPOST($key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($amounts) <= 0) {
|
||||
$error++;
|
||||
$errmsg = 'ErrorNoPaymentDefined';
|
||||
setEventMessages('ErrorNoPaymentDefined', null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
|
@ -109,6 +112,7 @@ if ($action == 'add_payment') {
|
|||
$payment->fk_typepayment = GETPOST("fk_typepayment", 'int');
|
||||
$payment->num_payment = GETPOST("num_payment", 'alphanothtml');
|
||||
$payment->note_public = GETPOST("note_public", 'restricthtml');
|
||||
$payment->fk_bank = $accountid;
|
||||
|
||||
if (!$error) {
|
||||
$paymentid = $payment->create($user);
|
||||
|
|
@ -120,7 +124,7 @@ if ($action == 'add_payment') {
|
|||
|
||||
if (!$error) {
|
||||
$result = $payment->addPaymentToBank($user, 'payment_expensereport', '(ExpenseReportPayment)', $accountid, '', '');
|
||||
if (!$result > 0) {
|
||||
if ($result <= 0) {
|
||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -202,7 +206,7 @@ if ($action == 'create' || empty($action)) {
|
|||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Period").'</td><td>'.get_date_range($expensereport->date_debut, $expensereport->date_fin, "", $langs, 0).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($expensereport->total_ttc, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($expensereport->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</span></td></tr>';
|
||||
|
||||
$sql = "SELECT sum(p.amount) as total";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e";
|
||||
|
|
@ -214,8 +218,8 @@ if ($action == 'create' || empty($action)) {
|
|||
$sumpaid = $obj->total;
|
||||
$db->free($resql);
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total - $sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td><span class="amount">'.price($sumpaid, 0, $langs, 1, -1, -1, $conf->currency).'</span></td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td><span class="amount">'.price($total - $sumpaid, 0, $langs, 1, -1, -1, $conf->currency).'</span></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
|
@ -223,6 +227,8 @@ if ($action == 'create' || empty($action)) {
|
|||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
print dol_get_fiche_head();
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
|
@ -243,7 +249,8 @@ if ($action == 'create' || empty($action)) {
|
|||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", "int") : $expensereport->accountid, "accountid", 0, '', 2); // Show open bank account list
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", "int") : 0, "accountid", 0, '', 2); // Show open bank account list
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
@ -277,7 +284,7 @@ if ($action == 'create' || empty($action)) {
|
|||
print '<td class="center">'.$langs->trans("Amount").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$total = 0;
|
||||
$total_ttc = 0;
|
||||
$totalrecu = 0;
|
||||
|
||||
while ($i < $num) {
|
||||
|
|
@ -298,7 +305,7 @@ if ($action == 'create' || empty($action)) {
|
|||
}
|
||||
$remaintopay = $objp->total_ttc - $sumpaid; // autofill remainder amount
|
||||
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">'; // autofill remainder amount
|
||||
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
|
||||
print '<input type="text" class="width75" name="'.$namef.'" id="'.$namef.'" value="'.GETPOST($namef).'">';
|
||||
} else {
|
||||
print '-';
|
||||
}
|
||||
|
|
@ -306,9 +313,8 @@ if ($action == 'create' || empty($action)) {
|
|||
|
||||
print "</tr>\n";
|
||||
|
||||
$total += $objp->total;
|
||||
$total_ttc += $objp->total_ttc;
|
||||
$totalrecu += $objp->am;
|
||||
$totalrecu += $sumpaid;
|
||||
$i++;
|
||||
}
|
||||
if ($i > 1) {
|
||||
|
|
|
|||
|
|
@ -489,6 +489,7 @@ while ($i < min($num, $limit)) {
|
|||
|
||||
// Type
|
||||
if (!empty($arrayfields['cpl.fk_type']['checked'])) {
|
||||
$label = '';
|
||||
if (!empty($alltypeleaves[$holidaylogstatic->type])) {
|
||||
if ($alltypeleaves[$holidaylogstatic->type]['code'] && $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']) != $alltypeleaves[$holidaylogstatic->type]['code']) {
|
||||
$label = $langs->trans($alltypeleaves[$holidaylogstatic->type]['code']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user