X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=GroupCountries.php;h=fdd8fca9f78d43656c164faae8545e0ba0f5de10;hb=refs%2Fheads%2Fmaster;hp=150a65b40785d7369f49d8868d10a9f39b2bd335;hpb=b0c44a9fc0bdf79ff91d53a8b6d3a616393db312;p=Pman.Core diff --git a/GroupCountries.php b/GroupCountries.php index 150a65b4..fdd8fca9 100644 --- a/GroupCountries.php +++ b/GroupCountries.php @@ -15,7 +15,7 @@ class Pman_Core_GroupCountries extends Pman parent::getAuth(); // load company! $au = $this->getAuthUser(); if (!$au) { - $this->jerr("Not authenticated", array('authFailure' => true)); + $this->jerror("LOGIN-NOAUTH", "Not authenticated", array('authFailure' => true)); } if ($au->company()->comptype != 'OWNER') { $this->jerr("Permission Denied" ); @@ -24,12 +24,12 @@ class Pman_Core_GroupCountries extends Pman return true; } - function get() + function get($v, $opts=array()) { - $this->post(); + $this->post($v); } - function post() + function post($v) { if (!$this->hasPerm( 'Core.Groups','E')) { // editing groups.. $this->jerr("PERMISSION DENIED"); @@ -46,22 +46,24 @@ class Pman_Core_GroupCountries extends Pman function addPersonToCountry($users) { foreach($users as $id){ - $p = DB_DataObject::factory('Person'); + $p = DB_DataObject::factory('core_person'); if(!$p->get($id)){ $this->jerr('This Person is not exsiting'); } $c = explode(',', $p->countries); $c[] = $_REQUEST['country']; - ksort($c); + sort($c); +// print_r($c); $p->countries = implode(',', $c); $p->update(); } + $this->jok(true); } - function supPersonToCountry($users) + function subPersonToCountry($users) { foreach($users as $id){ - $p = DB_DataObject::factory('Person'); + $p = DB_DataObject::factory('core_person'); if(!$p->get($id)){ $this->jerr('This Person is not exsiting'); } @@ -69,12 +71,12 @@ class Pman_Core_GroupCountries extends Pman if(($key = array_search($_REQUEST['country'], $c)) !== false) { unset($c[$key]); } - ksort($c); - print_r($c); -// $p->countries = implode(',', $c); -// $p->update(); + sort($c); +// print_r($c); + $p->countries = implode(',', $c); + $p->update(); } - + $this->jok(true); } }