diff --git a/www/app/api/items.php b/www/app/api/items.php
index f7483d78f..8a3352e83 100644
--- a/www/app/api/items.php
+++ b/www/app/api/items.php
@@ -207,13 +207,7 @@ public function save($args) {
$item->thumb = "data:{$image->mime};base64," . base64_encode($thumb->getImageAsString());
}
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
-
+
$image->save();
$item->image_id = $image->image_id;
diff --git a/www/app/entity/customer.php b/www/app/entity/customer.php
index 9253ecb5f..b36f08762 100644
--- a/www/app/entity/customer.php
+++ b/www/app/entity/customer.php
@@ -61,6 +61,8 @@ protected function beforeSave() {
$this->detail .= "comment}]]> ";
$this->detail .= "";
+
+
return true;
}
@@ -100,6 +102,11 @@ protected function afterLoad() {
parent::afterLoad();
}
+ public function afterSave($update) {
+ if($update==false) {
+ \App\Entity\Subscribe::onNewCustomer($this->customer_id) ;
+ }
+ }
public function beforeDelete() {
$conn = \ZDB\DB::getConnect();
diff --git a/www/app/entity/doc/document.php b/www/app/entity/doc/document.php
index 44c6a6543..43e878f5e 100644
--- a/www/app/entity/doc/document.php
+++ b/www/app/entity/doc/document.php
@@ -645,9 +645,6 @@ public function nextNumber($branch_id = 0) {
$branch = " and branch_id=" . $branch_id;
}
$limit =" limit 0,1";
- if($conn->dataProvider=="postgres") {
- $limit =" limit 1";
- }
$sql = "select document_number from documents where meta_id='{$this->meta_id}' {$branch} order by document_id desc ".$limit;
$prevnumber = $conn->GetOne($sql);
if (strlen($prevnumber) == 0) {
diff --git a/www/app/entity/item.php b/www/app/entity/item.php
index 30141ef74..9f2b78003 100644
--- a/www/app/entity/item.php
+++ b/www/app/entity/item.php
@@ -671,9 +671,7 @@ public function getNearestSerie($store_id = 0) {
}
$limit =" limit 0,1";
- if($conn->dataProvider=="postgres") {
- $limit =" limit 1";
- }
+
$sql .= " order by sdate desc ". $limit;
diff --git a/www/app/entity/stock.php b/www/app/entity/stock.php
index c056a2c9e..3ccfbca81 100644
--- a/www/app/entity/stock.php
+++ b/www/app/entity/stock.php
@@ -152,9 +152,7 @@ public static function pickup($store_id, $item) {
if ($last == null) {
$conn = \ZDB\DB::getConnect();
$limit =" limit 0,1";
- if($conn->dataProvider=="postgres") {
- $limit =" limit 1";
- }
+
$lastpartion = $conn->GetOne("select coalesce(partion,0) from store_stock where qty > 0 and item_id={$item->item_id} order by stock_id desc ".$limit);
if ($lastpartion == 0) {
$lastpartion = $item->price/2; //типа учетная цена
diff --git a/www/app/entity/subscribe.php b/www/app/entity/subscribe.php
index b41923a89..8fe2d941e 100644
--- a/www/app/entity/subscribe.php
+++ b/www/app/entity/subscribe.php
@@ -82,7 +82,7 @@ protected function beforeSave() {
public static function getEventList() {
$list = array();
$list[self::EVENT_DOCSTATE] = "Зміна статусу документа";
- // $list[self::EVENT_NEWCUST] = "Новий контрвгент";
+ $list[self::EVENT_NEWCUST] = "Новий контрвгент";
return $list;
}
@@ -105,14 +105,12 @@ public static function getMsgTypeList($rt=0) {
if($sms['smstype']==2) {
$list[self::MSG_VIBER] = "Viber";
}
+
if(strlen(\App\System::getOption("common", 'tbtoken'))>0) {
$list[self::MSG_BOT] = "Телеграм бот";
-
}
-
if($rt==self::RSV_CUSTOMER) {
- unset($list[self::MSG_BOT]) ;
unset($list[self::MSG_NOTIFY]) ;
}
@@ -156,85 +154,141 @@ public static function onDocumentState($doc_id, $state) {
continue;
}
-
-
- $ret = '';
- $phone = '';
- $viber = '';
- $chat_id = '';
- // $viber='';
- $email = '';
- $notify = 0;
+ $options=[];
+ $c=null;
+ $u=null;
+
+
if ($sub->reciever_type == self::RSV_CUSTOMER) {
- $c = \App\Entity\Customer::load($doc->customer_id);
- if ($c != null && $c->nosubs != 1) {
- $phone = $c->phone;
- $viber = $c->viber;
- $email = $c->email;
- $chat_id = $c->chat_id;
+ if($c->nosubs != 1) {
+ $c = \App\Entity\Customer::load($doc->customer_id);
}
}
if ($sub->reciever_type == self::RSV_DOCAUTHOR) {
- $u = \App\Entity\User::load($doc->user_id);
- if ($u != null) {
- $phone = $u->phone;
- $viber = $u->viber;
- $email = $u->email;
- $chat_id = $u->chat_id;
- $notify = $doc->user_id;
- }
+ $u = \App\Entity\User::load($doc->headerdata['author']);
}
if ($sub->reciever_type == self::RSV_USER) {
$u = \App\Entity\User::load($sub->user_id);
- if ($u != null) {
- $phone = $u->phone;
- $viber = $u->viber;
- $email = $u->email;
- $chat_id = $u->chat_id;
- $notify = $sub->user_id;
- }
+ }
+
+
+ if ($c != null ) {
+ $options['phone'] = $c->phone;
+ $options['viber'] = $c->viber;
+ $options['email'] = $c->email;
+ $options['chat_id'] = $c->chat_id;
}
+
+ if ($u != null) {
+ $options['phone'] = $u->phone;
+ $options['viber'] = $u->viber;
+ $options['email'] = $u->email;
+ $options['chat_id'] = $u->chat_id;
+ $options['notifyuser'] = $doc->user_id;
+ }
+ $options['doc'] = $doc;
+
$text = $sub->getTextDoc($doc);
- if ($notify > 0 && $sub->msg_type == self::MSG_NOTIFY) {
- self::sendNotify($notify, $text);
+
+
+ $text = $sub->sendmsg($text,$options);
+
+
+
+
+ }
+ }
+
+ //Новый контрагент
+ public static function onNewCustomer($customer_id) {
+ $c = \App\Entity\Customer::load($customer_id);
+
+ $list = self::find('disabled <> 1 and sub_type= ' . self::EVENT_NEWCUST);
+ foreach ($list as $sub) {
+ $options=[];
+
+ $u=null;
+
+
+ if ($sub->reciever_type == self::RSV_CUSTOMER) {
+ if($c->nosubs == 1) {
+ continue;
+ }
}
- if ( $sub->reciever_type== self::RSV_SYSTEM) {
+ if ($sub->reciever_type == self::RSV_USER) {
+ $u = \App\Entity\User::load($sub->user_id);
+ }
+
+
+ if ($c != null ) {
+ $options['phone'] = $c->phone;
+ $options['viber'] = $c->viber;
+ $options['email'] = $c->email;
+ $options['chat_id'] = $c->chat_id;
+ }
+
+ if ($u != null) {
+ $options['phone'] = $u->phone;
+ $options['viber'] = $u->viber;
+ $options['email'] = $u->email;
+ $options['chat_id'] = $u->chat_id;
+ $options['notifyuser'] = $u->user_id;
+ }
+// $options['c'] = $c;
+
+ $text = $sub->getTextCust($c);
+
+
+ $sub->sendmsg($text,$options);
+
+
+
+
+ }
+ }
+
+
+ private function sendmsg($text, $options=[]){
+ if ($options['notifyuser'] > 0 && $this->msg_type == self::MSG_NOTIFY) {
+ self::sendNotify($options['notifyuser'], $text);
+ }
+ if ( $this->reciever_type== self::RSV_SYSTEM) {
self::sendNotify(\App\Entity\Notify::SYSTEM, $text);
}
- if (strlen($phone) > 0 && $sub->msg_type == self::MSG_SMS) {
- $ret = self::sendSMS($phone, $text);
+ if (strlen($options['phone']) > 0 && $this->msg_type == self::MSG_SMS) {
+ $ret = self::sendSMS($options['phone'], $text);
}
- if (strlen($email) > 0 && $sub->msg_type == self::MSG_EMAIL) {
+ if (strlen($options['email']) > 0 && $this->msg_type == self::MSG_EMAIL) {
if(System::useCron()) {
$task = new \App\Entity\CronTask();
$task->tasktype=\App\Entity\CronTask::TYPE_SUBSEMAIL;
$task->taskdata= serialize(array(
- 'email'=>$email ,
- 'subject'=>$sub->msgsubject ,
+ 'email'=>$options['email'] ,
+ 'subject'=>$this->msgsubject ,
'text'=>$text ,
- 'document_id'=> $sub->attach==1 ? $doc->document_id : 0
+ 'document_id'=> $this->attach==1 ? $options['doc']->document_id : 0
));
$task->save();
} else {
- $ret = self::sendEmail($email, $text, $sub->msgsubject, $sub->attach==1 ? $doc : null);
+ $ret = self::sendEmail($options['email'], $text, $this->msgsubject, $this->attach==1 ? $options['doc'] : null);
}
}
- if(strlen($viber)==0) {
- $viber = $phone;
+ if(strlen($options['viber'])==0) {
+ $options['viber'] = $options['phone'];
}
- if(strlen($viber)>0 && $sub->msg_type == self::MSG_VIBER) {
- $ret = self::sendViber($viber, $text) ;
+ if(strlen($options['viber'])>0 && $this->msg_type == self::MSG_VIBER) {
+ $ret = self::sendViber($options['viber'], $text) ;
}
- if(strlen($chat_id)>0 && $sub->msg_type == self::MSG_BOT) {
- $ret = self::sendBot($chat_id, $text, $sub->attach==1 ? $doc : null,$sub->html==1) ;
+ if(strlen($options['chat_id'])>0 && $this->msg_type == self::MSG_BOT) {
+ $ret = self::sendBot($options['chat_id'], $text, $this->attach==1 ? $options['doc'] : null,$this->html==1) ;
}
if($sub->reciever_type == self::RSV_WH) {
- $ret = self::sendHook($sub->url, $text) ;
+ $ret = self::sendHook($this->url, $text) ;
}
if(strlen($ret)>0) {
@@ -245,23 +299,34 @@ public static function onDocumentState($doc_id, $state) {
$n->message = $ret;
$n->save();
- return;
- }
-
- if ($sub->reciever_type != self::RSV_SYSTEM ){
-
- // $text="Event: Документ ".$doc->meta_desc . "({$doc->document_number}) ";
- // $text .= (' Стан ' .\App\Entity\Doc\Document::getStateName($doc->state) );
-
- // self::sendNotify(\App\Entity\Notify::SYSTEM, $text);
- }
-
-
+ }
+ }
+
+ /**
+ * возвращает текст с учетом разметки
+ *
+ * @param mixed $c
+ */
+ private function getTextCust($c) {
+ $this->msgtext = str_replace('{', '{{', $this->msgtext);
+ $this->msgtext = str_replace('}', '}}', $this->msgtext);
+ $common = \App\System::getOptions("common");
- }
- }
+ $header = array();
+ $header['customer_id'] = $c->customer_id;
+ $header['customer_name'] = $c->customer_name;
+
+
+ try {
+ $m = new \Mustache_Engine();
+ $text = $m->render($this->msgtext, $header);
+ return $text;
+ } catch(\Exception $e) {
+ return "Помилка розмітки";
+ }
+ }
/**
* возвращает текст с учетом разметки
*
diff --git a/www/app/helper.php b/www/app/helper.php
index 7f483876f..52c11ed72 100644
--- a/www/app/helper.php
+++ b/www/app/helper.php
@@ -367,10 +367,7 @@ public static function addFile($file, $itemid, $comment, $itemtype = 0) {
$data = file_get_contents($file['tmp_name']);
- if($conn->dataProvider=='postgres') {
- $data = pg_escape_bytea($data);
-
- }
+
$data = $conn->qstr($data);
$sql = "insert into filesdata (file_id,filedata) values ({$id},{$data}) ";
$conn->Execute($sql);
@@ -1329,10 +1326,7 @@ public static function checkVer(){
$phpv = phpversion() ;
$conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=="postgres") {
- $phpv = $phpv. '_pg';
- }
-
+
$nocache= "?t=" . time()."&s=". self::getSalt().'&phpv='.$phpv;
diff --git a/www/app/modules/hr/items.php b/www/app/modules/hr/items.php
index 27a4898a7..b40d32882 100644
--- a/www/app/modules/hr/items.php
+++ b/www/app/modules/hr/items.php
@@ -116,11 +116,7 @@ public function onCheck($sender) {
$image->content = $im;
$image->mime = $imagedata['mime'];
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
$image->save();
$c->image_id = $image->image_id;
$c->save();
@@ -456,11 +452,7 @@ public function importOnSubmit($sender) {
$image->content = $im;
$image->mime = $imagedata['mime'];
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
$image->save();
$item->image_id = $image->image_id;
break;
diff --git a/www/app/modules/ocstore/items.php b/www/app/modules/ocstore/items.php
index b7c9e1999..e95fd69a1 100644
--- a/www/app/modules/ocstore/items.php
+++ b/www/app/modules/ocstore/items.php
@@ -342,12 +342,7 @@ public function importOnSubmit($sender) {
$image = new \App\Entity\Image();
$image->content = $im;
$image->mime = $imagedata['mime'];
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
$image->save();
$item->image_id = $image->image_id;
diff --git a/www/app/modules/pu/items.php b/www/app/modules/pu/items.php
index 72b6abc19..7b9fb04ce 100644
--- a/www/app/modules/pu/items.php
+++ b/www/app/modules/pu/items.php
@@ -380,12 +380,7 @@ public function importOnSubmit($sender) {
$image = new \App\Entity\Image();
$image->content = $im;
$image->mime = $imagedata['mime'];
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
$image->save();
$item->image_id = $image->image_id;
diff --git a/www/app/modules/shop/pages/admin/productlist.php b/www/app/modules/shop/pages/admin/productlist.php
index 0a88b0fc1..af4adbd2d 100644
--- a/www/app/modules/shop/pages/admin/productlist.php
+++ b/www/app/modules/shop/pages/admin/productlist.php
@@ -252,12 +252,7 @@ public function onImageSubmit($sender) {
$thumb->resize(512, 512);
$image->thumb = $thumb->getImageAsString();
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
$image->save();
$this->_item->productdata->images[] = $image->image_id;
diff --git a/www/app/modules/wc/items.php b/www/app/modules/wc/items.php
index 1688d2947..5d00e4efc 100644
--- a/www/app/modules/wc/items.php
+++ b/www/app/modules/wc/items.php
@@ -403,11 +403,6 @@ public function onGetItems($sender) {
$image->content = $im;
$image->mime = $imagedata['mime'];
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
$image->save();
$item->image_id = $image->image_id;
break;
@@ -462,11 +457,7 @@ public function onGetItems($sender) {
$image = new \App\Entity\Image();
$image->content = $im;
$image->mime = $imagedata['mime'];
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
$image->save();
$item->image_id = $image->image_id;
diff --git a/www/app/pages/base.php b/www/app/pages/base.php
index b970338b8..1fdfa3953 100644
--- a/www/app/pages/base.php
+++ b/www/app/pages/base.php
@@ -26,6 +26,9 @@ public function __construct($params = null) {
return;
}
+
+
+
$this->_tvars['curversion'] = System::CURR_VERSION ;
$options = System::getOptions('common');
@@ -236,9 +239,7 @@ public function __construct($params = null) {
$w = " TIME_TO_SEC(timediff(now(),lastactive)) <300 ";
- if($conn->dataProvider=="postgres") {
- $w = " EXTRACT(EPOCH FROM now() - lastactive) <300 ";
- }
+
if ($this->branch_id > 0) {
$w .= " and employee_id in (select employee_id from employees where branch_id ={$this->branch_id}) ";
@@ -282,7 +283,10 @@ public function __construct($params = null) {
$this->_tvars['cron'] = true;
}
-
+
+ if($_config['db']['driver'] == 'postgres'){
+ $this->setError('Поддержка Postgres прекращена!') ;
+ }
}
public function LogoutClick($sender) {
diff --git a/www/app/pages/doc/calcsalary.php b/www/app/pages/doc/calcsalary.php
index 25636f4ac..c11e971e0 100644
--- a/www/app/pages/doc/calcsalary.php
+++ b/www/app/pages/doc/calcsalary.php
@@ -289,9 +289,7 @@ public function loaddata($args, $post) {
$sql="select sum(tm) as tm, count(distinct dd) as dd from (select date(t_start) as dd, (UNIX_TIMESTAMP(t_end)-UNIX_TIMESTAMP(t_start) - t_break*60) as tm from timesheet where t_type=1 and emp_id = {$emp->employee_id} and date(t_start)>=date({$from}) and date( t_start)<= date( {$to} ) ) t ";
- if($conn->dataProvider=="postgres") {
- $sql="select sum(tm) as tm, count(distinct dd) as dd from (select date(t_start) as dd, (extract(epoch from t_end) - extract(epoch from t_start) - t_break*60) as tm from timesheet where t_type=1 and emp_id = {$emp->employee_id} and date(t_start)>=date({$from}) and date( t_start)<= date( {$to} ) ) t ";
- }
+
$t = $conn->GetRow($sql);
$e['hours'] = intval($t['tm']/3600);
diff --git a/www/app/pages/reference/categorylist.php b/www/app/pages/reference/categorylist.php
index bc2653895..b49291ed5 100644
--- a/www/app/pages/reference/categorylist.php
+++ b/www/app/pages/reference/categorylist.php
@@ -314,12 +314,7 @@ public function saveOnClick($sender) {
$thumb->resize(512, 512);
$image->content = $thumb->getImageAsString();
}
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
$image->save();
$this->_category->image_id = $image->image_id;
diff --git a/www/app/pages/reference/itemlist.php b/www/app/pages/reference/itemlist.php
index 112156f2d..016f7f38e 100644
--- a/www/app/pages/reference/itemlist.php
+++ b/www/app/pages/reference/itemlist.php
@@ -524,12 +524,8 @@ public function save($sender) {
$this->_item->thumb = "data:{$image->mime};base64," . base64_encode($thumb->getImageAsString());
}
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
+
$image->save();
$this->_item->image_id = $image->image_id;
diff --git a/www/app/pages/register/iostate.php b/www/app/pages/register/iostate.php
index 547fe248a..c1d48b332 100644
--- a/www/app/pages/register/iostate.php
+++ b/www/app/pages/register/iostate.php
@@ -188,10 +188,7 @@ public function getItems($start, $count, $sortfield = null, $asc = null) {
$sql = "select i.*,d.username,d.meta_id,d.document_number,d.document_date from documents_view d join iostate_view i on d.document_id = i.document_id where " . $this->getWhere() . " order by id desc ";
if ($count > 0) {
$limit =" limit {$start},{$count}";
- if($conn->dataProvider=="postgres") {
- $limit =" limit {$count} offset {$start}";
- }
-
+
$sql .= $limit;
}
diff --git a/www/app/pages/register/paylist.php b/www/app/pages/register/paylist.php
index a3714eda3..a4b078ed2 100644
--- a/www/app/pages/register/paylist.php
+++ b/www/app/pages/register/paylist.php
@@ -335,9 +335,7 @@ public function getItems($start=-1, $count=-1, $sortfield = null, $asc = null) {
$sql = "select p.*,d.customer_name,d.meta_id,d.document_date from documents_view d join paylist_view p on d.document_id = p.document_id where " . $this->getWhere() . " order by pl_id desc ";
if ($count > 0) {
$limit =" limit {$start},{$count}";
- if($conn->dataProvider=="postgres") {
- $limit =" limit {$count} offset {$start}";
- }
+
$sql .= $limit;
diff --git a/www/app/pages/register/stocklist.php b/www/app/pages/register/stocklist.php
index 036edb931..0c1873317 100644
--- a/www/app/pages/register/stocklist.php
+++ b/www/app/pages/register/stocklist.php
@@ -147,9 +147,7 @@ public function getItems($start, $count, $sortfield = null, $asc = null) {
if ($count > 0) {
$limit =" limit {$start},{$count}";
- if($conn->dataProvider=="postgres") {
- $limit =" limit {$count} offset {$start}";
- }
+
$sql .= $limit;
diff --git a/www/app/pages/report/itemactivity.php b/www/app/pages/report/itemactivity.php
index c40cf7599..50e9d8c84 100644
--- a/www/app/pages/report/itemactivity.php
+++ b/www/app/pages/report/itemactivity.php
@@ -104,9 +104,7 @@ private function generateReport() {
$detail = array();
$conn = \ZDB\DB::getConnect();
$gd = " GROUP_CONCAT(distinct dc.document_number) ";
- if($conn->dataProvider=="postgres") {
- $gd = " string_agg( dc.document_number,',') ";
- }
+
$sql = "
SELECT t.*,
diff --git a/www/app/pages/report/olap.php b/www/app/pages/report/olap.php
index d363b91ac..01f89cc5d 100644
--- a/www/app/pages/report/olap.php
+++ b/www/app/pages/report/olap.php
@@ -345,9 +345,7 @@ private function getBaseSql($type) {
$concat=" concat(year(dv.document_date),'-',( case when month(dv.document_date)< 10 then concat('0',month(dv.document_date) ) else concat('',month(dv.document_date) ) end ) ) ";
- if($conn->dataProvider=='postgres') {
- $concat=" concat(DATE_PART( 'year',dv.document_date),'-',DATE_PART('month',dv.document_date)) ";
- }
+
$where = " dv.document_date >= " . $conn->DBDate($this->startform->stfrom->getDate()) . "
AND dv.document_date <= " . $conn->DBDate($this->startform->stto->getDate()) ;
@@ -429,9 +427,6 @@ private function getBaseSql($type) {
$concat=" concat(year(pv.paydate),'-',( case when month(pv.paydate)< 10 then concat('0',month(pv.paydate) ) else concat('',month(pv.paydate) ) end ) ) ";
- if($conn->dataProvider=='postgres') {
- $concat=" concat(DATE_PART( 'year',pv.paydate),'-',DATE_PART('month',pv.paydate)) ";
- }
$where = " pv.amount <> 0 and pv.paydate >= " . $conn->DBDate($this->startform->stfrom->getDate()) . "
AND pv.paydate <= " . $conn->DBDate($this->startform->stto->getDate()) ;
diff --git a/www/app/pages/report/timestat.php b/www/app/pages/report/timestat.php
index e08982ff5..1f075aeaa 100644
--- a/www/app/pages/report/timestat.php
+++ b/www/app/pages/report/timestat.php
@@ -64,9 +64,7 @@ private function generateReport() {
$detail = array();
$total = 0;
$sql = "select emp_name,sum(tm) as tm from (select emp_name, (UNIX_TIMESTAMP(t_end)-UNIX_TIMESTAMP(t_start) - t_break*60) as tm from timesheet_view where t_type = {$type} and t_start>={$_from} and t_start<={$_to} and disabled <> 1) t group by emp_name order by emp_name ";
- if($conn->dataProvider=="postgres") {
- $sql = "select emp_name,sum(tm) as tm from (select emp_name, ( extract(EPOCH from (t_end - t_start) ) - t_break*60) as tm from timesheet_view where t_type = {$type} and t_start>={$_from} and t_start<={$_to} and disabled <> 1) t group by emp_name order by emp_name ";
- }
+
$stat = $conn->Execute($sql);
foreach ($stat as $row) {
diff --git a/www/app/pages/service/import.php b/www/app/pages/service/import.php
index 69a04f5b3..7598248b1 100644
--- a/www/app/pages/service/import.php
+++ b/www/app/pages/service/import.php
@@ -394,12 +394,7 @@ public function onImport($sender) {
$item->thumb = "data:{$image->mime};base64," . base64_encode($thumb->getImageAsString());
}
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $image->thumb = pg_escape_bytea($image->thumb);
- $image->content = pg_escape_bytea($image->content);
-
- }
+
$image->save();
$item->image_id = $image->image_id;
diff --git a/www/app/pages/subscribes.php b/www/app/pages/subscribes.php
index 80cbc40a0..d8e0af78a 100644
--- a/www/app/pages/subscribes.php
+++ b/www/app/pages/subscribes.php
@@ -88,6 +88,11 @@ public function update($sender) {
$this->editform->editmsgtype->setOptionList($l);
$this->editform->editmsgtype->setValue(array_shift($l));
$this->update($this->editform->editmsgtype) ;
+
+ $this->editform->edituser->setVisible($rt==Subscribe::RSV_USER);
+
+
+
return;
}
@@ -97,8 +102,6 @@ public function update($sender) {
$this->editform->editmsgsubject->setVisible(false);
$this->editform->editattach->setVisible( false);
$this->editform->edithtml->setVisible(false);
- $this->editform->edituser->setVisible(false);
- $this->editform->editmsgtype->setVisible(true);
$this->editform->editurl->setVisible($mt == Subscribe::RSV_WH);
diff --git a/www/app/pages/timesheet.php b/www/app/pages/timesheet.php
index 9fd990902..1bc60324c 100644
--- a/www/app/pages/timesheet.php
+++ b/www/app/pages/timesheet.php
@@ -80,9 +80,6 @@ public function loaddata($arg, $post) {
$tn = TimeItem::getTypeTime();
$sql="select t_type,sum(tm) as tm, count(distinct dd) as dd from (select t_type, date(t_start) as dd, (UNIX_TIMESTAMP(t_end)-UNIX_TIMESTAMP(t_start) - t_break*60) as tm from timesheet where emp_id = {$emp_id} and date(t_start)>=date({$t_start}) and date( t_start)<= date( {$t_end} ) ) t group by t_type order by t_type ";
- if($conn->dataProvider=="postgres") {
- $sql="select t_type,sum(tm) as tm, count(distinct dd) as dd from (select t_type, date(t_start) as dd, (extract(epoch from t_end) - extract(epoch from t_start) - t_break*60) as tm from timesheet where emp_id = {$emp_id} and date(t_start)>=date({$t_start}) and date( t_start)<= date( {$t_end} ) ) t group by t_type order by t_type ";
- }
$stat = $conn->Execute($sql);
foreach ($stat as $row) {
diff --git a/www/app/pages/update.php b/www/app/pages/update.php
index 3b25d459e..65db2bf57 100644
--- a/www/app/pages/update.php
+++ b/www/app/pages/update.php
@@ -49,11 +49,7 @@ public function __construct() {
$phpv = phpversion() ;
$conn = \ZDB\DB::getConnect();
-
- if($conn->dataProvider=="postgres") {
- $phpv = $phpv. '_pg';
- }
-
+
$nocache= "?t=" . time()."&s=". H::getSalt() .'&phpv='.$phpv ;
$v = @file_get_contents("https://zippy.com.ua/checkver.php".$nocache);
@@ -108,9 +104,6 @@ public function __construct() {
$this->_tvars['showdb'] = true ;
$sqlurl= $data['sql'] ;
- if($_config['db']['driver'] == 'postgres'){
- // $sqlurl= $data['sqlp'] ;
- }
$this->_tvars['sqlurl'] = $sqlurl .$t ;
$this->_tvars['sql'] = file_get_contents($this->_tvars['sqlurl']) ;
@@ -182,9 +175,8 @@ public function OnSqlUpdate($sender) {
try{
- if( ($_config['db']['driver'] ??'') == '' ){
-
- $b= mysqli_connect($_config['db']['host'], $_config['db']['user'], $_config['db']['pass'], $_config['db']['name']) ;
+
+ $b= mysqli_connect($_config['db']['host'], $_config['db']['user'], $_config['db']['pass'], $_config['db']['name']) ;
if($b ==false) {
$this->setErrorTopPage('Invalid connect') ;
@@ -205,37 +197,7 @@ public function OnSqlUpdate($sender) {
}
- }
- if($_config['db']['driver'] == 'postgres'){
-
- $this->setWarn('PostgreSql має бути оновлена вручну') ;
- return;
-
- $b = pg_connect("host={$_config['db']['host']} port=5432 dbname={$_config['db']['name']} user={$_config['db']['user']} password={$_config['db']['pass']}");
-
-
- if($b ==false) {
- $this->setErrorTopPage('Invalid connect') ;
- return;
- }
-
- foreach($sql_array as $s) {
- $s = trim($s);
- if(strlen($s)==0) {
- continue;
- }
- $r= pg_query($b,$s) ;
- if($r ==false) {
- $msg= pg_execute() ;
- $this->setErrorTopPage($s.' error') ;
- return;
- }
-
-
- }
- }
-
$this->setSuccess('БД оновлена') ;
diff --git a/www/templates/modules/shop/pages/admin/dashboard.html b/www/templates/modules/shop/pages/admin/dashboard.html
index 2f8a99e20..07391de56 100644
--- a/www/templates/modules/shop/pages/admin/dashboard.html
+++ b/www/templates/modules/shop/pages/admin/dashboard.html
@@ -2,6 +2,7 @@
Дашборд
+
diff --git a/www/templates/pages/base.html b/www/templates/pages/base.html
index 52f23b42d..1c67c0acb 100644
--- a/www/templates/pages/base.html
+++ b/www/templates/pages/base.html
@@ -28,13 +28,12 @@
-
-
+
-
-
+
diff --git a/www/templates/pages/reference/customerlist.html b/www/templates/pages/reference/customerlist.html
index 518208899..ba594f6cc 100644
--- a/www/templates/pages/reference/customerlist.html
+++ b/www/templates/pages/reference/customerlist.html
@@ -2,6 +2,7 @@
Довідник контрагентів
+
diff --git a/www/templates/pages/register/prodstagelist.html b/www/templates/pages/register/prodstagelist.html
index 39f378da0..44fd81f55 100644
--- a/www/templates/pages/register/prodstagelist.html
+++ b/www/templates/pages/register/prodstagelist.html
@@ -1,6 +1,7 @@
Виробничі етапи
+
diff --git a/www/templates/pages/subscribes.html b/www/templates/pages/subscribes.html
index 3087cbfa7..3c355c65b 100644
--- a/www/templates/pages/subscribes.html
+++ b/www/templates/pages/subscribes.html
@@ -144,9 +144,10 @@ Опис тегiв
Для системних повідомлень та e-mail в розмітці можна використовувати HTML.
Доступні теги для відправки через Телеграм.
- Допускаються наступні теги:
+ Допускаються наступні теги для документу :
{customer_name} Ім'я контрагента
+ {document_id} ID документа
{document_number} Номер документа
{doc_dn} Номер документа (тiльки цифри)
{document_date} Дата документа
@@ -171,6 +172,14 @@ Опис тегiв
{botname} Телеграм-бот
+ Допускаються наступні теги для контрагента :
+
+ {customer_name} Ім'я контрагента
+ {customer_id} ID контрагента
+
+
+
+
Якщо потрібно вивести текст в залежності від наявності значення, наприклад,
{#credit}
diff --git a/www/templates/printforms/report/price.tpl b/www/templates/printforms/report/price.tpl
index dfd982cd7..482eb590d 100644
--- a/www/templates/printforms/report/price.tpl
+++ b/www/templates/printforms/report/price.tpl
@@ -41,20 +41,20 @@
{{#_detail}}
- {{name}}
- {{code}}
- {{msr}}
+ {{name}}
+ {{code}}
+ {{msr}}
- {{#iscat}} {{cat}} {{/iscat}}
- {{#isbrand}} {{brand}} {{/isbrand}}
-{{#showqty}} {{qty}} {{/showqty}}
-{{#price1name}} {{price1}} {{/price1name}}
-{{#price2name}} {{price2}} {{/price2name}}
-{{#price3name}} {{price3}} {{/price3name}}
-{{#price4name}} {{price4}} {{/price4name}}
-{{#price5name}} {{price5}} {{/price5name}}
-{{#showdesc}} {{desc}} {{/showdesc}}
- {{notes}}
+ {{#iscat}} {{cat}} {{/iscat}}
+ {{#isbrand}} {{brand}} {{/isbrand}}
+{{#showqty}} {{qty}} {{/showqty}}
+{{#price1name}} {{price1}} {{/price1name}}
+{{#price2name}} {{price2}} {{/price2name}}
+{{#price3name}} {{price3}} {{/price3name}}
+{{#price4name}} {{price4}} {{/price4name}}
+{{#price5name}} {{price5}} {{/price5name}}
+{{#showdesc}} {{desc}} {{/showdesc}}
+ {{notes}}
{{/_detail}}