Merge remote-tracking branch 'origin/3.6' into 3.7

Conflicts:
	htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
	htdocs/core/tpl/objectline_create.tpl.php
	htdocs/fichinter/fiche.php
This commit is contained in:
Laurent Destailleur 2014-11-28 02:20:01 +01:00
commit df9a6dae6c
16 changed files with 76 additions and 21 deletions

View File

@ -174,7 +174,10 @@ Dolibarr better:
- Fix: Civility & birthdate wasn't save into adherent module. - Fix: Civility & birthdate wasn't save into adherent module.
- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref - Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref
- Fix: Chars - is no more allowed into value for code for extra fields. - Fix: Chars - is no more allowed into value for code for extra fields.
( Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache - Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state
- Fix: Show sender Country on PDF docs when sender Country <> receiver Country
- Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS
***** ChangeLog for 3.6.1 compared to 3.6.* ***** ***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users: For users:

View File

@ -416,7 +416,15 @@ class Propal extends CommonObject
// infos marge // infos marge
$this->line->fk_fournprice = $fk_fournprice; if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// by external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
// Mise en option de la ligne // Mise en option de la ligne
@ -567,7 +575,15 @@ class Propal extends CommonObject
$this->line->skip_update_total = $skip_update_total; $this->line->skip_update_total = $skip_update_total;
// infos marge // infos marge
$this->line->fk_fournprice = $fk_fournprice; if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// by external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
$this->line->date_start=$date_start; $this->line->date_start=$date_start;

View File

@ -1224,7 +1224,15 @@ class Commande extends CommonOrder
$this->line->date_end=$date_end; $this->line->date_end=$date_end;
// infos marge // infos marge
$this->line->fk_fournprice = $fk_fournprice; if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// by external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
// TODO Ne plus utiliser // TODO Ne plus utiliser
@ -2421,7 +2429,15 @@ class Commande extends CommonOrder
$this->line->skip_update_total=$skip_update_total; $this->line->skip_update_total=$skip_update_total;
// infos marge // infos marge
$this->line->fk_fournprice = $fk_fournprice; if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
//by external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
// TODO deprecated // TODO deprecated

View File

@ -2203,7 +2203,15 @@ class Facture extends CommonInvoice
$this->line->skip_update_total = $skip_update_total; $this->line->skip_update_total = $skip_update_total;
// infos marge // infos marge
$this->line->fk_fournprice = $fk_fournprice; if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// POS or external module, take lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice;
}
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_option) && count($array_option)>0) {
@ -3499,6 +3507,14 @@ class FactureLigne extends CommonInvoiceLine
} }
} }
// POS or by external module, take lowest buying price
if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($this->fk_product);
$this->fk_fournprice = $productFournisseur->product_fourn_price_id;
}
$this->db->begin(); $this->db->begin();
// Insertion dans base de la ligne // Insertion dans base de la ligne

View File

@ -766,11 +766,12 @@ function dol_bc($var,$moreclass='')
* @param Object $object A company or contact object * @param Object $object A company or contact object
* @param int $withcountry 1=Add country into address string * @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string * @param string $sep Separator to use to build string
* @param Tranlsate $outputlangs Object lang that contains language for text translation.
* @return string Formated string * @return string Formated string
*/ */
function dol_format_address($object,$withcountry=0,$sep="\n") function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
{ {
global $conf; global $conf,$langs;
$ret=''; $ret='';
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
@ -815,8 +816,8 @@ function dol_format_address($object,$withcountry=0,$sep="\n")
$ret.=", ".$object->state; $ret.=", ".$object->state;
} }
} }
if (! is_object($outputlangs)) $outputlangs=$langs;
if ($withcountry) $ret.=($object->country?$sep.$object->country:''); if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
return $ret; return $ret;
} }

View File

@ -312,7 +312,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'source') if ($mode == 'source')
{ {
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n"; $withCountry = 0;
if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1;
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n";
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
{ {

View File

@ -1188,7 +1188,7 @@ class pdf_einstein extends ModelePDFCommandes
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $posy=42;

View File

@ -1145,7 +1145,7 @@ class pdf_proforma extends ModelePDFCommandes
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $posy=42;

View File

@ -555,7 +555,7 @@ class pdf_strato extends ModelePDFContract
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
} }
$carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $posy=42;

View File

@ -539,7 +539,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
$pdf->SetFont('','', $default_font_size - 3); $pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY($blSocX,$blSocY+4); $pdf->SetXY($blSocX,$blSocY+4);

View File

@ -587,7 +587,7 @@ class pdf_rouget extends ModelePdfExpedition
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
} }
$carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posx=$this->marge_gauche; $posx=$this->marge_gauche;

View File

@ -1434,7 +1434,7 @@ class pdf_crabe extends ModelePDFFactures
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $posy=42;

View File

@ -522,7 +522,7 @@ class pdf_soleil extends ModelePDFFicheinter
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
} }
$carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $posy=42;

View File

@ -1284,7 +1284,7 @@ class pdf_azur extends ModelePDFPropales
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
} }
$carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $posy=42;

View File

@ -970,7 +970,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $posy=42;

View File

@ -1022,7 +1022,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $posy=42;