예제 #1
0
파일: Print.php 프로젝트: knatorski/SMS
 /**
  * Inicjalizacja formularza
  */
 public function baseInit()
 {
     $this->_atModel = $atModel = new AddonType();
     $this->_bModel = $bModel = new Branch();
     $rows = $atModel->fetchAll('not ghost', 'name asc');
     $addons = array();
     foreach ($rows as $row) {
         $addons[Base_Convert::strToHex($row->id)] = $row->name;
     }
     $this->addElement('MultiCheckbox', 'addons', array('label' => 'Uzwględnij następujące dodatki:', 'MultiOptions' => $addons, 'value' => array_keys($addons), 'required' => true));
     $this->addons->getDecorator('row')->setOption('class', 'row widerow');
     $rows = $bModel->fetchAll('not ghost', 'web_name asc');
     $branches = array();
     foreach ($rows as $row) {
         $branches[Base_Convert::strToHex($row->id)] = $row->branch_name;
     }
     $this->addElement('MultiCheckbox', 'branches', array('label' => 'Uwzględnij następujące brandy:', 'MultiOptions' => $branches, 'value' => array_keys($branches), 'required' => true));
     $dic = new Logic_Dictionary();
     $cTypes = array();
     $this->_cDic = $cDic = $dic->getDictionaryEntriesByCode('client_type');
     foreach ($cDic as $ct) {
         $cTypes[Base_Convert::strToHex($ct->id)] = ucfirst($ct->entry);
     }
     $rows = $bModel->fetchAll('not ghost', 'web_name asc');
     $branches = array();
     foreach ($rows as $row) {
         $branches[Base_Convert::strToHex($row->id)] = $row->branch_name;
     }
     $this->addElement('MultiCheckbox', 'clients', array('label' => 'Uwzględnij nastepujących klientów:', 'MultiOptions' => $cTypes, 'value' => array_keys($cTypes), 'required' => true));
     $this->addElement('Select', 'timepoint', array('label' => 'Wyeksportuj wartości:', 'MultiOptions' => array('now' => 'Aktualne', 'archive' => 'Archiwalne'), 'required' => true));
     $this->datee(false, 'date', 'Data:', true, array('value' => date('Y-m-d'), 'required' => true));
     $this->addElement('text', 'time', array('label' => 'Godzina:', 'class' => 'timeentry', 'required' => true, 'value' => date('H:00:00'), 'validators' => array(array('validator' => 'Date', 'options' => array('format' => 'H:i:s')))));
     $this->submit(false, 'submitbtn', 'Eksportuj');
 }
예제 #2
0
파일: Calculate.php 프로젝트: knatorski/SMS
 protected function getBrands()
 {
     $brandModel = new Branch();
     $brandsResult = $brandModel->fetchAll();
     $brands = array();
     foreach ($brandsResult as $brand) {
         $brands[$brand->id] = $brand->branch_name;
     }
     return $brands;
 }
예제 #3
0
 function list_drop()
 {
     $branch = new Branch();
     $branch->get();
     foreach ($branch as $row) {
         $data[''] = '[ Pilih Cabang ]';
         $data[$row->branch_name] = $row->branch_name;
     }
     return $data;
 }
예제 #4
0
파일: Add.php 프로젝트: knatorski/SMS
 public function getBranches()
 {
     $branchModel = new Branch();
     $branches = $branchModel->fetchAll();
     $branchOptions = array();
     foreach ($branches as $branch) {
         $branchOptions[$branch->id] = $branch->web_name;
     }
     return $branchOptions;
 }
예제 #5
0
 public function view()
 {
     if (!isset($this->request->params['slug'])) {
         $this->notice('invalid');
     }
     $branch = $this->Branch->find('first', array('conditions' => array('Branch.slug' => $this->request->params['slug'], 'Branch.active' => 1), 'contain' => array('Address' => array('fields' => array('Address.address'), 'Country' => array('fields' => array('Country.name'))), 'Contact')));
     if (empty($branch)) {
         $this->notice(__('The branch does not exsit'), array('redirect' => true));
     }
     $this->set('title_for_layout', sprintf(__('Contact us at %s'), $branch['Branch']['name']));
     $this->set(compact('branch'));
 }
예제 #6
0
파일: Filter.php 프로젝트: knatorski/SMS
 protected function branch($acl = false, $fieldname = 'id_branch', $label = 'Branch', $required = null)
 {
     $model = new Branch();
     $branches = $model->getAllBranches();
     $options = array();
     foreach ($branches as $branch) {
         $options[$branch->id] = $branch->web_name;
     }
     $method = $acl ? 'addSupervisedElement' : 'addElement';
     $this->{$method}('select', $fieldname, array('label' => $label, 'MultiOptions' => $this->addClearStart($options)));
     $this->notEmpty($fieldname);
 }
예제 #7
0
 public function run()
 {
     DB::table('branchs')->truncate();
     $branch = new Branch();
     $branch->name = "Giày dép";
     $branch->save();
     $branch = new Branch();
     $branch->name = "Áo quần";
     $branch->save();
     $branch = new Branch();
     $branch->name = "Phụ kiện";
     $branch->save();
 }
예제 #8
0
파일: Factory.php 프로젝트: knatorski/SMS
 /** Zwraca nazwę jednostki przez którą użytkownik będzie łączył sie z Def,
  *  jeżeli wybrany DEF nie jest głównym defem usera zwrócona zostanie defaultowa jednostka
  *
  * @param string $BaCode - backend_application_code z tabeli backendApplication
  * @return string - jednostka przez którą user powinien łączyć się z DEF
  */
 public static function getUserBranchName($BaCode)
 {
     $BaCode = strtolower($BaCode);
     $user = Zend_Auth::getInstance()->getIdentity();
     $branchName = null;
     $branch = new Branch();
     if (strtolower($user->jednostka['application_code']) == strtolower($BaCode)) {
         $branchName = $user->jednostka['symbol_def'];
     } else {
         $branchName = $user->default_branches[$BaCode]['symbol_def'];
     }
     $branchName = $branch->findOne($user->id_branch);
     return $branchName->symbol_def;
 }
 public function add($parentId, Branch $branch)
 {
     $this->branches[$branch->getNodeId()] = $branch;
     if (null === $this->root) {
         $this->root = $parentId ? $this->branches[$parentId] = new UnknownNodeBranch($branch) : $branch;
     } else {
         if (false === isset($this->branches[$parentId])) {
             // hidden from nav, don’t return the whole section then:
             return $this;
         }
         $this->branches[$parentId]->add($branch);
     }
     return $this;
 }
예제 #10
0
 /**
  * @param sfWebRequest $request
  * @return void
  */
 public function execute($request)
 {
     $projectId = $request->getParameter('project_id');
     $baseBranchName = $request->getParameter('base_branch');
     $branchName = $request->getParameter('branch');
     $commit = (string) $request->getParameter('commit');
     // Last commit
     $result = array();
     file_put_contents(sprintf("%s/api.log", sfConfig::get('sf_log_dir')), sprintf("%s [%s] set review = projectId : %s - baseBranchName : %s - branchName : %s - commit : %s\n", date('d/m/Y H:i:s'), $_SERVER['REMOTE_ADDR'], $projectId, $baseBranchName, $branchName, $commit), FILE_APPEND);
     $repository = RepositoryQuery::create()->filterById($projectId)->findOne();
     if ($repository) {
         $branch = BranchQuery::create()->filterByRepositoryId($repository->getId())->filterByName($branchName)->findOne();
         if (!$branch) {
             $branch = new Branch();
             $branch->setName($branchName)->setRepositoryId($repository->getId())->setBaseBranchName($baseBranchName)->save();
         }
         if ($branch->getBaseBranchName() != $baseBranchName) {
             $branch->setBaseBranchName($baseBranchName)->save();
         }
         if (($nbFiles = BranchPeer::synchronize($this->gitCommand, $repository, $branch)) != 0) {
             $result['message'] = sprintf("Your branch '%s' has too many files : %s (max : %s)", $branch->__toString(), $nbFiles, sfConfig::get('app_max_number_of_files_to_review', 4096));
             $this->getResponse()->setStatusCode('500');
         } elseif (!$branch->isDeleted()) {
             if (strlen($commit) === 40) {
                 if (!$this->gitCommand->commitIsInHistory($repository->getGitDir(), $branch->getCommitStatusChanged(), $commit)) {
                     $result['message'] = sprintf("Review has been %sengaged [old status : %s]", $branch->getReviewRequest() ? 're' : '', BranchPeer::getLabelStatus($branch->getStatus()));
                     $branch->setReviewRequest(1)->setStatus(BranchPeer::A_TRAITER)->setIsBlacklisted(0)->save();
                     $this->getResponse()->setStatusCode('201');
                     $this->dispatcher->notify(new sfEvent($this, 'notification.review-request', array('project-id' => $branch->getRepositoryId(), 'object' => $branch)));
                 } else {
                     $result['message'] = sprintf("Commit already used : '%s'", $commit);
                     $this->getResponse()->setStatusCode('200');
                 }
             } else {
                 $result['message'] = sprintf("No valid commit '%s'", $commit);
                 $this->getResponse()->setStatusCode('422');
             }
         } else {
             $result['message'] = sprintf("Unknown branch '%s' in project '%s'", $branchName, $repository->getName());
             $this->getResponse()->setStatusCode('404');
         }
     } else {
         $result['message'] = sprintf("No valid project '%s'", $projectId);
         $this->getResponse()->setStatusCode('400');
     }
     $this->getResponse()->setContentType('application/json');
     return $this->renderText(json_encode($result));
 }
예제 #11
0
 public function getTable($customerType, $addonType, $version = null)
 {
     $tableData = new stdClass();
     $tableData->header = array('');
     $tableData->data = array();
     $addonTypeModel = new AddonType();
     $addonTypeRow = $addonTypeModel->findOne($addonType);
     $addonTypeCode = $addonTypeRow->code;
     $branchModel = new Branch();
     $branches = $branchModel->fetchAll();
     foreach ($branches as $branch) {
         $tableData->header[] = $branch->branch_name;
     }
     $addon = new Addon();
     $addonResults = $addon->getOrderedAddons($customerType, $addonType, $version);
     $previousStep = null;
     $rowArray = array();
     foreach ($addonResults as $addonResult) {
         if ($addonResult->step_description !== $previousStep) {
             if ($previousStep !== null) {
                 $tableData->data[] = $rowArray;
             }
             $previousStep = $addonResult->step_description;
             switch ($addonTypeCode) {
                 case 'deposit_period':
                     $rowArray = array($previousStep);
                     break;
                 case 'deposit_amount':
                 case 'customer_engagement':
                     $rowArray = array(number_format($previousStep, 0, '.', ' '));
                     break;
                 case 'new_old_money':
                     if ($previousStep == 0) {
                         $rowArray = array('Stare środki');
                     } else {
                         $rowArray = array('Nowe środki');
                     }
                     break;
                 case 'brand':
                     $rowArray = array('Dodatek');
                     break;
             }
         }
         $rowArray[] = $addonResult->interest_value;
     }
     $tableData->data[] = $rowArray;
     return $tableData;
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $student = Student::find($id);
     if ($student == NULL) {
         throw new Exception('Invalid Student ID');
     }
     $student->year = (int) substr($student->year, 2, 4);
     $student_category = StudentCategories::find($student->category);
     $student->category = $student_category->category;
     $student_branch = Branch::find($student->branch);
     $student->branch = $student_branch->branch;
     if ($student->rejected == 1) {
         unset($student->approved);
         unset($student->books_issued);
         $student->rejected = (bool) $student->rejected;
         return $student;
     }
     if ($student->approved == 0) {
         unset($student->rejected);
         unset($student->books_issued);
         $student->approved = (bool) $student->approved;
         return $student;
     }
     unset($student->rejected);
     unset($student->approved);
     $student_issued_books = Logs::select('book_issue_id', 'issued_at')->where('student_id', '=', $id)->orderBy('time_stamp', 'desc')->take($student->books_issued)->get();
     foreach ($student_issued_books as $issued_book) {
         $issue = Issue::find($issued_book->book_issue_id);
         $book = Books::find($issue->book_id);
         $issued_book->name = $book->title;
         $issued_book->issued_at = date('d-M', $issued_book->issued_at);
     }
     $student->issued_books = $student_issued_books;
     return $student;
 }
 public function __construct(Branch $branch = null)
 {
     parent::__construct(null, null, null, null, null, null, null);
     if ($branch) {
         $this->add($branch);
     }
 }
예제 #14
0
 public function loginAction()
 {
     if ($this->isLogin()) {
         $this->redirect(\Func\url('/', true));
     }
     if ($this->isAjax()) {
         $data = $this->request->getPost();
         if (empty($data)) {
             $this->pageError('param');
         }
         $modelForm = new OperatorForm('login');
         if ($result = $modelForm->validate($data)) {
             if ($info = $modelForm->login()) {
                 if ($info->status == Operator::STATUS_FREEZE) {
                     $this->error('该账号已冻结');
                 }
                 $_sess = ['oid' => $info->oid, 'username' => $info->username, 'rid' => $info->rid, 'rname' => Role::getNameById($info->rid), 'bname' => Branch::getNameById($info->bid), 'bid' => $info->bid, 'auth' => Operator::getAuthByRid($info->rid), 'expire' => time() + $this->getConfig('session', 'expire')];
                 $this->session->set('operator', $_sess);
                 $this->success(['msg' => '登录成功', 'redirect' => ['url' => \Func\url('/'), 'seconds' => 0]]);
             } else {
                 $this->error('账号或密码错误');
             }
         }
         $error = $modelForm->getErrors();
         if ($error) {
             $this->error($error);
         }
         $this->error('参数错误');
     }
     $this->single('login');
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Branch::create(['name' => $faker->city, 'address' => $faker->address]);
     }
 }
예제 #16
0
 public function archive($publicId)
 {
     $branch = Branch::scope($publicId)->firstOrFail();
     $branch->delete();
     Session::flash('message', trans('texts.archived_branch'));
     return Redirect::to('company/branches');
 }
예제 #17
0
 /**
  * 编辑门店信息
  */
 public function editAction()
 {
     if ($this->isAjax()) {
         $data = $this->request->getPost();
         $modelForm = new BranchForm('edit');
         if ($modelForm->validate($data)) {
             if ($modelForm->edit()) {
                 $this->success('操作成功');
             } else {
                 $this->error('操作失败');
             }
         } else {
             $this->error('验证失败');
         }
         exit;
     }
     $id = $this->dispatcher->getParams()[0];
     if (empty($id)) {
         $this->pageError('param');
     }
     $info = Branch::findById($id);
     if (!$info) {
         $this->pageError('param');
     }
     $this->view->setVars(['info' => $info, 'formparams' => ['event' => 'edit', 'action' => \Func\url('/branch/edit')]]);
     $this->view->pick('branch/add');
 }
예제 #18
0
 public function getPostPage()
 {
     $obj = new BaseController();
     $campusid = $this->getDevice();
     if ($campusid == 0) {
         $countryname = $obj->getCountryName();
         if ($countryname == 'NONE') {
             return Redirect::route('selectcampus-get');
         } else {
             //check whether the country name exists inthe db
             $locationcountry = Country::where('name', '=', $countryname);
             if ($locationcountry->count()) {
                 $locationcountrycode = $locationcountry->first()->code;
                 $locationcountrycode = strtolower($locationcountrycode);
                 return Redirect::route('selectcountryid', $locationcountrycode);
             } else {
                 return Redirect::route('selectcampus-get');
             }
         }
     }
     $college = Institution::whereHas('Branch', function ($query) use($campusid) {
         $query->where('id', '=', $campusid);
     })->first();
     View::share('college', $college);
     $mycampus = Branch::where('id', '=', $campusid)->first();
     View::share('mycampus', $mycampus);
     if (Auth::user()) {
         return View::make('member.post');
     }
     return View::make('guest.post');
 }
예제 #19
0
 /**
  * @param Branch $branch
  *
  * @return Commit[]
  */
 public function getCommits(Branch $branch)
 {
     exec(sprintf('git log --pretty=format:"%s" %s', self::PRETTY_FORMAT_STRING, $branch->getName()), $output);
     $commits = [];
     $commitData = [];
     foreach ($output as $line) {
         if (empty($line)) {
             $commits[$commitData['H']] = new Commit(new Hash($commitData['H']), new User($commitData['aN'], $commitData['aE']), new \DateTime($commitData['ai']), new User($commitData['cN'], $commitData['cE']), new \DateTime($commitData['ci']), $commitData['s']);
             continue;
         }
         if (false === strpos($line, ':')) {
             continue;
         }
         list($key, $value) = explode(':', $line, 2);
         $commitData[$key] = $value;
     }
     return $commits;
 }
예제 #20
0
파일: BranchPeer.php 프로젝트: ratibus/Crew
 /**
  * @static
  * @param GitCommand $gitCommand
  * @param Repository $repository
  * @param Branch $branch
  * @param bool $deleteOnly
  * @return void
  */
 public static function synchronize(GitCommand $gitCommand, Repository $repository, Branch $branch, $deleteOnly = false)
 {
     $branchGit = $gitCommand->getNoMergedBranchInfos($repository->getGitDir(), $branch->getBaseBranchName(), $branch->getName());
     $branchModel = BranchQuery::create()->filterByRepositoryId($repository->getId())->filterByName($branch->getName())->findOne();
     if ($branchModel) {
         if (is_null($branchGit)) {
             $branchModel->delete();
         } elseif (!$branchModel->getIsBlacklisted() && !$deleteOnly) {
             $lastSynchronizationCommit = $branchModel->getLastCommit();
             $branchModel->setCommitReference($branchGit['commit_reference']);
             $branchModel->setLastCommit($branchGit['last_commit']);
             $branchModel->setLastCommitDesc($branchGit['last_commit_desc']);
             $branchModel->save();
             return FilePeer::synchronize($gitCommand, $branchModel, $lastSynchronizationCommit);
         }
     }
     return 0;
 }
예제 #21
0
 public function dashboard()
 {
     $sucursales = Branch::count();
     $usuarios = User::count();
     $clientes = Client::count();
     $productos = Product::count();
     $informacionCuenta = array('sucursales' => $sucursales, 'usuarios' => $usuarios, 'clientes' => $clientes, 'productos' => $productos);
     // return Response::json($informacionCuenta);
     return View::make('cuentas.dashboard')->with('cuenta', $informacionCuenta);
 }
예제 #22
0
 public function dashboard()
 {
     $sucursales = Branch::where('account_id', Auth::user()->account_id)->get();
     $usuarios = Account::find(Auth::user()->account_id)->users;
     $clientes = Account::find(Auth::user()->account_id)->clients;
     $productos = Account::find(Auth::user()->account_id)->products;
     $informacionCuenta = array('sucursales' => sizeof($sucursales), 'usuarios' => sizeof($usuarios), 'clientes' => sizeof($clientes), 'productos' => sizeof($productos));
     // return Response::json($informacionCuenta);
     return View::make('cuentas.dashboard')->with('cuenta', $informacionCuenta);
 }
예제 #23
0
 /**
  * @param sfWebRequest $request
  * @return void
  */
 public function execute($request)
 {
     $branch = BranchPeer::retrieveByPK($request->getParameter('branch'));
     $this->forward404Unless($branch, 'Branch Not Found');
     $oldtStatus = $branch->getStatus();
     $branch->setIsBlacklisted(true)->setReviewRequest(false)->save();
     Branch::saveAction($this->getUser()->getId(), $branch->getRepositoryId(), $branch->getId(), $oldtStatus, $branch->getStatus());
     $this->getResponse()->setContentType('application/json');
     return $this->renderText(json_encode(array('status' => 'blacklisted')));
 }
예제 #24
0
파일: Ldap.php 프로젝트: knatorski/SMS
 /**
  * Implementacja metody z interfejsu Zend_Auth_Adapter_Interface
  * @see Zend_Auth_Adapter_Interface::authenticate()
  * @return Zend_Auth_Result
  */
 public function authenticate()
 {
     if (empty($this->_username)) {
         throw new Zend_Auth_Adapter_Exception('Nie podano loginu!');
     }
     if (empty($this->_password)) {
         throw new Zend_Auth_Adapter_Exception('Nie podano hasła!');
     }
     $config = Zend_Registry::get('config');
     $this->_options = $config['ldap'];
     $resultLDAP = parent::authenticate();
     if ($resultLDAP->isValid()) {
         $userModel = new User();
         $userRow = $userModel->fetchRow(array('login = ?' => new Zend_Db_Expr("UPPER('{$this->_username}')"), 'ghost = ?' => 'f', 'is_locked = ?' => 'f', new Zend_Db_Expr('valid_until > NOW()')));
         if ($userRow !== null) {
             $identity = $this->_toStdClass($userRow);
             unset($identity->password);
             $ldapData = parent::getAccountObject();
             $identity->ldap = $ldapData;
             $branchModel = new Branch();
             $identity->id_branch = ODDZIAL_ID;
             $identity->view_branch = ODDZIAL_ID;
             $data = $branchModel->find($identity->id_branch);
             $d = $data->current()->toArray();
             $d['application_code'] = 'getin';
             $identity->jednostka = $d;
             $identity->user_backend_apps_logins = null;
             $identity->default_branches[$d['application_code']]['default_login'] = '******';
             $this->_authResult['code'] = Zend_Auth_Result::SUCCESS;
             $this->_authResult['messages'] = 'Autoryzacja pomyślna.';
             $this->_authResult['identity'] = $identity;
             return $this->_createAuthResult();
         } else {
             $this->_authResult['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
             $this->_authResult['messages'] = 'Konto nieaktywne lub zablokowane.';
             return $this->_createAuthResult();
         }
     } else {
         $this->_authResult['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
         $this->_authResult['messages'] = 'Nieprawidłowe dane logowania.';
         return $this->_createAuthResult();
     }
 }
예제 #25
0
파일: Abstract.php 프로젝트: knatorski/SMS
 /**
  *
  * @TODO cach profilu
  */
 protected function getCurrentProfile()
 {
     if (defined('CMD')) {
         $config = Zend_Registry::get('config');
         if ($config['bin']['user'] === null || $config['bin']['branch'] === null) {
             throw new Exception('Brak ustawień w application.ini bin.user lub bin.branch');
         }
         $u = new User();
         $u_data = $u->fetchRow("login = '******'bin']['user'] . "'", "id DESC")->toArray();
         $storageRow = new stdClass();
         foreach ($u_data as $key => $value) {
             $storageRow->{$key} = $value;
         }
         $auth = Zend_Auth::getInstance();
         $storage = $auth->getStorage();
         $o = new Branch();
         $data = $o->fetchRow("branch_name = '" . $config['bin']['branch'] . "'", "id DESC")->toArray();
         $storageRow->jednostka = $data;
         $profile = new Profile();
         $profiles = $profile->fetchAll(array('id_user = '******'id'], 'id_branch = ' . $data['id'], 'ghost = false'));
         if (count($profiles)) {
             $storageRow->profile_id = $profiles[0]['id'];
         }
         $storage->write($storageRow);
     }
     if (defined('CMD') && defined('EXPORT_ID_USER')) {
         $identity['id'] = EXPORT_ID_USER;
         $where_id = $identity['id'];
     } else {
         $where_id = Zend_Auth::getInstance()->getIdentity() ? Zend_Auth::getInstance()->getIdentity()->id : '';
     }
     if (!$this->currentProfile and $where_id) {
         $cm = $this->getBootstrap()->getResource('cachemanager');
         $cache = $cm->getCache('rolecache');
         $cache_id = str_replace("-", "", 'OUcache' . ODDZIAL_ID . '_' . $where_id);
         if (!($this->currentProfile = $cache->load($cache_id))) {
             $profilModel = new Profile();
             $this->currentProfile = $profilModel->fetchRow(array("id_user = {$where_id}", "id_branch = " . ODDZIAL_ID, 'ghost = false'));
             $cache->save($this->currentProfile, $cache_id);
         }
     }
     return $this->currentProfile;
 }
예제 #26
0
 private static function format($data)
 {
     $branches = Branch::all(['key' => true, 'all' => true]);
     foreach ($data as $key => &$row) {
         $row['bname'] = $branches[$row['bid']]['name'];
         $row['is_freeze'] = $row['status'] == self::STATUS_FREEZE;
         $row['status_text'] = $row['is_freeze'] ? '已冻结' : '正常';
     }
     return $data;
 }
예제 #27
0
 public static function buscar($public_id)
 {
     if (Auth::check()) {
         $account_id = Auth::user()->account_id;
     } else {
         $account_id = Session::get('account_id');
     }
     $branch = Branch::where('public_id', $public_id)->scope(false, $account_id)->first();
     return $branch;
 }
예제 #28
0
 public static function editById($id, $data)
 {
     $info = Branch::findFirst(intval($id));
     if (!$info) {
         return false;
     }
     foreach ($data as $field => $value) {
         $info->{$field} = $value;
     }
     return $info->update();
 }
 public function getUpdate($business_id, $field, $value)
 {
     $first_branch = Branch::where('business_id', '=', $business_id)->first();
     $first_service = Service::where('branch_id', '=', $first_branch->branch_id)->first();
     if (QueueSettings::serviceExists($first_service->service_id)) {
         QueueSettings::updateQueueSetting($first_service->service_id, $field, $value);
     } else {
         QueueSettings::createQueueSetting(['service_id' => $first_service->service_id, 'date' => mktime(0, 0, 0, date('m'), date('d'), date('Y')), $field => $value]);
     }
     return json_encode(['success' => 1]);
 }
예제 #30
0
파일: Branch.php 프로젝트: adsavin/bswshop
 public static function getOptions($no_select = null)
 {
     $model = Branch::model()->findAll();
     $arr = array();
     if ($no_select == true) {
         $arr[] = '--- ไม่เลือกรายการ ---';
     }
     foreach ($model as $r) {
         $arr[$r->branch_id] = $r->branch_name;
     }
     return $arr;
 }