diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index c30c8e80dd9..f53a67b4d2c 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -395,3 +395,16 @@ 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_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; diff --git a/htdocs/install/mysql/tables/llx_intracommreport.sql b/htdocs/install/mysql/tables/llx_intracommreport.sql new file mode 100644 index 00000000000..e3b27d2de7c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_intracommreport.sql @@ -0,0 +1,30 @@ +-- =================================================================== +-- Copyright (C) 2019 Open-DSI +-- +-- 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 . +-- +-- =================================================================== + +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; diff --git a/htdocs/intracommreport/class/deb_prodouane.class.php b/htdocs/intracommreport/class/intracommreport.class.php similarity index 85% rename from htdocs/intracommreport/class/deb_prodouane.class.php rename to htdocs/intracommreport/class/intracommreport.class.php index 01f9f4ba557..0f7c0db9c32 100644 --- a/htdocs/intracommreport/class/deb_prodouane.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -1,16 +1,49 @@ + * + * 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 . + */ -class TDebProdouane extends TObjetStd { +/** + * \file htdocs/intracommreport/class/intracommreport.class.php + * \ingroup Intracomm report + * \brief File of class to manage intracomm report + */ + +/** + * Class to manage intracomm report + */ +class DebProdouane extends CommonObject +{ static $TType = array( 'introduction'=>'Introduction' ,'expedition'=>'Expédition' ); - - function __construct(&$ATMdb) { - - $this->ATMdb = $ATMdb; - $this->errors = array(); + + /** + * Constructor + * + * @param DoliDB $db Database handle + */ + public function __construct($db) + { + global $conf; + + $this->db = $db; + + /* parent::set_table(MAIN_DB_PREFIX.'deb_prodouane'); parent::add_champs('numero_declaration,entity','type=entier;'); parent::add_champs('type_declaration,periode,mode','type=chaine;'); @@ -18,6 +51,7 @@ class TDebProdouane extends TObjetStd { parent::add_champs('exporttype', array('type'=>'string', 'size'=>'10')); parent::start(); parent::_init_vars(); + */ $this->exporttype = 'deb'; } @@ -41,25 +75,25 @@ class TDebProdouane extends TObjetStd { $e = new SimpleXMLElement(''); $enveloppe = $e->addChild('Envelope'); - $enveloppe->addChild('envelopeId', $conf->global->EXPORT_PRO_DEB_NUM_AGREMENT); + $enveloppe->addChild('envelopeId', $conf->global->INTRACOMMREPORT_NUM_AGREMENT); $date_time = $enveloppe->addChild('DateTime'); $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->EXPORT_PRO_DEB_TYPE_ACTEUR); - $party->addAttribute('partyRole', $conf->global->EXPORT_PRO_DEB_ROLE_ACTEUR); + $party->addAttribute('partType', $conf->global->INTRACOMMREPORT_TYPE_ACTEUR); + $party->addAttribute('partyRole', $conf->global->INTRACOMMREPORT_ROLE_ACTEUR); $party->addChild('partyId', $party_id); $party->addChild('partyName', $declarant); $enveloppe->addChild('softwareUsed', 'Dolibarr'); $declaration = $enveloppe->addChild('Declaration'); $declaration->addChild('declarationId', $id_declaration); $declaration->addChild('referencePeriod', $periode_reference); - if($conf->global->EXPORT_PRO_DEB_TYPE_ACTEUR === 'PSI') $psiId = $party_id; + if($conf->global->INTRACOMMREPORT_TYPE_ACTEUR === 'PSI') $psiId = $party_id; else $psiId = 'NA'; $declaration->addChild('PSIId', $psiId); $function = $declaration->addChild('Function'); $functionCode = $function->addChild('functionCode', $mode); - $declaration->addChild('declarationTypeCode', $conf->global->{'EXPORT_PRO_DEB_NIV_OBLIGATION_'.strtoupper($type)}); + $declaration->addChild('declarationTypeCode', $conf->global->{'INTRACOMMREPORT_NIV_OBLIGATION_'.strtoupper($type)}); $declaration->addChild('flowCode', ($type == 'introduction' ? 'A' : 'D')); $declaration->addChild('currencyCode', $conf->global->MAIN_MONNAIE); /********************************************************************/ @@ -118,9 +152,9 @@ class TDebProdouane extends TObjetStd { return 0; } - if($exporttype == 'deb' && $conf->global->EXPORT_PRO_DEB_CATEG_FRAISDEPORT > 0) { + if($exporttype == 'deb' && $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT > 0) { $categ_fraisdeport = new Categorie($db); - $categ_fraisdeport->fetch($conf->global->EXPORT_PRO_DEB_CATEG_FRAISDEPORT); + $categ_fraisdeport->fetch($conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT); $TLinesFraisDePort = array(); } @@ -136,7 +170,7 @@ class TDebProdouane extends TObjetStd { // 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 '.$res->nom.''; } else { - if($conf->global->EXPORT_PRO_DEB_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; } else $this->addItemXMl($declaration, $res, '', $i); } diff --git a/htdocs/intracommreport/export.php b/htdocs/intracommreport/export.php index e50b548ea12..c15231f7ed4 100644 --- a/htdocs/intracommreport/export.php +++ b/htdocs/intracommreport/export.php @@ -1,16 +1,38 @@ + * + * 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 . + */ -require './config.php'; +/** + * \file htdocs/intracommreport/export.php + * \ingroup Intracomm report + * \brief Page to manage intracomm report export + */ +require_once '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; -dol_include_once('/intracommreport/class/deb_prodouane.class.php'); +require_once DOL_DOCUMENT_ROOT . '/intracommreport/class/intracommreport.class.php'; $action = GETPOST('action'); $exporttype = GETPOST('exporttype'); // DEB ou DES if (empty($exporttype)) $exporttype = 'deb'; +/* $PDOdb = new TPDOdb; $ATMform = new TFormCore; +*/ $formother = new FormOther($db); $year = GETPOST('year'); $month = GETPOST('month'); @@ -65,7 +87,7 @@ function _print_form_deb() { print ''; $TabMonth = array(); 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 ''; print ''; @@ -74,7 +96,7 @@ function _print_form_deb() { print 'Type de déclaration'; print ''; print ''; - 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 ''; print ''; @@ -116,7 +138,7 @@ function _print_form_des() print ''; $TabMonth = array(); 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 ''; print '';