Merge branch '12.0_new_payments_on_vat' of github.com:atm-gauthier/dolibarr into NEW/add_real_payments_on_vat_objects

This commit is contained in:
Gauthier PC portable 024 2021-01-19 13:40:13 +01:00
commit 998aa8f943
4 changed files with 32 additions and 13 deletions

View File

@ -43,6 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
@ -370,6 +371,7 @@ $donstatic = new Don($db);
$paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db);
$paymentscstatic = new PaymentSocialContribution($db);
$paymentvatstatic = new PaymentVAT($db);
$paymentsalstatic = new PaymentSalary($db);
$paymentdonationstatic = new PaymentDonation($db);
$paymentvariousstatic = new PaymentVarious($db);
@ -1210,9 +1212,9 @@ if ($resql)
print ' '.$paymentscstatic->getNomUrl(2);
} elseif ($links[$key]['type'] == 'payment_vat')
{
print '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$links[$key]['url_id'].'">';
print ' '.img_object($langs->trans('ShowPayment'), 'payment').' ';
print '</a>';
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
print ' '.$paymentvatstatic->getNomUrl(2);
}
elseif ($links[$key]['type'] == 'payment_salary')
{

View File

@ -703,17 +703,31 @@ class PaymentVAT extends CommonObject
$result = '';
if (empty($this->ref)) $this->ref = $this->lib;
$label = $langs->trans("ShowPayment").': '.$this->ref;
if (!empty($this->id)) {
$link = '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend = '</a>';
$label = img_picto('', $this->picto).' <u>'.$langs->trans("VATPayment").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->label)) {
$labeltoshow = $this->label;
$reg = array();
if (preg_match('/^\((.*)\)$/i', $this->label, $reg))
{
// Label generique car entre parentheses. On l'affiche en le traduisant
if ($reg[1] == 'paiement') $reg[1] = 'Payment';
$labeltoshow = $langs->trans($reg[1]);
}
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
}
if ($this->datep) $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
if ($withpicto) $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
}
if (!empty($this->id)) {
$link = '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend = '</a>';
return $result;
}
if ($withpicto) $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
}
return $result;
}
}

View File

@ -741,6 +741,8 @@ class Tva extends CommonObject
$label = '<u>'.$langs->trans("ShowVatPayment").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->label))
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
$url = DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id;

View File

@ -326,6 +326,7 @@ while ($i < min($num, $limit)) {
$tva_static->id = $obj->rowid;
$tva_static->ref = $obj->rowid;
$tva_static->label = $obj->label;
print '<tr class="oddeven">';