public function __construct($file_id) { if (!is_numeric($file_id)) { die; } $user = \ZippyERP\System\System::getUser(); if ($user->user_id == 0) { die; } $file = \ZippyERP\ERP\Helper::loadFile($file_id); if ($file == null) { die; } $type = ""; $pos = strrpos($file['filename'], '.'); if ($pos !== false) { $type = substr($file['filename'], $pos + 1); } $size = strlen($file['filedata']); if ($size > 0) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $file['filename']); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . $size); flush(); echo $file['filedata']; } die; }
protected function beforeRender() { parent::beforeRender(); $user = System::getUser(); $this->welcomform->SetVisible($user->isLogined()); $this->welcomform->username->setText($user->userlogin); $this->welcomform->adminmenu->SetVisible($user->userlogin == 'admin'); }
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"); } }
public function __construct($user_id) { parent::__construct(); $this->user = \ZippyERP\System\User::load($user_id); $this->add(new Label('login', $this->user->userlogin)); $this->add(new Label('createdate', date('Y-m-d', $this->user->registration_date))); $this->add(new Label('userroles', 'Зарегистрировнный пользователь')); $this->add(new \Zippy\Html\Form\Form('roleform'))->setVisible(System::getUser()->userlogin == 'admin'); $this->roleform->add(new \Zippy\Html\DataList\DataView("rolerow", new \ZCL\DB\EntityDataSource('\\ZippyERP\\System\\Role'), $this, 'OnAddRoleRow'))->Reload(); $this->roleform->setSubmitHandler($this, 'OnSubmit'); }
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', 'Вы не админ'); } }
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"); } }
public function beforeRequest() { if (System::getUser()->user_id > 0) { App::RedirectHome(); } }
public function __construct($docid = 0, $basedocid = 0) { parent::__construct(); $this->add(new Form('docform')); $this->docform->add(new TextInput('document_number')); $this->docform->add(new Date('document_date'))->setDate(time()); $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent"); $this->docform->add(new AutocompleteTextInput('contract'))->setAutocompleteHandler($this, "OnAutoContract"); $this->docform->add(new TextInput('author')); $this->docform->add(new TextInput('paytype')); $this->docform->add(new CheckBox('ernn')); $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick'); $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick'); $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick'); $this->docform->add(new Label('totalnds')); $this->docform->add(new Label('total')); $this->add(new Form('editdetail'))->setVisible(false); $this->editdetail->add(new AutocompleteTextInput('edittovar'))->setAutocompleteHandler($this, "OnAutoItem"); $this->editdetail->edittovar->setChangeHandler($this, 'OnChangeItem'); $this->editdetail->add(new TextInput('editquantity'))->setText("1"); $this->editdetail->add(new TextInput('editprice')); $this->editdetail->add(new TextInput('editpricends')); $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick'); $this->editdetail->add(new SubmitButton('submitrow'))->setClickHandler($this, 'saverowOnClick'); if ($docid > 0) { //загружаем содержимок документа настраницу $this->_doc = Document::load($docid); $this->docform->document_number->setText($this->_doc->document_number); $this->docform->totalnds->setText(H::fm($this->_doc->headerdata['totalnds'])); $this->docform->document_date->setDate($this->_doc->document_date); $this->docform->ernn->setChecked($this->_doc->headerdata['ernn']); $this->docform->paytype->setText($this->_doc->headerdata['paytype']); $this->docform->author->setText($this->_doc->headerdata['author']); $this->docform->contract->setKey($this->_doc->headerdata['contract']); $this->docform->contract->setText($this->_doc->headerdata['contractnumber']); $this->docform->customer->setKey($this->_doc->headerdata['customer']); $this->docform->customer->setText($this->_doc->headerdata['customername']); $basedoc = Document::load($this->_doc->headerdata['based']); foreach ($this->_doc->detaildata as $item) { $item = new Item($item); $this->_tovarlist[$item->item_id] = $item; } } else { $this->_doc = Document::create('TaxInvoice'); $this->docform->document_number->setText($this->_doc->nextNumber()); $user = System::getUser(); $employee = \ZippyERP\ERP\Entity\Employee::find("login='******'"); if ($employee instanceof \ZippyERP\ERP\Entity\Employee) { $this->docform->author->setText($employee->fullname); } if ($basedocid > 0) { //создание на основании $basedoc = Document::load($basedocid); if ($basedoc instanceof Document) { $this->_basedocid = $basedocid; if ($basedoc->meta_name == 'GoodsIssue') { $this->docform->customer->setKey($basedoc->headerdata['customer']); $this->docform->customer->setText($basedoc->headerdata['customername']); $this->docform->contract->setKey($basedoc->headerdata['contract']); $this->docform->contract->setText($basedoc->headerdata['contractnumber']); foreach ($basedoc->detaildata as $item) { $item = new Item($item); $this->_tovarlist[$item->item_id] = $item; } } if ($basedoc->meta_name == 'Invoice') { $this->docform->customer->setKey($basedoc->headerdata['customer']); $this->docform->customer->setText($basedoc->headerdata['customername']); $this->docform->contract->setKey($basedoc->headerdata['contract']); $this->docform->contract->setText($basedoc->headerdata['contractnumber']); foreach ($basedoc->detaildata as $item) { $item = new Item($item); $this->_tovarlist[$item->item_id] = $item; } } } } } $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_tovarlist')), $this, 'detailOnRow'))->Reload(); }
/** * Обновляет состояние документа * * @param mixed $state */ public function updateStatus($state) { if ($this->state == $state) { return false; } if ($this->document_id == 0) { return false; } if ($state == self::STATE_CANCELED) { $this->Cancel(); } if ($state == self::STATE_EXECUTED) { $this->Execute(); } $this->state = $state; $conn = \ZCL\DB\DB::getConnect(); $host = $conn->qstr($_SERVER["REMOTE_ADDR"]); $user = \ZippyERP\System\System::getUser()->getUserID(); $sql = "insert into erp_document_update_log (document_id,user_id,document_state,updatedon,hostname) values ({$this->document_id},{$user},{$this->state},now(),{$host})"; $conn->Execute($sql); $sql = "update erp_document set state={$this->state},updated=now() where document_id = {$this->document_id}"; $conn->Execute($sql); return true; }
public function beforeRender() { parent::beforeRender(); $user = System::getUser(); }
/** * добавление коментария * * @param mixed $sender */ public function OnMsgSubmit($sender) { $msg = new \ZippyERP\ERP\Entity\Message(); $msg->message = $this->addmsgform->addmsg->getText(); $msg->created = time(); $msg->user_id = System::getUser()->user_id; $msg->item_id = $this->_item->contact_id; $msg->item_type = \ZippyERP\ERP\Consts::MSG_ITEM_TYPE_CONTACT; if (strlen($msg->message) == 0) { return; } $msg->save(); $this->addmsgform->addmsg->setText(''); $this->updateMessages(); }
private function getWhere() { $conn = \ZCL\DB\DB::getConnect(); $filter = Filter::getFilter("doclist"); $where = " date(document_date) >= " . $conn->DBDate($filter->from) . " and date(document_date) <= " . $conn->DBDate($filter->to); if (strlen($filter->docgroup) > 1) { $where .= " and type_id in (select meta_id from erp_metadata where menugroup ='{$filter->docgroup}' )"; } if (strlen($filter->searchnumber) > 1) { $where .= " and document_number like '%{$filter->searchnumber}%' "; } if ($filter->onlymy == true) { $where .= " and user_id = " . System::getUser()->user_id; } return $where; }
public function addnewtaskOnClick($sender) { $this->taskstab->setVisible(false); $this->edittasktab->setVisible(true); $this->edittasktab->edittaskform->clean(); $this->_task = new Task(); $this->_task->project_id = $this->_project->project_id; $this->_task->createdby = System::getUser()->user_id; $this->_task->created = time(); $this->_task->updated = time(); $this->edittasktab->edittaskform->edittaskspriority->setValue(3); }