From a694166fc2f78dd6da993aaaadc709236f7be686 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 May 2011 07:02:22 +0000 Subject: [PATCH] New: Can send ficheinter by email --- ChangeLog | 1 + .../includes/modules/modFicheinter.class.php | 208 +++++++++--------- htdocs/includes/modules/modUser.class.php | 10 +- htdocs/langs/fr_FR/interventions.lang | 2 + htdocs/user/perms.php | 1 + 5 files changed, 117 insertions(+), 105 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58f42d3c0b3..3f08224816d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ $Id$ ***** ChangeLog for 3.1 compared to 3.0 ***** For users: +- New: Can send interventions cards by email. - New: Add option MAIN_FIRST_TO_UPPER to force upper case of first letters for names and firstname. - New: Can filter of payment type in bank transaction list. diff --git a/htdocs/includes/modules/modFicheinter.class.php b/htdocs/includes/modules/modFicheinter.class.php index 0df0153793a..225561492fb 100644 --- a/htdocs/includes/modules/modFicheinter.class.php +++ b/htdocs/includes/modules/modFicheinter.class.php @@ -42,138 +42,146 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); class modFicheinter extends DolibarrModules { - /** - * \brief Constructeur. Definit les noms, constantes et boites - * \param DB Database access handler - */ - function modFicheinter($DB) - { - global $conf; + /** + * \brief Constructeur. Definit les noms, constantes et boites + * \param DB Database access handler + */ + function modFicheinter($DB) + { + global $conf; - $this->db = $DB ; - $this->numero = 70 ; + $this->db = $DB ; + $this->numero = 70 ; - $this->family = "crm"; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = preg_replace('/^mod/i','',get_class($this)); - $this->description = "Gestion des fiches d'intervention"; + $this->family = "crm"; + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) + $this->name = preg_replace('/^mod/i','',get_class($this)); + $this->description = "Gestion des fiches d'intervention"; - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'dolibarr'; + // 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->picto = "intervention"; + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + $this->special = 0; + $this->picto = "intervention"; - // Data directories to create when module is enabled - $this->dirs = array("/ficheinter/temp"); + // Data directories to create when module is enabled + $this->dirs = array("/ficheinter/temp"); // Dependencies - $this->depends = array("modSociete"); - $this->requiredby = array(); - $this->conflictwith = array(); - $this->langfiles = array("bills","companies","interventions"); + $this->depends = array("modSociete"); + $this->requiredby = array(); + $this->conflictwith = array(); + $this->langfiles = array("bills","companies","interventions"); - // Config pages - $this->config_page_url = array("fichinter.php"); + // Config pages + $this->config_page_url = array("fichinter.php"); - // Constantes - $this->const = array(); - $r=0; + // Constantes + $this->const = array(); + $r=0; - $this->const[$r][0] = "FICHEINTER_ADDON_PDF"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "soleil"; - $r++; + $this->const[$r][0] = "FICHEINTER_ADDON_PDF"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "soleil"; + $r++; - $this->const[$r][0] = "FICHEINTER_ADDON"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "pacific"; - $r++; + $this->const[$r][0] = "FICHEINTER_ADDON"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "pacific"; + $r++; - // Boites - $this->boxes = array(); + // Boites + $this->boxes = array(); - // Permissions - $this->rights = array(); - $this->rights_class = 'ficheinter'; - $r=0; + // Permissions + $this->rights = array(); + $this->rights_class = 'ficheinter'; + $r=0; $r++; - $this->rights[$r][0] = 61; - $this->rights[$r][1] = 'Lire les fiches d\'intervention'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 1; - $this->rights[$r][4] = 'lire'; + $this->rights[$r][0] = 61; + $this->rights[$r][1] = 'Lire les fiches d\'intervention'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'lire'; $r++; - $this->rights[$r][0] = 62; - $this->rights[$r][1] = 'Creer/modifier les fiches d\'intervention'; - $this->rights[$r][2] = 'w'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'creer'; + $this->rights[$r][0] = 62; + $this->rights[$r][1] = 'Creer/modifier les fiches d\'intervention'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'creer'; $r++; - $this->rights[$r][0] = 64; - $this->rights[$r][1] = 'Supprimer les fiches d\'intervention'; - $this->rights[$r][2] = 'd'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'supprimer'; + $this->rights[$r][0] = 64; + $this->rights[$r][1] = 'Supprimer les fiches d\'intervention'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'supprimer'; - $r++; - $this->rights[$r][0] = 67; - $this->rights[$r][1] = 'Exporter les fiches interventions'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'export'; + $r++; + $this->rights[$r][0] = 67; + $this->rights[$r][1] = 'Exporter les fiches interventions'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'export'; - //Exports - //-------- - $r=1; + $r++; + $this->rights[$r][0] = 68; + $this->rights[$r][1] = 'Envoyer les fiches d\'intervention'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on + $this->rights[$r][5] = 'send'; - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='InterventionCardsAndInterventionLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_permission[$r]=array(array("ficheinter","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote",'fd.rowid'=>'InterLineId','fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc"); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",'f.fk_statut'=>"intervention",'f.description'=>"intervention",'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line'); + //Exports + //-------- + $r=1; - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'fichinter as f, '.MAIN_DB_PREFIX.'fichinterdet as fd, '.MAIN_DB_PREFIX.'societe as s)'; - $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_fichinter'; - $this->export_sql_end[$r] .=' AND f.entity = '.$conf->entity; - $r++; + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='InterventionCardsAndInterventionLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r]=array(array("ficheinter","export")); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote",'fd.rowid'=>'InterLineId','fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc"); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",'f.fk_statut'=>"intervention",'f.description'=>"intervention",'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line'); - } + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'fichinter as f, '.MAIN_DB_PREFIX.'fichinterdet as fd, '.MAIN_DB_PREFIX.'societe as s)'; + $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_fichinter'; + $this->export_sql_end[$r] .=' AND f.entity = '.$conf->entity; + $r++; + + } - /** - * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. - * Definit egalement les repertoires de donnees a creer pour ce module. - */ - function init() - { - global $conf; + /** + * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. + * Definit egalement les repertoires de donnees a creer pour ce module. + */ + function init() + { + global $conf; - // Permissions - $this->remove(); + // Permissions + $this->remove(); - $sql = array( + $sql = array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','ficheinter',".$conf->entity.")", - ); + ); - return $this->_init($sql); - } + return $this->_init($sql); + } - /** - * \brief Fonction appelee lors de la desactivation d'un module. - * Supprime de la base les constantes, boites et permissions du module. - */ - function remove() - { - $sql = array(); + /** + * \brief Fonction appelee lors de la desactivation d'un module. + * Supprime de la base les constantes, boites et permissions du module. + */ + function remove() + { + $sql = array(); - return $this->_remove($sql); - } + return $this->_remove($sql); + } } ?> diff --git a/htdocs/includes/modules/modUser.class.php b/htdocs/includes/modules/modUser.class.php index 643ca900c39..c7284b0697d 100644 --- a/htdocs/includes/modules/modUser.class.php +++ b/htdocs/includes/modules/modUser.class.php @@ -162,7 +162,7 @@ class modUser extends DolibarrModules $this->rights[$r][1] = 'Modifier ses propres permissions'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 1; - $this->rights[$r][4] = 'self_advance'; + $this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'writeperms'; $r++; @@ -170,7 +170,7 @@ class modUser extends DolibarrModules $this->rights[$r][1] = 'Consulter les groupes'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'group_advance'; + $this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'read'; $r++; @@ -178,7 +178,7 @@ class modUser extends DolibarrModules $this->rights[$r][1] = 'Consulter les permissions des groupes'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'group_advance'; + $this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'readperms'; $r++; @@ -186,7 +186,7 @@ class modUser extends DolibarrModules $this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'group_advance'; + $this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'write'; $r++; @@ -194,7 +194,7 @@ class modUser extends DolibarrModules $this->rights[$r][1] = 'Supprimer ou desactiver les groupes'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'group_advance'; + $this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][5] = 'delete'; $r++; diff --git a/htdocs/langs/fr_FR/interventions.lang b/htdocs/langs/fr_FR/interventions.lang index 8d1d87455a1..4b4f981e70a 100644 --- a/htdocs/langs/fr_FR/interventions.lang +++ b/htdocs/langs/fr_FR/interventions.lang @@ -45,3 +45,5 @@ ArcticNumRefModelDesc1=Modèle de numérotation générique ArcticNumRefModelError=Activation impossible PacificNumRefModelDesc1=Renvoie le numéro sous la forme %syymm-nnnn où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0 PacificNumRefModelError=Une facture commençant par $syymm existe en base et est incompatible avec cette numérotation. Supprimez la ou renommez la pour activer ce module. +SendInterventionByMail=Envoi de la fiche d'intervention par mail +SendInterventionRef=Envoi Intervention %s diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 8896b0e64bb..18071d625b0 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -259,6 +259,7 @@ print ' '; print ''.$langs->trans("Permissions").''; print ''."\n"; +//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS; $sql = "SELECT r.id, r.libelle, r.module"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"