New: Can send ficheinter by email

This commit is contained in:
Laurent Destailleur 2011-05-05 07:02:22 +00:00
parent d9ea527f49
commit a694166fc2
5 changed files with 117 additions and 105 deletions

View File

@ -5,6 +5,7 @@ $Id$
***** ChangeLog for 3.1 compared to 3.0 ***** ***** ChangeLog for 3.1 compared to 3.0 *****
For users: For users:
- New: Can send interventions cards by email.
- New: Add option MAIN_FIRST_TO_UPPER to force upper case of first - New: Add option MAIN_FIRST_TO_UPPER to force upper case of first
letters for names and firstname. letters for names and firstname.
- New: Can filter of payment type in bank transaction list. - New: Can filter of payment type in bank transaction list.

View File

@ -42,138 +42,146 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
class modFicheinter extends DolibarrModules class modFicheinter extends DolibarrModules
{ {
/** /**
* \brief Constructeur. Definit les noms, constantes et boites * \brief Constructeur. Definit les noms, constantes et boites
* \param DB Database access handler * \param DB Database access handler
*/ */
function modFicheinter($DB) function modFicheinter($DB)
{ {
global $conf; global $conf;
$this->db = $DB ; $this->db = $DB ;
$this->numero = 70 ; $this->numero = 70 ;
$this->family = "crm"; $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) // 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->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Gestion des fiches d'intervention"; $this->description = "Gestion des fiches d'intervention";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; $this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0; $this->special = 0;
$this->picto = "intervention"; $this->picto = "intervention";
// Data directories to create when module is enabled // Data directories to create when module is enabled
$this->dirs = array("/ficheinter/temp"); $this->dirs = array("/ficheinter/temp");
// Dependencies // Dependencies
$this->depends = array("modSociete"); $this->depends = array("modSociete");
$this->requiredby = array(); $this->requiredby = array();
$this->conflictwith = array(); $this->conflictwith = array();
$this->langfiles = array("bills","companies","interventions"); $this->langfiles = array("bills","companies","interventions");
// Config pages // Config pages
$this->config_page_url = array("fichinter.php"); $this->config_page_url = array("fichinter.php");
// Constantes // Constantes
$this->const = array(); $this->const = array();
$r=0; $r=0;
$this->const[$r][0] = "FICHEINTER_ADDON_PDF"; $this->const[$r][0] = "FICHEINTER_ADDON_PDF";
$this->const[$r][1] = "chaine"; $this->const[$r][1] = "chaine";
$this->const[$r][2] = "soleil"; $this->const[$r][2] = "soleil";
$r++; $r++;
$this->const[$r][0] = "FICHEINTER_ADDON"; $this->const[$r][0] = "FICHEINTER_ADDON";
$this->const[$r][1] = "chaine"; $this->const[$r][1] = "chaine";
$this->const[$r][2] = "pacific"; $this->const[$r][2] = "pacific";
$r++; $r++;
// Boites // Boites
$this->boxes = array(); $this->boxes = array();
// Permissions // Permissions
$this->rights = array(); $this->rights = array();
$this->rights_class = 'ficheinter'; $this->rights_class = 'ficheinter';
$r=0; $r=0;
$r++; $r++;
$this->rights[$r][0] = 61; $this->rights[$r][0] = 61;
$this->rights[$r][1] = 'Lire les fiches d\'intervention'; $this->rights[$r][1] = 'Lire les fiches d\'intervention';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 1;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
$this->rights[$r][0] = 62; $this->rights[$r][0] = 62;
$this->rights[$r][1] = 'Creer/modifier les fiches d\'intervention'; $this->rights[$r][1] = 'Creer/modifier les fiches d\'intervention';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer'; $this->rights[$r][4] = 'creer';
$r++; $r++;
$this->rights[$r][0] = 64; $this->rights[$r][0] = 64;
$this->rights[$r][1] = 'Supprimer les fiches d\'intervention'; $this->rights[$r][1] = 'Supprimer les fiches d\'intervention';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'supprimer'; $this->rights[$r][4] = 'supprimer';
$r++; $r++;
$this->rights[$r][0] = 67; $this->rights[$r][0] = 67;
$this->rights[$r][1] = 'Exporter les fiches interventions'; $this->rights[$r][1] = 'Exporter les fiches interventions';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'export'; $this->rights[$r][4] = 'export';
//Exports $r++;
//-------- $this->rights[$r][0] = 68;
$r=1; $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; //Exports
$this->export_label[$r]='InterventionCardsAndInterventionLines'; // Translation key (used only if key ExportDataset_xxx_z not found) //--------
$this->export_permission[$r]=array(array("ficheinter","export")); $r=1;
$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_code[$r]=$this->rights_class.'_'.$r;
$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_label[$r]='InterventionCardsAndInterventionLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_fichinter'; $this->export_permission[$r]=array(array("ficheinter","export"));
$this->export_sql_end[$r] .=' AND f.entity = '.$conf->entity; $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");
$r++; $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. * \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. * Definit egalement les repertoires de donnees a creer pour ce module.
*/ */
function init() function init()
{ {
global $conf; global $conf;
// Permissions // Permissions
$this->remove(); $this->remove();
$sql = array( $sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "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.")", "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. * \brief Fonction appelee lors de la desactivation d'un module.
* Supprime de la base les constantes, boites et permissions du module. * Supprime de la base les constantes, boites et permissions du module.
*/ */
function remove() function remove()
{ {
$sql = array(); $sql = array();
return $this->_remove($sql); return $this->_remove($sql);
} }
} }
?> ?>

View File

@ -162,7 +162,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Modifier ses propres permissions'; $this->rights[$r][1] = 'Modifier ses propres permissions';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 1; $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'; $this->rights[$r][5] = 'writeperms';
$r++; $r++;
@ -170,7 +170,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Consulter les groupes'; $this->rights[$r][1] = 'Consulter les groupes';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $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'; $this->rights[$r][5] = 'read';
$r++; $r++;
@ -178,7 +178,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Consulter les permissions des groupes'; $this->rights[$r][1] = 'Consulter les permissions des groupes';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $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'; $this->rights[$r][5] = 'readperms';
$r++; $r++;
@ -186,7 +186,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions'; $this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $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'; $this->rights[$r][5] = 'write';
$r++; $r++;
@ -194,7 +194,7 @@ class modUser extends DolibarrModules
$this->rights[$r][1] = 'Supprimer ou desactiver les groupes'; $this->rights[$r][1] = 'Supprimer ou desactiver les groupes';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $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'; $this->rights[$r][5] = 'delete';
$r++; $r++;

View File

@ -45,3 +45,5 @@ ArcticNumRefModelDesc1=Modèle de numérotation générique
ArcticNumRefModelError=Activation impossible 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 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. 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

View File

@ -259,6 +259,7 @@ print '<td align="center" width="24">&nbsp;</td>';
print '<td>'.$langs->trans("Permissions").'</td>'; print '<td>'.$langs->trans("Permissions").'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
$sql = "SELECT r.id, r.libelle, r.module"; $sql = "SELECT r.id, r.libelle, r.module";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"