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" );
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");
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'];
sort($c);
- print_r($c);
-// $p->countries = implode(',', $c);
-// $p->update();
+// print_r($c);
+ $p->countries = implode(',', $c);
+ $p->update();
}
+ $this->jok(true);
}
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');
}
if(($key = array_search($_REQUEST['country'], $c)) !== false) {
unset($c[$key]);
}
- sort($c);
- print_r($c);
-// $p->countries = implode(',', $c);
-// $p->update();
+ sort($c);
+// print_r($c);
+ $p->countries = implode(',', $c);
+ $p->update();
}
-
+ $this->jok(true);
}
}