Fixed saving new ContractconfigValuest

This commit is contained in:
Frank Schubert
2023-03-22 18:52:05 +01:00
parent 16d0d8c35a
commit f97c6cc603
5 changed files with 8 additions and 7 deletions

View File

@@ -86,7 +86,6 @@ class ContractconfigController extends mfBaseController {
}*/ }*/
$old_values[$item->name] = $item->getValue(); $old_values[$item->name] = $item->getValue();
if(!$item->value->set($itemvalue)) { if(!$item->value->set($itemvalue)) {
$error_items[$item->id] = $item->name; $error_items[$item->id] = $item->name;
continue; continue;

View File

@@ -19,8 +19,8 @@ abstract class Contractconfig_Hook {
abstract public function beforeSave(); abstract public function beforeSave();
abstract public function afterSave(); abstract public function afterSave();
abstract public function beforeDelete(); abstract public function beforeCancel();
abstract public function afterDelete(); abstract public function afterCancel();
public function __construct(Contract $contract) { public function __construct(Contract $contract) {

View File

@@ -85,6 +85,7 @@ class Contractconfig_Hook_Voicenumberblock extends Contractconfig_Hook {
/* /*
* TODO: Check if contract was canceled, then set lock and lock_reason to reserved * TODO: Check if contract was canceled, then set lock and lock_reason to reserved
* => should go into beforeCancel event
*/ */
public function checkNewNumbers() { public function checkNewNumbers() {
$this->log->debug(":: In Contractconfig_Hook_Voicenumberblock->afterSave()"); $this->log->debug(":: In Contractconfig_Hook_Voicenumberblock->afterSave()");
@@ -158,11 +159,11 @@ class Contractconfig_Hook_Voicenumberblock extends Contractconfig_Hook {
} }
public function beforeDelete() { public function beforeCancel() {
} }
public function afterDelete() { public function afterCancel() {
} }
} }

View File

@@ -59,7 +59,7 @@ class ContractconfigItem extends mfBaseModel {
$value->contract_id = $this->contract_id; $value->contract_id = $this->contract_id;
$value->create_by = $me->id; $value->create_by = $me->id;
} }
//var_dump($value);exit;
$this->value = $value; $this->value = $value;
return $this->value; return $this->value;
} }

View File

@@ -4,7 +4,8 @@ class ContractconfigValue extends mfBaseModel {
private $item; private $item;
public function set($new_value) { public function set($new_value) {
$item = $this->getProperty("item"); // explicitly load item, because we might not have an id yet
$item = new ContractconfigItem($this->item_id);
$me = new User(); $me = new User();
$me->loadMe(); $me->loadMe();