This commit is contained in:
Alexandre SPANGARO 2019-05-21 09:55:41 +02:00
parent ba4bd274c0
commit 11015dd072
6 changed files with 60 additions and 131 deletions

View File

@ -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;

View File

@ -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))
{

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* 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
@ -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;

View File

@ -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';
}
/**

View File

@ -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'
);

View File

@ -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 '<form action="'.$_SERVER['PHP_SELF'].'" name="save" method="POST">';
print '<input type="hidden" name="action" value="export" />';
print '<table width="100%" class="noborder" style="background-color: #fff;">';
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td colspan="2">';
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 '<form action="'.$_SERVER['PHP_SELF'].'" name="save" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -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(