diff --git a/ChangeLog b/ChangeLog
index f01603c5e16..239686a449a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@ For users:
- New: Add "payment due before" field in invoice exports
- New: Add feature to resize or crop image files (for products photos)
- New: task #10113 : Show list of emailing on clicking on "number of mass emailing received"
+- New: Add default language for third parties and use it when multilang is enabled
+ to define default language for document generation.
- Fix: Formant number as wrong for ar_AR language.
For developers:
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 0536329ffab..d603367ef37 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -1910,7 +1910,7 @@ if ($id > 0 || ! empty($ref))
$var=true;
- $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
+ $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf,'',0,0,28,0,'',0,'',$societe->default_lang);
/*
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index fcaa43ca742..97f0727de81 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -2137,7 +2137,7 @@ else
$genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer;
- $somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
+ $somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
/*
* Liste des factures
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 7838cad9c72..740eeb0d853 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -3456,7 +3456,7 @@ else
$var=true;
print '
';
- $somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf);
+ $somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
/*
* Propales rattachees
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index e9bc2faf4bf..9738eaae7f2 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -466,7 +466,7 @@ if ($_GET["action"] == 'create')
$sql.= ", ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " WHERE ps.fk_entrepot = e.rowid";
$sql.= " AND fk_product = '".$product->id."'";
-
+
$result = $db->query($sql) ;
if ($result)
{
@@ -559,7 +559,7 @@ else
{
print '
'.$mesg.'
';
}
-
+
$typeobject = $expedition->origin;
$origin = $expedition->origin;
$expedition->fetch_object();
@@ -912,7 +912,7 @@ else
//$genallowed=1;
//$delallowed=0;
- $somethingshown=$formfile->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf);
+ $somethingshown=$formfile->show_documents('expedition',$expeditionref,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf,'',0,0,28,0,'','',$soc->default_lang);
if ($genallowed && ! $somethingshown) $somethingshown=1;
}
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index f1f45da3d37..9928188bf5e 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -627,7 +627,7 @@ elseif ($fichinterid)
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
$sql.= ' WHERE ft.fk_fichinter = '.$fichinterid;
$sql.= ' ORDER BY ft.rang ASC, ft.rowid';
-
+
$resql = $db->query($sql);
if ($resql)
{
@@ -873,7 +873,7 @@ elseif ($fichinterid)
$var=true;
print "
\n";
- $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fichinter->modelpdf);
+ $somethingshown=$formfile->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fichinter->modelpdf,'',0,0,28,0,'','','',$societe->default_lang);
print "";
print " | ";
diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php
index 296bccb3c03..d1a49fdf704 100644
--- a/htdocs/html.formfile.class.php
+++ b/htdocs/html.formfile.class.php
@@ -129,17 +129,18 @@ class FormFile
* \param genallowed Generation is allowed (1/0 or array of formats)
* \param delallowed Remove is allowed (1/0)
* \param modelselected Model to preselect by default
- * \param modelliste Tableau des modeles possibles. Use '' to hide combo select list.
+ * \param modelliste Array of possible models. Use '' to hide this combo select list.
* \param forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* \param iconPDF Show only PDF icon with link (1/0)
* \param maxfilenamelength Max length for filename shown
- * \param noform Do not output html form start and end
+ * \param noform Do not output html form tags
* \param param More param on http links
* \param title Title to show on top of form
* \param buttonlabel Label on submit button
- * \return int <0 si ko, nbre de fichiers affiches si ok
+ * \param codelang Defautl language code to use on lang combo box if multilang is enabled
+ * \return int <0 si ko, nbre de fichiers affiches si ok
*/
- function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='')
+ function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
{
// filedir = conf->...dir_ouput."/".get_exdir(id)
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
@@ -323,11 +324,13 @@ class FormFile
print '';
}
print '';
+ // Language code (if multilang)
if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
{
include_once(DOL_DOCUMENT_ROOT.'/html.formadmin.class.php');
$formadmin=new FormAdmin($this->db);
- $formadmin->select_lang($langs->getDefaultLang());
+ $defaultlang=$codelang?$codelang:$langs->getDefaultLang();
+ $formadmin->select_lang($defaultlang);
}
else
{
@@ -381,7 +384,7 @@ class FormFile
if (!$iconPDF) print " | ";
// Show file name with link to download
- if (!$iconPDF) print '| ';
+ if (!$iconPDF) print ' | ';
print '';
if (!$iconPDF)
{
@@ -394,9 +397,9 @@ class FormFile
print '';
if (!$iconPDF) print ' | ';
// Affiche taille fichier
- if (!$iconPDF) print ''.dol_print_size(dol_filesize($filedir."/".$file["name"])).' | ';
+ if (!$iconPDF) print ''.dol_print_size(dol_filesize($filedir."/".$file["name"])).' | ';
// Affiche date fichier
- if (!$iconPDF) print ''.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').' | ';
+ if (!$iconPDF) print ''.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').' | ';
if ($delallowed)
{
diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php
index 02992727346..0bb7bcc7f8f 100644
--- a/htdocs/lib/functions2.lib.php
+++ b/htdocs/lib/functions2.lib.php
@@ -996,7 +996,7 @@ function picto_from_langcode($codelang)
if ($codelang == 'auto') $ret=img_picto('','/theme/common/flags/int.png','',1);
else {
//print $codelang;
- $langtocountryflag=array('fr_CA'=>'mq','es_CA','catalonia','ar_AR'=>'');
+ $langtocountryflag=array('fr_CA'=>'mq','ca_ES'=>'catalonia','ar_AR'=>'');
$tmpcode='';
if (isset($langtocountryflag[$codelang])) $tmpcode=$langtocountryflag[$codelang];
else
diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php
index 509024d46df..b4b79b65fab 100644
--- a/htdocs/livraison/fiche.php
+++ b/htdocs/livraison/fiche.php
@@ -598,7 +598,7 @@ else
$genallowed=$user->rights->expedition->livraison->creer;
$delallowed=$user->rights->expedition->livraison->supprimer;
- $somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf);
+ $somethingshown=$formfile->show_documents('livraison',$livraisonref,$filedir,$urlsource,$genallowed,$delallowed,$livraison->modelpdf,'',0,0,28,0,'','','',$soc->default_lang);
if ($genallowed && ! $somethingshown) $somethingshown=1;
print '';
|