diff --git a/TODO.md b/TODO.md index 4db9d53..d1a81b0 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,6 @@ - [x] Standardise test group recipes: lint-php, lint-css, lint-js, test + add fix recipe + make lint pass clean - [x] Remove Mot de passe column from acces.php, add key.svg icon button in Actions to copy password to clipboard, reorder actions (URL/password/edit/toggle/archive), switch URL icon to link-simple.svg - [x] Fix CC2r: removed hidden seeds (were stale/overriding user input), render initial licence-choice from \$formData; Interne want_license unchecked clears CC2r+licence, switching from other modes preserves values; CC2r independent toggle; licence dropdown has no-licence placeholder -- [ ] Dans le formulaire admin, le contact privé ne se sauvegarde pas. +- [x] Dans le formulaire admin, le contact privé ne se sauvegarde pas. - [x] Remove "Rendre le contact visible publiquement sur la fiche du TFE" from admin add/edit forms - [x] Auto-show contact on public TFE page when contact_visible is filled (no checkbox needed) diff --git a/app/migrations/applied/042_fix_contact_columns.sql b/app/migrations/applied/042_fix_contact_columns.sql new file mode 100644 index 0000000..79f290f --- /dev/null +++ b/app/migrations/applied/042_fix_contact_columns.sql @@ -0,0 +1,74 @@ +-- 042_fix_contact_columns.sql +-- 041 accidentally renamed contact_interne → author_email and contact_public → author_show_contact. +-- Revert to the names used everywhere in the application code. + +DROP VIEW IF EXISTS v_theses_full; +DROP VIEW IF EXISTS v_theses_public; + +CREATE VIEW IF NOT EXISTS v_theses_full AS +SELECT + t.id, + t.identifier, + t.title, + t.subtitle, + t.year, + t.is_doctoral, + t.objet, + o.name as orientation, + ap.name as ap_program, + ft.name as finality_type, + t.synopsis, + t.context_note, + t.duration_pages, + t.duration_minutes, + t.has_annexes, + at.name as access_type, + lt.name as license_type, + t.license_id, + t.license_custom, + t.access_type_id, + t.jury_points, + t.submitted_at, + t.defense_date, + t.published_at, + t.is_published, + t.baiu_link, + t.exemplaire_baiu, + t.exemplaire_erg, + t.cc2r, + t.remarks, + t.jury_note_added, + t.contact_visible, + GROUP_CONCAT(DISTINCT a.name ORDER BY a.name ASC) as authors, + GROUP_CONCAT(DISTINCT s.name) as supervisors, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'president' THEN s.name END) as jury_president, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'promoteur' AND ts.is_ulb = 0 THEN s.name END) as jury_promoteurs, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'promoteur' AND ts.is_ulb = 1 THEN s.name END) as jury_promoteurs_ulb, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'lecteur' AND ts.is_external = 0 THEN s.name END) as jury_lecteurs_internes, + GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'lecteur' AND ts.is_external = 1 THEN s.name END) as jury_lecteurs_externes, + GROUP_CONCAT(DISTINCT l.name) as languages, + GROUP_CONCAT(DISTINCT fmt.name) as formats, + GROUP_CONCAT(DISTINCT tg.name) as keywords, + (SELECT a2.email FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as contact_interne, + (SELECT a2.show_contact FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as contact_public +FROM theses t +LEFT JOIN orientations o ON t.orientation_id = o.id +LEFT JOIN ap_programs ap ON t.ap_program_id = ap.id +LEFT JOIN finality_types ft ON t.finality_id = ft.id +LEFT JOIN access_types at ON t.access_type_id = at.id +LEFT JOIN license_types lt ON t.license_id = lt.id +LEFT JOIN thesis_authors ta ON t.id = ta.thesis_id +LEFT JOIN authors a ON ta.author_id = a.id +LEFT JOIN thesis_supervisors ts ON t.id = ts.thesis_id +LEFT JOIN supervisors s ON ts.supervisor_id = s.id +LEFT JOIN thesis_languages tl ON t.id = tl.thesis_id +LEFT JOIN languages l ON tl.language_id = l.id +LEFT JOIN thesis_formats tf ON t.id = tf.thesis_id +LEFT JOIN format_types fmt ON tf.format_id = fmt.id +LEFT JOIN thesis_tags tt ON t.id = tt.thesis_id +LEFT JOIN tags tg ON tt.tag_id = tg.id +GROUP BY t.id; + +CREATE VIEW IF NOT EXISTS v_theses_public AS +SELECT * FROM v_theses_full +WHERE is_published = 1; diff --git a/app/storage/schema.sql b/app/storage/schema.sql index 7369989..56f7f1d 100644 --- a/app/storage/schema.sql +++ b/app/storage/schema.sql @@ -418,7 +418,6 @@ SELECT ft.name as finality_type, t.synopsis, t.context_note, - t.contact_visible, t.duration_pages, t.duration_minutes, t.has_annexes, @@ -438,6 +437,7 @@ SELECT t.cc2r, t.remarks, t.jury_note_added, + t.contact_visible, GROUP_CONCAT(DISTINCT a.name ORDER BY a.name ASC) as authors, GROUP_CONCAT(DISTINCT s.name) as supervisors, GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'president' THEN s.name END) as jury_president,