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

Conflicts:
	htdocs/commande/class/commande.class.php
	htdocs/compta/facture/class/facture.class.php
This commit is contained in:
Laurent Destailleur 2018-10-04 17:53:40 +02:00
commit 13759ea146
3 changed files with 16 additions and 13 deletions

View File

@ -1877,6 +1877,9 @@ class Commande extends CommonOrder
$line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$line->fetch_optionals();
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;

View File

@ -1379,7 +1379,7 @@ class Facture extends CommonInvoice
} }
else else
{ {
$this->error='Bill with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; $this->error='Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found';
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
return 0; return 0;
} }
@ -1485,7 +1485,7 @@ class Facture extends CommonInvoice
$line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
// TODO Fetch optional like done in fetch line of facture_rec ? $line->fetch_optionals();
$this->lines[$i] = $line; $this->lines[$i] = $line;
@ -4845,17 +4845,17 @@ class FactureLigne extends CommonInvoiceLine
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) { if ($resql && $resql->num_rows > 0) {
$res = $this->db->fetch_array($resql); $res = $this->db->fetch_array($resql);
$returnPercent = floatval($res['situation_percent']); $returnPercent = floatval($res['situation_percent']);
if($include_credit_note) { if($include_credit_note) {
$sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd'; $sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd';
$sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) '; $sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) ';
$sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id; $sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id;
$sql.= ' AND f.situation_cycle_ref = '.$tmpinvoice->situation_cycle_ref; // Prevent cycle outed $sql.= ' AND f.situation_cycle_ref = '.$tmpinvoice->situation_cycle_ref; // Prevent cycle outed
$sql.= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE; $sql.= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE;
$res = $this->db->query($sql); $res = $this->db->query($sql);
if($res) { if($res) {
while($obj = $this->db->fetch_object($res)) { while($obj = $this->db->fetch_object($res)) {
@ -4863,7 +4863,7 @@ class FactureLigne extends CommonInvoiceLine
} }
} }
} }
return $returnPercent; return $returnPercent;
} else { } else {
$this->error = $this->db->error(); $this->error = $this->db->error();

View File

@ -447,15 +447,15 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
} else { } else {
$companytouseforaddress = $targetcompany; $companytouseforaddress = $targetcompany;
// Contact on a thirdparty that is a different thirdparty than the thirdparty of object // Contact on a thirdparty that is a different thirdparty than the thirdparty of object
if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id)
{ {
$targetcontact->fetch_thirparty(); $targetcontact->fetch_thirdparty();
$companytouseforaddress = $targetcontact->thirdparty; $companytouseforaddress = $targetcontact->thirdparty;
} }
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress)); $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress));
} }
// Country // Country
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) { if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
$stringaddress.= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code)); $stringaddress.= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code));