Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# DC1 ChangeLog

## 1.1.1 (05/11/2025)

- Correction d'un problème empêchant la gestion correcte des permissions

1.1.1 (03/09/2025)

- Ajout de la version 2019 du formulaire DC1

## 1.0.0 (30/09/2025)

- Création du module dédié aux Formulaires DC1
# DC1 ChangeLog

## 1.1.2 (05/11/2025)

- Harmonisation complète des traductions en_US/fr_FR
- Ajout d'une page d'accueil d'administration documentée
- Rédaction d'un README bilingue et mise à jour des informations de version
- Correction du chargement des dépendances en environnement custom

## 1.1.1 (05/11/2025)

- Correction d'un problème empêchant la gestion correcte des permissions

1.1.1 (03/09/2025)

- Ajout de la version 2019 du formulaire DC1

## 1.0.0 (30/09/2025)

- Création du module dédié aux Formulaires DC1
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
README
# Module DC1 / Module DC1

## 🇬🇧 English

### Overview
- French public procurement support: provide assistance with the DC1 application letter form.
- Pre-fills the DC1 template from Dolibarr commercial proposals and linked third parties.
- Generates PDF outputs compliant with the 2016 and 2019 official templates.

### Requirements
- Dolibarr 16.0 or later with the Multicompany module when required.
- PHP 7.4+ and a MySQL-compatible database.

### Installation
1. Copy the `dc1` directory into Dolibarr's `custom` folder.
2. Enable the module from the Dolibarr module configuration page.
3. Apply database migrations from `sql/llx_dc1.sql` using the Dolibarr interface.

### Configuration
- Navigate to **Setup > Modules > DC1** to activate the feature flag.
- Adjust permissions so that only authorised roles can edit the DC1 tab.

### Usage
- Open a commercial proposal and fill in the **DC1** tab.
- Generate the document via the **Proposition commerciale** tab using the DC1 model.

## 🇫🇷 Français

### Aperçu
- Assistance aux marchés publics : facilite la lettre de candidature DC1.
- Pré-remplit le modèle DC1 depuis les propositions commerciales et les tiers liés.
- Génère des PDF conformes aux modèles officiels 2016 et 2019.

### Prérequis
- Dolibarr 16.0 ou plus avec le module Multicompany si nécessaire.
- PHP 7.4+ et une base de données compatible MySQL.

### Installation
1. Copier le répertoire `dc1` dans le dossier `custom` de Dolibarr.
2. Activer le module depuis la page de configuration des modules Dolibarr.
3. Appliquer les migrations SQL depuis `sql/llx_dc1.sql` via l'interface Dolibarr.

### Configuration
- Aller dans **Configuration > Modules > DC1** pour activer le paramètre fonctionnel.
- Ajuster les permissions afin que seules les personnes autorisées modifient l'onglet DC1.

### Utilisation
- Ouvrir une proposition commerciale et remplir l'onglet **DC1**.
- Générer le document depuis l'onglet **Proposition commerciale** en choisissant le modèle DC1.
80 changes: 79 additions & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
@@ -1 +1,79 @@
Url not available
<?php
/* Copyright (C) 2025 Pierre Ardoin <developpeur@lesmetiersdubatiment.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 <https://www.gnu.org/licenses/>.
*/
/**
* \file admin/index.php
* \ingroup dc1
* \brief DC1 module administration home page.
*/

$res = @include '../../main.inc.php';
if (! $res) {
$res = @include '../../../main.inc.php';
}

require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
dol_include_once('/dc1/lib/dc1.lib.php');
dol_include_once('/dc1/core/modules/modDc1.class.php');

if (empty($user->admin)) {
accessforbidden();
}

$langs->loadLangs(array('admin', 'dc1@dc1'));

$module = new modDc1($db);

llxHeader('', $langs->trans('DC1AdminHomeTitle'));

$head = dc1AdminPrepareHead();
dol_fiche_head($head, 'home', $langs->trans('Module450005Name'), 0, '');

// EN: Provide a short introduction for administrators.
// FR: Fournit une courte introduction pour les administrateurs.
print '<p class="opacitymedium">' . $langs->trans('DC1AdminHomeIntro') . '</p>';

print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
// EN: Present the module purpose for administrators.
// FR: Présente l'objectif du module aux administrateurs.
print '<div class="underbanner">';
print '<p>' . $langs->trans('Module450005Desc') . '</p>';
print '</div>';
// EN: Offer quick access to the official documentation.
// FR: Offre un accès rapide à la documentation officielle.
print '<div class="underbanner">';
print '<h3>' . $langs->trans('DC1AdminHomeDocumentation') . '</h3>';
print '<p><a class="classfortooltip" target="_blank" rel="noopener" href="https://www.economie.gouv.fr/cedef/dematerialisation-formulaires-dc1-dc2">' . $langs->trans('DC1AdminHomeDocumentationLink') . '</a></p>';
print '</div>';
print '</div>';
print '<div class="fichehalfright">';
// EN: Display module version and contact reference.
// FR: Affiche la version du module et le contact de référence.
print '<div class="underbanner">';
print '<h3>' . $langs->trans('DC1AdminHomeVersion') . '</h3>';
print '<p>' . dol_escape_htmltag($module->version) . '</p>';
print '</div>';
print '<div class="underbanner">';
print '<h3>' . $langs->trans('DC1AdminHomeSupport') . '</h3>';
print '<p><a class="classfortooltip" target="_blank" rel="noopener" href="mailto:developpeur@lesmetiersdubatiment.fr">' . $langs->trans('DC1AdminHomeSupportLink') . '</a></p>';
print '</div>';
print '</div>';
print '</div>';
dol_fiche_end();

llxFooter();
$db->close();
104 changes: 41 additions & 63 deletions admin/setup.php
Original file line number Diff line number Diff line change
@@ -1,92 +1,70 @@
<?php
/* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) 2020 Ardoin Pierre <mapiolca@me.com>
/* Copyright (C) 2025 Pierre Ardoin <developpeur@lesmetiersdubatiment.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
* the Free Software Foundation, either version 3 of the License, or
* 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
* 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/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/**
* \file admin/chantier_param.php
* \brief This file is an example module setup page
* Put some comments here
* \file admin/setup.php
* \ingroup dc1
* \brief General setup page for the DC1 module.
*/
// Dolibarr environment
$res=@include("../../main.inc.php"); // For root directory
if (! $res) $res=@include("../../../main.inc.php"); // For "custom" directory
// Libraries
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/custom/dc1/class/dc1.class.php';

if(!$user->admin or empty($conf->dc1->enabled))
accessforbidden();

$langs->load("admin");
$langs->load("dc1@dc1");

$action = GETPOST('action','alpha');
if($action == 'save'){
$res = @include '../../main.inc.php';
if (! $res) {
$res = @include '../../../main.inc.php';
}

dolibarr_set_const($db, "LMDB_BUDGET_ORDER_STATUS", GETPOST('order_status'), 'int', 0, "Statut des commandes fournisseurs à prendre en charge", $conf->entity);
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
dol_include_once('/dc1/lib/dc1.lib.php');

header("Location: ".$_SERVER["PHP_SELF"]);
exit;
if (empty($user->admin)) {
accessforbidden();
}

/*
* View
*/
$langs->loadLangs(array('admin', 'dc1@dc1'));

llxHeader('',$langs->trans("LMDBSetup"));
llxHeader('', $langs->trans('DC1Setup'));

// Configuration header
$head = dc1AdminPrepareHead();
dol_fiche_head($head, 'setup', $langs->trans('Module450005Name'), 0, '');

$head = dc1_prepare_head();
dol_fiche_head($head,'SetupG', $langs->trans("Les Métiers du Bâtiment"), 0, "");
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
print '<input type="hidden" name="token" value="' . newToken() . '">';

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("ModuleSetup"),$linkback);
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">'."\n";
print '<thead>';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th align="center" width="300">'.$langs->trans("Value").'</th>';
print '</tr>';
print '</thead>';
showParameters();
print '<tbody>';
print '<table class="noborder" width="100%">';
print '<thead>';
print '<tr class="liste_titre">';
print '<th>' . $langs->trans('Name') . '</th>';
print '<th class="center" width="260">' . $langs->trans('Value') . '</th>';
print '</tr>';
print '</thead>';
print '<tbody>';

function showParameters() {
global $db,$conf,$langs,$bc;

$html=new Form($db);
// EN: Toggle the activation of the DC1 tab without reloading the page.
// FR: Permet d'activer l'onglet DC1 sans recharger la page.
print '<tr class="oddeven">';
print '<td>' . $langs->trans('LMDB_DC1_ACTIVATED') . '</td>';
print '<td class="center">' . ajax_constantonoff('LMDB_DC1_ACTIVATED') . '</td>';
print '</tr>';

$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td align="left" class="">'.$langs->trans("LMDB_DC1_ACTIVATED").'</td>';
print '<td align="center" width="300">';
print ajax_constantonoff('LMDB_DC1_ACTIVATED');
print '</td>';
print '</tr>';

}
print '</tbody>';
print '</tbody>';
print '</table>';

print '<center><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center>';

print '</form>';

?>
dol_fiche_end();

llxFooter();
$db->close();
Loading
Loading