-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add the trigger to prefix on new event
- Loading branch information
Laurent De Coninck
committed
Oct 31, 2023
1 parent
bcf7e51
commit 41d5694
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
core/triggers/interface_01_modAgenda_PrefixTitleByBalloon.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
class InterfacePrefixTitleByBalloon extends DolibarrTriggers | ||
{ | ||
|
||
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) | ||
{ | ||
if('ACTION_CREATE' !== $action){ | ||
return 0 ; | ||
} | ||
|
||
if(!($object instanceof ActionComm)){ | ||
return 0 ; | ||
} | ||
|
||
if(!isset($object->array_options['options_bal']) || empty($object->array_options['options_bal'])){ | ||
return 0 ; // No balloon | ||
} | ||
|
||
$balloon = new Bbc_ballons($this->db); | ||
$balloon->fetch($object->array_options['options_bal']); | ||
if(empty($balloon->id)){ | ||
return 0 ; // No balloon found | ||
} | ||
|
||
$object->label = '['.$balloon->immat.'] - '.$object->label; | ||
$object->update($user, true); | ||
|
||
return 1; | ||
} | ||
} |