Fixing style errors.
This commit is contained in:
parent
c664a1e42d
commit
ce3e658608
@ -125,6 +125,5 @@ class modIntracommreport extends DolibarrModules
|
|||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
$r=1;
|
$r=1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,8 +147,8 @@ if ($action == 'create')
|
|||||||
print $langs->trans("AnalysisPeriod");
|
print $langs->trans("AnalysisPeriod");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formother->select_month($month ? date('M') : $month,'month',0, 1, 'widthauto valignmiddle ');
|
print $formother->select_month($month ? date('M') : $month, 'month', 0, 1, 'widthauto valignmiddle ');
|
||||||
print $formother->select_year($year ? date('Y') : $year,'year',0, 3, 3);
|
print $formother->select_year($year ? date('Y') : $year, 'year', 0, 3, 3);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class Actionsintracommreport
|
|||||||
|
|
||||||
if (in_array('somecontext', explode(':', $parameters['context'])))
|
if (in_array('somecontext', explode(':', $parameters['context'])))
|
||||||
{
|
{
|
||||||
// do something only for the context 'somecontext'
|
// do something only for the context 'somecontext'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -92,7 +92,8 @@ class IntracommReport extends CommonObject
|
|||||||
* @param $mode O pour création, R pour régénération (apparemment toujours 0 dans la cadre des échanges XML selon la doc)
|
* @param $mode O pour création, R pour régénération (apparemment toujours 0 dans la cadre des échanges XML selon la doc)
|
||||||
* @param $type introduction ou expedition
|
* @param $type introduction ou expedition
|
||||||
*/
|
*/
|
||||||
function getXML($mode='O', $type='introduction', $periode_reference='') {
|
function getXML($mode = 'O', $type = 'introduction', $periode_reference = '')
|
||||||
|
{
|
||||||
|
|
||||||
global $db, $conf, $mysoc;
|
global $db, $conf, $mysoc;
|
||||||
|
|
||||||
@ -140,7 +141,7 @@ class IntracommReport extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// $type_declaration tjrs = "expedition" à voir si ça évolue
|
// $type_declaration tjrs = "expedition" à voir si ça évolue
|
||||||
function getXMLDes($period_year, $period_month, $type_declaration='expedition')
|
function getXMLDes($period_year, $period_month, $type_declaration = 'expedition')
|
||||||
{
|
{
|
||||||
global $db, $conf, $mysoc;
|
global $db, $conf, $mysoc;
|
||||||
|
|
||||||
@ -162,7 +163,8 @@ class IntracommReport extends CommonObject
|
|||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addItemsFact(&$declaration, $type, $periode_reference, $exporttype='deb') {
|
function addItemsFact(&$declaration, $type, $periode_reference, $exporttype = 'deb')
|
||||||
|
{
|
||||||
|
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -187,7 +189,6 @@ class IntracommReport extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
while($res = $db->fetch_object($resql)) {
|
while($res = $db->fetch_object($resql)) {
|
||||||
|
|
||||||
if ($exporttype == 'des')
|
if ($exporttype == 'des')
|
||||||
{
|
{
|
||||||
$this->addItemXMlDes($declaration, $res, '', $i);
|
$this->addItemXMlDes($declaration, $res, '', $i);
|
||||||
@ -196,7 +197,7 @@ class IntracommReport extends CommonObject
|
|||||||
{
|
{
|
||||||
if(empty($res->fk_pays)) {
|
if(empty($res->fk_pays)) {
|
||||||
// On n'arrête pas la boucle car on veut savoir quels sont tous les tiers qui n'ont pas de pays renseigné
|
// On n'arrête pas la boucle car on veut savoir quels sont tous les tiers qui n'ont pas de pays renseigné
|
||||||
$this->errors[] = 'Pays non renseigné pour le tiers <a href="'.dol_buildpath('/societe/soc.php',1).'?socid='.$res->id_client.'">'.$res->nom.'</a>';
|
$this->errors[] = 'Pays non renseigné pour le tiers <a href="'.dol_buildpath('/societe/soc.php', 1).'?socid='.$res->id_client.'">'.$res->nom.'</a>';
|
||||||
} else {
|
} else {
|
||||||
if($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0 && $categ_fraisdeport->containsObject('product', $res->id_prod)) {
|
if($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0 && $categ_fraisdeport->containsObject('product', $res->id_prod)) {
|
||||||
$TLinesFraisDePort[] = $res;
|
$TLinesFraisDePort[] = $res;
|
||||||
@ -205,20 +206,18 @@ class IntracommReport extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($TLinesFraisDePort)) $this->addItemFraisDePort($declaration, $TLinesFraisDePort, $type, $categ_fraisdeport, $i);
|
if(!empty($TLinesFraisDePort)) $this->addItemFraisDePort($declaration, $TLinesFraisDePort, $type, $categ_fraisdeport, $i);
|
||||||
|
|
||||||
if(count($this->errors) > 0) return 0;
|
if(count($this->errors) > 0) return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSQLFactLines($type, $periode_reference, $exporttype='deb') {
|
function getSQLFactLines($type, $periode_reference, $exporttype = 'deb')
|
||||||
|
{
|
||||||
|
|
||||||
global $mysoc, $conf;
|
global $mysoc, $conf;
|
||||||
|
|
||||||
@ -254,10 +253,10 @@ class IntracommReport extends CommonObject
|
|||||||
AND f.datef BETWEEN "'.$periode_reference.'-01" AND "'.$periode_reference.'-'.date('t').'"';
|
AND f.datef BETWEEN "'.$periode_reference.'-01" AND "'.$periode_reference.'-'.date('t').'"';
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addItemXMl(&$declaration, &$res, $code_douane_spe='', $i) {
|
function addItemXMl(&$declaration, &$res, $code_douane_spe = '', $i)
|
||||||
|
{
|
||||||
|
|
||||||
$item = $declaration->addChild('Item');
|
$item = $declaration->addChild('Item');
|
||||||
$item->addChild('ItemNumber', $i);
|
$item->addChild('ItemNumber', $i);
|
||||||
@ -277,10 +276,9 @@ class IntracommReport extends CommonObject
|
|||||||
$nature_of_transaction->addChild('natureOfTransactionBCode', 1);
|
$nature_of_transaction->addChild('natureOfTransactionBCode', 1);
|
||||||
$item->addChild('modeOfTransportCode', $res->mode_transport);
|
$item->addChild('modeOfTransportCode', $res->mode_transport);
|
||||||
$item->addChild('regionCode', substr($res->zip, 0, 2));
|
$item->addChild('regionCode', substr($res->zip, 0, 2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addItemXMlDes($declaration, &$res, $code_douane_spe='', $i)
|
function addItemXMlDes($declaration, &$res, $code_douane_spe = '', $i)
|
||||||
{
|
{
|
||||||
$item = $declaration->addChild('ligne_des');
|
$item = $declaration->addChild('ligne_des');
|
||||||
$item->addChild('numlin_des', $i);
|
$item->addChild('numlin_des', $i);
|
||||||
@ -291,7 +289,8 @@ class IntracommReport extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Cette fonction ajoute un item en récupérant le code douane du produit ayant le plus haut montant dans la facture
|
* Cette fonction ajoute un item en récupérant le code douane du produit ayant le plus haut montant dans la facture
|
||||||
*/
|
*/
|
||||||
function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i) {
|
function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i)
|
||||||
|
{
|
||||||
|
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
@ -309,7 +308,6 @@ class IntracommReport extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach($TLinesFraisDePort as $res) {
|
foreach($TLinesFraisDePort as $res) {
|
||||||
|
|
||||||
$sql = 'SELECT p.customcode
|
$sql = 'SELECT p.customcode
|
||||||
FROM '.MAIN_DB_PREFIX.$tabledet.' d
|
FROM '.MAIN_DB_PREFIX.$tabledet.' d
|
||||||
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.')
|
INNER JOIN '.MAIN_DB_PREFIX.$table.' f ON (f.rowid = d.'.$field_link.')
|
||||||
@ -338,11 +336,11 @@ class IntracommReport extends CommonObject
|
|||||||
$this->addItemXMl($declaration, $res, $ress->customcode, $i);
|
$this->addItemXMl($declaration, $res, $ress->customcode, $i);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextNumeroDeclaration() {
|
function getNextNumeroDeclaration()
|
||||||
|
{
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
$resql = $db->query('SELECT MAX(numero_declaration) as max_numero_declaration FROM '.$this->get_table().' WHERE exporttype="'.$this->exporttype.'"');
|
$resql = $db->query('SELECT MAX(numero_declaration) as max_numero_declaration FROM '.$this->get_table().' WHERE exporttype="'.$this->exporttype.'"');
|
||||||
@ -352,12 +350,14 @@ class IntracommReport extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// La doc impose que le numéro soit un entier positif d'un maximum de 6 caractères
|
// La doc impose que le numéro soit un entier positif d'un maximum de 6 caractères
|
||||||
static function getNumeroDeclaration($numero) {
|
static function getNumeroDeclaration($numero)
|
||||||
|
{
|
||||||
|
|
||||||
return str_pad($numero, 6, 0, STR_PAD_LEFT);
|
return str_pad($numero, 6, 0, STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateXMLFile() {
|
function generateXMLFile()
|
||||||
|
{
|
||||||
|
|
||||||
$name = $this->periode.'.xml';
|
$name = $this->periode.'.xml';
|
||||||
$fname = sys_get_temp_dir().'/'.$name;
|
$fname = sys_get_temp_dir().'/'.$name;
|
||||||
@ -374,6 +374,5 @@ class IntracommReport extends CommonObject
|
|||||||
header('Content-Length: ' . filesize($fname));
|
header('Content-Length: ' . filesize($fname));
|
||||||
readfile($fname);
|
readfile($fname);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user