diff --git a/htdocs/core/boxes/intracommreport_box.php b/htdocs/core/boxes/intracommreport_box.php index 1e7c9dd1725..1758b2ffda4 100644 --- a/htdocs/core/boxes/intracommreport_box.php +++ b/htdocs/core/boxes/intracommreport_box.php @@ -31,7 +31,7 @@ class intracommreportbox extends ModeleBoxes { public $boxcode = "mybox"; - public $boximg = "intracommreport@intracommreport"; + public $boximg = "intracommreport"; public $boxlabel; public $depends = array("intracommreport"); public $db; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index fc639802e7f..a82168f34a6 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1360,6 +1360,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); } + // Intracomm report + if (! empty($conf->intracommreport->enabled)) + { + $newmenu->add("/intracommreport/export.php?leftmenu=intracommreport", $langs->trans("MenuDeclaration"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); + if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) { + // DEB + $newmenu->add("/intracommreport/export.php?leftmenu=intracommreport", $langs->trans("MenuDeclarationDEB"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreportDEB', 1); + $newmenu->add("/intracommreport/export.php?leftmenu=intracommreportDEB", $langs->trans("MenuDeclarationDEBNew"), 2, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1); + $newmenu->add("/intracommreport/export.php?action=list&leftmenu=intracommreportDEB", $langs->trans("MenuDeclarationDEBList"), 2, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); + // DES + $newmenu->add("/intracommreport/export.php?exporttype=des&leftmenu=intracommreport", $langs->trans("MenuDeclarationDES"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreportDES', 1); + $newmenu->add("/intracommreport/export.php?exporttype=des&leftmenu=intracommreportDES", $langs->trans("MenuDeclarationDESNew"), 2, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1); + $newmenu->add("/intracommreport/export.php?exporttype=des&action=list&leftmenu=intracommreportDES", $langs->trans("MenuDeclarationDESList"), 2, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); + } + } + // Assets if (! empty($conf->asset->enabled)) { diff --git a/htdocs/core/modules/modIntracommreport.class.php b/htdocs/core/modules/modIntracommreport.class.php index 6d2d4171a77..943e269c19c 100644 --- a/htdocs/core/modules/modIntracommreport.class.php +++ b/htdocs/core/modules/modIntracommreport.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2019 Alexandre Spangaro +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * 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 @@ -21,7 +21,7 @@ /** * \file htdocs/core/modules/modIntracommreport.class.php * \ingroup Intracomm report - * \brief Module to activate intracomm report double entry accounting module + * \brief Module to activate intracomm report module */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; @@ -50,7 +50,7 @@ class modIntracommreport extends DolibarrModules $this->description = "Intracomm report management (Support for French DEB/DES format)"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version - $this->version = 'dolibarr'; + $this->version = 'development'; $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); $this->picto = 'intracommreport'; @@ -95,108 +95,27 @@ class modIntracommreport extends DolibarrModules // Permissions $this->rights_class = 'intracommreport'; - $this->rights = array(); // Permission array used by this module $r = 0; + $r++; + $this->rights[$r][0] = 68001; + $this->rights[$r][1] = 'Read intracomm report'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'read'; + + $r++; + $this->rights[$r][0] = 68002; + $this->rights[$r][1] = 'Create/modify intracomm report'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'write'; + // Main menu entries $this->menu = array(); // List of menus to add $r=0; - - $langs->load('intracommreport'); - - $this->menu[$r]=array('fk_menu'=>0, // Put 0 if this is a top menu - 'type'=>'top', // This is a Top menu entry - 'titre'=>$langs->trans('intracommreportDouane'), - 'mainmenu'=>'intracommreport', - 'leftmenu'=>'', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school). - 'url'=>'/intracommreport/export.php', - 'langs'=>'intracommreport@intracommreport', - 'position'=>100, - 'enabled'=>'$conf->intracommreport->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>1, // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=intracommreport', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>$langs->trans('intracommreportDEB'), - 'mainmenu'=>'intracommreport', - 'leftmenu'=>'intracommreport', - 'url'=>'/intracommreport/export.php', - 'position'=>100+$r, - 'enabled'=>'$conf->intracommreport->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>1, // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=intracommreport,fk_leftmenu=intracommreport', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>$langs->trans('intracommreportNew'), - 'mainmenu'=>'intracommreport', - 'leftmenu'=>'intracommreportNew', - 'url'=>'/intracommreport/export.php', - 'position'=>100+$r, - 'enabled'=>'$conf->intracommreport->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>1, // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=intracommreport,fk_leftmenu=intracommreport', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>$langs->trans('intracommreportList'), - 'mainmenu'=>'intracommreport', - 'leftmenu'=>'intracommreportList', - 'url'=>'/intracommreport/export.php?action=list', - 'position'=>100+$r, - 'enabled'=>'$conf->intracommreport->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>1, // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=intracommreport', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>$langs->trans('intracommreportDES'), - 'mainmenu'=>'intracommreport', - 'leftmenu'=>'exportprodes', - 'url'=>'/intracommreport/export.php?exporttype=des', - 'position'=>100+$r, - 'enabled'=>'$conf->intracommreport->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>1, // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=intracommreport,fk_leftmenu=exportprodes', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>$langs->trans('exportprodesNew'), - 'mainmenu'=>'intracommreport', - 'leftmenu'=>'exportprodes_new', - 'url'=>'/intracommreport/export.php?exporttype=des', - 'position'=>100+$r, - 'enabled'=>'$conf->intracommreport->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>1, // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=intracommreport,fk_leftmenu=exportprodes', // Put 0 if this is a top menu - 'type'=>'left', // This is a Top menu entry - 'titre'=>$langs->trans('exportprodesList'), - 'mainmenu'=>'intracommreport', - 'leftmenu'=>'exportprodes_list', - 'url'=>'/intracommreport/export.php?exporttype=des&action=list', - 'position'=>100+$r, - 'enabled'=>'$conf->intracommreport->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>1, // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - + // Exports $r=1; diff --git a/htdocs/core/triggers/interface_99_modintracommreport_intracommreporttrigger.class.php b/htdocs/core/triggers/interface_99_modintracommreport_intracommreporttrigger.class.php index 73f03fb8039..ddbb5df329b 100644 --- a/htdocs/core/triggers/interface_99_modintracommreport_intracommreporttrigger.class.php +++ b/htdocs/core/triggers/interface_99_modintracommreport_intracommreporttrigger.class.php @@ -54,7 +54,7 @@ class Interfaceintracommreporttrigger . "They are provided for tutorial purpose only."; // 'development', 'experimental', 'dolibarr' or version $this->version = 'development'; - $this->picto = 'intracommreport@intracommreport'; + $this->picto = 'intracommreport'; } /** diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index 0f7c0db9c32..af8a244deec 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -24,10 +24,10 @@ /** * Class to manage intracomm report */ -class DebProdouane extends CommonObject +class IntracommReport extends CommonObject { - static $TType = array( + static $type = array( 'introduction'=>'Introduction' ,'expedition'=>'Expédition' ); diff --git a/htdocs/intracommreport/export.php b/htdocs/intracommreport/export.php index c15231f7ed4..5a61a62a581 100644 --- a/htdocs/intracommreport/export.php +++ b/htdocs/intracommreport/export.php @@ -25,21 +25,18 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT . '/intracommreport/class/intracommreport.class.php'; +$langs->loadLangs(array("intracommreport")); + $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'); $type_declaration = GETPOST('type'); switch($action) { - case 'generateXML': $obj = new TDebProdouane($PDOdb); $obj->load($PDOdb, GETPOST('id_declaration')); @@ -55,26 +52,24 @@ switch($action) { if ($exporttype == 'deb') _print_form_deb(); else _print_form_des(); break; - } function _print_form_deb() { - global $langs, $ATMform, $formother, $year, $month, $type_declaration; - - $langs->load('intracommreport@intracommreport'); - $langs->load('main'); - - llxHeader(); - print_fiche_titre($langs->trans('intracommreportTitle')); - dol_fiche_head(); + global $langs, $formother, $year, $month, $type_declaration; + + $title = $langs->trans("IntracommReportDEBTitle"); + llxHeader("", $title); + print load_fiche_titre($langs->trans("IntracommReportDEBTitle")); + + dol_fiche_head(); print '
'; print ''; - print ''; + print '
'; print ''; print '
'; print 'Paramètres de l\'export'; @@ -112,14 +107,13 @@ function _print_form_deb() { function _print_form_des() { - global $langs, $ATMform, $formother, $year, $month, $type_declaration; - - $langs->load('intracommreport@intracommreport'); - $langs->load('main'); - - llxHeader(); - print_fiche_titre($langs->trans('exportprodesTitle')); - dol_fiche_head(); + global $langs, $formother, $year, $month, $type_declaration; + + $title = $langs->trans("IntracommReportDESTitle"); + llxHeader("", $title); + print load_fiche_titre($langs->trans("IntracommReportDESTitle")); + + dol_fiche_head(); print ''; print ''; @@ -195,13 +189,13 @@ function _liste($exporttype='deb') { global $db, $conf, $PDOdb, $langs; - $langs->load('intracommreport@intracommreport'); + $langs->load('intracommreport'); llxHeader(); $l = new TListviewTBS('intracommreport'); $sql = 'SELECT numero_declaration, type_declaration, periode, rowid as dl - FROM '.MAIN_DB_PREFIX.'deb_prodouane + FROM '.MAIN_DB_PREFIX.'intracommreport WHERE entity = '.$conf->entity.' AND exporttype = '.$PDOdb->quote($exporttype); print $l->render($PDOdb, $sql, array(