From 16ff828b6075187bcd68956fba953d74d5e50053 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Mar 2006 23:47:01 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20option=20MAIN=5FMULTILANGS=20pour=20avo?= =?UTF-8?q?ir=20une=20interface=20qui=20g=E8re=20plusieurs=20langues=20(re?= =?UTF-8?q?nd=20obsolete=20le=20param=20PRODUIT=5FMULTILANGS)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/ihm.php | 64 ++++--- htdocs/compta/facture.php | 9 +- htdocs/html.form.class.php | 25 ++- htdocs/includes/boxes/box_produits.php | 2 +- htdocs/includes/boxes/box_services_vendus.php | 2 +- .../modules/commande/modules_commande.php | 104 ++++++----- htdocs/includes/modules/dons/modules_don.php | 57 +++--- .../modules/facture/modules_facture.php | 168 ++++++++++-------- .../modules/fichinter/modules_fichinter.php | 75 ++++---- .../modules/propale/modules_propale.php | 89 +++++----- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + htdocs/main.inc.php | 4 +- htdocs/master.inc.php | 4 +- htdocs/product.class.php | 4 +- htdocs/product/barcode.php | 2 +- htdocs/product/categorie.php | 2 +- htdocs/product/document.php | 2 +- htdocs/product/fiche.php | 2 +- htdocs/product/fournisseurs.php | 2 +- htdocs/product/index.php | 2 +- htdocs/product/liste.php | 2 +- htdocs/product/photos.php | 2 +- htdocs/product/popuprop.php | 2 +- htdocs/product/price.php | 2 +- htdocs/product/sousproduits/fiche.php | 2 +- htdocs/product/stats/facture.php | 2 +- htdocs/product/stats/fiche.php | 2 +- htdocs/product/stock/fiche.php | 2 +- htdocs/product/stock/product.php | 2 +- htdocs/product/traduction.php | 2 +- htdocs/user/param_ihm.php | 16 +- 32 files changed, 374 insertions(+), 283 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index fcaf2d10091..60f55292df7 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -49,31 +49,33 @@ $searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$lan if (isset($_POST["action"]) && $_POST["action"] == 'update') { - 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_DISABLE_JAVASCRIPT", $_POST["disable_javascript"]); - dolibarr_set_const($db, "MAIN_POPUP_CALENDAR", $_POST["popup_calendar"]); - - dolibarr_set_const($db, "MAIN_SHOW_BUGTRACK_LINK", $_POST["bugtrack"]); - dolibarr_set_const($db, "MAIN_SHOW_WORKBOARD", $_POST["workboard"]); - - dolibarr_set_const($db, "MAIN_MENU_BARRETOP", $_POST["main_menu_barretop"]); - 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_BARRELEFT", $_POST["main_menufront_barreleft"]); - - 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_SOCIETE",$_POST["main_searchform_societe"]); - dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["main_searchform_produitservice"]); - - dolibarr_set_const($db, "MAIN_MOTD", trim($_POST["main_motd"])); - - $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer - - Header("Location: ihm.php?mainmenu=home&leftmenu=setup"); + dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"]); + 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_POPUP_CALENDAR", $_POST["popup_calendar"]); + + dolibarr_set_const($db, "MAIN_SHOW_BUGTRACK_LINK", $_POST["bugtrack"]); + dolibarr_set_const($db, "MAIN_SHOW_WORKBOARD", $_POST["workboard"]); + + dolibarr_set_const($db, "MAIN_MENU_BARRETOP", $_POST["main_menu_barretop"]); + 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_BARRELEFT",$_POST["main_menufront_barreleft"]); + + 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_SOCIETE", $_POST["main_searchform_societe"]); + dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["main_searchform_produitservice"]); + + dolibarr_set_const($db, "MAIN_MOTD", $_POST["main_motd"]); + + $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer + + Header("Location: ihm.php?mainmenu=home&leftmenu=setup"); + exit; } @@ -103,7 +105,12 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') // Taille max des listes $var=!$var; - print ''.$langs->trans("DefaultMaxSizeList").''; + print ''.$langs->trans("DefaultMaxSizeList").''; + + $var=!$var; + print ''.$langs->trans("EnableMultilangInterface").''; + $html->selectyesnonum('main_multilangs',$conf->global->MAIN_MULTILANGS); + print ''; $var=!$var; print ''.$langs->trans("ShowBugTrackLink").''; @@ -212,7 +219,10 @@ else print ''.$langs->trans("DefaultLanguage").'' . ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$conf->global->MAIN_LANG_DEFAULT) . ''; $var=!$var; - print ''.$langs->trans("DefaultMaxSizeList").'' . $conf->global->SIZE_LISTE_LIMIT . ''; + print ''.$langs->trans("EnableMultilangInterface").'' . yn($conf->global->MAIN_MULTILANGS) . ''; + + $var=!$var; + print ''.$langs->trans("DefaultMaxSizeList").'' . $conf->global->MAIN_SIZE_LISTE_LIMIT . ''; $var=!$var; print ''.$langs->trans("ShowBugTrackLink").''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 32d3023185a..d86059480d8 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -585,9 +585,11 @@ if ($_POST['action'] == 'send' || $_POST['action'] == 'relance') /* * Générer ou regéné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); $filedir=$conf->facture->dir_output . '/' . sanitize_string($fac->ref); $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; - $genallowed=0; $delallowed=0; $var=true; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index f54d2162241..6e0a110b52d 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -624,7 +624,7 @@ class Form $sqld.= " ORDER BY p.nbvente DESC"; // 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); if ( $resultd ) $objtp = $this->db->fetch_object($resultd); @@ -642,7 +642,7 @@ class Form $objp = $this->db->fetch_object($result); // Multilangs : modification des donné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 ( $objtp->label != '') $objp->label = $objtp->label; @@ -2086,7 +2086,7 @@ class Form $modellist=$model->liste_modeles($this->db); } } - else if ($modulepart == 'commande') + else if ($modulepart == 'commande') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -2150,10 +2150,17 @@ class Form print_titre($langs->trans("Documents")); print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } @@ -2198,12 +2205,18 @@ class Form // Affiche colonne type MIME print ''; // Affiche nom fichier avec lien download - print ''; + print ''; // Affiche taille fichier print ''; // Affiche date fichier print ''; + if ($delallowed) + { + print ''; + } + print ''; $i++; diff --git a/htdocs/includes/boxes/box_produits.php b/htdocs/includes/boxes/box_produits.php index a1a269196ba..13835dc00b1 100644 --- a/htdocs/includes/boxes/box_produits.php +++ b/htdocs/includes/boxes/box_produits.php @@ -80,7 +80,7 @@ class box_produits extends ModeleBoxes { $objp = $db->fetch_object($result); // 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.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; diff --git a/htdocs/includes/boxes/box_services_vendus.php b/htdocs/includes/boxes/box_services_vendus.php index ea77d2d0803..85511414b34 100644 --- a/htdocs/includes/boxes/box_services_vendus.php +++ b/htdocs/includes/boxes/box_services_vendus.php @@ -91,7 +91,7 @@ class box_services_vendus extends ModeleBoxes { $objp = $db->fetch_object($result); // 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.= " WHERE fk_product=".$objp->pid." AND lang='". $langs->getDefaultLang() ."'"; diff --git a/htdocs/includes/modules/commande/modules_commande.php b/htdocs/includes/modules/commande/modules_commande.php index 64358fce26b..ad3efd88530 100644 --- a/htdocs/includes/modules/commande/modules_commande.php +++ b/htdocs/includes/modules/commande/modules_commande.php @@ -133,54 +133,66 @@ class ModeleNumRefCommandes } } -function commande_pdf_create($db, $comid, $modele='') + + +/* + \brief Crée un bon de commande sur disque en fonction du modèle de COMMANDE_ADDON_PDF + \param db objet base de donnée + \param id id de la propale à créer + \param modele force le modele à utiliser ('' par defaut) + \param outputlangs objet lang a utiliser pour traduction +*/ +function commande_pdf_create($db, $id, $modele='', $outputlangs='') { - global $langs; - $langs->load("orders"); - - $dir = DOL_DOCUMENT_ROOT."/includes/modules/commande/"; - - // Positionne modele sur le nom du modele de facture à utiliser - if (! strlen($modele)) - { - if (defined("COMMANDE_ADDON_PDF") && COMMANDE_ADDON_PDF) - { - $modele = COMMANDE_ADDON_PDF; - } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_PROPALE_ADDON_PDF_NotDefined"); - return 0; - } - } - // Charge le modele - $file = "pdf_".$modele.".modules.php"; - if (file_exists($dir.$file)) - { - $classname = "pdf_".$modele; - require_once($dir.$file); - - $obj = new $classname($db); - - if ( $obj->write_pdf_file($comid) > 0) - { - // on supprime l'image correspondant au preview - commande_delete_preview($db, $comid); - return 1; - } - else - { - dolibarr_syslog("Erreur dans commande_pdf_create"); - dolibarr_print_error($db,$obj->pdferror()); - return 0; - } - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file); - return 0; - } + global $conf,$langs; + $langs->load("orders"); + + $dir = DOL_DOCUMENT_ROOT."/includes/modules/commande/"; + + // Positionne modele sur le nom du modele de facture à utiliser + if (! strlen($modele)) + { + if ($conf->global->COMMANDE_ADDON_PDF) + { + $modele = $conf->global->COMMANDE_ADDON_PDF; + } + else + { + print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_ADDON_PDF_NotDefined"); + return 0; + } + } + + // Charge le modele + $file = "pdf_".$modele.".modules.php"; + if (file_exists($dir.$file)) + { + $classname = "pdf_".$modele; + require_once($dir.$file); + + $obj = new $classname($db); + + if ( $obj->write_pdf_file($id, $outputlangs) > 0) + { + // on supprime l'image correspondant au preview + commande_delete_preview($db, $id); + return 1; + } + else + { + dolibarr_syslog("Erreur dans commande_pdf_create"); + dolibarr_print_error($db,$obj->pdferror()); + return 0; + } + } + else + { + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file); + return 0; + } } + + function commande_delete_preview($db, $propalid) { global $langs,$conf; diff --git a/htdocs/includes/modules/dons/modules_don.php b/htdocs/includes/modules/dons/modules_don.php index 1566cb242fe..0014fb64ca1 100644 --- a/htdocs/includes/modules/dons/modules_don.php +++ b/htdocs/includes/modules/dons/modules_don.php @@ -134,38 +134,55 @@ class ModeleNumRefDons /** \brief Crée un don sur disque en fonction du modèle de DON_ADDON_PDF - \param db objet base de donnée - \param donid id de la facture à créer - \param message message - \return int 0 si KO, 1 si OK + \param db objet base de donnée + \param id id du don à créer + \param message message + \param modele force le modele à utiliser ('' par defaut) + \param outputlangs objet lang a utiliser pour traduction + \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"); - define("DON_ADDON",'html_cerfafr'); + // todo forcé ici + $conf->global->DON_ADDON='html_cerfafr'; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/"; - if (defined("DON_ADDON") && DON_ADDON) - { - $file = DON_ADDON.".modules.php"; - - $classname = DON_ADDON; + // Positionne modele sur le nom du modele à utiliser + if (! strlen($modele)) + { + 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; + } + } + + // Charge le modele + $file = $modele.".modules.php"; + if (file_exists($dir.$file)) + { + $classname = $modele; require_once($dir.$file); $obj = new $classname($db); $obj->message = $message; - if ( $obj->write_file($donid) > 0) + if ( $obj->write_file($id,$outputlangs) > 0) { // Succès de la création de la facture. On génère le fichier meta - don_meta_create($db, $donid); + don_meta_create($db, $id); // et on supprime l'image correspondant au preview - don_delete_preview($db, $donid); + don_delete_preview($db, $id); return 1; } @@ -176,11 +193,11 @@ function don_create($db, $donid, $message="") return 0; } } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_DON_ADDON_PDF_NotDefined"); - return 0; - } + else + { + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file); + return 0; + } } /** diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php index 11ad1292197..2b49381157d 100644 --- a/htdocs/includes/modules/facture/modules_facture.php +++ b/htdocs/includes/modules/facture/modules_facture.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Regis Houssin * @@ -43,43 +43,45 @@ require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis ca class ModelePDFFactures extends FPDF { - var $error=''; + var $error=''; - /** - * \brief Renvoi le dernier message d'erreur de création de facture - */ - function pdferror() - { - return $this->error; - } + /** + * \brief Renvoi le dernier message d'erreur de création de facture + */ + function pdferror() + { + return $this->error; + } - /** - * \brief Renvoi la liste des modèles actifs - * \param db Handler de base - */ - function liste_modeles($db) - { - $liste=array(); - $sql =""; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $liste[$row[0]]=$row[1]; - $i++; - } - } - else - { - return -1; - } - return $liste; - } + /** + * \brief Renvoi la liste des modèles actifs + * \param db Handler de base + */ + function liste_modeles($db) + { + $liste=array(); + $sql ="SELECT value, value from ".MAIN_DB_PREFIX."const"; + $sql.=" where name='FACTURE_ADDON_PDF'"; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $row = $db->fetch_row($resql); + $liste[$row[0]]=$row[1]; + $i++; + } + } + else + { + dolibarr_print_error($db); + return -1; + } + return $liste; + } } @@ -133,52 +135,68 @@ class ModeleNumRefFactures /** - \brief Crée un facture sur disque en fonction du modèle de FACTURE_ADDON_PDF - \param db objet base de donnée - \param facid id de la facture à créer - \param message message - \return int 0 si KO, 1 si OK + \brief Crée un facture sur disque en fonction du modèle de FACTURE_ADDON_PDF + \param db objet base de donnée + \param id id de la facture à créer + \param message message + \param modele force le modele à utiliser ('' par defaut) + \param outputlangs objet lang a utiliser pour traduction + \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; - $langs->load("bills"); + global $conf,$langs; + $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) - { - $file = "pdf_".FACTURE_ADDON_PDF.".modules.php"; - - $classname = "pdf_".FACTURE_ADDON_PDF; - require_once($dir.$file); - - $obj = new $classname($db); - $obj->message = $message; - - if ( $obj->write_pdf_file($facid) > 0) + // Positionne modele sur le nom du modele à utiliser + if (! strlen($modele)) { - // Succès de la création de la facture. On génère le fichier meta - facture_meta_create($db, $facid); - - // et on supprime l'image correspondant au preview - facture_delete_preview($db, $facid); - - return 1; //TODO A MODIFIER - } - else - { - dolibarr_syslog("Erreur dans facture_pdf_create"); - dolibarr_print_error($db,$obj->pdferror()); - return 0; + 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; + } } - } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_FACTURE_ADDON_PDF_NotDefined"); - return 0; - } + // Charge le modele + $file = "pdf_".$modele.".modules.php"; + if (file_exists($dir.$file)) + { + $classname = "pdf_".$modele; + require_once($dir.$file); + + $obj = new $classname($db); + $obj->message = $message; + + if ($obj->write_pdf_file($id, $outputlangs) > 0) + { + // Succès de la création de la facture. On génère le fichier meta + facture_meta_create($db, $id); + + // et on supprime l'image correspondant au preview + facture_delete_preview($db, $id); + + return 1; + } + else + { + dolibarr_syslog("Erreur dans facture_pdf_create"); + dolibarr_print_error($db,$obj->pdferror()); + return 0; + } + + } + else + { + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file); + return 0; + } } /** diff --git a/htdocs/includes/modules/fichinter/modules_fichinter.php b/htdocs/includes/modules/fichinter/modules_fichinter.php index 9a4f64c003e..a1f7b51f36d 100644 --- a/htdocs/includes/modules/fichinter/modules_fichinter.php +++ b/htdocs/includes/modules/fichinter/modules_fichinter.php @@ -139,42 +139,57 @@ class ModeleNumRefFicheinter /** \brief Crée une fiche intervention sur disque en fonction du modèle de FICHEINTER_ADDON_PDF - \param db objet base de donnée - \param facid id de la facture à créer - \return int 0 si KO, 1 si OK + \param db objet base de donnée + \param id id de la fiche à créer + \param modele force le modele à utiliser ('' par defaut) + \param outputlangs objet lang a utiliser pour traduction + \return int 0 si KO, 1 si OK */ -function fichinter_pdf_create($db, $facid) +function fichinter_pdf_create($db, $facid, $modele='', $outputlangs) { - global $langs; - $langs->load("ficheinter"); - - $dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/"; - - if (defined("FICHEINTER_ADDON_PDF") && FICHEINTER_ADDON_PDF) - { - - $file = "pdf_".FICHEINTER_ADDON_PDF.".modules.php"; - - $classname = "pdf_".FICHEINTER_ADDON_PDF; - require_once($dir.$file); - - $obj = new $classname($db); - - if ( $obj->write_pdf_file($facid) > 0) + global $conf,$langs; + $langs->load("ficheinter"); + + $dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/"; + + // Positionne modele sur le nom du modele de facture à utiliser + if (! strlen($modele)) { - return 1; + 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; + } } - else + + // Charge le modele + $file = "pdf_".$modele.".modules.php"; + if (file_exists($dir.$file)) { - dolibarr_print_error($db,$obj->pdferror()); - return 0; + $classname = "pdf_".$modele; + require_once($dir.$file); + + $obj = new $classname($db); + + if ( $obj->write_pdf_file($id,$outputlangs) > 0) + { + return 1; + } + else + { + dolibarr_print_error($db,$obj->pdferror()); + return 0; + } + } + else + { + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file); + return 0; } - } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined"); - return 0; - } } ?> diff --git a/htdocs/includes/modules/propale/modules_propale.php b/htdocs/includes/modules/propale/modules_propale.php index aa88f0e38c1..1407164b0c1 100644 --- a/htdocs/includes/modules/propale/modules_propale.php +++ b/htdocs/includes/modules/propale/modules_propale.php @@ -132,59 +132,62 @@ class ModeleNumRefPropales /** \brief Crée une propale sur disque en fonction du modèle de PROPALE_ADDON_PDF - \param db objet base de donnée - \param facid id de la facture à créer - \param modele force le modele à utiliser ('' par defaut) + \param db objet base de donnée + \param id id de la propale à créer + \param modele force le modele à 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; - $langs->load("propale"); - - $dir = DOL_DOCUMENT_ROOT."/includes/modules/propale/"; + global $langs; + $langs->load("propale"); - // Positionne modele sur le nom du modele de facture à utiliser - if (! strlen($modele)) - { - if (defined("PROPALE_ADDON_PDF") && PROPALE_ADDON_PDF) - { - $modele = PROPALE_ADDON_PDF; - } - else - { - print $langs->trans("Error")." ".$langs->trans("Error_PROPALE_ADDON_PDF_NotDefined"); - return 0; - } - } + $dir = DOL_DOCUMENT_ROOT."/includes/modules/propale/"; - // Charge le modele - $file = "pdf_propale_".$modele.".modules.php"; - if (file_exists($dir.$file)) - { - $classname = "pdf_propale_".$modele; - require_once($dir.$file); - - $obj = new $classname($db); + // Positionne modele sur le nom du modele de facture à utiliser + if (! strlen($modele)) + { + if ($conf->global->PROPALE_ADDON_PDF) + { + $modele = $conf->global->PROPALE_ADDON_PDF; + } + else + { + print $langs->trans("Error")." ".$langs->trans("Error_PROPALE_ADDON_PDF_NotDefined"); + return 0; + } + } - if ( $obj->write_pdf_file($facid) > 0) + // Charge le modele + $file = "pdf_propale_".$modele.".modules.php"; + if (file_exists($dir.$file)) { - // on supprime l'image correspondant au preview - propale_delete_preview($db, $facid); - return 1; + $classname = "pdf_propale_".$modele; + require_once($dir.$file); + + $obj = new $classname($db); + + if ( $obj->write_pdf_file($id, $outputlangs) > 0) + { + // on supprime l'image correspondant au preview + propale_delete_preview($db, $id); + return 1; + } + else + { + dolibarr_syslog("Erreur dans propale_pdf_create"); + dolibarr_print_error($db,$obj->pdferror()); + return 0; + } } - else + else { - dolibarr_syslog("Erreur dans propale_pdf_create"); - dolibarr_print_error($db,$obj->pdferror()); - return 0; + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file); + return 0; } - } - else - { - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file); - return 0; - } } + /** \brief Supprime l'image de prévisualitation, pour le cas de régénération de propal \param db objet base de donnée diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 30af3aae0e4..2c4853f1b32 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -301,6 +301,7 @@ DefaultMaxSizeList=Default max length for list MessageOfDay=Message of day PermanentLeftSearchForm=Permanent search form on left menu DefaultLanguage=Default language to use (language code) +EnableMultilangInterface=Enable multi-langual interface SystemSuccessfulyUpdated=Your sustem has been updated successfully CompanyInfo=Company/foundation informations CompanyIds=Company/foundation identities diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 59186112a80..dcf5bb82d5c 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -300,6 +300,7 @@ MaxSizeList=Longueur maximale des listes DefaultMaxSizeList=Longueur maximale par défaut des listes MessageOfDay=Message du jour DefaultLanguage=Langue par défaut à utiliser (code langue) +EnableMultilangInterface=Activer l'interface multi-langage PermanentLeftSearchForm=Zone de recherche permanente du menu de gauche SystemSuccessfulyUpdated=Votre système a été correctement mis à jour CompanyInfo=Informations sur la société/association diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a240675cc71..d8177d4f0a1 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -161,9 +161,9 @@ if ($user->admin) * 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)) { diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 7e36faf67d4..303ad8e495b 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -384,8 +384,8 @@ else { } // $conf->liste_limit = constante de taille maximale des listes -if (! $conf->global->SIZE_LISTE_LIMIT) $conf->global->SIZE_LISTE_LIMIT=20; -$conf->liste_limit=$conf->global->SIZE_LISTE_LIMIT; +if (! $conf->global->MAIN_SIZE_LISTE_LIMIT) $conf->global->MAIN_SIZE_LISTE_LIMIT=20; +$conf->liste_limit=$conf->global->MAIN_SIZE_LISTE_LIMIT; // $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; diff --git a/htdocs/product.class.php b/htdocs/product.class.php index df65b83940a..8ece005e588 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -225,7 +225,7 @@ class Product if ( $this->db->query($sql) ) { // Multilangs - if($conf->global->PRODUIT_MULTILANGS == 1) + if($conf->global->MAIN_MULTILANGS) if ( $this->setMultiLangs() < 0) { $this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql; @@ -679,7 +679,7 @@ class Product $this->db->free(); // multilangs - if( $conf->global->PRODUIT_MULTILANGS == 1 ) $this->getMultiLangs(); + if( $conf->global->MAIN_MULTILANGS) $this->getMultiLangs(); // multiprix diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php index 62b1debeb22..e0ca3a2aab9 100644 --- a/htdocs/product/barcode.php +++ b/htdocs/product/barcode.php @@ -102,7 +102,7 @@ if($product->type == 0) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/categorie.php b/htdocs/product/categorie.php index eb132648d05..4ca7f88035a 100644 --- a/htdocs/product/categorie.php +++ b/htdocs/product/categorie.php @@ -129,7 +129,7 @@ if ($_GET["id"] || $_GET["ref"]) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 11068633c29..5f9fd900e51 100755 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -145,7 +145,7 @@ if ($product->id) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index fc30b4aba03..d129293d7f6 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -457,7 +457,7 @@ if ($_GET["id"] || $_GET["ref"]) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 6a7367b774a..4756c2d61dc 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -212,7 +212,7 @@ if ($_GET["id"] || $_GET["ref"]) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index e4427190861..47881c9cc61 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -141,7 +141,7 @@ if ($result) $objp = $db->fetch_object($result); //Multilangs - if ($conf->global->PRODUIT_MULTILANGS == 1) + if ($conf->global->MAIN_MULTILANGS) { $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 3a762825117..be7fb6cb44a 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -225,7 +225,7 @@ if ($resql) $objp = $db->fetch_object($resql); // 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.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index fc7eea29e34..9693417cd9c 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -141,7 +141,7 @@ if ($_GET["id"] || $_GET["ref"]) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index aced7fc0c7d..58094b92b56 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -85,7 +85,7 @@ if ($result) $objp = $db->fetch_object($result); // 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.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3ac6162b200..f174be8d4e6 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -142,7 +142,7 @@ if($product->type == 0) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/sousproduits/fiche.php b/htdocs/product/sousproduits/fiche.php index f14fd4ba348..598f5900072 100644 --- a/htdocs/product/sousproduits/fiche.php +++ b/htdocs/product/sousproduits/fiche.php @@ -199,7 +199,7 @@ if ($id || $ref) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index edc29b43c80..17903b6d78c 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -121,7 +121,7 @@ if ($_GET["id"] || $_GET["ref"]) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index bb8ec3bfee2..9357a5a35a5 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -169,7 +169,7 @@ if ($_GET["id"] || $_GET["ref"]) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 2dea1d28934..ccb5be36969 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -290,7 +290,7 @@ else $objp = $db->fetch_object($resql); // 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.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index ffb5825eb27..7abaebf765f 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -154,7 +154,7 @@ if ($_GET["id"] || $_GET["ref"]) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 2f6a45a6139..a7e97c0fbdd 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -179,7 +179,7 @@ if($product->type == 0) } // 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][1] = $langs->trans("Translation"); diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index d3baddb5d36..0b26b4d5319 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -69,8 +69,8 @@ if ($_POST["action"] == 'update') $tabparam["MAIN_MENU_BARRETOP"]=$_POST["main_menu_barretop"]; $tabparam["MAIN_MENU_BARRELEFT"]=$_POST["main_menu_barreleft"]; - if ($_POST["check_SIZE_LISTE_LIMIT"]=="on") $tabparam["SIZE_LISTE_LIMIT"]=$_POST["size_liste_limit"]; - else $tabparam["SIZE_LISTE_LIMIT"]=''; + if ($_POST["check_SIZE_LISTE_LIMIT"]=="on") $tabparam["MAIN_SIZE_LISTE_LIMIT"]=$_POST["main_size_liste_limit"]; + else $tabparam["MAIN_SIZE_LISTE_LIMIT"]=''; if ($_POST["check_MAIN_THEME"]=="on") $tabparam["MAIN_THEME"]=$_POST["main_theme"]; else $tabparam["MAIN_THEME"]=''; @@ -157,9 +157,9 @@ if ($_GET["action"] == 'edit') // Taille max des listes $var=!$var; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print '
'.$langs->trans('Model').''; + print '
'.$langs->trans('Model').''; $this->select_array('model',$modellist,$modelselected,0,0,1); $texte=$langs->trans('Generate'); - print ''; + print ''; + $this->select_lang($langs->getDefaultLang()); + print ''; + print ''; print '
'.$mimetype.''.$file.''.$file.''; + print ''.filesize($filedir."/".$file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).''.img_delete().'
'.$langs->trans("MaxSizeList").''.$conf->global->SIZE_LISTE_LIMIT.'conf->SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").'
'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'conf->MAIN_SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").'

'; @@ -192,9 +192,9 @@ else $var=!$var; print ''.$langs->trans("MaxSizeList").''; - print ''.$conf->global->SIZE_LISTE_LIMIT.''; - print 'conf->SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").''; - print '' . $fuser->conf->SIZE_LISTE_LIMIT . ''; + print ''.$conf->global->MAIN_SIZE_LISTE_LIMIT.''; + print 'conf->MAIN_SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").''; + print '' . $fuser->conf->MAIN_SIZE_LISTE_LIMIT . ''; print '
';