N°3735 - New method AddValue on DBObject for Designer users

This commit is contained in:
vdumas
2021-02-25 16:09:21 +01:00
parent 4ce3631e4b
commit a6f4b30004
2 changed files with 45 additions and 0 deletions

View File

@@ -237,6 +237,27 @@
</argument>
</arguments>
</method>
<method id="AddValue">
<arguments>
<argument id="1">
<type>attcode</type>
<mandatory>true</mandatory>
<type_restrictions>
<operation>allow</operation>
<types>
<type id="AttributeInteger"/>
<type id="AttributeDecimal"/>
<type id="AttributePercentage"/>
<type id="AttributeDuration"/>
</types>
</type_restrictions>
</argument>
<argument id="2">
<type>string</type>
<mandatory>false</mandatory>
</argument>
</arguments>
</method>
<method id="SetCurrentDate">
<arguments>
<argument id="1">

View File

@@ -3976,6 +3976,30 @@ abstract class DBObject implements iDisplay
public function SetCurrentDate($sAttCode)
{
$this->Set($sAttCode, time());
return true;
}
/**
* Helper to add a value to the given attribute
*
* Suitable for use as a lifecycle action
*
* @api
*
* @param string $sAttCode
* @param int|float $iValue
*
* @return bool
*
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @since 3.0.0
*/
public function AddValue($sAttCode, $iValue = 1)
{
$this->Set($sAttCode, $this->Get($sAttCode) + $iValue);
return true;
}