From decd5c300baafd55d3367ec34e6e7ec606870da4 Mon Sep 17 00:00:00 2001 From: Leon Date: Fri, 7 Jun 2019 17:56:24 +0300 Subject: [PATCH 01/17] =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D1=8B=D0=B5=20=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8F=20=D0=B4=D0=BB=D1=8F=20=20=D0=BF=D0=B0?= =?UTF-8?q?=D1=80=D1=82=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/update.sql | 1 + www/app/entity/doc/goodsreceipt.php | 2 +- www/app/entity/doc/moveitem.php | 2 +- www/app/entity/doc/prodreceipt.php | 2 +- www/app/entity/doc/transitem.php | 2 +- www/app/entity/stock.php | 27 +++++++++++++++------------ www/app/pages/base.php | 1 + www/app/pages/doc/retcustissue.php | 2 +- www/app/pages/options.php | 3 +++ www/templates/pages/options.html | 4 ++++ 10 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 db/update.sql diff --git a/db/update.sql b/db/update.sql new file mode 100644 index 000000000..558b6f936 --- /dev/null +++ b/db/update.sql @@ -0,0 +1 @@ +ALTER TABLE `store_stock` ADD `snumber` VARCHAR(64) NULL AFTER `qty`, ADD `sdate` DATE NULL AFTER `snumber`; \ No newline at end of file diff --git a/www/app/entity/doc/goodsreceipt.php b/www/app/entity/doc/goodsreceipt.php index 1b5ae52ce..decf662cd 100644 --- a/www/app/entity/doc/goodsreceipt.php +++ b/www/app/entity/doc/goodsreceipt.php @@ -49,7 +49,7 @@ public function Execute() { //аналитика foreach ($this->detaildata as $row) { - $stock = \App\Entity\Stock::getStock($this->headerdata['store'], $row['item_id'], $row['price'], true); + $stock = \App\Entity\Stock::getStock($this->headerdata['store'], $row['item_id'], $row['price'],$row['snumber'], true); $sc = new Entry($this->document_id, $row['amount'], $row['quantity']); diff --git a/www/app/entity/doc/moveitem.php b/www/app/entity/doc/moveitem.php index 016d0b4d0..6bcab7ca1 100644 --- a/www/app/entity/doc/moveitem.php +++ b/www/app/entity/doc/moveitem.php @@ -31,7 +31,7 @@ public function Execute() { $sc->save(); - $stockto = Stock::getStock($this->headerdata['storeto'], $value['item_id'], $value['partion'], true); + $stockto = Stock::getStock($this->headerdata['storeto'], $value['item_id'], $value['partion'],$value['snumber'],, true); $sc = new Entry($this->document_id, $value['quantity'] * $value['partion'], $value['quantity']); $sc->setStock($stockto->stock_id); diff --git a/www/app/entity/doc/prodreceipt.php b/www/app/entity/doc/prodreceipt.php index b57248a1b..65e3fc958 100644 --- a/www/app/entity/doc/prodreceipt.php +++ b/www/app/entity/doc/prodreceipt.php @@ -50,7 +50,7 @@ public function Execute() { //аналитика foreach ($this->detaildata as $row) { - $stock = \App\Entity\Stock::getStock($this->headerdata['store'], $row['item_id'], $row['price'], true); + $stock = \App\Entity\Stock::getStock($this->headerdata['store'], $row['item_id'], $row['price'],$row['snumber'], true); $sc = new Entry($this->document_id, $row['amount'], $row['quantity']); diff --git a/www/app/entity/doc/transitem.php b/www/app/entity/doc/transitem.php index f04c94e14..29d567b54 100644 --- a/www/app/entity/doc/transitem.php +++ b/www/app/entity/doc/transitem.php @@ -32,7 +32,7 @@ public function Execute() { $ti = Item::load($this->headerdata['toitem']); $price = round(($this->amount ) / $this->headerdata["toquantity"]); - $stockto = Stock::getStock($this->headerdata['storefrom'], $ti->item_id, $price, true); + $stockto = Stock::getStock($this->headerdata['storefrom'], $ti->item_id, $price,"", true); $sc = new Entry($this->document_id, $this->headerdata["toquantity"] * $price, $this->headerdata["toquantity"]); $sc->setStock($stockto->stock_id); diff --git a/www/app/entity/stock.php b/www/app/entity/stock.php index b4198c7f9..e3c73a33c 100644 --- a/www/app/entity/stock.php +++ b/www/app/entity/stock.php @@ -13,7 +13,7 @@ class Stock extends \ZCL\DB\Entity { protected function init() { $this->stock_id = 0; - $this->deleted = 0; + } /** @@ -26,15 +26,13 @@ protected function init() { public static function findArrayAC($store, $partname = "") { - $criteria = "qty <>0 and disabled <> 1 "; + $criteria = "qty <> 0 and disabled <> 1 "; if (strlen($partname) > 0) { $partname = self::qstr('%' . $partname . '%'); - $criteria .= " and (itemname like {$partname} or item_code like {$partname} )"; + $criteria .= " and (itemname like {$partname} or item_code like {$partname} or snumber like {$partname} )"; } - - - - $entitylist = self::find($criteria, "itemname"); + + $entitylist = self::find($criteria, "sdate asc"); $list = array(); foreach ($entitylist as $key => $value) { @@ -52,11 +50,15 @@ public static function findArrayAC($store, $partname = "") { * @param mixed $price Цена * @param mixed $create Создать если не существует */ - public static function getStock($store_id, $item_id, $price, $create = false) { - - $where = "store_id = {$store_id} and item_id = {$item_id} and partion = {$price} "; - + public static function getStock($store_id, $item_id, $price,$snumber="", $create = false) { $conn = \ZDB\DB::getConnect(); + + $where = "store_id = {$store_id} and item_id = {$item_id} and partion = {$price} "; + + if (strlen($snumber) > 0) { + $snumber = self::qstr('%' . $snumber . '%'); + $where .= " and snumber = {$snumber} "; + } //на случай если удален //$conn->Execute("update store_stock set deleted=0 where " . $where); @@ -67,6 +69,7 @@ public static function getStock($store_id, $item_id, $price, $create = false) { $stock->store_id = $store_id; $stock->item_id = $item_id; $stock->partion = $price; + $stock->snumber = $snumber; $stock->save(); } @@ -101,7 +104,7 @@ public static function getQuantity($stock_id, $date = null) { public static function pickup($store_id, $item_id, $qty) { $res = array(); $where = "store_id = {$store_id} and item_id = {$item_id} and qty >0 "; - $stlist = self::find($where, 'stock_id'); + $stlist = self::find($where, 'sdate,stock_id'); foreach ($stlist as $st) { if ($st->qty >= $qty) { $st->quantity = $qty; diff --git a/www/app/pages/base.php b/www/app/pages/base.php index 1cfccb011..e58bfa347 100644 --- a/www/app/pages/base.php +++ b/www/app/pages/base.php @@ -54,6 +54,7 @@ public function __construct($params = null) { $options = System::getOptions('common'); $this->_tvars["useset"] = $options['useset'] == 1; + $this->_tvars["usesnumber"] = $options['usesnumber'] == 1; $this->_tvars["smart"] = Helper::generateSmartMenu(); $this->_tvars["picontent"] = $pi; diff --git a/www/app/pages/doc/retcustissue.php b/www/app/pages/doc/retcustissue.php index cca772407..5460bf604 100644 --- a/www/app/pages/doc/retcustissue.php +++ b/www/app/pages/doc/retcustissue.php @@ -110,7 +110,7 @@ public function __construct($docid = 0, $basedocid = 0) { foreach ($basedoc->detaildata as $item) { - $stock = \App\Entity\Stock::getStock($basedoc->headerdata['store'], $item['item_id'], $item['price']); + $stock = \App\Entity\Stock::getStock($basedoc->headerdata['store'], $item['item_id'], $item['price'], $item['snumber']); $stock->quantity = $item['quantity']; $stock->price = $item['price']; $this->_tovarlist[$stock->stock_id] = $stock; diff --git a/www/app/pages/options.php b/www/app/pages/options.php index b2258a0fa..f93a00436 100644 --- a/www/app/pages/options.php +++ b/www/app/pages/options.php @@ -36,6 +36,7 @@ public function __construct() { + $this->common->add(new CheckBox('usesnumber')); $this->common->add(new CheckBox('useset')); $this->common->add(new CheckBox('useval'))->onChange($this, "onVal"); $this->common->add(new TextInput('cdoll')); @@ -67,6 +68,7 @@ public function __construct() { $this->common->price4->setText($common['price4']); $this->common->price5->setText($common['price5']); $this->common->useset->setChecked($common['useset']); + $this->common->usesnumber->setChecked($common['usesnumber']); $this->common->useval->setChecked($common['useval']); // $this->common->closeddate->setDate($common['closeddate']); @@ -129,6 +131,7 @@ public function saveCommonOnClick($sender) { $common['price4'] = $this->common->price4->getText(); $common['price5'] = $this->common->price5->getText(); $common['useset'] = $this->common->useset->isChecked(); + $common['usesnumber'] = $this->common->usesnumber->isChecked(); $common['useval'] = $this->common->useval->isChecked(); // $common['closeddate'] = $this->common->closeddate->getDate(); diff --git a/www/templates/pages/options.html b/www/templates/pages/options.html index 467c13758..7805d2ebf 100644 --- a/www/templates/pages/options.html +++ b/www/templates/pages/options.html @@ -42,6 +42,10 @@

Основные настройки

+
+ + +
From 482412872eafcf20aa04096db70c1cf3f38b2c46 Mon Sep 17 00:00:00 2001 From: Leon Date: Fri, 7 Jun 2019 22:57:43 +0300 Subject: [PATCH 02/17] =?UTF-8?q?=D0=B4=D0=B5=D1=82=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D0=BE=20=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D1=83=D0=B4=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app/pages/reference/eqlist.php | 47 ++++++++++++++++++++++- www/app/pages/register/tasklist.php | 7 +++- www/templates/pages/reference/eqlist.html | 33 ++++++++++++++-- 3 files changed, 80 insertions(+), 7 deletions(-) diff --git a/www/app/pages/reference/eqlist.php b/www/app/pages/reference/eqlist.php index c5834b73e..637f82202 100644 --- a/www/app/pages/reference/eqlist.php +++ b/www/app/pages/reference/eqlist.php @@ -25,6 +25,7 @@ class EqList extends \App\Pages\Base { private $_item; + public $_uselist=array(); public function __construct() { parent::__construct(); @@ -35,9 +36,11 @@ public function __construct() { $this->filter->add(new TextInput('searchkey')); $this->filter->add(new DropDownChoice('searchemp', Employee::findArray("emp_name", "", "emp_name"), 0)); + $this->add(new Panel('itemtable'))->setVisible(true); $this->itemtable->add(new DataView('eqlist', new EQDS($this), $this, 'eqlistOnRow')); $this->itemtable->add(new ClickLink('addnew'))->onClick($this, 'addOnClick'); + $this->itemtable->eqlist->setPageSize(25); $this->itemtable->add(new \Zippy\Html\DataList\Paginator('pag', $this->itemtable->eqlist)); $this->itemtable->eqlist->setSelectedClass('table-success'); @@ -55,18 +58,27 @@ public function __construct() { $this->itemdetail->add(new SubmitButton('save'))->onClick($this, 'OnSubmit'); $this->itemdetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick'); + + $this->add(new Panel('usetable'))->setVisible(false); + $this->usetable->add(new Label('usename')); + $this->usetable->add(new ClickLink('back'))->onClick($this, 'cancelOnClick'); + $this->usetable->add(new DataView('uselist', new ArrayDataSource($this,'_uselist'), $this, 'uselistOnRow')); + } + + public function eqlistOnRow($row) { $item = $row->getDataItem(); $row->add(new Label('eq_name', $item->eq_name)); $row->add(new Label('code', $item->code)); $row->add(new Label('serial', $item->serial)); + $row->add(new ClickLink('use'))->onClick($this, 'useOnClick'); $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); $row->add(new ClickLink('delete'))->onClick($this, 'deleteOnClick'); } - + public function deleteOnClick($sender) { if (false == \App\ACL::checkEditRef('EqList')) return; @@ -85,6 +97,38 @@ public function deleteOnClick($sender) { $this->itemtable->eqlist->Reload(); } + public function useOnClick($sender) { + $this->itemtable->setVisible(false); + $this->usetable->setVisible(true); + $item=$sender->getOwner()->getDataItem(); + $this->usetable->usename->setText($item->eq_name); + $this->_uselist = array(); + + $list = \App\Entity\Doc\Document::find("meta_name='task' and state not in(2,3,1,9) ","document_date desc") ; + + + foreach($list as $task){ + foreach ($task->detaildata as $value) { + if ($value['eq_id'] > 0) { + + $it = new \App\DataItem(array( + "usetask" => $task->document_number, + "useplace" => $value['eq_name'] + )); + $this->_uselist[] = $it; + + } + } + } + + $this->usetable->uselist->Reload(); + } + public function uselistOnRow($row) { + $item = $row->getDataItem(); + $row->add(new Label('usetask', $item->usetask)); + $row->add(new Label('useplace', $item->useplace)); + + } public function editOnClick($sender) { $this->_item = $sender->owner->getDataItem(); $this->itemtable->setVisible(false); @@ -110,6 +154,7 @@ public function addOnClick($sender) { public function cancelOnClick($sender) { $this->itemtable->setVisible(true); $this->itemdetail->setVisible(false); + $this->usetable->setVisible(false); } public function OnFilter($sender) { diff --git a/www/app/pages/register/tasklist.php b/www/app/pages/register/tasklist.php index 26c791da3..051a7a780 100644 --- a/www/app/pages/register/tasklist.php +++ b/www/app/pages/register/tasklist.php @@ -141,14 +141,17 @@ public function tasklistOnRow($row) { $row->add(new Label('taskemps', implode(', ', $emps))); $row->add(new Label('taskclient', $task->customer_name)); $row->add(new Label('taskamount', $task->amount)); - $row->add(new Label('taskdebet', $task->amount - $task->datatag)); + $row->add(new Label('taskdebet', $task->amount - $task->datatag)); $this->_tamount = $this->_tamount + $task->amount; - $this->_tdebet = $this->_tdebet + $task->amount - $task->datatag; + $this->_tdebet = $this->_tdebet + $task->amount - $task->datatag; $row->add(new ClickLink('taskshow'))->onClick($this, 'taskshowOnClick'); $row->add(new ClickLink('taskedit'))->onClick($this, 'taskeditOnClick'); $row->add(new ClickLink('taskpay'))->onClick($this, 'taskpayOnClick'); + if ($task->state == Document::STATE_CLOSED){ + $row->taskedit->setVisible(false); + } } //панель кнопок diff --git a/www/templates/pages/reference/eqlist.html b/www/templates/pages/reference/eqlist.html index 1eb03feb3..a2bf685b4 100644 --- a/www/templates/pages/reference/eqlist.html +++ b/www/templates/pages/reference/eqlist.html @@ -41,10 +41,11 @@

Справочник оборудования

- - - - + + +   +   +
@@ -100,6 +101,30 @@

Редактирование

+
+ + + К списку +

+ + + + + + + + + + + + + + + + +
НарядУчасток
+ +
From 0d0608907a669a558ba2b827bdc59619eddc3df1 Mon Sep 17 00:00:00 2001 From: Leon Date: Sat, 8 Jun 2019 19:57:41 +0300 Subject: [PATCH 03/17] =?UTF-8?q?=D1=81=D1=80=D0=BE=D0=BA=20=D0=B3=D0=BE?= =?UTF-8?q?=D0=B4=D0=BD=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app/entity/item.php | 2 ++ www/app/pages/reference/itemlist.php | 5 ++++- www/templates/pages/reference/itemlist.html | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/www/app/entity/item.php b/www/app/entity/item.php index ad4c20554..9ca0ce445 100644 --- a/www/app/entity/item.php +++ b/www/app/entity/item.php @@ -33,6 +33,7 @@ protected function afterLoad() { $this->curname = (string) ($xml->curname[0]); $this->currate = doubleval($xml->currate[0]); $this->pricelist = (int) $xml->pricelist[0]; + $this->term = (int) $xml->term[0]; @@ -45,6 +46,7 @@ protected function beforeSave() { $this->detail = ""; //упаковываем данные в detail $this->detail .= "{$this->pricelist}"; + $this->detail .= "{$this->term}"; $this->detail .= "{$this->price1}"; $this->detail .= "{$this->price2}"; diff --git a/www/app/pages/reference/itemlist.php b/www/app/pages/reference/itemlist.php index 624a5938d..bda7b3f5e 100644 --- a/www/app/pages/reference/itemlist.php +++ b/www/app/pages/reference/itemlist.php @@ -83,6 +83,7 @@ public function __construct($add = false) { } $this->itemdetail->add(new TextInput('editbarcode')); $this->itemdetail->add(new TextInput('editminqty')); + $this->itemdetail->add(new TextInput('editterm')); $this->itemdetail->add(new TextInput('editmsr')); $this->itemdetail->add(new DropDownChoice('editcat', Category::findArray("cat_name", "", "cat_name"), 0)); $this->itemdetail->add(new TextInput('editcode')); @@ -174,6 +175,7 @@ public function editOnClick($sender) { $this->itemdetail->editcode->setText($this->_item->item_code); $this->itemdetail->editbarcode->setText($this->_item->bar_code); $this->itemdetail->editmsr->setText($this->_item->msr); + $this->itemdetail->editterm->setText( $this->_item->term); $this->itemdetail->editminqty->setText( \App\Helper::fqty($this->_item->minqty)); $this->itemdetail->editdisabled->setChecked($this->_item->disabled); $this->itemdetail->editpricelist->setChecked($this->_item->pricelist); @@ -215,10 +217,11 @@ public function OnSubmit($sender) { $this->_item->bar_code = trim($this->itemdetail->editbarcode->getText()); $this->_item->msr = $this->itemdetail->editmsr->getText(); + $this->_item->term = $this->itemdetail->editterm->getText(); $this->_item->minqty = $this->itemdetail->editminqty->getText(); $this->_item->description = $this->itemdetail->editdescription->getText(); $this->_item->disabled = $this->itemdetail->editdisabled->isChecked() ? 1 : 0; - ; + $this->_item->pricelist = $this->itemdetail->editpricelist->isChecked() ? 1 : 0; //проверка уникальности артикула diff --git a/www/templates/pages/reference/itemlist.html b/www/templates/pages/reference/itemlist.html index c75930485..6925bec37 100644 --- a/www/templates/pages/reference/itemlist.html +++ b/www/templates/pages/reference/itemlist.html @@ -121,6 +121,12 @@

Редактирование товара

+
+ +
+ +
+
From e85ad9e8e6c6966456c4ac6b7af360c498743d64 Mon Sep 17 00:00:00 2001 From: Leon Date: Sat, 8 Jun 2019 23:04:25 +0300 Subject: [PATCH 04/17] =?UTF-8?q?=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=20=20=D0=B2=20=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app/application.php | 14 +++---- www/app/helper.php | 8 +--- www/app/{ => modules}/shop/basket.php | 2 +- www/app/{ => modules}/shop/comparelist.php | 2 +- .../shop/entity/manufacturer.php | 2 +- www/app/{ => modules}/shop/entity/order.php | 2 +- .../{ => modules}/shop/entity/orderdetail.php | 2 +- www/app/{ => modules}/shop/entity/product.php | 4 +- .../shop/entity/productattribute.php | 2 +- .../shop/entity/productcomment.php | 2 +- .../shop/entity/productgroup.php | 2 +- www/app/{ => modules}/shop/helper.php | 8 ++-- www/app/{ => modules}/shop/pages/aboutus.php | 2 +- www/app/{ => modules}/shop/pages/base.php | 10 ++--- www/app/{ => modules}/shop/pages/catalog.php | 18 ++++----- www/app/{ => modules}/shop/pages/compare.php | 8 ++-- www/app/{ => modules}/shop/pages/contact.php | 2 +- www/app/{ => modules}/shop/pages/delivery.php | 2 +- .../{ => modules}/shop/pages/grouplist.php | 10 ++--- www/app/{ => modules}/shop/pages/main.php | 10 ++--- .../shop/pages/manufacturers.php | 8 ++-- www/app/{ => modules}/shop/pages/options.php | 4 +- www/app/{ => modules}/shop/pages/order.php | 12 +++--- .../{ => modules}/shop/pages/productlist.php | 18 ++++----- .../{ => modules}/shop/pages/productview.php | 18 ++++----- www/app/pages/base.php | 2 + www/app/pages/options.php | 6 +-- www/index.php | 4 +- .../{ => modules}/shop/pages/aboutus.html | 0 .../{ => modules}/shop/pages/base.html | 0 .../{ => modules}/shop/pages/catalog.html | 0 .../{ => modules}/shop/pages/compare.html | 0 .../{ => modules}/shop/pages/contact.html | 0 .../{ => modules}/shop/pages/delivery.html | 0 .../{ => modules}/shop/pages/grouplist.html | 0 .../{ => modules}/shop/pages/main.html | 0 .../shop/pages/manufacturers.html | 0 .../{ => modules}/shop/pages/options.html | 0 .../{ => modules}/shop/pages/order.html | 0 .../{ => modules}/shop/pages/productlist.html | 0 .../{ => modules}/shop/pages/productview.html | 0 www/templates/pages/base.html | 40 ++++++++++--------- www/templates/pages/options.html | 8 +--- www/templates/pages/users.html | 14 ++++--- 44 files changed, 122 insertions(+), 124 deletions(-) rename www/app/{ => modules}/shop/basket.php (97%) rename www/app/{ => modules}/shop/comparelist.php (98%) rename www/app/{ => modules}/shop/entity/manufacturer.php (94%) rename www/app/{ => modules}/shop/entity/order.php (98%) rename www/app/{ => modules}/shop/entity/orderdetail.php (90%) rename www/app/{ => modules}/shop/entity/product.php (97%) rename www/app/{ => modules}/shop/entity/productattribute.php (95%) rename www/app/{ => modules}/shop/entity/productcomment.php (93%) rename www/app/{ => modules}/shop/entity/productgroup.php (95%) rename www/app/{ => modules}/shop/helper.php (98%) rename www/app/{ => modules}/shop/pages/aboutus.php (87%) rename www/app/{ => modules}/shop/pages/base.php (86%) rename www/app/{ => modules}/shop/pages/catalog.php (94%) rename www/app/{ => modules}/shop/pages/compare.php (94%) rename www/app/{ => modules}/shop/pages/contact.php (97%) rename www/app/{ => modules}/shop/pages/delivery.php (87%) rename www/app/{ => modules}/shop/pages/grouplist.php (98%) rename www/app/{ => modules}/shop/pages/main.php (86%) rename www/app/{ => modules}/shop/pages/manufacturers.php (95%) rename www/app/{ => modules}/shop/pages/options.php (98%) rename www/app/{ => modules}/shop/pages/order.php (95%) rename www/app/{ => modules}/shop/pages/productlist.php (96%) rename www/app/{ => modules}/shop/pages/productview.php (94%) rename www/templates/{ => modules}/shop/pages/aboutus.html (100%) rename www/templates/{ => modules}/shop/pages/base.html (100%) rename www/templates/{ => modules}/shop/pages/catalog.html (100%) rename www/templates/{ => modules}/shop/pages/compare.html (100%) rename www/templates/{ => modules}/shop/pages/contact.html (100%) rename www/templates/{ => modules}/shop/pages/delivery.html (100%) rename www/templates/{ => modules}/shop/pages/grouplist.html (100%) rename www/templates/{ => modules}/shop/pages/main.html (100%) rename www/templates/{ => modules}/shop/pages/manufacturers.html (100%) rename www/templates/{ => modules}/shop/pages/options.html (100%) rename www/templates/{ => modules}/shop/pages/order.html (100%) rename www/templates/{ => modules}/shop/pages/productlist.html (100%) rename www/templates/{ => modules}/shop/pages/productview.html (100%) diff --git a/www/app/application.php b/www/app/application.php index 2bd48faf4..96f88b1f9 100644 --- a/www/app/application.php +++ b/www/app/application.php @@ -101,15 +101,15 @@ public function Route($uri) { $arr = explode('/', $uri); $pages = array( - "shop" => "\\App\\Shop\\Pages\\Main", + "shop" => "\\App\\Modules\\Shop\\Pages\\Main", "store" => "\\App\\Pages\\Main", - "sp" => "\\App\\Shop\\Pages\\ProductView", - "aboutus" => "\\App\\Shop\\Pages\\AboutUs", - "delivery" => "\\App\\Shop\\Pages\\Delivery", - "contact" => "\\App\\Shop\\Pages\\Contact", + "sp" => "\\App\\Modules\\Shop\\Pages\\ProductView", + "aboutus" => "\\App\\Modules\\Shop\\Pages\\AboutUs", + "delivery" => "\\App\\Modules\\Shop\\Pages\\Delivery", + "contact" => "\\App\\Modules\\Shop\\Pages\\Contact", "simage" => "\\App\\Pages\\LoadImage", - "scat" => "\\App\\Shop\\Pages\\Main", - "pcat" => "\\App\\Shop\\Pages\\Catalog" + "scat" => "\\App\\Modules\\Shop\\Pages\\Main", + "pcat" => "\\App\\Modules\\Shop\\Pages\\Catalog" ); if (strlen($pages[$arr[0]]) > 0) { diff --git a/www/app/helper.php b/www/app/helper.php index d0d0b9645..b561c37fb 100644 --- a/www/app/helper.php +++ b/www/app/helper.php @@ -90,9 +90,7 @@ public static function generateMenu($meta_type) { case 4 : $dir = "Pages/Reference"; break; - case 5 : - $dir = "Shop/Pages"; - break; + } $textmenu = ""; @@ -145,9 +143,7 @@ public static function generateSmartMenu() { case 4 : $dir = "Pages/Reference"; break; - case 5 : - $dir = "Shop/Pages"; - break; + } $textmenu .= " {$item['description']} "; diff --git a/www/app/shop/basket.php b/www/app/modules/shop/basket.php similarity index 97% rename from www/app/shop/basket.php rename to www/app/modules/shop/basket.php index 11826877c..33ef1d48a 100644 --- a/www/app/shop/basket.php +++ b/www/app/modules/shop/basket.php @@ -1,6 +1,6 @@ group_id); - $attrlist = \App\Shop\Helper::getProductAttributeListByGroup($this->group_id); + $attrlist = \App\Modules\Shop\Helper::getProductAttributeListByGroup($this->group_id); $ret = array(); $attrvalues = array(); diff --git a/www/app/shop/entity/productattribute.php b/www/app/modules/shop/entity/productattribute.php similarity index 95% rename from www/app/shop/entity/productattribute.php rename to www/app/modules/shop/entity/productattribute.php index d95e81125..a626da3e8 100644 --- a/www/app/shop/entity/productattribute.php +++ b/www/app/modules/shop/entity/productattribute.php @@ -1,6 +1,6 @@ _tvars["islogined"] = $user->user_id > 0; - $this->add(new \Zippy\Html\Link\BookmarkableLink('shopcart', "/index.php?p=/App/Shop/Pages/Order"))->setVisible(false); - $this->add(new \Zippy\Html\Link\BookmarkableLink('showcompare', "/index.php?p=/App/Shop/Pages/Compare"))->setVisible(false); + $this->add(new \Zippy\Html\Link\BookmarkableLink('shopcart', "/index.php?p=/App/Modules/Shop/Pages/Order"))->setVisible(false); + $this->add(new \Zippy\Html\Link\BookmarkableLink('showcompare', "/index.php?p=/App/Modules/Shop/Pages/Compare"))->setVisible(false); $this->op = System::getOptions("shop"); @@ -51,8 +51,8 @@ final protected function isError() { } protected function beforeRender() { - $this->shopcart->setVisible(\App\Shop\Basket::getBasket()->isEmpty() == false); - $this->showcompare->setVisible(\App\Shop\CompareList::getCompareList()->isEmpty() == false); + $this->shopcart->setVisible(\App\Modules\Shop\Basket::getBasket()->isEmpty() == false); + $this->showcompare->setVisible(\App\Modules\Shop\CompareList::getCompareList()->isEmpty() == false); } protected function afterRender() { diff --git a/www/app/shop/pages/catalog.php b/www/app/modules/shop/pages/catalog.php similarity index 94% rename from www/app/shop/pages/catalog.php rename to www/app/modules/shop/pages/catalog.php index ebef37024..674d6a578 100644 --- a/www/app/shop/pages/catalog.php +++ b/www/app/modules/shop/pages/catalog.php @@ -1,6 +1,6 @@ sfilter->add(new ClickLink('sclear'))->onClick($this, 'onSClear'); $this->sfilter->add(new ManufacturerList('mlist')); - foreach (\App\Shop\Entity\Manufacturer::find("manufacturer_id in(select manufacturer_id from shop_products where deleted <> 1 and group_id={$this->group_id})", "manufacturername") as $key => $value) { + foreach (\App\Modules\Shop\Entity\Manufacturer::find("manufacturer_id in(select manufacturer_id from shop_products where deleted <> 1 and group_id={$this->group_id})", "manufacturername") as $key => $value) { $this->sfilter->mlist->AddCheckBox($key, false, $value->manufacturername); } $this->sfilter->add(new DataView('attrlist', new ArrayDataSource(Helper::getProductSearchAttributeListByGroup($this->group_id)), $this, 'attrlistOnRow'))->Reload(); @@ -80,7 +80,7 @@ public function __construct($id) { } } $this->add(new Panel("recentlyp"))->setVisible(count($ra) > 0); - $this->recentlyp->add(new DataView('rlist', new EntityDataSource("\\App\\Shop\\Entity\\Product", " product_id in (" . implode(",", $ra) . ")"), $this, 'rOnRow')); + $this->recentlyp->add(new DataView('rlist', new EntityDataSource("\\App\\Modules\\Shop\\Entity\\Product", " product_id in (" . implode(",", $ra) . ")"), $this, 'rOnRow')); if (count($ra) > 0) { $this->recentlyp->rlist->Reload(); } @@ -110,12 +110,12 @@ public function plistOnRow($row) { public function oncartdel($sender) { $item = $sender->getOwner()->getDataItem(); - \App\Shop\Basket::getBasket()->deleteProduct($item->product_id); + \App\Modules\Shop\Basket::getBasket()->deleteProduct($item->product_id); } public function oncompdel($sender) { $item = $sender->getOwner()->getDataItem(); - \App\Shop\CompareList::getCompareList()->deleteProduct($item->product_id); + \App\Modules\Shop\CompareList::getCompareList()->deleteProduct($item->product_id); } public function rOnRow($row) { @@ -138,7 +138,7 @@ public function OnBuy($sender) { $product = $sender->getOwner()->getDataItem(); $product->quantity = 1; - \App\Shop\Basket::getBasket()->addProduct($product); + \App\Modules\Shop\Basket::getBasket()->addProduct($product); $this->setSuccess("Товар добавлен в корзину"); $this->resetURL(); diff --git a/www/app/shop/pages/compare.php b/www/app/modules/shop/pages/compare.php similarity index 94% rename from www/app/shop/pages/compare.php rename to www/app/modules/shop/pages/compare.php index 3b2059476..e56b0275b 100644 --- a/www/app/shop/pages/compare.php +++ b/www/app/modules/shop/pages/compare.php @@ -1,9 +1,9 @@ deleteProduct($params[0]); if ($comparelist->isEmpty()) { $filter = \App\Filter::getFilter("ProductCatalog"); - App::Redirect("\\App\\Shop\\Pages\\Catalog", $filter->group_id); + App::Redirect("\\App\\Modules\\Shop\\Pages\\Catalog", $filter->group_id); } } diff --git a/www/app/shop/pages/contact.php b/www/app/modules/shop/pages/contact.php similarity index 97% rename from www/app/shop/pages/contact.php rename to www/app/modules/shop/pages/contact.php index c61be87f3..fae380e5b 100644 --- a/www/app/shop/pages/contact.php +++ b/www/app/modules/shop/pages/contact.php @@ -1,6 +1,6 @@ add(new Panel("subcatlistp")); $this->subcatlistp->setVisible($id > 0); - $this->subcatlistp->add(new DataView("subcatlist", new EntityDataSource("\\App\\Shop\\Entity\\ProductGroup", "parent_id=" . $id), $this, 'OnCatRow')); + $this->subcatlistp->add(new DataView("subcatlist", new EntityDataSource("\\App\\Modules\\Shop\\Entity\\ProductGroup", "parent_id=" . $id), $this, 'OnCatRow')); if ($id > 0) $this->subcatlistp->subcatlist->Reload(); $this->add(new Panel("newlistp")); - $this->newlistp->add(new DataView("newlist", new EntityDataSource("\\App\\Shop\\Entity\\Product", "", "product_id desc", 12), $this, 'OnNewRow'))->Reload(); + $this->newlistp->add(new DataView("newlist", new EntityDataSource("\\App\\Modules\\Shop\\Entity\\Product", "", "product_id desc", 12), $this, 'OnNewRow'))->Reload(); } public function OnCatRow($datarow) { diff --git a/www/app/shop/pages/manufacturers.php b/www/app/modules/shop/pages/manufacturers.php similarity index 95% rename from www/app/shop/pages/manufacturers.php rename to www/app/modules/shop/pages/manufacturers.php index d3a478f0c..08de5980f 100644 --- a/www/app/shop/pages/manufacturers.php +++ b/www/app/modules/shop/pages/manufacturers.php @@ -1,12 +1,12 @@ add(new \Zippy\Html\Panel('list')); - $panellist->add(new DataView("manufacturerslist", new \ZCL\DB\EntityDataSource('\App\Shop\Entity\Manufacturer'), $this, 'OnAddRow')); + $panellist->add(new DataView("manufacturerslist", new \ZCL\DB\EntityDataSource('\App\Modules\Shop\Entity\Manufacturer'), $this, 'OnAddRow')); $panellist->add(new \Zippy\Html\Link\ClickLink('addnew', $this, 'OnAddClick')); diff --git a/www/app/shop/pages/options.php b/www/app/modules/shop/pages/options.php similarity index 98% rename from www/app/shop/pages/options.php rename to www/app/modules/shop/pages/options.php index c63a57869..c1c864448 100644 --- a/www/app/shop/pages/options.php +++ b/www/app/modules/shop/pages/options.php @@ -1,6 +1,6 @@ basketlist = Basket::getBasket()->list; if (Basket::getBasket()->isEmpty()) { - App::Redirect("\\App\\Shop\\Pages\\Catalog", 0); + App::Redirect("\\App\\Modules\\Shop\\Pages\\Catalog", 0); } else { $this->OnUpdate($this); } @@ -164,7 +164,7 @@ public function OnSave($sender) { public function OnAddRow(\Zippy\Html\DataList\DataRow $datarow) { $item = $datarow->getDataItem(); $datarow->setDataItem($item); - $datarow->add(new \Zippy\Html\Link\RedirectLink('pname', '\App\Shop\Pages\ProductView', $item->product_id))->setValue($item->productname); + $datarow->add(new \Zippy\Html\Link\RedirectLink('pname', '\App\Modules\Shop\Pages\ProductView', $item->product_id))->setValue($item->productname); $datarow->add(new Label('price', $item->price)); $datarow->add(new TextInput('quantity', new \Zippy\Binding\PropertyBinding($item, 'quantity'))); $datarow->add(new \Zippy\Html\Link\ClickLink('delete', $this, 'OnDelete')); diff --git a/www/app/shop/pages/productlist.php b/www/app/modules/shop/pages/productlist.php similarity index 96% rename from www/app/shop/pages/productlist.php rename to www/app/modules/shop/pages/productlist.php index 24cdf491c..3d79d2e0d 100644 --- a/www/app/shop/pages/productlist.php +++ b/www/app/modules/shop/pages/productlist.php @@ -1,6 +1,6 @@ listpanel->add(new Form('searchform'))->onSubmit($this, 'searchformOnSubmit'); $this->listpanel->searchform->add(new TextInput('skeyword')); $this->listpanel->searchform->add(new CheckBox('sstatus')); - $this->listpanel->searchform->add(new DropDownChoice('smanuf', \App\Shop\Entity\Manufacturer::findArray('manufacturername', '', 'manufacturername'))); + $this->listpanel->searchform->add(new DropDownChoice('smanuf', \App\Modules\Shop\Entity\Manufacturer::findArray('manufacturername', '', 'manufacturername'))); $this->listpanel->searchform->add(new ClickLink('sclear'))->onClick($this, 'onSClear'); $this->listpanel->add(new Form('sortform')); $this->listpanel->sortform->add(new DropDownChoice('sorting'))->onChange($this, 'sortingOnChange'); @@ -84,8 +84,8 @@ public function __construct() { $editform->add(new TextArea('edescshort')); $editform->add(new TextArea('edescdet')); - $editform->add(new DropDownChoice('emanuf', \App\Shop\Entity\Manufacturer::findArray('manufacturername', '', 'manufacturername'))); - $editform->add(new DropDownChoice('egroup', \App\Shop\Entity\ProductGroup::findArray('groupname', 'group_id not in (select parent_id from shop_productgroups)', 'groupname'))); + $editform->add(new DropDownChoice('emanuf', \App\Modules\Shop\Entity\Manufacturer::findArray('manufacturername', '', 'manufacturername'))); + $editform->add(new DropDownChoice('egroup', \App\Modules\Shop\Entity\ProductGroup::findArray('groupname', 'group_id not in (select parent_id from shop_productgroups)', 'groupname'))); diff --git a/www/app/shop/pages/productview.php b/www/app/modules/shop/pages/productview.php similarity index 94% rename from www/app/shop/pages/productview.php rename to www/app/modules/shop/pages/productview.php index d8d8ae54f..17a572ba0 100644 --- a/www/app/shop/pages/productview.php +++ b/www/app/modules/shop/pages/productview.php @@ -1,16 +1,16 @@ add(new \Zippy\Html\DataList\DataView('attributelist', new \Zippy\Html\DataList\ArrayDataSource($list), $this, 'OnAddAttributeRow'))->Reload(); $this->add(new ClickLink('buy', $this, 'OnBuy')); $this->add(new ClickLink('addtocompare', $this, 'OnAddCompare')); - $this->add(new RedirectLink('compare', "\\App\\Shop\\Pages\\Compare"))->setVisible(false); + $this->add(new RedirectLink('compare', "\\App\\Modules\\Shop\\Pages\\Compare"))->setVisible(false); $form = $this->add(new \Zippy\Html\Form\Form('formcomment')); $form->onSubmit($this, 'OnComment'); @@ -125,7 +125,7 @@ public function OnAddAttributeRow(\Zippy\Html\DataList\DataRow $datarow) { public function OnBuy($sender) { $product = Product::load($this->product_id); $product->quantity = 1; - \App\Shop\Basket::getBasket()->addProduct($product); + \App\Modules\Shop\Basket::getBasket()->addProduct($product); $this->setSuccess("Товар добавлен в корзину"); //$this->resetURL(); App::RedirectURI('/pcat/' . $product->group_id); @@ -134,7 +134,7 @@ public function OnBuy($sender) { //добавить к форме сравнения public function OnAddCompare($sender) { $product = Product::load($this->product_id); - $comparelist = \App\Shop\CompareList::getCompareList(); + $comparelist = \App\Modules\Shop\CompareList::getCompareList(); if (false == $comparelist->addProduct($product)) { $this->setWarn('Добавлять можно только товары с одинаковой категорией'); return; @@ -146,7 +146,7 @@ public function OnAddCompare($sender) { public function OnComment($sender) { - $comment = new \App\Shop\Entity\ProductComment(); + $comment = new \App\Modules\Shop\Entity\ProductComment(); $comment->product_id = $this->product_id; $comment->author = $this->formcomment->nick->getText(); $comment->comment = $this->formcomment->comment->getText(); @@ -172,7 +172,7 @@ protected function beforeRender() { App::addJavaScript("openComments();", true); $this->gotocomment = false; } - if (\App\Shop\CompareList::getCompareList()->hasProsuct($this->product_id)) { + if (\App\Modules\Shop\CompareList::getCompareList()->hasProsuct($this->product_id)) { $this->compare->setVisible(true); $this->addtocompare->setVisible(false); } else { diff --git a/www/app/pages/base.php b/www/app/pages/base.php index e58bfa347..582c01383 100644 --- a/www/app/pages/base.php +++ b/www/app/pages/base.php @@ -63,6 +63,8 @@ public function __construct($params = null) { $this->_tvars["shop"] = $_config['modules']['shop'] == 1; $this->_tvars["ocstore"] = $_config['modules']['ocstore'] == 1; + //если включен хоть один модуль + $this->_tvars["modules"] = $this->_tvars["shop"] || $this->_tvars["ocstore"]; } diff --git a/www/app/pages/options.php b/www/app/pages/options.php index f93a00436..b9d9db709 100644 --- a/www/app/pages/options.php +++ b/www/app/pages/options.php @@ -87,7 +87,7 @@ public function __construct() { $this->listpan->filter->add(new CheckBox('fdic'))->setChecked(true); $this->listpan->filter->add(new CheckBox('frep'))->setChecked(true); $this->listpan->filter->add(new CheckBox('freg'))->setChecked(true); - $this->listpan->filter->add(new CheckBox('fshop'))->setChecked(true); + $this->listpan->add(new ClickLink('addnew'))->onClick($this, 'addnewOnClick'); $this->listpan->add(new DataView('metarow', $this->metadatads, $this, 'metarowOnRow'))->Reload(); @@ -158,9 +158,7 @@ public function filterOnSubmit($sender) { if ($this->listpan->filter->freg->isChecked()) { $where .= " or meta_type = 3"; } - if ($this->listpan->filter->fshop->isChecked()) { - $where .= " or meta_type = 5"; - } + $this->metadatads->setWhere($where); diff --git a/www/index.php b/www/index.php index 912eec57b..6eabbd4d4 100644 --- a/www/index.php +++ b/www/index.php @@ -29,8 +29,8 @@ $app = new \App\Application(); - if($_config['common']['shop'] == 1){ - $app->Run('\App\Shop\Pages\Main'); + if($_config['modules']['shop'] == 1){ + $app->Run('\App\Modules\Shop\Pages\Main'); } else { $app->Run('\App\Pages\Main'); } diff --git a/www/templates/shop/pages/aboutus.html b/www/templates/modules/shop/pages/aboutus.html similarity index 100% rename from www/templates/shop/pages/aboutus.html rename to www/templates/modules/shop/pages/aboutus.html diff --git a/www/templates/shop/pages/base.html b/www/templates/modules/shop/pages/base.html similarity index 100% rename from www/templates/shop/pages/base.html rename to www/templates/modules/shop/pages/base.html diff --git a/www/templates/shop/pages/catalog.html b/www/templates/modules/shop/pages/catalog.html similarity index 100% rename from www/templates/shop/pages/catalog.html rename to www/templates/modules/shop/pages/catalog.html diff --git a/www/templates/shop/pages/compare.html b/www/templates/modules/shop/pages/compare.html similarity index 100% rename from www/templates/shop/pages/compare.html rename to www/templates/modules/shop/pages/compare.html diff --git a/www/templates/shop/pages/contact.html b/www/templates/modules/shop/pages/contact.html similarity index 100% rename from www/templates/shop/pages/contact.html rename to www/templates/modules/shop/pages/contact.html diff --git a/www/templates/shop/pages/delivery.html b/www/templates/modules/shop/pages/delivery.html similarity index 100% rename from www/templates/shop/pages/delivery.html rename to www/templates/modules/shop/pages/delivery.html diff --git a/www/templates/shop/pages/grouplist.html b/www/templates/modules/shop/pages/grouplist.html similarity index 100% rename from www/templates/shop/pages/grouplist.html rename to www/templates/modules/shop/pages/grouplist.html diff --git a/www/templates/shop/pages/main.html b/www/templates/modules/shop/pages/main.html similarity index 100% rename from www/templates/shop/pages/main.html rename to www/templates/modules/shop/pages/main.html diff --git a/www/templates/shop/pages/manufacturers.html b/www/templates/modules/shop/pages/manufacturers.html similarity index 100% rename from www/templates/shop/pages/manufacturers.html rename to www/templates/modules/shop/pages/manufacturers.html diff --git a/www/templates/shop/pages/options.html b/www/templates/modules/shop/pages/options.html similarity index 100% rename from www/templates/shop/pages/options.html rename to www/templates/modules/shop/pages/options.html diff --git a/www/templates/shop/pages/order.html b/www/templates/modules/shop/pages/order.html similarity index 100% rename from www/templates/shop/pages/order.html rename to www/templates/modules/shop/pages/order.html diff --git a/www/templates/shop/pages/productlist.html b/www/templates/modules/shop/pages/productlist.html similarity index 100% rename from www/templates/shop/pages/productlist.html rename to www/templates/modules/shop/pages/productlist.html diff --git a/www/templates/shop/pages/productview.html b/www/templates/modules/shop/pages/productview.html similarity index 100% rename from www/templates/shop/pages/productview.html rename to www/templates/modules/shop/pages/productview.html diff --git a/www/templates/pages/base.html b/www/templates/pages/base.html index 2b79dada7..800df5444 100644 --- a/www/templates/pages/base.html +++ b/www/templates/pages/base.html @@ -151,26 +151,15 @@

Zippy Скла

- {{#shop}} - - {{/shop}} - {{#ocstore}} + + {{#modules}} {{/ocstore}} - + + {{/modules}}