2
0
forked from Wavyzz/dolibarr

Ajout option MAIN_MULTILANGS pour avoir une interface qui gre plusieurs langues (rend obsolete le param PRODUIT_MULTILANGS)

This commit is contained in:
Laurent Destailleur
2006-03-21 23:47:01 +00:00
parent e11d993a80
commit 16ff828b60
32 changed files with 374 additions and 283 deletions

View File

@@ -50,7 +50,8 @@ $searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$lan
if (isset($_POST["action"]) && $_POST["action"] == 'update') if (isset($_POST["action"]) && $_POST["action"] == 'update')
{ {
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"]); dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"]);
dolibarr_set_const($db, "SIZE_LISTE_LIMIT", $_POST["size_liste_limit"]); dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"]);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"]);
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["disable_javascript"]); dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["disable_javascript"]);
dolibarr_set_const($db, "MAIN_POPUP_CALENDAR", $_POST["popup_calendar"]); dolibarr_set_const($db, "MAIN_POPUP_CALENDAR", $_POST["popup_calendar"]);
@@ -61,19 +62,20 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update')
dolibarr_set_const($db, "MAIN_MENU_BARRELEFT", $_POST["main_menu_barreleft"]); dolibarr_set_const($db, "MAIN_MENU_BARRELEFT", $_POST["main_menu_barreleft"]);
dolibarr_set_const($db, "MAIN_MENUFRONT_BARRETOP", $_POST["main_menufront_barretop"]); dolibarr_set_const($db, "MAIN_MENUFRONT_BARRETOP", $_POST["main_menufront_barretop"]);
dolibarr_set_const($db, "MAIN_MENUFRONT_BARRELEFT", $_POST["main_menufront_barreleft"]); dolibarr_set_const($db, "MAIN_MENUFRONT_BARRELEFT",$_POST["main_menufront_barreleft"]);
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"]); dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"]);
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT",$_POST["main_searchform_contact"]); dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["main_searchform_contact"]);
dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE",$_POST["main_searchform_societe"]); dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["main_searchform_societe"]);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["main_searchform_produitservice"]); dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["main_searchform_produitservice"]);
dolibarr_set_const($db, "MAIN_MOTD", trim($_POST["main_motd"])); dolibarr_set_const($db, "MAIN_MOTD", $_POST["main_motd"]);
$_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer
Header("Location: ihm.php?mainmenu=home&leftmenu=setup"); Header("Location: ihm.php?mainmenu=home&leftmenu=setup");
exit;
} }
@@ -103,7 +105,12 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
// Taille max des listes // Taille max des listes
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="size_liste_limit" size="4" value="' . SIZE_LISTE_LIMIT . '"></td></tr>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableMultilangInterface").'</td><td>';
$html->selectyesnonum('main_multilangs',$conf->global->MAIN_MULTILANGS);
print '</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink").'</td><td>'; print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink").'</td><td>';
@@ -212,7 +219,10 @@ else
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DefaultLanguage").'</td><td>' . ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$conf->global->MAIN_LANG_DEFAULT) . '</td></tr>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("DefaultLanguage").'</td><td>' . ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$conf->global->MAIN_LANG_DEFAULT) . '</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->SIZE_LISTE_LIMIT . '</td></tr>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableMultilangInterface").'</td><td>' . yn($conf->global->MAIN_MULTILANGS) . '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td></tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink").'</td><td>'; print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink").'</td><td>';

View File

@@ -585,9 +585,11 @@ if ($_POST['action'] == 'send' || $_POST['action'] == 'relance')
/* /*
* G<>n<EFBFBD>rer ou reg<65>n<EFBFBD>rer le document PDF * G<>n<EFBFBD>rer ou reg<65>n<EFBFBD>rer le document PDF
*/ */
if ($_GET['action'] == 'builddoc') if ($_REQUEST['action'] == 'builddoc') // En get ou en post
{ {
facture_pdf_create($db, $_GET['facid']); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
facture_pdf_create($db, $_REQUEST['facid'], '', '', $outputlangs);
} }
/********************************************************************* /*********************************************************************
@@ -1754,9 +1756,8 @@ else
$filename=sanitize_string($fac->ref); $filename=sanitize_string($fac->ref);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($fac->ref); $filedir=$conf->facture->dir_output . '/' . sanitize_string($fac->ref);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer); $genallowed=($fac->statut == 1 && $user->rights->facture->creer);
// $delallowed=$user->rights->facture->supprimer; // $delallowed=$user->rights->facture->supprimer;
$genallowed=0;
$delallowed=0; $delallowed=0;
$var=true; $var=true;

View File

@@ -624,7 +624,7 @@ class Form
$sqld.= " ORDER BY p.nbvente DESC"; $sqld.= " ORDER BY p.nbvente DESC";
// inutile de faire la requete si l'option n'est pas active // inutile de faire la requete si l'option n'est pas active
if ($conf->global->PRODUIT_MULTILANGS == 1) if ($conf->global->MAIN_MULTILANGS)
{ {
$resultd = $this->db->query($sqld); $resultd = $this->db->query($sqld);
if ( $resultd ) $objtp = $this->db->fetch_object($resultd); if ( $resultd ) $objtp = $this->db->fetch_object($resultd);
@@ -642,7 +642,7 @@ class Form
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
// Multilangs : modification des donn<6E>e si une traduction existe // Multilangs : modification des donn<6E>e si une traduction existe
if ($conf->global->PRODUIT_MULTILANGS == 1) if ($conf->global->MAIN_MULTILANGS)
if ( $objp->rowid == $objtp->fk_product ) // si on a une traduction if ( $objp->rowid == $objtp->fk_product ) // si on a une traduction
{ {
if ( $objtp->label != '') $objp->label = $objtp->label; if ( $objtp->label != '') $objp->label = $objtp->label;
@@ -2150,10 +2150,17 @@ class Form
print_titre($langs->trans("Documents")); print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr '.$bc[$var].'><td>'.$langs->trans('Model').'</td><td align="center">'; print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans('Model').'</td>';
print '<td align="center">';
$this->select_array('model',$modellist,$modelselected,0,0,1); $this->select_array('model',$modellist,$modelselected,0,0,1);
$texte=$langs->trans('Generate'); $texte=$langs->trans('Generate');
print '</td><td align="center" colspan="2"><input class="button" type="submit" value="'.$texte.'">'; print '</td>';
print '<td align="center">';
$this->select_lang($langs->getDefaultLang());
print '</td>';
print '<td align="center" colspan="'.($delallowed?'2':'1').'">';
print '<input class="button" type="submit" value="'.$texte.'">';
print '</td></tr>'; print '</td></tr>';
} }
@@ -2198,12 +2205,18 @@ class Form
// Affiche colonne type MIME // Affiche colonne type MIME
print '<td nowrap>'.$mimetype.'</td>'; print '<td nowrap>'.$mimetype.'</td>';
// Affiche nom fichier avec lien download // Affiche nom fichier avec lien download
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a>';
print '</td>';
// Affiche taille fichier // Affiche taille fichier
print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>'; print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>';
// Affiche date fichier // Affiche date fichier
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>'; print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>';
if ($delallowed)
{
print '<td><a href="'.$urlsource.'&action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.img_delete().'</a></td>';
}
print '</tr>'; print '</tr>';
$i++; $i++;

View File

@@ -80,7 +80,7 @@ class box_produits extends ModeleBoxes {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
// Multilangs // Multilangs
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active if ($conf->global->MAIN_MULTILANGS) // si l'option est active
{ {
$sqld = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sqld = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
$sqld.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; $sqld.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";

View File

@@ -91,7 +91,7 @@ class box_services_vendus extends ModeleBoxes {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
// Multilangs // Multilangs
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active if ($conf->global->MAIN_MULTILANGS) // si l'option est active
{ {
$sqld = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sqld = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
$sqld.= " WHERE fk_product=".$objp->pid." AND lang='". $langs->getDefaultLang() ."'"; $sqld.= " WHERE fk_product=".$objp->pid." AND lang='". $langs->getDefaultLang() ."'";

View File

@@ -133,9 +133,18 @@ class ModeleNumRefCommandes
} }
} }
function commande_pdf_create($db, $comid, $modele='')
/*
\brief Cr<43>e un bon de commande sur disque en fonction du mod<6F>le de COMMANDE_ADDON_PDF
\param db objet base de donn<6E>e
\param id id de la propale <20> cr<63>er
\param modele force le modele <20> utiliser ('' par defaut)
\param outputlangs objet lang a utiliser pour traduction
*/
function commande_pdf_create($db, $id, $modele='', $outputlangs='')
{ {
global $langs; global $conf,$langs;
$langs->load("orders"); $langs->load("orders");
$dir = DOL_DOCUMENT_ROOT."/includes/modules/commande/"; $dir = DOL_DOCUMENT_ROOT."/includes/modules/commande/";
@@ -143,16 +152,17 @@ function commande_pdf_create($db, $comid, $modele='')
// Positionne modele sur le nom du modele de facture <20> utiliser // Positionne modele sur le nom du modele de facture <20> utiliser
if (! strlen($modele)) if (! strlen($modele))
{ {
if (defined("COMMANDE_ADDON_PDF") && COMMANDE_ADDON_PDF) if ($conf->global->COMMANDE_ADDON_PDF)
{ {
$modele = COMMANDE_ADDON_PDF; $modele = $conf->global->COMMANDE_ADDON_PDF;
} }
else else
{ {
print $langs->trans("Error")." ".$langs->trans("Error_PROPALE_ADDON_PDF_NotDefined"); print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_ADDON_PDF_NotDefined");
return 0; return 0;
} }
} }
// Charge le modele // Charge le modele
$file = "pdf_".$modele.".modules.php"; $file = "pdf_".$modele.".modules.php";
if (file_exists($dir.$file)) if (file_exists($dir.$file))
@@ -162,10 +172,10 @@ function commande_pdf_create($db, $comid, $modele='')
$obj = new $classname($db); $obj = new $classname($db);
if ( $obj->write_pdf_file($comid) > 0) if ( $obj->write_pdf_file($id, $outputlangs) > 0)
{ {
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
commande_delete_preview($db, $comid); commande_delete_preview($db, $id);
return 1; return 1;
} }
else else
@@ -181,6 +191,8 @@ function commande_pdf_create($db, $comid, $modele='')
return 0; return 0;
} }
} }
function commande_delete_preview($db, $propalid) function commande_delete_preview($db, $propalid)
{ {
global $langs,$conf; global $langs,$conf;

View File

@@ -135,37 +135,54 @@ class ModeleNumRefDons
/** /**
\brief Cr<43>e un don sur disque en fonction du mod<6F>le de DON_ADDON_PDF \brief Cr<43>e un don sur disque en fonction du mod<6F>le de DON_ADDON_PDF
\param db objet base de donn<6E>e \param db objet base de donn<6E>e
\param donid id de la facture <20> cr<63>er \param id id du don <20> cr<63>er
\param message message \param message message
\param modele force le modele <20> utiliser ('' par defaut)
\param outputlangs objet lang a utiliser pour traduction
\return int 0 si KO, 1 si OK \return int 0 si KO, 1 si OK
*/ */
function don_create($db, $donid, $message="") function don_create($db, $id, $message='', $modele='', $outputlangs='')
{ {
global $langs; global $conf, $langs;
$langs->load("bills"); $langs->load("bills");
define("DON_ADDON",'html_cerfafr'); // todo forc<72> ici
$conf->global->DON_ADDON='html_cerfafr';
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/";
if (defined("DON_ADDON") && DON_ADDON) // Positionne modele sur le nom du modele <20> utiliser
if (! strlen($modele))
{ {
$file = DON_ADDON.".modules.php"; if ($conf->global->DON_ADDON_PDF)
{
$modele = $conf->global->DON_ADDON_PDF;
}
else
{
print $langs->trans("Error")." ".$langs->trans("Error_DON_ADDON_PDF_NotDefined");
return 0;
}
}
$classname = DON_ADDON; // Charge le modele
$file = $modele.".modules.php";
if (file_exists($dir.$file))
{
$classname = $modele;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db);
$obj->message = $message; $obj->message = $message;
if ( $obj->write_file($donid) > 0) if ( $obj->write_file($id,$outputlangs) > 0)
{ {
// Succ<63>s de la cr<63>ation de la facture. On g<>n<EFBFBD>re le fichier meta // Succ<63>s de la cr<63>ation de la facture. On g<>n<EFBFBD>re le fichier meta
don_meta_create($db, $donid); don_meta_create($db, $id);
// et on supprime l'image correspondant au preview // et on supprime l'image correspondant au preview
don_delete_preview($db, $donid); don_delete_preview($db, $id);
return 1; return 1;
} }
@@ -178,7 +195,7 @@ function don_create($db, $donid, $message="")
} }
else else
{ {
print $langs->trans("Error")." ".$langs->trans("Error_DON_ADDON_PDF_NotDefined"); print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
return 0; return 0;
} }
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com> * Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
* *
@@ -60,7 +60,8 @@ class ModelePDFFactures extends FPDF
function liste_modeles($db) function liste_modeles($db)
{ {
$liste=array(); $liste=array();
$sql =""; $sql ="SELECT value, value from ".MAIN_DB_PREFIX."const";
$sql.=" where name='FACTURE_ADDON_PDF'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@@ -76,6 +77,7 @@ class ModelePDFFactures extends FPDF
} }
else else
{ {
dolibarr_print_error($db);
return -1; return -1;
} }
return $liste; return $liste;
@@ -135,36 +137,52 @@ class ModeleNumRefFactures
/** /**
\brief Cr<43>e un facture sur disque en fonction du mod<6F>le de FACTURE_ADDON_PDF \brief Cr<43>e un facture sur disque en fonction du mod<6F>le de FACTURE_ADDON_PDF
\param db objet base de donn<6E>e \param db objet base de donn<6E>e
\param facid id de la facture <20> cr<63>er \param id id de la facture <20> cr<63>er
\param message message \param message message
\param modele force le modele <20> utiliser ('' par defaut)
\param outputlangs objet lang a utiliser pour traduction
\return int 0 si KO, 1 si OK \return int 0 si KO, 1 si OK
*/ */
function facture_pdf_create($db, $facid, $message="") function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
{ {
global $langs; global $conf,$langs;
$langs->load("bills"); $langs->load("bills");
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/facture/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/facture/";
if (defined("FACTURE_ADDON_PDF") && FACTURE_ADDON_PDF) // Positionne modele sur le nom du modele <20> utiliser
if (! strlen($modele))
{ {
$file = "pdf_".FACTURE_ADDON_PDF.".modules.php"; if ($conf->global->FACTURE_ADDON_PDF)
{
$modele = $conf->global->FACTURE_ADDON_PDF;
}
else
{
print $langs->trans("Error")." ".$langs->trans("Error_FACTURE_ADDON_PDF_NotDefined");
return 0;
}
}
$classname = "pdf_".FACTURE_ADDON_PDF; // Charge le modele
$file = "pdf_".$modele.".modules.php";
if (file_exists($dir.$file))
{
$classname = "pdf_".$modele;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db);
$obj->message = $message; $obj->message = $message;
if ( $obj->write_pdf_file($facid) > 0) if ($obj->write_pdf_file($id, $outputlangs) > 0)
{ {
// Succ<63>s de la cr<63>ation de la facture. On g<>n<EFBFBD>re le fichier meta // Succ<63>s de la cr<63>ation de la facture. On g<>n<EFBFBD>re le fichier meta
facture_meta_create($db, $facid); facture_meta_create($db, $id);
// et on supprime l'image correspondant au preview // et on supprime l'image correspondant au preview
facture_delete_preview($db, $facid); facture_delete_preview($db, $id);
return 1; //TODO A MODIFIER return 1;
} }
else else
{ {
@@ -176,7 +194,7 @@ function facture_pdf_create($db, $facid, $message="")
} }
else else
{ {
print $langs->trans("Error")." ".$langs->trans("Error_FACTURE_ADDON_PDF_NotDefined"); print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
return 0; return 0;
} }
} }

View File

@@ -140,27 +140,42 @@ class ModeleNumRefFicheinter
/** /**
\brief Cr<43>e une fiche intervention sur disque en fonction du mod<6F>le de FICHEINTER_ADDON_PDF \brief Cr<43>e une fiche intervention sur disque en fonction du mod<6F>le de FICHEINTER_ADDON_PDF
\param db objet base de donn<6E>e \param db objet base de donn<6E>e
\param facid id de la facture <20> cr<63>er \param id id de la fiche <20> cr<63>er
\param modele force le modele <20> utiliser ('' par defaut)
\param outputlangs objet lang a utiliser pour traduction
\return int 0 si KO, 1 si OK \return int 0 si KO, 1 si OK
*/ */
function fichinter_pdf_create($db, $facid) function fichinter_pdf_create($db, $facid, $modele='', $outputlangs)
{ {
global $langs; global $conf,$langs;
$langs->load("ficheinter"); $langs->load("ficheinter");
$dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/"; $dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/";
if (defined("FICHEINTER_ADDON_PDF") && FICHEINTER_ADDON_PDF) // Positionne modele sur le nom du modele de facture <20> utiliser
if (! strlen($modele))
{ {
if ($conf->global->FICHEINTER_ADDON_PDF)
{
$modele = $conf->global->FICHEINTER_ADDON_PDF;
}
else
{
print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined");
return 0;
}
}
$file = "pdf_".FICHEINTER_ADDON_PDF.".modules.php"; // Charge le modele
$file = "pdf_".$modele.".modules.php";
$classname = "pdf_".FICHEINTER_ADDON_PDF; if (file_exists($dir.$file))
{
$classname = "pdf_".$modele;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db);
if ( $obj->write_pdf_file($facid) > 0) if ( $obj->write_pdf_file($id,$outputlangs) > 0)
{ {
return 1; return 1;
} }
@@ -172,7 +187,7 @@ function fichinter_pdf_create($db, $facid)
} }
else else
{ {
print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined"); print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
return 0; return 0;
} }
} }

View File

@@ -133,10 +133,12 @@ class ModeleNumRefPropales
/** /**
\brief Cr<43>e une propale sur disque en fonction du mod<6F>le de PROPALE_ADDON_PDF \brief Cr<43>e une propale sur disque en fonction du mod<6F>le de PROPALE_ADDON_PDF
\param db objet base de donn<6E>e \param db objet base de donn<6E>e
\param facid id de la facture <20> cr<63>er \param id id de la propale <20> cr<63>er
\param modele force le modele <20> utiliser ('' par defaut) \param modele force le modele <20> utiliser ('' par defaut)
\param outputlangs objet lang a utiliser pour traduction
\return int 0 si KO, 1 si OK
*/ */
function propale_pdf_create($db, $facid, $modele='') function propale_pdf_create($db, $id, $modele='', $outputlangs='')
{ {
global $langs; global $langs;
$langs->load("propale"); $langs->load("propale");
@@ -146,9 +148,9 @@ function propale_pdf_create($db, $facid, $modele='')
// Positionne modele sur le nom du modele de facture <20> utiliser // Positionne modele sur le nom du modele de facture <20> utiliser
if (! strlen($modele)) if (! strlen($modele))
{ {
if (defined("PROPALE_ADDON_PDF") && PROPALE_ADDON_PDF) if ($conf->global->PROPALE_ADDON_PDF)
{ {
$modele = PROPALE_ADDON_PDF; $modele = $conf->global->PROPALE_ADDON_PDF;
} }
else else
{ {
@@ -166,10 +168,10 @@ function propale_pdf_create($db, $facid, $modele='')
$obj = new $classname($db); $obj = new $classname($db);
if ( $obj->write_pdf_file($facid) > 0) if ( $obj->write_pdf_file($id, $outputlangs) > 0)
{ {
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
propale_delete_preview($db, $facid); propale_delete_preview($db, $id);
return 1; return 1;
} }
else else
@@ -185,6 +187,7 @@ function propale_pdf_create($db, $facid, $modele='')
return 0; return 0;
} }
} }
/** /**
\brief Supprime l'image de pr<70>visualitation, pour le cas de r<>g<EFBFBD>n<EFBFBD>ration de propal \brief Supprime l'image de pr<70>visualitation, pour le cas de r<>g<EFBFBD>n<EFBFBD>ration de propal
\param db objet base de donn<6E>e \param db objet base de donn<6E>e

View File

@@ -301,6 +301,7 @@ DefaultMaxSizeList=Default max length for list
MessageOfDay=Message of day MessageOfDay=Message of day
PermanentLeftSearchForm=Permanent search form on left menu PermanentLeftSearchForm=Permanent search form on left menu
DefaultLanguage=Default language to use (language code) DefaultLanguage=Default language to use (language code)
EnableMultilangInterface=Enable multi-langual interface
SystemSuccessfulyUpdated=Your sustem has been updated successfully SystemSuccessfulyUpdated=Your sustem has been updated successfully
CompanyInfo=Company/foundation informations CompanyInfo=Company/foundation informations
CompanyIds=Company/foundation identities CompanyIds=Company/foundation identities

View File

@@ -300,6 +300,7 @@ MaxSizeList=Longueur maximale des listes
DefaultMaxSizeList=Longueur maximale par d<>faut des listes DefaultMaxSizeList=Longueur maximale par d<>faut des listes
MessageOfDay=Message du jour MessageOfDay=Message du jour
DefaultLanguage=Langue par d<>faut <20> utiliser (code langue) DefaultLanguage=Langue par d<>faut <20> utiliser (code langue)
EnableMultilangInterface=Activer l'interface multi-langage
PermanentLeftSearchForm=Zone de recherche permanente du menu de gauche PermanentLeftSearchForm=Zone de recherche permanente du menu de gauche
SystemSuccessfulyUpdated=Votre syst<73>me a <20>t<EFBFBD> correctement mis <20> jour SystemSuccessfulyUpdated=Votre syst<73>me a <20>t<EFBFBD> correctement mis <20> jour
CompanyInfo=Informations sur la soci<63>t<EFBFBD>/association CompanyInfo=Informations sur la soci<63>t<EFBFBD>/association

View File

@@ -161,9 +161,9 @@ if ($user->admin)
* Overwrite configs global par configs perso * Overwrite configs global par configs perso
* ------------------------------------------ * ------------------------------------------
*/ */
if (isset($user->conf->SIZE_LISTE_LIMIT) && $user->conf->SIZE_LISTE_LIMIT > 0) if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT) && $user->conf->MAIN_SIZE_LISTE_LIMIT > 0)
{ {
$conf->liste_limit = $user->conf->SIZE_LISTE_LIMIT; $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
} }
if (isset($user->conf->PRODUIT_LIMIT_SIZE)) if (isset($user->conf->PRODUIT_LIMIT_SIZE))
{ {

View File

@@ -384,8 +384,8 @@ else {
} }
// $conf->liste_limit = constante de taille maximale des listes // $conf->liste_limit = constante de taille maximale des listes
if (! $conf->global->SIZE_LISTE_LIMIT) $conf->global->SIZE_LISTE_LIMIT=20; if (! $conf->global->MAIN_SIZE_LISTE_LIMIT) $conf->global->MAIN_SIZE_LISTE_LIMIT=20;
$conf->liste_limit=$conf->global->SIZE_LISTE_LIMIT; $conf->liste_limit=$conf->global->MAIN_SIZE_LISTE_LIMIT;
// $conf->produit->limit_size = constante de taille maximale des select de produit // $conf->produit->limit_size = constante de taille maximale des select de produit
if (! isset($conf->global->PRODUIT_LIMIT_SIZE)) $conf->global->PRODUIT_LIMIT_SIZE=50; if (! isset($conf->global->PRODUIT_LIMIT_SIZE)) $conf->global->PRODUIT_LIMIT_SIZE=50;

View File

@@ -225,7 +225,7 @@ class Product
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
{ {
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
if ( $this->setMultiLangs() < 0) if ( $this->setMultiLangs() < 0)
{ {
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql; $this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
@@ -679,7 +679,7 @@ class Product
$this->db->free(); $this->db->free();
// multilangs // multilangs
if( $conf->global->PRODUIT_MULTILANGS == 1 ) $this->getMultiLangs(); if( $conf->global->MAIN_MULTILANGS) $this->getMultiLangs();
// multiprix // multiprix

View File

@@ -102,7 +102,7 @@ if($product->type == 0)
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -129,7 +129,7 @@ if ($_GET["id"] || $_GET["ref"])
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -145,7 +145,7 @@ if ($product->id)
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -457,7 +457,7 @@ if ($_GET["id"] || $_GET["ref"])
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -212,7 +212,7 @@ if ($_GET["id"] || $_GET["ref"])
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -141,7 +141,7 @@ if ($result)
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
//Multilangs //Multilangs
if ($conf->global->PRODUIT_MULTILANGS == 1) if ($conf->global->MAIN_MULTILANGS)
{ {
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";

View File

@@ -225,7 +225,7 @@ if ($resql)
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
// Multilangs // Multilangs
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active if ($conf->global->MAIN_MULTILANGS) // si l'option est active
{ {
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";

View File

@@ -141,7 +141,7 @@ if ($_GET["id"] || $_GET["ref"])
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -85,7 +85,7 @@ if ($result)
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
// Multilangs // Multilangs
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active if ($conf->global->MAIN_MULTILANGS) // si l'option est active
{ {
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";

View File

@@ -142,7 +142,7 @@ if($product->type == 0)
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -199,7 +199,7 @@ if ($id || $ref)
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -121,7 +121,7 @@ if ($_GET["id"] || $_GET["ref"])
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -169,7 +169,7 @@ if ($_GET["id"] || $_GET["ref"])
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -290,7 +290,7 @@ else
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
// Multilangs // Multilangs
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active if ($conf->global->MAIN_MULTILANGS) // si l'option est active
{ {
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";

View File

@@ -154,7 +154,7 @@ if ($_GET["id"] || $_GET["ref"])
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -179,7 +179,7 @@ if($product->type == 0)
} }
// Multilangs // Multilangs
if($conf->global->PRODUIT_MULTILANGS == 1) if($conf->global->MAIN_MULTILANGS)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id;
$head[$h][1] = $langs->trans("Translation"); $head[$h][1] = $langs->trans("Translation");

View File

@@ -69,8 +69,8 @@ if ($_POST["action"] == 'update')
$tabparam["MAIN_MENU_BARRETOP"]=$_POST["main_menu_barretop"]; $tabparam["MAIN_MENU_BARRETOP"]=$_POST["main_menu_barretop"];
$tabparam["MAIN_MENU_BARRELEFT"]=$_POST["main_menu_barreleft"]; $tabparam["MAIN_MENU_BARRELEFT"]=$_POST["main_menu_barreleft"];
if ($_POST["check_SIZE_LISTE_LIMIT"]=="on") $tabparam["SIZE_LISTE_LIMIT"]=$_POST["size_liste_limit"]; if ($_POST["check_SIZE_LISTE_LIMIT"]=="on") $tabparam["MAIN_SIZE_LISTE_LIMIT"]=$_POST["main_size_liste_limit"];
else $tabparam["SIZE_LISTE_LIMIT"]=''; else $tabparam["MAIN_SIZE_LISTE_LIMIT"]='';
if ($_POST["check_MAIN_THEME"]=="on") $tabparam["MAIN_THEME"]=$_POST["main_theme"]; if ($_POST["check_MAIN_THEME"]=="on") $tabparam["MAIN_THEME"]=$_POST["main_theme"];
else $tabparam["MAIN_THEME"]=''; else $tabparam["MAIN_THEME"]='';
@@ -157,9 +157,9 @@ if ($_GET["action"] == 'edit')
// Taille max des listes // Taille max des listes
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>';
print '<td>'.$conf->global->SIZE_LISTE_LIMIT.'</td>'; print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
print '<td align="left" nowrap="nowrap" width="20%"><input name="check_SIZE_LISTE_LIMIT" type="checkbox" '.($fuser->conf->SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>'; print '<td align="left" nowrap="nowrap" width="20%"><input name="check_SIZE_LISTE_LIMIT" type="checkbox" '.($fuser->conf->MAIN_SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td><input class="flat" name="size_liste_limit" size="4" value="' . $fuser->conf->SIZE_LISTE_LIMIT . '"></td></tr>'; print '<td><input class="flat" name="main_size_liste_limit" size="4" value="' . $fuser->conf->SIZE_LISTE_LIMIT . '"></td></tr>';
print '</table><br>'; print '</table><br>';
@@ -192,9 +192,9 @@ else
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>';
print '<td>'.$conf->global->SIZE_LISTE_LIMIT.'</td>'; print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
print '<td align="left" nowrap="nowrap" width="20%"><input type="checkbox" disabled '.($fuser->conf->SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>'; print '<td align="left" nowrap="nowrap" width="20%"><input type="checkbox" disabled '.($fuser->conf->MAIN_SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>' . $fuser->conf->SIZE_LISTE_LIMIT . '</td></tr>'; print '<td>' . $fuser->conf->MAIN_SIZE_LISTE_LIMIT . '</td></tr>';
print '</table><br>'; print '</table><br>';