Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d41bdad079 | |||
| 9dd279794c | |||
| 6b1aa0764e | |||
| f6a2444d2c | |||
| 8d3da5da60 | |||
| 83e9df906a | |||
| eb4d615118 |
21
.cursor/rules/entreprise/00-checklist-nouveau-projet.mdc
Normal file
21
.cursor/rules/entreprise/00-checklist-nouveau-projet.mdc
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
description: Checklist agent — monter un nouveau projet sur le modèle Progiweb
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Checklist nouveau projet (agent)
|
||||
|
||||
Quand l'utilisateur demande de reproduire le modèle Reader / Inscription / CRM :
|
||||
|
||||
1. Créer la structure `.cursor/rules/{entreprise,projet,ops}/` (copier `entreprise/` depuis un projet déjà aligné).
|
||||
2. Remplir `ops/20-parametres.mdc` (URLs Gitea, Bitbucket, chemins serveur, webhook, SSH).
|
||||
3. Remplir `ops/20-git-deploy-playbook.mdc` (layout git root : `$HOME` vs `public_html`).
|
||||
4. Remplir `projet/` (stack, conventions, préfixe JIRA).
|
||||
5. Windows : remote Gitea, branche `dev`, `.gitignore` secrets / runtime.
|
||||
6. Versionner `deploy_dev.php` au bon endroit (docroot) **avant** d'activer le webhook.
|
||||
7. Serveur : `~/deploy/deploy_dev.sh` (chemins absolus), git init/fetch sur le bon root, tester `curl` webhook.
|
||||
8. Gitea : webhook push → URL `deploy_dev.php` ; miroir Bitbucket avec sync **à chaque soumission** + intervalle filet (ex. `1h`).
|
||||
9. Test bout en bout : push `dev` → commit visible sur Gitea, serveur, Bitbucket.
|
||||
10. Secrets uniquement dans 1Password (référencer le titre de l'item dans `ops/20-parametres.mdc`).
|
||||
|
||||
Ne pas inventer Bitbucket SSH sur le serveur : le serveur tire depuis Gitea local (`127.0.0.1:3000`) en général.
|
||||
43
.cursor/rules/entreprise/00-git-modele.mdc
Normal file
43
.cursor/rules/entreprise/00-git-modele.mdc
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
description: Progiweb — modèle Git / Gitea / Bitbucket / serveur (entreprise)
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Modèle Git entreprise (Progiweb)
|
||||
|
||||
Référentiel agent. Détails par projet → `ops/20-parametres.mdc` et `ops/20-git-deploy-playbook.mdc`.
|
||||
|
||||
## Rôles
|
||||
|
||||
| Système | Rôle |
|
||||
|---|---|
|
||||
| **Gitea** (`git.progiweb.ca`) | Source de vérité — push depuis Windows |
|
||||
| **Bitbucket** | Miroir / backup opérationnel hors serveurs |
|
||||
| **Serveur (cPanel)** | Déploiement uniquement — **jamais** de commits sur le serveur |
|
||||
|
||||
## Branches
|
||||
|
||||
- Travail quotidien : **`dev`**
|
||||
- Prod : **`master`** (quand le projet l'utilise ; ne pas inventer le flux prod)
|
||||
- Ne pas pousser `master` sans demande explicite
|
||||
|
||||
## Flux nominal
|
||||
|
||||
```
|
||||
Windows --push--> Gitea(dev) --webhook--> serveur (deploy_dev)
|
||||
|
|
||||
+--miroir push--> Bitbucket(dev)
|
||||
```
|
||||
|
||||
## Déploiement (règles absolues)
|
||||
|
||||
- Script shell hors webroot : typiquement `~/deploy/deploy_dev.sh`
|
||||
- Déclencheur versionné dans le **docroot** : `deploy_dev.php` (sinon `git clean -fd` le détruit)
|
||||
- Le script fait : `git fetch` → `git reset --hard FETCH_HEAD` → `git clean` **ciblé** (jamais un clean aveugle sur tout le home cPanel)
|
||||
- Via PHP/Apache, **`HOME` est souvent absent** → chemins **absolus** dans le `.sh`
|
||||
- Auth Gitea Windows : token (éviter OAuth HTTP « Bad Request »)
|
||||
- Auth miroir Bitbucket : user `x-token-auth` + Repository Access Token (1Password) — pas le mot de passe web
|
||||
|
||||
## Nouveau projet
|
||||
|
||||
Suivre `entreprise/00-checklist-nouveau-projet.mdc` et recopier `entreprise/` + remplir `ops/` + `projet/`.
|
||||
30
.cursor/rules/entreprise/00-workflow.mdc
Normal file
30
.cursor/rules/entreprise/00-workflow.mdc
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
description: Progiweb — workflow agent (entreprise). Toujours s'y référer.
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Workflow entreprise (Progiweb)
|
||||
|
||||
Référentiel agent — pas une doc humaine. S'appliquer à tous les projets Progiweb montés sur ce modèle.
|
||||
|
||||
## Avant de modifier du code
|
||||
|
||||
- Demander le **numéro JIRA** si l'utilisateur ne l'a pas fourni (préfixe selon le projet, voir `projet/`).
|
||||
- Ne pas bloquer une simple question ou une lecture seule.
|
||||
|
||||
## Portée
|
||||
|
||||
- **Changement minimal** : uniquement ce qui est demandé.
|
||||
- Pas de refactor large, renommage massif ou nettoyage opportuniste sans accord explicite.
|
||||
- Cohérence locale (fichier / module) plutôt que modernisation globale.
|
||||
|
||||
## Incohérences voisines
|
||||
|
||||
1. Signaler brièvement.
|
||||
2. Proposer une correction ciblée.
|
||||
3. Attendre confirmation avant de sortir du périmètre.
|
||||
|
||||
## Fin de tâche
|
||||
|
||||
- Résumer : quoi, où, déploiement / SQL / étapes manuelles restantes.
|
||||
- Ne pas créer de README ou docs hors demande explicite (les règles agent vivent dans `.cursor/rules/`).
|
||||
29
.cursor/rules/ops/20-git-deploy-playbook.mdc
Normal file
29
.cursor/rules/ops/20-git-deploy-playbook.mdc
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
description: CRM MS1 — playbook Git/deploy + état connu (ops)
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Playbook Git / deploy — CRM MS1
|
||||
|
||||
## Layout (≠ Reader)
|
||||
|
||||
- Dépôt Git serveur = **`~/public_html`** (comme un site entier dans le docroot).
|
||||
- `deploy_dev.php` doit être **versionné** à la racine du dépôt — sinon chaque `git clean -fd` l'efface.
|
||||
|
||||
## Philosophie
|
||||
|
||||
- Serveur = déploiement only (pas de `user.name` / commits serveur).
|
||||
- Windows → Gitea → webhook → `deploy_dev.php` → `~/deploy/deploy_dev.sh`.
|
||||
|
||||
## Subtilités / état à surveiller
|
||||
|
||||
- `git clean -fd` est agressif : tout fichier non versionné dans `public_html` disparaît.
|
||||
- Si le push Windows échoue : auth Gitea (token), pas OAuth HTTP cassé.
|
||||
- Miroir Bitbucket : sync à chaque soumission + intervalle filet `1h` (aligner sur Reader).
|
||||
- Tunnel SQL / Cursor : SSH **7822**.
|
||||
|
||||
## Checklist locale agent
|
||||
|
||||
1. `deploy_dev.php` présent et tracké avant d'activer le webhook.
|
||||
2. Tester `curl` / hit sur `deploy_dev.php` après correction des chemins absolus dans le `.sh`.
|
||||
3. Vérifier Gitea + serveur sur le même SHA `dev`.
|
||||
43
.cursor/rules/ops/20-parametres.mdc
Normal file
43
.cursor/rules/ops/20-parametres.mdc
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
description: CRM MS1 — paramètres figés (ops)
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Paramètres — CRM MS1
|
||||
|
||||
Secrets → 1Password uniquement.
|
||||
|
||||
## Git / remotes
|
||||
|
||||
| Clé | Valeur |
|
||||
|---|---|
|
||||
| Gitea (Windows) | `http://git.progiweb.ca/stephan/crm-ms1.git` |
|
||||
| Gitea (serveur, typique) | `http://127.0.0.1:3000/stephan/crm-ms1.git` |
|
||||
| Branche travail | `dev` |
|
||||
| Autre branche remote vue | `main` (historique) — travail sur **`dev`** |
|
||||
| Bitbucket | Ancien ; source de vérité = **Gitea** |
|
||||
|
||||
## Webhook / deploy (dev)
|
||||
|
||||
| Clé | Valeur |
|
||||
|---|---|
|
||||
| URL webhook prévue | `https://ms1crmdev.progiweb.net/deploy_dev.php` |
|
||||
| Script | `~/deploy/deploy_dev.sh` |
|
||||
| Git root serveur | **`~/public_html`** (tout le CRM = docroot) |
|
||||
| Comportement script | fetch → reset --hard → `git clean -fd` |
|
||||
|
||||
## SSH / SQLTools
|
||||
|
||||
| Clé | Valeur |
|
||||
|---|---|
|
||||
| Port SSH | **7822** (pas 3306 pour le tunnel) |
|
||||
| Host SSH | `ms1crmdev.progiweb.net` |
|
||||
| User SSH / home | `devcrmms1` / `/home/devcrmms1` |
|
||||
| cPanel | `https://serveur-prod.progiweb.net:2083` |
|
||||
| Exemple SQLTools | `.vscode/settings.json.example` → copier en `settings.json` (gitignored) |
|
||||
| BD CRM dev | `devcrmms1_dev` |
|
||||
| BD Inscription (2e groupe CI) | `devinscription_prod` (même host MySQL si grants OK) |
|
||||
|
||||
## 1Password / auth
|
||||
|
||||
- Même modèle Reader : token Gitea pour push Windows ; miroir Bitbucket si activé = `x-token-auth` + access token.
|
||||
10
.cursor/rules/projet/10-documentation.mdc
Normal file
10
.cursor/rules/projet/10-documentation.mdc
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
description: CRM MS1 — documentation agent
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Documentation agent — CRM MS1
|
||||
|
||||
- Documenter la logique métier non évidente.
|
||||
- Référencer le ticket JIRA dans le code / SQL quand fourni.
|
||||
- Fin de tâche : quoi / où / déploiement.
|
||||
11
.cursor/rules/projet/10-php-conventions.mdc
Normal file
11
.cursor/rules/projet/10-php-conventions.mdc
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
description: Conventions PHP CRM MS1
|
||||
globs: **/*.php,application/**/*.php,v4/**/*.php,v4_ci4/**/*.php
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Conventions PHP — CRM MS1
|
||||
|
||||
- Suivre le fichier ouvert (style local).
|
||||
- Changement minimal ; pas de modernisation globale sans accord.
|
||||
- Pas de secrets dans le code ; pas de `var_dump` laissé en prod.
|
||||
11
.cursor/rules/projet/10-stack.mdc
Normal file
11
.cursor/rules/projet/10-stack.mdc
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
description: CRM MS1 — stack et préfixe JIRA (projet)
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Projet CRM MS1 — stack
|
||||
|
||||
- Stack : PHP applicatif CRM (`application/`, `v4/`, `v4_ci4/`, etc.).
|
||||
- Préfixe JIRA : confirmer avec l'utilisateur (souvent ticket CRM / MS1 selon le contexte).
|
||||
- Workspace local typique : `C:\dev_v4\crm-ms1`.
|
||||
- Ne pas committer `credentials.json` ni secrets.
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,8 +1,12 @@
|
||||
# IDE — ne jamais committer les connexions SQL (copier settings.json.example)
|
||||
.vscode/settings.json
|
||||
|
||||
# Runtime / data
|
||||
data/
|
||||
logs/
|
||||
error_log
|
||||
|
||||
|
||||
# CI4 writable runtime
|
||||
*/writable/logs/
|
||||
*/writable/cache/
|
||||
|
||||
47
.vscode/settings.json.example
vendored
Normal file
47
.vscode/settings.json.example
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
// Copier vers settings.json (gitignored) et renseigner vos identifiants locaux.
|
||||
"sqltools.connections": [
|
||||
{
|
||||
"mysqlOptions": {
|
||||
"authProtocol": "default",
|
||||
"enableSsl": "Disabled"
|
||||
},
|
||||
"ssh": "Enabled",
|
||||
"previewLimit": 50,
|
||||
"server": "localhost",
|
||||
"port": 3306,
|
||||
"sshOptions": {
|
||||
"port": 7822,
|
||||
"host": "ms1crmdev.progiweb.net",
|
||||
"username": "YOUR_SSH_USER",
|
||||
"password": "YOUR_SSH_PASSWORD"
|
||||
},
|
||||
"driver": "MariaDB",
|
||||
"name": "CRM MS1 — dev",
|
||||
"username": "YOUR_DB_USER",
|
||||
"password": "YOUR_DB_PASSWORD",
|
||||
"database": "devcrmms1_dev"
|
||||
},
|
||||
{
|
||||
"mysqlOptions": {
|
||||
"authProtocol": "default",
|
||||
"enableSsl": "Disabled"
|
||||
},
|
||||
"ssh": "Enabled",
|
||||
"previewLimit": 50,
|
||||
"server": "localhost",
|
||||
"port": 3306,
|
||||
"sshOptions": {
|
||||
"port": 7822,
|
||||
"host": "ms1crmdev.progiweb.net",
|
||||
"username": "YOUR_SSH_USER",
|
||||
"password": "YOUR_SSH_PASSWORD"
|
||||
},
|
||||
"driver": "MariaDB",
|
||||
"name": "MS1 Inscription (via CRM host)",
|
||||
"username": "YOUR_DB_USER",
|
||||
"password": "YOUR_DB_PASSWORD",
|
||||
"database": "devinscription_prod"
|
||||
}
|
||||
]
|
||||
}
|
||||
118
application/config/database.php
Normal file
118
application/config/database.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| DATABASE CONNECTIVITY SETTINGS
|
||||
| -------------------------------------------------------------------
|
||||
| This file will contain the settings needed to access your database.
|
||||
|
|
||||
| For complete instructions please consult the 'Database Connection'
|
||||
| page of the User Guide.
|
||||
|
|
||||
| -------------------------------------------------------------------
|
||||
| EXPLANATION OF VARIABLES
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| ['dsn'] The full DSN string describe a connection to the database.
|
||||
| ['hostname'] The hostname of your database server.
|
||||
| ['username'] The username used to connect to the database
|
||||
| ['password'] The password used to connect to the database
|
||||
| ['database'] The name of the database you want to connect to
|
||||
| ['dbdriver'] The database driver. e.g.: mysqli.
|
||||
| Currently supported:
|
||||
| cubrid, ibase, mssql, mysql, mysqli, oci8,
|
||||
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
|
||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
||||
| to the table name when using the Query Builder class
|
||||
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|
||||
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|
||||
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
|
||||
| ['cachedir'] The path to the folder where cache files should be stored
|
||||
| ['char_set'] The character set used in communicating with the database
|
||||
| ['dbcollat'] The character collation used in communicating with the database
|
||||
| NOTE: For MySQL and MySQLi databases, this setting is only used
|
||||
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
|
||||
| (and in table creation queries made with DB Forge).
|
||||
| There is an incompatibility in PHP with mysql_real_escape_string() which
|
||||
| can make your site vulnerable to SQL injection if you are using a
|
||||
| multi-byte character set and are running versions lower than these.
|
||||
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
|
||||
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
|
||||
| ['encrypt'] Whether or not to use an encrypted connection.
|
||||
|
|
||||
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
|
||||
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
||||
|
|
||||
| 'ssl_key' - Path to the private key file
|
||||
| 'ssl_cert' - Path to the public key certificate file
|
||||
| 'ssl_ca' - Path to the certificate authority file
|
||||
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
|
||||
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
|
||||
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not
|
||||
|
|
||||
| ['compress'] Whether or not to use client compression (MySQL only)
|
||||
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
||||
| - good for ensuring strict SQL while developing
|
||||
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
|
||||
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
|
||||
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
|
||||
| NOTE: Disabling this will also effectively disable both
|
||||
| $this->db->last_query() and profiling of DB queries.
|
||||
| When you run a query, with this setting set to TRUE (default),
|
||||
| CodeIgniter will store the SQL statement for debugging purposes.
|
||||
| However, this may cause high memory usage, especially if you run
|
||||
| a lot of SQL queries ... disable this to avoid that problem.
|
||||
|
|
||||
| The $active_group variable lets you choose which connection group to
|
||||
| make active. By default there is only one group (the 'default' group).
|
||||
|
|
||||
| The $query_builder variables lets you determine whether or not to load
|
||||
| the query builder class.
|
||||
*/
|
||||
$active_group = 'default';
|
||||
$query_builder = TRUE;
|
||||
|
||||
$db['default'] = array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'devcrmms1_bd',
|
||||
'password' => '.vB==c$s_Yk7',
|
||||
'database' => 'devcrmms1_dev',
|
||||
'dbdriver' => 'mysqli',
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
'db_debug' => (ENVIRONMENT !== 'dev'),
|
||||
'cache_on' => FALSE,
|
||||
'cachedir' => '',
|
||||
'char_set' => 'utf8',
|
||||
'dbcollat' => 'utf8_general_ci',
|
||||
'swap_pre' => '',
|
||||
'encrypt' => FALSE,
|
||||
'compress' => FALSE,
|
||||
'stricton' => FALSE,
|
||||
'failover' => array(),
|
||||
'save_queries' => TRUE
|
||||
);
|
||||
|
||||
$db['ms1inscription'] = array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'devinscription_bd',
|
||||
'password' => 'x$@_v0-l_I((',
|
||||
'database' => 'devinscription_prod',
|
||||
'dbdriver' => 'mysqli',
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
'db_debug' => (ENVIRONMENT !== 'dev'),
|
||||
'cache_on' => FALSE,
|
||||
'cachedir' => '',
|
||||
'char_set' => 'utf8',
|
||||
'dbcollat' => 'utf8_general_ci',
|
||||
'swap_pre' => '',
|
||||
'encrypt' => FALSE,
|
||||
'compress' => FALSE,
|
||||
'stricton' => FALSE,
|
||||
'failover' => array(),
|
||||
'save_queries' => TRUE
|
||||
);
|
||||
2
deploy_dev.php
Normal file
2
deploy_dev.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
echo shell_exec('/home/devcrmms1/deploy/deploy_dev.sh 2>&1');
|
||||
@ -168,6 +168,11 @@ class DynamicForms extends Controller
|
||||
}
|
||||
// =================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// =================================================
|
||||
// LISTES ENFANTS (quand on est sur le parent)
|
||||
// =================================================
|
||||
|
||||
Reference in New Issue
Block a user