mbi...@users.adullact.net
unread,Jun 24, 2024, 9:34:25 AM (5 days ago) Jun 24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openmairi...@googlegroups.com
Author: mbideau
Date: 2024-06-24 15:34:22 +0200 (Mon, 24 Jun 2024)
New Revision: 18056
Modified:
branches/6.6.0-develop--fix-module-obj/obj/instruction.class.php
branches/6.6.0-develop--fix-module-obj/obj/module.class.php
Log:
fix(modules): des objets metiers vides sont associes aux modules charges
Modified: branches/6.6.0-develop--fix-module-obj/obj/instruction.class.php
===================================================================
--- branches/6.6.0-develop--fix-module-obj/obj/instruction.class.php 2024-06-24 13:12:07 UTC (rev 18055)
+++ branches/6.6.0-develop--fix-module-obj/obj/instruction.class.php 2024-06-24 13:34:22 UTC (rev 18056)
@@ -122,6 +122,8 @@
// si on est sur un dossier d'instruction
if ($this->f->contexte_dossier_instruction()) {
$idx = $this->f->get_submitted_get_value('idxformulaire');
+ $object = ! empty($this->getVal($this->clePrimaire)) ? $this : null;
+ $object = ! $only_for_class ? $object : null;
if (! empty($idx)) {
// si on est dans le cadre de l'affichage d'une nouvelle instruction
@@ -133,7 +135,7 @@
$evenements_ids = array_column($evenements_data, 'evenement');
$this->f->log(__METHOD__, 'evenements: '.implode(',', $evenements_ids));
$modules = $this->f->module_manager->get_modules_for_object_name_and_ids(
- 'evenement', $evenements_ids, $this, false);
+ 'evenement', $evenements_ids, $object, false);
}
// si on est dans le cadre d'un listing
@@ -159,9 +161,8 @@
// ajoute les modules des évènements des instructions du dossier courant
$evenements_ids = array_column($qres['result'], 'evenement');
$this->f->log(__METHOD__, 'evenements: '.implode(',', $evenements_ids));
- $linked_object = ! $only_for_class ? $this : null;
$modules = $this->f->module_manager->get_modules_for_object_name_and_ids(
- 'evenement', $evenements_ids, $linked_object, false);
+ 'evenement', $evenements_ids, $object, false);
}
}
}
Modified: branches/6.6.0-develop--fix-module-obj/obj/module.class.php
===================================================================
--- branches/6.6.0-develop--fix-module-obj/obj/module.class.php 2024-06-24 13:12:07 UTC (rev 18055)
+++ branches/6.6.0-develop--fix-module-obj/obj/module.class.php 2024-06-24 13:34:22 UTC (rev 18056)
@@ -88,12 +88,18 @@
*
* @return module
*/
- public function __construct(string $dir, application $framework, ?lien_module $object_link_instance = null, ?om_dbform $object = null) {
+ public function __construct(string $dir, application $framework,
+ ?lien_module $object_link_instance = null, ?om_dbform $object = null) {
$this->framework = $framework;
- $this->log(__METHOD__, '');
+ $this->log(__METHOD__, 'object_link: '.$object_link_instance->to_string().
+ ', object: '.($object ? get_class($object).
+ '#'.$object->getVal($object->clePrimaire) : 'null'));
$this->dir = $dir;
$this->object_link_instance = $object_link_instance;
$this->object = $object;
+ if (! empty($this->object) && empty($this->object->getVal($this->object->clePrimaire))) {
+ throw new RuntimeException("Cannot specify an object with no primary key");
+ }
$this->load_conf();
}