diff --git a/dev/resources/intracommreport/manuelDebXml1.2.pdf b/dev/resources/intracommreport/manuelDebXml1.2.pdf
new file mode 100644
index 00000000000..50544632a0f
Binary files /dev/null and b/dev/resources/intracommreport/manuelDebXml1.2.pdf differ
diff --git a/dev/resources/intracommreport/schema_deb.xsd b/dev/resources/intracommreport/schema_deb.xsd
new file mode 100644
index 00000000000..5379932fa29
--- /dev/null
+++ b/dev/resources/intracommreport/schema_deb.xsd
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/core/modules/modIntracommreport.class.php b/htdocs/core/modules/modIntracommreport.class.php
index 668cf7af875..da1bda58c48 100644
--- a/htdocs/core/modules/modIntracommreport.class.php
+++ b/htdocs/core/modules/modIntracommreport.class.php
@@ -62,10 +62,10 @@ class modIntracommreport extends DolibarrModules
$this->config_page_url = array("intracommreport.php@intracommreport");
// Dependencies
- $this->depends = array("modFacture", "modTax"); // List of modules id that must be enabled if this module is enabled
+ $this->depends = array("modFacture", "modTax", "modCategorie"); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
- $this->phpmin = array(5, 5); // Minimum version of PHP required by module
+ $this->phpmin = array(5, 6); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(13, 0, -5); // Minimum version of Dolibarr required by module
$this->langfiles = array("intracommreport");
diff --git a/htdocs/intracommreport/admin/intracommreport.php b/htdocs/intracommreport/admin/intracommreport.php
index 9947e844e40..16e24503959 100644
--- a/htdocs/intracommreport/admin/intracommreport.php
+++ b/htdocs/intracommreport/admin/intracommreport.php
@@ -159,9 +159,8 @@ print "\n";
print '
';
print '| '.$langs->trans("INTRACOMMREPORT_CATEG_FRAISDEPORT").' | ';
-$arraychoices = array(3=>'Seuil de 460 000 €', 4=>'En dessous de 460 000 €');
print '';
-print $formother->select_categories(0, $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
+print $formother->select_categories('product', $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
print ' | ';
print "
\n";
@@ -193,10 +192,8 @@ foreach ($list_DES as $key)
print '';
-print '';
-print '
';
-print '';
-print '
';
+print '
';
+print '';
print '
';
print '';
diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php
index 0cf5a71c27a..cd4765161e9 100644
--- a/htdocs/intracommreport/class/intracommreport.class.php
+++ b/htdocs/intracommreport/class/intracommreport.class.php
@@ -142,7 +142,7 @@ class IntracommReport extends CommonObject
$date_time->addChild('date', date('Y-m-d'));
$date_time->addChild('time', date('H:i:s'));
$party = $enveloppe->addChild('Party');
- $party->addAttribute('partType', $conf->global->INTRACOMMREPORT_TYPE_ACTEUR);
+ $party->addAttribute('partyType', $conf->global->INTRACOMMREPORT_TYPE_ACTEUR);
$party->addAttribute('partyRole', $conf->global->INTRACOMMREPORT_ROLE_ACTEUR);
$party->addChild('partyId', $party_id);
$party->addChild('partyName', $declarant);
@@ -286,13 +286,13 @@ class IntracommReport extends CommonObject
global $mysoc, $conf;
if ($type == 'expedition' || $exporttype == 'des') {
- $sql = 'SELECT f.facnumber, f.total as total_ht';
+ $sql = 'SELECT f.ref as refinvoice, f.total as total_ht';
$table = 'facture';
$table_extraf = 'facture_extrafields';
$tabledet = 'facturedet';
$field_link = 'fk_facture';
} else { // Introduction
- $sql = 'SELECT f.ref_supplier as facnumber, f.total_ht';
+ $sql = 'SELECT f.ref_supplier as refinvoice, f.total_ht';
$table = 'facture_fourn';
$table_extraf = 'facture_fourn_extrafields';
$tabledet = 'facture_fourn_det';
@@ -330,7 +330,7 @@ class IntracommReport extends CommonObject
public function addItemXMl(&$declaration, &$res, $i, $code_douane_spe = '')
{
$item = $declaration->addChild('Item');
- $item->addChild('ItemNumber', $i);
+ $item->addChild('itemNumber', $i);
$cn8 = $item->addChild('CN8');
if (empty($code_douane_spe)) {
$code_douane = $res->customcode;
@@ -338,14 +338,15 @@ class IntracommReport extends CommonObject
$code_douane = $code_douane_spe;
}
$cn8->addChild('CN8Code', $code_douane);
+ $item->addChild('MSConsDestCode', $res->code); // code iso pays client
+ $item->addChild('countryOfOriginCode', substr($res->zip, 0, 2)); // code iso pays d'origine
+ $item->addChild('netMass', round($res->weight * $res->qty)); // Poids du produit
+ $item->addChild('quantityInSU', $res->qty); // Quantité de produit dans la ligne
+ $item->addChild('invoicedAmount', round($res->total_ht)); // Montant total ht de la facture (entier attendu)
+ // $item->addChild('invoicedNumber', $res->refinvoice); // Numéro facture
if (!empty($res->tva_intra)) {
$item->addChild('partnerId', $res->tva_intra);
}
- $item->addChild('MSConsDestCode', $res->code); // code iso pays client
- $item->addChild('netMass', $res->weight * $res->qty); // Poids du produit
- $item->addChild('quantityInSU', $res->qty); // Quantité de produit dans la ligne
- $item->addChild('invoicedAmount', round($res->total_ht)); // Montant total ht de la facture (entier attendu)
- $item->addChild('invoicedNumber', $res->facnumber); // Numéro facture
$item->addChild('statisticalProcedureCode', '11');
$nature_of_transaction = $item->addChild('NatureOfTransaction');
$nature_of_transaction->addChild('natureOfTransactionACode', 1);
@@ -389,7 +390,7 @@ class IntracommReport extends CommonObject
$table = 'facture';
$tabledet = 'facturedet';
$field_link = 'fk_facture';
- $more_sql = 'f.facnumber';
+ $more_sql = 'f.ref';
} else { // Introduction
$table = 'facture_fourn';
$tabledet = 'facture_fourn_det';
@@ -404,14 +405,14 @@ class IntracommReport extends CommonObject
INNER JOIN '.MAIN_DB_PREFIX.'product p ON (p.rowid = d.fk_product)
WHERE d.fk_product IS NOT NULL
AND f.entity = '.$conf->entity.'
- AND '.$more_sql.' = "'.$res->facnumber.'"
+ AND '.$more_sql.' = "'.$res->refinvoice.'"
AND d.total_ht =
(
SELECT MAX(d.total_ht)
FROM '.MAIN_DB_PREFIX.$tabledet.' d
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.')
WHERE d.fk_product IS NOT NULL
- AND '.$more_sql.' = "'.$res->facnumber.'"
+ AND '.$more_sql.' = "'.$res->refinvoice.'"
AND d.fk_product NOT IN
(
SELECT fk_product