Contractjournal finished & Started Contractconfig Hooks for Provisioning Workflow
This commit is contained in:
@@ -55,6 +55,12 @@ class ContractconfigController extends mfBaseController {
|
||||
$this->redirect("Contract");
|
||||
}
|
||||
|
||||
$contract = new Contract($contract_id);
|
||||
if(!$contract->id) {
|
||||
$this->layout()->setFlash("Contract ID nicht gefunden.","error");
|
||||
$this->redirect("Contract");
|
||||
}
|
||||
|
||||
if(!is_array($r->itemvalues) || !count($r->itemvalues)) {
|
||||
$this->layout()->setFlash("Keine Änderungen.","info");
|
||||
$this->redirect("Contract");
|
||||
@@ -87,6 +93,9 @@ class ContractconfigController extends mfBaseController {
|
||||
return $this->editAction();
|
||||
}
|
||||
|
||||
// run custom productgroup hooks
|
||||
|
||||
|
||||
$this->layout()->setFlash("Konfiguration gespeichert", "success");
|
||||
$this->redirect("Contract", "view", ['id' => $contract_id]);
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
abstract class Contractconfig_Hook {
|
||||
protected $contract;
|
||||
protected $items;
|
||||
|
||||
public function __construct(Contract $contract) {
|
||||
|
||||
if(method_exists($this, "init")) {
|
||||
$this->init();
|
||||
}
|
||||
}
|
||||
|
||||
public function isResponsible() {
|
||||
if(!$this->contract) return false;
|
||||
|
||||
// only work on contracts with our producttech attributes
|
||||
if(!$this->testMyProductAttributes($contract)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function testMyProductAttributes(Contract $contract) {
|
||||
$product = $contract->product;
|
||||
|
||||
}
|
||||
|
||||
abstract public function beforeSave();
|
||||
abstract public function afterSave();
|
||||
|
||||
abstract public function beforeDelete();
|
||||
abstract public function afterDelete();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class Contractconfig_Hook_Voip extends Contractconfig_Hook {
|
||||
private $my_product_attributes = ["needs_number"];
|
||||
|
||||
/*
|
||||
* Checks to determine if class needs to work on contract.
|
||||
*/
|
||||
public function isResponsible(Contract $contract) {
|
||||
|
||||
/*
|
||||
* Test for standard checks
|
||||
* (Only Producttech attributes for now)
|
||||
*/
|
||||
if(!parent::isResponsible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// do additional checks
|
||||
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
||||
}
|
||||
|
||||
public function beforeSave() {
|
||||
|
||||
}
|
||||
|
||||
public function afterSave() {
|
||||
|
||||
}
|
||||
|
||||
public function beforeDelete() {
|
||||
|
||||
}
|
||||
|
||||
public function afterDelete() {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user