Merge-Konflikt in DeviceController.php behoben
This commit is contained in:
@@ -8,6 +8,7 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
private $status;
|
||||
private $statusflags; // TODO
|
||||
private $preorders;
|
||||
private $active_preorders;
|
||||
|
||||
protected function init() {
|
||||
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
@@ -65,6 +66,8 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
$gda_egenschaft = strtolower($hausnummer->rimo_type);
|
||||
}
|
||||
|
||||
if(strtolower($gda_egenschaft) == "greenfield") continue;
|
||||
|
||||
if(!$gda_egenschaft) {
|
||||
$unit_count_gda["sd"] += $hausnummer->unit_count;
|
||||
continue;
|
||||
@@ -107,11 +110,13 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
$old_status = new ADBStatus($this->_old_data->status_id);
|
||||
$new_status = new ADBStatus($this->data->status_id);
|
||||
$logstr .= "| '$key' => FROM '".$this->_old_data->$key."' TO '".$this->data->$key."' [".$old_status->code." => ".$new_status->code."]";
|
||||
} elseif($key = "external_data" && $this->_old_data->external_data && $this->external_data) {
|
||||
} elseif($key == "external_data" && $this->_old_data->external_data && $this->external_data) {
|
||||
$old_data = json_decode($this->_old_data->external_data);
|
||||
$new_data = json_decode($this->external_data);
|
||||
if(json_encode($old_data) !== json_encode($new_data)) {
|
||||
$logstr .= "| '$key' => FROM '".$this->_old_data->$key."' TO '".$this->data->$key."'";
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$logstr .= "| '$key' => FROM '".$this->_old_data->$key."' TO '".$this->data->$key."'";
|
||||
@@ -312,6 +317,15 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
return $this->preorders;
|
||||
}
|
||||
|
||||
if($name == "active_preorders") {
|
||||
$preorders = PreorderModel::searchActive(["adb_wohneinheit_id" => $this->id]);
|
||||
if(!count($preorders)) {
|
||||
return [];
|
||||
}
|
||||
$this->preorders = $preorders;
|
||||
return $this->preorders;
|
||||
}
|
||||
|
||||
if($name == "ftu_data") {
|
||||
$rimo_data = $this->getExternalRimoData();
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1066,7 +1066,7 @@ class AddressDBController extends mfBaseController {
|
||||
$u['zusatz'] = $unit->zusatz;
|
||||
$u['usage'] = $unit->nutzung;
|
||||
$u['oaid'] = $unit->oaid;
|
||||
$u['preorder_count'] = count($unit->preorders);
|
||||
$u['preorder_count'] = count($unit->active_preorders);
|
||||
$results[] = $u;
|
||||
}
|
||||
|
||||
|
||||
@@ -447,6 +447,10 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
'sort_key' => $sort_key,
|
||||
'oaid' => $data->hausnummer_oaid,
|
||||
'cluster_id' => $data->netzgebiet_extref,
|
||||
'rimo_external_id' => null,
|
||||
'visibility' => null,
|
||||
'adrcd' => null,
|
||||
'subcd' => null,
|
||||
'zip' => $data->plz,
|
||||
'city' => $data->gemeinde,
|
||||
"municipality" => "",
|
||||
@@ -472,6 +476,17 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
} else {
|
||||
unset($tmp_addresses[$address_key]['municipality']);
|
||||
}
|
||||
if($this->me->is("preorderaddressreporting")) {
|
||||
$tmp_addresses[$address_key]['rimo_external_id'] = $data->hausnummer_rimo_id;
|
||||
$tmp_addresses[$address_key]['visibility'] = $data->visibility;
|
||||
$tmp_addresses[$address_key]['adrcd'] = $data->adrcd;
|
||||
$tmp_addresses[$address_key]['subcd'] = $data->subcd;
|
||||
} else {
|
||||
unset($tmp_addresses[$address_key]['rimo_external_id']);
|
||||
unset($tmp_addresses[$address_key]["visibility"]);
|
||||
unset($tmp_addresses[$address_key]["adrcd"]);
|
||||
unset($tmp_addresses[$address_key]["subcd"]);
|
||||
}
|
||||
}
|
||||
|
||||
$unit_data = [
|
||||
@@ -589,6 +604,10 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
$new_address['ordered'] = $u['ordered'];
|
||||
$new_address['orderType'] = $u['orderType'];
|
||||
$new_address['ispName'] = $u['ispName'];
|
||||
$new_address['rimo_external_id'] = $ta['rimo_external_id'];
|
||||
$new_address['visibility'] = $ta['visibility'];
|
||||
$new_address['adrcd'] = $ta['adrcd'];
|
||||
$new_address['subcd'] = $ta['subcd'];
|
||||
}
|
||||
$new_address['oaid'] = $u['oaid'];
|
||||
$new_address['building_oaid'] = $ta['oaid'];
|
||||
@@ -743,6 +762,10 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
$tmp_addresses[$address_key] = [
|
||||
'oaid' => $data->hausnummer_oaid,
|
||||
'cluster_id' => $data->netzgebiet_extref,
|
||||
'rimo_external_id' => null,
|
||||
'visibility' => null,
|
||||
'adrcd' => null,
|
||||
'subcd' => null,
|
||||
'zip' => $data->plz,
|
||||
'city' => $data->gemeinde,
|
||||
"municipality" => "",
|
||||
@@ -768,7 +791,17 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
} else {
|
||||
unset($tmp_addresses[$address_key]['municipality']);
|
||||
}
|
||||
|
||||
if($this->me->is("preorderaddressreporting")) {
|
||||
$tmp_addresses[$address_key]['rimo_external_id'] = $data->hausnummer_rimo_id;
|
||||
$tmp_addresses[$address_key]['visibility'] = $data->visibility;
|
||||
$tmp_addresses[$address_key]['adrcd'] = $data->adrcd;
|
||||
$tmp_addresses[$address_key]['subcd'] = $data->subcd;
|
||||
} else {
|
||||
unset($tmp_addresses[$address_key]['rimo_external_id']);
|
||||
unset($tmp_addresses[$address_key]["visibility"]);
|
||||
unset($tmp_addresses[$address_key]["adrcd"]);
|
||||
unset($tmp_addresses[$address_key]["subcd"]);
|
||||
}
|
||||
}
|
||||
|
||||
$unit_data = [
|
||||
@@ -808,6 +841,10 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
||||
$new_address['ordered'] = $u['ordered'];
|
||||
$new_address['orderType'] = $u['orderType'];
|
||||
$new_address['ispName'] = $u['ispName'];
|
||||
$new_address['rimo_external_id'] = $ta['rimo_external_id'];
|
||||
$new_address['visibility'] = $ta['visibility'];
|
||||
$new_address['adrcd'] = $ta['adrcd'];
|
||||
$new_address['subcd'] = $ta['subcd'];
|
||||
}
|
||||
$new_address['oaid'] = $u['oaid'];
|
||||
$new_address['building_oaid'] = $ta['oaid'];
|
||||
|
||||
@@ -15,7 +15,9 @@ class Building extends mfBaseModel {
|
||||
private $workflowitems;
|
||||
private $files;
|
||||
private $pipework_enabler;
|
||||
|
||||
private $creator;
|
||||
private $editor;
|
||||
|
||||
public function getAddress($singelLine = false) {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
@@ -327,6 +329,28 @@ class Building extends mfBaseModel {
|
||||
return $this->pipework_enabler;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
|
||||
if($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
|
||||
if($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
|
||||
|
||||
@@ -10,9 +10,7 @@ class ConstructionConsentController extends mfBaseController {
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908]))) $this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
protected function indexAction() : void {
|
||||
|
||||
@@ -11,9 +11,7 @@ class ConstructionConsentContactController extends mfBaseController
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908]))) $this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
|
||||
@@ -9,9 +9,7 @@ class ConstructionConsentJournalController extends mfBaseController {
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908]))) $this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
protected function saveAction() {
|
||||
|
||||
@@ -11,9 +11,7 @@ class ConstructionConsentOwnerController extends mfBaseController
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908]))) $this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
protected function uploadDocumentAction() {
|
||||
|
||||
@@ -4,6 +4,7 @@ class ConstructionConsentProject extends mfBaseModel {
|
||||
private $consents;
|
||||
private $networks;
|
||||
private $adb_networks;
|
||||
private $addresses;
|
||||
|
||||
protected function beforeUpdate($data) {
|
||||
if(!array_key_exists("edit_by", $data)) {
|
||||
@@ -18,11 +19,21 @@ class ConstructionConsentProject extends mfBaseModel {
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "addresses") {
|
||||
$addresses = ConstructionConsentProjectAddress::search(["constructionconsentproject_id" => $this->id]);
|
||||
if(!count($addresses)) {
|
||||
return [];
|
||||
}
|
||||
foreach($addresses as $address) {
|
||||
$this->addresses[$address->address->id] = $address;
|
||||
}
|
||||
return $this->addresses;
|
||||
}
|
||||
|
||||
if($name == "consents") {
|
||||
$consents = ConstructionConsent::search(["constructionconsentproject_id" => $this->id]);
|
||||
if(!$consents) {
|
||||
return [];
|
||||
|
||||
}
|
||||
$this->consents = $consents;
|
||||
return $this->consents;
|
||||
|
||||
@@ -10,9 +10,7 @@ class ConstructionConsentProjectController extends mfBaseController {
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908]))) $this->redirect("Dashboard");
|
||||
}
|
||||
|
||||
protected function indexAction() : void {
|
||||
@@ -135,30 +133,21 @@ class ConstructionConsentProjectController extends mfBaseController {
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
$netzgebiete = [];
|
||||
|
||||
if(!$project->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern", "error");
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
|
||||
// save networks
|
||||
$netzgebiete = [];
|
||||
foreach($r->adb_netzgebiet_id as $netzgebiet_id) {
|
||||
$netzgebiet = new ADBNetzgebiet($netzgebiet_id);
|
||||
if(!$netzgebiet->id) continue;
|
||||
|
||||
$netzgebiete[] = $netzgebiet_id;
|
||||
}
|
||||
|
||||
/*
|
||||
if($mode == "add") {
|
||||
$project = ConstructionConsentProject::create($data);
|
||||
} else {
|
||||
$project->update($data);
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
//save networks
|
||||
foreach($netzgebiete as $netzgebiet_id) {
|
||||
$ccn = ConstructionConsentNetwork::getFirst(["constructionconsentproject_id" => $project->id, "adb_netzgebiet_id" => $netzgebiet_id]);
|
||||
if(!$ccn) {
|
||||
@@ -169,17 +158,40 @@ class ConstructionConsentProjectController extends mfBaseController {
|
||||
$ccn->save();
|
||||
}
|
||||
}
|
||||
|
||||
foreach(ConstructionConsentNetwork::search(["constructionconsentproject_id" => $project->id]) as $ccn) {
|
||||
if(!in_array($ccn->adb_netzgebiet_id, $netzgebiete)) {
|
||||
$ccn->delete();
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($r->get());exit;
|
||||
// save addresses
|
||||
$addresses = [];
|
||||
foreach($r->address_id as $address_id) {
|
||||
$address = new Address($address_id);
|
||||
if(!$address->id) continue;
|
||||
|
||||
$addresses[] = $address_id;
|
||||
}
|
||||
foreach($addresses as $address_id) {
|
||||
$cca = ConstructionConsentProjectAddress::getFirst(["constructionconsentproject_id" => $project->id, "address_id" => $address_id]);
|
||||
if(!$cca) {
|
||||
$cca = ConstructionConsentProjectAddress::create([
|
||||
"constructionconsentproject_id" => $project->id,
|
||||
"address_id" => $address_id
|
||||
]);
|
||||
$cca->save();
|
||||
}
|
||||
}
|
||||
foreach(ConstructionConsentProjectAddress::search(["constructionconsentproject_id" => $project->id]) as $cca) {
|
||||
if(!in_array($cca->address_id, $addresses)) {
|
||||
$cca->delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->layout()->setFlash("Zustimmungserklärungsprojekt erfolgreich gespeichert", "success");
|
||||
$this->redirect("ConstructionConsentProject");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -417,9 +417,9 @@ class DeviceController extends mfBaseController
|
||||
|
||||
private function getDevices()
|
||||
{
|
||||
if (!$this->me->is(["Admin"])) {
|
||||
if ($this->allowedPops === null) return [];
|
||||
}
|
||||
|
||||
if ($this->allowedPops === null) return [];
|
||||
|
||||
$devices = DeviceModel::search(['popIds' => $this->allowedPops]);
|
||||
|
||||
foreach ($devices as $device) {
|
||||
|
||||
@@ -37,6 +37,12 @@ class Preorder extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
public function beforeSave() {
|
||||
if(!isset($this->data->status_id)) {
|
||||
$this->data->status_id = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function afterSave() {
|
||||
// reset auto magic properties
|
||||
$this->status = null;
|
||||
@@ -111,6 +117,9 @@ class Preorder extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
$campaign = $this->getProperty("campaign");
|
||||
if($campaign->oaid_origin == "other") return true;
|
||||
|
||||
if($this->adb_wohneinheit_id && is_array($this->getProperty("adb_wohneinheit")->rimo_workorders)) {
|
||||
foreach($this->getProperty("adb_wohneinheit")->rimo_workorders as $workorder) {
|
||||
Rimoapi::updateWorkorder($workorder->rimo_id, $update);
|
||||
@@ -425,7 +434,7 @@ class Preorder extends mfBaseModel {
|
||||
|
||||
$new_status = new Preorderstatus($this->status_id);
|
||||
if(!$new_status->id) {
|
||||
$this->log->warning(__METHOD__ . ": Preorder has invalid status!");
|
||||
$this->log->warning(__METHOD__ . ": Preorder has invalid status! ".print_r($this, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -583,6 +592,23 @@ class Preorder extends mfBaseModel {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*if($campaign->oaid_origin == "other") {
|
||||
// oaid in wohneinheit übernehmen, falls in Preorder schon vorhanden
|
||||
if($this->oaid)
|
||||
// oaid aus wohneinheit übernehmen, falls vorhanden
|
||||
|
||||
|
||||
$this->log->debug(__METHOD__.": Kampagne unterstützt keine OAIDs");
|
||||
return true;
|
||||
}*/
|
||||
|
||||
if($campaign->oaid_origin == "other") {
|
||||
if($wohneinheit->oaid != $this->oaid) {
|
||||
$this->oaid = $wohneinheit->oaid;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if($this->oaid) {
|
||||
// If current OAID is from correct Origin then do nothing
|
||||
if($campaign->oaid_origin == "thetool") {
|
||||
@@ -755,6 +781,13 @@ class Preorder extends mfBaseModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
$campaign = new Preordercampaign($this->preordercampaign_id);
|
||||
|
||||
if($campaign->oaid_origin == "other") {
|
||||
$this->log->debug(__METHOD__.": Kampagne unterstützt keine OAIDs");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!$this->oaid) {
|
||||
$this->setOrCreateOaid();
|
||||
if(!$this->oaid) {
|
||||
|
||||
@@ -399,6 +399,28 @@ class PreorderController extends mfBaseController {
|
||||
$this->redirect("Preordercampaign");
|
||||
}
|
||||
|
||||
$new_status = false;
|
||||
if($data['adb_wohneinheit_id']) {
|
||||
$unit = new ADBWohneinheit($data['adb_wohneinheit_id']);
|
||||
if ($unit->id) {
|
||||
$new_status = PreorderstatusModel::getFirst(["code" => $unit->status->code]);
|
||||
if ($unit->hausnummer->status->code > $unit->status->code) {
|
||||
$new_status = PreorderstatusModel::getFirst(["code" => $unit->hausnummer->status->code]);
|
||||
}
|
||||
}
|
||||
} elseif($data['adb_hausnummer_id']) {
|
||||
$h = new ADBHausnummer($data['adb_hausnummer_id']);
|
||||
if($h->id) {
|
||||
$new_status = PreorderstatusModel::getFirst(["code" => $h->status->code]);
|
||||
}
|
||||
}
|
||||
if($new_status) {
|
||||
$data["status_id"] = $new_status->id;
|
||||
} else {
|
||||
$data["status_id"] = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($campaign->product_type != "setup_only") {
|
||||
$data['product_id'] = $r->product_id;
|
||||
@@ -1345,12 +1367,14 @@ class PreorderController extends mfBaseController {
|
||||
/*if($preorder->type != "legacytransfer") {
|
||||
return false;
|
||||
}*/
|
||||
if(!$this->me->is("Admin")) {
|
||||
if(!$this->me->is("Admin") && !$this->me->can("preorder")) {
|
||||
$this->log->debug(__METHOD__.": no permission");
|
||||
return false;
|
||||
}
|
||||
|
||||
$workorder = $preorder->createRimoWorkorder();
|
||||
if(!$workorder) {
|
||||
$this->log->debug(__METHOD__.": error creating workorder");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1369,7 +1393,8 @@ class PreorderController extends mfBaseController {
|
||||
}
|
||||
|
||||
private function deleteWorkorderApi() {
|
||||
if(!$this->me->is("Admin")) {
|
||||
if(!$this->me->is("Admin") && !$this->me->can("preorder")) {
|
||||
$this->log->debug(__METHOD__.": no permission");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -257,8 +257,10 @@ class PreordercampaignController extends mfBaseController {
|
||||
|
||||
if($r->oaid_origin == "ofaa") {
|
||||
$data['oaid_origin'] = "ofaa";
|
||||
} else {
|
||||
} elseif($r->oaid_origin == "thetool") {
|
||||
$data['oaid_origin'] = "thetool";
|
||||
} else {
|
||||
$data['oaid_origin'] = "other";
|
||||
}
|
||||
|
||||
if($r->product_type == "setup_only") {
|
||||
@@ -776,7 +778,7 @@ class PreordercampaignController extends mfBaseController {
|
||||
|
||||
protected function assignOpenAccessIdsToPreordersAction() {
|
||||
$this->layout()->setTemplate("Preordercampaign/Admin");
|
||||
|
||||
|
||||
$id = $this->request->id;
|
||||
if(!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||
@@ -788,6 +790,11 @@ class PreordercampaignController extends mfBaseController {
|
||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||
$this->redirect("Preordercampaign");
|
||||
}
|
||||
|
||||
if($campaign->oaid_origin == "other") {
|
||||
$this->layout()->setFlash("Kampagne unterstützt keine OAIDs", "warning");
|
||||
$this->redirect("Preordercampaign", "Admin", ["id" => $id]);
|
||||
}
|
||||
|
||||
$assigned_oaids = 0;
|
||||
$multiple_unit = 0;
|
||||
@@ -865,6 +872,11 @@ class PreordercampaignController extends mfBaseController {
|
||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||
$this->redirect("Preordercampaign");
|
||||
}
|
||||
|
||||
if($campaign->oaid_origin == "other") {
|
||||
$this->layout()->setFlash("Kampagne unterstützt keine OAIDs, somit können keine Workorders erstellt werden", "warning");
|
||||
$this->redirect("Preordercampaign", "Admin", ["id" => $id]);
|
||||
}
|
||||
|
||||
$missing_units = [];
|
||||
$missing_extrefs = [];
|
||||
@@ -992,6 +1004,11 @@ class PreordercampaignController extends mfBaseController {
|
||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||
$this->redirect("Preordercampaign");
|
||||
}
|
||||
|
||||
if($campaign->oaid_origin == "other") {
|
||||
$this->layout()->setFlash("Kampagne unterstützt keine OAIDs", "warning");
|
||||
$this->redirect("Preordercampaign", "Admin", ["id" => $id]);
|
||||
}
|
||||
|
||||
$oaid_assigned = 0;
|
||||
$missing_units = 0;
|
||||
@@ -1058,6 +1075,11 @@ class PreordercampaignController extends mfBaseController {
|
||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||
$this->redirect("Preordercampaign");
|
||||
}
|
||||
|
||||
if($campaign->oaid_origin == "other") {
|
||||
$this->layout()->setFlash("Kampagne unterstützt keine OAIDs", "warning");
|
||||
$this->redirect("Preordercampaign", "Admin", ["id" => $id]);
|
||||
}
|
||||
|
||||
$oaid_updated = 0;
|
||||
|
||||
|
||||
@@ -183,7 +183,6 @@ class Termination extends mfBaseModel {
|
||||
}
|
||||
|
||||
$bcode = $this->getProperty("building")->code;
|
||||
var_dump($bcode);
|
||||
if(!$bcode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ class WarehouseArticleController extends TTCrud {
|
||||
['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center', 'priority' => 8]]
|
||||
];
|
||||
|
||||
protected array $autocompleteColumns = ['articleNumber', 'title', 'description', 'category'];
|
||||
|
||||
protected array $additionalActions = [
|
||||
['key' => 'openHistory','title' => 'Historie','class' => 'fas fa-history text-secondary'],
|
||||
['key' => 'editDistributorEntries','title' => 'Lieferanten','class' => 'fas fa-truck text-cyan'],
|
||||
|
||||
@@ -336,6 +336,7 @@ class WarehouseEShopOrderController extends TTCrud {
|
||||
$id = WarehouseEShopOrderModel::create(['status' => 'new',
|
||||
'extRef' => $json['extRef'],
|
||||
'deliveryMode' => $json['deliveryMode'],
|
||||
'deliveryAddressAdditional' => $json['deliveryAddressAdditional'],
|
||||
'deliveryAddressName' => $json['deliveryAddressName'],
|
||||
'deliveryAddressLine' => $json['deliveryAddressLine'],
|
||||
'deliveryAddressPLZ' => $json['deliveryAddressPLZ'],
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class WarehouseOffer extends mfBaseModel
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
class WarehouseOfferController extends TTCrud {
|
||||
protected string $headerTitle = 'Angebote';
|
||||
protected bool $createText = false;
|
||||
|
||||
protected array $columns = [
|
||||
['key' => 'id', 'text' => 'ID', 'modal' => false],
|
||||
['key' => 'offerNumber', 'text' => 'Angebotsnummer', 'required' => true, 'modal' => false],
|
||||
['key' => 'customerNumber', 'text' => 'Kundennummer', 'required' => true, 'modal' => false],
|
||||
['key' => 'customerName', 'text' => 'Kundenname', 'required' => true, 'modal' => false],
|
||||
['key' => 'customerCity', 'text' => 'Stadt', 'required' => true, 'modal' => false],
|
||||
['key' => 'customerVAT', 'text' => 'UID', 'required' => true, 'modal' => false],
|
||||
['key' => 'editor', 'text' => 'Sachbearbeiter', 'required' => true, 'modal' => false],
|
||||
['key' => 'totalAmount', 'text' => 'Gesamtbetrag', 'required' => true, 'modal' => false],
|
||||
['key' => 'status', 'text' => 'Status', 'required' => true, 'modal' => ['type' => 'select']],
|
||||
['key' => 'create', 'text' => 'Erstellt', 'required' => true, 'modal' => false],
|
||||
['key' => 'createBy', 'text' => 'Erstellt von', 'required' => true, 'modal' => ['type' => 'select']],
|
||||
['key' => 'actions',
|
||||
'text' => 'Aktionen',
|
||||
'required' => false,
|
||||
'modal' => false,
|
||||
'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
|
||||
];
|
||||
|
||||
protected array $permissionCheck = ['WarehouseAdmin'];
|
||||
|
||||
protected array $additionalActions = [
|
||||
['key' => 'openHistory', 'title' => 'Historie', 'class' => 'fas fa-history text-primary'],
|
||||
['key' => 'sendOffer', 'title' => 'Angebot senden', 'class' => 'fas fa-paper-plane text-success']
|
||||
];
|
||||
|
||||
protected array $infoMessages = [
|
||||
'create' => 'Angebot wurde erfolgreich erstellt.',
|
||||
'update' => 'Angebot wurde aktualisiert.',
|
||||
'delete' => 'Angebot wurde gelöscht',
|
||||
'noChanges' => 'Keine Änderungen',
|
||||
'sent' => 'Angebot wurde erfolgreich gesendet',
|
||||
];
|
||||
|
||||
protected function beforeCreate(): bool {
|
||||
$currentCount = WarehouseOfferModel::count(['create' => ['from' => strtotime(date('Y-01-01'))]]);
|
||||
$this->postData['offerNumber'] = 'AN' . date('Y') . '-' . str_pad($currentCount + 1, 4, '0', STR_PAD_LEFT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function beforeUpdate($postData): bool {
|
||||
(new WarehouseHistoryController)->create($postData, $this->mod);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getHistoryAction() {
|
||||
self::returnJson((new WarehouseHistoryController)->getHistory($this->request->id, $this->mod, $this->columns));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class WarehouseOfferModel
|
||||
*
|
||||
* Represents a warehouse offer with customer details and related metadata.
|
||||
*
|
||||
* @property int $id Unique identifier for the warehouse offer
|
||||
* @property string $offerNumber Unique offer number
|
||||
* @property string $customerNumber Customer number
|
||||
* @property string $customerName Name of the customer
|
||||
* @property string $customerStreet Street address of the customer
|
||||
* @property string $customerCity City of the customer
|
||||
* @property string $customerZip Postal code of the customer
|
||||
* @property string $customerVAT VAT number of the customer
|
||||
* @property int $editor ID of the editor who last modified the offer
|
||||
* @property string $purpose Purpose of the offer
|
||||
* @property string $positions Details about positions in the offer
|
||||
* @property string $alternativePositions Details about alternative positions in the offer
|
||||
* @property float $totalDiscount Total discount applied to the offer
|
||||
* @property string $paymentTerms Payment terms for the offer
|
||||
* @property string $deliveryTerms Delivery terms for the offer
|
||||
* @property string $closingText Closing text for the offer
|
||||
* @property string $notes Additional notes for the offer
|
||||
* @property string $status Current status of the offer
|
||||
* @property float $totalAmount Total amount of the offer
|
||||
* @property int $create Timestamp of the offer creation
|
||||
* @property int $createBy ID of the user who created the offer
|
||||
*/
|
||||
class WarehouseOfferModel extends TTCrudBaseModel {
|
||||
public int $id;
|
||||
public string $offerNumber;
|
||||
public string $customerNumber;
|
||||
public string $customerName;
|
||||
public string $customerStreet;
|
||||
public string $customerCity;
|
||||
public string $customerZip;
|
||||
public string $customerVAT;
|
||||
public int $editor;
|
||||
public string $purpose;
|
||||
public string $positions;
|
||||
public string $alternativePositions;
|
||||
public float $totalDiscount;
|
||||
public string $paymentTerms;
|
||||
public string $deliveryTerms;
|
||||
public string $closingText;
|
||||
public string $notes;
|
||||
public string $status;
|
||||
public float $totalAmount;
|
||||
public int $create;
|
||||
public int $createBy;
|
||||
}
|
||||
@@ -1,77 +1,159 @@
|
||||
<?php
|
||||
//TODO: enable switching distributors in the order preview
|
||||
|
||||
class WarehouseOrderController extends TTCrud {
|
||||
protected string $headerTitle = 'Lieferantenbestellungen';
|
||||
protected bool $createText = false;
|
||||
|
||||
protected array $columns = [
|
||||
['key' => 'id', 'text' => 'ID', 'modal' => false],
|
||||
['key' => 'orderNumber', 'text' => 'Bestellnummer', 'required' => true, 'modal' => false],
|
||||
['key' => 'delAddrCity', 'text' => 'Stadt', 'required' => true, 'modal' => false],
|
||||
['key' => 'delAddrEMail', 'text' => 'E-Mail', 'required' => true, 'modal' => false],
|
||||
['key' => 'delAddrLine', 'text' => 'Adresse', 'required' => true, 'modal' => false],
|
||||
['key' => 'delAddrName', 'text' => 'Name', 'required' => true, 'modal' => false],
|
||||
['key' => 'delAddrPLZ', 'text' => 'PLZ', 'required' => true, 'modal' => false],
|
||||
['key' => 'editor', 'text' => 'Bearbeiter', 'required' => true, 'modal' => false],
|
||||
['key' => 'note', 'text' => 'Notiz', 'required' => true, 'modal' => false],
|
||||
['key' => 'positions', 'text' => 'Positionen', 'required' => true, 'modal' => false],
|
||||
['key' => 'create', 'text' => 'Erstellt', 'required' => true, 'modal' => false],
|
||||
['key' => 'createBy', 'text' => 'Erstellt von', 'required' => true, 'modal' => ['type' => 'select']],
|
||||
['key' => 'actions',
|
||||
'text' => 'Aktionen',
|
||||
'required' => false,
|
||||
'modal' => false,
|
||||
'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
|
||||
];
|
||||
|
||||
protected array $permissionCheck = ['WarehouseAdmin'];
|
||||
|
||||
protected array $additionalActions = [['key' => 'openHistory', 'title' => 'Historie', 'class' => 'fas fa-history text-primary']];
|
||||
//@formatter:off
|
||||
protected array $columns = [
|
||||
['key' => 'id', 'text' => 'ID', 'modal' => false, 'table' => false],
|
||||
['key' => 'orderNumber', 'text' => 'Bestellnummer', 'required' => true, 'modal' => false],
|
||||
['key' => 'distributor', 'text' => 'Lieferant', 'required' => false, 'modal' => false, 'table' => ['filter' => false]],
|
||||
['key' => 'delAddrCity', 'text' => 'Stadt', 'required' => true, 'modal' => false, 'table' => false],
|
||||
['key' => 'delAddrEMail', 'text' => 'E-Mail', 'required' => true, 'modal' => false, 'table' => false],
|
||||
['key' => 'delAddrLine', 'text' => 'Adresse', 'required' => true, 'modal' => false, 'table' => false],
|
||||
['key' => 'delAddrName', 'text' => 'Name', 'required' => true, 'modal' => false, 'table' => false],
|
||||
['key' => 'delAddrPLZ', 'text' => 'PLZ', 'required' => true, 'modal' => false, 'table' => false],
|
||||
['key' => 'editor', 'text' => 'Bearbeiter', 'required' => true, 'modal' => ['type' => 'select'], 'table' => ['filter' => 'select']],
|
||||
['key' => 'note', 'text' => 'Notiz', 'required' => true, 'modal' => false, 'table' => false],
|
||||
['key' => 'sum', 'text' => 'Summe', 'required' => false, 'modal' => false, 'table' => ['class' => 'text-right']],
|
||||
['key' => 'status', 'text' => 'Status', 'required' => false, 'modal' => ['type' => 'select', 'items' => []], 'table' => ['filter' => 'select']],
|
||||
['key' => 'positions', 'text' => 'Positionen', 'required' => true, 'modal' => false, 'table' => false],
|
||||
['key' => 'extReference', 'text' => 'Externe Referenz', 'required' => true, 'modal' => false],
|
||||
['key' => 'createBy', 'text' => 'Erstellt von', 'required' => true, 'modal' => ['type' => 'select'], 'table' => ['filter' => 'select']],
|
||||
['key' => 'create', 'text' => 'Erstellt', 'required' => true, 'modal' => false],
|
||||
['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
|
||||
];
|
||||
//@formatter:on
|
||||
|
||||
protected array $infoMessages = ['create' => 'Bestellung wurde erfolgreich erstellt.',
|
||||
'update' => 'Bestellung wurde aktualisiert.',
|
||||
'delete' => 'Bestellung wurde gelöscht',
|
||||
'noChanges' => 'Keine Änderungen',];
|
||||
|
||||
protected function prepareCrudConfig(): void {
|
||||
$editorColumnIndex = array_search('editor', array_column($this->columns, 'key'));
|
||||
$this->columns[$editorColumnIndex]['modal']['items'] = array_map(function ($user) {
|
||||
return ['value' => intval($user->id), 'text' => $user->name];
|
||||
}, UserModel::search(['employee' => true]));
|
||||
|
||||
$statusIndex = array_search('status', array_column($this->columns, 'key'));
|
||||
$this->columns[$statusIndex]['modal']['items'] = [
|
||||
['value' => 'new', 'text' => 'Neu'],
|
||||
['value' => 'accepted', 'text' => 'Akzeptiert'],
|
||||
['value' => 'ordered', 'text' => 'Bestellt'],
|
||||
['value' => 'sent', 'text' => 'Versendet'],
|
||||
['value' => 'partiallyDelivered', 'text' => 'Teilweise geliefert'],
|
||||
['value' => 'fullyDelivered', 'text' => 'Geliefert'],
|
||||
['value' => 'cancelled', 'text' => 'Storniert'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function beforeCreate(): bool {
|
||||
$currentCount = WarehouseOrderModel::count(['create' => ['from' => strtotime(date('Y-01-01'))]]);
|
||||
$this->postData['orderNumber'] = 'PO' . date('Y') . '-' . str_pad($currentCount + 1, 4, '0', STR_PAD_LEFT);
|
||||
$this->postData['orderNumber'] = 'PO' . date('Y') . '-' . str_pad(WarehouseOrderModel::count(['create' => ['from' => strtotime(date('Y-01-01'))]]) + 1, 4, '0', STR_PAD_LEFT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getArticleDistributorDataAction() {
|
||||
$data = [];
|
||||
$article = $this->request->articleId;
|
||||
$articleId = $this->request->articleId;
|
||||
if ($this->request->allDistributor === 'true') self::returnJson(array_map(fn($d) => ['id' => $d->id,
|
||||
'name' => $d->name], WarehouseDistributorModel::getAll()));
|
||||
else if (!empty($articleId)) self::returnJson(array_map(fn($d) => ['id' => $d->distributorId,
|
||||
'name' => WarehouseDistributorModel::get($d->distributorId)->name,
|
||||
'purchasePrice' => $d->purchasePrice,
|
||||
'externalArticleNumber' => $d->externalArticleNumber], WarehouseArticleDistributorModel::getAll(['articleId' => $articleId])));
|
||||
else self::returnJson([]);
|
||||
}
|
||||
|
||||
if ($this->request->allDistributor === 'true') {
|
||||
foreach (WarehouseDistributorModel::getAll() as $distributor) {
|
||||
$data[] = [
|
||||
'id' => $distributor->id,
|
||||
'name' => $distributor->name,
|
||||
];
|
||||
}
|
||||
} elseif (!empty($article)) {
|
||||
foreach (WarehouseArticleDistributorModel::getAll(['articleId' => $this->request->articleId]) as $distributor) {
|
||||
$data[] = [
|
||||
'id' => $distributor->distributorId,
|
||||
'name' => WarehouseDistributorModel::get($distributor->distributorId)->name,
|
||||
'purchasePrice' => $distributor->purchasePrice,
|
||||
'externalArticleNumber' => $distributor->externalArticleNumber,
|
||||
];
|
||||
}
|
||||
protected function getByIdParse(array $order): array {
|
||||
$order['positions'] = json_decode($order['positions'], true);
|
||||
|
||||
foreach ($order['positions'] as &$position) {
|
||||
$position['distributorName'] = WarehouseDistributorModel::get($position['distributorId'])->name;
|
||||
$position['articleName'] = WarehouseArticleModel::get($position['article'])->title;
|
||||
}
|
||||
|
||||
self::returnJson($data);
|
||||
return $order;
|
||||
}
|
||||
|
||||
protected function beforeUpdate($postData): bool {
|
||||
(new WarehouseHistoryController)->create($postData, $this->mod);
|
||||
return true;
|
||||
protected function createPDFAction() {
|
||||
$order = (array) WarehouseOrderModel::get($this->request->id);
|
||||
$order['positions'] = json_decode($order['positions'], true);
|
||||
// check if all positions have the same distributor
|
||||
$distributorId = $order['positions'][0]['distributorId'];
|
||||
foreach ($order['positions'] as $key => $position) {
|
||||
if ($position['distributorId'] !== $distributorId) {
|
||||
self::returnJson(['error' => 'Die Bestellung enthält Positionen von verschiedenen Lieferanten.']);
|
||||
}
|
||||
|
||||
// we need to get the article name and distributor name for the pdf
|
||||
$position['distributorName'] = WarehouseDistributorModel::get($position['distributorId'])->name;
|
||||
$position['articleName'] = WarehouseArticleModel::get($position['article'])->title;
|
||||
|
||||
$order['positions'][$key] = $position;
|
||||
}
|
||||
|
||||
$pdf_vars = ['order' => $order,
|
||||
'distributor' => WarehouseDistributorModel::get($distributorId),
|
||||
"bank_iban" => TT_INVOICE_BANK_IBAN,
|
||||
"bank_bic" => TT_INVOICE_BANK_BIC,
|
||||
"bank_bank" => TT_INVOICE_BANK_BANK,
|
||||
"bank_owner" => TT_INVOICE_BANK_OWNER];
|
||||
|
||||
|
||||
$countryText = CountryModel::search(['id' => WarehouseDistributorModel::get($distributorId)->countryId])[0]->name;
|
||||
|
||||
$headerHtml = file_get_contents(BASEDIR . "/Layout/default/WarehouseOrder/PDF_HEADER.html");
|
||||
$headerHtml = str_replace("{{ basedir }}", BASEDIR, $headerHtml);
|
||||
$headerHtml = str_replace("{{ externalReference }}","<strong>Ihre Referenz:</strong> ". $order['extReference'], $headerHtml);
|
||||
|
||||
$headerHtml = str_replace("{{ addressLine_1 }}", WarehouseDistributorModel::get($distributorId)->name, $headerHtml);
|
||||
$headerHtml = str_replace("{{ addressLine_2 }}", WarehouseDistributorModel::get($distributorId)->address, $headerHtml);
|
||||
$headerHtml = str_replace("{{ addressLine_3 }}", WarehouseDistributorModel::get($distributorId)->plz . " " . WarehouseDistributorModel::get($distributorId)->city, $headerHtml);
|
||||
$headerHtml = str_replace("{{ addressLine_4 }}", $countryText, $headerHtml);
|
||||
|
||||
$headerHtml = str_replace("{{ billingAddressLine_1 }}", "Xinon GmbH", $headerHtml);
|
||||
$headerHtml = str_replace("{{ billingAddressLine_2 }}", "Fladnitz im Raabtal 150", $headerHtml);
|
||||
$headerHtml = str_replace("{{ billingAddressLine_3 }}", "8322 Studenzen", $headerHtml);
|
||||
$headerHtml = str_replace("{{ billingAddressLine_4 }}", "Österreich", $headerHtml);
|
||||
$headerHtml = str_replace("{{ billingAddressLine_5 }}", "einkauf@xinon.at", $headerHtml);
|
||||
$headerHtml = str_replace("{{ billingAddressLine_6 }}", "<strong>Referenz: ". $order["orderNumber"] . "</strong>", $headerHtml);
|
||||
|
||||
// if order dellAddrLine is Fladnitz im Raabtal 150 we need to set all template strings to empty
|
||||
|
||||
$chk = $order['delAddrLine'] == "Fladnitz im Raabtal 150";
|
||||
|
||||
$headerHtml = str_replace("{{ shippingAddressLine_1 }}", $chk ? "" : $order['delAddrName'], $headerHtml);
|
||||
$headerHtml = str_replace("{{ shippingAddressLine_2 }}", $chk ? "" : $order['delAddrLine'], $headerHtml);
|
||||
$headerHtml = str_replace("{{ shippingAddressLine_3 }}", $chk ? "" : $order['delAddrPLZ'] . " " . $order['delAddrCity'], $headerHtml);
|
||||
$headerHtml = str_replace("{{ shippingAddressLine_4 }}", $chk ? "" : $order['delAddrEMail'], $headerHtml);
|
||||
|
||||
|
||||
$headerFile = BASEDIR . "/var/temp/order_header-" . date("U") . "-" . rand(1000, 9999) . ".html";
|
||||
file_put_contents($headerFile, $headerHtml);
|
||||
|
||||
$footerHtml = file_get_contents(BASEDIR . "/Layout/default/WarehouseOrder/PDF_FOOTER.html");
|
||||
$footerHtml = str_replace("{{ bank_iban }}", TT_INVOICE_BANK_IBAN_FORMATTED, $footerHtml);
|
||||
$footerHtml = str_replace("{{ bank_bic }}", TT_INVOICE_BANK_BIC, $footerHtml);
|
||||
$footerHtml = str_replace("{{ bank_bank }}", TT_INVOICE_BANK_BANK, $footerHtml);
|
||||
$footerHtml = str_replace("{{ bank_owner }}", TT_INVOICE_BANK_OWNER, $footerHtml);
|
||||
|
||||
$footerFile = BASEDIR . "/var/temp/order_footer-" . date("U") . "-" . rand(1000, 9999) . ".html";
|
||||
file_put_contents($footerFile, $footerHtml);
|
||||
|
||||
|
||||
$pdf = new PdfForm("WarehouseOrder/PDF_MAIN", $pdf_vars);
|
||||
$wkhtmltopdfArgs = "--header-html $headerFile --footer-html $footerFile";
|
||||
$filename = $pdf->render($wkhtmltopdfArgs);
|
||||
|
||||
// return the pdf and die so the client sees the pdf not the filename
|
||||
header('Content-Type: application/pdf');
|
||||
header('Content-Disposition: inline; filename="' . $filename . '"');
|
||||
readfile($filename);
|
||||
|
||||
}
|
||||
|
||||
protected function getHistoryAction() {
|
||||
self::returnJson((new WarehouseHistoryController)->getHistory($this->request->id, $this->mod, $this->columns));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
//TODO: migration for extReference
|
||||
/**
|
||||
* Class WarehouseOrderModel
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
*
|
||||
* @property int $id Unique identifier for the warehouse order
|
||||
* @property string $orderNumber Unique order number
|
||||
* @property string $extReference External reference number
|
||||
* @property int $distributorId ID of the distributor associated with the order
|
||||
* @property string $delAddrCity City of the delivery address
|
||||
* @property string $delAddrEMail Email associated with the delivery address
|
||||
@@ -22,6 +23,7 @@
|
||||
class WarehouseOrderModel extends TTCrudBaseModel {
|
||||
public int $id;
|
||||
public string $orderNumber;
|
||||
public string $extReference;
|
||||
public int $distributorId;
|
||||
public string $delAddrCity;
|
||||
public string $delAddrEMail;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
class WarehouseProject extends mfBaseModel {
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class WarehouseProjectController extends TTCrud {
|
||||
protected string $headerTitle = 'Projekte';
|
||||
protected string $createText = 'Neues Projekt erstellen';
|
||||
|
||||
//@formatter:off
|
||||
protected array $columns = [
|
||||
['key' => 'title', 'text' => 'Titel', 'required' => true, 'table' => ['class' => 'text-nowrap', 'priority' => 9]],
|
||||
['key' => 'description', 'text' => 'Beschreibung', 'required' => true, 'table' => ['class' => 'text-nowrap']],
|
||||
['key' => 'createBy', 'text' => 'Erstellt von', 'required' => true, 'type' => 'select', 'table' => ['class' => 'text-nowrap', 'filter' => 'select'], 'modal' => ['items' => [], 'type' => 'select']],
|
||||
['key' => 'create', 'text' => 'Erstellt am', 'required' => true, 'table' => ['filter' => 'date', 'class' => 'text-center']],
|
||||
['key' => 'address', 'text' => 'Adresse', 'required' => true, 'type' => 'autocomplete', 'table' => ['class' => 'text-nowrap', 'filter' => false], 'modal' => ['apiUrl' => '/Address/api?do=findAddress', 'items' => '/Address/api?do=findAddress', 'type' => 'autocomplete']],
|
||||
['key' => 'status', 'text' => 'Status', 'required' => true, 'table' => ['filter' => 'select'], 'modal' => [ 'type' => 'select', 'items' => [ ['value' => 'erstellt', 'text' => 'Erstellt'], ['value' => 'in_bearbeitung', 'text' => 'In Bearbeitung'], ['value' => 'erledigt', 'text' => 'Erledigt'], ['value' => 'verrechnet', 'text' => 'Verrechnet']]]]
|
||||
];
|
||||
|
||||
|
||||
protected array $additionalActions = [
|
||||
];
|
||||
|
||||
protected array $infoMessages = [
|
||||
'create' => 'Projekt wurde erstellt',
|
||||
'update' => 'Projekt wurde aktualisiert',
|
||||
'delete' => 'Projekt wurde gelöscht',
|
||||
'noChanges' => 'Keine Änderungen',
|
||||
];
|
||||
//@formatter:on
|
||||
|
||||
public function prepareCrudConfig() {
|
||||
$users = array_map(function($user) {
|
||||
return ['value' => $user->id, 'text' => $user->name];
|
||||
}, UserModel::search(['employee' => true]));
|
||||
|
||||
$this->columns[1]['modal']['items'] = $users;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class WarehouseProjectModel extends TTCrudBaseModel {
|
||||
public int $id;
|
||||
public string $title;
|
||||
public string $description;
|
||||
public string $startDate;
|
||||
public string $endDate;
|
||||
public string $status;
|
||||
public string $priority;
|
||||
|
||||
public int $assignedTo;
|
||||
public int $createBy;
|
||||
public int $create;
|
||||
}
|
||||
@@ -22,24 +22,12 @@ class Workflowitem extends mfBaseModel {
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
|
||||
if($name == "value") {
|
||||
if(!$this->object_id) {
|
||||
$this->log->warn(__CLASS__."::getProperty('value'): Object ID not set");
|
||||
$this->log->debug("[Backtrace] ================");
|
||||
$this->log->debug("[Backtrace] START Backtrace");
|
||||
$bt = debug_backtrace();
|
||||
foreach($bt as $n => $b) {
|
||||
$this->log->debug($n.") ".$b["file"]."(".$b['line']."): ".$b['class']."->".$b['function']."()" );
|
||||
}
|
||||
$this->log->debug("[Backtrace] $sql");
|
||||
$this->log->debug("[Backtrace] END Backtrace");
|
||||
return null;
|
||||
}
|
||||
$value = mfValuecache::singleton()->get("wfItemvalue-item-".$this->id."-object-".$this->object_id);
|
||||
if($this->id == 55 && $this->object_id == 509) {
|
||||
var_dump($value);exit;
|
||||
}
|
||||
if($value) {
|
||||
$this->value = $value;
|
||||
return $value;
|
||||
|
||||
Reference in New Issue
Block a user