Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 9.0

This commit is contained in:
Laurent Destailleur 2019-03-19 13:10:17 +01:00
commit dbe15d3685
4 changed files with 15 additions and 12 deletions

View File

@ -661,8 +661,8 @@ if ($action == 'create')
print "</tr>\n";
}
$total_debit = price2num($total_debit);
$total_credit = price2num($total_credit);
$total_debit = price2num($total_debit, 'MT');
$total_credit = price2num($total_credit, 'MT');
if ($total_debit != $total_credit)
{

View File

@ -1296,15 +1296,15 @@ if (empty($reshook))
$qualified=1;
if (empty($lines[$i]->qty)) $qualified=0; // We discard qty=0, it is an option
if (! empty($lines[$i]->special_code)) $qualified=0; // We discard special_code (frais port, ecotaxe, option, ...)
if ($qualified) $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
if ($qualified){
$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
$tva_tx = $lines[$i]->tva_tx;
$amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100;
}
}
if ($totalamount != 0) {
if ($numlines > 0) $numlines = $numlines-1;
$tva_tx = $lines[$numlines]->tva_tx;
if (! empty($lines[$numlines]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$numlines]->vat_src_code.')';
$amountdeposit[$tva_tx] = ($totalamount * $valuedeposit) / 100;
} else {
if($totalamount == 0) {
$amountdeposit[0] = 0;
}
} else {
@ -1315,7 +1315,6 @@ if (empty($reshook))
$amount_ttc_diff = $amountdeposit[0];
}
foreach ($amountdeposit as $tva => $amount)
{
if (empty($amount)) continue;
@ -1328,6 +1327,7 @@ if (empty($reshook))
} elseif ($typeamount=='variable') {
$descline.= ' ('. $valuedeposit.'%)';
}
$descline.= ' - '.$srcobject->ref;
$result = $object->addline(
$descline,

View File

@ -1695,7 +1695,7 @@ class Facture extends CommonInvoice
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").",";
$sql.= " situation_cycle_ref=".(empty($this->situation_cycle_ref)?"null":$this->db->escape($this->situation_cycle_ref)).",";
$sql.= " situation_counter=".(empty($this->situation_counter)?"null":$this->db->escape($this->situation_counter)).",";
$sql.= " situation_final=".(empty($this->situation_counter)?"0":$this->db->escape($this->situation_counter));
$sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final));
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();

View File

@ -3447,7 +3447,10 @@ class Form
$langs->load('bills');
$opt = '<option value ="" selected></option>';
$sql = 'SELECT rowid, facnumber, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_counter>=1';
$sql = 'SELECT rowid, facnumber, situation_cycle_ref, situation_counter, situation_final, fk_soc';
$sql.= ' FROM ' . MAIN_DB_PREFIX . 'facture';
$sql.= ' WHERE entity IN ('.getEntity('facture').')';
$sql.= ' AND situation_counter>=1';
$sql.= ' ORDER by situation_cycle_ref, situation_counter desc';
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {