New: Add default language for third parties and use it when multilang is enabled to define default language for document generation.

This commit is contained in:
Laurent Destailleur 2010-02-27 11:05:01 +00:00
parent eb2b3c0ea6
commit 05cc92e3db
9 changed files with 23 additions and 18 deletions

View File

@ -6,6 +6,8 @@ For users:
- New: Add "payment due before" field in invoice exports - New: Add "payment due before" field in invoice exports
- New: Add feature to resize or crop image files (for products photos) - 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: 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. - Fix: Formant number as wrong for ar_AR language.
For developers: For developers:

View File

@ -1910,7 +1910,7 @@ if ($id > 0 || ! empty($ref))
$var=true; $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);
/* /*

View File

@ -2137,7 +2137,7 @@ else
$genallowed=$user->rights->commande->creer; $genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer; $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 * Liste des factures

View File

@ -3456,7 +3456,7 @@ else
$var=true; $var=true;
print '<br>'; print '<br>';
$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 * Propales rattachees

View File

@ -466,7 +466,7 @@ if ($_GET["action"] == 'create')
$sql.= ", ".MAIN_DB_PREFIX."entrepot as e"; $sql.= ", ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " WHERE ps.fk_entrepot = e.rowid"; $sql.= " WHERE ps.fk_entrepot = e.rowid";
$sql.= " AND fk_product = '".$product->id."'"; $sql.= " AND fk_product = '".$product->id."'";
$result = $db->query($sql) ; $result = $db->query($sql) ;
if ($result) if ($result)
{ {
@ -559,7 +559,7 @@ else
{ {
print '<div class="error">'.$mesg.'</div>'; print '<div class="error">'.$mesg.'</div>';
} }
$typeobject = $expedition->origin; $typeobject = $expedition->origin;
$origin = $expedition->origin; $origin = $expedition->origin;
$expedition->fetch_object(); $expedition->fetch_object();
@ -912,7 +912,7 @@ else
//$genallowed=1; //$genallowed=1;
//$delallowed=0; //$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; if ($genallowed && ! $somethingshown) $somethingshown=1;
} }

View File

@ -627,7 +627,7 @@ elseif ($fichinterid)
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
$sql.= ' WHERE ft.fk_fichinter = '.$fichinterid; $sql.= ' WHERE ft.fk_fichinter = '.$fichinterid;
$sql.= ' ORDER BY ft.rang ASC, ft.rowid'; $sql.= ' ORDER BY ft.rang ASC, ft.rowid';
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -873,7 +873,7 @@ elseif ($fichinterid)
$var=true; $var=true;
print "<br>\n"; print "<br>\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 "</td><td>"; print "</td><td>";
print "&nbsp;</td>"; print "&nbsp;</td>";

View File

@ -129,17 +129,18 @@ class FormFile
* \param genallowed Generation is allowed (1/0 or array of formats) * \param genallowed Generation is allowed (1/0 or array of formats)
* \param delallowed Remove is allowed (1/0) * \param delallowed Remove is allowed (1/0)
* \param modelselected Model to preselect by default * \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 forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* \param iconPDF Show only PDF icon with link (1/0) * \param iconPDF Show only PDF icon with link (1/0)
* \param maxfilenamelength Max length for filename shown * \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 param More param on http links
* \param title Title to show on top of form * \param title Title to show on top of form
* \param buttonlabel Label on submit button * \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) // filedir = conf->...dir_ouput."/".get_exdir(id)
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
@ -323,11 +324,13 @@ class FormFile
print '</td>'; print '</td>';
} }
print '<td align="center">'; print '<td align="center">';
// Language code (if multilang)
if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang) if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
{ {
include_once(DOL_DOCUMENT_ROOT.'/html.formadmin.class.php'); include_once(DOL_DOCUMENT_ROOT.'/html.formadmin.class.php');
$formadmin=new FormAdmin($this->db); $formadmin=new FormAdmin($this->db);
$formadmin->select_lang($langs->getDefaultLang()); $defaultlang=$codelang?$codelang:$langs->getDefaultLang();
$formadmin->select_lang($defaultlang);
} }
else else
{ {
@ -381,7 +384,7 @@ class FormFile
if (!$iconPDF) print "<tr ".$bc[$var].">"; if (!$iconPDF) print "<tr ".$bc[$var].">";
// Show file name with link to download // Show file name with link to download
if (!$iconPDF) print '<td>'; if (!$iconPDF) print '<td nowrap="nowrap">';
print '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">'; print '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">';
if (!$iconPDF) if (!$iconPDF)
{ {
@ -394,9 +397,9 @@ class FormFile
print '</a>'; print '</a>';
if (!$iconPDF) print '</td>'; if (!$iconPDF) print '</td>';
// Affiche taille fichier // Affiche taille fichier
if (!$iconPDF) print '<td align="right">'.dol_print_size(dol_filesize($filedir."/".$file["name"])).'</td>'; if (!$iconPDF) print '<td align="right" nowrap="nowrap">'.dol_print_size(dol_filesize($filedir."/".$file["name"])).'</td>';
// Affiche date fichier // Affiche date fichier
if (!$iconPDF) print '<td align="right">'.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').'</td>'; if (!$iconPDF) print '<td align="right" nowrap="nowrap">'.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').'</td>';
if ($delallowed) if ($delallowed)
{ {

View File

@ -996,7 +996,7 @@ function picto_from_langcode($codelang)
if ($codelang == 'auto') $ret=img_picto('','/theme/common/flags/int.png','',1); if ($codelang == 'auto') $ret=img_picto('','/theme/common/flags/int.png','',1);
else { else {
//print $codelang; //print $codelang;
$langtocountryflag=array('fr_CA'=>'mq','es_CA','catalonia','ar_AR'=>''); $langtocountryflag=array('fr_CA'=>'mq','ca_ES'=>'catalonia','ar_AR'=>'');
$tmpcode=''; $tmpcode='';
if (isset($langtocountryflag[$codelang])) $tmpcode=$langtocountryflag[$codelang]; if (isset($langtocountryflag[$codelang])) $tmpcode=$langtocountryflag[$codelang];
else else

View File

@ -598,7 +598,7 @@ else
$genallowed=$user->rights->expedition->livraison->creer; $genallowed=$user->rights->expedition->livraison->creer;
$delallowed=$user->rights->expedition->livraison->supprimer; $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; if ($genallowed && ! $somethingshown) $somethingshown=1;
print '</td><td valign="top" width="50%">'; print '</td><td valign="top" width="50%">';