From: Alexander Smirnov Date: Thu, 2 May 2024 13:25:06 +0000 (+0300) Subject: orders delivery X-Git-Tag: 1.1~63^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=35c085371669d1d8efd8b59251741454448cb975;p=erp24_rep%2Fyii-erp24%2F.git orders delivery --- diff --git a/erp24/controllers/OrdersController.php b/erp24/controllers/OrdersController.php index 3a0eef92..fee3d2c6 100644 --- a/erp24/controllers/OrdersController.php +++ b/erp24/controllers/OrdersController.php @@ -51,6 +51,11 @@ class OrdersController extends Controller return $this->render('couriers_stats'); } + public function actionAjaxReturnCheck() { return $this->renderPartial('ajax-return-check'); } + public function actionAjaxCreateCheck() { return $this->renderPartial('ajax-create-check'); } + public function actionAjaxCreateCheckJson() { return $this->renderPartial('ajax-create-check-json'); } + public function actionAjaxCheckRemove() { return $this->renderPartial('ajax-check-remove'); } + public function actionDelivery2() { if (!empty($_REQUEST["umoup"])) { diff --git a/erp24/inc/base_new.php b/erp24/inc/base_new.php index 77581d58..7fc3dd9c 100644 --- a/erp24/inc/base_new.php +++ b/erp24/inc/base_new.php @@ -742,7 +742,7 @@ $id_db - уникальный номер заказа или номер AUTOINCR */ function create_guid_my($prefix="01",$id_db="") { if(empty($id_db)) $id_db=rand(0,99999999); - $id_db=100000000000+$id_db; + $id_db=100000000000+(int)$id_db; $str= "$prefix".date("Ym")."-".date("di")."-".date("hs")."-".bin2hex(random_bytes(2))."-".$id_db.""; return strtolower($str); } diff --git a/erp24/modul/orders/ajax_check_remove.php b/erp24/modul/orders/ajax_check_remove.php index 04cb651c..94dee43f 100644 --- a/erp24/modul/orders/ajax_check_remove.php +++ b/erp24/modul/orders/ajax_check_remove.php @@ -1,8 +1,7 @@ - $colors) { // ставим в соответствие вид оплаты -$date = $db::getValue("SELECT extract(epoch FROM date) as date FROM create_checks WHERE order_id=? AND type='Продажа' order by date desc LIMIT 1",[$lid_id]); +$date = $db::getValue("SELECT extract(epoch FROM date) as date FROM create_checks WHERE order_id=? AND type='Продажа' order by date desc LIMIT 1",[$order_id]); $error=""; if($date>(time()-60) and !empty($date)) $error="Чек не создан так как чек с таким заказом уже создан"; if(!empty($error)) echo($error); diff --git a/erp24/modul/orders/ajax_return_check.php b/erp24/modul/orders/ajax_return_check.php index 341b706b..3e54462a 100644 --- a/erp24/modul/orders/ajax_return_check.php +++ b/erp24/modul/orders/ajax_return_check.php @@ -1,9 +1,9 @@ - function ajax_return_check(sales_check) { jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text(''); - + + const param3 = $('meta[name=csrf-param]').attr('content'); + const token3 = $('meta[name=csrf-token]').attr('content'); $.ajax({ - url: '/orders/ajax_return_check/', + url: '/orders/ajax-return-check/', method: 'post', dataType: 'html', - data: { sales_check: ''+sales_check+''}, + data: { sales_check: ''+sales_check+'', [param3]: token3}, success: function(data){ $('#modal-7 .modal-body').html(data); $('#check__'+sales_check+'').remove(); @@ -589,12 +591,14 @@ $.ajax({ function ajax_create_check(order_id) { jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text(''); - + + const param3 = $('meta[name=csrf-param]').attr('content'); + const token3 = $('meta[name=csrf-token]').attr('content'); $.ajax({ - url: '/orders/ajax_create_check/', + url: '/orders/ajax-create-check/', method: 'post', dataType: 'html', - data: { order_id: ''+order_id+'', create_check: '2' }, + data: { order_id: ''+order_id+'', create_check: '2', [param3]: token3 }, success: function(data){ $('#modal-7 .modal-body').html(data); $('.btn__'+order_id+'').hide(); @@ -606,12 +610,14 @@ $.ajax({ function ajax_create_check_json(order_id) { jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text(''); - + + const param3 = $('meta[name=csrf-param]').attr('content'); + const token3 = $('meta[name=csrf-token]').attr('content'); $.ajax({ - url: '/orders/ajax_create_check_json/', + url: '/orders/ajax-create-check-json/', method: 'post', dataType: 'html', - data: { order_id: ''+order_id+'', create_check: '2' }, + data: { order_id: ''+order_id+'', create_check: '2', [param3]: token3 }, success: function(data){ $('#modal-7 .modal-body').html(data); $('.btn__'+order_id+'').hide(); @@ -620,12 +626,14 @@ $.ajax({ function ajax_check_remove(order_id) { jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text(''); - + + const param3 = $('meta[name=csrf-param]').attr('content'); + const token3 = $('meta[name=csrf-token]').attr('content'); $.ajax({ - url: '/orders/ajax_check_remove/', + url: '/orders/ajax-check-remove/', method: 'post', dataType: 'html', - data: { order_id: ''+order_id+''}, + data: { order_id: ''+order_id+'', [param3]: token3}, success: function(data){ $('#modal-7 .modal-body').html(data); }}); diff --git a/erp24/views/orders/ajax-check-remove.php b/erp24/views/orders/ajax-check-remove.php new file mode 100644 index 00000000..dc14e9a7 --- /dev/null +++ b/erp24/views/orders/ajax-check-remove.php @@ -0,0 +1,5 @@ +