From 0056facfd270a5ac38914eb64d4c39d938592a4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Feb 2009 15:09:59 +0000 Subject: [PATCH] Clean a lot of code --- .settings/org.eclipse.core.resources.prefs | 10 +- dev/skeletons/modMyModule.class.php | 53 +++--- htdocs/admin/modules.php | 30 +-- ...p => pdf_courrier_droit_editeur.class.php} | 0 htdocs/docs/document.class.php | 46 ++--- htdocs/docs/generate.php | 71 ++++---- htdocs/docs/index.php | 16 +- htdocs/docs/pre.inc.php | 171 +++++++++--------- .../modules/DolibarrModules.class.php | 55 ------ .../includes/modules/modCategorie.class.php | 40 ++-- htdocs/includes/modules/modDocument.class.php | 6 +- .../includes/modules/modDroitPret.class.php | 19 +- htdocs/includes/modules/modEditeur.class.php | 30 ++- htdocs/includes/modules/modEnergie.class.php | 4 +- htdocs/includes/modules/modMailing.class.php | 4 +- .../includes/modules/modTelephonie.class.php | 4 +- htdocs/langs/en_US/admin.lang | 7 +- htdocs/langs/fr_FR/admin.lang | 7 +- htdocs/pre.inc.php | 2 +- htdocs/product/canvas/livre/liste.tpl | 4 +- htdocs/product/canvas/livre/livre-create.tpl | 14 +- htdocs/product/canvas/livre/livre-edit.tpl | 12 +- htdocs/product/canvas/livre/livre-view.tpl | 8 +- .../canvas/livrecontrat/livrecontrat-edit.tpl | 6 +- .../canvas/livrecontrat/livrecontrat-view.tpl | 8 +- .../livrecouverture/livrecouverture-edit.tpl | 6 +- .../livrecouverture/livrecouverture-view.tpl | 4 +- 27 files changed, 283 insertions(+), 354 deletions(-) rename htdocs/docs/class/{courrier-droit-editeur.class.php => pdf_courrier_droit_editeur.class.php} (100%) diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index 485e31cc11b..d44b01c21b4 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -1,4 +1,4 @@ -#Fri Jan 23 00:49:24 CET 2009 +#Wed Feb 11 15:08:12 CET 2009 eclipse.preferences.version=1 encoding//dev/initdemo/initdemo.sql=UTF-8 encoding//dev/skeletons/modMyModule.class.php=ISO-8859-1 @@ -614,6 +614,14 @@ encoding//htdocs/lib/product.lib.php=ISO-8859-1 encoding//htdocs/main.inc.php=ISO-8859-1 encoding//htdocs/master.inc.php=ISO-8859-1 encoding//htdocs/paiement.class.php=ISO-8859-1 +encoding//htdocs/product/canvas/livre/liste.tpl=UTF-8 +encoding//htdocs/product/canvas/livre/livre-create.tpl=UTF-8 +encoding//htdocs/product/canvas/livre/livre-edit.tpl=UTF-8 +encoding//htdocs/product/canvas/livre/livre-view.tpl=UTF-8 +encoding//htdocs/product/canvas/livrecontrat/livrecontrat-edit.tpl=UTF-8 +encoding//htdocs/product/canvas/livrecontrat/livrecontrat-view.tpl=UTF-8 +encoding//htdocs/product/canvas/livrecouverture/livrecouverture-edit.tpl=UTF-8 +encoding//htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl=UTF-8 encoding//htdocs/product/fiche.php=ISO-8859-1 encoding//htdocs/product/reassort.php=ISO-8859-1 encoding//htdocs/product/stats/fiche.php=ISO-8859-1 diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index a3080a63f93..705a17e01a4 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -43,60 +43,61 @@ class modMyModule extends DolibarrModules function modMyModule($DB) { $this->db = $DB; - + // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). $this->numero = 10000; // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'mymodule'; - + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' - // It is used to group modules in module setup page - $this->family = "other"; + // It is used to group modules in module setup page + $this->family = "other"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = eregi_replace('^mod','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Description of module MyModule"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.0'; + $this->version = '1.0'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=other) $this->special = 0; // Name of png file (without png) used for this module. - // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. + // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. $this->picto='generic'; - + // Data directories to create when module is enabled. $this->dirs = array(); //$this->dirs[0] = DOL_DATA_ROOT.'/mymodule; //$this->dirs[1] = DOL_DATA_ROOT.'/mymodule/temp; - + // Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'. $this->style_sheet = ''; // Config pages. Put here list of php page names stored in admmin directory used to setup module. $this->config_page_url = array("mymodulesetuppage.php"); - + // Dependencies $this->depends = array(); // List of modules id that must be enabled if this module is enabled $this->requiredby = array(); // List of modules id to disable if this one is disabled $this->phpmin = array(4,1); // Minimum version of PHP required by module $this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module $this->langfiles = array("mymodule"); - + // Constants $this->const = array(); // List of particular constants to add when module is enabled - - + //Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0), + // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) ); + // New pages on tabs $this->tabs = array('entity:Title:@mymodule:/mymodule/mynewtab.php?id=__ID__'); - - + + // Boxes - $this->boxes = array(); // List of boxes + $this->boxes = array(); // List of boxes $r=0; - + // Add here list of php file(s) stored in includes/boxes that contains class to show a box. // Example: //$this->boxes[$r][1] = "myboxa.php"; @@ -104,11 +105,11 @@ class modMyModule extends DolibarrModules //$this->boxes[$r][1] = "myboxb.php"; //$r++; - + // Permissions $this->rights = array(); // Permission array used by this module $r=0; - + // Add here list of permission defined by an id, a label, a boolean and two constant strings. // Example: // $this->rights[$r][0] = 2000; // Permission id (must not be already used) @@ -118,11 +119,11 @@ class modMyModule extends DolibarrModules // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $r++; - + // Main menu entries $this->menus = array(); // List of menus to add $r=0; - + // Add here entries to declare new menus // Example to declare the Top Menu entry: // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu @@ -163,11 +164,11 @@ class modMyModule extends DolibarrModules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; - - + + // Exports $r=1; - + // Example: // $this->export_code[$r]=$this->rights_class.'_'.$r; // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) @@ -191,9 +192,9 @@ class modMyModule extends DolibarrModules function init() { $sql = array(); - + $result=$this->load_tables(); - + return $this->_init($sql); } @@ -210,7 +211,7 @@ class modMyModule extends DolibarrModules return $this->_remove($sql); } - + /** * \brief Create tables and keys required by module * Files mymodule.sql and mymodule.key.sql with create table and create keys diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index c4e89d7f51e..367e571bd39 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -263,10 +263,10 @@ asort($orders); // Affichage debut page -if ($mode==0) print $langs->trans("ModulesDesc")."
\n"; -if ($mode==1) print $langs->trans("ModulesInterfaceDesc")."
\n"; -if ($mode==2) print $langs->trans("ModulesSpecialDesc")."
\n"; -if ($mode==3) print $langs->trans("ModulesJobDesc")."
\n"; +if ($mode==0) { $tagmode = 'common'; print $langs->trans("ModulesDesc")."
\n"; } +if ($mode==2) { $tagmode = 'other'; print $langs->trans("ModulesSpecialDesc")."
\n"; } +if ($mode==1) { $tagmode = 'interfaces'; print $langs->trans("ModulesInterfaceDesc")."
\n"; } +if ($mode==3) { $tagmode = 'functional'; print $langs->trans("ModulesJobDesc")."
\n"; } print "
\n"; @@ -281,15 +281,6 @@ if (! empty($categ[$categidx])) $h++; } -$categidx=1; -if (! empty($categ[$categidx])) -{ - $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; - $head[$h][1] = $langs->trans("ModulesInterfaces"); - $head[$h][2] = 'interfaces'; - $h++; -} - $categidx=2; if (! empty($categ[$categidx])) { @@ -299,16 +290,25 @@ if (! empty($categ[$categidx])) $h++; } +$categidx=1; +if (! empty($categ[$categidx])) +{ + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; + $head[$h][1] = $langs->trans("ModulesInterfaces"); + $head[$h][2] = 'interfaces'; + $h++; +} + $categidx=3; if (! empty($categ[$categidx])) { $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; - $head[$h][1] = $langs->trans("ModulesJob"); + $head[$h][1] = $langs->trans("ModulesSpecial"); $head[$h][2] = 'functional'; $h++; } -dolibarr_fiche_head($head, $mode, $langs->trans("Modules")); +dolibarr_fiche_head($head, $tagmode, $langs->trans("Modules")); if ($mesg) print '
'.$mesg.'
'; diff --git a/htdocs/docs/class/courrier-droit-editeur.class.php b/htdocs/docs/class/pdf_courrier_droit_editeur.class.php similarity index 100% rename from htdocs/docs/class/courrier-droit-editeur.class.php rename to htdocs/docs/class/pdf_courrier_droit_editeur.class.php diff --git a/htdocs/docs/document.class.php b/htdocs/docs/document.class.php index cb5d8bff8b1..245eae29f85 100644 --- a/htdocs/docs/document.class.php +++ b/htdocs/docs/document.class.php @@ -37,7 +37,9 @@ class Document { $this->db = $db; } - + + + /** \brief Génère le document \return int 0= ok, <> 0 = ko @@ -46,31 +48,11 @@ class Document { $errno = 0; - dolibarr_syslog("Document::Generate id=$id", LOG_DEBUG ); + dolibarr_syslog("Document::Generate id=$id", LOG_DEBUG ); $this->id = $id; - - // On récupère données du mail - $sql = "SELECT classfile,class"; - $sql .= " FROM ".MAIN_DB_PREFIX."document_generator"; - $sql .= " WHERE rowid = '".$this->id."';"; - - $resql=$this->db->query($sql); - if ($resql) - { - while ($obj = $this->db->fetch_object($resql) ) - { - $class = $obj->class; - $classfile = $obj->classfile; - } - $this->db->free($resql); - } - else - { - print $this->db->error(); - print "$sql\n"; - } - - + $class = $id; + $classfile = 'docs/class/'.$class.'.class.php'; + require DOL_DOCUMENT_ROOT.'/'.$classfile; $obj = new $class($this->db); @@ -78,19 +60,19 @@ class Document $sql = "DELETE FROM ".MAIN_DB_PREFIX."document"; $sql.= " WHERE name='".$obj->name."';"; - + $resql=$this->db->query($sql); - + $sql = "INSERT INTO ".MAIN_DB_PREFIX."document"; $sql.= " (name,file_name,file_extension,date_generation) VALUES"; $sql.= " ('".$obj->name."','".$obj->file."','".$obj->extension."',".$this->db->idate(mktime()).")"; - + $resql=$this->db->query($sql); - + $id = $this->db->last_insert_id(MAIN_DB_PREFIX."document"); - + $err = $obj->Generate($id); - + if ($err === 0) { $this->db->commit(); @@ -101,7 +83,7 @@ class Document $this->db->rollback(); dolibarr_syslog("Document::Generate ROLLBACK", LOG_ERR ); } - + return $errno; } diff --git a/htdocs/docs/generate.php b/htdocs/docs/generate.php index 060824be377..0e0394422a5 100644 --- a/htdocs/docs/generate.php +++ b/htdocs/docs/generate.php @@ -14,39 +14,44 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** - \file htdocs/docs/index.php - \ingroup document - \brief Page d'accueil module document - \version $Revision$ -*/ + \file htdocs/docs/index.php + \ingroup document + \brief Page d'accueil module document + \version $Id$ + */ require("./pre.inc.php"); + + /* - * Affichage page configuration module societe - * + * Actions */ -if ($_GET["id"] > 0) +if ($_GET["id"]) { - require_once(DOL_DOCUMENT_ROOT.'/docs/document.class.php'); - $doc = new Document($db); - if ($doc->Generate($_GET["id"]) == 0) - { - Header("Location: index.php"); - } + require_once(DOL_DOCUMENT_ROOT.'/docs/document.class.php'); + $doc = new Document($db); + if ($doc->Generate($_GET["id"]) == 0) + { + Header("Location: index.php"); + exit; + } + } + +/* + * View + */ + llxHeader(); -print_titre($langs->trans("Documents")); +print_titre($langs->trans("DocumentsBuilder")); print "\n"; print "\n"; @@ -54,30 +59,18 @@ print ' '; print ' '; print "\n"; -$sql = "SELECT dg.rowid,dg.name, dg.classfile, dg.class"; -$sql.= " FROM ".MAIN_DB_PREFIX."document_generator as dg"; -$sql.= " ORDER BY dg.name ASC;"; +// TODO: Scan class that are in docs/class directory to find generator availables +$listofmodules=array('pdf_courrier_droit_editeur'); -$resql = $db->query($sql); -if ($resql) +$var=true; +foreach ($listofmodules as $val) { - $var=True; - while ($obj = $db->fetch_object($resql) ) - { - - $var=!$var; - - print ""; - print ''; - print ''; - print "\n"; - } + $var=!$var; - $db->free($resql); -} -else -{ - dolibarr_print_error($db); + print ""; + print ''; + print ''; + print "\n"; } diff --git a/htdocs/docs/index.php b/htdocs/docs/index.php index bf60328eb74..9ef4fe14fc3 100644 --- a/htdocs/docs/index.php +++ b/htdocs/docs/index.php @@ -14,27 +14,25 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/docs/index.php \ingroup document \brief Page d'accueil module document - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); + /* - * Affichage page configuration module societe - * + * View */ + llxHeader(); -print_titre($langs->trans("Documents")); +print_titre($langs->trans("DocumentsBuilder")); print "
'.$langs->trans("Name").''.$langs->trans("Description").'
'.stripslashes($obj->name).' 
'.$val.' 
\n"; print "\n"; @@ -52,9 +50,9 @@ if ($resql) { $var=True; while ($obj = $db->fetch_object($resql) ) - { + { $var=!$var; - + print ""; print ' - - + diff --git a/htdocs/product/canvas/livre/livre-create.tpl b/htdocs/product/canvas/livre/livre-create.tpl index 8255bc1a9b6..2c3407eff71 100644 --- a/htdocs/product/canvas/livre/livre-create.tpl +++ b/htdocs/product/canvas/livre/livre-create.tpl @@ -35,7 +35,7 @@
'; $loc = get_exdir($obj->rowid).$obj->rowid.".pdf"; diff --git a/htdocs/docs/pre.inc.php b/htdocs/docs/pre.inc.php index 6e9b85bec6b..147f4c5602e 100644 --- a/htdocs/docs/pre.inc.php +++ b/htdocs/docs/pre.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007 Rodolphe Quiedeville * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,98 +19,101 @@ */ /** - \file htdocs/pre.inc.php - \brief Fichier gestionnaire du menu de gauche de l'accueil - \version $Source$ -*/ + * \file htdocs/docs/pre.inc.php + * \brief Fichier gestionnaire du menu de gauche de l'accueil + * \version $Source$ + */ require ("../main.inc.php"); -function llxHeader($head = "") -{ - global $user, $conf, $langs; +require_once("../main.inc.php"); - top_menu($head); - - $menu = new Menu(); - - if ($conf->societe->enabled && $user->rights->societe->lire) - { - $langs->load("companies"); - $menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies")); - - if(is_dir("societe/groupe")) - { + +function llxHeader($head = "", $title="", $help_url='') +{ + global $user, $conf, $langs; + + top_menu($head); + + $menu = new Menu(); + + if ($conf->societe->enabled && $user->rights->societe->lire) + { + $langs->load("companies"); + $menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies")); + + if(is_dir("societe/groupe")) + { $menu->add_submenu(DOL_URL_ROOT."/societe/groupe/index.php", $langs->trans("MenuSocGroup")); - } - $menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts")); - } - - if ($conf->commercial->enabled && $user->rights->commercial->lire) - { - $langs->load("commercial"); - $menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial")); - - $menu->add_submenu(DOL_URL_ROOT."/comm/clients.php",$langs->trans("Customers")); - $menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php",$langs->trans("Prospects")); - - if ($user->rights->propale->lire) - { + } + $menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts")); + } + + if ($conf->commercial->enabled && $user->rights->commercial->lire) + { + $langs->load("commercial"); + $menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial")); + + $menu->add_submenu(DOL_URL_ROOT."/comm/clients.php",$langs->trans("Customers")); + $menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php",$langs->trans("Prospects")); + + if ($user->rights->propale->lire) + { $langs->load("propal"); $menu->add_submenu(DOL_URL_ROOT."/comm/propal.php", $langs->trans("Prop")); - } - } - - if ($conf->compta->enabled || $conf->comptaexpert->enabled) - { - $langs->load("compta"); - $menu->add(DOL_URL_ROOT."/compta/index.php", $langs->trans("MenuFinancial")); - - if ($user->rights->facture->lire) { - $langs->load("bills"); - $menu->add_submenu(DOL_URL_ROOT."/compta/facture.php", $langs->trans("Bills")); - } - } - - if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) - { - $langs->trans("interventions"); - $menu->add(DOL_URL_ROOT."/fichinter/index.php", $langs->trans("Interventions")); - } - - if (($conf->produit->enabled || $conf->service->enabled) && $user->rights->produit->lire) - { - $langs->load("products"); - $chaine=""; - if ($conf->produit->enabled) { $chaine.= $langs->trans("Products"); } - if ($conf->produit->enabled && $conf->service->enabled) { $chaine.="/"; } - if ($conf->service->enabled) { $chaine.= $langs->trans("Services"); } - $menu->add(DOL_URL_ROOT."/product/index.php", "$chaine"); - - } + } + } + + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { + $langs->load("compta"); + $menu->add(DOL_URL_ROOT."/compta/index.php", $langs->trans("MenuFinancial")); + + if ($user->rights->facture->lire) { + $langs->load("bills"); + $menu->add_submenu(DOL_URL_ROOT."/compta/facture.php", $langs->trans("Bills")); + } + } + + if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) + { + $langs->trans("interventions"); + $menu->add(DOL_URL_ROOT."/fichinter/index.php", $langs->trans("Interventions")); + } + + if (($conf->produit->enabled || $conf->service->enabled) && $user->rights->produit->lire) + { + $langs->load("products"); + $chaine=""; + if ($conf->produit->enabled) { $chaine.= $langs->trans("Products"); } + if ($conf->produit->enabled && $conf->service->enabled) { $chaine.="/"; } + if ($conf->service->enabled) { $chaine.= $langs->trans("Services"); } + $menu->add(DOL_URL_ROOT."/product/index.php", "$chaine"); + + } - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $langs->load("orders"); - $menu->add(DOL_URL_ROOT."/commande/index.php", $langs->trans("Orders")); - } - - if ($conf->document->enabled) - { - $menu->add(DOL_URL_ROOT."/docs/index.php", $langs->trans("Documents")); - $menu->add_submenu(DOL_URL_ROOT."/docs/generate.php", $langs->trans("Génération")); - } - - - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) - { - $langs->load("suppliers"); - $menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers")); - } - + if ($conf->commande->enabled && $user->rights->commande->lire) + { + $langs->load("orders"); + $menu->add(DOL_URL_ROOT."/commande/index.php", $langs->trans("Orders")); + } - - left_menu($menu->liste); + if ($conf->document->enabled) + { + $menu->add(DOL_URL_ROOT."/docs/index.php", $langs->trans("DocumentsBuilder")); + $menu->add_submenu(DOL_URL_ROOT."/docs/generate.php", $langs->trans("Build")); + } + + + if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) + { + $langs->load("suppliers"); + $menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers")); + } + + + + left_menu($menu->liste); } ?> diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index 98e404438f8..aa22c6aa050 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -118,27 +118,6 @@ class DolibarrModules } } - // Cree les documents generables - if (is_array($this->docs)) - { - foreach ($this->docs as $key => $doc) - { - if (! $err) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_generator (rowid,name,classfile,class) VALUES "; - $sql .= "(".$doc[0].",'".addslashes($doc[1])."','".$doc[2]."','".$doc[3]."');"; - - $result=$this->db->query($sql); - if (! $result) - { - $this->error=$this->db->error(); - dolibarr_syslog("DolibarrModules::_init Error sql=".$sql." - ".$this->error, LOG_ERR); - $err++; - } - } - } - } - // Cree les repertoires if (is_array($this->dirs)) { @@ -198,9 +177,6 @@ class DolibarrModules // Supprime les menus apportes par le module $err+=$this->delete_menus(); - // Supprime les documents generables - $err+=$this->delete_docs(); - // Execute les requetes sql complementaires for ($i = 0 ; $i < sizeof($array_sql) ; $i++) { @@ -535,37 +511,6 @@ class DolibarrModules } - - /** - * \brief Supprime les documents - * \return int Nombre d'erreurs (0 si ok) - */ - function delete_docs() - { - $err=0; - - // Supprime les documents generables - if (is_array($this->docs)) - { - foreach ($this->docs as $key => $doc) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_generator "; - $sql .= "WHERE name= '".addslashes($doc[0])."' AND classfile='".$doc[1]."'AND class='".$doc[2]."';"; - - dolibarr_syslog("DolibarrModules::delete_docs sql=".$sql); - $result=$this->db->query($sql); - if (! $result) - { - dolibarr_syslog("DolibarrModules::delete_docs Error sql=".$sql." - ".$this->db->error()); - $err++; - } - - } - } - return $err; - } - - /** * \brief Supprime les boites * \return int Nombre d'erreurs (0 si ok) diff --git a/htdocs/includes/modules/modCategorie.class.php b/htdocs/includes/modules/modCategorie.class.php index e303c496a29..5e83c7308e9 100644 --- a/htdocs/includes/modules/modCategorie.class.php +++ b/htdocs/includes/modules/modCategorie.class.php @@ -45,69 +45,69 @@ class modCategorie extends DolibarrModules { $this->db = $DB; $this->numero = 1780; - + $this->family = "technic"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = eregi_replace('^mod','',get_class($this)); $this->description = "Gestion des catégories (produits, clients, fournisseurs...)"; - + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; - + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 0; + $this->special = 2; $this->picto = 'generic'; - + // Dir $this->dirs = array(); - + // Dependencies $this->depends = array("modProduit"); - + // Config pages $this->config_page_url = array(); $this->langfiles = array("products","companies","categories"); - + // Constantes $this->const = array(); - + // Boxes $this->boxes = array(); - + // Permissions $this->rights = array(); $this->rights_class = 'categorie'; - + $r=0; - + $this->rights[$r][0] = 241; // id de la permission $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour) $this->rights[$r][3] = 1; // La permission est-elle une permission par défaut $this->rights[$r][4] = 'lire'; $r++; - + $this->rights[$r][0] = 242; // id de la permission $this->rights[$r][1] = 'Creer/modifier les categories'; // libelle de la permission $this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut $this->rights[$r][4] = 'creer'; $r++; - + $this->rights[$r][0] = 243; // id de la permission $this->rights[$r][1] = 'Supprimer les categories'; // libelle de la permission $this->rights[$r][2] = 'd'; // type de la permission (déprécié à ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut $this->rights[$r][4] = 'supprimer'; $r++; - + $this->rights[$r][0] = 244; // id de la permission $this->rights[$r][1] = 'Voir le contenu des categories cachees'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour) $this->rights[$r][3] = 1; // La permission est-elle une permission par défaut $this->rights[$r][4] = 'voir'; $r++; - + // Exports //-------- $r=0; @@ -135,7 +135,7 @@ class modCategorie extends DolibarrModules $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_societe as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON s.fk_pays = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_societe = s.rowid'; $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories - + $r++; $this->export_code[$r]='category_'.$r; $this->export_label[$r]='List of products categories'; @@ -158,9 +158,9 @@ class modCategorie extends DolibarrModules { // Permissions $this->remove(); - + $sql = array(); - + return $this->_init($sql); } @@ -171,7 +171,7 @@ class modCategorie extends DolibarrModules function remove() { $sql = array(); - + return $this->_remove($sql); } diff --git a/htdocs/includes/modules/modDocument.class.php b/htdocs/includes/modules/modDocument.class.php index e439c94d4d1..e17cb142a52 100644 --- a/htdocs/includes/modules/modDocument.class.php +++ b/htdocs/includes/modules/modDocument.class.php @@ -51,12 +51,12 @@ class modDocument extends DolibarrModules $this->family = "other"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = eregi_replace('^mod','',get_class($this)); - $this->description = "Gestion des documents"; + $this->description = "Genération de courriers/publipostages"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'development'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; + $this->special = 3; $this->picto='dir'; // Dir @@ -68,7 +68,7 @@ class modDocument extends DolibarrModules // D�pendances $this->depends = array(); - $this->requiredby = array(); + $this->requiredby = array("modEditeur"); $this->conflictwith = array(); $this->langfiles = array("orders","bills","companies"); diff --git a/htdocs/includes/modules/modDroitPret.class.php b/htdocs/includes/modules/modDroitPret.class.php index d2db1931e2d..c9f0117e514 100644 --- a/htdocs/includes/modules/modDroitPret.class.php +++ b/htdocs/includes/modules/modDroitPret.class.php @@ -52,22 +52,31 @@ class modDroitPret extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = eregi_replace('^mod','',get_class($this)); $this->description = "Gestion du droit de prets"; - $this->version = 'experimental'; // 'development' or 'experimental' or 'dolibarr' or version + $this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; + $this->special = 3; // Dir - $this->dirs = array(); + global $dolibarr_smarty_compile; + global $dolibarr_smarty_cache; + $this->dirs = array($dolibarr_smarty_compile, + $dolibarr_smarty_cache); - // D�pendances + // Dependances $this->depends = array(); $this->requiredby = array(); + $this->conflictwith = array(); + $this->needleftmenu = array(); + $this->needtotopmenu = array(); + $this->langfiles = array("orders","bills","companies"); // Config pages $this->config_page_url = array("droitpret.php"); // Constantes - $this->const = array(); + $this->const=array(0=>array('PRODUCT_CANVAS_ABILITY','chaine',1,'This is a constant',1), + 1=>array('MAIN_NEED_SMARTY','chaine',1,'Need smarty',0) + ); // Boxes $this->boxes = array(); diff --git a/htdocs/includes/modules/modEditeur.class.php b/htdocs/includes/modules/modEditeur.class.php index 314c8f9d32e..b15bb77bc34 100644 --- a/htdocs/includes/modules/modEditeur.class.php +++ b/htdocs/includes/modules/modEditeur.class.php @@ -53,43 +53,37 @@ class modEditeur extends DolibarrModules $this->name = eregi_replace('^mod','',get_class($this)); $this->description = "Gestion des editeurs"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'dolibarr'; - + $this->version = 'development'; + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 3; $this->picto='book'; // Dir - $this->dirs = array(); + global $dolibarr_smarty_compile; + global $dolibarr_smarty_cache; + $this->dirs = array($dolibarr_smarty_compile, + $dolibarr_smarty_cache); // Config pages $this->config_page_url = array("editeur.php"); - // D�pendances - $this->depends = array(); + // Dependances + $this->depends = array("modDocument"); $this->requiredby = array(); $this->conflictwith = array(); - $this->needleftmenu = array('default.php'); + $this->needleftmenu = array('rodolphe.php'); $this->needtotopmenu = array(); $this->langfiles = array("orders","bills","companies"); // Constantes - - $this->const = array(); + $this->const=array(); // Boites $this->boxes = array(); - // Documents - $this->docs = array(); - $this->docs[0][0] = 1; - $this->docs[0][1] = 'Courrier des droits'; - $this->docs[0][2] = 'docs/class/courrier-droit-editeur.class.php'; - $this->docs[0][3] = 'pdf_courrier_droit_editeur'; - // Permissions $this->rights = array(); - } @@ -101,8 +95,6 @@ class modEditeur extends DolibarrModules { global $conf; - $sql = array(); - return $this->_init($sql); } @@ -113,7 +105,7 @@ class modEditeur extends DolibarrModules */ function remove() { - $sql = array(); + global $conf; return $this->_remove($sql); } diff --git a/htdocs/includes/modules/modEnergie.class.php b/htdocs/includes/modules/modEnergie.class.php index cee70b502d8..4ccfa87c1bd 100644 --- a/htdocs/includes/modules/modEnergie.class.php +++ b/htdocs/includes/modules/modEnergie.class.php @@ -57,9 +57,9 @@ class modEnergie extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; - + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; + $this->special = 3; $this->picto='energie'; // Dir diff --git a/htdocs/includes/modules/modMailing.class.php b/htdocs/includes/modules/modMailing.class.php index f3bb20f7a09..10592c47235 100644 --- a/htdocs/includes/modules/modMailing.class.php +++ b/htdocs/includes/modules/modMailing.class.php @@ -54,7 +54,7 @@ class modMailing extends DolibarrModules $this->description = "Gestion des EMailings"; $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 1; + $this->special = 0; $this->picto='email'; // Dir @@ -113,7 +113,7 @@ class modMailing extends DolibarrModules { // Permissions $this->remove(); - + return $this->_init($sql); } diff --git a/htdocs/includes/modules/modTelephonie.class.php b/htdocs/includes/modules/modTelephonie.class.php index 093b905bbd8..c47c7087aba 100644 --- a/htdocs/includes/modules/modTelephonie.class.php +++ b/htdocs/includes/modules/modTelephonie.class.php @@ -58,9 +58,9 @@ class modTelephonie extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; - + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 2; + $this->special = 3; $this->picto='phoning'; // Dir diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 02caa185f8e..2b9e21be91c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -69,11 +69,10 @@ OtherSetup=Other setup CurrentValueSeparatorDecimal=Decimal separator CurrentValueSeparatorThousand=Thousand separator Modules=Modules -ModulesCommon=Common modules -ModulesInterfaces=Interfaces modules +ModulesCommon=Main modules ModulesOther=Other modules -ModulesJob=Setup modules -ModulesSpecial=Special modules +ModulesInterfaces=Interfaces modules +ModulesSpecial=Modules very specific ParameterInDolibarr=Parameter %s LanguageParameter=Language parameter %s LanguageBrowserParameter=Parameter %s diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index f047a50a826..16fdd1773bf 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -69,11 +69,10 @@ OtherSetup=Divers CurrentValueSeparatorDecimal=Séparateur décimal CurrentValueSeparatorThousand=Séparateur de milliers Modules=Modules -ModulesCommon=Modules standards +ModulesCommon=Modules principaux +ModulesOther=Modules complémentaires ModulesInterfaces=Modules interfaces -ModulesOther=Modules autres -ModulesJob=Modules métiers -ModulesSpecial=Modules spéciaux +ModulesSpecial=Modules très spécifiques ParameterInDolibarr=Variable %s LanguageParameter=Variable langue %s LanguageBrowserParameter=Variable %s diff --git a/htdocs/pre.inc.php b/htdocs/pre.inc.php index e6f9a1b8710..045846d0308 100644 --- a/htdocs/pre.inc.php +++ b/htdocs/pre.inc.php @@ -110,7 +110,7 @@ function llxHeader($head = "") if (! empty($conf->document->enabled)) { - $menu->add(DOL_URL_ROOT."/docs/index.php", $langs->trans("Documents")); + $menu->add(DOL_URL_ROOT."/docs/index.php", $langs->trans("DocumentsBuilder")); } if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire) diff --git a/htdocs/product/canvas/livre/liste.tpl b/htdocs/product/canvas/livre/liste.tpl index a764cb4f1b0..c1510e74a83 100644 --- a/htdocs/product/canvas/livre/liste.tpl +++ b/htdocs/product/canvas/livre/liste.tpl @@ -14,7 +14,7 @@ Case Référence + Référence A-Z @@ -33,7 +33,7 @@ CasierEntrepôtEntrepot Ventes Stock Pages
- + - - + @@ -100,7 +100,7 @@ - + - + - + diff --git a/htdocs/product/canvas/livre/livre-edit.tpl b/htdocs/product/canvas/livre/livre-edit.tpl index a22c31a8c22..d4e914f9dbb 100644 --- a/htdocs/product/canvas/livre/livre-edit.tpl +++ b/htdocs/product/canvas/livre/livre-edit.tpl @@ -29,14 +29,14 @@
RéférenceRéférence @@ -62,13 +62,13 @@ {$prod_isbn} ISBN-13sera calculé + sera calculé
EANsera calculésera calculé
Prix de revientsera calculésera calculé Prix reliure
Durée du contrat :Durée du contrat : @@ -186,7 +186,7 @@ % Quantité achetéeQuantité achetée @@ -213,7 +213,7 @@
- +
-
Éditer Livre
+
Éditer Livre
- + - + - + - + @@ -228,7 +228,7 @@ - + {/if} diff --git a/htdocs/product/canvas/livre/livre-view.tpl b/htdocs/product/canvas/livre/livre-view.tpl index a5b07f8abb6..3241179ba1e 100644 --- a/htdocs/product/canvas/livre/livre-view.tpl +++ b/htdocs/product/canvas/livre/livre-view.tpl @@ -24,7 +24,7 @@
Réf.Réf. @@ -182,7 +182,7 @@ Saisi par{$livre_contrat_user_fullname}
Durée du contrat :Durée du contrat : @@ -198,7 +198,7 @@ % Quantité achetéeQuantité achetée @@ -220,7 +220,7 @@ Saisi par{$livre_contrat_user_fullname}
Durée du contrat : Durée du contrat : {$livre_contrat_duree} Date d'application {$livre_contrat_date_app|date_format:"%d %B %Y"}
Taux conclu {$livre_contrat_taux} %Quantité achetéeQuantité achetée {$livre_contrat_quant}
- + - + @@ -125,7 +125,7 @@ - + @@ -134,7 +134,7 @@ - + diff --git a/htdocs/product/canvas/livrecontrat/livrecontrat-edit.tpl b/htdocs/product/canvas/livrecontrat/livrecontrat-edit.tpl index 6fcb59369e3..654e6a5d0a2 100644 --- a/htdocs/product/canvas/livrecontrat/livrecontrat-edit.tpl +++ b/htdocs/product/canvas/livrecontrat/livrecontrat-edit.tpl @@ -10,7 +10,7 @@
RéférenceRéférence {$prod_ref} {$fiche_cursor_prev}{$fiche_cursor_next} @@ -96,7 +96,7 @@
Stock réelStock réel {$prod_stock_reel} Exemplaires en commande {$prod_stock_in_command}
Durée du contrat : Durée du contrat : {$livre_contrat_duree} Date d'application {$livre_contrat_date_app|date_format:"%d %B %Y"}
Taux conclu {$livre_contrat_taux} %Quantité achetéeQuantité achetée {$livre_contrat_quant}
- + @@ -39,7 +39,7 @@
Réf.Réf. {$prod_ref}
- + - +
Durée du contrat :Durée du contrat : @@ -54,7 +54,7 @@ % Quantité achetéeQuantité achetée diff --git a/htdocs/product/canvas/livrecontrat/livrecontrat-view.tpl b/htdocs/product/canvas/livrecontrat/livrecontrat-view.tpl index 0f0029c3e1e..6f1514e06b6 100644 --- a/htdocs/product/canvas/livrecontrat/livrecontrat-view.tpl +++ b/htdocs/product/canvas/livrecontrat/livrecontrat-view.tpl @@ -1,7 +1,7 @@ - + - + @@ -41,7 +41,7 @@
RéférenceRéférence {$prod_ref} {$fiche_cursor_prev}{$fiche_cursor_next} @@ -28,7 +28,7 @@
Stock réelStock réel {$prod_stock_reel} Exemplaires en commande {$prod_stock_in_command}
- + @@ -50,7 +50,7 @@ - + diff --git a/htdocs/product/canvas/livrecouverture/livrecouverture-edit.tpl b/htdocs/product/canvas/livrecouverture/livrecouverture-edit.tpl index f3c60e35d6b..be3c52463c7 100644 --- a/htdocs/product/canvas/livrecouverture/livrecouverture-edit.tpl +++ b/htdocs/product/canvas/livrecouverture/livrecouverture-edit.tpl @@ -7,7 +7,7 @@
Durée du contrat : Durée du contrat : {$prod_contrat_duree} Date d'application {$prod_contrat_date_app|date_format:"%e %B %Y"}
Taux conclu {$prod_contrat_taux}Quantité achetéeQuantité achetée {$prod_contrat_quant}
- +
Réf.Réf. @@ -131,7 +131,7 @@ - + - +
Durée du contrat :Durée du contrat : @@ -149,7 +149,7 @@ % Quantité achetéeQuantité achetée diff --git a/htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl b/htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl index 1429c997c37..a09ebcbe59f 100644 --- a/htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl +++ b/htdocs/product/canvas/livrecouverture/livrecouverture-view.tpl @@ -1,7 +1,7 @@ - + - +
RéférenceRéf {$livre_ref}   @@ -26,7 +26,7 @@
Stock réelStock réel {$prod_stock_reel} Exemplaires en commande {$prod_stock_in_command}