Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/extracompanyname #491

Open
wants to merge 57 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9626095
autoload entities from db
manuelh78 Apr 8, 2024
332aa62
Ajout Statut Legal
manuelh78 Apr 8, 2024
0db0435
Modif Adherent
manuelh78 Apr 8, 2024
e97e860
Update company.html.twig
manuelh78 Apr 8, 2024
90f8e00
Payment typeS
manuelh78 Apr 8, 2024
8c57e9a
change Titles routes
manuelh78 Apr 8, 2024
d5291f2
Update mysql.sql
manuelh78 Apr 8, 2024
27a11d4
Update company.html.twig
manuelh78 Apr 8, 2024
8e300b8
affichage revu
manuelh78 Apr 8, 2024
02affef
Update mysql.sql
manuelh78 Apr 8, 2024
fbaffb4
amélioration Repository
manuelh78 Apr 8, 2024
ecb7d24
Update Adherent.php
manuelh78 Apr 8, 2024
b4d3633
Update MembersController.php
manuelh78 Apr 8, 2024
f5b68d7
Update RepositoryTrait.php
manuelh78 Apr 8, 2024
98f37a4
Update RepositoryTrait.php
manuelh78 Apr 8, 2024
48cf9c1
Update EntityFromDb.php
manuelh78 Apr 8, 2024
01c46fd
Ajout supression des entities / TWIG
manuelh78 Apr 9, 2024
942af2f
Payment update
manuelh78 Apr 9, 2024
ee651e3
Passer les tests 1
manuelh78 Apr 9, 2024
29c95f6
EntityFromDb
manuelh78 Apr 15, 2024
bac8278
Update PaymentTypes.php
manuelh78 Apr 15, 2024
d8dc037
Update Title.php
manuelh78 Apr 15, 2024
b635640
Update Adherent.php
manuelh78 Apr 15, 2024
917a45a
Update LegalStatus.php
manuelh78 Apr 15, 2024
5499ca2
Update PaymentType.php
manuelh78 Apr 15, 2024
37b200f
Update Titles.php
manuelh78 Apr 15, 2024
dd68b7b
Create Translate.php
manuelh78 Apr 15, 2024
92d5c22
Update TitlesController.php
manuelh78 Apr 15, 2024
d7b53d9
Après validation
manuelh78 Apr 16, 2024
ab78a5d
automatic getters /setters
manuelh78 Apr 16, 2024
a1435b5
Update TestsBootstrap.php
manuelh78 Apr 16, 2024
1c7789e
Update Title.php
manuelh78 Apr 16, 2024
d2b720a
Update LegalStatus.php
manuelh78 Apr 16, 2024
efeff5c
Update EntityFromDb.php
manuelh78 Apr 16, 2024
f30a106
Update Login.php
manuelh78 Apr 16, 2024
833cd46
Update PaymentTypes.php
manuelh78 Apr 16, 2024
692778b
Phpcbf
manuelh78 Apr 16, 2024
6782645
Update RepositoryTrait.php
manuelh78 Apr 16, 2024
39106de
Update company.html.twig
manuelh78 Apr 16, 2024
79b0f51
Update Adherent.php
manuelh78 Apr 19, 2024
d31630f
Update EntityFromDb.php
manuelh78 May 6, 2024
375639d
Update Title.php
manuelh78 May 7, 2024
bfc1b77
Update Adherent.php
manuelh78 May 7, 2024
84fcba9
Update mysql.sql
manuelh78 May 7, 2024
fe815a2
Update LegalStatus.php
manuelh78 May 7, 2024
f977c3c
Update Adherent.php
manuelh78 May 7, 2024
f531fc6
Update PaymentType.php
manuelh78 May 7, 2024
a748be7
Update LegalStatuss.php
manuelh78 May 7, 2024
8918f09
Utiliser un nom de methode plus claire getInstallDefaultValues
manuelh78 May 7, 2024
24a7a8a
Update EntityFromDb.php
manuelh78 May 8, 2024
3ba14f3
Update Titles.php
manuelh78 May 8, 2024
4ef03d2
Update PaymentTypes.php
manuelh78 May 8, 2024
942d62f
add removeAll()
manuelh78 May 10, 2024
45117be
phpcbf
manuelh78 May 10, 2024
92ac24e
Update Titles.php
manuelh78 May 10, 2024
937f840
phpcbf add types
manuelh78 May 10, 2024
6eab12f
twigcs company.html.twig
manuelh78 May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions galette/includes/fields_defs/members_fields.php
Expand Up @@ -67,6 +67,14 @@
'position' => 5,
'category' => FieldsCategories::ADH_CATEGORY_IDENTITY
),
'id_legal_status' => array( // POURQUOI _adh +/- partout ?
'label' => _T("Legal status:"),
'propname' => 'id_legal_status',
'required' => false,
'visible' => FieldsConfig::NOBODY,//USER_WRITE,
'position' => 5000000, //TODO
'category' => FieldsCategories::ADH_CATEGORY_IDENTITY
),
'pseudo_adh' => array(
'label' => _T("Nickname:"),
'propname' => 'nickname',
Expand Down
63 changes: 4 additions & 59 deletions galette/includes/routes/management.routes.php
Expand Up @@ -29,6 +29,7 @@
use Galette\Controllers\AdminToolsController;
use Galette\Controllers\TextController;
use Galette\DynamicFields\DynamicField;
use Galette\Controllers\Crud\CrudHelper;

//galette's dashboard
$app->get(
Expand Down Expand Up @@ -207,35 +208,9 @@ function ($request, $response) use ($routeparser) {
[PdfController::class, 'storeModels']
)->setName('pdfModels')->add($authenticate);

$app->get(
'/titles',
[Crud\TitlesController::class, 'list']
)->setName('titles')->add($authenticate);

$app->post(
'/titles',
[Crud\TitlesController::class, 'doAdd']
)->setName('titles')->add($authenticate);

$app->get(
'/titles/remove/{id:\d+}',
[Crud\TitlesController::class, 'confirmDelete']
)->setName('removeTitle')->add($authenticate);

$app->post(
'/titles/remove/{id:\d+}',
[Crud\TitlesController::class, 'delete']
)->setName('doRemoveTitle')->add($authenticate);

$app->get(
'/titles/edit/{id:\d+}',
[Crud\TitlesController::class, 'edit']
)->setname('editTitle')->add($authenticate);

$app->post(
'/titles/edit/{id:\d+}',
[Crud\TitlesController::class, 'doEdit']
)->setname('editTitle')->add($authenticate);
CrudHelper::addRoutesBasicEntityCRUD($app, Crud\TitlesController::class, $authenticate);
CrudHelper::addRoutesBasicEntityCRUD($app, Crud\LegalStatussController::class, $authenticate);
CrudHelper::addRoutesBasicEntityCRUD($app, Crud\PaymentTypesController::class, $authenticate);

$app->get(
'/texts[/{lang}/{ref}]',
Expand Down Expand Up @@ -403,36 +378,6 @@ function ($request, $response) use ($routeparser) {
[AdminToolsController::class, 'process']
)->setName('doAdminTools')->add($authenticate);

$app->get(
'/payment-types',
[Crud\PaymentTypeController::class, 'list']
)->setName('paymentTypes')->add($authenticate);

$app->post(
'/payment-types',
[Crud\PaymentTypeController::class, 'doAdd']
)->setName('paymentTypes')->add($authenticate);

$app->get(
'/payment-type/remove/{id:\d+}',
[Crud\PaymentTypeController::class, 'confirmDelete']
)->setName('removePaymentType')->add($authenticate);

$app->post(
'/payment-type/remove/{id:\d+}',
[Crud\PaymentTypeController::class, 'delete']
)->setName('doRemovePaymentType')->add($authenticate);

$app->get(
'/payment-type/edit/{id:\d+}',
[Crud\PaymentTypeController::class, 'edit']
)->setname('editPaymentType')->add($authenticate);

$app->post(
'/payment-type/edit/{id:\d+}',
[Crud\PaymentTypeController::class, 'doEdit']
)->setname('editPaymentType')->add($authenticate);

$app->get(
'/{form_name:adh|contrib|trans}/{id:\d+}/file/{fid:\d+}/{pos:\d+}/{name}',
[Crud\DynamicFieldsController::class, 'getDynamicFile']
Expand Down
10 changes: 10 additions & 0 deletions galette/install/scripts/mysql.sql
Expand Up @@ -11,6 +11,7 @@ CREATE TABLE galette_adherents (
prenom_adh varchar(255) NOT NULL default '',
pseudo_adh varchar(255) NOT NULL default '',
societe_adh varchar(200) default NULL,
id_legal_status int(10) unsigned DEFAULT NULL,
titre_adh int(10) unsigned default NULL,
ddn_adh date default '1901-01-01',
sexe_adh tinyint(1) NOT NULL default '0',
Expand Down Expand Up @@ -44,6 +45,7 @@ CREATE TABLE galette_adherents (
UNIQUE (login_adh),
FOREIGN KEY (id_statut) REFERENCES galette_statuts (id_statut) ON DELETE RESTRICT ON UPDATE CASCADE,
FOREIGN KEY (titre_adh) REFERENCES galette_titles (id_title) ON DELETE RESTRICT ON UPDATE CASCADE,
FOREIGN KEY (id_legal_status) REFERENCES galette_legalstatus (id_legal_status) ON DELETE RESTRICT ON UPDATE CASCADE,
FOREIGN KEY (parent_id) REFERENCES galette_adherents (id_adh) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

Expand Down Expand Up @@ -95,6 +97,14 @@ CREATE TABLE galette_titles (
PRIMARY KEY (id_title)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

DROP TABLE IF EXISTS galette_legalstatus;
CREATE TABLE galette_legalstatus (
id_legal_status int(10) unsigned NOT NULL auto_increment,
short_label varchar(10) NOT NULL default '',
long_label varchar(100) default '',
PRIMARY KEY (id_legal_status)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;

DROP TABLE IF EXISTS galette_types_cotisation;
CREATE TABLE galette_types_cotisation (
id_type_cotis int(10) unsigned NOT NULL auto_increment,
Expand Down
2 changes: 1 addition & 1 deletion galette/lib/Galette/Controllers/AdminToolsController.php
Expand Up @@ -108,7 +108,7 @@ public function process(Request $request, Response $response): Response

if (isset($post['initpdfmodels'])) {
//proceed emails texts reinitialization
$models = new PdfModels($this->zdb, $this->preferences, $this->login);
$models = new PdfModels();//$this->zdb, $this->preferences, $this->login);
$res = $models->installInit(false);
if ($res === true) {
$success_detected[] = _T("PDF models has been successfully reinitialized.");
Expand Down
96 changes: 96 additions & 0 deletions galette/lib/Galette/Controllers/Crud/CrudHelper.php
@@ -0,0 +1,96 @@
<?php

namespace Galette\Controllers\Crud;

use Slim\App;
use Galette\Middleware\Authenticate;

/**
* CrudHelper
*
* @author Manuel <manuelh78dev@ik.me>
*/
class CrudHelper
{
/**
* Ajouter des routes automatiquement pour un object Entity via le nom de son controller
*
* @param Slim\App $app Slim application
* @param string $controllerClassName controller class name AController::class
* @param Authenticate $authenticate Middleware for user authentification
*
* @return void
*/
public static function addRoutesBasicEntityCRUD(App $app, string $controllerClassName, Authenticate $authenticate): void
{
//Galette\Controllers\Crud\TitlesController -> Title
$entity = str_replace(['Controller', '\\'], ['', '/'], $controllerClassName);
$entity = basename($entity);
$entity = substr($entity, 0, -1);

$baseName = lcfirst($entity);
$basePath = strtolower($entity);

$app->get(
"/{$basePath}s",
[$controllerClassName, 'list']
)->setName("{$baseName}s")->add($authenticate);

$app->post(
"/{$basePath}",
[$controllerClassName, 'doAdd']
)->setName("add{$entity}"/*"{$basePath}"*/)->add($authenticate);

$app->get(
"/{$basePath}/remove/{id:\d+}",
[$controllerClassName, 'confirmDelete']
)->setName("remove{$entity}")->add($authenticate);

$app->post(
"/{$basePath}/remove/{id:\d+}",
[$controllerClassName, 'delete']
)->setName("doRemove{$entity}")->add($authenticate);

$app->get(
"/{$basePath}/edit/{id:\d+}",
[$controllerClassName, 'edit']
)->setname("edit{$entity}")->add($authenticate);

$app->post(
"/{$basePath}/edit/{id:\d+}",
[$controllerClassName, 'doEdit']
)->setname("edit{$entity}")->add($authenticate);
}
}


/*$app->get(
'/titles',
[Crud\TitlesController::class, 'list']
)->setName('titles')->add($authenticate);

$app->post(
'/title',
[Crud\TitlesController::class, 'doAdd']
)->setName('titles')->add($authenticate);

$app->get(
'/titles/remove/{id:\d+}',
[Crud\TitlesController::class, 'confirmDelete']
)->setName('removeTitle')->add($authenticate);

$app->post(
'/titles/remove/{id:\d+}',
[Crud\TitlesController::class, 'delete']
)->setName('doRemoveTitle')->add($authenticate);

$app->get(
'/titles/edit/{id:\d+}',
[Crud\TitlesController::class, 'edit']
)->setname('editTitle')->add($authenticate);

$app->post(
'/titles/edit/{id:\d+}',
[Crud\TitlesController::class, 'doEdit']
)->setname('editTitle')->add($authenticate);
*/