function __construct() { parent::__construct(); $this->customize(); $bps = $this->getMyBPSData(); if (Session::isPluginLoaded("mAdressBuch")) { $CAB = mAdressBuchGUI::getCurrent($this, false, true); if ($CAB == "-2") { $this->addAssocV3("type", "=", "default", "AND", "1"); $AC = anyC::get("AdressBuch"); $AC->addAssocV3("AdressBuchUserID", "=", Session::currentUser()->getID()); $AC->addAssocV3("AdressBuchTyp", "=", "2"); while ($AB = $AC->getNextEntry()) { $this->addAssocV3("type", "=", "AB" . $AB->getID(), "OR", "1"); } } if ($CAB == "0") { $this->addAssocV3("type", "=", "default"); } if ($CAB > 0) { $AB = new AdressBuch($CAB); if ($AB->A("AdressBuchTyp") == "1" or $AB->A("AdressBuchTyp") == "3" or $AB->A("AdressBuchTyp") == "2" and $AB->A("AdressBuchUserID") == Session::currentUser()->getID()) { $this->addAssocV3("type", "=", "AB" . $bps["AdressBuch"]); } } } /*if($bps == -1 OR !isset($bps["AdressBuch"]) OR $bps["AdressBuch"] == 0) $this->addAssocV3("type","=","default"); else { $AB = new AdressBuch($bps["AdressBuch"]); if($AB->A("AdressBuchTyp") == "1" OR $AB->A("AdressBuchTyp") == "3" OR ($AB->A("AdressBuchTyp") == "2" AND $AB->A("AdressBuchUserID") == Session::currentUser()->getID())) $this->addAssocV3("type","=","AB".$bps["AdressBuch"]); }*/ $this->gui = new HTMLGUI(); if ($bps != -1 and isset($bps["selectionMode"]) and (strpos($bps["selectionMode"], "Vertrag") !== false or strpos($bps["selectionMode"], "Bestellung") !== false or strpos($bps["selectionMode"], "CloudKunde") !== false or strpos($bps["selectionMode"], "Einsatzort") !== false)) { $this->gui = new HTMLGUI2(); $this->gui->setDisplaySide("right"); } }
public function getACData($attributeName, $query) { $users = Users::getUsers(); $selection = array(); $query = preg_match("/%/", $query) ? preg_replace("/%/", $query, "") : $query; while ($user = $users->getNextEntry()) { if (preg_match("/.*" . $query . ".*/", $user->A("UserEmail")) || preg_match("/.*" . $query . ".*/", $user->A("name")) || preg_match("/.*" . $query . ".*/", $user->A("username"))) { $subSelection = array("label" => $user->A("name"), "value" => $user->A("UserEmail"), "email" => $user->A("UserEmail"), "description" => ""); $selection[] = $subSelection; } } if (Session::isPluginLoaded("mWAdresse")) { $adresses = new Adressen(); $adresses->setSearchStringV3($query); $adresses->setSearchFieldsV3(array("firma", "nachname", "email")); $adresses->setFieldsV3(array("firma AS label", "AdresseID AS value", "vorname", "nachname", "CONCAT(strasse, ' ', nr, ', ', plz, ' ', ort) AS description", "email", "firma")); $adresses->setLimitV3("10"); $adresses->setParser("label", "AdressenGUI::parserACLabel"); if ($attributeName == "SendMailTo") { $adresses->addAssocV3("email", "!=", ""); } while ($adress = $adresses->getNextEntry()) { $subSelection = array(); foreach ($adress->getA() as $key => $value) { $subSelection[$key] = $value; } $selection[] = $subSelection; } } echo json_encode($selection); }