예제 #1
0
 public function onsubmit($sender)
 {
     $this->setError('');
     if ($this->_login == '') {
         $this->setError('Введите логин');
     } else {
         if ($this->_password == '') {
             $this->setError('Введите пароль');
         } else {
             if ($this->_confirm == '') {
                 $this->setError('Подтвердите пароль');
             } else {
                 if ($this->_confirm != $this->_password) {
                     $this->setError('Неверное подтверждение');
                 } else {
                     if ($user = Helper::login($this->_login) != false) {
                         $this->setError('Логин уже существует');
                     }
                 }
             }
         }
     }
     if (!$this->isError()) {
         $user = new User();
         $user->userlogin = $this->_login;
         $user->userpass = \password_hash($this->_password, PASSWORD_DEFAULT);
         $user->Save();
         App::Redirect('\\ZippyERP\\System\\Pages\\UserInfo', $user->user_id);
     }
     $this->_confirm = '';
     $this->_password = '';
 }
예제 #2
0
 public function __construct()
 {
     $this->add(new \ZippyERP\System\Blocks\Header("header"));
     $this->add(new \Zippy\Html\Label("errormessage", new \Zippy\Binding\PropertyBinding($this, '_errormsg'), false, true))->setVisible(false);
     $user = System::getUser();
     if ($user->user_id == 0) {
         App::Redirect("\\ZippyERP\\System\\Pages\\Userlogin");
     }
 }
예제 #3
0
파일: header.php 프로젝트: Niqpue/zippyerp
 public function LogoutClick($sender)
 {
     setcookie("remember", '', 0);
     System::setUser(new \ZippyERP\System\User());
     $_SESSION['user_id'] = 0;
     $_SESSION['userlogin'] = '******';
     //$page = $this->getOwnerPage();
     //  $page = get_class($page)  ;
     App::RedirectHome();
     //    App::$app->getresponse()->toBack();
 }
예제 #4
0
function autoload($className)
{
    $className = str_replace("\\", "/", ltrim($className, '\\'));
    if (strpos($className, 'ZippyERP/ERP/') === 0) {
        $file = __DIR__ . DIRECTORY_SEPARATOR . strtolower(str_replace("ZippyERP/ERP/", "", $className)) . ".php";
        if (file_exists($file)) {
            require_once $file;
        } else {
            \ZippyERP\System\Application::Redirect('\\ZippyERP\\System\\Pages\\Error', "Класс {$className} не  найден");
        }
    }
}
예제 #5
0
 public function __construct()
 {
     $this->title = 'Страница администратора';
     $this->add(new \ZippyERP\System\Blocks\Header("header"));
     $this->add(new \Zippy\Html\Label("errormessage", new \Zippy\Binding\PropertyBinding($this, '_errormsg'), false, true))->setVisible(false);
     $user = System::getUser();
     if ($user->user_id == 0) {
         App::Redirect("\\ZippyERP\\System\\Pages\\Userlogin");
     }
     if ($user->userlogin !== 'admin') {
         App::Redirect('\\ZippyERP\\Pages\\Error', 'Вы не админ');
     }
 }
예제 #6
0
파일: base.php 프로젝트: Niqpue/zippyerp
 public function __construct()
 {
     $this->add(new \ZippyERP\System\Blocks\Header("header"));
     $this->add(new Label("errormessage", new \Zippy\Binding\PropertyBinding($this, '_errormsg'), false, true))->setVisible(false);
     $this->add(new Label("warnmessage", new \Zippy\Binding\PropertyBinding($this, '_warnmsg'), false, true))->setVisible(false);
     $this->add(new Label("successmessage", new \Zippy\Binding\PropertyBinding($this, '_successmsg'), false, true))->setVisible(false);
     $this->add(new Label("menudoc", Helper::generateMenu(1), true));
     $this->add(new Label("menurep", Helper::generateMenu(2), true));
     $this->add(new Label("menureg", Helper::generateMenu(3), true));
     $this->add(new Label("menuref", Helper::generateMenu(4), true));
     $this->add(new Label("menupage", Helper::generateMenu(5), true));
     $this->add(new ClickLink("pageinfo"))->setAttribute("data-content", $this->getPageInfo());
     $user = System::getUser();
     if ($user->user_id == 0) {
         App::Redirect("\\ZippyERP\\System\\Pages\\Userlogin");
     }
 }
예제 #7
0
function autoload($className)
{
    $className = str_replace("\\", "/", ltrim($className, '\\'));
    /*
     if (strpos($className, 'ZippyERP/System/Pages/') === 0) {
     require_once(__DIR__ . "/" . strtolower(str_replace("ZippyERP/", "", $className)) . ".php");
     } else
     if (strpos($className, 'ZippyERP/System/Blocks/') === 0) {
     require_once(__DIR__ . "/" . strtolower(str_replace("ZippyERP/", "", $className)) . ".php");
     } else
    */
    if (strpos($className, 'ZippyERP/System/') === 0) {
        $file = __DIR__ . DIRECTORY_SEPARATOR . strtolower(str_replace("ZippyERP/System/", "", $className)) . ".php";
        if (file_exists($file)) {
            require_once $file;
        } else {
            \ZippyERP\System\Application::Redirect('\\ZippyERP\\System\\Pages\\Error', 'Неверный URL');
        }
    }
}
예제 #8
0
 public function backtolistOnClick($sender)
 {
     App::RedirectBack();
 }
예제 #9
0
 public function savedocOnClick($sender)
 {
     if ($this->docform->customer->getKey() <= 0) {
         $this->setError('Не выбран  контрагент');
         return;
     }
     $this->_doc->headerdata = array('customer' => $this->docform->customer->getKey(), 'customername' => $this->docform->customer->getText(), 'bankaccount' => $this->docform->bankaccount->getValue(), 'tax' => $this->docform->tax->getValue(), 'notes' => $this->docform->notes->getText(), 'basedoc' => $this->docform->basedoc->getKey(), 'basedocname' => $this->docform->basedoc->getText(), 'nds' => $this->docform->nds->getValue() * 100, 'amount' => $this->docform->amount->getValue() * 100);
     $this->_doc->amount = 100 * $this->docform->amount->getText();
     $this->_doc->document_number = $this->docform->document_number->getText();
     $this->_doc->document_date = strtotime($this->docform->document_date->getText());
     $isEdited = $this->_doc->document_id > 0;
     $conn = \ZCL\DB\DB::getConnect();
     $conn->BeginTrans();
     try {
         $this->_doc->save();
         if ($sender->id == 'execdoc') {
             $this->_doc->updateStatus(Document::STATE_EXECUTED);
         } else {
             $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
         }
         if ($this->_basedocid > 0) {
             $this->_doc->AddConnectedDoc($this->_basedocid);
             $this->_basedocid = 0;
         }
         $conn->CommitTrans();
         App::RedirectBack();
     } catch (\ZippyERP\System\Exception $ee) {
         $conn->RollbackTrans();
         $this->setError($ee->message);
     } catch (\Exception $ee) {
         $conn->RollbackTrans();
         throw new \Exception($ee->message);
     }
 }
예제 #10
0
 public function beforeRequest()
 {
     if (System::getUser()->user_id > 0) {
         App::RedirectHome();
     }
 }
예제 #11
0
 public function backtolistOnClick($sender)
 {
     // App::Redirect("\\ZippyERP\\ERP\\Pages\\Register\\DocList");
     App::RedirectBack();
 }
예제 #12
0
 public function editOnClick($sender)
 {
     $item = $sender->owner->getDataItem();
     $type = H::getMetaType($item->type_id);
     $class = "\\ZippyERP\\ERP\\Pages\\Doc\\" . $type['meta_name'];
     //   $item = $class::load($item->document_id);
     App::Redirect($class, $item->document_id);
 }
예제 #13
0
 public function savedocOnClick($sender)
 {
     $this->_doc->document_date = strtotime($this->docform->document_date->getText());
     $this->_doc->document_number = $this->docform->document_number->getText();
     $this->_doc->headerdata['entry'] = base64_encode(serialize($this->_entryarr));
     $this->_doc->headerdata['emp'] = base64_encode(serialize($this->_emparr));
     $this->_doc->headerdata['item'] = base64_encode(serialize($this->_itemarr));
     $this->_doc->headerdata['c'] = base64_encode(serialize($this->_carr));
     $this->_doc->headerdata['f'] = base64_encode(serialize($this->_farr));
     $this->_doc->headerdata['description'] = $this->docform->description->getText();
     $conn = \ZCL\DB\DB::getConnect();
     $conn->BeginTrans();
     try {
         $this->_doc->save();
         if ($sender->id == 'execdoc') {
             $this->_doc->updateStatus(Document::STATE_EXECUTED);
         } else {
             $this->_doc->updateStatus($this->_edited ? Document::STATE_EDITED : Document::STATE_NEW);
         }
         $conn->CommitTrans();
         App::RedirectBack();
     } catch (\ZippyERP\System\Exception $ee) {
         $conn->RollbackTrans();
         $this->setError($ee->message);
     } catch (\Exception $ee) {
         $conn->RollbackTrans();
         throw new \Exception($ee->message);
     }
 }
예제 #14
0
파일: doclist.php 프로젝트: Niqpue/zippyerp
 public function editOnClick($sender)
 {
     $item = $sender->owner->getDataItem();
     $type = H::getMetaType($item->type_id);
     $class = "\\ZippyERP\\ERP\\Pages\\Doc\\" . $type['meta_name'];
     //   $item = $class::load($item->document_id);
     //запоминаем страницу пагинатора
     $filter = Filter::getFilter("doclist");
     $filter->page = $this->doclist->getCurrentPage();
     App::Redirect($class, $item->document_id);
 }
예제 #15
0
 public function savedocOnClick($sender)
 {
     $basedocid = $this->docform->basedoc->getKey();
     $this->_doc->headerdata = array('optype' => $this->docform->optype->getValue(), 'opdetail' => $this->docform->opdetail->getKey(), 'opdetailname' => $this->docform->opdetail->getText(), 'amount' => $this->docform->amount->getValue() * 100, 'basedoc' => $basedocid, 'notes' => $this->docform->notes->getText());
     $this->_doc->amount = 100 * $this->docform->amount->getText();
     $this->_doc->document_number = $this->docform->document_number->getText();
     $this->_doc->document_date = $this->docform->document_date->getDate();
     $isEdited = $this->_doc->document_id > 0;
     $conn = \ZCL\DB\DB::getConnect();
     $conn->BeginTrans();
     try {
         $this->_doc->save();
         if ($sender->id == 'execdoc') {
             $this->_doc->updateStatus(Document::STATE_EXECUTED);
         } else {
             $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
         }
         if ($basedocid > 0) {
             $this->_doc->AddConnectedDoc($basedocid);
         }
         $conn->CommitTrans();
         App::RedirectBack();
     } catch (\ZippyERP\System\Exception $ee) {
         $conn->RollbackTrans();
         $this->setError($ee->message);
     } catch (\Exception $ee) {
         $conn->RollbackTrans();
         throw new \Exception($ee->message);
     }
 }
예제 #16
0
 public function cancelOnClick($sender)
 {
     App::RedirectBack();
 }
예제 #17
0
파일: docview.php 프로젝트: Niqpue/zippyerp
 public function detailDocOnClick($sender)
 {
     $id = $sender->owner->getDataItem()->document_id;
     App::Redirect('\\ZippyERP\\ERP\\Pages\\Register\\DocList', $id);
 }