Skip to content

Commit

Permalink
Additonal Check for length of inserted value
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Apr 18, 2023
1 parent 360b385 commit 9fb68bc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion debian/composer.json
Expand Up @@ -3,7 +3,7 @@
"description": "Library for easy interaction with czech accounting system AbraFlexi.",
"homepage": "https://github.com/Spoje-NET/php-abraflexi",
"license": "GPL-2.0+",
"version": "2.23",
"version": "2.23.1",
"type": "library",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/AbraFlexi/RO.php
Expand Up @@ -2087,7 +2087,7 @@ public function getFirstRecordID() {
}

/**
* Get previous record ID
* Get next record ID
*
* @param array $conditions optional
*
Expand Down
17 changes: 17 additions & 0 deletions src/AbraFlexi/RW.php
Expand Up @@ -597,4 +597,21 @@ public function sendUnsent() {
return $this->lastResponseCode == 202;
}

/**
* @inheritDoc
*/
public function setDataValue(string $columnName, $value)
{
if($this->debug === true){
$columnInfo = $this->getColumnInfo($columnName);
if ($columnInfo) {
if (array_key_exists('maxLength', $columnInfo) && (mb_strlen((string)$value) > $columnInfo['maxLength'])) {
$this->addStatusMessage($value . ' is too long. Shorting to ' . $columnInfo['maxLength'] . ' characters', 'warning');
$value = substr($value, 0, intval($columnInfo['maxLength']));
}
}
}
return parent::setDataValue($columnName, $value);
}

}

0 comments on commit 9fb68bc

Please sign in to comment.