public function create($pdata)
 {
     $data = array();
     $data['isActive'] = $pdata['isActive'];
     $data['profileUpdated'] = $pdata['profileUpdated'];
     $data['city'] = $pdata['city'];
     $data['currency'] = $pdata['currency'];
     $data['createdTime'] = new \DateTime('now');
     $data['lastLogin'] = new \DateTime('now');
     $data['email'] = $pdata['email'];
     $data['firstName'] = $pdata['firstname'];
     $data['lastName'] = $pdata['lastname'];
     $data['username'] = $pdata['username'];
     $data['password'] = $pdata['password'];
     $data['phone'] = $pdata['phone'];
     $data['gender'] = $pdata['gender'];
     $entityManager = $this->getEntityManager();
     $data['country'] = $entityManager->getRepository('User\\Entity\\Country')->findOneBy(array('id' => $pdata['country']));
     $userExist = $entityManager->getRepository('User\\Entity\\User')->findOneBy(array('email' => $pdata['email']));
     if ($userExist) {
         return new JsonModel(['success' => 'failed', 'msg' => '']);
     } else {
         $user = new User();
         $user->setData($data);
         $user->save($entityManager);
         $user->createFreelancer($this, $data, $entityManager, $pdata['lang_code']);
         $freelancer = $user->getFreelancer();
         $tmp = array('Resources' => $pdata['resources'], 'DesktopCatTools' => $pdata['desktopcattools'], 'DesktopOperatingSystems' => $pdata['desktopoperatingsystems'], 'InterpretingSpecialisms' => $pdata['interpretingspecialisms'], 'TranslationCatTools' => $pdata['translationcattools'], 'TranslationSpecialisms' => $pdata['translationspecialisms']);
         $freelancer->updateData($tmp, $entityManager);
         $freelancer->save($entityManager);
         $ret_data = $user->getData();
         // Set Translation Price
         foreach ($pdata['translationPrices'] as $k => $v) {
             $translationPrice = array('user' => $user, 'sourceLanguage' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['sourceLanguage']['id'])), 'targetLanguage' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['targetLanguage']['id'])), 'price' => $v['price']);
             $pTranslationPrice = new UserTranslationPrice();
             $pTranslationPrice->setData($translationPrice);
             $pTranslationPrice->save($entityManager);
         }
         // Set Desktop Prices
         foreach ($pdata['desktopPrices'] as $k => $v) {
             $desktopPrice = array('user' => $user, 'language' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['language']['id'])), 'software' => $entityManager->getRepository('User\\Entity\\DesktopSoftware')->findOneBy(array('id' => $v['language']['id'])), 'priceMac' => $v['priceMac'], 'pricePc' => $v['pricePc'], 'priceHourMac' => $v['priceHourMac'], 'priceHourPc' => $v['priceHourPc']);
             $pDesktopPrice = new UserDesktopPrice();
             $pDesktopPrice->setData($desktopPrice);
             $pDesktopPrice->save($entityManager);
         }
         // Set Interpreting Price
         foreach ($pdata['interpretingPrices'] as $k => $v) {
             $interpretingPrice = array('user' => $user, 'sourceLanguage' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['sourceLanguage']['id'])), 'targetLanguage' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['targetLanguage']['id'])), 'service' => $entityManager->getRepository('User\\Entity\\InterpretingService')->findOneBy(array('id' => $v['service']['id'])), 'priceDay' => $v['priceDay'], 'priceHalfDay' => $v['priceHalfDay']);
             $pInterpretingPrice = new UserInterpretingPrice();
             $pInterpretingPrice->setData($interpretingPrice);
             $pInterpretingPrice->save($entityManager);
         }
         return new JsonModel(['user' => $ret_data, 'success' => 'success']);
     }
     return new JsonModel(['success' => 'failed', 'msg' => 'Unknown Error']);
 }
Example #2
0
 public function create($data)
 {
     $entityManager = $this->getEntityManager();
     $pdata = array('isActive' => $data['isActive'], 'profileUpdated' => '0', 'city' => $data['city'], 'createdTime' => new \DateTime('now'), 'lastLogin' => new \DateTime('now'), 'email' => $data['email'], 'firstName' => $data['firstName'], 'lastName' => $data['lastName'], 'name' => $data['name'], 'password' => $data['password'], 'phone' => $data['phone'], 'cellphone' => $data['cellphone'], 'gender' => $data['gender'], 'country' => $entityManager->getRepository('User\\Entity\\Country')->findOneBy(array('id' => $data['country'])));
     $userExist = $entityManager->getRepository('User\\Entity\\User')->findOneBy(array('email' => $data['email']));
     if ($userExist) {
     } else {
         $user = new User();
         $user->createStaff($this, $pdata);
         $staff = $user->getStaff();
         $staff->setType($entityManager->getRepository('User\\Entity\\Roles')->findOneBy(array('id' => $data['type'])));
         $staff->setClient($this->getCurrentUser());
         $staff->setName($data['name']);
         $staff->save($entityManager);
         //$staffData = $staff->getData();
         return new JsonModel($user->getData());
     }
     return new JsonModel(['error' => 'User Exist', 'email' => $data['email']]);
 }
Example #3
0
 public function getData()
 {
     return ['id' => $this->id, 'user' => $this->user->getData(), 'paypal' => $this->paypal, 'alipay' => $this->alipay, 'account' => $this->account, 'address' => $this->address, 'city' => $this->city, 'country' => $this->country, 'name' => $this->name, 'accountNo' => $this->accountNo, 'swift' => $this->swift, 'routingNumber' => $this->routingNumber];
 }
Example #4
0
 public function getData()
 {
     return array('id' => $this->id, 'user' => $this->user->getData(), 'repetitions' => $this->repetitions, 'yibai' => $this->yibai, 'jiuwu' => $this->jiuwu, 'bawu' => $this->bawu, 'qiwu' => $this->qiwu, 'wushi' => $this->wushi, 'nomatch' => $this->nomatch);
 }
Example #5
0
 public function getData()
 {
     $client = $this->client ? $this->client->getEmployer() ? $this->client->getEmployer()->getData() : null : null;
     if ($client) {
         $client['types'] = $this->client->getTypes();
     }
     return ['client' => $client, 'user' => $this->client ? $this->client->getData() : null, 'userid' => $this->client->getId(), 'dueDate' => $this->dueDate, 'quote_no' => $this->quote_no, 'project_no' => $this->project_no, 'tax' => $this->tax, 'discount' => $this->discount, 'duration' => $this->duration, 'field' => $this->field ? $this->field->getData() : null, 'id' => $this->id, 'interpretingInfo' => $this->interpretingInfo, 'serviceLevel' => $this->serviceLevel, 'pm' => $this->pm ? $this->pm->getData() : null, 'priority' => $this->priority, 'reference' => $this->reference, 'sale' => $this->sale ? $this->sale->getData() : null, 'sourceLanguage' => $this->sourceLanguage->getData(), 'startDate' => $this->startDate, 'status' => $this->status, 'targetLanguages' => $this->getArrayData($this->targetLanguages), 'po' => $this->po, 'sourcetext' => $this->sourcetext, 'currency' => $this->currency, 'total_tmp' => $this->total_tmp, 'total' => $this->total, 'types' => $this->types, 'transGraph' => $this->transGraph, 'payStatus' => $this->payStatus, 'description' => $this->description];
 }
Example #6
0
 public function getData()
 {
     return ['id' => $this->id, 'activityDate' => $this->activityDate, 'project' => $this->project->getId(), 'task' => $this->task ? $this->task->getData()['id'] : null, 'type' => $this->type, 'sender' => $this->sender ? $this->sender->getData() : null, 'message' => $this->message];
 }
 public function create($pdata)
 {
     error_reporting(E_ALL);
     ini_set('display_errors', 1);
     $data = array();
     $data['isActive'] = $pdata['isActive'];
     $data['profileUpdated'] = $pdata['profileUpdated'];
     $data['city'] = $pdata['city'];
     $data['currency'] = $pdata['currency'];
     $data['createdTime'] = new \DateTime('now');
     $data['lastLogin'] = new \DateTime('now');
     $data['email'] = $pdata['email'];
     $data['firstName'] = $pdata['firstname'];
     $data['lastName'] = $pdata['surname'];
     $data['password'] = $pdata['password'];
     $data['phone'] = $pdata['phone'];
     $data['cellphone'] = $pdata['cellphone'];
     $data['gender'] = $pdata['gender'];
     $data['comments'] = $pdata['comments'];
     $data['position'] = $pdata['position'];
     $data['contracted'] = $pdata['contracted'];
     $data['name'] = $pdata['name'];
     $entityManager = $this->getEntityManager();
     $data['company_id'] = $entityManager->getRepository('User\\Entity\\Company')->findOneBy(array('id' => $pdata['company']));
     $data['country'] = $entityManager->getRepository('User\\Entity\\Country')->findOneBy(array('id' => $pdata['country']));
     $data['pm'] = $entityManager->getRepository('User\\Entity\\Staff')->findOneBy(array('id' => $pdata['pm']['id']));
     $data['sales'] = $entityManager->getRepository('User\\Entity\\Staff')->findOneBy(array('id' => $pdata['sales']['id']));
     $userExist = $entityManager->getRepository('User\\Entity\\User')->findOneBy(array('email' => $pdata['email']));
     if ($userExist) {
         return new JsonModel(['success' => 'failed', 'msg' => '']);
     } else {
         $user = new User();
         $user->setData($data);
         $user->save($entityManager);
         $user->createEmployer($this, $data, $entityManager, $pdata['lang_code']);
         $employer = $user->getEmployer();
         $employer->updateData(array('position' => $pdata['position'], 'company' => $data['company_id'], 'defaultServiceLevel' => $pdata['defaultServiceLevel'], 'comments' => $pdata['comments'], 'contracted' => $pdata['contracted'], 'pm' => $data['pm'], 'name' => $pdata['name'], 'sales' => $data['sales']));
         $employer->save($entityManager);
         $ret_data = $user->getData();
         $projectType = array();
         // Set Translation Price
         foreach ($pdata['translationPrices'] as $k => $v) {
             if (!in_array(1, $projectType)) {
                 $projectType[] = 1;
             }
             $translationPrice = array('user' => $user, 'sourceLanguage' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['sourceLanguage']['id'])), 'targetLanguage' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['targetLanguage']['id'])), 'price' => $v['price']);
             $pTranslationPrice = new UserTranslationPrice();
             $pTranslationPrice->setData($translationPrice);
             $pTranslationPrice->save($entityManager);
         }
         // Set Desktop Prices
         foreach ($pdata['desktopPrices'] as $k => $v) {
             if ($v['priceMac'] != 0 || $v['priceHourMac'] != 0) {
                 if (!in_array(4, $projectType)) {
                     $projectType[] = 4;
                 }
             }
             if ($v['pricePc'] != 0 || $v['priceHourPc'] != 0) {
                 if (!in_array(5, $projectType)) {
                     $projectType[] = 5;
                 }
             }
             $desktopPrice = array('user' => $user, 'language' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['language']['id'])), 'software' => $entityManager->getRepository('User\\Entity\\DesktopSoftware')->findOneBy(array('id' => $v['language']['id'])), 'priceMac' => $v['priceMac'], 'pricePc' => $v['pricePc'], 'priceHourMac' => $v['priceHourMac'], 'priceHourPc' => $v['priceHourPc']);
             $pDesktopPrice = new UserDesktopPrice();
             $pDesktopPrice->setData($desktopPrice);
             $pDesktopPrice->save($entityManager);
         }
         // Set Interpreting Price
         foreach ($pdata['interpretingPrices'] as $k => $v) {
             if (!in_array(7, $projectType)) {
                 $projectType[] = 7;
                 $projectType[] = 8;
                 $projectType[] = 9;
                 $projectType[] = 10;
             }
             $interpretingPrice = array('user' => $user, 'sourceLanguage' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['sourceLanguage']['id'])), 'targetLanguage' => $entityManager->getRepository('User\\Entity\\Language')->findOneBy(array('id' => $v['targetLanguage']['id'])), 'service' => $entityManager->getRepository('User\\Entity\\InterpretingService')->findOneBy(array('id' => $v['service']['id'])), 'priceDay' => $v['priceDay'], 'priceHalfDay' => $v['priceHalfDay']);
             $pInterpretingPrice = new UserInterpretingPrice();
             $pInterpretingPrice->setData($interpretingPrice);
             $pInterpretingPrice->save($entityManager);
         }
         // Set TM Ratio
         if ($pdata['tmRatio'] != null) {
             if (!in_array(2, $projectType)) {
                 $projectType[] = 2;
             }
         }
         $pTmRatio = new UserTmRatio();
         $tmRatio = array('repetitions' => $pdata['tmRatio']['repetitions'], 'yibai' => $pdata['tmRatio']['yibai'], 'jiuwu' => $pdata['tmRatio']['jiuwu'], 'bawu' => $pdata['tmRatio']['bawu'], 'qiwu' => $pdata['tmRatio']['qiwu'], 'wushi' => $pdata['tmRatio']['wushi'], 'nomatch' => $pdata['tmRatio']['nomatch'], 'user' => $user);
         $pTmRatio->setData($tmRatio);
         $pTmRatio->save($entityManager);
         // Set Engineering Price
         foreach ($pdata['engineeringPrices'] as $k => $v) {
             if ($pdata['tmRatio'] != null) {
                 if (!in_array(6, $projectType)) {
                     $projectType[] = 6;
                 }
             }
             $engineeringPrice = array('engineeringcategory' => $entityManager->getRepository('Common\\Entity\\EngineeringCategory')->findOneBy(array('id' => $v['engineeringcategory']['id'])), 'unit' => $entityManager->getRepository('Common\\Entity\\Unit')->findOneBy(array('id' => $v['unit']['id'])), 'price' => $v['price'], 'user' => $user);
             $pEngineeringPrices = new UserEngineeringPrice();
             $pEngineeringPrices->setData($engineeringPrice);
             $pEngineeringPrices->save($entityManager);
         }
         $user->setData(array('types' => $projectType));
         $user->save($entityManager);
         //var_dump($projectType); exit;
         return new JsonModel(['user' => $ret_data, 'success' => 'success']);
     }
 }
Example #8
0
 public function getData()
 {
     return ['id' => $this->id, 'client' => $this->client ? $this->client->getEmployer()->getData() : null, 'freelancer' => $this->freelancer ? $this->freelancer->getData() : null, 'createDate' => $this->createDate, 'payDate' => $this->payDate, 'intrans_no' => $this->intrans_no, 'fapiao_no' => $this->fapiao_no, 'is_deleted' => $this->is_deleted, 'fee' => $this->fee, 'total' => $this->total, 'subtotal' => $this->subtotal, 'bank' => $this->bank->getData(), 'bankuser' => $this->bankuser, 'items' => $this->items ? $this->items : null, 'typeStatus' => $this->typeStatus, 'currency' => $this->currency];
 }