WIP
This commit is contained in:
parent
abfb708044
commit
20b516885f
@ -312,9 +312,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
|||||||
|
|
||||||
// Accounting
|
// Accounting
|
||||||
$tmpentry = array(
|
$tmpentry = array(
|
||||||
'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)),
|
'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled) || ! empty($conf->intracommreport->enabled)),
|
||||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)),
|
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read) || ! empty($user->rights->intracommreport->read)),
|
||||||
'module'=>'comptabilite|accounting|asset'
|
'module'=>'comptabilite|accounting|asset|intracommreport'
|
||||||
);
|
);
|
||||||
$menu_arr[] = array(
|
$menu_arr[] = array(
|
||||||
'name' => 'Accounting',
|
'name' => 'Accounting',
|
||||||
@ -333,7 +333,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
|||||||
|
|
||||||
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 0 : 1 ),
|
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 0 : 1 ),
|
||||||
|
|
||||||
'loadLangs' => array("compta","accountancy","assets"),
|
'loadLangs' => array("compta","accountancy","assets","intracommreport"),
|
||||||
'submenus' => array(),
|
'submenus' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -112,6 +112,13 @@ class modIntracommreport extends DolibarrModules
|
|||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'write';
|
$this->rights[$r][4] = 'write';
|
||||||
|
|
||||||
|
$this->rights[$r][0] = 68004;
|
||||||
|
$this->rights[$r][1] = 'Delete intracomm report';
|
||||||
|
$this->rights[$r][2] = 'd';
|
||||||
|
$this->rights[$r][3] = 0;
|
||||||
|
$this->rights[$r][4] = 'delete';
|
||||||
|
$r++;
|
||||||
|
|
||||||
// Main menu entries
|
// Main menu entries
|
||||||
$this->menu = array(); // List of menus to add
|
$this->menu = array(); // List of menus to add
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|||||||
49
htdocs/install/mysql/migration/10.0.0-11.0.0.sql
Normal file
49
htdocs/install/mysql/migration/10.0.0-11.0.0.sql
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
--
|
||||||
|
-- Be carefull to requests order.
|
||||||
|
-- This file must be loaded by calling /install/index.php page
|
||||||
|
-- when current version is 11.0.0 or higher.
|
||||||
|
--
|
||||||
|
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
|
||||||
|
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
|
||||||
|
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
|
||||||
|
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
|
||||||
|
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
|
||||||
|
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
|
||||||
|
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
|
||||||
|
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
|
||||||
|
-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
|
||||||
|
-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
|
||||||
|
-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
|
||||||
|
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
|
||||||
|
-- To make pk to be auto increment (postgres):
|
||||||
|
-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
|
||||||
|
-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
|
||||||
|
-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
|
||||||
|
-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
|
||||||
|
-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
|
||||||
|
-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
|
||||||
|
-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
|
||||||
|
-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
|
||||||
|
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
|
||||||
|
-- Note: fields with type BLOB/TEXT can't have default value.
|
||||||
|
|
||||||
|
-- Missing in 10.0
|
||||||
|
|
||||||
|
|
||||||
|
-- For 11.0
|
||||||
|
|
||||||
|
CREATE TABLE llx_intracommreport
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
|
||||||
|
ref varchar(30) NOT NULL, -- report reference number
|
||||||
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
|
type_declaration varchar(32),
|
||||||
|
period varchar(32),
|
||||||
|
mode varchar(32),
|
||||||
|
content_xml text,
|
||||||
|
type_export varchar(10),
|
||||||
|
datec datetime,
|
||||||
|
tms timestamp
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
@ -411,16 +411,3 @@ INSERT INTO llx_c_transport_mode (code, libelle, active) VALUES ('PRO', 'Propuls
|
|||||||
|
|
||||||
ALTER TABLE llx_facture ADD COLUMN fk_mode_transport integer after location_incoterms;
|
ALTER TABLE llx_facture ADD COLUMN fk_mode_transport integer after location_incoterms;
|
||||||
ALTER TABLE llx_facture_fourn ADD COLUMN fk_mode_transport integer after location_incoterms;
|
ALTER TABLE llx_facture_fourn ADD COLUMN fk_mode_transport integer after location_incoterms;
|
||||||
|
|
||||||
create table llx_intracommreport
|
|
||||||
(
|
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
|
|
||||||
ref varchar(30) NOT NULL, -- report reference number
|
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
|
||||||
type_declaration varchar(32),
|
|
||||||
periode varchar(32),
|
|
||||||
mode varchar(32),
|
|
||||||
content_xml text,
|
|
||||||
exporttype varchar(10)
|
|
||||||
)ENGINE=innodb;
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Copyright (C) 2019 Open-DSI <aspangaro@open-dsi.fr>
|
-- Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
|
||||||
|
-- Copyright (C) 2019 Open-DSI <support@open-dsi.fr>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@ -23,8 +24,10 @@ create table llx_intracommreport
|
|||||||
ref varchar(30) NOT NULL, -- report reference number
|
ref varchar(30) NOT NULL, -- report reference number
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
type_declaration varchar(32),
|
type_declaration varchar(32),
|
||||||
periode varchar(32),
|
period varchar(32),
|
||||||
mode varchar(32),
|
mode varchar(32),
|
||||||
content_xml text,
|
content_xml text,
|
||||||
exporttype varchar(10)
|
type_export varchar(10),
|
||||||
|
datec datetime,
|
||||||
|
tms timestamp
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2019 Open-DSI <support@open-dsi.fr>
|
/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2019 Open-DSI <support@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,17 +21,48 @@
|
|||||||
* \ingroup Intracomm report
|
* \ingroup Intracomm report
|
||||||
* \brief File of class to manage intracomm report
|
* \brief File of class to manage intracomm report
|
||||||
*/
|
*/
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage intracomm report
|
* Class to manage intracomm report
|
||||||
*/
|
*/
|
||||||
class IntracommReport extends CommonObject
|
class IntracommReport extends CommonObject
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string ID to identify managed object
|
||||||
|
*/
|
||||||
|
public $element='intracommreport';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Name of table without prefix where object is stored
|
||||||
|
*/
|
||||||
|
public $table_element='intracommreport';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Field with ID of parent key if this field has a parent
|
||||||
|
*/
|
||||||
|
public $fk_element='fk_intracommreport';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $ismultientitymanaged = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DEB - Product
|
||||||
|
*/
|
||||||
|
const TYPE_DEB = 0;
|
||||||
|
/**
|
||||||
|
* DES - Service
|
||||||
|
*/
|
||||||
|
const TYPE_DES = 1;
|
||||||
|
|
||||||
static $type = array(
|
static $type = array(
|
||||||
'introduction'=>'Introduction'
|
'introduction'=>'Introduction'
|
||||||
,'expedition'=>'Expédition'
|
,'expedition'=>'Expédition'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -52,11 +84,10 @@ class IntracommReport extends CommonObject
|
|||||||
parent::start();
|
parent::start();
|
||||||
parent::_init_vars();
|
parent::_init_vars();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$this->exporttype = 'deb';
|
$this->exporttype = 'deb';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
@ -64,16 +95,16 @@ class IntracommReport extends CommonObject
|
|||||||
function getXML($mode='O', $type='introduction', $periode_reference='') {
|
function getXML($mode='O', $type='introduction', $periode_reference='') {
|
||||||
|
|
||||||
global $db, $conf, $mysoc;
|
global $db, $conf, $mysoc;
|
||||||
|
|
||||||
/**************Construction de quelques variables********************/
|
/**************Construction de quelques variables********************/
|
||||||
$party_id = substr(strtr($mysoc->tva_intra, array(' '=>'')), 0, 4).$mysoc->idprof2;
|
$party_id = substr(strtr($mysoc->tva_intra, array(' '=>'')), 0, 4).$mysoc->idprof2;
|
||||||
$declarant = substr($mysoc->managers, 0, 14);
|
$declarant = substr($mysoc->managers, 0, 14);
|
||||||
$id_declaration = self::getNumeroDeclaration($this->numero_declaration);
|
$id_declaration = self::getNumeroDeclaration($this->numero_declaration);
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
/**************Construction du fichier XML***************************/
|
/**************Construction du fichier XML***************************/
|
||||||
$e = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" standalone="yes"?><INSTAT></INSTAT>');
|
$e = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" standalone="yes"?><INSTAT></INSTAT>');
|
||||||
|
|
||||||
$enveloppe = $e->addChild('Envelope');
|
$enveloppe = $e->addChild('Envelope');
|
||||||
$enveloppe->addChild('envelopeId', $conf->global->INTRACOMMREPORT_NUM_AGREMENT);
|
$enveloppe->addChild('envelopeId', $conf->global->INTRACOMMREPORT_NUM_AGREMENT);
|
||||||
$date_time = $enveloppe->addChild('DateTime');
|
$date_time = $enveloppe->addChild('DateTime');
|
||||||
@ -97,69 +128,66 @@ class IntracommReport extends CommonObject
|
|||||||
$declaration->addChild('flowCode', ($type == 'introduction' ? 'A' : 'D'));
|
$declaration->addChild('flowCode', ($type == 'introduction' ? 'A' : 'D'));
|
||||||
$declaration->addChild('currencyCode', $conf->global->MAIN_MONNAIE);
|
$declaration->addChild('currencyCode', $conf->global->MAIN_MONNAIE);
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
/**************Ajout des lignes de factures**************************/
|
/**************Ajout des lignes de factures**************************/
|
||||||
$res = self::addItemsFact($declaration, $type, $periode_reference);
|
$res = self::addItemsFact($declaration, $type, $periode_reference);
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
$this->errors = array_unique($this->errors);
|
$this->errors = array_unique($this->errors);
|
||||||
|
|
||||||
if(!empty($res)) return $e->asXML();
|
if(!empty($res)) return $e->asXML();
|
||||||
else return 0;
|
else return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// $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;
|
||||||
|
|
||||||
|
|
||||||
$e = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?><fichier_des></fichier_des>');
|
$e = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?><fichier_des></fichier_des>');
|
||||||
|
|
||||||
$declaration_des = $e->addChild('declaration_des');
|
$declaration_des = $e->addChild('declaration_des');
|
||||||
$declaration_des->addChild('num_des', self::getNumeroDeclaration($this->numero_declaration));
|
$declaration_des->addChild('num_des', self::getNumeroDeclaration($this->numero_declaration));
|
||||||
$declaration_des->addChild('num_tvaFr', $mysoc->tva_intra); // /^FR[a-Z0-9]{2}[0-9]{9}$/ // Doit faire 13 caractères
|
$declaration_des->addChild('num_tvaFr', $mysoc->tva_intra); // /^FR[a-Z0-9]{2}[0-9]{9}$/ // Doit faire 13 caractères
|
||||||
$declaration_des->addChild('mois_des', $period_month);
|
$declaration_des->addChild('mois_des', $period_month);
|
||||||
$declaration_des->addChild('an_des', $period_year);
|
$declaration_des->addChild('an_des', $period_year);
|
||||||
|
|
||||||
|
|
||||||
/**************Ajout des lignes de factures**************************/
|
/**************Ajout des lignes de factures**************************/
|
||||||
$res = self::addItemsFact($declaration_des, $type_declaration, $period_year.'-'.$period_month, 'des');
|
$res = self::addItemsFact($declaration_des, $type_declaration, $period_year.'-'.$period_month, 'des');
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
$this->errors = array_unique($this->errors);
|
$this->errors = array_unique($this->errors);
|
||||||
|
|
||||||
if(!empty($res)) return $e->asXML();
|
if(!empty($res)) return $e->asXML();
|
||||||
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;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
|
|
||||||
$sql = $this->getSQLFactLines($type, $periode_reference, $exporttype);
|
$sql = $this->getSQLFactLines($type, $periode_reference, $exporttype);
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
if($resql) {
|
if($resql) {
|
||||||
$i=1;
|
$i=1;
|
||||||
|
|
||||||
if(empty($resql->num_rows)) {
|
if(empty($resql->num_rows)) {
|
||||||
$this->errors[] = 'Aucune donnée pour cette période';
|
$this->errors[] = 'Aucune donnée pour cette période';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($exporttype == 'deb' && $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0) {
|
if($exporttype == 'deb' && $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0) {
|
||||||
$categ_fraisdeport = new Categorie($db);
|
$categ_fraisdeport = new Categorie($db);
|
||||||
$categ_fraisdeport->fetch($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT);
|
$categ_fraisdeport->fetch($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT);
|
||||||
$TLinesFraisDePort = array();
|
$TLinesFraisDePort = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@ -175,25 +203,25 @@ class IntracommReport extends CommonObject
|
|||||||
} else $this->addItemXMl($declaration, $res, '', $i);
|
} else $this->addItemXMl($declaration, $res, '', $i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$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;
|
||||||
|
|
||||||
if($type=='expedition' || $exporttype=='des') {
|
if($type=='expedition' || $exporttype=='des') {
|
||||||
$sql = 'SELECT f.facnumber, f.total as total_ht';
|
$sql = 'SELECT f.facnumber, f.total as total_ht';
|
||||||
$table = 'facture';
|
$table = 'facture';
|
||||||
@ -224,13 +252,13 @@ class IntracommReport extends CommonObject
|
|||||||
AND f.entity = '.$conf->entity.'
|
AND f.entity = '.$conf->entity.'
|
||||||
AND (s.fk_pays <> '.$mysoc->country_id.' OR s.fk_pays IS NULL)
|
AND (s.fk_pays <> '.$mysoc->country_id.' OR s.fk_pays IS NULL)
|
||||||
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);
|
||||||
$cn8 = $item->addChild('CN8');
|
$cn8 = $item->addChild('CN8');
|
||||||
@ -249,7 +277,7 @@ 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)
|
||||||
@ -259,14 +287,14 @@ class IntracommReport extends CommonObject
|
|||||||
$item->addChild('valeur', round($res->total_ht)); // Montant total ht de la facture (entier attendu)
|
$item->addChild('valeur', round($res->total_ht)); // Montant total ht de la facture (entier attendu)
|
||||||
$item->addChild('partner_des', $res->tva_intra); // Représente le numéro TVA du client étranger
|
$item->addChild('partner_des', $res->tva_intra); // Représente le numéro TVA du client étranger
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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;
|
||||||
|
|
||||||
if($type=='expedition') {
|
if($type=='expedition') {
|
||||||
$table = 'facture';
|
$table = 'facture';
|
||||||
$tabledet = 'facturedet';
|
$tabledet = 'facturedet';
|
||||||
@ -279,9 +307,9 @@ class IntracommReport extends CommonObject
|
|||||||
$field_link = 'fk_facture_fourn';
|
$field_link = 'fk_facture_fourn';
|
||||||
$more_sql = 'f.ref_supplier';
|
$more_sql = 'f.ref_supplier';
|
||||||
}
|
}
|
||||||
|
|
||||||
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.')
|
||||||
@ -303,43 +331,40 @@ class IntracommReport extends CommonObject
|
|||||||
WHERE fk_categorie = '.$categ_fraisdeport->id.'
|
WHERE fk_categorie = '.$categ_fraisdeport->id.'
|
||||||
)
|
)
|
||||||
)';
|
)';
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$ress = $db->fetch_object($resql);
|
$ress = $db->fetch_object($resql);
|
||||||
|
|
||||||
$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.'"');
|
||||||
if($resql) $res = $db->fetch_object($resql);
|
if($resql) $res = $db->fetch_object($resql);
|
||||||
|
|
||||||
return ($res->max_numero_declaration + 1);
|
return ($res->max_numero_declaration + 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
$f = fopen($fname, 'w+');
|
$f = fopen($fname, 'w+');
|
||||||
fwrite($f, $this->content_xml);
|
fwrite($f, $this->content_xml);
|
||||||
fclose($f);
|
fclose($f);
|
||||||
|
|
||||||
header('Content-Description: File Transfer');
|
header('Content-Description: File Transfer');
|
||||||
header('Content-Type: application/xml');
|
header('Content-Type: application/xml');
|
||||||
header('Content-Disposition: attachment; filename="'.$name.'"');
|
header('Content-Disposition: attachment; filename="'.$name.'"');
|
||||||
@ -349,7 +374,6 @@ class IntracommReport extends CommonObject
|
|||||||
header('Content-Length: ' . filesize($fname));
|
header('Content-Length: ' . filesize($fname));
|
||||||
readfile($fname);
|
readfile($fname);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ $action = GETPOST('action');
|
|||||||
$exporttype = GETPOST('exporttype'); // DEB ou DES
|
$exporttype = GETPOST('exporttype'); // DEB ou DES
|
||||||
if (empty($exporttype)) $exporttype = 'deb';
|
if (empty($exporttype)) $exporttype = 'deb';
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$year = GETPOST('year');
|
$year = GETPOST('year');
|
||||||
$month = GETPOST('month');
|
$month = GETPOST('month');
|
||||||
@ -58,7 +59,7 @@ switch($action) {
|
|||||||
|
|
||||||
function _print_form_deb() {
|
function _print_form_deb() {
|
||||||
|
|
||||||
global $langs, $formother, $year, $month, $type_declaration;
|
global $langs, $form, $formother, $year, $month, $type, $type_declaration;
|
||||||
|
|
||||||
$title = $langs->trans("IntracommReportDEBTitle");
|
$title = $langs->trans("IntracommReportDEBTitle");
|
||||||
llxHeader("", $title);
|
llxHeader("", $title);
|
||||||
@ -83,7 +84,8 @@ function _print_form_deb() {
|
|||||||
$TabMonth = array();
|
$TabMonth = array();
|
||||||
for($i=1;$i<=12;$i++) $TabMonth[$i] = $langs->trans('Month'.str_pad($i, 2, 0, STR_PAD_LEFT));
|
for($i=1;$i<=12;$i++) $TabMonth[$i] = $langs->trans('Month'.str_pad($i, 2, 0, STR_PAD_LEFT));
|
||||||
//print $ATMform->combo('','month', $TabMonth, empty($month) ? date('m') : $month);
|
//print $ATMform->combo('','month', $TabMonth, empty($month) ? date('m') : $month);
|
||||||
print $formother->selectyear(empty($year) ? date('Y') : $year,'year',0, 20, 5);
|
print $formother->select_month(empty($month) ? date('M') : $month,'month',0, 1);
|
||||||
|
print $formother->select_year(empty($year) ? date('Y') : $year,'year',0, 3, 3);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
@ -92,7 +94,8 @@ function _print_form_deb() {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
//print $ATMform->combo('','type', array('introduction'=>'Introduction', 'expedition'=>'Expédition'), $type_declaration);
|
//print $ATMform->combo('','type', array('introduction'=>'Introduction', 'expedition'=>'Expédition'), $type_declaration);
|
||||||
print '</td>';
|
print $form->selectarray('type', $type, $type_declaration);
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -120,13 +123,13 @@ function _print_form_des()
|
|||||||
print '<input type="hidden" name="action" value="export" />';
|
print '<input type="hidden" name="action" value="export" />';
|
||||||
print '<input type="hidden" name="exporttype" value="des" />';
|
print '<input type="hidden" name="exporttype" value="des" />';
|
||||||
print '<input type="hidden" name="type" value="expedition" />'; // Permet d'utiliser le bon select de la requête sql
|
print '<input type="hidden" name="type" value="expedition" />'; // Permet d'utiliser le bon select de la requête sql
|
||||||
|
|
||||||
print '<table width="100%" class="noborder" style="background-color: #fff;">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
print '<tr class="liste_titre"><td colspan="2">';
|
print '<tr class="liste_titre"><td colspan="2">';
|
||||||
print 'Paramètres de l\'export';
|
print 'Paramètres de l\'export';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>Période d\'analyse</td>';
|
print '<td>Période d\'analyse</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -136,22 +139,21 @@ function _print_form_des()
|
|||||||
print $formother->selectyear(empty($year) ? date('Y') : $year,'year',0, 20, 5);
|
print $formother->selectyear(empty($year) ? date('Y') : $year,'year',0, 20, 5);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
print '<input class="butAction" type="submit" value="Exporter XML" />';
|
print '<input class="butAction" type="submit" value="Exporter XML" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _export_xml_deb($type_declaration, $period_year, $period_month) {
|
function _export_xml_deb($type_declaration, $period_year, $period_month) {
|
||||||
|
|
||||||
global $PDOdb, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj = new TDebProdouane($PDOdb);
|
$obj = new TDebProdouane($db);
|
||||||
$obj->entity = $conf->entity;
|
$obj->entity = $conf->entity;
|
||||||
$obj->mode = 'O';
|
$obj->mode = 'O';
|
||||||
$obj->periode = $period_year.'-'.$period_month;
|
$obj->periode = $period_year.'-'.$period_month;
|
||||||
@ -163,13 +165,12 @@ function _export_xml_deb($type_declaration, $period_year, $period_month) {
|
|||||||
$obj->generateXMLFile();
|
$obj->generateXMLFile();
|
||||||
}
|
}
|
||||||
else setEventMessage($obj->errors, 'warnings');
|
else setEventMessage($obj->errors, 'warnings');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _export_xml_des($type_declaration, $period_year, $period_month) {
|
function _export_xml_des($type_declaration, $period_year, $period_month) {
|
||||||
|
|
||||||
global $PDOdb, $conf;
|
global $PDOdb, $conf;
|
||||||
|
|
||||||
$obj = new TDebProdouane($PDOdb);
|
$obj = new TDebProdouane($PDOdb);
|
||||||
$obj->entity = $conf->entity;
|
$obj->entity = $conf->entity;
|
||||||
$obj->periode = $period_year.'-'.$period_month;
|
$obj->periode = $period_year.'-'.$period_month;
|
||||||
@ -182,49 +183,6 @@ function _export_xml_des($type_declaration, $period_year, $period_month) {
|
|||||||
$obj->generateXMLFile();
|
$obj->generateXMLFile();
|
||||||
}
|
}
|
||||||
else setEventMessage($obj->errors, 'warnings');
|
else setEventMessage($obj->errors, 'warnings');
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function _liste($exporttype='deb') {
|
|
||||||
|
|
||||||
global $db, $conf, $PDOdb, $langs;
|
|
||||||
|
|
||||||
$langs->load('intracommreport');
|
|
||||||
|
|
||||||
llxHeader();
|
|
||||||
$l = new TListviewTBS('intracommreport');
|
|
||||||
|
|
||||||
$sql = 'SELECT numero_declaration, type_declaration, periode, rowid as dl
|
|
||||||
FROM '.MAIN_DB_PREFIX.'intracommreport
|
|
||||||
WHERE entity = '.$conf->entity.' AND exporttype = '.$PDOdb->quote($exporttype);
|
|
||||||
|
|
||||||
print $l->render($PDOdb, $sql, array(
|
|
||||||
'type'=>array(
|
|
||||||
//'date_cre'=>'date'
|
|
||||||
)
|
|
||||||
,'link'=>array(
|
|
||||||
'dl'=>'<a href="'.dol_buildpath('/intracommreport/export.php', 1).'?action=generateXML&id_declaration=@dl@">'.img_picto('', 'file.png').'</a>'
|
|
||||||
)
|
|
||||||
,'eval'=>array(
|
|
||||||
'numero_declaration'=>'TDebProdouane::getNumeroDeclaration("@val@")'
|
|
||||||
,'type_declaration'=>'TDebProdouane::$TType["@val@"]'
|
|
||||||
)
|
|
||||||
,'liste'=>array(
|
|
||||||
'titre'=>$langs->trans('intracommreportList'.$exporttype)
|
|
||||||
,'image'=>img_picto('','title.png', '', 0)
|
|
||||||
,'picto_precedent'=>img_picto('','back.png', '', 0)
|
|
||||||
,'picto_suivant'=>img_picto('','next.png', '', 0)
|
|
||||||
,'messageNothing'=>"Il n'y a aucune déclaration à afficher"
|
|
||||||
,'picto_search'=>img_picto('','search.png', '', 0)
|
|
||||||
)
|
|
||||||
,'title'=>array(
|
|
||||||
'numero_declaration'=>$langs->trans('intracommreportNumber')
|
|
||||||
,'type_declaration'=>$langs->trans('intracommreportTypeDeclaration')
|
|
||||||
,'periode'=>$langs->trans('intracommreportPeriod')
|
|
||||||
,'dl'=>$langs->trans('intracommreportDownload')
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
588
htdocs/intracommreport/list.php
Normal file
588
htdocs/intracommreport/list.php
Normal file
@ -0,0 +1,588 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2019 Open-DSI <support@open-dsi.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
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/intracommreport/list.php
|
||||||
|
* \ingroup Intracomm Report
|
||||||
|
* \brief Page to list intracomm report
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/intracommreport/class/intracommreport.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
|
||||||
|
// Load translation files required by the page
|
||||||
|
$langs->loadLangs(array('intracommreport'));
|
||||||
|
|
||||||
|
$action=GETPOST('action', 'alpha');
|
||||||
|
$massaction=GETPOST('massaction', 'alpha');
|
||||||
|
$show_files=GETPOST('show_files', 'int');
|
||||||
|
$confirm=GETPOST('confirm', 'alpha');
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
|
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||||
|
$search_ref=GETPOST("search_ref", 'alpha');
|
||||||
|
$search_type = GETPOST("search_type", 'int');
|
||||||
|
$fourn_id = GETPOST("fourn_id", 'int');
|
||||||
|
$catid = GETPOST('catid', 'int');
|
||||||
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
|
$type=GETPOST("type", "int");
|
||||||
|
|
||||||
|
$diroutputmassaction=$conf->product->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
|
|
||||||
|
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||||
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
|
$page = (GETPOST("page", 'int')?GETPOST("page", 'int'):0);
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
if (! $sortfield) $sortfield="i.ref";
|
||||||
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
|
||||||
|
// Initialize context for list
|
||||||
|
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'intracommreportlist';
|
||||||
|
if ((string) $type == '1') { $contextpage='DESlist'; if ($search_type=='') $search_type='1'; }
|
||||||
|
if ((string) $type == '0') { $contextpage='DEBlist'; if ($search_type=='') $search_type='0'; }
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||||
|
$object=new IntracommReport($db);
|
||||||
|
$hookmanager->initHooks(array('intracommreportlist'));
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label('intracommreport');
|
||||||
|
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (empty($action)) $action='list';
|
||||||
|
|
||||||
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
|
$canvas=GETPOST("canvas");
|
||||||
|
$objcanvas=null;
|
||||||
|
if (! empty($canvas))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
|
||||||
|
$objcanvas = new Canvas($db, $action);
|
||||||
|
$objcanvas->getCanvas('product', 'list', $canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
/*
|
||||||
|
if ($search_type=='0') $result=restrictedArea($user, 'produit', '', '', '', '', '', $objcanvas);
|
||||||
|
elseif ($search_type=='1') $result=restrictedArea($user, 'service', '', '', '', '', '', $objcanvas);
|
||||||
|
else $result=restrictedArea($user, 'produit|service', '', '', '', '', '', $objcanvas);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// List of fields to search into when doing a "search in all"
|
||||||
|
$fieldstosearchall = array(
|
||||||
|
'i.ref'=>"Ref",
|
||||||
|
'pfi.ref_fourn'=>"RefSupplier",
|
||||||
|
'i.label'=>"ProductLabel",
|
||||||
|
'i.description'=>"Description",
|
||||||
|
"i.note"=>"Note",
|
||||||
|
);
|
||||||
|
|
||||||
|
$isInEEC=isInEEC($mysoc);
|
||||||
|
|
||||||
|
// Definition of fields for lists
|
||||||
|
$arrayfields=array(
|
||||||
|
'i.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||||
|
//'pfi.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
|
||||||
|
'i.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
|
'i.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->service->enabled))),
|
||||||
|
'i.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
|
||||||
|
'i.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))),
|
||||||
|
'i.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled))),
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
|
// Purge search criteria
|
||||||
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$sall="";
|
||||||
|
$search_ref="";
|
||||||
|
$search_label="";
|
||||||
|
$search_barcode="";
|
||||||
|
$search_categ=0;
|
||||||
|
$search_tosell="";
|
||||||
|
$search_tobuy="";
|
||||||
|
$search_tobatch='';
|
||||||
|
//$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.
|
||||||
|
|
||||||
|
$show_childproducts = '';
|
||||||
|
$search_array_options=array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
|
$objectclass='Product';
|
||||||
|
if ((string) $search_type == '1') { $objectlabel='Services'; }
|
||||||
|
if ((string) $search_type == '0') { $objectlabel='Products'; }
|
||||||
|
|
||||||
|
$permtoread = $user->rights->produit->lire;
|
||||||
|
$permtodelete = $user->rights->produit->supprimer;
|
||||||
|
$uploaddir = $conf->product->dir_output;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
$formother=new FormOther($db);
|
||||||
|
|
||||||
|
$title=$langs->trans('IntracommReportList'.$type);
|
||||||
|
|
||||||
|
$sql = 'SELECT DISTINCT i.rowid, i.type_declaration, i.type_export, i.period, i.mode, i.entity';
|
||||||
|
/*
|
||||||
|
// Add fields from extrafields
|
||||||
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// Add fields from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'intracommreport as i';
|
||||||
|
|
||||||
|
// if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."intracommreport_extrafields as ef on (i.rowid = ef.fk_object)";
|
||||||
|
|
||||||
|
$sql.= ' WHERE i.entity IN ('.getEntity('intracommreport').')';
|
||||||
|
|
||||||
|
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
|
// if the type is not 1, we show all products (type = 0,2,3)
|
||||||
|
if (dol_strlen($search_type) && $search_type != '-1')
|
||||||
|
{
|
||||||
|
if ($search_type == 1) $sql.= " AND i.type = 1";
|
||||||
|
else $sql.= " AND i.type = 0";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($search_ref) $sql .= natural_search('i.ref', $search_ref);
|
||||||
|
if ($search_label) $sql .= natural_search('i.label', $search_label);
|
||||||
|
if ($search_barcode) $sql .= natural_search('i.barcode', $search_barcode);
|
||||||
|
if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND i.tosell = ".$db->escape($search_tosell);
|
||||||
|
if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND i.tobuy = ".$db->escape($search_tobuy);
|
||||||
|
if (dol_strlen($canvas) > 0) $sql.= " AND i.canvas = '".$db->escape($canvas)."'";
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Add where from extra fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
|
*/
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
|
$sql.= " GROUP BY i.rowid";
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Add fields from extrafields
|
||||||
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Add fields from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
|
$helpurl='EN:Module_IntracommReport|FR:Module_ProDouane';
|
||||||
|
llxHeader('', $title, $helpurl, '');
|
||||||
|
|
||||||
|
// Displays product removal confirmation
|
||||||
|
if (GETPOST('delprod')) {
|
||||||
|
setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
|
||||||
|
}
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
if ($sall) $param.="&sall=".urlencode($sall);
|
||||||
|
if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ);
|
||||||
|
if ($search_ref) $param="&search_ref=".urlencode($search_ref);
|
||||||
|
if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier);
|
||||||
|
if ($search_barcode) $param.=($search_barcode?"&search_barcode=".urlencode($search_barcode):"");
|
||||||
|
if ($search_label) $param.="&search_label=".urlencode($search_label);
|
||||||
|
|
||||||
|
// Add $param from extra fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
|
// List of mass actions available
|
||||||
|
$arrayofmassactions = array(
|
||||||
|
'generate_doc'=>$langs->trans("ReGeneratePDF"),
|
||||||
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
|
);
|
||||||
|
if ($user->rights->intracommreport->delete) $arrayofmassactions['predelete']="<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
|
||||||
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
|
$newcardbutton='';
|
||||||
|
$rightskey='DEB';
|
||||||
|
if($type == IntracommReport::TYPE_DES) $rightskey='DES';
|
||||||
|
if($user->rights->{$rightskey}->creer)
|
||||||
|
{
|
||||||
|
$label='NewDEB';
|
||||||
|
if($type == IntracommReport::TYPE_DES) $label='NewDES';
|
||||||
|
$newcardbutton.= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/intracommreport/card.php?action=create&type='.$type);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
||||||
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
|
print '<input type="hidden" name="action" value="list">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
|
if (empty($arrayfields['i.fk_product_type']['checked'])) print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
|
||||||
|
|
||||||
|
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
|
$topicmail="Information";
|
||||||
|
$modelmail="product";
|
||||||
|
$objecttmp=new IntracommReport($db);
|
||||||
|
$trackid='prod'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
|
if ($sall)
|
||||||
|
{
|
||||||
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint;
|
||||||
|
else $moreforfilter=$hookmanager->resPrint;
|
||||||
|
|
||||||
|
if ($moreforfilter)
|
||||||
|
{
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
|
print $moreforfilter;
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
|
|
||||||
|
// Lines with input filters
|
||||||
|
print '<tr class="liste_titre_filter">';
|
||||||
|
if (! empty($arrayfields['i.ref']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre left">';
|
||||||
|
print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['pfi.ref_fourn']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre left">';
|
||||||
|
print '<input class="flat" type="text" name="search_ref_supplier" size="8" value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['i.label']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre left">';
|
||||||
|
print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Type
|
||||||
|
if (! empty($arrayfields['i.fk_product_type']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre left">';
|
||||||
|
$array=array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
|
||||||
|
print $form->selectarray('search_type', $array, $search_type);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Barcode
|
||||||
|
if (! empty($arrayfields['i.barcode']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input class="flat" type="text" name="search_barcode" size="6" value="'.dol_escape_htmltag($search_barcode).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Duration
|
||||||
|
if ((string) $type == '1' && ! empty($arrayfields['i.duration']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Weight
|
||||||
|
if (! empty($arrayfields['i.weight']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// Extra fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
|
*/
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
// Date creation
|
||||||
|
if (! empty($arrayfields['i.datec']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Date modification
|
||||||
|
if (! empty($arrayfields['i.tms']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
print '<td class="liste_titre center maxwidthsearch">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
if (! empty($arrayfields['i.ref']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['i.ref']['label'], $_SERVER["PHP_SELF"], "i.ref", "", $param, "", $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['i.label']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['i.label']['label'], $_SERVER["PHP_SELF"], "i.label", "", $param, "", $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['i.fk_product_type']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['i.fk_product_type']['label'], $_SERVER["PHP_SELF"], "i.fk_product_type", "", $param, "", $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['i.barcode']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['i.barcode']['label'], $_SERVER["PHP_SELF"], "i.barcode", "", $param, "", $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
if ((string) $type == '1' && ! empty($arrayfields['i.duration']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['i.duration']['label'], $_SERVER["PHP_SELF"], "i.duration", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['i.weight']['checked'])) print_liste_field_titre($arrayfields['i.weight']['label'], $_SERVER["PHP_SELF"], "i.weight", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Extra fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
|
*/
|
||||||
|
// Hook fields
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
if (! empty($arrayfields['i.datec']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['i.datec']['label'], $_SERVER["PHP_SELF"], "i.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['i.tms']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['i.tms']['label'], $_SERVER["PHP_SELF"], "i.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||||
|
}
|
||||||
|
|
||||||
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
|
$intracommreport_static = new IntracommReport($db);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$totalarray=array();
|
||||||
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
$intracommreport_static->id = $obj->rowid;
|
||||||
|
$intracommreport_static->ref = $obj->ref;
|
||||||
|
$intracommreport_static->ref_fourn = $obj->ref_supplier;
|
||||||
|
$intracommreport_static->label = $obj->label;
|
||||||
|
$intracommreport_static->type = $obj->fk_product_type;
|
||||||
|
$intracommreport_static->status_buy = $obj->tobuy;
|
||||||
|
$intracommreport_static->status = $obj->tosell;
|
||||||
|
$intracommreport_static->status_batch = $obj->tobatch;
|
||||||
|
$intracommreport_static->entity = $obj->entity;
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
if (! empty($arrayfields['i.ref']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax200">';
|
||||||
|
print $intracommreport_static->getNomUrl(1);
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
// Ref supplier
|
||||||
|
if (! empty($arrayfields['pfi.ref_fourn']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax200">';
|
||||||
|
print $intracommreport_static->getNomUrl(1);
|
||||||
|
print "</td>\n";
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
// Label
|
||||||
|
if (! empty($arrayfields['i.label']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax200">'.dol_trunc($obj->label, 80).'</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type
|
||||||
|
if (! empty($arrayfields['i.fk_product_type']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>'.$obj->fk_product_type.'</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Barcode
|
||||||
|
if (! empty($arrayfields['i.barcode']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>'.$obj->barcode.'</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duration
|
||||||
|
if ((string) $type == '1' && ! empty($arrayfields['i.duration']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="center nowraponall">';
|
||||||
|
|
||||||
|
if (preg_match('/([^a-z]+)[a-z]$/i', $obj->duration))
|
||||||
|
{
|
||||||
|
$duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1);
|
||||||
|
$duration_unit = substr($obj->duration, -1);
|
||||||
|
|
||||||
|
if ((float) $duration_value > 1)
|
||||||
|
{
|
||||||
|
$dur=array("i"=>$langs->trans("Minutes"),"h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
|
||||||
|
}
|
||||||
|
elseif ((float) $duration_value > 0)
|
||||||
|
{
|
||||||
|
$dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||||
|
}
|
||||||
|
print $duration_value;
|
||||||
|
print (! empty($duration_unit) && isset($dur[$duration_unit]) ? ' '.$langs->trans($dur[$duration_unit]) : '');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $obj->duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Weight
|
||||||
|
if (! empty($arrayfields['i.weight']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print $obj->weight;
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action
|
||||||
|
print '<td class="nowrap center">';
|
||||||
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
{
|
||||||
|
$selected=0;
|
||||||
|
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||||
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
print "</div>";
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
40
htdocs/intracommreport/list_det
Normal file
40
htdocs/intracommreport/list_det
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
function _liste($exporttype='deb') {
|
||||||
|
|
||||||
|
global $db, $conf, $langs;
|
||||||
|
|
||||||
|
$langs->load('intracommreport');
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
$l = new TListviewTBS('intracommreport');
|
||||||
|
|
||||||
|
$sql = 'SELECT numero_declaration, type_declaration, periode, rowid as dl
|
||||||
|
FROM '.MAIN_DB_PREFIX.'intracommreport
|
||||||
|
WHERE entity = '.$conf->entity.' AND exporttype = '.$PDOdb->quote($exporttype);
|
||||||
|
|
||||||
|
print $l->render($PDOdb, $sql, array(
|
||||||
|
'type'=>array(
|
||||||
|
//'date_cre'=>'date'
|
||||||
|
)
|
||||||
|
,'link'=>array(
|
||||||
|
'dl'=>'<a href="'.dol_buildpath('/intracommreport/export.php', 1).'?action=generateXML&id_declaration=@dl@">'.img_picto('', 'file.png').'</a>'
|
||||||
|
)
|
||||||
|
,'eval'=>array(
|
||||||
|
'numero_declaration'=>'TDebProdouane::getNumeroDeclaration("@val@")'
|
||||||
|
,'type_declaration'=>'TDebProdouane::$TType["@val@"]'
|
||||||
|
)
|
||||||
|
,'liste'=>array(
|
||||||
|
'titre'=>$langs->trans('IntracommReportList'.$exporttype)
|
||||||
|
,'image'=>img_picto('','title.png', '', 0)
|
||||||
|
,'picto_precedent'=>img_picto('','back.png', '', 0)
|
||||||
|
,'picto_suivant'=>img_picto('','next.png', '', 0)
|
||||||
|
,'messageNothing'=>"Il n'y a aucune déclaration à afficher"
|
||||||
|
,'picto_search'=>img_picto('','search.png', '', 0)
|
||||||
|
)
|
||||||
|
,'title'=>array(
|
||||||
|
'numero_declaration'=>$langs->trans('IntracommReportNumber')
|
||||||
|
,'type_declaration'=>$langs->trans('IntracommReportTypeDeclaration')
|
||||||
|
,'periode'=>$langs->trans('IntracommReportPeriod')
|
||||||
|
,'dl'=>$langs->trans('IntracommReportDownload')
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
@ -895,6 +895,9 @@ Permission63001=Read resources
|
|||||||
Permission63002=Create/modify resources
|
Permission63002=Create/modify resources
|
||||||
Permission63003=Delete resources
|
Permission63003=Delete resources
|
||||||
Permission63004=Link resources to agenda events
|
Permission63004=Link resources to agenda events
|
||||||
|
Permission68001=Read intracomm report
|
||||||
|
Permission68002=Create/modify intracomm report
|
||||||
|
Permission68004=Delete intracomm report
|
||||||
DictionaryCompanyType=Third-party types
|
DictionaryCompanyType=Third-party types
|
||||||
DictionaryCompanyJuridicalType=Third-party legal entities
|
DictionaryCompanyJuridicalType=Third-party legal entities
|
||||||
DictionaryProspectLevel=Prospect potential
|
DictionaryProspectLevel=Prospect potential
|
||||||
|
|||||||
@ -14,22 +14,22 @@ INTRACOMMREPORT_CATEG_FRAISDEPORT=Catégorie de services de type "Frais de port"
|
|||||||
INTRACOMMREPORT_NUM_DECLARATION=Numéro de déclarant
|
INTRACOMMREPORT_NUM_DECLARATION=Numéro de déclarant
|
||||||
|
|
||||||
#Menu
|
#Menu
|
||||||
exportprodebDouane=Export Pro-Douane
|
MenuDeclaration=Export Pro-Douane
|
||||||
exportprodebDEB=Export DEB
|
MenuDeclarationDEB=Export DEB
|
||||||
exportprodebNew=Nouvelle déclaration
|
MenuDeclarationDEBNew=Nouvelle déclaration
|
||||||
exportprodebList=Liste des déclarations
|
MenuDeclarationDEBList=Liste des déclarations
|
||||||
exportprodebDES=Export DES
|
MenuDeclarationDES=Export DES
|
||||||
exportprodesNew=Nouvelle déclaration
|
MenuDeclarationDESNew=Nouvelle déclaration
|
||||||
exportprodesList=Liste des déclarations
|
MenuDeclarationDESList=Liste des déclarations
|
||||||
|
|
||||||
#page d'export
|
#page d'export
|
||||||
exportprodebTitle=Export d'un fichier XML au format ProDouane - DEB
|
IntracommReportDEBTitle=Export d'un fichier XML au format ProDouane - DEB
|
||||||
exportprodesTitle=Export d'un fichier XML au format ProDouane - DES
|
IntracommReportDESTitle=Export d'un fichier XML au format ProDouane - DES
|
||||||
|
|
||||||
#Liste
|
#Liste
|
||||||
exportprodebListdeb=Liste des déclarations générées (DEB)
|
IntracommReportListDEB=Liste des déclarations générées (DEB)
|
||||||
exportprodebListdes=Liste des déclarations générées (DES)
|
IntracommReportListDES=Liste des déclarations générées (DES)
|
||||||
exportprodebNumber=Numéro déclaration
|
IntracommReportNumber=Numéro déclaration
|
||||||
exportprodebPeriod=Période d'analyse
|
IntracommReportPeriod=Période d'analyse
|
||||||
exportprodebTypeDeclaration=Type de déclaration
|
IntracommReportTypeDeclaration=Type de déclaration
|
||||||
exportprodebDownload=Télécharger fichier XML
|
IntracommReportDownload=Télécharger fichier XML
|
||||||
Loading…
Reference in New Issue
Block a user