* NEW : Derive ModuleBuilder status labels from arrayofkeyval
LibStatut() in the ModuleBuilder object template hardcoded the
Draft/Enabled/Disabled labels, which diverged from the labels defined
in the 'status' field arrayofkeyval used by the list filter and the
select. Build labelStatus/labelStatusShort from arrayofkeyval so the
badge, the filter and the select all show the same configurable labels.
Add ModuleBuilderTemplateConventionsTest covering the derivation.
Next: normalize trigger codes to MYMODULE_MYOBJECT_ACTION in class line 637 + typo line 50, sql/data.sql lines 27/30-32, myobject_card.php line 378; extend the test with trigger assertions.
* NEW : Use explicit MODULE_OBJECT_ACTION trigger naming in template
The ModuleBuilder object template emitted the validate trigger as the
generic MYOBJECT_VALIDATE, inconsistent with the MYMODULE_MYOBJECT
prefix already advertised by $TRIGGER_PREFIX and used by the
unvalidate/cancel/reopen/sentbymail trigger codes. Normalize the
validate trigger, the seed data.sql agenda triggers and the close
notification example to the MYMODULE_MYOBJECT_<ACTION> policy so
generated modules expose clear, non-ambiguous trigger codes. Also fix a
typo in the $TRIGGER_PREFIX comment.
Extend ModuleBuilderTemplateConventionsTest with trigger naming checks.
Next: ChangeLog entry covering both features, then dolibarr-audit + functional verification, then push to remote quentin and run pr-review-v2.
* DOC : Add ChangeLog entries for ModuleBuilder status labels and triggers
Next: dolibarr-audit on both features, then functional verification, then push to remote quentin and run pr-review-v2.
* FIX : Guard ModuleBuilder LibStatut against undefined status key
Hardening from audit: when LibStatut() is called with a status value
that is not present in the 'status' field arrayofkeyval, reading
labelStatus/labelStatusShort raised an undefined-array-key warning under
PHP 8. Default both labels to an empty string, which dolGetStatus
already accepts, so the badge degrades gracefully to the status code.
Next: push branch to remote quentin and run dolibarr-pr-review-v2 on the full diff vs develop.
* CHORE Drop the files CONTRIBUTING forbids to edit in a PR [skip-claudemd]
ChangeLog is generated from the commit messages at release time, and the
language files other than en_US are synced from Transifex.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: Alexandre SPANGARO <aspangaro.dolibarr@gmail.com>
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Allow null for buyer, and force '' for in printObjectLine(s)
* Allow null for Contact in show_actions_done
* Qual: Enable phan on modulebuilder
# Qual: Enable phan on modulebuilder
Most files of the modulebuilder template can be checked as regular files.
It will help improve the template
* Update baseline (enable modulebuilder notices)
* Add properties that are expected to exist on modules_boxes
* Qual: Ignore false positive (phan)
* Set phpdoc type to include null on formAddObjectLine
* Qual: Fixes for modulebuilder (phan, phpstan, bugs, format)
* Fix phpcs for intracom
* Make ModeleBoxes:showBox() signature match child class's
* Fix *box::showBox() phpdoc types
* Update index.php
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
* Fix language
* Fix language
* Fix language
* Fix language
* Fix language
* Fix language
* Fix language
* CI Missing language key
* Update eventorganization.lang
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>