New: Can import members using assistant

This commit is contained in:
Laurent Destailleur 2010-10-01 23:37:36 +00:00
parent 85635cdeea
commit 7a2d72b6fd
17 changed files with 304 additions and 449 deletions

View File

@ -3,6 +3,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.0 compared to 2.9 ***** ***** ChangeLog for 3.0 compared to 2.9 *****
For users: For users:
- New: Can import members using assistant.
- New: Can exclude deposit, replacement or credit notes in script rebuild_merge_pdf. - New: Can exclude deposit, replacement or credit notes in script rebuild_merge_pdf.
- New: task #10473 : Option MAIN_PROFIDx_IN_ADDRESS must no more be hidden. - New: task #10473 : Option MAIN_PROFIDx_IN_ADDRESS must no more be hidden.
- New: Can generate business card for on particular member. - New: Can generate business card for on particular member.

View File

@ -27,6 +27,7 @@
require("../main.inc.php"); require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_options.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_options.class.php");
@ -755,7 +756,6 @@ if ($rowid)
} }
if (! $dateto) if (! $dateto)
{ {
//$dateto=dol_time_plus_duree(dol_time_plus_duree($datefrom,$defaultdelay,$defaultdelayunit),-1,'d');
$dateto=-1; // By default, no date is suggested $dateto=-1; // By default, no date is suggested
} }
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>'; print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';

View File

@ -31,6 +31,7 @@
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
/** /**

View File

@ -28,6 +28,7 @@
*/ */
require ("../main.inc.php"); require ("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php');
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");

View File

@ -1071,7 +1071,7 @@ if ($step == 4 && $datatoimport)
} }
// STEP 5: Summary of choices // STEP 5: Summary of choices and launch simulation
if ($step == 5 && $datatoimport) if ($step == 5 && $datatoimport)
{ {
$model=$format; $model=$format;
@ -1262,218 +1262,26 @@ if ($step == 5 && $datatoimport)
print '</div>'; print '</div>';
if (GETPOST('action') != 'launchsimu')
{
// Show import id // Show import id
print $langs->trans("NowClickToTestTheImport",$langs->transnoentitiesnoconv("RunSimulateImportFile")).'<br>'; print $langs->trans("NowClickToTestTheImport",$langs->transnoentitiesnoconv("RunSimulateImportFile")).'<br>';
print '<br>'; print '<br>';
// Actions // Actions
print '<center>'; print '<center>';
if ($user->rights->import->run) if ($user->rights->import->run)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import&step=6'.$param.'">'.$langs->trans("RunSimulateImportFile").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import&step=5&action=launchsimu'.$param.'">'.$langs->trans("RunSimulateImportFile").'</a>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("RunSimulateImportFile").'</a>'; print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("RunSimulateImportFile").'</a>';
} }
/*print '<form action="'.$_SERVER["PHP_SELF"].'?step=6&'.$param.'">';
print '<input class="button" type="submit" value="'.$langs->trans("RunSimulateImportFile").'">';
print '</form>';*/
print '</center>'; print '</center>';
if ($mesg) print $mesg;
}
// STEP 6: Result of simulation
if ($step == 6 && $datatoimport)
{
$model=$format;
$liste=$objmodelimport->liste_modeles($db);
// Create classe to use for import
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/";
$file = "import_".$model.".modules.php";
$classname = "Import".ucfirst($model);
require_once($dir.$file);
$obj = new $classname($db);
// Load source fields in input file
$fieldssource=array();
$result=$obj->import_open_file($conf->import->dir_temp.'/'.$filetoimport,$langs);
if ($result >= 0)
{
// Read first line
$arrayrecord=$obj->import_read_record();
// Put into array fieldssource starting with 1.
$i=1;
foreach($arrayrecord as $key => $val)
{
$fieldssource[$i]['example1']=dol_trunc($val['val'],24);
$i++;
} }
$obj->import_close_file(); else
}
$nboflines=(! empty($_GET["nboflines"])?$_GET["nboflines"]:dol_count_nb_of_line($conf->import->dir_temp.'/'.$filetoimport));
$param='&format='.$format.'&datatoimport='.$datatoimport.'&filetoimport='.urlencode($filetoimport).'&nboflines='.$nboflines;
if ($excludefirstline) $param.='&excludefirstline=1';
llxHeader('',$langs->trans("NewImport"),'EN:Module_Imports_En|FR:Module_Imports|ES:M&oacute;dulo_Importaciones');
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=1'.$param;
$head[$h][1] = $langs->trans("Step")." 1";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=2'.$param;
$head[$h][1] = $langs->trans("Step")." 2";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=3'.$param;
$head[$h][1] = $langs->trans("Step")." 3";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=4'.$param;
$head[$h][1] = $langs->trans("Step")." 4";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param;
$head[$h][1] = $langs->trans("Step")." 5";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=6'.$param;
$head[$h][1] = $langs->trans("Step")." 6";
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("NewImport"));
print '<table width="100%" class="border">';
// Module
print '<tr><td width="25%">'.$langs->trans("Module").'</td>';
print '<td>';
//print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_module[0]->picto).' ';
print $objimport->array_import_module[0]->getName();
print '</td></tr>';
// Lot de donnees a importer
print '<tr><td>'.$langs->trans("DatasetToImport").'</td>';
print '<td>';
print img_object($objimport->array_import_module[0]->getName(),$objimport->array_import_icon[0]).' ';
print $objimport->array_import_label[0];
print '</td></tr>';
print '</table><br>';
print '<b>'.$langs->trans("InformationOnSourceFile").'</b>';
print '<table width="100%" class="border">';
//print '<tr><td colspan="2"><b>'.$langs->trans("InformationOnSourceFile").'</b></td></tr>';
// Source file format
print '<tr><td width="25%">'.$langs->trans("SourceFileFormat").'</td>';
print '<td>';
$text=$objmodelimport->getDriverDesc($format);
print $html->textwithpicto($objmodelimport->getDriverLabel($format),$text);
print '</td></tr>';
// File to import
print '<tr><td>'.$langs->trans("FileToImport").'</td>';
print '<td>';
$modulepart='import';
//$relativepath=$filetoimport;
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($filetoimport).'&step=4'.$param.'" target="_blank">';
print $filetoimport;
print '</a>';
print '</td></tr>';
// Nb of fields
print '<tr><td>';
print $langs->trans("NbOfSourceLines");
print '</td><td>';
print $nboflines;
print '</td></tr>';
// Checkbox do not import first line
print '<tr><td>';
print $langs->trans("Option");
print '</td><td>';
print '<input type="hidden" name="excludefirstline" value="'.$excludefirstline.'">';
print '<input type="checkbox" name="excludefirstlinebis" value="1" disabled="true"';
print ($excludefirstline?' checked="true"':'');
print '>';
print ' '.$langs->trans("DoNotImportFirstLine");
print '</td></tr>';
print '</table>';
print '<br>';
print '<b>'.$langs->trans("InformationOnTargetTables").'</b>';
print '<table width="100%" class="border">';
//print '<tr><td colspan="2"><b>'.$langs->trans("InformationOnTargetTables").'</b></td></tr>';
// Tables imported
print '<tr><td width="25%">';
print $langs->trans("TablesTarget");
print '</td><td>';
$listtables=array();
foreach($array_match_file_to_database as $code=>$label)
{ {
//var_dump($fieldssource);
if ($code > sizeof($fieldssource)) continue;
//print $code.'-'.$label;
$alias=preg_replace('/(\..*)$/i','',$label);
$listtables[$alias]=$objimport->array_import_tables[0][$alias];
}
if (sizeof($listtables))
{
$newval='';
foreach ($listtables as $val)
{
if ($newval) print ', ';
$newval=$val;
// Link to Dolibarr wiki pages
/*$helppagename='EN:Table_'.$newval;
if ($helppagename && empty($conf->global->MAIN_HELP_DISABLELINK))
{
// Get helpbaseurl, helppage and mode from helppagename and langs
$arrayres=getHelpParamFor($helppagename,$langs);
$helpbaseurl=$arrayres['helpbaseurl'];
$helppage=$arrayres['helppage'];
$mode=$arrayres['mode'];
$newval.=' <a href="'.sprintf($helpbaseurl,$helppage).'">'.img_picto($langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage'),DOL_URL_ROOT.'/theme/common/helpdoc.png','',1).'</a>';
}*/
print $newval;
}
}
else print $langs->trans("Error");
print '</td></tr>';
// Fields imported
print '<tr><td>';
print $langs->trans("FieldsTarget").'</td><td>';
$listfields=array();
$i=0;
$sort_array_match_file_to_database=$array_match_file_to_database;
ksort($sort_array_match_file_to_database);
//var_dump($sort_array_match_file_to_database);
foreach($sort_array_match_file_to_database as $code=>$label)
{
$i++;
//var_dump($fieldssource);
if ($code > sizeof($fieldssource)) continue;
//print $code.'-'.$label;
$alias=preg_replace('/(\..*)$/i','',$label);
$listfields[$i]=$langs->trans("Field").' '.$code.'->'.$label;
}
print sizeof($listfields)?(join(', ',$listfields)):$langs->trans("Error");
print '</td></tr>';
print '</table>';
// Launch import // Launch import
$arrayoferrors=array(); $arrayoferrors=array();
@ -1518,8 +1326,6 @@ if ($step == 6 && $datatoimport)
$db->rollback(); // We force rollback because this was just a simulation. $db->rollback(); // We force rollback because this was just a simulation.
print '</div>';
// Show OK // Show OK
if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' <b>'.$langs->trans("NoError").'</b><br><br>'; if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' <b>'.$langs->trans("NoError").'</b><br><br>';
else print $langs->trans("NbOfLinesOK",$nbok).'</b><br><br>'; else print $langs->trans("NbOfLinesOK",$nbok).'</b><br><br>';
@ -1548,7 +1354,6 @@ if ($step == 6 && $datatoimport)
print '<br>'; print '<br>';
} }
// Show Warnings // Show Warnings
//var_dump($arrayoferrors); //var_dump($arrayoferrors);
if (sizeof($arrayofwarnings)) if (sizeof($arrayofwarnings))
@ -1589,29 +1394,30 @@ if ($step == 6 && $datatoimport)
{ {
if (empty($nboferrors)) if (empty($nboferrors))
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import&step=7&importid='.$importid.$param.'">'.$langs->trans("RunImportFile").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import&step=6&importid='.$importid.$param.'">'.$langs->trans("RunImportFile").'</a>';
} }
else else
{ {
//print '<a class="butAction" href="'.DOL_URL_ROOT.'/imports/import.php?leftmenu=import&step=5&action=launchsimu'.$param.'">'.$langs->trans("RunSimulateImportFile").'</a>';
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("CorrectErrorBeforeRunningImport")).'">'.$langs->trans("RunImportFile").'</a>'; print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("CorrectErrorBeforeRunningImport")).'">'.$langs->trans("RunImportFile").'</a>';
} }
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("RunSimulateImportFile").'</a>';
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("RunImportFile").'</a>'; print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("RunImportFile").'</a>';
} }
/*print '<form action="'.$_SERVER["PHP_SELF"].'?step=6&'.$param.'">';
print '<input class="button" type="submit" value="'.$langs->trans("RunSimulateImportFile").'">';
print '</form>';*/
print '</center>'; print '</center>';
}
if ($mesg) print $mesg; if ($mesg) print $mesg;
} }
// STEP 6: Real import
// STEP 7: Real import if ($step == 6 && $datatoimport)
if ($step == 7 && $datatoimport)
{ {
$model=$format; $model=$format;
$liste=$objmodelimport->liste_modeles($db); $liste=$objmodelimport->liste_modeles($db);
@ -1673,10 +1479,6 @@ if ($step == 7 && $datatoimport)
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=6'.$param; $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=6'.$param;
$head[$h][1] = $langs->trans("Step")." 6"; $head[$h][1] = $langs->trans("Step")." 6";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=7'.$param;
$head[$h][1] = $langs->trans("Step")." 7";
$hselected=$h; $hselected=$h;
$h++; $h++;

View File

@ -50,6 +50,8 @@ class ImportCsv extends ModeleImports
var $handle; // Handle fichier var $handle; // Handle fichier
var $cachefieldtable=array(); // Array to cache list of value into fields@tables
/** /**
* \brief Constructeur * \brief Constructeur
@ -330,7 +332,7 @@ class ImportCsv extends ModeleImports
else if ($arrayrecord[($key-1)]['type'] > 0) else if ($arrayrecord[($key-1)]['type'] > 0)
{ {
$newval=$arrayrecord[($key-1)]['val']; $newval=$arrayrecord[($key-1)]['val'];
$listvalues.="'".addslashes($arrayrecord[($key-1)]['val'])."'"; $listvalues.="'".$this->db->escape($arrayrecord[($key-1)]['val'])."'";
} }
// Make some tests // Make some tests
@ -345,13 +347,52 @@ class ImportCsv extends ModeleImports
} }
// Test format only if field is not a missing mandatory field // Test format only if field is not a missing mandatory field
else { else {
if (! empty($objimport->array_import_regex[0][$val]) && ! preg_match('/'.$objimport->array_import_regex[0][$val].'/i',$newval)) if (! empty($objimport->array_import_regex[0][$val]))
{
// If test is "Must exist in a field@table"
if (preg_match('/^(.*)@(.*)$/',$objimport->array_import_regex[0][$val],$reg))
{
$field=$reg[1];
$table=$reg[2];
if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table no already loaded into cache
{
$sql="SELECT ".$field." as aliasfield FROM ".$table;
$resql=$this->db->query($sql);
if ($resql)
{
$num=$this->db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj=$this->db->fetch_object($resql);
if ($obj) $this->cachefieldtable[$field.'@'.$table][]=$obj->aliasfield;
$i++;
}
}
else
{
dol_print_error($this->db);
}
}
// Now we check in cache
if (! in_array($newval,$this->cachefieldtable[$field.'@'.$table]))
{
$this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn',$key,$newval,$field,$table);
$this->errors[$error]['type']='FOREIGNKEY';
$error++;
}
}
// If test is just a static regex
else if (! preg_match('/'.$objimport->array_import_regex[0][$val].'/i',$newval))
{ {
$this->errors[$error]['lib']=$langs->trans('ErrorWrongValueForField',$key,$newval,$objimport->array_import_regex[0][$val]); $this->errors[$error]['lib']=$langs->trans('ErrorWrongValueForField',$key,$newval,$objimport->array_import_regex[0][$val]);
$this->errors[$error]['type']='REGEX'; $this->errors[$error]['type']='REGEX';
$errorforthistable++; $errorforthistable++;
$error++; $error++;
} }
}
// Other tests // Other tests
// ... // ...

View File

@ -209,16 +209,19 @@ class modAdherent extends DolibarrModules
//-------- //--------
$r=0; $r=0;
$now=dol_now();
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
$r++; $r++;
$this->import_code[$r]=$this->rights_class.'_'.$r; $this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Members"; // Translation key $this->import_label[$r]="Members"; // Translation key
$this->import_icon[$r]=$this->picto; $this->import_icon[$r]=$this->picto;
$this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'adherent'); $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_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_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','a.datefin'=>'DateEndSubscription');
$this->import_entities_array[$r]=array(); // We define here only fields that use another picto $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_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]$','a.datefin'=>'^[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'); $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'=>'1','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'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
} }

View File

@ -65,3 +65,7 @@ UPDATE llx_c_tva SET taux = '18' WHERE rowid = 41;
UPDATE llx_c_tva SET taux = '8' WHERE rowid = 42; UPDATE llx_c_tva SET taux = '8' WHERE rowid = 42;
DELETE FROM llx_c_tva WHERE rowid = 45; DELETE FROM llx_c_tva WHERE rowid = 45;
DELETE FROM llx_c_tva WHERE rowid = 46; DELETE FROM llx_c_tva WHERE rowid = 46;
ALTER TABLE llx_adherent ADD COLUMN import_key varchar(14);
ALTER TABLE llx_categorie ADD COLUMN import_key varchar(14);

View File

@ -59,5 +59,6 @@ create table llx_adherent
tms timestamp, -- date de modification tms timestamp, -- date de modification
fk_user_author integer, -- can be null because member can be create by a guest fk_user_author integer, -- can be null because member can be create by a guest
fk_user_mod integer, fk_user_mod integer,
fk_user_valid integer fk_user_valid integer,
import_key varchar(14) -- Import key
)type=innodb; )type=innodb;

View File

@ -28,7 +28,8 @@ create table llx_categorie
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
description text, -- description of the category description text, -- description of the category
fk_soc integer DEFAULT NULL, -- attribution of the category has a company (for product only) fk_soc integer DEFAULT NULL, -- attribution of the category has a company (for product only)
visible tinyint DEFAULT 1 NOT NULL -- determine if the products are visible or not visible tinyint DEFAULT 1 NOT NULL, -- determine if the products are visible or not
import_key varchar(14) -- Import key
)type=innodb; )type=innodb;
-- --

View File

@ -64,6 +64,7 @@ ErrorModuleRequireJavascript=Javascript must not be disabled to have this featur
ErrorPasswordsMustMatch=Both typed passwords must match each other ErrorPasswordsMustMatch=Both typed passwords must match each other
ErrorContactEMail=A technical error occured. Please, contact administrator to folowwing email <b>%s</b> en provide the error code <b>%s</b> in your message, or even better by adding a screen copy of this page. ErrorContactEMail=A technical error occured. Please, contact administrator to folowwing email <b>%s</b> en provide the error code <b>%s</b> in your message, or even better by adding a screen copy of this page.
ErrorWrongValueForField=Wrong value for field number <b>%s</b> (value '<b>%s</b>' does not match regex rule <b>%s</b>) ErrorWrongValueForField=Wrong value for field number <b>%s</b> (value '<b>%s</b>' does not match regex rule <b>%s</b>)
ErrorFieldValueNotIn=Wrong value for field number<b>%s</b> (value '<b>%s</b>' is not a value available into field <b>%s</b> of table <b>%s</b>)
ErrorsOnXLines=Errors on <b>%s</b> source lines ErrorsOnXLines=Errors on <b>%s</b> source lines
WarningsOnXLines=Warnings on <b>%s</b> source lines WarningsOnXLines=Warnings on <b>%s</b> source lines
ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus) ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus)

View File

@ -65,6 +65,7 @@ ErrorModuleRequireJavascript=Le javascript ne doit pas être désactivé pour qu
ErrorPasswordsMustMatch=Les 2 mots de passe saisis doivent correspondre ErrorPasswordsMustMatch=Les 2 mots de passe saisis doivent correspondre
ErrorContactEMail=Une erreur technique est apparue. Merci de contacter l'administrateur à l'email suivant <b>%s</b> en lui indiquant le code erreur <b>%s</b> dans votre message ou mieux en fournissant une copie d'écran de cette page. ErrorContactEMail=Une erreur technique est apparue. Merci de contacter l'administrateur à l'email suivant <b>%s</b> en lui indiquant le code erreur <b>%s</b> dans votre message ou mieux en fournissant une copie d'écran de cette page.
ErrorWrongValueForField=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' ne respecte pas la règle <b>%s</b>) ErrorWrongValueForField=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' ne respecte pas la règle <b>%s</b>)
ErrorFieldValueNotIn=Mauvaise valeur pour le champ numéro <b>%s</b> (la valeur '<b>%s</b>' n'est pas une valeure présente dans le champ <b>%s</b> de la table <b>%s</b>)
ErrorsOnXLines=Erreurs sur <b>%s</b> lignes sources ErrorsOnXLines=Erreurs sur <b>%s</b> lignes sources
WarningsOnXLines=Alertes sur <b>%s</b> lignes sources WarningsOnXLines=Alertes sur <b>%s</b> lignes sources
ErrorFileIsInfectedWithAVirus=L'antivirus n'a pas pu valider ce fichier (il est probablement infecté par un virus) ! ErrorFileIsInfectedWithAVirus=L'antivirus n'a pas pu valider ce fichier (il est probablement infecté par un virus) !

View File

@ -25,11 +25,30 @@
*/ */
/** \brief Converti les heures et minutes en secondes /**
* \param iHours Heures * Add a delay to a date
* \param iMinutes Minutes * @param time Date timestamp ou au format YYYY-MM-DD
* \param iSeconds Secondes * @param duration_value Value of delay to add
* \return iResult Temps en secondes * @param duration_unit Unit of added delay (d, m, y)
* @return int New timestamp
*/
function dol_time_plus_duree($time,$duration_value,$duration_unit)
{
if ($duration_value == 0) return $time;
if ($duration_value > 0) $deltastring="+".abs($duration_value);
if ($duration_value < 0) $deltastring="-".abs($duration_value);
if ($duration_unit == 'd') { $deltastring.=" day"; }
if ($duration_unit == 'm') { $deltastring.=" month"; }
if ($duration_unit == 'y') { $deltastring.=" year"; }
return strtotime($deltastring,$time);
}
/** Converti les heures et minutes en secondes
* @param iHours Heures
* @param iMinutes Minutes
* @param iSeconds Secondes
* @return iResult Temps en secondes
*/ */
function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0) function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
{ {
@ -38,13 +57,12 @@ function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
} }
/** \brief Return, in clear text, value of a number of seconds in days, hours and minutes /** Return, in clear text, value of a number of seconds in days, hours and minutes
* \param iSecond Number of seconds * @param iSecond Number of seconds
* \param format Output format (all: complete display, hour: displays only hours, min: displays only minutes) * @param format Output format (all: complete display, hour: displays only hours, min: displays only minutes)
* \param lengthOfDay Length of day (default 86400 seconds) * @param lengthOfDay Length of day (default 86400 seconds)
* \return sTime Formated text of duration * @return sTime Formated text of duration
* \example 0 return 00:00, 3600 return 1:00, 86400 return 1d, 90000 return 1 Day 01:00 * @example 0 return 00:00, 3600 return 1:00, 86400 return 1d, 90000 return 1 Day 01:00
*
*/ */
function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400) function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400)
{ {
@ -86,10 +104,10 @@ function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400)
} }
/** \brief Return previous month /** Return previous month
* \param month Month * @param month Month
* \param year Year * @param year Year
* \return array Previous year,month * @return array Previous year,month
*/ */
function dol_get_prev_month($month, $year) function dol_get_prev_month($month, $year)
{ {
@ -106,10 +124,10 @@ function dol_get_prev_month($month, $year)
return array('year' => $prev_year, 'month' => $prev_month); return array('year' => $prev_year, 'month' => $prev_month);
} }
/** \brief Return next month /** Return next month
* \param month Month * @param month Month
* \param year Year * @param year Year
* \return array Next year,month * @return array Next year,month
*/ */
function dol_get_next_month($month, $year) function dol_get_next_month($month, $year)
{ {
@ -127,13 +145,13 @@ function dol_get_next_month($month, $year)
} }
/** \brief Return GMT time for first day of a month or year /** Return GMT time for first day of a month or year
* \param year Year * @param year Year
* \param month Month * @param month Month
* \param gm False = Return date to compare with server TZ, True to compare with GM date. * @param gm False = Return date to compare with server TZ, True to compare with GM date.
* Exemple: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, after a dol_print_date will return 1970-01-01 00:00:00 * Exemple: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, after a dol_print_date will return 1970-01-01 00:00:00
* Exemple: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, after a dol_print_date will return 1970-01-01 00:00:00 * Exemple: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, after a dol_print_date will return 1970-01-01 00:00:00
* \return Timestamp Date for first day * @return Timestamp Date for first day
*/ */
function dol_get_first_day($year,$month=1,$gm=false) function dol_get_first_day($year,$month=1,$gm=false)
{ {
@ -141,11 +159,11 @@ function dol_get_first_day($year,$month=1,$gm=false)
} }
/** \brief Return GMT time for last day of a month or year /** Return GMT time for last day of a month or year
* \param year Year * @param year Year
* \param month Month * @param month Month
* \param gm False = Return date to compare with server TZ, True to compare with GM date. * @param gm False = Return date to compare with server TZ, True to compare with GM date.
* \return Timestamp Date for first day * @return Timestamp Date for first day
*/ */
function dol_get_last_day($year,$month=12,$gm=false) function dol_get_last_day($year,$month=12,$gm=false)
{ {
@ -168,11 +186,11 @@ function dol_get_last_day($year,$month=12,$gm=false)
/** /**
* \brief Fonction retournant le nombre de jour fieries samedis et dimanches entre 2 dates entrees en timestamp * Fonction retournant le nombre de jour fieries samedis et dimanches entre 2 dates entrees en timestamp
* \remarks Called by function num_open_day * @remarks Called by function num_open_day
* \param timestampStart Timestamp de debut * @param timestampStart Timestamp de debut
* \param timestampEnd Timestamp de fin * @param timestampEnd Timestamp de fin
* \return nbFerie Nombre de jours feries * @return nbFerie Nombre de jours feries
*/ */
function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR') function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
{ {
@ -266,11 +284,11 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
} }
/** /**
* \brief Fonction retournant le nombre de jour entre deux dates * Fonction retournant le nombre de jour entre deux dates
* \param timestampStart Timestamp de debut * @param timestampStart Timestamp de debut
* \param timestampEnd Timestamp de fin * @param timestampEnd Timestamp de fin
* \param lastday On prend en compte le dernier jour, 0: non, 1:oui * @param lastday On prend en compte le dernier jour, 0: non, 1:oui
* \return nbjours Nombre de jours * @return nbjours Nombre de jours
*/ */
function num_between_day($timestampStart, $timestampEnd, $lastday=0) function num_between_day($timestampStart, $timestampEnd, $lastday=0)
{ {
@ -290,12 +308,12 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
} }
/** /**
* \brief Fonction retournant le nombre de jour entre deux dates sans les jours feries (jours ouvres) * Fonction retournant le nombre de jour entre deux dates sans les jours feries (jours ouvres)
* \param timestampStart Timestamp de debut * @param timestampStart Timestamp de debut
* \param timestampEnd Timestamp de fin * @param timestampEnd Timestamp de fin
* \param inhour 0: sort le nombre de jour , 1: sort le nombre d'heure (72 max) * @param inhour 0: sort le nombre de jour , 1: sort le nombre d'heure (72 max)
* \param lastday On prend en compte le dernier jour, 0: non, 1:oui * @param lastday On prend en compte le dernier jour, 0: non, 1:oui
* \return nbjours Nombre de jours ou d'heures * @return nbjours Nombre de jours ou d'heures
*/ */
function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0) function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
{ {

View File

@ -24,16 +24,16 @@
*/ */
/** /**
* \brief Scan a directory and return a list of files/directories. Content for string is UTF8. * Scan a directory and return a list of files/directories. Content for string is UTF8.
* \param $path Starting path from which to search * @param $path Starting path from which to search
* \param $types Can be "directories", "files", or "all" * @param $types Can be "directories", "files", or "all"
* \param $recursive Determines whether subdirectories are searched * @param $recursive Determines whether subdirectories are searched
* \param $filter Regex for include filter * @param $filter Regex for include filter
* \param $exludefilter Regex for exclude filter (example: '\.meta$') * @param $exludefilter Regex for exclude filter (example: '\.meta$')
* \param $sortcriteria Sort criteria ("name","date","size") * @param $sortcriteria Sort criteria ("name","date","size")
* \param $sortorder Sort order (SORT_ASC, SORT_DESC) * @param $sortorder Sort order (SORT_ASC, SORT_DESC)
* \param $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower) * @param $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower)
* \return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file') * @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
*/ */
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0) function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
{ {

View File

@ -393,8 +393,8 @@ function dol_fiche_head($links, $active='0', $title='', $notab=0, $picto='')
} }
/** /**
* \brief Show tab footer of a card * Show tab footer of a card
* \param notab 0=Add tab footer, 1=no tab footer * @param notab 0=Add tab footer, 1=no tab footer
*/ */
function dol_fiche_end($notab=0) function dol_fiche_end($notab=0)
{ {
@ -402,25 +402,6 @@ function dol_fiche_end($notab=0)
} }
/**
* \brief Add a delay to a date
* \param time Date timestamp ou au format YYYY-MM-DD
* \param duration_value Value of delay to add
* \param duration_unit Unit of added delay (d, m, y)
* \return int New timestamp
*/
function dol_time_plus_duree($time,$duration_value,$duration_unit)
{
if ($duration_value == 0) return $time;
if ($duration_value > 0) $deltastring="+".abs($duration_value);
if ($duration_value < 0) $deltastring="-".abs($duration_value);
if ($duration_unit == 'd') { $deltastring.=" day"; }
if ($duration_unit == 'm') { $deltastring.=" month"; }
if ($duration_unit == 'y') { $deltastring.=" year"; }
return strtotime($deltastring,$time);
}
/* For backward compatibility */ /* For backward compatibility */
function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodetooutput=false) function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodetooutput=false)
{ {

View File

@ -475,8 +475,6 @@ if ($_REQUEST["amount"] == 'contractline')
//} //}
if ($contractline->date_fin_validite) if ($contractline->date_fin_validite)
{ {
//$dateactend = dol_time_plus_duree ($contractline->date_fin_validite, $product->duration_value, $product->duration_unit);
//print ', '.$langs->trans("DateEndPlanned").': '.dol_print_date($contractline->date_fin_validite);
$text.='<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite); $text.='<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite);
} }

View File

@ -1,6 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -42,6 +42,7 @@ $forcecommit=0;
require_once($path."../../htdocs/master.inc.php"); require_once($path."../../htdocs/master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php");