Commit b711d444 authored by Leif Andersson's avatar Leif Andersson
Browse files

Ändringar för att passa version 2.1.3

parent 97fdb08a
......@@ -29,7 +29,7 @@ $canChangeRecord = $this->CheckPermission('Use ReglerAddress');
* After this, the code is identical to the code that would otherwise be
* wrapped in the DisplayAdminPanel() method in the module body.
*/
$groups = Groups::getGroupList();
//echo '<pre>'; print_r($groups); echo '</pre>'; exit;
......@@ -104,6 +104,7 @@ foreach ($params as $key => $value) {
}
$Persons = array();
if (count($formValues) > 0) $Persons = Person::searchPersons($formValues);
//echo '<pre>'; print_r($formValues); echo '</pre>';
foreach ($Persons as $person) {
$params = array('ID' => $person->ID) + $hiddenParameters;
$person->link = $this->CreateLink($id, 'add_edit', '', 'Visa', $params);
......
......@@ -6,9 +6,7 @@ class AddressDB {
private static $database = 'NyAdresser';
private function __construct() {
global $gCms;
if (!isset($gCms)) exit;
$config =& $gCms->GetConfig();
$config = cms_utils::get_config();
$this->PDB = ADONewConnection($config['dbms'],
'pear:date:extend:transaction');
$result = $this->PDB->Connect($config['db_hostname'],
......
......@@ -45,8 +45,7 @@ EOS;
private static $list = array();
public function __construct($param = NULL) {
global $gCms; if (!isset($gCms)) exit;
if (!isset(self::$groupFields)) {
if (!isset(self::$groupFields)) {
self::$groupFields = AddressDB::getFields('Grupper');
}
foreach (self::$groupFields as $field) {$this->$field = '';}
......@@ -88,7 +87,6 @@ EOS;
}
public function updateRecord() {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
if ($this->ID == '') { $this->createRecord(); }
......@@ -109,7 +107,6 @@ EOS;
public static function getGroupList() {
if (count(self::$list) > 0) return self::$list;
global $gCms; if (!isset($gCms)) exit;
$c = __CLASS__;
$db = AddressDB::getDB();
$result = $db->Execute(self::$queryList,array());
......@@ -120,17 +117,7 @@ EOS;
return self::$list;
}
/* global $gCms; */
/* if (!isset($gCms)) exit; */
/* $ADB = AddressDB::getDB(); */
/* $result = $ADB->Execute(self::$queryList,array()); */
/* while ($row = $result->FetchRow()) { */
/* $this->list[$row['Gruppnamn']] = $row['ID']; */
/* } */
/* } */
public static function getMembers($GruppID) {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
$result = $db->Execute(self::$queryMembership,array($GruppID));
if ($result === false) { die("Database error!<br>" . $db->ErrorMsg()); }
......@@ -153,7 +140,6 @@ EOS;
}
public static function setMember($ID,$GroupID) {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
$values = array($ID, $GroupID);
$result = $db->Execute(self::$querySetGroup,$values);
......@@ -161,7 +147,6 @@ EOS;
}
public static function unsetMember($ID,$GroupID) {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
$values = array($ID, $GroupID);
// echo '<pre>'; print_r($queryUnsetGroup); print_r($values); echo '</pre>';exit;
......@@ -171,8 +156,7 @@ EOS;
}
public static function setMailLists() {
global $gCms; if (!isset($gCms)) exit;
$config =& $gCms->GetConfig();
$config = cms_utils::get_config();
$maildir = $config['root_path'] . '/uploads/mailinglists';
$db = AddressDB::getDB();
$groups = self::getGroupList();
......@@ -200,7 +184,6 @@ EOS;
// exit;
}
public static function removeAddress($AdressID = null) {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
if (is_null($AdressID))
die('Strange error in removeAddress. No ID.'.PHP_EOL);
......
......@@ -33,7 +33,6 @@ EOS;
private static $personFields;
public function __construct($param = NULL) {
global $gCms; if (!isset($gCms)) exit;
if (!isset(self::$personFields)) {
self::$personFields = AddressDB::getFields('Adresser');
}
......@@ -55,7 +54,6 @@ EOS;
}
private function fromDB($adressID) {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
$values = array($adressID);
$result = $db->Execute(self::$queryOne,$values);
......@@ -81,7 +79,6 @@ EOS;
}
private function getGroups($adressID) {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
$values = array($adressID);
$result = $db->Execute(self::$queryGroups,$values);
......@@ -103,7 +100,6 @@ EOS;
public function updateRecord() {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
$query = 'update Adresser set ';
$qfields = array(); $values = array();
......@@ -127,7 +123,6 @@ EOS;
}
public static function searchPersons($formValues) {
global $gCms; if (!isset($gCms)) exit;
$andQuery = array(); $orQuery = '';
$andValues = array(); $orValues = array();
foreach ($formValues as $key => $value) {
......@@ -166,13 +161,16 @@ EOS;
$class = __CLASS__;
$records = array();
$result = $db->Execute($query,$values);
if (!$result) { die("Database error!<br>" . $db->ErrorMsg()); }
while ($row = $result->FetchRow()) {
$person = new $class();
//echo '<pre>'; print_r($person); echo '</pre>';
foreach ($row as $key => $value) {
$person->$key = $value;
}
$records[] = $person;
//echo '<pre>'; print_r($records); echo '</pre>';
}
return $records;
}
......@@ -195,7 +193,6 @@ EOS;
}
public static function deleteRecord($ID = null) {
global $gCms; if (!isset($gCms)) exit;
$db = AddressDB::getDB();
if (is_null($ID)) die('Strange error in deleteRecord. No ID.'.PHP_EOL);
$values = array($ID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment