New: Can import members with assistant

This commit is contained in:
Laurent Destailleur 2010-09-30 19:25:58 +00:00
parent 557fa249af
commit a69b2a9437
10 changed files with 56 additions and 12 deletions

View File

@ -143,7 +143,7 @@ class Export
// Code du dataset export
$this->array_export_code[$i]=$module->export_code[$r];
// Libelle du dataset export
$this->array_export_label[$i]=$module->getDatasetLabel($r);
$this->array_export_label[$i]=$module->getExportDatasetLabel($r);
// Tableau des champ a exporter (cle=champ, valeur=libelle)
$this->array_export_fields[$i]=$module->export_fields_array[$r];
// Tableau des entites a exporter (cle=champ, valeur=entite)

View File

@ -53,9 +53,9 @@ class Import
/**
* \brief Load description of an importable dataset
* \param user Object user making import
* \param filter Load a particular dataset only
* Load description of an importable dataset
* @param user Object user making import
* @param filter Load a particular dataset only
*/
function load_arrays($user,$filter='')
{
@ -137,7 +137,7 @@ class Import
// Code du dataset export
$this->array_import_code[$i]=$module->import_code[$r];
// Libelle du dataset export
$this->array_import_label[$i]=$module->getDatasetLabel($r);
$this->array_import_label[$i]=$module->getImportDatasetLabel($r);
// Array of tables to import (key=alias, value=tablename)
$this->array_import_tables[$i]=$module->import_tables_array[$r];
// Array of tables creator field to import (key=alias, value=creator field)

View File

@ -303,8 +303,8 @@ class DolibarrModules
/**
* \brief Retourne la liste des fichiers lang en rapport avec le module
* \return array Tableau des fichier lang
* Return list of lang files related to module
* @return array Array of lang files
*/
function getLangFilesArray()
{
@ -312,10 +312,10 @@ class DolibarrModules
}
/**
* \brief Retourne le libelle d'un lot de donnees exportable
* \return string Libelle du lot de donnees
* Return translated label of a export dataset
* @return string Label of databaset
*/
function getDatasetLabel($r)
function getExportDatasetLabel($r)
{
global $langs;
@ -333,7 +333,29 @@ class DolibarrModules
}
/**
/**
* Return translated label of an import dataset
* @return string Label of databaset
*/
function getImportDatasetLabel($r)
{
global $langs;
$langstring="ImportDataset_".$this->import_code[$r];
//print "x".$langstring;
if ($langs->trans($langstring) == $langstring)
{
// Traduction non trouvee
return $langs->trans($this->import_label[$r]);
}
else
{
// Traduction trouvee
return $langs->trans($langstring);
}
}
/**
* \brief Insert line in dolibarr_modules table.
* \return int Nb of errors (0 if OK)
* \remarks Storage is made for information only, table is not required for Dolibarr usage.

View File

@ -204,6 +204,21 @@ class modAdherent extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_options as ao ON a.rowid = ao.fk_member';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'cotisation as c ON c.fk_adherent = a.rowid';
$this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid';
// Imports
//--------
$r=0;
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Members"; // Translation key
$this->import_icon[$r]=$this->picto;
$this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'adherent');
$this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('a.civilite'=>"Civility",'a.nom'=>"Lastname*",'a.prenom'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'MorPhy*','a.societe'=>'Company','a.adresse'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation');
$this->import_entities_array[$r]=array(); // We define here only fields that use another picto
$this->import_regex_array[$r]=array('a.civilite'=>'code@'.MAIN_DB_PREFIX.'c_civilite','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('a.civilite'=>"MR",'a.nom'=>'Smith','a.prenom'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.adresse'=>'21 jump street','a.cp'=>'55000','a.ville'=>'New York','a.pays'=>'US','a.email'=>'jsmith@example.com','a.naiss'=>'1972-10-10','a.statut'=>"0 or 1",'a.note'=>"This is a comment on member",'a.datec'=>'2008-12-31');
}

View File

@ -162,7 +162,7 @@ class modProduct extends DolibarrModules
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Products"; // Translation key
$this->import_icon[$r]='product';
$this->import_icon[$r]=$this->picto;
$this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product');
$this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
$this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.duration'=>"Duration",'p.weight'=>"Weight",'p.volume'=>"Volume",'p.datec'=>'DateCreation*');

View File

@ -113,6 +113,7 @@ PublicMemberList=Public member list
BlankSubscriptionForm=Subscription form
MemberPublicLinks=Public links/pages
ExportDataset_member_1=Members and subscriptions
ImportDataset_member_1=Members
LastMembers=Last %s members
LastMembersModified=Last %s modified members
AttributeName=Attribute name

View File

@ -131,6 +131,8 @@ DeletePicture=Delete a picture
ConfirmDeletePicture=Are you sure you want to delete this picture ?
ExportDataset_produit_1=Products
ExportDataset_service_1=Services
ImportDataset_produit_1=Products
ImportDataset_service_1=Services
DeleteProductLine=Delete product line
ConfirmDeleteProductLine=Are you sure you want to delete this product line?
NoProductMatching=No product/service match your criteria

View File

@ -273,6 +273,7 @@ DolibarrLogin=Login Dolibarr
NoDolibarrAccess=Pas d'accès Dolibarr
ExportDataset_company_1=Tiers (sociétés/institutions) et attributs
ExportDataset_company_2=Contacts (de tiers) et attributs
ImportDataset_company_1=Tiers (sociétés/institutions) et attributs
PriceLevel=Niveau de prix
DeliveriesAddress=Adresse(s) de livraison
DeliveryAddress=Adresse de livraison

View File

@ -113,6 +113,7 @@ PublicMemberList=Liste des membres publics
BlankSubscriptionForm=Formulaire inscription
MemberPublicLinks=Liens/pages publiques
ExportDataset_member_1=Adhérents et adhésions
ImportDataset_member_1=Adhérents
LastMembers=Les %s derniers adhérents
LastMembersModified=Les %s derniers adhérents modifiés
AttributeName=Nom de l'attribut

View File

@ -131,6 +131,8 @@ DeletePicture=Supprimer une photo
ConfirmDeletePicture=Êtes-vous sûr de vouloir supprimer cette photo ?
ExportDataset_produit_1=Produits
ExportDataset_service_1=Services
ImportDataset_produit_1=Produits
ImportDataset_service_1=Services
DeleteProductLine=Supprimer ligne produit
ConfirmDeleteProductLine=Êtes-vous sûr de vouloir effacer cette ligne produit ?
NoProductMatching=Aucun produit/service ne répond au critère