瀏覽代碼

MMICommon Trigger update when note updated

Mathieu Moulin 2 年之前
父節點
當前提交
92de55b215
共有 2 個文件被更改,包括 15 次插入2 次删除
  1. 14 1
      htdocs/core/class/commonobject.class.php
  2. 1 1
      htdocs/custom/mmicommon

+ 14 - 1
htdocs/core/class/commonobject.class.php

@@ -3436,7 +3436,7 @@ abstract class CommonObject
 	public function update_note($note, $suffix = '')
 	{
 		// phpcs:enable
-		global $user;
+		global $user, $conf;
 
 		if (!$this->table_element) {
 			$this->error = 'update_note was called on objet with property table_element not defined';
@@ -3477,6 +3477,19 @@ abstract class CommonObject
 				$this->note = $note; // deprecated
 				$this->note_private = $note;
 			}
+			// MMI Trigger
+			if (!empty($conf->global->MMICORE_UPDATE_NOTE_TRIGGER_UPDATE) && !empty($conf->global->MMICORE_UPDATE_NOTE_TRIGGER_UPDATE_LIST) && !empty($this->element)) {
+				$list = [];
+				preg_match_all('/([a-z_]+):([A-Z_]+)/', $conf->global->MMICORE_UPDATE_NOTE_TRIGGER_UPDATE_LIST, $matches);
+				if (!empty($matches)) foreach($matches[1] as $i=>$j) {
+					$list[$j] = $matches[2][$i];
+				}
+				//var_dump($list); die();
+				if (isset($list[$this->element])) {
+					//echo $list[$this->element].'_MODIFY';
+					$result = $this->call_trigger($list[$this->element].'_MODIFY', $user);
+				}
+			}
 			return 1;
 		} else {
 			$this->error = $this->db->lasterror();

+ 1 - 1
htdocs/custom/mmicommon

@@ -1 +1 @@
-Subproject commit 85f773f1daa9bc47d4e0deb1269e5c2ba41beff8
+Subproject commit 3a2705efdb19ced6a6725328d0b0ad44816128ca