Example #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 = '';
 }
Example #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");
     }
 }
Example #3
0
 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();
 }
Example #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} не  найден");
        }
    }
}
Example #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', 'Вы не админ');
     }
 }
Example #6
0
 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");
     }
 }
Example #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');
        }
    }
}
Example #8
0
 public function backtolistOnClick($sender)
 {
     App::RedirectBack();
 }
Example #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);
     }
 }
Example #10
0
 public function beforeRequest()
 {
     if (System::getUser()->user_id > 0) {
         App::RedirectHome();
     }
 }
Example #11
0
 public function backtolistOnClick($sender)
 {
     // App::Redirect("\\ZippyERP\\ERP\\Pages\\Register\\DocList");
     App::RedirectBack();
 }
Example #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);
 }
Example #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);
     }
 }
Example #14
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);
     //запоминаем страницу пагинатора
     $filter = Filter::getFilter("doclist");
     $filter->page = $this->doclist->getCurrentPage();
     App::Redirect($class, $item->document_id);
 }
Example #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);
     }
 }
Example #16
0
 public function cancelOnClick($sender)
 {
     App::RedirectBack();
 }
Example #17
0
 public function detailDocOnClick($sender)
 {
     $id = $sender->owner->getDataItem()->document_id;
     App::Redirect('\\ZippyERP\\ERP\\Pages\\Register\\DocList', $id);
 }