Changeset 3350161
- Timestamp:
- 08/26/2025 08:05:52 AM (7 months ago)
- Location:
- order-picking-app/trunk
- Files:
-
- 5 edited
-
admin/class-orderpickingapp-admin.php (modified) (1 diff)
-
admin/partials/orderpickingapp-settings-page.php (modified) (4 diffs)
-
includes/class-orderpickingapp.php (modified) (4 diffs)
-
orderpickingapp.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
order-picking-app/trunk/admin/class-orderpickingapp-admin.php
r3329391 r3350161 906 906 907 907 echo 'Picker: ' . ucfirst($user_claimed); 908 909 $batch_id = $order->get_meta('batch_id'); 910 if (isset($batch_id) && !empty($batch_id)) { 911 echo '</br>'; 912 echo 'Batch: ' . $batch_id; 913 } 908 914 909 915 if ($picking_status == 'completed') { -
order-picking-app/trunk/admin/partials/orderpickingapp-settings-page.php
r3329391 r3350161 475 475 <h5>App functions</h5> 476 476 <div class="form-check"> 477 <input type="checkbox" class="form-check-input" name="enable_batch_order_select" value="yes" <?php echo (isset($app_settings['enable_batch_order_select']) && $app_settings['enable_batch_order_select'] == 'yes')? 'checked' : ''; ?>> 478 <label class="form-check-label" ><?php echo __( 'Enable custom order select for batch picking. You can create your own picking list by custom selected orders inside the app', 'orderpickingapp' ); ?></label> 479 </div> 480 <div class="form-check"> 477 481 <input type="checkbox" class="form-check-input" name="disable_inventory_update" value="yes" <?php echo ( (isset($app_settings['disable_inventory_update']) && $app_settings['disable_inventory_update'] == 'yes') )? 'checked' : ''; ?>> 478 482 <label class="form-check-label" for="yes">Disable inventory updates within the app</label> … … 516 520 <p style="font-size: 14px; text-align: center; margin: 0 15%;">Add all employees who will use the Order Picking App here. In the app you start by choosing a picker. For picked orders/products, the relevant picker is noted in the order notes.</p> 517 521 <?php 522 $noUsers = true; 518 523 if( isset($app_settings['app_users']) && !empty($app_settings['app_users']) && is_array($app_settings['app_users']) ): 519 524 $i = count($app_settings['app_users']); … … 535 540 } 536 541 542 $noUsers = false; 543 537 544 $i--; ?> 538 545 <div class="form-group <?php echo ($i == 0)? 'duplicate_row' : ''; ?>" style="width: 100%;margin: 10px 0; min-height: 30px;"> 539 <input style="float: left; width: 20%;margin-right: 10px;" type="text" class="form-control app_users_name" name="app_users[][app_users[][app_users_ password]]" value="<?php echo $app_user['app_users_name']; ?>" placeholder="<?php echo $app_user['app_users_name']; ?>"/>546 <input style="float: left; width: 20%;margin-right: 10px;" type="text" class="form-control app_users_name" name="app_users[][app_users[][app_users_name]]" value="<?php echo $app_user['app_users_name']; ?>" placeholder="<?php echo $app_user['app_users_name']; ?>"/> 540 547 <input style="float: left; width: 20%;margin-right: 10px;" type="text" class="form-control" name="app_users[][app_users_password]" value="<?php echo $app_user['app_users_password']; ?>" placeholder="<?php echo __( 'Enter user password (optional)', 'orderpickingapp' ); ?>"/> 541 548 <input style="float: left; width: 8%;margin-right: 10px;" type="number" min="0" max="23" step="1" class="woocommerce-Input woocommerce-Input--text input-text" name="app_users[][app_users_start_time]" value="<?php echo $app_user['app_users_start_time']; ?>" placeholder="Start"/> … … 564 571 <?php 565 572 endforeach; ?> 566 <?php else: ?> 573 <?php endif; ?> 574 575 <?php if( $noUsers ): ?> 567 576 <div class="form-group duplicate_row" style="width: 100%;margin: 10px 0; min-height: 30px;"> 568 577 <input style="float: left; width: 20%;margin-right: 10px;" type="text" class="form-control" name="app_users[][app_users_name]" value="" placeholder="Enter user name"/> -
order-picking-app/trunk/includes/class-orderpickingapp.php
r3316832 r3350161 232 232 'methods' => 'POST', 233 233 'callback' => array($this, 'createOrder'), 234 'permission_callback' => '__return_true', 235 )); 236 register_rest_route('picking/v1', '/get-order', array( 237 'methods' => 'GET', 238 'callback' => array($this, 'getOrder'), 239 'permission_callback' => '__return_true', 240 )); 241 register_rest_route('picking/v1', '/create-batch', array( 242 'methods' => 'POST', 243 'callback' => array($this, 'createBatch'), 234 244 'permission_callback' => '__return_true', 235 245 )); … … 1473 1483 1474 1484 public 1485 function getOrder($request) 1486 { 1487 1488 global $woocommerce; 1489 1490 header('Access-Control-Allow-Origin: *'); 1491 header("Access-Control-Allow-Methods: GET"); 1492 1493 if (class_exists('WooCommerce')) { 1494 1495 $token = $request->get_param('token'); 1496 $order_id = $request->get_param('order_id'); 1497 1498 if (isset($token)) { 1499 1500 $currency_symbol = get_woocommerce_currency_symbol(); 1501 $currency_symbol = html_entity_decode($currency_symbol); 1502 1503 $orderpickingapp_apikey = get_option('orderpickingapp_apikey'); 1504 if (isset($orderpickingapp_apikey) && $token == $orderpickingapp_apikey) { 1505 1506 $order = wc_get_order( $order_id ); 1507 if ( $order ) { 1508 1509 $picking_status = $order->get_meta('picking_status'); 1510 if( !empty($picking_status) && $picking_status !== 'picking' ){ 1511 $args = array( 1512 'status' => 400, 1513 'message' => 'Order already picked!', 1514 ); 1515 wp_send_json($args); 1516 } 1517 1518 $batch_id = $order->get_meta('batch_id'); 1519 if( isset($batch_id) && !empty($batch_id) ){ 1520 $args = array( 1521 'status' => 400, 1522 'message' => 'Order already connected to a batch!', 1523 ); 1524 wp_send_json($args); 1525 } 1526 1527 $total_items = 0; 1528 foreach ($order->get_items() as $item) { 1529 $product_id = $item->get_product_id(); 1530 if (is_plugin_active('woocommerce-product-bundles/woocommerce-product-bundles.php') && !empty($product_id)) { 1531 $product_info = wc_get_product($product_id); 1532 $product_type = $product_info->get_type(); 1533 if (!in_array($product_type, array('woosb', 'bundle', 'grouped'))) { 1534 $total_items = $total_items + $item->get_quantity(); 1535 } 1536 } else { 1537 $total_items = $total_items + $item->get_quantity(); 1538 } 1539 } 1540 1541 $fullname = $order->get_shipping_first_name() . ' ' . $order->get_shipping_last_name(); 1542 if( strlen($fullname) < 3 ){ 1543 $fullname = $order->get_billing_first_name() . ' ' . $order->get_billing_last_name(); 1544 } 1545 1546 $order_number = $order_id; 1547 $custom_order_number = $order->get_meta('_alg_wc_full_custom_order_number'); 1548 if( isset($custom_order_number) && !empty($custom_order_number) ){ 1549 $order_number = $custom_order_number; 1550 } 1551 else{ 1552 $custom_order_number = $order->get_meta('_order_number'); 1553 if( isset($custom_order_number) && !empty($custom_order_number) ){ 1554 $order_number = $custom_order_number; 1555 } 1556 } 1557 1558 $order_prefix = get_option('order_prefix'); 1559 if (isset($order_prefix) && !empty($order_prefix)) { 1560 $order_number = $order_prefix . $order_number; 1561 } 1562 1563 $customer_note = $order->get_customer_note(); 1564 $customer_note = apply_filters('orderpickingapp_order_note', $customer_note); 1565 1566 wp_send_json( array( 1567 'orderid' => $order_id, 1568 'order_number' => $order_number, 1569 'date' => substr($order->get_date_created(), 5, 5), 1570 'items' => $total_items, 1571 'total' => $currency_symbol . ' ' . $order->get_total(), 1572 'fullname' => $fullname, 1573 'shipping' => $order->get_shipping_method(), 1574 'order_note' => $customer_note, 1575 )); 1576 } else { 1577 $args = array( 1578 'status' => 400, 1579 'message' => 'Order not found!', 1580 ); 1581 wp_send_json($args); 1582 } 1583 } else { 1584 header("HTTP/1.1 401 Unauthorized"); 1585 exit; 1586 } 1587 } else { 1588 header("HTTP/1.1 401 Unauthorized"); 1589 exit; 1590 } 1591 } 1592 } 1593 1594 public 1595 function createBatch($request) 1596 { 1597 1598 header('Access-Control-Allow-Origin: *'); 1599 header("Access-Control-Allow-Credentials: true"); 1600 header('Access-Control-Allow-Methods: POST'); 1601 header('Access-Control-Max-Age: 1000'); 1602 header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token , Authorization'); 1603 1604 $token = $request->get_param('token'); 1605 $appuser = $request->get_param('appuser'); 1606 1607 $body = $request->get_body(); 1608 $data = json_decode($body, true); 1609 1610 if (class_exists('WooCommerce')) { 1611 if (isset($token)) { 1612 $orderpickingapp_apikey = get_option('orderpickingapp_apikey'); 1613 if (isset($orderpickingapp_apikey) && $token == $orderpickingapp_apikey) { 1614 1615 $picking_batch = get_option('picking_batch'); 1616 if (!isset($picking_batch) || empty($picking_batch)) { 1617 $picking_batch = 0; 1618 } 1619 1620 $BatchBoxCharacter = 'A'; 1621 $BatchBoxCharacterSecond = 'A'; 1622 foreach( $data['orderids'] as $orderid ){ 1623 1624 $Order = wc_get_order($orderid); 1625 $Order->update_meta_data('claimed', 'true'); 1626 $Order->update_meta_data('user_claimed', $appuser); 1627 $Order->update_meta_data('picking_status', 'picking'); 1628 $Order->update_meta_data('batch_id', $BatchBoxCharacter . $BatchBoxCharacterSecond . '-' . $picking_batch); 1629 $Order->save(); 1630 1631 if ($BatchBoxCharacterSecond == 'Z') { 1632 $BatchBoxCharacter = chr(ord($BatchBoxCharacter) + 1); 1633 $BatchBoxCharacterSecond = 'A'; 1634 } else { 1635 $BatchBoxCharacterSecond = chr(ord($BatchBoxCharacterSecond) + 1); 1636 } 1637 } 1638 1639 $args = array( 1640 'status' => 200, 1641 ); 1642 wp_send_json($args); 1643 } 1644 else { 1645 wp_send_json('Unauthorized'); 1646 header("HTTP/1.1 401 Unauthorized"); 1647 exit; 1648 } 1649 } else { 1650 wp_send_json('Unauthorized'); 1651 header("HTTP/1.1 401 Unauthorized"); 1652 exit; 1653 } 1654 } 1655 exit; 1656 } 1657 1658 public 1475 1659 function getCustomers($request) 1476 1660 { … … 1783 1967 1784 1968 // Manual order assigning 1785 if (isset($manual_order_assigning) && $manual_order_assigning == 'yes' && $user_claimed != $appuser) { 1969 if( isset($manual_order_assigning) && $manual_order_assigning == 'yes' && $user_claimed != $appuser) { 1970 continue; 1971 } 1972 1973 // Check for open picking batch and batch picking user 1974 if( $picking_amount > 1 && $ordersClaimed && $user_claimed != $appuser ){ 1786 1975 continue; 1787 1976 } … … 2140 2329 2141 2330 $order_number = $shop_order_id; 2142 $custom_order_number = $o pen_order->get_meta('_alg_wc_full_custom_order_number');2331 $custom_order_number = $order->get_meta('_alg_wc_full_custom_order_number'); 2143 2332 if( isset($custom_order_number) && !empty($custom_order_number) ){ 2144 2333 $order_number = $custom_order_number; 2145 2334 } 2146 2335 else{ 2147 $custom_order_number = $o pen_order->get_meta('_order_number');2336 $custom_order_number = $order->get_meta('_order_number'); 2148 2337 if( isset($custom_order_number) && !empty($custom_order_number) ){ 2149 2338 $order_number = $custom_order_number; -
order-picking-app/trunk/orderpickingapp.php
r3329391 r3350161 3 3 * Plugin Name: Order Picking App 4 4 * Description: Make your life easier by using the Orderpicking App. You'll never be inefficient if the Orderpicking App is installed in your store. We assist you in all aspects of your webshop. From intelligent selecting to order packing, we have you covered. Connecting the Orderpicking App to your Woocommerce webshop is simple and quick. Within an hour, you'll be online with the Orderpicking App. You're able to pick and pack your orders three times faster and with greater accuracy. 5 * Version: 2. 1.95 * Version: 2.2.0 6 6 * Author: Arture | PHP Professionals 7 7 * Author URI: http://arture.nl -
order-picking-app/trunk/readme.txt
r3329391 r3350161 5 5 Requires at least: 6.0 6 6 Tested up to: 6.8.1 7 Stable tag: 2. 1.97 Stable tag: 2.2.0 8 8 Requires PHP: 8.0 9 9 License: GPLv2 or later … … 37 37 == Changelog == 38 38 39 = 2.2.0 = 40 * New setting for custom order select inside batch picking 41 * Bugfix with add new picker save action 42 39 43 = 2.1.9 = 40 44 * Woocommerce settings for picker start en end time
Note: See TracChangeset
for help on using the changeset viewer.