forked from Wavyzz/dolibarr
Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/core/class/commonobject.class.php htdocs/core/tpl/originproductline.tpl.php htdocs/fourn/facture/card.php htdocs/install/mysql/migration/14.0.0-15.0.0.sql htdocs/user/card.php
This commit is contained in:
@@ -276,6 +276,9 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
||||
if ($offset) {
|
||||
$param .= '&offset='.urlencode($offset);
|
||||
}
|
||||
if ($limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||
}
|
||||
|
||||
@@ -519,9 +519,10 @@ class Account extends CommonObject
|
||||
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||
* @param int $datev Date value
|
||||
* @param string $num_releve Label of bank receipt for reconciliation
|
||||
* @param float $amount_main_currency Amount
|
||||
* @return int Rowid of added entry, <0 if KO
|
||||
*/
|
||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '')
|
||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
|
||||
{
|
||||
// Deprecation warning
|
||||
if (is_numeric($oper)) {
|
||||
@@ -579,6 +580,7 @@ class Account extends CommonObject
|
||||
$accline->datev = $datev;
|
||||
$accline->label = $label;
|
||||
$accline->amount = $amount;
|
||||
$accline->amount_main_currency = $amount_main_currency;
|
||||
$accline->fk_user_author = $user->id;
|
||||
$accline->fk_account = $this->id;
|
||||
$accline->fk_type = $oper;
|
||||
@@ -1801,7 +1803,8 @@ class AccountLine extends CommonObject
|
||||
*/
|
||||
public $datev;
|
||||
|
||||
public $amount;
|
||||
public $amount; /* Amount of payment in the bank account currency */
|
||||
public $amount_main_currency; /* Amount in the currency of company if bank account use another currency */
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@@ -1962,6 +1965,7 @@ class AccountLine extends CommonObject
|
||||
$sql .= ", datev";
|
||||
$sql .= ", label";
|
||||
$sql .= ", amount";
|
||||
$sql .= ", amount_main_currency";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", num_chq";
|
||||
$sql .= ", fk_account";
|
||||
@@ -1976,7 +1980,8 @@ class AccountLine extends CommonObject
|
||||
$sql .= ", '".$this->db->idate($this->datev)."'";
|
||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||
$sql .= ", ".price2num($this->amount);
|
||||
$sql .= ", ".($this->fk_user_author > 0 ? $this->fk_user_author : "null");
|
||||
$sql .= ", ".(empty($this->amount_main_currency) ? "NULL" : price2num($this->amount_main_currency));
|
||||
$sql .= ", ".($this->fk_user_author > 0 ? ((int) $this->fk_user_author) : "null");
|
||||
$sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null");
|
||||
$sql .= ", '".$this->db->escape($this->fk_account)."'";
|
||||
$sql .= ", '".$this->db->escape($this->fk_type)."'";
|
||||
|
||||
@@ -811,6 +811,10 @@ class Facture extends CommonInvoice
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
|
||||
// Complete vat rate with code
|
||||
$vatrate = $newinvoiceline->tva_tx;
|
||||
if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$newinvoiceline->vat_src_code.')';
|
||||
|
||||
$newinvoiceline->fk_parent_line = $fk_parent_line;
|
||||
|
||||
if ($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) {
|
||||
@@ -821,7 +825,37 @@ class Facture extends CommonInvoice
|
||||
$newinvoiceline->fk_remise_except = $discountId;
|
||||
}
|
||||
|
||||
$result = $newinvoiceline->insert();
|
||||
$result = $this->addline(
|
||||
$newinvoiceline->desc,
|
||||
$newinvoiceline->subprice,
|
||||
$newinvoiceline->qty,
|
||||
$vatrate,
|
||||
$newinvoiceline->localtax1_tx,
|
||||
$newinvoiceline->localtax2_tx,
|
||||
$newinvoiceline->fk_product,
|
||||
$newinvoiceline->remise_percent,
|
||||
$newinvoiceline->date_start,
|
||||
$newinvoiceline->date_end,
|
||||
$newinvoiceline->fk_code_ventilation,
|
||||
$newinvoiceline->info_bits,
|
||||
$newinvoiceline->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$newinvoiceline->product_type,
|
||||
$newinvoiceline->rang,
|
||||
$newinvoiceline->special_code,
|
||||
$newinvoiceline->element,
|
||||
$newinvoiceline->id,
|
||||
$fk_parent_line,
|
||||
$newinvoiceline->fk_fournprice,
|
||||
$newinvoiceline->pa_ht,
|
||||
$newinvoiceline->label,
|
||||
$newinvoiceline->array_options,
|
||||
$newinvoiceline->situation_percent,
|
||||
$newinvoiceline->fk_prev_id,
|
||||
$newinvoiceline->fk_unit,
|
||||
$newinvoiceline->multicurrency_subprice
|
||||
);
|
||||
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0) {
|
||||
|
||||
@@ -266,6 +266,7 @@ if (empty($reshook)) {
|
||||
if (!$error) {
|
||||
// Create payment and update this->multicurrency_amounts if this->amounts filled or
|
||||
// this->amounts if this->multicurrency_amounts filled.
|
||||
// This also set ->amount and ->multicurrency_amount
|
||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); // This include closing invoices and regenerating documents
|
||||
if ($paiement_id < 0) {
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
|
||||
@@ -636,17 +636,22 @@ class Paiement extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$totalamount = $this->amount;
|
||||
$totalamount_main_currency = null;
|
||||
if (empty($totalamount)) {
|
||||
$totalamount = $this->total; // For backward compatibility
|
||||
}
|
||||
|
||||
// if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me)
|
||||
if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) {
|
||||
$totalamount = $this->multicurrency_amount;
|
||||
$totalamount = $this->multicurrency_amount; // We will insert into llx_bank.amount in foreign currency
|
||||
$totalamount_main_currency = $this->amount; // We will also save the amount in main currency into column llx_bank.amount_main_currency
|
||||
}
|
||||
|
||||
if ($mode == 'payment_supplier') {
|
||||
$totalamount = -$totalamount;
|
||||
if (isset($totalamount_main_currency)) {
|
||||
$totalamount_main_currency = -$totalamount_main_currency;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert payment into llx_bank
|
||||
@@ -660,8 +665,11 @@ class Paiement extends CommonObject
|
||||
$user,
|
||||
$emetteur_nom,
|
||||
$emetteur_banque,
|
||||
$accountancycode
|
||||
);
|
||||
$accountancycode,
|
||||
null,
|
||||
'',
|
||||
$totalamount_main_currency
|
||||
);
|
||||
|
||||
// Mise a jour fk_bank dans llx_paiement
|
||||
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
||||
@@ -706,7 +714,7 @@ class Paiement extends CommonObject
|
||||
DOL_URL_ROOT.'/comm/card.php?socid=',
|
||||
$fac->thirdparty->name,
|
||||
'company'
|
||||
);
|
||||
);
|
||||
if ($result <= 0) {
|
||||
dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
|
||||
}
|
||||
@@ -724,7 +732,7 @@ class Paiement extends CommonObject
|
||||
DOL_URL_ROOT.'/fourn/card.php?socid=',
|
||||
$fac->thirdparty->name,
|
||||
'company'
|
||||
);
|
||||
);
|
||||
if ($result <= 0) {
|
||||
dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
|
||||
}
|
||||
@@ -742,7 +750,7 @@ class Paiement extends CommonObject
|
||||
DOL_URL_ROOT.'/compta/prelevement/card.php?id=',
|
||||
$this->num_payment,
|
||||
'withdraw'
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
// Add link 'InvoiceRefused' in bank_url
|
||||
@@ -753,7 +761,7 @@ class Paiement extends CommonObject
|
||||
DOL_URL_ROOT.'/compta/prelevement/card.php?id=',
|
||||
$this->num_prelevement,
|
||||
'withdraw'
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
@@ -1291,40 +1299,40 @@ class Paiement extends CommonObject
|
||||
|
||||
$langs->load('compta');
|
||||
/*if ($mode == 0)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
||||
}*/
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate');
|
||||
if ($status == 1) return $langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
|
||||
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
|
||||
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
|
||||
}*/
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user