Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into mko559

This commit is contained in:
Maxime Kohlhaas 2012-10-26 01:00:22 +02:00
commit fc7bc7e5d9
44 changed files with 2996 additions and 2270 deletions

View File

@ -228,16 +228,16 @@ print '<td align="center" valign="top">';
print '<table class="border" width="100%">';
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
$filter='s.client in (1,2,3)';
print $form->select_company($socid,'socid',$filter,1);
print '</td></tr>';
// User
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
print '<tr><td align="left">'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td align="left">';
print $form->select_users($userid,'userid',1);
print '</td></tr>';
// Year
print '<tr><td>'.$langs->trans("Year").'</td><td>';
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
arsort($arrayyears);
print $form->selectarray('year',$arrayyears,$year,0);

View File

@ -1521,7 +1521,22 @@ class Commande extends CommonOrder
$nb=0;
foreach($this->lines as $line)
{
if ($line->fk_product_type == 0) $nb++;
if ($line->product_type == 0) $nb++;
}
return $nb;
}
/**
* Return number of line with type service.
*
* @return int <0 if KO, Nbr of service lines if OK
*/
function getNbOfServicesLines()
{
$nb=0;
foreach($this->lines as $line)
{
if ($line->product_type == 1) $nb++;
}
return $nb;
}

View File

@ -1382,8 +1382,8 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty();
$projectid = (!empty($objectsrc->fk_project)?$object->fk_project:'');
$ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
$ref_client = (!empty($objectsrc->ref_client)?$objectsrc->ref_client:'');
$soc = $objectsrc->client;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));

View File

@ -249,17 +249,17 @@ print '<td align="center" valign="top">';
print '<table class="border" width="100%">';
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1';
print $form->select_company($socid,'socid',$filter,1);
print '</td></tr>';
// User
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
print '<tr><td align="left">'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td align="left">';
print $form->select_users($userid,'userid',1);
print '</td></tr>';
// Year
print '<tr><td>'.$langs->trans("Year").'</td><td>';
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
arsort($arrayyears);
print $form->selectarray('year',$arrayyears,$year,0);

View File

@ -66,21 +66,21 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
$subelement = $regs[2];
}
if ($element == 'propal') $element = 'propale';
else if ($element == 'fichinter') $element = 'ficheinter';
else if ($element == 'product') $element = 'produit';
else if ($element == 'member') $element = 'adherent';
if ($element == 'propal') $newelement = 'propale';
else if ($element == 'fichinter') $newelement = 'ficheinter';
else if ($element == 'product') $newelement = 'produit';
else if ($element == 'member') $newelement = 'adherent';
else if ($element == 'order_supplier') {
$element = 'fournisseur';
$newelement = 'fournisseur';
$subelement = 'commande';
}
else if ($element == 'invoice_supplier') {
$element = 'fournisseur';
$newelement = 'fournisseur';
$subelement = 'facture';
}
if (! empty($user->rights->$element->creer) || ! empty($user->rights->$element->write)
|| (isset($subelement) && (! empty($user->rights->$element->$subelement->creer) || ! empty($user->rights->$element->$subelement->write)))
if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->write)
|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
|| ($element == 'payment' && $user->rights->facture->paiement)
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
{

View File

@ -38,9 +38,11 @@ class ExtraFields
var $attribute_label;
// Tableau contenant le nom des champs en clef et la taille de ces champs en value
var $attribute_size;
// Tableau contenant le statut unique ou non
// Array to store if attribute is unique or not
var $attribute_unique;
// Array to store if attribute is required or not
var $attribute_required;
var $error;
var $errno;
@ -67,6 +69,7 @@ class ExtraFields
$this->attribute_size = array();
$this->attribute_elementtype = array();
$this->attribute_unique = array();
$this->attribute_required = array();
}
/**
@ -79,20 +82,21 @@ class ExtraFields
* @param int $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @return int <=0 if KO, >0 if OK
*/
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0)
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0)
{
if (empty($attrname)) return -1;
if (empty($label)) return -1;
// Create field into database
$result=$this->create($attrname,$type,$size,$elementtype);
$result=$this->create($attrname,$type,$size,$elementtype, $unique);
$err1=$this->errno;
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS')
{
// Add declaration of field into table
$result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique);
$result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required);
$err2=$this->errno;
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
{
@ -115,26 +119,23 @@ class ExtraFields
* @param string $attrname code of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour')
* @param int $length Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @return int <=0 if KO, >0 if OK
*/
private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0)
private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0)
{
$table='';
$table=$elementtype.'_extrafields';
// Special case for not normalized table names
if ($elementtype == 'member') $table='adherent_extrafields';
if ($elementtype == 'company') $table='societe_extrafields';
if ($elementtype == 'contact') $table='socpeople_extrafields';
if ($elementtype == 'product') $table='product_extrafields';
if (empty($table))
{
print 'ErrorBarValueForParameters';
return -1;
}
elseif ($elementtype == 'company') $table='societe_extrafields';
elseif ($elementtype == 'contact') $table='socpeople_extrafields';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{
$field_desc = array('type'=>$type, 'value'=>$length);
$field_desc = array('type'=>$type, 'value'=>$length, 'null'=>($required?'NOT NULL':'NULL'));
$result=$this->db->DDLAddField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
if ($result > 0)
{
@ -168,9 +169,10 @@ class ExtraFields
* @param int $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @return int <=0 if KO, >0 if OK
*/
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0)
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0)
{
global $conf;
@ -180,7 +182,7 @@ class ExtraFields
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired)";
$sql.= " VALUES('".$attrname."',";
$sql.= " '".$this->db->escape($label)."',";
$sql.= " '".$type."',";
@ -188,7 +190,8 @@ class ExtraFields
$sql.= " '".$size."',";
$sql.= " ".$conf->entity.",";
$sql.= " '".$elementtype."',";
$sql.= " '".$unique."'";
$sql.= " '".$unique."',";
$sql.= " '".$required."'";
$sql.=')';
dol_syslog(get_class($this)."::create_label sql=".$sql);
@ -209,21 +212,17 @@ class ExtraFields
* Delete an optionnal attribute
*
* @param string $attrname Code of attribute to delete
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...)
* @return int < 0 if KO, 0 if nothing is done, 1 if OK
*/
function delete($attrname, $elementtype='member')
{
$table='';
if ($elementtype == 'member') $table='adherent_extrafields';
if ($elementtype == 'company') $table='societe_extrafields';
if ($elementtype == 'contact') $table='socpeople_extrafields';
if ($elementtype == 'product') $table='product_extrafields';
if (empty($table))
{
print 'ErrorBarValueForParameters';
return -1;
}
$table=$elementtype.'_extrafields';
// Special case for not normalized table names
if ($elementtype == 'member') $table='adherent_extrafields';
elseif ($elementtype == 'company') $table='societe_extrafields';
elseif ($elementtype == 'contact') $table='socpeople_extrafields';
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{
@ -289,32 +288,29 @@ class ExtraFields
* @param string $label Label of attribute
* @param string $type Type of attribute
* @param int $length Length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @return int >0 if OK, <=0 if KO
*/
function update($attrname,$label,$type,$length,$elementtype,$unique=0)
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0)
{
$table='';
$table=$elementtype.'_extrafields';
// Special case for not normalized table names
if ($elementtype == 'member') $table='adherent_extrafields';
if ($elementtype == 'company') $table='societe_extrafields';
if ($elementtype == 'contact') $table='socpeople_extrafields';
if ($elementtype == 'product') $table='product_extrafields';
if (empty($table))
{
print 'ErrorBarValueForParameters';
return -1;
}
elseif ($elementtype == 'company') $table='societe_extrafields';
elseif ($elementtype == 'contact') $table='socpeople_extrafields';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{
$field_desc = array('type'=>$type, 'value'=>$length);
$field_desc = array('type'=>$type, 'value'=>$length, 'null'=>($required?'NOT NULL':'NULL'));
$result=$this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
if ($result > 0)
{
if ($label)
{
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique);
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required);
}
if ($result > 0)
{
@ -359,9 +355,10 @@ class ExtraFields
* @param int $size Length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @return int <=0 if KO, >0 if OK
*/
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0)
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0)
{
global $conf;
dol_syslog(get_class($this)."::update_label $attrname,$label,$type,$size");
@ -384,7 +381,8 @@ class ExtraFields
$sql.= " type,";
$sql.= " size,";
$sql.= " elementtype,";
$sql.= " fieldunique";
$sql.= " fieldunique,";
$sql.= " fieldrequired";
$sql.= ") VALUES (";
$sql.= "'".$attrname."',";
$sql.= " ".$conf->entity.",";
@ -392,7 +390,8 @@ class ExtraFields
$sql.= " '".$type."',";
$sql.= " '".$size."',";
$sql.= " '".$elementtype."',";
$sql.= " '".$unique."'";
$sql.= " '".$unique."',";
$sql.= " '".$required."'";
$sql.= ")";
dol_syslog(get_class($this)."::update_label sql=".$sql);
$resql2=$this->db->query($sql);
@ -440,7 +439,7 @@ class ExtraFields
$array_name_label=array();
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique";
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity = ".$conf->entity;
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";
@ -461,6 +460,7 @@ class ExtraFields
$this->attribute_size[$tab->name]=$tab->size;
$this->attribute_elementtype[$tab->name]=$tab->elementtype;
$this->attribute_unique[$tab->name]=$tab->fieldunique;
$this->attribute_required[$tab->name]=$tab->fieldrequired;
}
}
return $array_name_label;
@ -489,6 +489,7 @@ class ExtraFields
$size =$this->attribute_size[$key];
$elementtype=$this->attribute_elementtype[$key];
$unique=$this->attribute_unique[$key];
$required=$this->attribute_required[$key];
if ($type == 'date')
{
$showsize=10;
@ -550,6 +551,7 @@ class ExtraFields
$size=$this->attribute_size[$key];
$elementtype=$this->attribute_elementtype[$key];
$unique=$this->attribute_unique[$key];
$required=$this->attribute_required[$key];
if ($type == 'date')
{
$showsize=10;

View File

@ -89,7 +89,7 @@ class Form
// TODO change for compatibility
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;/',$typeofdata))
{
if ($perm)
if (! empty($perm))
{
$tmp=explode(':',$typeofdata);
$ret.= '<div class="editkey_'.$tmp[0].(! empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';

View File

@ -38,12 +38,17 @@ $(document).ready(function () {
} else {
dst = "1"; // daylight savings time is observed
}
var tz=new Date().toTimeString().match(/\(.*\)/);
var now=new Date();
var tz=now.toTimeString().match(/\(.*\)/);
//alert('date=' + now + ' string=' + now.toTimeString());
var dst_first=DisplayDstSwitchDates('first');
var dst_second=DisplayDstSwitchDates('second');
//alert(dst);
$('#tz').val(std_time_offset); // returns TZ
$('#tz_string').val(tz[0].replace('(','').replace(')','')); // returns TZ string
// tz is null with IE
if (tz != null) {
$('#tz_string').val(tz[0].replace('(','').replace(')','')); // returns TZ string
}
$('#dst_observed').val(dst); // returns if DST is observed on summer
$('#dst_first').val(dst_first); // returns DST first switch in year
$('#dst_second').val(dst_second); // returns DST second switch in year

View File

@ -718,9 +718,10 @@ function delConstant(url, code, input, entity) {
*
*/
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) {
var boxConfirm = box;
$("#confirm_" + code)
.attr("title", box.title)
.html(box.content)
.attr("title", boxConfirm.title)
.html(boxConfirm.content)
.dialog({
resizable: false,
height: 170,
@ -737,9 +738,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
}
// Close dialog
$(this).dialog("close");
// Execute another function
if (box.function) {
var fnName = box.function;
// Execute another method
if (boxConfirm.method) {
var fnName = boxConfirm.method;
if (window.hasOwnProperty(fnName)) {
window[fnName]();
}

View File

@ -642,7 +642,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
}
else
{
$out.='<a id="'.$links[$i][2].'" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
$out.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
}
}
}

View File

@ -87,7 +87,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
function getDriverLabel()
function getDriverLabel($key='')
{
return $this->label;
}
@ -97,7 +97,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
function getDriverDesc()
function getDriverDesc($key='')
{
return $this->desc;
}
@ -117,7 +117,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
function getDriverVersion()
function getDriverVersion($key='')
{
return $this->version;
}
@ -127,7 +127,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
function getLibLabel()
function getLibLabel($key='')
{
return $this->label_lib;
}
@ -137,7 +137,7 @@ class ExportCsv extends ModeleExports
*
* @return string
*/
function getLibVersion()
function getLibVersion($key='')
{
return $this->version_lib;
}

View File

@ -87,7 +87,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
function getDriverLabel()
function getDriverLabel($key='')
{
return $this->label;
}
@ -97,7 +97,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
function getDriverDesc()
function getDriverDesc($key='')
{
return $this->desc;
}
@ -117,7 +117,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
function getDriverVersion()
function getDriverVersion($key='')
{
return $this->version;
}
@ -127,7 +127,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
function getLibLabel()
function getLibLabel($key='')
{
return $this->label_lib;
}
@ -137,7 +137,7 @@ class ExportExcel extends ModeleExports
*
* @return string
*/
function getLibVersion()
function getLibVersion($key='')
{
return $this->version_lib;
}

View File

@ -88,7 +88,7 @@ class ExportExcel2007 extends ExportExcel
*
* @return string
*/
function getDriverLabel()
function getDriverLabel($key='')
{
return $this->label;
}
@ -98,7 +98,7 @@ class ExportExcel2007 extends ExportExcel
*
* @return string
*/
function getDriverDesc()
function getDriverDesc($key='')
{
return $this->desc;
}
@ -118,7 +118,7 @@ class ExportExcel2007 extends ExportExcel
*
* @return string
*/
function getDriverVersion()
function getDriverVersion($key='')
{
return $this->version;
}
@ -128,7 +128,7 @@ class ExportExcel2007 extends ExportExcel
*
* @return string
*/
function getLibLabel()
function getLibLabel($key='')
{
return $this->label_lib;
}
@ -138,7 +138,7 @@ class ExportExcel2007 extends ExportExcel
*
* @return string
*/
function getLibVersion()
function getLibVersion($key='')
{
return $this->version_lib;
}

View File

@ -82,7 +82,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
function getDriverLabel()
function getDriverLabel($key='')
{
return $this->label;
}
@ -92,7 +92,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
function getDriverDesc()
function getDriverDesc($key='')
{
return $this->desc;
}
@ -112,7 +112,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
function getDriverVersion()
function getDriverVersion($key='')
{
return $this->version;
}
@ -122,7 +122,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
function getLibLabel()
function getLibLabel($key='')
{
return $this->label_lib;
}
@ -132,7 +132,7 @@ class ExportTsv extends ModeleExports
*
* @return string
*/
function getLibVersion()
function getLibVersion($key='')
{
return $this->version_lib;
}

View File

@ -173,7 +173,8 @@ class modAdherent extends DolibarrModules
$this->export_label[$r]='MembersAndSubscriptions';
$this->export_permission[$r]=array(array("adherent","export"));
$this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civilite'=>"UserTitle",'a.nom'=>"Lastname",'a.prenom'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','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.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount');
$this->export_entities_array[$r]=array('a.rowid'=>'member','a.civilite'=>"member",'a.nom'=>"member",'a.prenom'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.adresse'=>"member",'a.cp'=>"member",'a.ville'=>"member",'a.pays'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.naiss'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription');
$this->export_TypeFields_array[$r]=array('a.civilite'=>"Text",'a.nom'=>"Text",'a.prenom'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.adresse'=>"Text",'a.cp'=>"Text",'a.ville'=>"Text",'a.pays'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.naiss'=>"Date",'a.statut'=>"Status",'a.note'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:fk_adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Number');
$this->export_entities_array[$r]=array('a.rowid'=>'member','a.civilite'=>"member",'a.nom'=>"member",'a.prenom'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.adresse'=>"member",'a.cp'=>"member",'a.ville'=>"member",'a.pays'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.naiss'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription');
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member'";
$resql=$this->db->query($sql);
@ -208,7 +209,7 @@ class modAdherent extends DolibarrModules
$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'=>"UserTitle",'a.nom'=>"Lastname*",'a.prenom'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','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');
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member'";
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
@ -216,7 +217,7 @@ class modAdherent extends DolibarrModules
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel;
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
}
}
// End add extra fields

View File

@ -145,6 +145,7 @@ class modBanque extends DolibarrModules
$this->export_label[$r]='Ecritures bancaires et releves';
$this->export_permission[$r]=array(array("banque","export"));
$this->export_fields_array[$r]=array('b.rowid'=>'IdTransaction','ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label','b.num_chq'=>'ChequeOrTransferNumber','-b.amount'=>'Debit','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","s.code_compta_fournisseur"=>"SupplierAccountancyCode");
$this->export_TypeFields_array[$r]=array('ba.ref'=>'Text','ba.label'=>'Text','b.datev'=>'Date','b.dateo'=>'Date','b.label'=>'Text','b.num_chq'=>'Text','-b.amount'=>'Number','b.amount'=>'Number','b.num_releve'=>'Text','b.datec'=>"Date","bu.url_id"=>"Text","s.nom"=>"Text","s.code_compta"=>"Text","s.code_compta_fournisseur"=>"Text");
$this->export_entities_array[$r]=array('b.rowid'=>'account','ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.dateo'=>'account','b.label'=>'account','b.num_chq'=>'account','-b.amount'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account","bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company");
$this->export_special_array[$r]=array('-b.amount'=>'NULLIFNEG','b.amount'=>'NULLIFNEG');
if (empty($conf->fournisseur->enabled))

View File

@ -110,6 +110,7 @@ class modCategorie extends DolibarrModules
$this->export_enabled[$r]='$conf->fournisseur->enabled';
$this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire"));
$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note");
$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.cp'=>"Text",'s.ville'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.tel'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note'=>"Text");
$this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company"); // We define here only fields that use another picto
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_fournisseur 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';
@ -124,6 +125,7 @@ class modCategorie extends DolibarrModules
$this->export_enabled[$r]='$conf->societe->enabled';
$this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire"));
$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus');
$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.cp'=>"Text",'s.ville'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.tel'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code');
$this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company",'s.fk_prospectlevel'=>'company','s.fk_stcomm'=>'company'); // We define here only fields that use another picto
$this->export_sql_start[$r]='SELECT DISTINCT ';
$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';
@ -138,6 +140,7 @@ class modCategorie extends DolibarrModules
$this->export_enabled[$r]='$conf->produit->enabled';
$this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire"));
$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref');
$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.rowid'=>'List:Product:label','p.ref'=>'Text');
$this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p';
@ -152,31 +155,29 @@ class modCategorie extends DolibarrModules
$this->export_enabled[$r]='$conf->adherent->enabled';
$this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire"));
$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.nom'=>'LastName','p.prenom'=>'Firstname');
$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.rowid'=>'List:adherent:nom','p.nom'=>'Text','p.prenom'=>'Text');
$this->export_entities_array[$r]=array('p.rowid'=>'member','p.nom'=>'member','p.prenom'=>'member'); // We define here only fields that use another picto
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p';
$this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid';
$this->export_sql_end[$r] .=' AND u.entity = '.$conf->entity;
$this->export_sql_end[$r] .=' AND u.type = 3'; // Supplier categories
// Imports
//--------
$r=0;
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="CatList"; // Translation key
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie');
$this->import_fields_array[$r]=array('ca.label'=>"Label*",
'ca.type'=>"Type*",'ca.description'=>"Description"
);
$this->import_fields_array[$r]=array('ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description");
$this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]');
$this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",
'ca.type'=>"1", 'ca.description'=>"Imported category");
$this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>"1",'ca.description'=>"Imported category");
}

View File

@ -174,6 +174,7 @@ class modCommande extends DolibarrModules
$this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("commande","commande","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','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','s.libelle'=>'List:c_pays:libelle:rowid','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Number",'c.remise_percent'=>"Number",'c.total_ht'=>"Number",'c.total_ttc'=>"Number",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Number",'cd.qty'=>"Number",'cd.total_ht'=>"Number",'cd.total_tva'=>"Number",'cd.total_ttc'=>"Number",'p.rowid'=>'List:Product:ref','p.ref'=>'Text','p.label'=>'Text');
$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.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -121,6 +121,7 @@ class modDeplacement extends DolibarrModules
$this->export_label[$r]='ListTripsAndExpenses';
$this->export_permission[$r]=array(array("deplacement","export"));
$this->export_fields_array[$r]=array('u.login'=>'Login','u.name'=>'Lastname','u.firstname'=>'Firstname','d.rowid'=>"TripId",'d.type'=>"Type",'d.km'=>"FeesKilometersOrAmout",'d.dated'=>"Date",'d.note'=>'NotePrivate','d.note_public'=>'NotePublic','s.nom'=>'ThirdParty');
$this->export_TypeFields_array[$r]=array('u.rowid'=>'List:user:name','u.login'=>'Text','u.name'=>'Text','u.firstname'=>'Text','d.type'=>"Text",'d.km'=>"Number",'d.dated'=>"Date",'d.note'=>'Text','d.note_public'=>'Text','s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text');
$this->export_entities_array[$r]=array('u.login'=>'user','u.name'=>'user','u.firstname'=>'user','d.rowid'=>"trip",'d.type'=>"trip",'d.km'=>"trip",'d.dated'=>"trip",'d.note'=>'trip','d.note_public'=>'trip','s.nom'=>'company');
$this->export_dependencies_array[$r]=array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them

View File

@ -175,6 +175,7 @@ class modFacture extends DolibarrModules
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"Label",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'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','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
@ -193,6 +194,7 @@ class modFacture extends DolibarrModules
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'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','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -139,6 +139,7 @@ class modFicheinter extends DolibarrModules
$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_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','s.fk_pays'=>'List:c_pays:libelle','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric");
$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_dependencies_array[$r]=array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -243,6 +243,7 @@ class modFournisseur extends DolibarrModules
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("fournisseur","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
@ -260,6 +261,7 @@ class modFournisseur extends DolibarrModules
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("fournisseur","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
@ -278,6 +280,7 @@ class modFournisseur extends DolibarrModules
$this->export_icon[$r]='order';
$this->export_permission[$r]=array(array("fournisseur","commande","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.note'=>"Note",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
//$this->export_TypeFields_array[$r]=array(); // TODO add fields type
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"order",'f.ref'=>"order",'f.ref_supplier'=>"order",'f.date_creation'=>"order",'f.date_commande'=>"order",'f.total_ht'=>"order",'f.total_ttc'=>"order",'f.tva'=>"order",'f.fk_statut'=>'order','f.note'=>"order",'fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -138,6 +138,9 @@ class modProduct extends DolibarrModules
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.pmp'=>'PMPValue'));
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.pmp'=>'Number'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product");
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product'));
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product'));
@ -175,7 +178,7 @@ class modProduct extends DolibarrModules
$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.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','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.datec'=>'DateCreation*');
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
@ -183,15 +186,15 @@ class modProduct extends DolibarrModules
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel;
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
}
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31');
if (! empty($conf->fournisseur->enabled))
{
// Import product suppliers

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -134,6 +134,35 @@ class modProjet extends DolibarrModules
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'all';
$this->rights[$r][5] = 'supprimer';
//Exports
//--------
$r=1;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("projet","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',
'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote",
'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.duration_planned'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc");
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','s.fk_pays'=>'List:c_pays:libelle',
's.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text",
'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.duration_planned'=>"Duree",'pt.progress'=>"Number",'pt.description'=>"Text");
$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'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project",
'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.duration_planned'=>"task",'pt.progress'=>"task",'pt.description'=>"task");
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'projet_task as pt, '.MAIN_DB_PREFIX.'societe as s)';
$this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid AND p.rowid = pt.fk_projet ';
$this->export_sql_end[$r] .=' AND p.entity = '.$conf->entity;
$r++;
}

View File

@ -168,6 +168,7 @@ class modPropale extends DolibarrModules
$this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("propale","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','cp.code'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','cp.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','cp.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -122,6 +122,8 @@ class modService extends DolibarrModules
$this->export_permission[$r]=array(array("service","export"));
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock'));
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date');
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Number'));
$this->export_entities_array[$r]=array('p.rowid'=>"service",'p.ref'=>"service",'p.label'=>"service",'p.description'=>"service",'p.accountancy_code_sell'=>'service','p.accountancy_code_sell'=>'service','p.note'=>"service",'p.price_base_type'=>"service",'p.price'=>"service",'p.price_ttc'=>"service",'p.tva_tx'=>"service",'p.tosell'=>"service",'p.duration'=>"service",'p.datec'=>"service",'p.tms'=>"service");
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product'));
// Add extra fields
@ -137,7 +139,7 @@ class modService extends DolibarrModules
$this->export_entities_array[$r][$fieldname]='product';
}
}
// End add axtra fields
// End add extra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
@ -158,7 +160,7 @@ class modService extends DolibarrModules
$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.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','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.datec'=>'DateCreation*');
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
@ -166,7 +168,7 @@ class modService extends DolibarrModules
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel;
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
}
}
// End add extra fields

View File

@ -247,8 +247,9 @@ class modSociete extends DolibarrModules
$this->export_label[$r]='ExportDataset_company_1';
$this->export_icon[$r]='company';
$this->export_permission[$r]=array(array("societe","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.status'=>"Status",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.default_lang'=>"DefaultLang",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Staff","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','d.nom'=>'State');
$this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.status'=>"Status",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.default_lang'=>"DefaultLang",'s.siren'=>"ProfId1",'s.siret'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Staff","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','d.nom'=>'State');
if (! empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix']='Prefix';
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Text",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.address'=>"Text",'s.cp'=>"Text",'s.ville'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.tel'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Number",'s.note'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'List:c_departements:nom:rowid');
$this->export_entities_array[$r]=array(); // We define here only fields that use another picto
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'";
@ -321,7 +322,7 @@ class modSociete extends DolibarrModules
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe','extra'=>MAIN_DB_PREFIX.'societe_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.code_compta'=>"CustomerAccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Staff","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation");
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'";
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
@ -329,7 +330,7 @@ class modSociete extends DolibarrModules
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel;
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
}
}
// End add extra fields
@ -355,6 +356,19 @@ class modSociete extends DolibarrModules
$this->import_entities_array[$r]=array('s.fk_soc'=>'company'); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'UserTitle','s.name'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note'=>"Note",'s.datec'=>"DateCreation");
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'contact'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
}
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('s.fk_user_creat'=>'user->id'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r]=array(
's.fk_soc'=>array('rule'=>'fetchidfromref','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'),
@ -363,7 +377,7 @@ class modSociete extends DolibarrModules
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('s.birthday'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('s.fk_soc'=>'MyBigCompany','s.civilite'=>"MR",'s.name'=>"Smith",'s.firstname'=>'John','s.address'=>'61 jump street','s.cp'=>'75000','s.ville'=>'Bigtown','s.fk_pays'=>'US, FR, DE...','s.datec'=>'1972-10-10','s.poste'=>"Director",'s.phone'=>"5551122",'s.phone_perso'=>"5551133",'s.phone_mobile'=>"5551144",'s.fax'=>"5551155",'s.email'=>"johnsmith@email.com",'s.note'=>"My comments");
// Import Bank Accounts
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
@ -373,15 +387,15 @@ class modSociete extends DolibarrModules
$this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_rib');
$this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank",
'sr.code_banque'=>"BankCode*",'sr.code_guichet'=>"DeskCode*",'sr.number'=>"BankAccountNumber*",
'sr.cle_rib'=>"BankAccountNumberKey*",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN"
'sr.cle_rib'=>"BankAccountNumberKey*",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN"
);
$this->import_convertvalue_array[$r]=array(
'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
);
$this->import_examplevalues_array[$r]=array('sr.fk_soc'=>"MyBigCompany",'sr.bank'=>"ING",
'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333",
'sr.cle_rib'=>"22",'sr.bic'=>"USHINGMMXXX",'sr.iban_prefix'=>"US00 0000 1111 22 3333 3333"
'sr.cle_rib'=>"22",'sr.bic'=>"USHINGMMXXX",'sr.iban_prefix'=>"US00 0000 1111 22 3333 3333"
);
}

View File

@ -123,6 +123,7 @@ class modStock extends DolibarrModules
$this->export_label[$r]="WarehousesAndProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("stock","lire"));
$this->export_fields_array[$r]=array('e.rowid'=>'IdWarehouse','e.label'=>'LocationSummary','e.description'=>'DescWareHouse','e.lieu'=>'LieuWareHouse','e.address'=>'Address','e.cp'=>'Zip','e.ville'=>'Town','p.rowid'=>"ProductId",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"Price",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification','ps.reel'=>'Stock');
$this->export_TypeFields_array[$r]=array('e.rowid'=>'List:entrepot:LabelWareHouse','e.label'=>'Text','e.label'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.cp'=>'Text','e.ville'=>'Text','p.rowid'=>"List:produit:label",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",'p.price'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date','ps.reel'=>'Number');
$this->export_entities_array[$r]=array('e.rowid'=>'warehouse','e.label'=>'warehouse','e.description'=>'warehouse','e.lieu'=>'warehouse','e.address'=>'warehouse','e.cp'=>'warehouse','e.ville'=>'warehouse','p.rowid'=>"product",'p.ref'=>"product",'p.fk_product_type'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.tva_tx'=>'product','p.tosell'=>"product",'p.duration'=>"product",'p.datec'=>'product','p.tms'=>'product','ps.reel'=>'stock');
$this->export_aggregate_array[$r]=array('ps.reel'=>'SUM'); // TODO Not used yet
$this->export_dependencies_array[$r]=array('stock'=>array('p.rowid','e.rowid')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
@ -131,13 +132,13 @@ class modStock extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e';
$this->export_sql_end[$r] .=' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid';
$this->export_sql_end[$r] .=' AND e.entity = '.$conf->entity;
// Imports
//--------
$r=0;
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]="Warehouses"; // Translation key
@ -150,7 +151,7 @@ class modStock extends DolibarrModules
'e.address'=>"Address",'e.cp'=>'Zip','e.fk_pays'=>'CountryCode',
'e.statut'=>'Status'
);
$this->import_convertvalue_array[$r]=array(
'e.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cpays.class.php','class'=>'Cpays','method'=>'fetch','dict'=>'DictionnaryCountry')
);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -126,6 +126,7 @@ class modTax extends DolibarrModules
$this->export_label[$r]='Taxes et charges sociales, et leurs reglements';
$this->export_permission[$r]=array(array("tax","charges","export"));
$this->export_fields_array[$r]=array('cc.libelle'=>"Type",'c.rowid'=>"IdSocialContribution",'c.libelle'=>"Label",'c.date_ech'=>'DateDue','c.periode'=>'Period','c.amount'=>"AmountExpected","c.paye"=>"Status",'p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero');
$this->export_TypeFields_array[$r]=array('cc.libelle'=>"List:c_chargesociales:libelle:id",'c.libelle'=>"Text",'c.date_ech'=>'Date','c.periode'=>'Period','c.amount'=>"Number","c.paye"=>"Boolean",'p.datep'=>'Date','p.amount'=>'Number','p.num_paiement'=>'Number');
$this->export_entities_array[$r]=array('cc.libelle'=>"tax_type",'c.rowid'=>"tax",'c.libelle'=>'tax','c.date_ech'=>'tax','c.periode'=>'tax','c.amount'=>"tax","c.paye"=>"tax",'p.rowid'=>'payment','p.datep'=>'payment','p.amount'=>'payment','p.num_paiement'=>'payment');
$this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@ -210,6 +210,8 @@ class modUser extends DolibarrModules
$this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs';
$this->export_permission[$r]=array(array("user","user","export"));
$this->export_fields_array[$r]=array('u.rowid'=>"Id",'u.login'=>"Login",'u.name'=>"Lastname",'u.firstname'=>"Firstname",'u.office_phone'=>'Telephone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",'u.admin'=>"Admin",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion','u.fk_socpeople'=>"IdContact",'u.fk_societe'=>"IdCompany",'u.fk_member'=>"MemberId");
$this->export_TypeFields_array[$r]=array('u.login'=>"Text",'u.name'=>"Text",'u.firstname'=>"Text",'u.office_phone'=>'Text','u.office_fax'=>'Text','u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date','u.datepreviouslogin'=>'Date','u.fk_societe'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:nom");
$this->export_entities_array[$r]=array('u.rowid'=>"user",'u.login'=>"user",'u.name'=>"user",'u.firstname'=>"user",'u.office_phone'=>'user','u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_societe'=>"company",'u.fk_member'=>"member");
if (empty($conf->adherent->enabled))
{

View File

@ -525,7 +525,7 @@ class pdf_azur extends ModelePDFPropales
}
// Show payments conditions
if (isset($object->type) && $object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement))
if (! empty($conf->global->PROPALE_PDF_PAIEMENT_ENABLED) && ($object->cond_reglement_code || $object->cond_reglement))
{
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
@ -542,7 +542,7 @@ class pdf_azur extends ModelePDFPropales
}
if (isset($object->type) && $object->type != 2)
if (! empty($conf->global->PROPALE_PDF_PAIEMENT_ENABLED))
{
// Check a payment mode is defined
if (empty($object->mode_reglement_code)

View File

@ -65,9 +65,10 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
{
global $conf, $user, $langs;
@ -136,7 +137,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -132,7 +132,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
{
global $user,$langs,$conf,$mysoc;
@ -284,10 +284,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
@ -809,9 +809,10 @@ if ($pageposafter > $pageposbefore) {
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
{
global $langs,$conf,$mysoc;
@ -887,6 +888,12 @@ if ($pageposafter > $pageposbefore) {
$pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R');
}
$posy+=2;
$pdf->SetTextColor(0,0,60);
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
if ($showaddress)
{
// Sender properties

View File

@ -147,9 +147,10 @@ abstract class ModeleNumRefSuppliersOrders
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
{
global $conf, $user, $langs;
$langs->load("suppliers");
@ -217,14 +218,14 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
{
$outputlangs->charset_output=$sav_charset_output;
// we delete preview files
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_delete_preview($object);
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);

View File

@ -296,10 +296,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
@ -908,9 +908,10 @@ if ($pageposafter > $pageposbefore) {
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
{
global $langs,$conf,$mysoc;
@ -992,6 +993,10 @@ if ($pageposafter > $pageposbefore) {
}
$posy+=2;
$pdf->SetTextColor(0,0,60);
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
if ($showaddress)
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Charles-Fr BENKE <charles.fr@benke.fr>
*
* 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
@ -35,12 +36,16 @@ class Export
var $array_export_label=array(); // Tableau de "libelle de lots"
var $array_export_sql=array(); // Tableau des "requetes sql"
var $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter
var $array_export_TypeFields=array(); // Tableau des listes de champ+Type de filtre
var $array_export_FilterValue=array(); // Tableau des listes de champ+Valeur a filtrer
var $array_export_entities=array(); // Tableau des listes de champ+alias a exporter
var $array_export_dependencies=array(); // array of list of entities that must take care of the DISTINCT if a field is added into export
var $array_export_special=array(); // Tableau des operations speciales sur champ
// To store export modules
var $hexa;
var $hexafilter;
var $hexafiltervalue;
var $datatoexport;
var $model_name;
@ -106,7 +111,7 @@ class Export
require_once $file;
$module = new $classname($this->db);
if (is_array($module->export_code))
if (isset($module->export_code) && is_array($module->export_code))
{
foreach($module->export_code as $r => $value)
{
@ -122,7 +127,7 @@ class Export
{
$perm=$val;
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if ($perm[2])
if (! empty($perm[2]))
{
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
}
@ -160,19 +165,21 @@ class Export
$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 champs a filtrer (cle=champ, valeur1=type de donnees) on verifie que le module a des filtres
$this->array_export_TypeFields[$i]=(isset($module->export_TypeFields_array[$r])?$module->export_TypeFields_array[$r]:'');
// Tableau des entites a exporter (cle=champ, valeur=entite)
$this->array_export_entities[$i]=$module->export_entities_array[$r];
// Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records)
$this->array_export_dependencies[$i]=$module->export_dependencies_array[$r];
$this->array_export_dependencies[$i]=(! empty($module->export_dependencies_array[$r])?$module->export_dependencies_array[$r]:'');
// Tableau des operations speciales sur champ
$this->array_export_special[$i]=$module->export_special_array[$r];
$this->array_export_special[$i]=(! empty($module->export_special_array[$r])?$module->export_special_array[$r]:'');
// Requete sql du dataset
$this->array_export_sql_start[$i]=$module->export_sql_start[$r];
$this->array_export_sql_end[$i]=$module->export_sql_end[$r];
//$this->array_export_sql[$i]=$module->export_sql[$r];
dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".count($module->export_fields_code[$r]));
dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".(! empty($module->export_fields_code[$r])?count($module->export_fields_code[$r]):''));
$i++;
// }
}
@ -196,7 +203,7 @@ class Export
* @param array $array_selected Filter on array of fields to export
* @return string SQL String. Example "select s.rowid as r_rowid, s.status as s_status from ..."
*/
function build_sql($indice,$array_selected)
function build_sql($indice, $array_selected, $array_filterValue, $array_filtered)
{
// Build the sql request
$sql=$this->array_export_sql_start[$indice];
@ -215,9 +222,225 @@ class Export
}
$sql.=$this->array_export_sql_end[$indice];
//construction du filtrage si le parametrage existe
if (is_array($array_filtered))
{
$sqlWhere='';
// pour ne pas a gerer le nombre de condition
foreach ($array_filtered as $key => $value)
{
if ($array_filterValue[$key])
{
$sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[0][$key], $key, $array_filterValue[$key]);
}
}
$sql.=$sqlWhere;
}
return $sql;
}
/**
* Build the conditionnal string from filter the query
*
* @param string $TypeField Type of Field to filter
* @param string $NameField Name of the field to filter
* @param string $ValueField Initial value of the field to filter
* @return string sql string of then field ex : "field='xxx'>"
*/
function build_filterQuery($TypeField, $NameField, $ValueField)
{
//print $TypeField." ".$NameField." ".$ValueField;
$InfoFieldList = explode(":", $TypeField);
// build the input field on depend of the type of file
switch ($InfoFieldList[0]) {
case 'Text':
if (strpos($ValueField, "%") > 0)
$szFilterQuery=" ".$NameField." like '".$ValueField."'";
else
$szFilterQuery=" ".$NameField."='".$ValueField."'";
break;
case 'Date':
if (strpos($ValueField, "+") > 0)
{
// mode plage
$ValueArray = explode("+", $ValueField);
$szFilterQuery= $this->conditionDate($NameField,$ValueArray[0],">=");
$szFilterQuery.=" and ".$this->conditionDate($NameField,$ValueArray[1],"<=");
}
else
{
if (is_numeric(substr($ValueField,0,1)))
$szFilterQuery=$this->conditionDate($NameField,$ValueField,"=");
else
$szFilterQuery=$this->conditionDate($NameField,substr($ValueField,1),substr($ValueField,0,1));
}
break;
case 'Duree':
break;
case 'Numeric':
// si le signe -
if (strpos($ValueField, "+") > 0)
{
// mode plage
$ValueArray = explode("+", $ValueField);
$szFilterQuery=$NameField.">=".$ValueArray[0];
$szFilterQuery.=" and ".$NameField."<=".$ValueArray[1];
}
else
{
if (is_numeric(substr($ValueField,0,1)))
$szFilterQuery=" ".$NameField."=".$ValueField;
else
$szFilterQuery=" ".$NameField.substr($ValueField,0,1).substr($ValueField,1);
}
break;
case 'Status':
case 'Boolean':
case 'List':
if (is_numeric($ValueField))
$szFilterQuery=" ".$NameField."=".$ValueField;
else
$szFilterQuery=" ".$NameField."='".$ValueField."'";
break;
}
return $szFilterQuery;
}
/**
*
* @param unknown $Field
* @param unknown $Value
* @param unknown $Sens
* @return string
*/
function conditionDate($Field, $Value, $Sens)
{
if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." ".$Value;
elseif (strlen($Value)==6) $Condition=" date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
else $Condition=" date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
return $Condition;
}
/**
* Build an input field used to filter the query
*
* @param string $TypeField Type of Field to filter
* @param string $NameField Name of the field to filter
* @param string $ValueField Initial value of the field to filter
* @return string html string of the input field ex : "<input type=text name=... value=...>"
*/
function build_filterField($TypeField, $NameField, $ValueField)
{
$szFilterField='';
$InfoFieldList = explode(":", $TypeField);
// build the input field on depend of the type of file
switch ($InfoFieldList[0]) {
case 'Text':
case 'Date':
case 'Duree':
case 'Numeric':
$szFilterField="<input type=Text name=".$NameField." value='".$ValueField."'>";
break;
case 'Boolean':
$szFilterField="<select name=".$NameField.">";
$szFilterField.='<option ';
if ($ValueField=='') $szFilterField.=' selected ';
$szFilterField.=' value="">Sans</option>';
$szFilterField.='<option ';
if ($ValueField=='1') $szFilterField.=' selected ';
$szFilterField.=' value="1">Oui</option>';
$szFilterField.='<option ';
if ($ValueField=='0') $szFilterField.=' selected ';
$szFilterField.=' value="0">Non</option>';
$szFilterField.="</select>";
break;
case 'List':
// 0 : Type du champ
// 1 : Nom de la table
// 2 : Nom du champ contenant le libelle
// 3 : Nom du champ contenant la cle (si different de rowid)
if (count($InfoFieldList)==4)
$keyList=$InfoFieldList[3];
else
$keyList='rowid';
$sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2];
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[1];
$resql = $this->db->query($sql);
if ($resql)
{
$szFilterField='<select class="flat" name="'.$NameField.'">';
$szFilterField.='<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$labeltoshow=dol_trunc($obj->$InfoFieldList[2],18);
if (!empty($ValueField) && $ValueField == $obj->rowid)
{
$szFilterField.='<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
}
else
{
$szFilterField.='<option value="'.$obj->rowid.'" >'.$labeltoshow.'</option>';
}
$i++;
}
}
$szFilterField.="</select>";
}
break;
}
return $szFilterField;
}
/**
* Build an input field used to filter the query
*
* @param string $TypeField Type of Field to filter
* @return string html string of the input field ex : "<input type=text name=... value=...>"
* TODO replace by translation
*/
function genDocFilter($TypeField)
{
$szMsg='';
$InfoFieldList = explode(":", $TypeField);
// build the input field on depend of the type of file
switch ($InfoFieldList[0]) {
case 'Text':
$szMsg="% permet de remplacer un ou plusieurs caract&egrave;res dans la chaine";
break;
case 'Date':
$szMsg ="'AAAA' 'AAAAMM' 'AAAAMMJJ' : filtre sur une ann&eacute;e/mois/jour <br>";
$szMsg.="'AAAA+AAAA' 'AAAAMM+AAAAMM' 'AAAAMMJJ+AAAAMMJJ': filtre sur une plage d'ann&eacute;e/mois/jour <br>";
$szMsg.="'&gt;AAAA' '&gt;AAAAMM' '&gt;AAAAMMJJ' filtre sur les ann&eacute;e/mois/jour suivants <br>";
$szMsg.="'&lsaquo;AAAA' '&lsaquo;AAAAMM' '&lsaquo;AAAAMMJJ' filtre sur les ann&eacute;e/mois/jour pr&eacute;c&eacute;dent <br>";
break;
case 'Duree':
break;
case 'Numeric':
$szMsg ="'NNNNN' filtre sur une valeur <br>";
$szMsg.="'NNNNN+NNNNN' filtre sur une plage de valeur<br>";
$szMsg.="'&lsaquo;NNNNN' filtre sur les valeurs inf&eacute;rieurs<br>";
$szMsg.="'&gt;NNNNN' filtre sur les valeurs sup&eacute;rieurs<br>";
break;
case 'Boolean':
break;
case 'List':
break;
}
return $szMsg;
}
/**
* Build export file.
* File is built into directory $conf->export->dir_temp.'/'.$user->id
@ -230,14 +453,14 @@ class Export
* @param string $sqlquery If set, transmit a sql query instead of building it from arrays
* @return int <0 if KO, >0 if OK
*/
function build_file($user, $model, $datatoexport, $array_selected, $sqlquery = '')
function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $array_filtered, $sqlquery = '')
{
global $conf,$langs;
$indice=0;
asort($array_selected);
dol_syslog("Export::build_file $model, $datatoexport, $array_selected");
dol_syslog("Export::build_file ".$model.", ".$datatoexport.", ".implode(",", $array_selected));
// Check parameters or context properties
if (! is_array($this->array_export_fields[$indice]))
@ -254,7 +477,7 @@ class Export
$objmodel = new $classname($this->db);
if ($sqlquery) $sql = $sqlquery;
else $sql=$this->build_sql($indice,$array_selected);
else $sql=$this->build_sql($indice, $array_selected, $array_filterValue, $array_filtered);
// Run the sql
$this->sqlusedforexport=$sql;
@ -281,6 +504,8 @@ class Export
// Genere ligne de titre
$objmodel->write_title($this->array_export_fields[$indice],$array_selected,$outputlangs);
$var=true;
while ($objp = $this->db->fetch_object($resql))
{
$var=!$var;
@ -349,9 +574,22 @@ class Export
$this->db->begin();
$filter='';
if (! empty($this->hexafilter) && ! empty($this->hexafiltervalue)) {
$filter = json_encode(array('field' => $this->hexafilter, 'value' => $this->hexafiltervalue));
}
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'export_model (';
$sql.= 'label, type, field)';
$sql.= " VALUES ('".$this->model_name."', '".$this->datatoexport."', '".$this->hexa."')";
$sql.= 'label,';
$sql.= 'type,';
$sql.= 'field,';
$sql.= 'filter';
$sql.= ') VALUES (';
$sql.= "'".$this->db->escape($this->model_name)."',";
$sql.= "'".$this->datatoexport."',";
$sql.= "'".$this->hexa."',";
$sql.= (! empty($filter)?"'".$filter."'":"null");
$sql.= ")";
dol_syslog("Export::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
@ -378,7 +616,7 @@ class Export
*/
function fetch($id)
{
$sql = 'SELECT em.rowid, em.field, em.label, em.type';
$sql = 'SELECT em.rowid, em.field, em.label, em.type, em.filter';
$sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
$sql.= ' WHERE em.rowid = '.$id;
@ -389,16 +627,20 @@ class Export
$obj = $this->db->fetch_object($result);
if ($obj)
{
$this->id = $obj->rowid;
$this->hexa = $obj->field;
$this->model_name = $obj->label;
$this->datatoexport = $obj->type;
$this->id = $obj->rowid;
$this->hexa = $obj->field;
$this->model_name = $obj->label;
$this->datatoexport = $obj->type;
$filter = json_decode($obj->filter, true);
$this->hexafilter = (isset($filter['field'])?$filter['field']:'');
$this->hexafiltervalue = (isset($filter['value'])?$filter['value']:'');
return 1;
}
else
{
$this->error="Model not found";
$this->error="ModelNotFound";
return -2;
}
}
@ -465,6 +707,58 @@ class Export
}
}
/**
*
*/
function list_export_model()
{
global $conf, $langs;
$sql = "SELECT em.rowid, em.field, em.label, em.type, em.filter";
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
$sql.= " ORDER BY rowid";
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$keyModel = array_search($obj->type, $this->array_export_code);
print "<tr>";
print '<td><a href=export.php?step=2&action=select_model&exportmodelid='.$obj->rowid.'&datatoexport='.$obj->type.'>'.$obj->label.'</a></td>';
print '<td>';
print img_object($this->array_export_module[$keyModel]->getName(),$this->array_export_icon[$keyModel]).' ';
print $this->array_export_module[$keyModel]->getName().' - ';
// recuperation du nom de l'export
$string=$langs->trans($this->array_export_label[$keyModel]);
print ($string!=$this->array_export_label[$keyModel]?$string:$this->array_export_label[$keyModel]);
print '</td>';
//print '<td>'.$obj->type.$keyModel.'</td>';
print '<td>'.str_replace(',',' , ',$obj->field).'</td>';
if (! empty($obj->filter)) {
$filter = json_decode($obj->filter, true);
print '<td>'.str_replace(',',' , ',$filter['field']).'</td>';
print '<td>'.str_replace(',',' , ',$filter['value']).'</td>';
}
// suppression de l'export
print '<td align="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteprof&id='.$obj->rowid.'">';
print img_delete();
print '</a>';
print "</tr>";
$i++;
}
}
else {
dol_print_error($this->db);
}
}
}
?>

View File

@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Charles-Fr BENKE <charles.fr@benke.fr>
*
* 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
@ -88,6 +89,8 @@ $entitytolang = array(
);
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
$array_filtered=isset($_SESSION["export_filtered_fields"])?$_SESSION["export_filtered_fields"]:array();
$array_filtervalue=isset($_SESSION["export_FilterValue_fields"])?$_SESSION["export_FilterValue_fields"]:array();
$datatoexport=GETPOST("datatoexport");
$action=GETPOST("action");
$step=GETPOST("step")?GETPOST("step"):1;
@ -132,7 +135,7 @@ if ($action=='selectfield')
$array_selected[$field]=count($array_selected)+1; // We tag the key $field as "selected"
// We check if there is a dependency
if (! empty($fieldsdependenciesarray[$fieldsentitiesarray[$field]]))
if (! empty($fieldsentitiesarray[$field]) && ! empty($fieldsdependenciesarray[$fieldsentitiesarray[$field]]))
{
$tmp=$fieldsdependenciesarray[$fieldsentitiesarray[$field]]; // $fieldsdependenciesarray=array('element'=>'fd.rowid') or array('element'=>array('fd.rowid','ab.rowid'))
if (is_array($tmp)) $listofdependencies=$tmp;
@ -174,6 +177,52 @@ if ($action=='unselectfield')
$_SESSION["export_selected_fields"]=$array_selected;
}
}
if ($action=='selectFilterfield')
{
if ($_GET["field"]=='all')
{
$fieldsarray=$objexport->array_export_TypeFields[0];
foreach($fieldsarray as $key=>$val)
{
if (! empty($array_filtered[$key])) continue; // If already selected, select next
$array_filtered[$key]=count($array_filtered)+1;
//print_r($array_selected);
$_SESSION["export_filtered_fields"]=$array_filtered;
}
}
else
{
$array_filtered[$_GET["field"]]=count($array_filtered)+1;
//print_r($array_selected);
$_SESSION["export_filtered_fields"]=$array_filtered;
}
}
if ($action=='unselectFilterfield')
{
if ($_GET["field"]=='all')
{
$array_filtered=array();
$_SESSION["export_filtered_fields"]=$array_filtered;
}
else
{
unset($array_filtered[$_GET["field"]]);
// Renumber fields of array_selected (from 1 to nb_elements)
asort($array_filtered);
$i=0;
$array_filterted_save=$array_filtered;
foreach($array_filtered as $code=>$value)
{
$i++;
$array_filtered[$code]=$i;
//print "x $code x $i y<br>";
}
$_SESSION["export_filtered_fields"]=$array_filtered;
}
}
if ($action=='downfield' || $action=='upfield')
{
$pos=$array_selected[$_GET["field"]];
@ -201,13 +250,17 @@ if ($action=='downfield' || $action=='upfield')
if ($step == 1 || $action == 'cleanselect')
{
$_SESSION["export_selected_fields"]=array();
$_SESSION["export_FilterValue_fields"]=array();
$_SESSION["export_filtered_fields"]=array();
$array_selected=array();
$array_filtervalue=array();
$array_filtered=array();
}
if ($action == 'builddoc')
{
// Build export file
$result=$objexport->build_file($user, $_POST['model'], $datatoexport, $array_selected);
$result=$objexport->build_file($user, $_POST['model'], $datatoexport, $array_selected, $array_filtervalue, $array_filtered);
if ($result < 0)
{
$mesg='<div class="error">'.$objexport->error.'</div>';
@ -242,9 +295,21 @@ if ($action == 'add_export_model')
$hexa.=$key;
}
$hexafilter='';
$hexafiltervalue='';
foreach($array_filtered as $key=>$val)
{
if ($hexafilter) $hexafilter.=',';
if ($hexafilter) $hexafiltervalue.=',';
$hexafilter.=$key;
$hexafiltervalue.=$array_filtervalue[$key];
}
$objexport->model_name = $export_name;
$objexport->datatoexport = $datatoexport;
$objexport->hexa = $hexa;
$objexport->hexafilter = $hexafilter;
$objexport->hexafiltervalue = $hexafiltervalue;
$result = $objexport->create($user);
if ($result >= 0)
@ -270,7 +335,13 @@ if ($action == 'add_export_model')
if ($step == 2 && $action == 'select_model')
{
$_SESSION["export_selected_fields"]=array();
$_SESSION["export_filtered_fields"]=array();
$_SESSION["export_FilterValue_fields"]=array();
$array_selected=array();
$array_filtered=array();
$array_filtervalue=array();
$result = $objexport->fetch($exportmodelid);
if ($result > 0)
{
@ -282,9 +353,38 @@ if ($step == 2 && $action == 'select_model')
$i++;
}
$_SESSION["export_selected_fields"]=$array_selected;
$fieldsarray=explode(',',$objexport->hexafilter);
$fieldsarrayvalue=explode(',',$objexport->hexafiltervalue);
$i=1;
foreach($fieldsarray as $val)
{
$array_filtered[$val]=$i;
$array_filtervalue[$val]=$fieldsarrayvalue[$i-1];
$i++;
}
$_SESSION["export_filtered_fields"]=$array_filtered;
$_SESSION["export_FilterValue_fields"]=$array_filtervalue;
}
}
// recuperation du filtrage issu du formulaire
if ($step == 4 && $action == 'submitFormField')
{
// on boucle sur les champs selectionne pour recuperer la valeur
if (is_array($objexport->array_export_TypeFields[0]))
{
$_SESSION["export_FilterValue_fields"]=array();
foreach($array_filtered as $code=>$value)
{
//print $code."=".$_POST[$objexport->array_export_fields[0][$code]];
$objexport->array_export_FilterValue[0][$code] = $_POST[$objexport->array_export_fields[0][$code]];
}
$_SESSION["export_FilterValue_fields"]=(! empty($objexport->array_export_FilterValue[0])?$objexport->array_export_FilterValue[0]:'');
$array_filtervalue=(! empty($objexport->array_export_FilterValue[0])?$objexport->array_export_FilterValue[0]:'');
}
}
/*
* View
@ -441,7 +541,7 @@ if ($step == 2 && $datatoexport)
// Champs exportables
$fieldsarray=$objexport->array_export_fields[0];
// Select request if all fields are selected
$sqlmaxforexport=$objexport->build_sql(0,array());
$sqlmaxforexport=$objexport->build_sql(0, array(), array(), array());
// $this->array_export_module[0]=$module;
// $this->array_export_code[0]=$module->export_code[$r];
@ -462,8 +562,8 @@ if ($step == 2 && $datatoexport)
$i++;
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
$entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity;
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
$entityicon=(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
print '<td nowrap="nowrap">';
// If value of entityicon=entitylang='icon:Label'
@ -479,7 +579,7 @@ if ($step == 2 && $datatoexport)
$tablename=getablenamefromfield($code,$sqlmaxforexport);
$htmltext ='<b>'.$langs->trans("Name").":</b> ".$text.'<br>';
$htmltext.='<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./','',$code)."<br>";
if ((isset($array_selected[$code]) && $array_selected[$code]) || $modelchoice == 1)
if (isset($array_selected[$code]) && $array_selected[$code])
{
// Selected fields
print '<td>&nbsp;</td>';
@ -489,7 +589,7 @@ if ($step == 2 && $datatoexport)
print $form->textwithpicto($text,$htmltext);
//print ' ('.$code.')';
print '</td>';
$bit=1;
//$bit=1; FIXME not used ?
}
else
{
@ -501,11 +601,11 @@ if ($step == 2 && $datatoexport)
print '</td>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field='.$code.'">'.img_right().'</a></td>';
print '<td>&nbsp;</td>';
$bit=0;
//$bit=0; FIXME not used ?
}
print '</tr>';
$save_select.=$bit;
//$save_select.=$bit; FIXME not used ?
}
print '</table>';
@ -522,7 +622,15 @@ if ($step == 2 && $datatoexport)
if (count($array_selected))
{
print '<a class="butAction" href="export.php?step=3&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
// If filters exist
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0]))
{
print '<a class="butAction" href="export.php?step=3&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
}
else
{
print '<a class="butAction" href="export.php?step=4&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
}
}
else
{
@ -534,6 +642,179 @@ if ($step == 2 && $datatoexport)
}
if ($step == 3 && $datatoexport)
{
llxHeader('',$langs->trans("NewExport"),'EN:Module_Exports_En|FR:Module_Exports|ES:M&oacute;dulo_Exportaciones');
/*
* Affichage onglets
*/
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1';
$head[$h][1] = $langs->trans("Step")." 1";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 2";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 3";
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("NewExport"));
print '<table width="100%" class="border">';
// Module
print '<tr><td width="25%">'.$langs->trans("Module").'</td>';
print '<td>';
//print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' ';
print $objexport->array_export_module[0]->getName();
print '</td></tr>';
// Lot de donnees a exporter
print '<tr><td width="25%">'.$langs->trans("DatasetToExport").'</td>';
print '<td>';
$icon=$objexport->array_export_icon[0];
$label=$objexport->array_export_label[0];
//print $value.'-'.$icon.'-'.$label."<br>";
print img_object($objexport->array_export_module[0]->getName(),$icon).' ';
print $label;
print '</td></tr>';
// Nbre champs exportes
print '<tr><td width="25%">'.$langs->trans("ExportedFields").'</td>';
$list='';
foreach($array_selected as $code=>$value)
{
$list.=(! empty($list)?', ':'');
$list.=(isset($objexport->array_export_fields[0][$code])?$langs->trans($objexport->array_export_fields[0][$code]):'');
}
print '<td>'.$list.'</td></tr>';
print '</table>';
print '<br>';
// Combo list of export models
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="select_model">';
print '<input type="hidden" name="step" value="3">';
print '<input type="hidden" name="datatoexport" value="'.$datatoexport.'">';
print '<table><tr><td colspan="2">';
print $langs->trans("SelectExportFields").' ';
$htmlother->select_export_model($exportmodelid,'exportmodelid',$datatoexport,1);
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
print '</td></tr></table>';
print '</form>';
// un formulaire en plus pour recuperer les filtres
print '<form action="export.php?step=4&action=submitFormField&datatoexport='.$datatoexport.'" name="FilterField" method="post">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Entities").'</td>';
print '<td>'.$langs->trans("FilterableFields").'</td>';
print '<td align="center"></td>';
print '<td>'.$langs->trans("FilteredFields").'</td>';
print '<td width="25%">'.$langs->trans("FilteredFieldsValues").'</td>';
print '</tr>';
// Champs exportables
$fieldsarray=$objexport->array_export_fields[0];
// Champs filtrable
$Typefieldsarray=$objexport->array_export_TypeFields[0];
// valeur des filtres
$ValueFiltersarray=(! empty($objexport->array_export_FilterValue[0])?$objexport->array_export_FilterValue[0]:'');
// Select request if all fields are selected
$sqlmaxforexport=$objexport->build_sql(0, array(), array(), array());
$var=true;
$i = 0;
// on boucle sur les champs filtrable
foreach($Typefieldsarray as $code=>$label)
{
$var=!$var;
print "<tr $bc[$var]>";
$i++;
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
$entityicon=(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
print '<td nowrap="nowrap">';
// If value of entityicon=entitylang='icon:Label'
$tmparray=explode(':',$entityicon);
if (count($tmparray) >=2)
{
$entityicon=$tmparray[0];
$entitylang=$tmparray[1];
}
print img_object('',$entityicon).' '.$langs->trans($entitylang);
print '</td>';
$labelName=(! empty($fieldsarray[$code])?$fieldsarray[$code]:'');
$ValueFilter=(! empty($array_filtervalue[$code])?$array_filtervalue[$code]:'');
$text=$langs->trans($labelName);
$tablename=getablenamefromfield($code,$sqlmaxforexport);
$htmltext ='<b>'.$langs->trans("Name").':</b> '.$text.' ('.$label.')<br>';
$htmltext.='<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./','',$code)."<br>";
if (isset($array_filtered[$code]) && $array_filtered[$code])
{
// Selected fields
print '<td>&nbsp;</td>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?step=3&datatoexport='.$datatoexport.'&action=unselectFilterfield&field='.$code.'">'.img_left().'</a></td>';
print '<td>';
print $form->textwithpicto($text,$htmltext);
print '</td>';
//$bit=1; FIXME not used?
// ici le filtre
print '<td>';
$szInfoFiltre=$objexport->genDocFilter($label);
if ($szInfoFiltre)
print $form->textwithpicto($objexport->build_filterField($label, $labelName, $ValueFilter), $szInfoFiltre);
else
print $objexport->build_filterField($label, $labelName, $ValueFilter);
print '</td>';
}
else
{
// Fields not selected
print '<td>';
//print $text.'-'.$htmltext."<br>";
print $form->textwithpicto($text,$htmltext);
//print ' ('.$code.')';
print '</td>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?step=3&datatoexport='.$datatoexport.'&action=selectFilterfield&field='.$code.'">'.img_right().'</a></td>';
print '<td colspan=2>&nbsp;</td>';
//$bit=0; FIXME not used?
}
print '</tr>';
//$save_selectFilter.=$bit; FIXME not used?
}
print '</table>';
print '</div>';
if ($mesg) print $mesg;
/*
* Barre d'action
*
*/
print '<div class="tabsAction">';
// il n'est pas obligatoire de filtrer les champs
print '<a class="butAction" href="javascript:FilterField.submit();">'.$langs->trans("NextStep").'</a>';
print '</div>';
}
if ($step == 4 && $datatoexport)
{
asort($array_selected);
@ -552,8 +833,16 @@ if ($step == 3 && $datatoexport)
$head[$h][1] = $langs->trans("Step")." 2";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 3";
// If filters exist
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0]))
{
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 3";
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=4&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 4";
$hselected=$h;
$h++;
@ -585,11 +874,24 @@ if ($step == 3 && $datatoexport)
}
print '<td>'.$list.'</td></tr>';
// Number of filtered fields
if (isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0]))
{
print '<tr><td width="25%">'.$langs->trans("FilteredFields").'</td>';
$list='';
foreach($array_filtered as $code=>$value)
{
$list.=($list?', ':'');
$list.="[".$langs->trans($objexport->array_export_fields[0][$code])."]='".$array_filtervalue[$code]."'";
}
print '<td>'.$list.'</td></tr>';
}
print '</table>';
print '<br>';
// Select request if all fields are selected
$sqlmaxforexport=$objexport->build_sql(0,array());
$sqlmaxforexport=$objexport->build_sql(0, array(), array(), array());
print $langs->trans("ChooseFieldsOrdersAndTitle").'<br>';
@ -609,8 +911,8 @@ if ($step == 3 && $datatoexport)
print "<tr $bc[$var]>";
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
$entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity;
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
$entityicon=(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
print '<td nowrap="nowrap">';
// If value of entityicon=entitylang='icon:Label'
@ -635,8 +937,8 @@ if ($step == 3 && $datatoexport)
print '<td align="right" width="100">';
print $value.' ';
print '</td><td align="center" width="20">';
if ($value < count($array_selected)) print '<a href="'.$_SERVER["PHP_SELF"].'?step=3&datatoexport='.$datatoexport.'&action=downfield&field='.$code.'">'.img_down().'</a>';
if ($value > 1) print '<a href="'.$_SERVER["PHP_SELF"].'?step=3&datatoexport='.$datatoexport.'&action=upfield&field='.$code.'">'.img_up().'</a>';
if ($value < count($array_selected)) print '<a href="'.$_SERVER["PHP_SELF"].'?step='.$step.'&datatoexport='.$datatoexport.'&action=downfield&field='.$code.'">'.img_down().'</a>';
if ($value > 1) print '<a href="'.$_SERVER["PHP_SELF"].'?step='.$step.'&datatoexport='.$datatoexport.'&action=upfield&field='.$code.'">'.img_up().'</a>';
print '</td>';
//print '<td>&nbsp;</td>';
@ -660,7 +962,7 @@ if ($step == 3 && $datatoexport)
if (count($array_selected))
{
print '<a class="butAction" href="export.php?step=4&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
print '<a class="butAction" href="export.php?step='.($step + 1).'&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
}
print '</div>';
@ -725,7 +1027,7 @@ if ($step == 3 && $datatoexport)
}
if ($step == 4 && $datatoexport)
if ($step == 5 && $datatoexport)
{
asort($array_selected);
@ -744,12 +1046,20 @@ if ($step == 4 && $datatoexport)
$head[$h][1] = $langs->trans("Step")." 2";
$h++;
// si le filtrage est parametre pour l'export ou pas
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0]))
{
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 3";
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 3";
$head[$h][1] = $langs->trans("Step")." 4";
$h++;
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=4&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 4";
$head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=5&datatoexport='.$datatoexport;
$head[$h][1] = $langs->trans("Step")." 5";
$hselected=$h;
$h++;
@ -781,6 +1091,19 @@ if ($step == 4 && $datatoexport)
}
print '<td>'.$list.'</td></tr>';
// Nbre champs filtres
if (is_array($objexport->array_export_TypeFields[0]))
{
print '<tr><td width="25%">'.$langs->trans("FilteredFields").'</td>';
$list='';
foreach($array_filtered as $code=>$value)
{
$list.=($list?', ':'');
$list.="[".$langs->trans($objexport->array_export_fields[0][$code])."]='".$array_filtervalue[$code]."'";
}
print '<td>'.$list.'</td></tr>';
}
print '</table>';
print '<br>';
@ -830,7 +1153,7 @@ if ($step == 4 && $datatoexport)
// Affiche liste des documents
// NB: La fonction show_documents rescanne les modules qd genallowed=1, sinon prend $liste
$formfile->show_documents('export','',$conf->export->dir_temp.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),1,1);
$formfile->show_documents('export','',$conf->export->dir_temp.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport,$liste,1,(! empty($_POST['model'])?$_POST['model']:'csv'),1,1);
print '</td><td width="50%">&nbsp;</td></tr>';
print '</table>';

View File

@ -307,7 +307,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
}
$ret=$object->fetch($id); // Reload to get new records
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
}
unset($_POST['qty']);
unset($_POST['type']);
@ -369,7 +369,7 @@ else if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($id); // Reload to get new records
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
}
}
else
@ -395,7 +395,7 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($id); // Reload to get new records
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
}
}
else
@ -429,7 +429,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourn
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$ret=$object->fetch($id); // Reload to get new records
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
}
}
else
@ -582,7 +582,7 @@ else if ($action == 'up' && $user->rights->fournisseur->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
exit;
}
@ -597,7 +597,7 @@ else if ($action == 'down' && $user->rights->fournisseur->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
exit;
}
@ -621,7 +621,7 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) /
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result=supplier_order_pdf_create($db, $object,$object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
$result=supplier_order_pdf_create($db, $object,$object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
if ($result <= 0)
{
dol_print_error($db,$result);

File diff suppressed because it is too large Load Diff

View File

@ -235,6 +235,7 @@ ALTER TABLE llx_propaldet MODIFY COLUMN localtax2_type varchar(1);
ALTER TABLE llx_menu MODIFY COLUMN enabled varchar(255) NULL DEFAULT '1';
ALTER TABLE llx_extrafields ADD COLUMN fieldunique INTEGER DEFAULT 0;
ALTER TABLE llx_extrafields ADD COLUMN fieldrequired INTEGER DEFAULT 0;
create table llx_socpeople_extrafields
(
@ -772,6 +773,9 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN import_key varchar(14) AFTE
ALTER TABLE llx_product_stock ADD COLUMN import_key varchar(14) AFTER pmp;
ALTER TABLE llx_societe_rib ADD COLUMN import_key varchar(14) AFTER adresse_proprio;
-- Export filter
ALTER TABLE llx_export_model ADD COLUMN filter text AFTER field;
-- [ task #146 ] Remove table llx_categorie_association
ALTER TABLE llx_categorie_association DROP FOREIGN KEY fk_categorie_asso_fk_categorie_mere;
ALTER TABLE llx_categorie_association DROP FOREIGN KEY fk_categorie_asso_fk_categorie_fille;
@ -802,4 +806,4 @@ ALTER TABLE llx_product_price_by_qty ADD INDEX idx_product_price_by_qty_fk_produ
ALTER TABLE llx_product_price_by_qty ADD CONSTRAINT fk_product_price_by_qty_fk_product_price FOREIGN KEY (fk_product_price) REFERENCES llx_product_price (rowid);
ALTER TABLE `llx_product_price_by_qty` ADD `remise_percent` DOUBLE NOT NULL DEFAULT '0' AFTER `price_ttc` ,
ADD `remise` DOUBLE NOT NULL DEFAULT '0' AFTER `remise_percent`;
ADD `remise` DOUBLE NOT NULL DEFAULT '0' AFTER `remise_percent`;

View File

@ -1,7 +1,7 @@
-- ===================================================================
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2007 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2007-2012 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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
@ -17,14 +17,15 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
-- Liste des modeles de document disponibles
-- ===================================================================
create table llx_export_model
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_user integer DEFAULT 0 NOT NULL,
label varchar(50) NOT NULL,
type varchar(20) NOT NULL,
field text NOT NULL
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_user integer DEFAULT 0 NOT NULL,
label varchar(50) NOT NULL,
type varchar(20) NOT NULL,
field text NOT NULL,
filter text
)ENGINE=innodb;

View File

@ -1,8 +1,6 @@
-- ===================================================================
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
-- Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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
@ -30,5 +28,6 @@ create table llx_extrafields
type varchar(8),
size varchar(8) DEFAULT NULL,
fieldunique integer DEFAULT 0,
fieldrequired integer DEFAULT 0,
pos integer DEFAULT 0
)ENGINE=innodb;

View File

@ -123,4 +123,8 @@ SuppliersProducts=Produits Fournisseurs
BankCode=Code banque
DeskCode=Code guichet
BankAccountNumber=Numéro compte
BankAccountNumberKey=Clé RIB
BankAccountNumberKey=Clé RIB
## filters
FilterableFields=Champs Filtrables
FilteredFields=Champs Filtrés
FilteredFieldsValues=Valeurs de filtrages

View File

@ -115,7 +115,7 @@ VolumeUnitinch3=pouce3
VolumeUnitounce=once
VolumeUnitlitre=litre
VolumeUnitgallon=gallon
Size=taille
Size=Taille
SizeUnitm=m
SizeUnitdm=dm
SizeUnitcm=cm