Plugin Directory

Changeset 3494315


Ignore:
Timestamp:
03/30/2026 08:55:04 AM (41 hours ago)
Author:
enituretechnology
Message:

2.2.5 - 2026-03-30

  • Update: Added cache support to handle duplicate simultaneous quote requests efficiently.
  • Update: Added delivery estimate options and order cutoff time functionality to the quote settings.
  • Update: Added bulk delete support for warehouse and drop ship locations.
  • Update: Added product-level offset days functionality.
  • Fix: Resolved Broken Access Control vulnerability to improve overall plugin security.

Ticket 23708293437

Location:
ltl-freight-quotes-day-ross-edition
Files:
12 added
2 deleted
38 edited
6 copied

Legend:

Unmodified
Added
Removed
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/assets/en-dayross-admin.css

    r3489974 r3494315  
    127127}
    128128
    129 .en_quote_settings_sub_options th {
     129.en_quote_settings_sub_options th,
     130.dayross_cutt_off_time_ship_date_offset th,
     131.en_quote_settings_shipment_offset_days_dayross_tr th,
     132.en_quote_settings_all_shipment_days_dayross_tr th
     133{
    130134    padding: 0 0 10px 15px;
    131135    margin-left: 10px !important;
     
    133137}
    134138
    135 .en_quote_settings_sub_options td {
     139.dayross_cutt_off_time_ship_date_offset th,
     140.en_quote_settings_shipment_offset_days_dayross_tr th,
     141.en_quote_settings_all_shipment_days_dayross_tr th {
     142    padding-top: 10px !important;
     143}
     144
     145.en_quote_settings_sub_options td,
     146.dayross_cutt_off_time_ship_date_offset td,
     147.en_quote_settings_shipment_offset_days_dayross_tr td,
     148.en_quote_settings_all_shipment_days_dayross_tr td {
    136149    padding: 0 0 10px 15px;
    137150}
     
    364377.woocommerce_variable_attributes.wc-metabox-content [class^="_nmfc_number"],
    365378.woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"],
     379.woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"],
    366380.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"],
    367381.woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"],
     
    387401.woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"],
    388402.woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"],
     403.woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"],
    389404.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"],
    390405.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedDimension"],
     
    396411.woocommerce_variable_attributes.wc-metabox-content .data p[class*="en_flat_rate_price"] span.woocommerce-help-tip,
    397412.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_en_product_markup"] span.woocommerce-help-tip,
     413.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_eniture_product_level_fulfillment_offset_days"] span.woocommerce-help-tip,
    398414.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedPercentage"] span.woocommerce-help-tip,
    399415.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedDimension"] span.woocommerce-help-tip,
     
    468484    background: none !important;
    469485}
     486
     487.en_quote_settings_all_shipment_days_dayross_tr td {
     488  display: flex !important;
     489  align-items: center;
     490  gap: 16px;
     491  flex-wrap: nowrap;
     492}
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/assets/en-dayross-admin.js

    r3490815 r3494315  
    6666        jQuery('#en_dayross_quote_settings').parents().find('.button-primary, .is-primary').on('click', function (event) {
    6767
     68            jQuery(':checkbox:disabled').prop('disabled', false);
     69
    6870            let en_validate_settings = {};
    6971            let en_data_error = true;
     
    179181            }
    180182
     183            // Validate fullfillment offset days
     184            if (!dayrossValidateFullfillmentOffsetDays()) return false;
    181185            // backup rates validation
    182186            if (!dayrossBackupRatesValidations()) return false;
     
    376380    handleAPISelection();
    377381    jQuery('#en_connection_settings_api_dayross').on('change', handleAPISelection);
     382
     383    // Cut-off time and shipment offset days settings
     384    dayrossCutOffTimeAndShipDateSettings();
    378385});
    379386
     
    801808    }
    802809}
     810
     811if (typeof dayrossCutOffTimeAndShipDateSettings != 'function') {
     812    function dayrossCutOffTimeAndShipDateSettings() {
     813        jQuery("#en_quote_settings_shipment_offset_days_dayross").closest('tr').addClass("en_quote_settings_shipment_offset_days_dayross_tr");
     814        jQuery("#en_quote_settings_all_shipment_days_dayross").closest('tr').addClass("en_quote_settings_all_shipment_days_dayross_tr");
     815        jQuery(".dayross_shipment_day ").closest('tr').addClass("dayross_shipment_day_tr");
     816        jQuery("#en_quote_settings_order_cut_off_time_dayross").closest('tr').addClass("dayross_cutt_off_time_ship_date_offset");
     817        jQuery("#en_quote_settings_shipment_offset_days_dayross").attr('maxlength', '2');
     818
     819        const dayross_current_time = en_dayross_admin_script.dayross_order_cut_off_time;
     820        if (dayross_current_time == '') {
     821            jQuery('#en_quote_settings_order_cut_off_time_dayross').wickedpicker({
     822                now: '',
     823                title: 'Cut Off Time',
     824            });
     825        } else {
     826            jQuery('#en_quote_settings_order_cut_off_time_dayross').wickedpicker({
     827                now: dayross_current_time,
     828                title: 'Cut Off Time'
     829            });
     830        }
     831
     832        const show_delivery_estimate = jQuery('input[name=en_quote_settings_delivery_estimate_options_dayross]:checked').val();
     833        if (show_delivery_estimate === 'dont_show_estimates') {
     834            jQuery("#en_quote_settings_order_cut_off_time_dayross").prop('disabled', true);
     835            jQuery("#en_quote_settings_shipment_offset_days_dayross").prop('disabled', true);
     836            jQuery("#en_quote_settings_shipment_offset_days_dayross").css("cursor", "not-allowed");
     837            jQuery("#en_quote_settings_order_cut_off_time_dayross").css("cursor", "not-allowed");
     838            jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').prop('disabled', true);
     839            jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').css("cursor", "not-allowed");
     840        } else {
     841            jQuery("#en_quote_settings_order_cut_off_time_dayross").prop('disabled', false);
     842            jQuery("#en_quote_settings_shipment_offset_days_dayross").prop('disabled', false);
     843            jQuery("#en_quote_settings_order_cut_off_time_dayross").css("cursor", "");
     844            jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').prop('disabled', false);
     845            jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').css("cursor", "");
     846        }
     847
     848        jQuery("input[name=en_quote_settings_delivery_estimate_options_dayross]").change(function () {
     849            const show_delivery_estimate = jQuery('input[name=en_quote_settings_delivery_estimate_options_dayross]:checked').val();
     850           
     851            if (show_delivery_estimate === 'dont_show_estimates') {
     852                jQuery("#en_quote_settings_order_cut_off_time_dayross").prop('disabled', true);
     853                jQuery("#en_quote_settings_shipment_offset_days_dayross").prop('disabled', true);
     854                jQuery("#en_quote_settings_order_cut_off_time_dayross").css("cursor", "not-allowed");
     855                jQuery("#en_quote_settings_shipment_offset_days_dayross").css("cursor", "not-allowed");
     856                jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').prop('disabled', true);
     857                jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').css("cursor", "not-allowed");
     858            } else {
     859                jQuery("#en_quote_settings_order_cut_off_time_dayross").prop('disabled', false);
     860                jQuery("#en_quote_settings_shipment_offset_days_dayross").prop('disabled', false);
     861                jQuery("#en_quote_settings_order_cut_off_time_dayross").css("cursor", "auto");
     862                jQuery("#en_quote_settings_shipment_offset_days_dayross").css("cursor", "auto");
     863                jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').prop('disabled', false);
     864                jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').css("cursor", "auto");
     865            }
     866        });
     867
     868        /*
     869        * Uncheck Week days Select All Checkbox
     870        */
     871        jQuery(".dayross_shipment_day").on('change load', function () {
     872
     873            const checkboxes = jQuery('.dayross_shipment_day:checked').length;
     874            const un_checkboxes = jQuery('.dayross_shipment_day').length;
     875
     876            if (checkboxes === un_checkboxes) {
     877                jQuery('.all_shipment_days_dayross_lfq').prop('checked', true);
     878            } else {
     879                jQuery('.all_shipment_days_dayross_lfq').prop('checked', false);
     880            }
     881        });
     882
     883        /*
     884        * Select All Shipment Week days
     885        */
     886
     887        const all_int_checkboxes = jQuery('.all_shipment_days_dayross_lfq');
     888        if (all_int_checkboxes.length === all_int_checkboxes.filter(":checked").length) {
     889            jQuery('.all_shipment_days_dayross_lfq').prop('checked', true);
     890        }
     891
     892        jQuery(".all_shipment_days_dayross_lfq").change(function () {
     893            if (this.checked) {
     894                jQuery(".dayross_shipment_day").each(function () {
     895                    this.checked = true;
     896                });
     897            } else {
     898                jQuery(".dayross_shipment_day").each(function () {
     899                    this.checked = false;
     900                });
     901            }
     902        });
     903
     904        const main_td = jQuery('.en_quote_settings_all_shipment_days_dayross_tr td');
     905        const rows   = jQuery('tr.dayross_shipment_day_tr');
     906
     907        if (!main_td.length || !rows.length) return;
     908
     909        // Move all day checkboxes into main row
     910        rows.each(function () {
     911            const input_wrap = jQuery(this).find('td > *').first();
     912            if (input_wrap.length) main_td.append(input_wrap);
     913        });
     914
     915        // Hide original rows
     916        rows.hide();
     917
     918        // ---- Select All sync ----
     919        const select_all = main_td.find('input[type="checkbox"]').first();
     920        const days = main_td.find('input[type="checkbox"]').not(select_all);
     921
     922        // Select all → days
     923        select_all.on('change', function () {
     924            days.prop('checked', this.checked);
     925        });
     926        // Days → select all
     927        days.on('change', function () {
     928            select_all.prop('checked', days.length === days.filter(':checked').length);
     929        });
     930    }
     931}
     932
     933if (typeof dayrossValidateFullfillmentOffsetDays !== 'function') {
     934    function dayrossValidateFullfillmentOffsetDays() {
     935        const offset_days = jQuery("#en_quote_settings_shipment_offset_days_dayross").val();
     936        const number_regex = /^[0-9]+$/;
     937        let error_msg = '';
     938       
     939        if (offset_days != "" && offset_days < 1) error_msg = 'Fulfillment Offset Days must be greater than or equal to 1.';
     940        if (!error_msg && offset_days != "" && offset_days > 20) error_msg = 'Fulfillment Offset Days must be less than or equal to 20.';
     941        if (!error_msg && offset_days != "" && !number_regex.test(offset_days)) error_msg = 'Fulfillment Offset Days must be a number.';
     942
     943        if (error_msg) {
     944            jQuery('.en_dayross_ltl_plan_notice').after('<div class="notice notice-error en_settings_message"><p><strong>Error! </strong>' + error_msg + '</p></div>');
     945            jQuery('#en_settings_message').delay(200).animate({scrollTop: 0}, 1000);
     946            jQuery('html, body').animate({scrollTop: 0}, 'slow');
     947            return false;
     948        }
     949
     950        return true;
     951    }
     952}
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/product/en-product-detail.php

    r3284707 r3494315  
    8181                    $custom_field = (isset($custom_field['id'])) ? $custom_field['id'] : '';
    8282                    $en_updated_product = (isset($_POST[$custom_field][$postId])) ? sanitize_text_field($_POST[$custom_field][$postId]) : '';
    83                     $en_updated_product = $custom_field == '_dropship_location' ?
    84                         (maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product)) : esc_attr($en_updated_product);
     83
     84                    if ($custom_field == '_dropship_location') {
     85                        $en_updated_product = maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product);
     86                    } elseif ($custom_field == '_eniture_product_level_fulfillment_offset_days') {
     87                        $en_updated_product = $this->sanitize_fulfillment_offset_days($en_updated_product);
     88                    } else {
     89                        $en_updated_product = esc_attr($en_updated_product);
     90                    }
     91
    8592                    update_post_meta($postId, $custom_field, $en_updated_product);
    8693                }
    8794            }
     95        }
     96
     97        private function sanitize_fulfillment_offset_days($value)
     98        {
     99            $value = trim($value);
     100            if ($value === '' || $value === null) return '';
     101
     102            $value = preg_replace('/[^0-9.-]/', '', $value);
     103            if (!is_numeric($value)) return '';
     104
     105            $value = intval(floor(floatval($value)));
     106            return $value < 0 ? '' : strval($value);
    88107        }
    89108
     
    181200                    'description' => "Increases the amount of the returned quote by a specified amount prior to displaying it in the shopping cart. The number entered will be interpreted as dollars and cents unless it is followed by a % sign. For example, entering 5.00 will cause $5.00 to be added to the quotes. Entering 5% will cause 5 percent of the item's price to be added to the shipping quotes."
    182201                ],
     202                [
     203                'type' => 'input_field',
     204                'input_type' => 'number',
     205                'id' => '_eniture_product_level_fulfillment_offset_days',
     206                'class' => '_eniture_product_level_fulfillment_offset_days short',
     207                'label' => __( 'Fulfillment Offset Days', 'woocommerce' ),
     208                'placeholder' => 'Fulfillment offset days, e.g. 2',
     209                'description' => "The number of days the ship date needs to be moved to allow for the processing of the order. If set, this will override the global Fulfillment Offset Days setting for this product.",
     210                'custom_attributes' => [
     211                    'min' => '1',
     212                    'max' => '20',
     213                    'step' => '1',
     214                    'title' => 'Value must be greater than or equal to 1 and less than or equal to 20',
     215                    'oninvalid' => "this.setCustomValidity(this.validity.rangeUnderflow ? 'Value must be greater than or equal to 1' : this.validity.rangeOverflow ? 'Value must be less than or equal to 20' : '')",
     216                    'oninput' => "this.setCustomValidity('')"
     217                ]
     218            ],
    183219            ];
    184220            // Micro Warehouse
     
    273309                'label' => $custom_field['label'],
    274310                'class' => $custom_field['class'],
    275                 'placeholder' => $custom_field['label'],
     311                'placeholder' => isset($custom_field['placeholder']) ? $custom_field['placeholder'] : $custom_field['label'],
    276312                'value' => get_post_meta($postId, $custom_field['id'], true)
    277313            ];
     
    281317                $custom_input_field['description'] = $custom_field['description'];
    282318            }
     319
     320            // Add input type if specified (e.g., 'number')
     321            if (isset($custom_field['input_type'])) {
     322                $custom_input_field['type'] = $custom_field['input_type'];
     323            }
     324
     325            // Add custom attributes if specified (e.g., min, max, step)
     326            if (isset($custom_field['custom_attributes'])) {
     327                $custom_input_field['custom_attributes'] = $custom_field['custom_attributes'];
     328            }
     329
    283330            echo '<div>';
    284331            woocommerce_wp_text_input($custom_input_field);
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/en-tab.php

    r3428882 r3494315  
    157157            $settings = $this->get_settings($current_section);
    158158
     159            // Cuttoff Time
     160            if (isset($_POST['en_quote_settings_order_cut_off_time_dayross']) && $_POST['en_quote_settings_order_cut_off_time_dayross'] != '') {
     161                $time_24_format = $this->get_time_in_24_hours($_POST['en_quote_settings_order_cut_off_time_dayross']);
     162                $_POST['en_quote_settings_order_cut_off_time_dayross'] = $time_24_format;
     163            }
     164
    159165            // backup rates
    160166            $backup_rates_fields = ['dayross_backup_rates_fixed_rate', 'dayross_backup_rates_cart_price_percentage', 'dayross_backup_rates_weight_function'];
     
    165171            WC_Admin_Settings::save_fields($settings);
    166172        }
     173       
     174         /**
     175         * Cuttoff Time
     176         * @param $timeStr
     177         * @return false|string
     178        */
     179        public function get_time_in_24_hours($timeStr)
     180        {
     181            $cutOffTime = explode(' ', $timeStr);
     182            $hours = $cutOffTime[0];
     183            $separator = $cutOffTime[1];
     184            $minutes = $cutOffTime[2];
     185            $meridiem = $cutOffTime[3];
     186            $cutOffTime = "{$hours}{$separator}{$minutes} $meridiem";
     187           
     188            return date("H:i", strtotime($cutOffTime));
     189        }
    167190    }
    168191
    169192    $en_tab = new EnDayrossTab();
    170     return $en_tab->en_load();
     193    $en_tab->en_load();
     194    return $en_tab;
    171195}
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/location/assets/css/en-dayross-location.css

    r3428882 r3494315  
    119119    color: #ff0000;
    120120    font-size: 11px;
    121     margin: 0 0 0 40.2%;
    122     width: 100%;
     121    width: 58.7%;
    123122    display: block;
    124 }
    125 
    126 .en_location_error_message {
     123    float: right;
     124}
     125
     126.en_location_error_message,
     127.en_dayross_warehouse_error_message, .en_dayross_dropship_error_message {
    127128    background: #f1f1f1 none repeat scroll 0 0;
    128129    border-left: 4px solid #dc3232;
     
    134135}
    135136
    136 .en_location_success_message {
     137.en_location_success_message,
     138.en_dayross_wh_location_success_message, .en_dayross_ds_location_success_message,
     139.en_dayross_warehouse_success_message, .en_dayross_dropship_success_message {
    137140    background: #fff none repeat scroll 0 0;
    138141    border-left: 4px solid #46b450;
     
    144147}
    145148
     149.en_dayross_warehouse_success_message, .en_dayross_dropship_success_message {
     150    margin: auto;
     151}
     152
    146153.spinner_disable {
    147154    color: #000000;
     
    162169    background: #fff none repeat scroll 0 0;
    163170    border-bottom: 1px solid #e1e1e1;
    164     color: #0073aa;
     171    color: #0073aa !important;
    165172    font-size: 14px;
    166173    font-weight: 400;
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/location/assets/js/en-dayross-location.js

    r3428882 r3494315  
    169169        } else if (en_is_var_exist('severity', data) && data['severity'] == 'error') {
    170170            jQuery('.en_popup_location_form').delay(200).animate({scrollTop: 0}, 300);
     171            const location_type = data['location'] == 'warehouse' ? 'wh' : 'ds';
     172            jQuery(`.en_dayross_${location_type}_location_error_message span`).text(data['message']);
     173            en_show_errors(`.en_dayross_${location_type}_location_error_message`);
    171174            jQuery('.en_location_error_message span').text(data['message']);
    172             en_show_errors('.en_location_error_message');
    173175        }
    174176
     
    377379    function en_dayross_location_delete(e, data, en_location_type, en_location_id) {
    378380        e.preventDefault();
     381
     382        // If warehouse location then directly delete
     383        if (en_location_type) {
     384            en_dayross_location_confirm_delete(data, en_location_type, en_location_id);
     385            return;
     386        }
     387
    379388        en_popup_confirmation_location_delete_show();
    380389        jQuery('.en_close_popup_location').on('click', function () {
     
    423432        if (data['message'].length > 0) {
    424433            jQuery('.en_popup_location_form').delay(200).animate({scrollTop: 0}, 300);
    425             jQuery('.en_location_success_message span').text(data['message']);
    426             en_show_errors('.en_location_success_message');
     434            const location_type = data['location'] == 'warehouse' ? 'wh' : 'ds';
     435            jQuery(`.en_dayross_${location_type}_location_success_message span`).text(data['message']);
     436            en_show_errors(`.en_dayross_${location_type}_location_success_message`);
    427437        }
    428438    }
     
    464474    }
    465475}
     476
     477if (typeof en_dayross_select_bulk_locations != 'function') {
     478    function en_dayross_select_bulk_locations(location_class, e) {
     479        const checked = jQuery(e).is(':checked');
     480        jQuery(`.${location_class}`).prop('checked', checked);
     481    }
     482}
     483
     484if (typeof en_dayross_toggle_select_all_locations != 'function') {
     485    function en_dayross_toggle_select_all_locations(location_class, select_all_locations) {
     486        const allChecked = jQuery(`.${location_class}:checked`).length === jQuery(`.${location_class}`).length;
     487        jQuery(`#${select_all_locations}`).prop('checked', allChecked);
     488    }
     489}
     490
     491if (typeof en_dayross_delete_bulk_locations != 'function') {
     492    function en_dayross_delete_bulk_locations(e, location_class, location_type) {
     493        e.preventDefault();
     494        const location_ids = jQuery(`.${location_class}:checked`).map(function () {
     495            return this.value;
     496        }).get();
     497
     498        // Show error message if no locations are selected
     499        if (location_ids.length === 0) {
     500            const loc_error_class = `en_dayross_${location_type}_error_message`;
     501            jQuery(`.${loc_error_class}`).show('slow').delay(3000).hide('slow');
     502            return;
     503        }
     504
     505        const postForm = {
     506            'action': 'en_dayross_wd_bulk_delete_locations',
     507            'location_ids': location_ids,
     508            'location_type': location_type,
     509            'wp_nonce': en_dayross_location_script.nonce
     510        }
     511        const delete_locs_btn = `.en_dayross_bulk_delete_${location_type}`,
     512        loc_success_class = `.en_dayross_${location_type}_success_message`,
     513        loc_error_class = `.en_dayross_${location_type}_error_message`;
     514       
     515        jQuery.ajax({
     516            type: 'POST',
     517            url: ajaxurl,
     518            data: postForm,
     519            dataType: 'json',
     520            beforeSend: function () {
     521                jQuery(delete_locs_btn).addClass('spinner_disable');
     522            },
     523            success: function (data) {
     524                if (data.error && data.message) {
     525                    jQuery(delete_locs_btn).removeClass('spinner_disable');
     526                    jQuery(loc_error_class).show('slow').delay(3000).hide('slow');
     527                } else {
     528                    jQuery(delete_locs_btn).removeClass('spinner_disable');
     529                    jQuery(data.target_location).replaceWith(data.html);
     530                    jQuery(loc_success_class).show('slow').delay(3000).hide('slow');
     531                    jQuery('.warehouse_updated, .warehouse_created, .warehouse_deleted, .dropship_deleted, .dropship_updated, .dropship_created').css('display', 'none');
     532                }
     533            },
     534            error: function (error) {
     535                jQuery(delete_locs_btn).removeClass('spinner_disable');
     536                console.log(error);
     537            }
     538        });
     539    }
     540}
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/location/dropship/en-dropship.php

    r3351760 r3494315  
    4141
    4242            <h1><?php _e('Drop ships', 'eniture-technology'); ?></h1>
    43             <button type="button" onclick="en_show_popup_location(false, event)" type="button"
    44                     class="button-primary"><?php _e('Add', 'eniture-technology'); ?></button>
    45             <p><?php _e('Locations that inventory specific items that are drop shipped to the destination. Use the products settings
     43            <div style="display: flex; gap: 3px; align-items: center; margin-top: 20px;">
     44                <button type="button" onclick="en_show_popup_location(false, event)" type="button"
     45                        class="button-primary"><?php _e('Add', 'eniture-technology'); ?></button>
     46                <button type="button" class="en_dayross_bulk_delete_dropship en_wd_add_dropship_btn button-primary" title="Delete Drop Ships" onclick="return en_dayross_delete_bulk_locations(event, 'en_dayross_delete_dropship_item', 'dropship');"><?php _e('Delete', 'eniture-technology'); ?></button>
     47            </div>
     48
     49            <p><?php _e("Locations that inventory specific items that are drop shipped to the destination. Use the product's settings
    4650                    page to identify it as a drop shipped item and its associated drop ship location. Orders that include drop
    4751                    shipped items will display a single figure for the shipping rate estimate that is equal to the sum of the
    48                     cheapest option of each shipment required to fulfill the order.', 'eniture-technology'); ?></p>
     52                    cheapest option of each shipment required to fulfill the order.", 'eniture-technology'); ?></p>
     53
     54            <div class="en_dayross_ds_location_success_message"><strong>Success! </strong><span></span></div>
     55            <div class="en_dayross_dropship_success_message"><strong>Success!</strong> <span>Selected drop ships deleted successfully.</span></div>
     56            <div class="en_dayross_dropship_error_message"><strong>Error!</strong> Please select at least one drop ship to delete.</div>
    4957
    5058            <table class="en_location_table en_location_dropship_table">
    5159            <thead>
    5260            <tr>
     61                <th class="en_wd_dropship_list_heading en_dayross_bulk_delete_col">
     62                    <!-- Bulk delete -->
     63                    <input type="checkbox" name="en_dayross_bulk_delete_dropships" id="en_dayross_bulk_delete_dropships" onclick="return en_dayross_select_bulk_locations('en_dayross_delete_dropship_item', this);" />
     64                </th>
    5365                <?php echo force_balance_tags(\EnLocation::en_arrange_table_data('th', $en_heading)); ?>
    5466                <th><?php _e('Action', 'eniture-technology'); ?></th>
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/location/en-location.php

    r3428882 r3494315  
    278278
    279279                echo '<tr class="' . esc_attr($append_class) . '" id="en_location_row_id_' . esc_attr($en_location_id) . '">';
     280
     281                $_type = ($loc_type === 'wh') ? 'warehouse' : 'dropship';
     282                echo '<td class="en_wd_' . esc_attr($_type) . '_list_data en_dayross_bulk_delete_col">
     283                    <input
     284                        type="checkbox"
     285                        class="en_dayross_delete_' . esc_attr($_type) . '_item"
     286                        value="' . esc_attr($en_location_id) . '"
     287                        onclick="return en_dayross_toggle_select_all_locations(
     288                            \'en_dayross_delete_' . esc_attr($_type) . '_item\',
     289                            \'en_dayross_bulk_delete_' . esc_attr($_type) . 's\'
     290                        );"
     291                    >
     292                </td>';
    280293                echo self::en_arrange_table_data('td', $en_sorted_location);
    281294
     
    309322                        <?php _e('Warning!', 'eniture-technology'); ?>
    310323                    </h2>
     324                    <hr>
    311325                    <p class="en_confirmation_message">
    312                         <?php _e('If you delete this location, then location settings will be disabled against products
    313                         (if any).', 'eniture-technology'); ?>
     326                        Warning! If you delete this location, Drop ship location settings will be disabled against products if any.
    314327                    </p>
     328                    <hr>
    315329                    <div class="en_confirmation_buttons">
    316330                        <a href="#"
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/location/includes/en-location-ajax.php

    r3428882 r3494315  
    1818            add_action('wp_ajax_en_dayross_get_location', [$this, 'en_dayross_get_location']);
    1919            add_action('wp_ajax_en_dayross_location_delete_row', [$this, 'en_dayross_location_delete_row']);
     20
     21            add_action('wp_ajax_nopriv_en_dayross_wd_bulk_delete_locations', array($this, 'en_dayross_bulk_delete_locations_ajax'));
     22            add_action('wp_ajax_en_dayross_wd_bulk_delete_locations', array($this, 'en_dayross_bulk_delete_locations_ajax'));
    2023        }
    2124
     
    199202
    200203                if ($location === 'warehouse') {
    201                     $location_step = 'Warehouse';
     204                    $location_step = 'New warehouse';
    202205                    $en_location_template_obj = new EnDayrossWarehouseTemplate();
    203206                    $en_target_location = '.en_location_warehouse_main_div';
    204207                    $validate = ['zip', 'city', 'state', 'country', 'location'];
    205208                } else {
    206                     $location_step = 'Dropship';
     209                    $location_step = 'New drop ship';
    207210                    $en_location_template_obj = new EnDayrossDropshipTemplate();
    208211                    $en_target_location = '.en_location_dropship_main_div';
     
    222225                        (!empty($en_location_data) &&
    223226                            reset($en_location_data)['id'] === $location_id))) {
     227                    $location_step = $location === 'warehouse' ? 'Warehouse' : 'Drop ship';
    224228                    $message = $location_step . ' updated successfully.';
    225229                    $action = 'update';
     
    250254        }
    251255
     256        public function en_dayross_bulk_delete_locations_ajax()
     257        {
     258            if (!(current_user_can('manage_options') || current_user_can('manage_woocommerce')) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['wp_nonce'])), 'en_dayross_location_nonce')) {
     259                echo wp_json_encode(array('error' => true, 'message' => 'Unauthorized Access.'));
     260                exit;
     261            }
     262
     263            $location_ids = isset($_POST['location_ids']) ? $_POST['location_ids'] : array();
     264            $loc_type = isset($_POST['location_type']) ? $_POST['location_type'] : '';
     265            if (empty($location_ids)) {
     266                echo wp_json_encode(['error' => true, 'message' => "Please select at least one {$loc_type} to delete."]);
     267                exit;
     268            }
     269
     270            global $wpdb;
     271            foreach ($location_ids as $location_id) {
     272                if ($loc_type == 'dropship') {
     273                    $get_dropship_id = '';
     274                    $dropship_id = intval($location_id);
     275                    $get_dropship_array = array($dropship_id);
     276                    $ser = maybe_serialize($get_dropship_id);
     277                    $get_dropship_val = array_map('intval', $get_dropship_array);
     278                    $get_post_id = $wpdb->get_results("SELECT group_concat(post_id) as post_ids_list FROM `" . $wpdb->prefix . "postmeta` WHERE `meta_key` = '_dropship_location' AND (`meta_value` LIKE '%" . $ser . "%' OR `meta_value` = '" . $dropship_id . "')");
     279                    $post_id = reset($get_post_id)->post_ids_list;
     280
     281                    if (isset($post_id)) {
     282                        $wpdb->query("UPDATE `" . $wpdb->prefix . "postmeta` SET `meta_value` = '' WHERE `meta_key` IN('_enable_dropship','_dropship_location')  AND `post_id` IN ($post_id)");
     283                    }
     284                }
     285
     286                $wpdb->delete($wpdb->prefix . "warehouse", array('id' => intval($location_id), 'location' => $loc_type));
     287            }
     288
     289            if ($loc_type === 'warehouse') {
     290                $en_location_template_obj = new EnDayrossWarehouseTemplate();
     291                $en_target_location = '.en_location_warehouse_main_div';
     292            } else {
     293                $en_location_template_obj = new EnDayrossDropshipTemplate();
     294                $en_target_location = '.en_location_dropship_main_div';
     295            }
     296
     297            $html = $en_location_template_obj::en_load();
     298
     299            echo wp_json_encode(['error' => false, 'message' => 'Locations deleted successfully.', 'target_location' => $en_target_location, 'html' => $html]);
     300            exit;
     301        }
     302
    252303    }
    253304
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/location/warehouse/en-warehouse.php

    r3351760 r3494315  
    3636            <div class="en_location_warehouse_main_div">
    3737
    38             <div class="en_location_success_message">
    39                 <strong><?php _e('Success!', 'eniture-technology'); ?></strong> <span></span></div>
     38            <h1><?php _e('Warehouses', 'eniture-technology'); ?></h1>
     39            <div style="display: flex; gap: 3px; align-items: center; margin-top: 20px;">
     40                <button title="Add Warehouse" type="button" onclick="en_show_popup_location(true, event)" type="button"
     41                        class="button-primary <?php echo esc_attr(self::$disabled_plan); ?>"><?php _e('Add', 'eniture-technology'); ?>
     42                </button>
     43                 <button type="button" class="en_dayross_bulk_delete_warehouse en_wd_add_warehouse_btn button-primary" title="Delete Warehouses" onclick="return en_dayross_delete_bulk_locations(event, 'en_dayross_delete_warehouse_item', 'warehouse');"><?php _e('Delete', 'eniture-technology'); ?>
     44                </button>
    4045
    41             <h1><?php _e('Warehouses', 'eniture-technology'); ?></h1>
    42             <button type="button" onclick="en_show_popup_location(true, event)" type="button"
    43                     class="button-primary <?php echo esc_attr(self::$disabled_plan); ?>"><?php _e('Add', 'eniture-technology'); ?>
    44             </button>
    45             <?php echo force_balance_tags(self::$plan_required); ?>
     46                <?php echo force_balance_tags(self::$plan_required); ?>
     47            </div>
    4648
    4749            <p><?php _e('Warehouses that inventory all products not otherwise identified as drop shipped items. The warehouse with the
    4850                    lowest shipping cost to the destination is used for quoting purposes.', 'eniture-technology'); ?></p>
     51           
     52            <div class="en_dayross_wh_location_success_message"><strong>Success! </strong><span></span></div>
     53            <div class="en_dayross_warehouse_success_message"><strong>Success! </strong> <span>Selected warehouses deleted successfully.</span></div>
     54            <div class="en_dayross_warehouse_error_message"><strong>Error!</strong> <span>Please select at least one warehouse to delete.</span></div>
    4955
    5056            <table class="en_location_table en_location_warehouse_table">
    5157            <thead>
    5258            <tr>
     59                 <th class="en_wd_warehouse_list_heading en_dayross_bulk_delete_col">
     60                    <!-- Bulk delete -->
     61                    <input type="checkbox" name="en_dayross_bulk_delete_warehouses" id="en_dayross_bulk_delete_warehouses" onclick="return en_dayross_select_bulk_locations('en_dayross_delete_warehouse_item', this);" />
     62                </th>
    5363                <?php echo force_balance_tags(\EnLocation::en_arrange_table_data('th', $en_heading)); ?>
    5464                <th><?php _e('Action', 'eniture-technology'); ?></th>
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/logs/en-logs.php

    r3462301 r3494315  
    4848           
    4949            $url = EN_DAYROSS_ROOT_URL_QUOTES . '/request-log/index.php';
    50             $logs = $obj_classs->en_dayross_sent_http_request($url, $data, 'POST');
     50            $logs = $obj_classs->en_dayross_sent_http_request($url, $data, 'POST', 'Logs');
    5151            $logs = (isset($logs) && is_string($logs) && strlen($logs) > 0) ? json_decode($logs, true) : [];
    5252
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/admin/tab/quote-settings/en-quote-settings.php

    r3428882 r3494315  
    2626            }
    2727
     28             if (get_option('en_quote_settings_show_delivery_estimate_dayross') == 'yes') {
     29                update_option('en_quote_settings_delivery_estimate_options_dayross', 'delivery_date');
     30                delete_option('en_quote_settings_show_delivery_estimate_dayross');
     31            }
     32
     33            // Cuttoff Time
     34            $dayross_disable_cutt_off_time_ship_date_offset = "";
     35            $dayross_cutt_off_time_package_required = "";
     36
     37            //  Check the cutt of time & offset days plans for disable input fields
     38            $dayross_action_cutOffTime_shipDateOffset = apply_filters('dayross_plans_suscription_and_features', 'order_cutt_off_time');
     39            if (is_array($dayross_action_cutOffTime_shipDateOffset) && false) {
     40                $dayross_disable_cutt_off_time_ship_date_offset = "disabled_me";
     41                $dayross_cutt_off_time_package_required = apply_filters('dayross_plans_notification_link', $dayross_action_cutOffTime_shipDateOffset);
     42            }
     43
    2844            $ltl_enable = get_option('en_plugins_return_LTL_quotes');
    2945            $weight_threshold_class = $ltl_enable == 'yes' ? 'show_en_weight_threshold_lfq' : 'hide_en_weight_threshold_lfq';
     
    5773                 * ==================================================================
    5874                 */
    59                 'en_quote_settings_show_delivery_estimate_dayross' => [
    60                     'name' => __('Show Delivery Estimate ', 'woocommerce-settings-dayross'),
    61                     'type' => 'checkbox',
    62                     'id' => 'en_quote_settings_show_delivery_estimate_dayross'
    63                 ],
     75
     76                //** Start Delivery Estimate Options - Cuttoff Time
     77                 'delivery_estimate_options_dayross' => array(
     78                    'name' => __('Delivery Estimate Options ', 'woocommerce-settings-dayross'),
     79                    'type' => 'text',
     80                    'class' => 'hidden',
     81                    'id' => 'delivery_estimate_options_dayross'
     82                ),
     83                'en_quote_settings_delivery_estimate_options_dayross' => array(
     84                    'name' => '',
     85                    'type' => 'radio',
     86                    'default' => 'dont_show_estimates',
     87                    'options' => array(
     88                        'dont_show_estimates' => __("Don't display delivery estimates.", 'woocommerce-settings-dayross'),
     89                        'delivery_days' => __("Display estimated number of days until delivery.", 'woocommerce-settings-dayross'),
     90                        'delivery_date' => __("Display estimated delivery date.", 'woocommerce-settings-dayross'),
     91                    ),
     92                    'id' => 'en_quote_settings_delivery_estimate_options_dayross',
     93                    'class' => 'dayross_lfq_dont_show_estimate_option',
     94                ),
     95                //** End Delivery Estimate Options
     96
     97                //**Start: Cut Off Time & Ship Date Offset
     98                'en_quote_settings_cutt_off_time_ship_date_offset_dayross' => array(
     99                    'name' => __('Cut Off Time & Ship Date Offset ', 'woocommerce-settings-dayross'),
     100                    'type' => 'text',
     101                    'class' => 'hidden',
     102                    'desc' => $dayross_cutt_off_time_package_required,
     103                    'id' => 'en_quote_settings_cutt_off_time_ship_date_offset_dayross'
     104                ),
     105                'en_quote_settings_order_cut_off_time_dayross' => array(
     106                    'name' => __('Order Cut Off Time ', 'woocommerce-settings-dayross'),
     107                    'type' => 'text',
     108                    'placeholder' => '-- : -- --',
     109                    'desc' => 'Enter the cut off time (e.g. 2:00) for the orders. Orders placed after this time will be quoted as shipping the next business day.',
     110                    'id' => 'en_quote_settings_order_cut_off_time_dayross',
     111                    'class' => $dayross_disable_cutt_off_time_ship_date_offset,
     112                ),
     113                'en_quote_settings_shipment_offset_days_dayross' => array(
     114                    'name' => __('Fulfillment Offset Days ', 'woocommerce-settings-dayross'),
     115                    'type' => 'text',
     116                    'desc' => 'The number of days the ship date needs to be moved to allow for the processing of the order.',
     117                    'placeholder' => 'Fulfillment Offset Days, e.g. 2',
     118                    'id' => 'en_quote_settings_shipment_offset_days_dayross',
     119                    'class' => $dayross_disable_cutt_off_time_ship_date_offset,
     120                ),
     121                'en_quote_settings_all_shipment_days_dayross' => array(
     122                    'name' => __("What days do you ship orders?", 'woocommerce-settings-dayross'),
     123                    'type' => 'checkbox',
     124                    'desc' => 'Select All',
     125                    'class' => "all_shipment_days_dayross_lfq $dayross_disable_cutt_off_time_ship_date_offset",
     126                    'id' => 'en_quote_settings_all_shipment_days_dayross'
     127                ),
     128                'en_quote_settings_monday_shipment_day_dayross' => array(
     129                    'name' => __("", 'woocommerce-settings-dayross'),
     130                    'type' => 'checkbox',
     131                    'desc' => 'Monday',
     132                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     133                    'id' => 'en_quote_settings_monday_shipment_day_dayross'
     134                ),
     135                'en_quote_settings_tuesday_shipment_day_dayross' => array(
     136                    'name' => __("", 'woocommerce-settings-dayross'),
     137                    'type' => 'checkbox',
     138                    'desc' => 'Tuesday',
     139                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     140                    'id' => 'en_quote_settings_tuesday_shipment_day_dayross'
     141                ),
     142                'en_quote_settings_wednesday_shipment_day_dayross' => array(
     143                    'name' => __("", 'woocommerce-settings-dayross'),
     144                    'type' => 'checkbox',
     145                    'desc' => 'Wednesday',
     146                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     147                    'id' => 'en_quote_settings_wednesday_shipment_day_dayross'
     148                ),
     149                'en_quote_settings_thursday_shipment_day_dayross' => array(
     150                    'name' => __("", 'woocommerce-settings-dayross'),
     151                    'type' => 'checkbox',
     152                    'desc' => 'Thursday',
     153                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     154                    'id' => 'en_quote_settings_thursday_shipment_day_dayross'
     155                ),
     156                'en_quote_settings_friday_shipment_day_dayross' => array(
     157                    'name' => __("", 'woocommerce-settings-dayross'),
     158                    'type' => 'checkbox',
     159                    'desc' => 'Friday',
     160                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     161                    'id' => 'en_quote_settings_friday_shipment_day_dayross'
     162                ),
     163                'en_quote_settings_show_delivery_estimate_dayross' => array(
     164                    'title' => __('', 'woocommerce'),
     165                    'name' => __('', 'woocommerce-settings-dayross'),
     166                    'desc' => '',
     167                    'id' => 'dayross_lfq_show_delivery_estimates',
     168                    'css' => '',
     169                    'default' => '',
     170                    'type' => 'title',
     171                ),
     172                //**End: Cut Off Time & Ship Date Offset
     173
    64174                'residential_delivery_options_label' => [
    65175                    'name' => __('Residential Delivery', 'woocommerce-settings-dayross'),
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/common/en-plans.php

    r3304907 r3494315  
    4848                    $plugin_info = get_plugins();
    4949                    $plugin_version = (isset($plugin_info[$index]['Version'])) ? $plugin_info[$index]['Version'] : 0;
    50                     $plugin_dir_url = EN_DAYROSS_DIR_FILE . 'en-hit-to-update-plan.php';
     50                   
    5151                    $post_data = array(
    5252                        'platform' => 'wordpress',
    5353                        'carrier' => '79',
    5454                        'store_url' => EN_DAYROSS_SERVER_NAME,
    55                         'webhook_url' => $plugin_dir_url,
     55                        'webhook_url' => '',
    5656                        'plugin_version' => $plugin_version,
    5757                        'license_key' => get_option('en_connection_settings_license_key_dayross'),
     
    8282                $plugin_info = get_plugins();
    8383                $plugin_version = (isset($plugin_info[$index]['Version'])) ? $plugin_info[$index]['Version'] : 0;
    84                 $plugin_dir_url = EN_DAYROSS_DIR_FILE . 'en-hit-to-update-plan.php';
     84               
    8585                $post_data = array(
    8686                    'platform' => 'wordpress',
    8787                    'carrier' => '79',
    8888                    'store_url' => EN_DAYROSS_SERVER_NAME,
    89                     'webhook_url' => $plugin_dir_url,
     89                    'webhook_url' => '',
    9090                    'plugin_version' => $plugin_version,
    9191                    'license_key' => get_option('en_connection_settings_license_key_dayross'),
     
    152152                'multi_warehouse' => ['2', '3'],
    153153                'nested_material' => ['3'],
    154                 'multi_dropships' => ['0', '1', '2', '3']
     154                'multi_dropships' => ['0', '1', '2', '3'],
     155                'order_cutt_off_time' => ['2', '3']
    155156            ];
    156157
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/en-install.php

    r3490815 r3494315  
    6767            'dayross_backup_rates_cart_price_percentage' => get_option("dayross_backup_rates_cart_price_percentage"),
    6868            'dayross_backup_rates_weight_function' => get_option("dayross_backup_rates_weight_function"),
     69             // Cuttoff Time
     70            'dayross_order_cut_off_time' => get_option("en_quote_settings_order_cut_off_time_dayross"),
    6971        ]);
    7072
    71         wp_enqueue_script('EnDayrossLocationScript', EN_DAYROSS_DIR_FILE . '/admin/tab/location/assets/js/en-dayross-location.js', [], '1.0.6');
     73        wp_enqueue_script('EnDayrossLocationScript', EN_DAYROSS_DIR_FILE . '/admin/tab/location/assets/js/en-dayross-location.js', [], '1.0.7');
    7274        wp_localize_script('EnDayrossLocationScript', 'en_dayross_location_script', array(
    7375            'pluginsUrl' => EN_DAYROSS_PLUGIN_URL,
     
    8082        ));
    8183
    82         wp_register_style('EnDayrossLocationStyle', EN_DAYROSS_DIR_FILE . '/admin/tab/location/assets/css/en-dayross-location.css', false, '1.0.3');
     84        wp_register_style('EnDayrossLocationStyle', EN_DAYROSS_DIR_FILE . '/admin/tab/location/assets/css/en-dayross-location.css', false, '1.0.4');
    8385        wp_enqueue_style('EnDayrossLocationStyle');
    8486
     
    8890        wp_register_style('EnDayrossProductCss', EN_DAYROSS_DIR_FILE . '/admin/product/assets/en-custom-fields-style.css', false, '1.0.2');
    8991        wp_enqueue_style('EnDayrossProductCss');
     92
     93        // Cuttoff Time
     94        wp_register_style('EnDayrossWickedPickerStyle', EN_DAYROSS_DIR_FILE . '/admin/assets/wickedpicker.min.css', false, '1.0.0');
     95        wp_register_script('EnDayrossWickedPickerScript', EN_DAYROSS_DIR_FILE . '/admin/assets/wickedpicker.js', false, '1.0.0');
     96       
     97        wp_enqueue_style('EnDayrossWickedPickerStyle');
     98        wp_enqueue_script('EnDayrossWickedPickerScript');
    9099    }
    91100
     
    118127    function en_dayross_shipping_sections($settings)
    119128    {
    120         $settings[] = include('admin/tab/en-tab.php');
     129        $en_tab = include('admin/tab/en-tab.php');
     130        if (is_object($en_tab)) {
     131            $settings[] = $en_tab;
     132        }
     133       
    121134        return $settings;
    122135    }
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/http/en-curl.php

    r3428882 r3494315  
    2525        static public function en_dayross_sent_http_request($url, $post_data, $method, $step_for = '') {
    2626            $curl_response = '';
     27            $en_time_start = 0;
     28
    2729            if (strlen($url) > 0 && is_array($post_data) && !empty($post_data)) {
    2830
    2931                $post_data = self::remove_extra_request_data($post_data);
     32                $cachable_data = self::create_cachable_data($post_data);
     33                $cache_key = self::create_cache_key($cachable_data);
     34                $cache_response = get_transient($cache_key);
     35                $skip_cache = in_array($step_for, ['Plan', 'Logs', 'Address', 'Connection']);
    3036
    31                 // Eniture Execution Time
    32                 $en_time_start = microtime(true);
     37                if ($skip_cache || false === $cache_response) {
     38                    // Eniture Execution Time
     39                    $en_time_start = microtime(true);
    3340
    34                 // Eniture Debug Mood
    35                 do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Request ", $post_data);
     41                    // Eniture Debug Mood
     42                    do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Request ", $post_data);
    3643
    37                 $method == 'POST' ? $post_data = http_build_query($post_data) : '';
     44                    $method == 'POST' ? $post_data = http_build_query($post_data) : '';
    3845
    39                 // Eniture Debug Mood
    40                 do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Build Query ", $post_data);
     46                    // Eniture Debug Mood
     47                    do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Build Query ", $post_data);
    4148
    42                 $response = wp_remote_post($url, [
    43                     'method' => $method,
    44                     'timeout' => 60,
    45                     'redirection' => 5,
    46                     'blocking' => true,
    47                     'body' => $post_data,
    48                         ]
    49                 );
    50                 $curl_response = wp_remote_retrieve_body($response);
    51                 $headers = wp_remote_retrieve_headers($response);
    52                 self::eniture_check_rate_limit_headers($headers);
     49                    $response = wp_remote_post($url, [
     50                        'method' => $method,
     51                        'timeout' => 60,
     52                        'redirection' => 5,
     53                        'blocking' => true,
     54                        'body' => $post_data,
     55                            ]
     56                    );
     57                    $headers = wp_remote_retrieve_headers($response);
     58                    self::eniture_check_rate_limit_headers($headers);
     59                    $curl_response = wp_remote_retrieve_body($response);
     60                    $resp = !empty($curl_response) && is_string($curl_response) ? json_decode($curl_response, true) : $curl_response;
     61
     62                    if (!empty($resp) && (!isset($resp['severity']) || (isset($resp['severity']) && $resp['severity'] != 'ERROR'))) {
     63                        set_transient($cache_key, $curl_response, 12 * HOUR_IN_SECONDS);
     64                    }
     65
     66                    // Eniture Debug Mood
     67                    do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Response ", json_decode($curl_response));
     68                } else {
     69                    $curl_response = $cache_response;
     70
     71                    // Eniture Debug Mood
     72                    do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Cache Response ", $curl_response);
     73                }
    5374            }
    54 
    55             // Eniture Debug Mood
    56             do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Response ", json_decode($curl_response));
    5775
    5876            // Eniture Execution Time
     
    98116        }
    99117
     118        static public function create_cachable_data($request_data)
     119        {
     120            $cache_keys = ['serverName', 'platform', 'carrierType', 'carrierName', 'carrierMode', 'requestVersion', 'clientId', 'clientSecret', 'requestForNewAPI', 'emailAddress', 'password', 'billToAccountNumber', 'licenseKey', 'dimWeightBaseAccount', 'shipment_type', 'LTL_FREIGHT', 'product_name', 'shipment_weight', 'commdityDetails', 'originAddress', 'receiverZip', 'receiverState', 'receiverCountryCode', 'receiverCity', 'addressLine', 'instorPickupLocalDelEnable', 'doNesting', 'modifyShipmentDateTime', 'OrderCutoffTime', 'shipmentOffsetDays', 'shipmentWeekDays', 'liftGateAsAnOption', 'accessorials', 'handlingUnitWeight', 'maxWeightPerHandlingUnit'];
     121            $cachable_data = [];
     122           
     123            // get the data from the request
     124            foreach ($cache_keys as $key) {
     125                if (isset($request_data[$key])) $cachable_data[$key] = $request_data[$key];
     126            }
     127
     128            if (isset($request_data['autoResidentials']) && $request_data['autoResidentials'] == 1) {
     129                $cachable_data['autoResidentials'] = $request_data['autoResidentials'];
     130                $cachable_data['addressLine'] = $request_data['addressLine'];
     131                $cachable_data['addressLine2'] = (isset($request_data['addressLine2'])) ? $request_data['addressLine2'] : '';
     132                $cachable_data['defaultRADAddressType'] = $request_data['defaultRADAddressType'];
     133                $cachable_data['defaultRADWithoutStreetAddress'] = $request_data['defaultRADWithoutStreetAddress'];
     134                $cachable_data['poboxAddressValidation'] = $request_data['poboxAddressValidation'];
     135            }
     136
     137            if (isset($request_data['standardPackaging']) && $request_data['standardPackaging'] == 1) {
     138                $cachable_data['standardPackaging'] = $request_data['standardPackaging'];
     139                $cachable_data['pallet'] = $request_data['pallet'];
     140            }
     141
     142            return $cachable_data;
     143        }
     144
     145        static public function create_cache_key($request_data)
     146        {
     147            $request_build_query = http_build_query($request_data);
     148            return md5('eniture_dayross_' . $request_build_query);
     149        }
    100150    }
    101151
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/ltl-freight-quotes-dayross-edition.php

    r3490815 r3494315  
    44 * Plugin URI: https://eniture.com/products/
    55 * Description: Dynamically retrieves your negotiated shipping rates from Day & Ross and displays the results in the WooCommerce shopping cart.
    6  * Version: 2.2.4
     6 * Version: 2.2.5
    77 * Author: Eniture Technology
    88 * Author URI: http://eniture.com/
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/readme.txt

    r3490815 r3494315  
    44Requires at least: 6.4
    55Tested up to: 6.9
    6 Stable tag: 2.2.4
     6Stable tag: 2.2.5
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    149149== Changelog ==
    150150
     151= 2.2.5 - 2026-03-30 =
     152* Update: Added cache support to handle duplicate simultaneous quote requests efficiently.
     153* Update: Added delivery estimate options and order cutoff time functionality to the quote settings.
     154* Update: Added bulk delete support for warehouse and drop ship locations.
     155* Update: Added product-level offset days functionality.
     156* Fix: Resolved Broken Access Control vulnerability to improve overall plugin security.
     157
    151158= 2.2.4 - 2026-03-25 =
    152159* Update: Updated labels text in the connection settings for improved clarity and consistency.
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/server/api/en-response.php

    r3462301 r3494315  
    318318            }
    319319
    320             $handling_fee = $en_settings_label = $rating_method = $transit_days = $enable_carriers = $liftgate_resid_delivery = $liftgate_delivery_option = '';
     320            $handling_fee = $en_settings_label = $rating_method = $transit_days = $delivery_estimate_option = $enable_carriers = $liftgate_resid_delivery = $liftgate_delivery_option = '';
    321321            $overlength_fees = [];
    322322            self::$en_settings = json_decode(EN_DAYROSS_SET_QUOTE_SETTINGS, true);
     
    374374                $label = isset($is_valid_label) && $is_valid_label ? $en_settings_label : 'Freight';
    375375                $calculated_transit_date = self::en_sanitize_rate('deliveryTimestamp', '');
     376                $calculated_transit_days = self::en_sanitize_rate('totalTransitTimeInDays', '');
    376377                $append_transit = '';
    377378
    378                 if ($rating_method != "average_rate" && is_string($calculated_transit_date) && self::$en_is_shipment == 'en_single_shipment' && strlen($calculated_transit_date) > 0 && $transit_days == "yes") {
    379                     $append_transit = ' (Expected delivery by ' . date('m-d-Y', strtotime($calculated_transit_date)) . ')';
     379                 if ($rating_method != "average_rate" && isset($delivery_estimate_option) && !empty($delivery_estimate_option) && $delivery_estimate_option != 'dont_show_estimates' && self::$en_is_shipment != 'multi_shipment') {
     380
     381                    if ($delivery_estimate_option == 'delivery_date' && is_string($calculated_transit_date) && strlen($calculated_transit_date) > 0) {
     382                        $append_transit = ' (Expected delivery by ' . date('m-d-Y', strtotime($calculated_transit_date)) . ')';
     383                    } else if ($delivery_estimate_option == 'delivery_days' && is_numeric($calculated_transit_days)) {
     384                        $append_transit = ' (Intransit days: ' . $calculated_transit_days . ')';
     385                    }
    380386                }
    381387
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/server/common/en-quote-settings.php

    r3462301 r3494315  
    7070            $range_5 = isset($range_5) && strlen($range_5) > 0 ? $range_5 : 770;
    7171
     72            $dayross_shipment_days = ['all', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday'];
     73            $shipment_days = [];
     74            foreach ($dayross_shipment_days as $key => $day) {
     75                get_option('en_quote_settings_' . $day . '_shipment_day_dayross') == 'yes' ? $shipment_days[] = $key : '';
     76            }
     77
    7278            $quote_settings = [
     79                // Cut Off Time & Ship Date Offset
     80                'delivery_estimate_option' => get_option('en_quote_settings_delivery_estimate_options_dayross'),
     81                'cutt_off_time' => get_option('en_quote_settings_order_cut_off_time_dayross'),
     82                'fulfilment_offset_days' => get_option('en_quote_settings_shipment_offset_days_dayross'),
     83                'shipment_days' => $shipment_days,
    7384                'transit_days' => get_option('en_quote_settings_show_delivery_estimate_dayross'),
    7485                'own_freight' => get_option('en_quote_settings_own_arrangment_dayross'),
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/server/en-shipping-rates.php

    r3462301 r3494315  
    221221                            $rate['label'] .= (!empty($label_sufex)) ? ' with ' . implode(' and ', $label_sufex) : '';
    222222                            $rate['label'] .= !empty($rate['append_transit']) ? $rate['append_transit'] : '';
     223
     224                            // Update rate label in FDO meta data
     225                            if (isset($rate['meta_data']['en_fdo_meta_data']['rate']['label'])) {
     226                                $rate['meta_data']['en_fdo_meta_data']['rate']['label'] = $rate['label'];
     227                            }
     228
    223229                            isset($rate['cost']) && $en_small_package_charges > 0 ?
    224230                                $rate['cost'] = $rate['cost'] + $en_small_package_charges : 0;
  • ltl-freight-quotes-day-ross-edition/tags/2.2.5/server/package/en-package.php

    r3462301 r3494315  
    182182                    // Get product level markup value
    183183                    $product_level_markup = self::en_get_product_level_markup($product_data, $product['variation_id'], $product['product_id'], $product['quantity']);
     184                    $product_level_fulfillment_offset = self::en_get_product_level_fulfillment_offset_days($product_data, $product['variation_id'], $product['product_id']);
    184185                    $get_freight = self::en_dayross_get_freight_class($product, $product_data);
    185186                    $freightClass_ltl_gross = ($get_freight['freight_class'] == 0) ? $get_freight['freight_class'] = "" : $get_freight['freight_class'];
     
    214215                        'markup' => $product_level_markup,
    215216                        'lineItemClass' => $freightClass_ltl_gross,
     217                        'fulfillment_offset_days' => $product_level_fulfillment_offset,
    216218                    ];
    217219
     
    330332                        self::$en_request['commdityDetails'][$origin_zip_code][$is_line_item] = $product_item;
    331333                        self::$en_request['originAddress'][$origin_zip_code] = $origin_address;
     334
     335                        // Track maximum fulfillment offset days
     336                        if (is_numeric($product_level_fulfillment_offset) && $product_level_fulfillment_offset > 0) {
     337                            if (!isset(self::$en_request['max_fulfillment_offset_days']) || $product_level_fulfillment_offset > self::$en_request['max_fulfillment_offset_days']) {
     338                                self::$en_request['max_fulfillment_offset_days'] = $product_level_fulfillment_offset;
     339                            }
     340                        }
    332341                    }
    333342                }
     
    405414            // Configure standard plugin with pallet packaging addon
    406415            self::$en_request = apply_filters('en_pallet_identify', array_merge(EnDayrossConnectionSettings::en_static_request_detail(), self::$en_request));
     416
     417            // Add the settings from quote page
     418            self::en_dayross_quote_settings_detail();
    407419
    408420            return self::$en_request;
     
    631643            switch (self::$product_key_name) {
    632644                case '_dropship_location':
     645                    $_post_id = self::$post_id;
    633646                    $enable_dropship = get_post_meta(self::$post_id, '_enable_dropship', true);
     647                   
    634648                    // check for parent id
    635649                    if (empty($enable_dropship) && self::$parent_id > 0 && self::$parent_id != self::$post_id) {
    636                         self::$post_id = self::$parent_id;
    637                         $enable_dropship = get_post_meta(self::$post_id, '_enable_dropship', true);
     650                        $_post_id = self::$parent_id;
     651                        $enable_dropship = get_post_meta($_post_id, '_enable_dropship', true);
    638652                    }
    639653                   
     
    643657                            $all_plugins = apply_filters('active_plugins', get_option('active_plugins'));
    644658                            if (stripos(implode($all_plugins), 'micro-warehouse-shipping.php')  || is_plugin_active_for_network('micro-warehouse-shipping-for-woocommerce/micro-warehouse-shipping.php')) {
    645                                 $locations_dropship = maybe_unserialize(get_post_meta(self::$post_id, '_dropship_location', true));
     659                                $locations_dropship = maybe_unserialize(get_post_meta($_post_id, '_dropship_location', true));
    646660
    647661                                if(!empty($locations_dropship)) {
     
    651665                            }
    652666
    653                             $en_dayross_get_location = self::en_dayross_get_location(get_post_meta(self::$post_id, self::$product_key_name, true));
     667                            $en_dayross_get_location = self::en_dayross_get_location(get_post_meta($_post_id, self::$product_key_name, true));
    654668
    655669                            if (empty($en_dayross_get_location)) {
     
    762776        }
    763777
     778        static public function en_get_product_level_fulfillment_offset_days($_product, $variation_id, $product_id)
     779        {
     780            $fulfillment_offset_days = '';
     781            $field_name = '_eniture_product_level_fulfillment_offset_days';
     782
     783            if ($_product->get_type() == 'variation' && $variation_id > 0) {
     784                $fulfillment_offset_days = get_post_meta($variation_id, $field_name, true);
     785
     786                if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) {
     787                    $parent_id = $_product->get_parent_id();
     788                    if ($parent_id > 0) {
     789                        $fulfillment_offset_days = get_post_meta($parent_id, $field_name, true);
     790                    }
     791                }
     792            } else {
     793                $fulfillment_offset_days = get_post_meta($_product->get_id(), $field_name, true);
     794            }
     795
     796            if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) {
     797                $fulfillment_offset_days = get_post_meta($product_id, $field_name, true);
     798            }
     799
     800            // Validate and sanitize the value before returning
     801            if (is_numeric($fulfillment_offset_days)) {
     802                $value = intval($fulfillment_offset_days);
     803                return $value;
     804            }
     805
     806            // Return empty string if invalid
     807            return '';
     808        }
     809
     810        /**
     811         * Quote settings
     812         * @param array $location
     813         * @return array|false
     814         */
     815        static public function en_dayross_quote_settings_detail() {
     816            $delivery_estimate_option = $cutt_off_time = $fulfilment_offset_days = '';
     817            $settings = $shipment_days = [];
     818            $feature_option = apply_filters("dayross_plans_suscription_and_features", 'order_cutt_off_time');
     819            $en_settings = json_decode(EN_DAYROSS_SET_QUOTE_SETTINGS, true);
     820            extract($en_settings);
     821
     822            // Use product-level fulfillment offset days if available, otherwise use global setting
     823            if (isset(self::$en_request['max_fulfillment_offset_days']) && is_numeric(self::$en_request['max_fulfillment_offset_days']) && self::$en_request['max_fulfillment_offset_days'] > 0) {
     824                $fulfilment_offset_days = self::$en_request['max_fulfillment_offset_days'];
     825            }
     826
     827            if (!is_array($feature_option) && ($delivery_estimate_option == 'delivery_days' || $delivery_estimate_option == 'delivery_date')) {
     828                $settings = [
     829                    'modifyShipmentDateTime' => strlen($cutt_off_time) > 0 || strlen($fulfilment_offset_days) > 0 || !empty($shipment_days) ? true : false,
     830                    'OrderCutoffTime' => $cutt_off_time,
     831                    'shipmentOffsetDays' => $fulfilment_offset_days,
     832                    'storeDateTime' => gmdate('Y-m-d H:i:s'),
     833                    'shipmentWeekDays' => $shipment_days,
     834                ];
     835            }
     836
     837            self::$en_request = array_merge(self::$en_request, $settings);
     838        }
     839
    764840    }
    765841
  • ltl-freight-quotes-day-ross-edition/trunk/admin/assets/en-dayross-admin.css

    r3489974 r3494315  
    127127}
    128128
    129 .en_quote_settings_sub_options th {
     129.en_quote_settings_sub_options th,
     130.dayross_cutt_off_time_ship_date_offset th,
     131.en_quote_settings_shipment_offset_days_dayross_tr th,
     132.en_quote_settings_all_shipment_days_dayross_tr th
     133{
    130134    padding: 0 0 10px 15px;
    131135    margin-left: 10px !important;
     
    133137}
    134138
    135 .en_quote_settings_sub_options td {
     139.dayross_cutt_off_time_ship_date_offset th,
     140.en_quote_settings_shipment_offset_days_dayross_tr th,
     141.en_quote_settings_all_shipment_days_dayross_tr th {
     142    padding-top: 10px !important;
     143}
     144
     145.en_quote_settings_sub_options td,
     146.dayross_cutt_off_time_ship_date_offset td,
     147.en_quote_settings_shipment_offset_days_dayross_tr td,
     148.en_quote_settings_all_shipment_days_dayross_tr td {
    136149    padding: 0 0 10px 15px;
    137150}
     
    364377.woocommerce_variable_attributes.wc-metabox-content [class^="_nmfc_number"],
    365378.woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"],
     379.woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"],
    366380.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"],
    367381.woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"],
     
    387401.woocommerce_variable_attributes.wc-metabox-content [class^="en_flat_rate_price"],
    388402.woocommerce_variable_attributes.wc-metabox-content [class^="_en_product_markup"],
     403.woocommerce_variable_attributes.wc-metabox-content [class^="_eniture_product_level_fulfillment_offset_days"],
    389404.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedPercentage"],
    390405.woocommerce_variable_attributes.wc-metabox-content [class^="_nestedDimension"],
     
    396411.woocommerce_variable_attributes.wc-metabox-content .data p[class*="en_flat_rate_price"] span.woocommerce-help-tip,
    397412.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_en_product_markup"] span.woocommerce-help-tip,
     413.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_eniture_product_level_fulfillment_offset_days"] span.woocommerce-help-tip,
    398414.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedPercentage"] span.woocommerce-help-tip,
    399415.woocommerce_variable_attributes.wc-metabox-content .data p[class*="_nestedDimension"] span.woocommerce-help-tip,
     
    468484    background: none !important;
    469485}
     486
     487.en_quote_settings_all_shipment_days_dayross_tr td {
     488  display: flex !important;
     489  align-items: center;
     490  gap: 16px;
     491  flex-wrap: nowrap;
     492}
  • ltl-freight-quotes-day-ross-edition/trunk/admin/assets/en-dayross-admin.js

    r3490815 r3494315  
    6666        jQuery('#en_dayross_quote_settings').parents().find('.button-primary, .is-primary').on('click', function (event) {
    6767
     68            jQuery(':checkbox:disabled').prop('disabled', false);
     69
    6870            let en_validate_settings = {};
    6971            let en_data_error = true;
     
    179181            }
    180182
     183            // Validate fullfillment offset days
     184            if (!dayrossValidateFullfillmentOffsetDays()) return false;
    181185            // backup rates validation
    182186            if (!dayrossBackupRatesValidations()) return false;
     
    376380    handleAPISelection();
    377381    jQuery('#en_connection_settings_api_dayross').on('change', handleAPISelection);
     382
     383    // Cut-off time and shipment offset days settings
     384    dayrossCutOffTimeAndShipDateSettings();
    378385});
    379386
     
    801808    }
    802809}
     810
     811if (typeof dayrossCutOffTimeAndShipDateSettings != 'function') {
     812    function dayrossCutOffTimeAndShipDateSettings() {
     813        jQuery("#en_quote_settings_shipment_offset_days_dayross").closest('tr').addClass("en_quote_settings_shipment_offset_days_dayross_tr");
     814        jQuery("#en_quote_settings_all_shipment_days_dayross").closest('tr').addClass("en_quote_settings_all_shipment_days_dayross_tr");
     815        jQuery(".dayross_shipment_day ").closest('tr').addClass("dayross_shipment_day_tr");
     816        jQuery("#en_quote_settings_order_cut_off_time_dayross").closest('tr').addClass("dayross_cutt_off_time_ship_date_offset");
     817        jQuery("#en_quote_settings_shipment_offset_days_dayross").attr('maxlength', '2');
     818
     819        const dayross_current_time = en_dayross_admin_script.dayross_order_cut_off_time;
     820        if (dayross_current_time == '') {
     821            jQuery('#en_quote_settings_order_cut_off_time_dayross').wickedpicker({
     822                now: '',
     823                title: 'Cut Off Time',
     824            });
     825        } else {
     826            jQuery('#en_quote_settings_order_cut_off_time_dayross').wickedpicker({
     827                now: dayross_current_time,
     828                title: 'Cut Off Time'
     829            });
     830        }
     831
     832        const show_delivery_estimate = jQuery('input[name=en_quote_settings_delivery_estimate_options_dayross]:checked').val();
     833        if (show_delivery_estimate === 'dont_show_estimates') {
     834            jQuery("#en_quote_settings_order_cut_off_time_dayross").prop('disabled', true);
     835            jQuery("#en_quote_settings_shipment_offset_days_dayross").prop('disabled', true);
     836            jQuery("#en_quote_settings_shipment_offset_days_dayross").css("cursor", "not-allowed");
     837            jQuery("#en_quote_settings_order_cut_off_time_dayross").css("cursor", "not-allowed");
     838            jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').prop('disabled', true);
     839            jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').css("cursor", "not-allowed");
     840        } else {
     841            jQuery("#en_quote_settings_order_cut_off_time_dayross").prop('disabled', false);
     842            jQuery("#en_quote_settings_shipment_offset_days_dayross").prop('disabled', false);
     843            jQuery("#en_quote_settings_order_cut_off_time_dayross").css("cursor", "");
     844            jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').prop('disabled', false);
     845            jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').css("cursor", "");
     846        }
     847
     848        jQuery("input[name=en_quote_settings_delivery_estimate_options_dayross]").change(function () {
     849            const show_delivery_estimate = jQuery('input[name=en_quote_settings_delivery_estimate_options_dayross]:checked').val();
     850           
     851            if (show_delivery_estimate === 'dont_show_estimates') {
     852                jQuery("#en_quote_settings_order_cut_off_time_dayross").prop('disabled', true);
     853                jQuery("#en_quote_settings_shipment_offset_days_dayross").prop('disabled', true);
     854                jQuery("#en_quote_settings_order_cut_off_time_dayross").css("cursor", "not-allowed");
     855                jQuery("#en_quote_settings_shipment_offset_days_dayross").css("cursor", "not-allowed");
     856                jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').prop('disabled', true);
     857                jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').css("cursor", "not-allowed");
     858            } else {
     859                jQuery("#en_quote_settings_order_cut_off_time_dayross").prop('disabled', false);
     860                jQuery("#en_quote_settings_shipment_offset_days_dayross").prop('disabled', false);
     861                jQuery("#en_quote_settings_order_cut_off_time_dayross").css("cursor", "auto");
     862                jQuery("#en_quote_settings_shipment_offset_days_dayross").css("cursor", "auto");
     863                jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').prop('disabled', false);
     864                jQuery('.all_shipment_days_dayross_lfq, .dayross_shipment_day').css("cursor", "auto");
     865            }
     866        });
     867
     868        /*
     869        * Uncheck Week days Select All Checkbox
     870        */
     871        jQuery(".dayross_shipment_day").on('change load', function () {
     872
     873            const checkboxes = jQuery('.dayross_shipment_day:checked').length;
     874            const un_checkboxes = jQuery('.dayross_shipment_day').length;
     875
     876            if (checkboxes === un_checkboxes) {
     877                jQuery('.all_shipment_days_dayross_lfq').prop('checked', true);
     878            } else {
     879                jQuery('.all_shipment_days_dayross_lfq').prop('checked', false);
     880            }
     881        });
     882
     883        /*
     884        * Select All Shipment Week days
     885        */
     886
     887        const all_int_checkboxes = jQuery('.all_shipment_days_dayross_lfq');
     888        if (all_int_checkboxes.length === all_int_checkboxes.filter(":checked").length) {
     889            jQuery('.all_shipment_days_dayross_lfq').prop('checked', true);
     890        }
     891
     892        jQuery(".all_shipment_days_dayross_lfq").change(function () {
     893            if (this.checked) {
     894                jQuery(".dayross_shipment_day").each(function () {
     895                    this.checked = true;
     896                });
     897            } else {
     898                jQuery(".dayross_shipment_day").each(function () {
     899                    this.checked = false;
     900                });
     901            }
     902        });
     903
     904        const main_td = jQuery('.en_quote_settings_all_shipment_days_dayross_tr td');
     905        const rows   = jQuery('tr.dayross_shipment_day_tr');
     906
     907        if (!main_td.length || !rows.length) return;
     908
     909        // Move all day checkboxes into main row
     910        rows.each(function () {
     911            const input_wrap = jQuery(this).find('td > *').first();
     912            if (input_wrap.length) main_td.append(input_wrap);
     913        });
     914
     915        // Hide original rows
     916        rows.hide();
     917
     918        // ---- Select All sync ----
     919        const select_all = main_td.find('input[type="checkbox"]').first();
     920        const days = main_td.find('input[type="checkbox"]').not(select_all);
     921
     922        // Select all → days
     923        select_all.on('change', function () {
     924            days.prop('checked', this.checked);
     925        });
     926        // Days → select all
     927        days.on('change', function () {
     928            select_all.prop('checked', days.length === days.filter(':checked').length);
     929        });
     930    }
     931}
     932
     933if (typeof dayrossValidateFullfillmentOffsetDays !== 'function') {
     934    function dayrossValidateFullfillmentOffsetDays() {
     935        const offset_days = jQuery("#en_quote_settings_shipment_offset_days_dayross").val();
     936        const number_regex = /^[0-9]+$/;
     937        let error_msg = '';
     938       
     939        if (offset_days != "" && offset_days < 1) error_msg = 'Fulfillment Offset Days must be greater than or equal to 1.';
     940        if (!error_msg && offset_days != "" && offset_days > 20) error_msg = 'Fulfillment Offset Days must be less than or equal to 20.';
     941        if (!error_msg && offset_days != "" && !number_regex.test(offset_days)) error_msg = 'Fulfillment Offset Days must be a number.';
     942
     943        if (error_msg) {
     944            jQuery('.en_dayross_ltl_plan_notice').after('<div class="notice notice-error en_settings_message"><p><strong>Error! </strong>' + error_msg + '</p></div>');
     945            jQuery('#en_settings_message').delay(200).animate({scrollTop: 0}, 1000);
     946            jQuery('html, body').animate({scrollTop: 0}, 'slow');
     947            return false;
     948        }
     949
     950        return true;
     951    }
     952}
  • ltl-freight-quotes-day-ross-edition/trunk/admin/product/en-product-detail.php

    r3284707 r3494315  
    8181                    $custom_field = (isset($custom_field['id'])) ? $custom_field['id'] : '';
    8282                    $en_updated_product = (isset($_POST[$custom_field][$postId])) ? sanitize_text_field($_POST[$custom_field][$postId]) : '';
    83                     $en_updated_product = $custom_field == '_dropship_location' ?
    84                         (maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product)) : esc_attr($en_updated_product);
     83
     84                    if ($custom_field == '_dropship_location') {
     85                        $en_updated_product = maybe_serialize(is_array($en_updated_product) ? array_map('intval', $en_updated_product) : $en_updated_product);
     86                    } elseif ($custom_field == '_eniture_product_level_fulfillment_offset_days') {
     87                        $en_updated_product = $this->sanitize_fulfillment_offset_days($en_updated_product);
     88                    } else {
     89                        $en_updated_product = esc_attr($en_updated_product);
     90                    }
     91
    8592                    update_post_meta($postId, $custom_field, $en_updated_product);
    8693                }
    8794            }
     95        }
     96
     97        private function sanitize_fulfillment_offset_days($value)
     98        {
     99            $value = trim($value);
     100            if ($value === '' || $value === null) return '';
     101
     102            $value = preg_replace('/[^0-9.-]/', '', $value);
     103            if (!is_numeric($value)) return '';
     104
     105            $value = intval(floor(floatval($value)));
     106            return $value < 0 ? '' : strval($value);
    88107        }
    89108
     
    181200                    'description' => "Increases the amount of the returned quote by a specified amount prior to displaying it in the shopping cart. The number entered will be interpreted as dollars and cents unless it is followed by a % sign. For example, entering 5.00 will cause $5.00 to be added to the quotes. Entering 5% will cause 5 percent of the item's price to be added to the shipping quotes."
    182201                ],
     202                [
     203                'type' => 'input_field',
     204                'input_type' => 'number',
     205                'id' => '_eniture_product_level_fulfillment_offset_days',
     206                'class' => '_eniture_product_level_fulfillment_offset_days short',
     207                'label' => __( 'Fulfillment Offset Days', 'woocommerce' ),
     208                'placeholder' => 'Fulfillment offset days, e.g. 2',
     209                'description' => "The number of days the ship date needs to be moved to allow for the processing of the order. If set, this will override the global Fulfillment Offset Days setting for this product.",
     210                'custom_attributes' => [
     211                    'min' => '1',
     212                    'max' => '20',
     213                    'step' => '1',
     214                    'title' => 'Value must be greater than or equal to 1 and less than or equal to 20',
     215                    'oninvalid' => "this.setCustomValidity(this.validity.rangeUnderflow ? 'Value must be greater than or equal to 1' : this.validity.rangeOverflow ? 'Value must be less than or equal to 20' : '')",
     216                    'oninput' => "this.setCustomValidity('')"
     217                ]
     218            ],
    183219            ];
    184220            // Micro Warehouse
     
    273309                'label' => $custom_field['label'],
    274310                'class' => $custom_field['class'],
    275                 'placeholder' => $custom_field['label'],
     311                'placeholder' => isset($custom_field['placeholder']) ? $custom_field['placeholder'] : $custom_field['label'],
    276312                'value' => get_post_meta($postId, $custom_field['id'], true)
    277313            ];
     
    281317                $custom_input_field['description'] = $custom_field['description'];
    282318            }
     319
     320            // Add input type if specified (e.g., 'number')
     321            if (isset($custom_field['input_type'])) {
     322                $custom_input_field['type'] = $custom_field['input_type'];
     323            }
     324
     325            // Add custom attributes if specified (e.g., min, max, step)
     326            if (isset($custom_field['custom_attributes'])) {
     327                $custom_input_field['custom_attributes'] = $custom_field['custom_attributes'];
     328            }
     329
    283330            echo '<div>';
    284331            woocommerce_wp_text_input($custom_input_field);
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/en-tab.php

    r3428882 r3494315  
    157157            $settings = $this->get_settings($current_section);
    158158
     159            // Cuttoff Time
     160            if (isset($_POST['en_quote_settings_order_cut_off_time_dayross']) && $_POST['en_quote_settings_order_cut_off_time_dayross'] != '') {
     161                $time_24_format = $this->get_time_in_24_hours($_POST['en_quote_settings_order_cut_off_time_dayross']);
     162                $_POST['en_quote_settings_order_cut_off_time_dayross'] = $time_24_format;
     163            }
     164
    159165            // backup rates
    160166            $backup_rates_fields = ['dayross_backup_rates_fixed_rate', 'dayross_backup_rates_cart_price_percentage', 'dayross_backup_rates_weight_function'];
     
    165171            WC_Admin_Settings::save_fields($settings);
    166172        }
     173       
     174         /**
     175         * Cuttoff Time
     176         * @param $timeStr
     177         * @return false|string
     178        */
     179        public function get_time_in_24_hours($timeStr)
     180        {
     181            $cutOffTime = explode(' ', $timeStr);
     182            $hours = $cutOffTime[0];
     183            $separator = $cutOffTime[1];
     184            $minutes = $cutOffTime[2];
     185            $meridiem = $cutOffTime[3];
     186            $cutOffTime = "{$hours}{$separator}{$minutes} $meridiem";
     187           
     188            return date("H:i", strtotime($cutOffTime));
     189        }
    167190    }
    168191
    169192    $en_tab = new EnDayrossTab();
    170     return $en_tab->en_load();
     193    $en_tab->en_load();
     194    return $en_tab;
    171195}
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/location/assets/css/en-dayross-location.css

    r3428882 r3494315  
    119119    color: #ff0000;
    120120    font-size: 11px;
    121     margin: 0 0 0 40.2%;
    122     width: 100%;
     121    width: 58.7%;
    123122    display: block;
    124 }
    125 
    126 .en_location_error_message {
     123    float: right;
     124}
     125
     126.en_location_error_message,
     127.en_dayross_warehouse_error_message, .en_dayross_dropship_error_message {
    127128    background: #f1f1f1 none repeat scroll 0 0;
    128129    border-left: 4px solid #dc3232;
     
    134135}
    135136
    136 .en_location_success_message {
     137.en_location_success_message,
     138.en_dayross_wh_location_success_message, .en_dayross_ds_location_success_message,
     139.en_dayross_warehouse_success_message, .en_dayross_dropship_success_message {
    137140    background: #fff none repeat scroll 0 0;
    138141    border-left: 4px solid #46b450;
     
    144147}
    145148
     149.en_dayross_warehouse_success_message, .en_dayross_dropship_success_message {
     150    margin: auto;
     151}
     152
    146153.spinner_disable {
    147154    color: #000000;
     
    162169    background: #fff none repeat scroll 0 0;
    163170    border-bottom: 1px solid #e1e1e1;
    164     color: #0073aa;
     171    color: #0073aa !important;
    165172    font-size: 14px;
    166173    font-weight: 400;
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/location/assets/js/en-dayross-location.js

    r3428882 r3494315  
    169169        } else if (en_is_var_exist('severity', data) && data['severity'] == 'error') {
    170170            jQuery('.en_popup_location_form').delay(200).animate({scrollTop: 0}, 300);
     171            const location_type = data['location'] == 'warehouse' ? 'wh' : 'ds';
     172            jQuery(`.en_dayross_${location_type}_location_error_message span`).text(data['message']);
     173            en_show_errors(`.en_dayross_${location_type}_location_error_message`);
    171174            jQuery('.en_location_error_message span').text(data['message']);
    172             en_show_errors('.en_location_error_message');
    173175        }
    174176
     
    377379    function en_dayross_location_delete(e, data, en_location_type, en_location_id) {
    378380        e.preventDefault();
     381
     382        // If warehouse location then directly delete
     383        if (en_location_type) {
     384            en_dayross_location_confirm_delete(data, en_location_type, en_location_id);
     385            return;
     386        }
     387
    379388        en_popup_confirmation_location_delete_show();
    380389        jQuery('.en_close_popup_location').on('click', function () {
     
    423432        if (data['message'].length > 0) {
    424433            jQuery('.en_popup_location_form').delay(200).animate({scrollTop: 0}, 300);
    425             jQuery('.en_location_success_message span').text(data['message']);
    426             en_show_errors('.en_location_success_message');
     434            const location_type = data['location'] == 'warehouse' ? 'wh' : 'ds';
     435            jQuery(`.en_dayross_${location_type}_location_success_message span`).text(data['message']);
     436            en_show_errors(`.en_dayross_${location_type}_location_success_message`);
    427437        }
    428438    }
     
    464474    }
    465475}
     476
     477if (typeof en_dayross_select_bulk_locations != 'function') {
     478    function en_dayross_select_bulk_locations(location_class, e) {
     479        const checked = jQuery(e).is(':checked');
     480        jQuery(`.${location_class}`).prop('checked', checked);
     481    }
     482}
     483
     484if (typeof en_dayross_toggle_select_all_locations != 'function') {
     485    function en_dayross_toggle_select_all_locations(location_class, select_all_locations) {
     486        const allChecked = jQuery(`.${location_class}:checked`).length === jQuery(`.${location_class}`).length;
     487        jQuery(`#${select_all_locations}`).prop('checked', allChecked);
     488    }
     489}
     490
     491if (typeof en_dayross_delete_bulk_locations != 'function') {
     492    function en_dayross_delete_bulk_locations(e, location_class, location_type) {
     493        e.preventDefault();
     494        const location_ids = jQuery(`.${location_class}:checked`).map(function () {
     495            return this.value;
     496        }).get();
     497
     498        // Show error message if no locations are selected
     499        if (location_ids.length === 0) {
     500            const loc_error_class = `en_dayross_${location_type}_error_message`;
     501            jQuery(`.${loc_error_class}`).show('slow').delay(3000).hide('slow');
     502            return;
     503        }
     504
     505        const postForm = {
     506            'action': 'en_dayross_wd_bulk_delete_locations',
     507            'location_ids': location_ids,
     508            'location_type': location_type,
     509            'wp_nonce': en_dayross_location_script.nonce
     510        }
     511        const delete_locs_btn = `.en_dayross_bulk_delete_${location_type}`,
     512        loc_success_class = `.en_dayross_${location_type}_success_message`,
     513        loc_error_class = `.en_dayross_${location_type}_error_message`;
     514       
     515        jQuery.ajax({
     516            type: 'POST',
     517            url: ajaxurl,
     518            data: postForm,
     519            dataType: 'json',
     520            beforeSend: function () {
     521                jQuery(delete_locs_btn).addClass('spinner_disable');
     522            },
     523            success: function (data) {
     524                if (data.error && data.message) {
     525                    jQuery(delete_locs_btn).removeClass('spinner_disable');
     526                    jQuery(loc_error_class).show('slow').delay(3000).hide('slow');
     527                } else {
     528                    jQuery(delete_locs_btn).removeClass('spinner_disable');
     529                    jQuery(data.target_location).replaceWith(data.html);
     530                    jQuery(loc_success_class).show('slow').delay(3000).hide('slow');
     531                    jQuery('.warehouse_updated, .warehouse_created, .warehouse_deleted, .dropship_deleted, .dropship_updated, .dropship_created').css('display', 'none');
     532                }
     533            },
     534            error: function (error) {
     535                jQuery(delete_locs_btn).removeClass('spinner_disable');
     536                console.log(error);
     537            }
     538        });
     539    }
     540}
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/location/dropship/en-dropship.php

    r3351760 r3494315  
    4141
    4242            <h1><?php _e('Drop ships', 'eniture-technology'); ?></h1>
    43             <button type="button" onclick="en_show_popup_location(false, event)" type="button"
    44                     class="button-primary"><?php _e('Add', 'eniture-technology'); ?></button>
    45             <p><?php _e('Locations that inventory specific items that are drop shipped to the destination. Use the products settings
     43            <div style="display: flex; gap: 3px; align-items: center; margin-top: 20px;">
     44                <button type="button" onclick="en_show_popup_location(false, event)" type="button"
     45                        class="button-primary"><?php _e('Add', 'eniture-technology'); ?></button>
     46                <button type="button" class="en_dayross_bulk_delete_dropship en_wd_add_dropship_btn button-primary" title="Delete Drop Ships" onclick="return en_dayross_delete_bulk_locations(event, 'en_dayross_delete_dropship_item', 'dropship');"><?php _e('Delete', 'eniture-technology'); ?></button>
     47            </div>
     48
     49            <p><?php _e("Locations that inventory specific items that are drop shipped to the destination. Use the product's settings
    4650                    page to identify it as a drop shipped item and its associated drop ship location. Orders that include drop
    4751                    shipped items will display a single figure for the shipping rate estimate that is equal to the sum of the
    48                     cheapest option of each shipment required to fulfill the order.', 'eniture-technology'); ?></p>
     52                    cheapest option of each shipment required to fulfill the order.", 'eniture-technology'); ?></p>
     53
     54            <div class="en_dayross_ds_location_success_message"><strong>Success! </strong><span></span></div>
     55            <div class="en_dayross_dropship_success_message"><strong>Success!</strong> <span>Selected drop ships deleted successfully.</span></div>
     56            <div class="en_dayross_dropship_error_message"><strong>Error!</strong> Please select at least one drop ship to delete.</div>
    4957
    5058            <table class="en_location_table en_location_dropship_table">
    5159            <thead>
    5260            <tr>
     61                <th class="en_wd_dropship_list_heading en_dayross_bulk_delete_col">
     62                    <!-- Bulk delete -->
     63                    <input type="checkbox" name="en_dayross_bulk_delete_dropships" id="en_dayross_bulk_delete_dropships" onclick="return en_dayross_select_bulk_locations('en_dayross_delete_dropship_item', this);" />
     64                </th>
    5365                <?php echo force_balance_tags(\EnLocation::en_arrange_table_data('th', $en_heading)); ?>
    5466                <th><?php _e('Action', 'eniture-technology'); ?></th>
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/location/en-location.php

    r3428882 r3494315  
    278278
    279279                echo '<tr class="' . esc_attr($append_class) . '" id="en_location_row_id_' . esc_attr($en_location_id) . '">';
     280
     281                $_type = ($loc_type === 'wh') ? 'warehouse' : 'dropship';
     282                echo '<td class="en_wd_' . esc_attr($_type) . '_list_data en_dayross_bulk_delete_col">
     283                    <input
     284                        type="checkbox"
     285                        class="en_dayross_delete_' . esc_attr($_type) . '_item"
     286                        value="' . esc_attr($en_location_id) . '"
     287                        onclick="return en_dayross_toggle_select_all_locations(
     288                            \'en_dayross_delete_' . esc_attr($_type) . '_item\',
     289                            \'en_dayross_bulk_delete_' . esc_attr($_type) . 's\'
     290                        );"
     291                    >
     292                </td>';
    280293                echo self::en_arrange_table_data('td', $en_sorted_location);
    281294
     
    309322                        <?php _e('Warning!', 'eniture-technology'); ?>
    310323                    </h2>
     324                    <hr>
    311325                    <p class="en_confirmation_message">
    312                         <?php _e('If you delete this location, then location settings will be disabled against products
    313                         (if any).', 'eniture-technology'); ?>
     326                        Warning! If you delete this location, Drop ship location settings will be disabled against products if any.
    314327                    </p>
     328                    <hr>
    315329                    <div class="en_confirmation_buttons">
    316330                        <a href="#"
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/location/includes/en-location-ajax.php

    r3428882 r3494315  
    1818            add_action('wp_ajax_en_dayross_get_location', [$this, 'en_dayross_get_location']);
    1919            add_action('wp_ajax_en_dayross_location_delete_row', [$this, 'en_dayross_location_delete_row']);
     20
     21            add_action('wp_ajax_nopriv_en_dayross_wd_bulk_delete_locations', array($this, 'en_dayross_bulk_delete_locations_ajax'));
     22            add_action('wp_ajax_en_dayross_wd_bulk_delete_locations', array($this, 'en_dayross_bulk_delete_locations_ajax'));
    2023        }
    2124
     
    199202
    200203                if ($location === 'warehouse') {
    201                     $location_step = 'Warehouse';
     204                    $location_step = 'New warehouse';
    202205                    $en_location_template_obj = new EnDayrossWarehouseTemplate();
    203206                    $en_target_location = '.en_location_warehouse_main_div';
    204207                    $validate = ['zip', 'city', 'state', 'country', 'location'];
    205208                } else {
    206                     $location_step = 'Dropship';
     209                    $location_step = 'New drop ship';
    207210                    $en_location_template_obj = new EnDayrossDropshipTemplate();
    208211                    $en_target_location = '.en_location_dropship_main_div';
     
    222225                        (!empty($en_location_data) &&
    223226                            reset($en_location_data)['id'] === $location_id))) {
     227                    $location_step = $location === 'warehouse' ? 'Warehouse' : 'Drop ship';
    224228                    $message = $location_step . ' updated successfully.';
    225229                    $action = 'update';
     
    250254        }
    251255
     256        public function en_dayross_bulk_delete_locations_ajax()
     257        {
     258            if (!(current_user_can('manage_options') || current_user_can('manage_woocommerce')) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['wp_nonce'])), 'en_dayross_location_nonce')) {
     259                echo wp_json_encode(array('error' => true, 'message' => 'Unauthorized Access.'));
     260                exit;
     261            }
     262
     263            $location_ids = isset($_POST['location_ids']) ? $_POST['location_ids'] : array();
     264            $loc_type = isset($_POST['location_type']) ? $_POST['location_type'] : '';
     265            if (empty($location_ids)) {
     266                echo wp_json_encode(['error' => true, 'message' => "Please select at least one {$loc_type} to delete."]);
     267                exit;
     268            }
     269
     270            global $wpdb;
     271            foreach ($location_ids as $location_id) {
     272                if ($loc_type == 'dropship') {
     273                    $get_dropship_id = '';
     274                    $dropship_id = intval($location_id);
     275                    $get_dropship_array = array($dropship_id);
     276                    $ser = maybe_serialize($get_dropship_id);
     277                    $get_dropship_val = array_map('intval', $get_dropship_array);
     278                    $get_post_id = $wpdb->get_results("SELECT group_concat(post_id) as post_ids_list FROM `" . $wpdb->prefix . "postmeta` WHERE `meta_key` = '_dropship_location' AND (`meta_value` LIKE '%" . $ser . "%' OR `meta_value` = '" . $dropship_id . "')");
     279                    $post_id = reset($get_post_id)->post_ids_list;
     280
     281                    if (isset($post_id)) {
     282                        $wpdb->query("UPDATE `" . $wpdb->prefix . "postmeta` SET `meta_value` = '' WHERE `meta_key` IN('_enable_dropship','_dropship_location')  AND `post_id` IN ($post_id)");
     283                    }
     284                }
     285
     286                $wpdb->delete($wpdb->prefix . "warehouse", array('id' => intval($location_id), 'location' => $loc_type));
     287            }
     288
     289            if ($loc_type === 'warehouse') {
     290                $en_location_template_obj = new EnDayrossWarehouseTemplate();
     291                $en_target_location = '.en_location_warehouse_main_div';
     292            } else {
     293                $en_location_template_obj = new EnDayrossDropshipTemplate();
     294                $en_target_location = '.en_location_dropship_main_div';
     295            }
     296
     297            $html = $en_location_template_obj::en_load();
     298
     299            echo wp_json_encode(['error' => false, 'message' => 'Locations deleted successfully.', 'target_location' => $en_target_location, 'html' => $html]);
     300            exit;
     301        }
     302
    252303    }
    253304
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/location/warehouse/en-warehouse.php

    r3351760 r3494315  
    3636            <div class="en_location_warehouse_main_div">
    3737
    38             <div class="en_location_success_message">
    39                 <strong><?php _e('Success!', 'eniture-technology'); ?></strong> <span></span></div>
     38            <h1><?php _e('Warehouses', 'eniture-technology'); ?></h1>
     39            <div style="display: flex; gap: 3px; align-items: center; margin-top: 20px;">
     40                <button title="Add Warehouse" type="button" onclick="en_show_popup_location(true, event)" type="button"
     41                        class="button-primary <?php echo esc_attr(self::$disabled_plan); ?>"><?php _e('Add', 'eniture-technology'); ?>
     42                </button>
     43                 <button type="button" class="en_dayross_bulk_delete_warehouse en_wd_add_warehouse_btn button-primary" title="Delete Warehouses" onclick="return en_dayross_delete_bulk_locations(event, 'en_dayross_delete_warehouse_item', 'warehouse');"><?php _e('Delete', 'eniture-technology'); ?>
     44                </button>
    4045
    41             <h1><?php _e('Warehouses', 'eniture-technology'); ?></h1>
    42             <button type="button" onclick="en_show_popup_location(true, event)" type="button"
    43                     class="button-primary <?php echo esc_attr(self::$disabled_plan); ?>"><?php _e('Add', 'eniture-technology'); ?>
    44             </button>
    45             <?php echo force_balance_tags(self::$plan_required); ?>
     46                <?php echo force_balance_tags(self::$plan_required); ?>
     47            </div>
    4648
    4749            <p><?php _e('Warehouses that inventory all products not otherwise identified as drop shipped items. The warehouse with the
    4850                    lowest shipping cost to the destination is used for quoting purposes.', 'eniture-technology'); ?></p>
     51           
     52            <div class="en_dayross_wh_location_success_message"><strong>Success! </strong><span></span></div>
     53            <div class="en_dayross_warehouse_success_message"><strong>Success! </strong> <span>Selected warehouses deleted successfully.</span></div>
     54            <div class="en_dayross_warehouse_error_message"><strong>Error!</strong> <span>Please select at least one warehouse to delete.</span></div>
    4955
    5056            <table class="en_location_table en_location_warehouse_table">
    5157            <thead>
    5258            <tr>
     59                 <th class="en_wd_warehouse_list_heading en_dayross_bulk_delete_col">
     60                    <!-- Bulk delete -->
     61                    <input type="checkbox" name="en_dayross_bulk_delete_warehouses" id="en_dayross_bulk_delete_warehouses" onclick="return en_dayross_select_bulk_locations('en_dayross_delete_warehouse_item', this);" />
     62                </th>
    5363                <?php echo force_balance_tags(\EnLocation::en_arrange_table_data('th', $en_heading)); ?>
    5464                <th><?php _e('Action', 'eniture-technology'); ?></th>
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/logs/en-logs.php

    r3462301 r3494315  
    4848           
    4949            $url = EN_DAYROSS_ROOT_URL_QUOTES . '/request-log/index.php';
    50             $logs = $obj_classs->en_dayross_sent_http_request($url, $data, 'POST');
     50            $logs = $obj_classs->en_dayross_sent_http_request($url, $data, 'POST', 'Logs');
    5151            $logs = (isset($logs) && is_string($logs) && strlen($logs) > 0) ? json_decode($logs, true) : [];
    5252
  • ltl-freight-quotes-day-ross-edition/trunk/admin/tab/quote-settings/en-quote-settings.php

    r3428882 r3494315  
    2626            }
    2727
     28             if (get_option('en_quote_settings_show_delivery_estimate_dayross') == 'yes') {
     29                update_option('en_quote_settings_delivery_estimate_options_dayross', 'delivery_date');
     30                delete_option('en_quote_settings_show_delivery_estimate_dayross');
     31            }
     32
     33            // Cuttoff Time
     34            $dayross_disable_cutt_off_time_ship_date_offset = "";
     35            $dayross_cutt_off_time_package_required = "";
     36
     37            //  Check the cutt of time & offset days plans for disable input fields
     38            $dayross_action_cutOffTime_shipDateOffset = apply_filters('dayross_plans_suscription_and_features', 'order_cutt_off_time');
     39            if (is_array($dayross_action_cutOffTime_shipDateOffset) && false) {
     40                $dayross_disable_cutt_off_time_ship_date_offset = "disabled_me";
     41                $dayross_cutt_off_time_package_required = apply_filters('dayross_plans_notification_link', $dayross_action_cutOffTime_shipDateOffset);
     42            }
     43
    2844            $ltl_enable = get_option('en_plugins_return_LTL_quotes');
    2945            $weight_threshold_class = $ltl_enable == 'yes' ? 'show_en_weight_threshold_lfq' : 'hide_en_weight_threshold_lfq';
     
    5773                 * ==================================================================
    5874                 */
    59                 'en_quote_settings_show_delivery_estimate_dayross' => [
    60                     'name' => __('Show Delivery Estimate ', 'woocommerce-settings-dayross'),
    61                     'type' => 'checkbox',
    62                     'id' => 'en_quote_settings_show_delivery_estimate_dayross'
    63                 ],
     75
     76                //** Start Delivery Estimate Options - Cuttoff Time
     77                 'delivery_estimate_options_dayross' => array(
     78                    'name' => __('Delivery Estimate Options ', 'woocommerce-settings-dayross'),
     79                    'type' => 'text',
     80                    'class' => 'hidden',
     81                    'id' => 'delivery_estimate_options_dayross'
     82                ),
     83                'en_quote_settings_delivery_estimate_options_dayross' => array(
     84                    'name' => '',
     85                    'type' => 'radio',
     86                    'default' => 'dont_show_estimates',
     87                    'options' => array(
     88                        'dont_show_estimates' => __("Don't display delivery estimates.", 'woocommerce-settings-dayross'),
     89                        'delivery_days' => __("Display estimated number of days until delivery.", 'woocommerce-settings-dayross'),
     90                        'delivery_date' => __("Display estimated delivery date.", 'woocommerce-settings-dayross'),
     91                    ),
     92                    'id' => 'en_quote_settings_delivery_estimate_options_dayross',
     93                    'class' => 'dayross_lfq_dont_show_estimate_option',
     94                ),
     95                //** End Delivery Estimate Options
     96
     97                //**Start: Cut Off Time & Ship Date Offset
     98                'en_quote_settings_cutt_off_time_ship_date_offset_dayross' => array(
     99                    'name' => __('Cut Off Time & Ship Date Offset ', 'woocommerce-settings-dayross'),
     100                    'type' => 'text',
     101                    'class' => 'hidden',
     102                    'desc' => $dayross_cutt_off_time_package_required,
     103                    'id' => 'en_quote_settings_cutt_off_time_ship_date_offset_dayross'
     104                ),
     105                'en_quote_settings_order_cut_off_time_dayross' => array(
     106                    'name' => __('Order Cut Off Time ', 'woocommerce-settings-dayross'),
     107                    'type' => 'text',
     108                    'placeholder' => '-- : -- --',
     109                    'desc' => 'Enter the cut off time (e.g. 2:00) for the orders. Orders placed after this time will be quoted as shipping the next business day.',
     110                    'id' => 'en_quote_settings_order_cut_off_time_dayross',
     111                    'class' => $dayross_disable_cutt_off_time_ship_date_offset,
     112                ),
     113                'en_quote_settings_shipment_offset_days_dayross' => array(
     114                    'name' => __('Fulfillment Offset Days ', 'woocommerce-settings-dayross'),
     115                    'type' => 'text',
     116                    'desc' => 'The number of days the ship date needs to be moved to allow for the processing of the order.',
     117                    'placeholder' => 'Fulfillment Offset Days, e.g. 2',
     118                    'id' => 'en_quote_settings_shipment_offset_days_dayross',
     119                    'class' => $dayross_disable_cutt_off_time_ship_date_offset,
     120                ),
     121                'en_quote_settings_all_shipment_days_dayross' => array(
     122                    'name' => __("What days do you ship orders?", 'woocommerce-settings-dayross'),
     123                    'type' => 'checkbox',
     124                    'desc' => 'Select All',
     125                    'class' => "all_shipment_days_dayross_lfq $dayross_disable_cutt_off_time_ship_date_offset",
     126                    'id' => 'en_quote_settings_all_shipment_days_dayross'
     127                ),
     128                'en_quote_settings_monday_shipment_day_dayross' => array(
     129                    'name' => __("", 'woocommerce-settings-dayross'),
     130                    'type' => 'checkbox',
     131                    'desc' => 'Monday',
     132                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     133                    'id' => 'en_quote_settings_monday_shipment_day_dayross'
     134                ),
     135                'en_quote_settings_tuesday_shipment_day_dayross' => array(
     136                    'name' => __("", 'woocommerce-settings-dayross'),
     137                    'type' => 'checkbox',
     138                    'desc' => 'Tuesday',
     139                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     140                    'id' => 'en_quote_settings_tuesday_shipment_day_dayross'
     141                ),
     142                'en_quote_settings_wednesday_shipment_day_dayross' => array(
     143                    'name' => __("", 'woocommerce-settings-dayross'),
     144                    'type' => 'checkbox',
     145                    'desc' => 'Wednesday',
     146                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     147                    'id' => 'en_quote_settings_wednesday_shipment_day_dayross'
     148                ),
     149                'en_quote_settings_thursday_shipment_day_dayross' => array(
     150                    'name' => __("", 'woocommerce-settings-dayross'),
     151                    'type' => 'checkbox',
     152                    'desc' => 'Thursday',
     153                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     154                    'id' => 'en_quote_settings_thursday_shipment_day_dayross'
     155                ),
     156                'en_quote_settings_friday_shipment_day_dayross' => array(
     157                    'name' => __("", 'woocommerce-settings-dayross'),
     158                    'type' => 'checkbox',
     159                    'desc' => 'Friday',
     160                    'class' => "dayross_shipment_day $dayross_disable_cutt_off_time_ship_date_offset",
     161                    'id' => 'en_quote_settings_friday_shipment_day_dayross'
     162                ),
     163                'en_quote_settings_show_delivery_estimate_dayross' => array(
     164                    'title' => __('', 'woocommerce'),
     165                    'name' => __('', 'woocommerce-settings-dayross'),
     166                    'desc' => '',
     167                    'id' => 'dayross_lfq_show_delivery_estimates',
     168                    'css' => '',
     169                    'default' => '',
     170                    'type' => 'title',
     171                ),
     172                //**End: Cut Off Time & Ship Date Offset
     173
    64174                'residential_delivery_options_label' => [
    65175                    'name' => __('Residential Delivery', 'woocommerce-settings-dayross'),
  • ltl-freight-quotes-day-ross-edition/trunk/common/en-plans.php

    r3304907 r3494315  
    4848                    $plugin_info = get_plugins();
    4949                    $plugin_version = (isset($plugin_info[$index]['Version'])) ? $plugin_info[$index]['Version'] : 0;
    50                     $plugin_dir_url = EN_DAYROSS_DIR_FILE . 'en-hit-to-update-plan.php';
     50                   
    5151                    $post_data = array(
    5252                        'platform' => 'wordpress',
    5353                        'carrier' => '79',
    5454                        'store_url' => EN_DAYROSS_SERVER_NAME,
    55                         'webhook_url' => $plugin_dir_url,
     55                        'webhook_url' => '',
    5656                        'plugin_version' => $plugin_version,
    5757                        'license_key' => get_option('en_connection_settings_license_key_dayross'),
     
    8282                $plugin_info = get_plugins();
    8383                $plugin_version = (isset($plugin_info[$index]['Version'])) ? $plugin_info[$index]['Version'] : 0;
    84                 $plugin_dir_url = EN_DAYROSS_DIR_FILE . 'en-hit-to-update-plan.php';
     84               
    8585                $post_data = array(
    8686                    'platform' => 'wordpress',
    8787                    'carrier' => '79',
    8888                    'store_url' => EN_DAYROSS_SERVER_NAME,
    89                     'webhook_url' => $plugin_dir_url,
     89                    'webhook_url' => '',
    9090                    'plugin_version' => $plugin_version,
    9191                    'license_key' => get_option('en_connection_settings_license_key_dayross'),
     
    152152                'multi_warehouse' => ['2', '3'],
    153153                'nested_material' => ['3'],
    154                 'multi_dropships' => ['0', '1', '2', '3']
     154                'multi_dropships' => ['0', '1', '2', '3'],
     155                'order_cutt_off_time' => ['2', '3']
    155156            ];
    156157
  • ltl-freight-quotes-day-ross-edition/trunk/en-install.php

    r3490815 r3494315  
    6767            'dayross_backup_rates_cart_price_percentage' => get_option("dayross_backup_rates_cart_price_percentage"),
    6868            'dayross_backup_rates_weight_function' => get_option("dayross_backup_rates_weight_function"),
     69             // Cuttoff Time
     70            'dayross_order_cut_off_time' => get_option("en_quote_settings_order_cut_off_time_dayross"),
    6971        ]);
    7072
    71         wp_enqueue_script('EnDayrossLocationScript', EN_DAYROSS_DIR_FILE . '/admin/tab/location/assets/js/en-dayross-location.js', [], '1.0.6');
     73        wp_enqueue_script('EnDayrossLocationScript', EN_DAYROSS_DIR_FILE . '/admin/tab/location/assets/js/en-dayross-location.js', [], '1.0.7');
    7274        wp_localize_script('EnDayrossLocationScript', 'en_dayross_location_script', array(
    7375            'pluginsUrl' => EN_DAYROSS_PLUGIN_URL,
     
    8082        ));
    8183
    82         wp_register_style('EnDayrossLocationStyle', EN_DAYROSS_DIR_FILE . '/admin/tab/location/assets/css/en-dayross-location.css', false, '1.0.3');
     84        wp_register_style('EnDayrossLocationStyle', EN_DAYROSS_DIR_FILE . '/admin/tab/location/assets/css/en-dayross-location.css', false, '1.0.4');
    8385        wp_enqueue_style('EnDayrossLocationStyle');
    8486
     
    8890        wp_register_style('EnDayrossProductCss', EN_DAYROSS_DIR_FILE . '/admin/product/assets/en-custom-fields-style.css', false, '1.0.2');
    8991        wp_enqueue_style('EnDayrossProductCss');
     92
     93        // Cuttoff Time
     94        wp_register_style('EnDayrossWickedPickerStyle', EN_DAYROSS_DIR_FILE . '/admin/assets/wickedpicker.min.css', false, '1.0.0');
     95        wp_register_script('EnDayrossWickedPickerScript', EN_DAYROSS_DIR_FILE . '/admin/assets/wickedpicker.js', false, '1.0.0');
     96       
     97        wp_enqueue_style('EnDayrossWickedPickerStyle');
     98        wp_enqueue_script('EnDayrossWickedPickerScript');
    9099    }
    91100
     
    118127    function en_dayross_shipping_sections($settings)
    119128    {
    120         $settings[] = include('admin/tab/en-tab.php');
     129        $en_tab = include('admin/tab/en-tab.php');
     130        if (is_object($en_tab)) {
     131            $settings[] = $en_tab;
     132        }
     133       
    121134        return $settings;
    122135    }
  • ltl-freight-quotes-day-ross-edition/trunk/http/en-curl.php

    r3428882 r3494315  
    2525        static public function en_dayross_sent_http_request($url, $post_data, $method, $step_for = '') {
    2626            $curl_response = '';
     27            $en_time_start = 0;
     28
    2729            if (strlen($url) > 0 && is_array($post_data) && !empty($post_data)) {
    2830
    2931                $post_data = self::remove_extra_request_data($post_data);
     32                $cachable_data = self::create_cachable_data($post_data);
     33                $cache_key = self::create_cache_key($cachable_data);
     34                $cache_response = get_transient($cache_key);
     35                $skip_cache = in_array($step_for, ['Plan', 'Logs', 'Address', 'Connection']);
    3036
    31                 // Eniture Execution Time
    32                 $en_time_start = microtime(true);
     37                if ($skip_cache || false === $cache_response) {
     38                    // Eniture Execution Time
     39                    $en_time_start = microtime(true);
    3340
    34                 // Eniture Debug Mood
    35                 do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Request ", $post_data);
     41                    // Eniture Debug Mood
     42                    do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Request ", $post_data);
    3643
    37                 $method == 'POST' ? $post_data = http_build_query($post_data) : '';
     44                    $method == 'POST' ? $post_data = http_build_query($post_data) : '';
    3845
    39                 // Eniture Debug Mood
    40                 do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Build Query ", $post_data);
     46                    // Eniture Debug Mood
     47                    do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Build Query ", $post_data);
    4148
    42                 $response = wp_remote_post($url, [
    43                     'method' => $method,
    44                     'timeout' => 60,
    45                     'redirection' => 5,
    46                     'blocking' => true,
    47                     'body' => $post_data,
    48                         ]
    49                 );
    50                 $curl_response = wp_remote_retrieve_body($response);
    51                 $headers = wp_remote_retrieve_headers($response);
    52                 self::eniture_check_rate_limit_headers($headers);
     49                    $response = wp_remote_post($url, [
     50                        'method' => $method,
     51                        'timeout' => 60,
     52                        'redirection' => 5,
     53                        'blocking' => true,
     54                        'body' => $post_data,
     55                            ]
     56                    );
     57                    $headers = wp_remote_retrieve_headers($response);
     58                    self::eniture_check_rate_limit_headers($headers);
     59                    $curl_response = wp_remote_retrieve_body($response);
     60                    $resp = !empty($curl_response) && is_string($curl_response) ? json_decode($curl_response, true) : $curl_response;
     61
     62                    if (!empty($resp) && (!isset($resp['severity']) || (isset($resp['severity']) && $resp['severity'] != 'ERROR'))) {
     63                        set_transient($cache_key, $curl_response, 12 * HOUR_IN_SECONDS);
     64                    }
     65
     66                    // Eniture Debug Mood
     67                    do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Response ", json_decode($curl_response));
     68                } else {
     69                    $curl_response = $cache_response;
     70
     71                    // Eniture Debug Mood
     72                    do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Cache Response ", $curl_response);
     73                }
    5374            }
    54 
    55             // Eniture Debug Mood
    56             do_action("eniture_debug_mood", EN_DAYROSS_NAME . " $step_for Response ", json_decode($curl_response));
    5775
    5876            // Eniture Execution Time
     
    98116        }
    99117
     118        static public function create_cachable_data($request_data)
     119        {
     120            $cache_keys = ['serverName', 'platform', 'carrierType', 'carrierName', 'carrierMode', 'requestVersion', 'clientId', 'clientSecret', 'requestForNewAPI', 'emailAddress', 'password', 'billToAccountNumber', 'licenseKey', 'dimWeightBaseAccount', 'shipment_type', 'LTL_FREIGHT', 'product_name', 'shipment_weight', 'commdityDetails', 'originAddress', 'receiverZip', 'receiverState', 'receiverCountryCode', 'receiverCity', 'addressLine', 'instorPickupLocalDelEnable', 'doNesting', 'modifyShipmentDateTime', 'OrderCutoffTime', 'shipmentOffsetDays', 'shipmentWeekDays', 'liftGateAsAnOption', 'accessorials', 'handlingUnitWeight', 'maxWeightPerHandlingUnit'];
     121            $cachable_data = [];
     122           
     123            // get the data from the request
     124            foreach ($cache_keys as $key) {
     125                if (isset($request_data[$key])) $cachable_data[$key] = $request_data[$key];
     126            }
     127
     128            if (isset($request_data['autoResidentials']) && $request_data['autoResidentials'] == 1) {
     129                $cachable_data['autoResidentials'] = $request_data['autoResidentials'];
     130                $cachable_data['addressLine'] = $request_data['addressLine'];
     131                $cachable_data['addressLine2'] = (isset($request_data['addressLine2'])) ? $request_data['addressLine2'] : '';
     132                $cachable_data['defaultRADAddressType'] = $request_data['defaultRADAddressType'];
     133                $cachable_data['defaultRADWithoutStreetAddress'] = $request_data['defaultRADWithoutStreetAddress'];
     134                $cachable_data['poboxAddressValidation'] = $request_data['poboxAddressValidation'];
     135            }
     136
     137            if (isset($request_data['standardPackaging']) && $request_data['standardPackaging'] == 1) {
     138                $cachable_data['standardPackaging'] = $request_data['standardPackaging'];
     139                $cachable_data['pallet'] = $request_data['pallet'];
     140            }
     141
     142            return $cachable_data;
     143        }
     144
     145        static public function create_cache_key($request_data)
     146        {
     147            $request_build_query = http_build_query($request_data);
     148            return md5('eniture_dayross_' . $request_build_query);
     149        }
    100150    }
    101151
  • ltl-freight-quotes-day-ross-edition/trunk/ltl-freight-quotes-dayross-edition.php

    r3490815 r3494315  
    44 * Plugin URI: https://eniture.com/products/
    55 * Description: Dynamically retrieves your negotiated shipping rates from Day & Ross and displays the results in the WooCommerce shopping cart.
    6  * Version: 2.2.4
     6 * Version: 2.2.5
    77 * Author: Eniture Technology
    88 * Author URI: http://eniture.com/
  • ltl-freight-quotes-day-ross-edition/trunk/readme.txt

    r3490815 r3494315  
    44Requires at least: 6.4
    55Tested up to: 6.9
    6 Stable tag: 2.2.4
     6Stable tag: 2.2.5
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    149149== Changelog ==
    150150
     151= 2.2.5 - 2026-03-30 =
     152* Update: Added cache support to handle duplicate simultaneous quote requests efficiently.
     153* Update: Added delivery estimate options and order cutoff time functionality to the quote settings.
     154* Update: Added bulk delete support for warehouse and drop ship locations.
     155* Update: Added product-level offset days functionality.
     156* Fix: Resolved Broken Access Control vulnerability to improve overall plugin security.
     157
    151158= 2.2.4 - 2026-03-25 =
    152159* Update: Updated labels text in the connection settings for improved clarity and consistency.
  • ltl-freight-quotes-day-ross-edition/trunk/server/api/en-response.php

    r3462301 r3494315  
    318318            }
    319319
    320             $handling_fee = $en_settings_label = $rating_method = $transit_days = $enable_carriers = $liftgate_resid_delivery = $liftgate_delivery_option = '';
     320            $handling_fee = $en_settings_label = $rating_method = $transit_days = $delivery_estimate_option = $enable_carriers = $liftgate_resid_delivery = $liftgate_delivery_option = '';
    321321            $overlength_fees = [];
    322322            self::$en_settings = json_decode(EN_DAYROSS_SET_QUOTE_SETTINGS, true);
     
    374374                $label = isset($is_valid_label) && $is_valid_label ? $en_settings_label : 'Freight';
    375375                $calculated_transit_date = self::en_sanitize_rate('deliveryTimestamp', '');
     376                $calculated_transit_days = self::en_sanitize_rate('totalTransitTimeInDays', '');
    376377                $append_transit = '';
    377378
    378                 if ($rating_method != "average_rate" && is_string($calculated_transit_date) && self::$en_is_shipment == 'en_single_shipment' && strlen($calculated_transit_date) > 0 && $transit_days == "yes") {
    379                     $append_transit = ' (Expected delivery by ' . date('m-d-Y', strtotime($calculated_transit_date)) . ')';
     379                 if ($rating_method != "average_rate" && isset($delivery_estimate_option) && !empty($delivery_estimate_option) && $delivery_estimate_option != 'dont_show_estimates' && self::$en_is_shipment != 'multi_shipment') {
     380
     381                    if ($delivery_estimate_option == 'delivery_date' && is_string($calculated_transit_date) && strlen($calculated_transit_date) > 0) {
     382                        $append_transit = ' (Expected delivery by ' . date('m-d-Y', strtotime($calculated_transit_date)) . ')';
     383                    } else if ($delivery_estimate_option == 'delivery_days' && is_numeric($calculated_transit_days)) {
     384                        $append_transit = ' (Intransit days: ' . $calculated_transit_days . ')';
     385                    }
    380386                }
    381387
  • ltl-freight-quotes-day-ross-edition/trunk/server/common/en-quote-settings.php

    r3462301 r3494315  
    7070            $range_5 = isset($range_5) && strlen($range_5) > 0 ? $range_5 : 770;
    7171
     72            $dayross_shipment_days = ['all', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday'];
     73            $shipment_days = [];
     74            foreach ($dayross_shipment_days as $key => $day) {
     75                get_option('en_quote_settings_' . $day . '_shipment_day_dayross') == 'yes' ? $shipment_days[] = $key : '';
     76            }
     77
    7278            $quote_settings = [
     79                // Cut Off Time & Ship Date Offset
     80                'delivery_estimate_option' => get_option('en_quote_settings_delivery_estimate_options_dayross'),
     81                'cutt_off_time' => get_option('en_quote_settings_order_cut_off_time_dayross'),
     82                'fulfilment_offset_days' => get_option('en_quote_settings_shipment_offset_days_dayross'),
     83                'shipment_days' => $shipment_days,
    7384                'transit_days' => get_option('en_quote_settings_show_delivery_estimate_dayross'),
    7485                'own_freight' => get_option('en_quote_settings_own_arrangment_dayross'),
  • ltl-freight-quotes-day-ross-edition/trunk/server/en-shipping-rates.php

    r3462301 r3494315  
    221221                            $rate['label'] .= (!empty($label_sufex)) ? ' with ' . implode(' and ', $label_sufex) : '';
    222222                            $rate['label'] .= !empty($rate['append_transit']) ? $rate['append_transit'] : '';
     223
     224                            // Update rate label in FDO meta data
     225                            if (isset($rate['meta_data']['en_fdo_meta_data']['rate']['label'])) {
     226                                $rate['meta_data']['en_fdo_meta_data']['rate']['label'] = $rate['label'];
     227                            }
     228
    223229                            isset($rate['cost']) && $en_small_package_charges > 0 ?
    224230                                $rate['cost'] = $rate['cost'] + $en_small_package_charges : 0;
  • ltl-freight-quotes-day-ross-edition/trunk/server/package/en-package.php

    r3462301 r3494315  
    182182                    // Get product level markup value
    183183                    $product_level_markup = self::en_get_product_level_markup($product_data, $product['variation_id'], $product['product_id'], $product['quantity']);
     184                    $product_level_fulfillment_offset = self::en_get_product_level_fulfillment_offset_days($product_data, $product['variation_id'], $product['product_id']);
    184185                    $get_freight = self::en_dayross_get_freight_class($product, $product_data);
    185186                    $freightClass_ltl_gross = ($get_freight['freight_class'] == 0) ? $get_freight['freight_class'] = "" : $get_freight['freight_class'];
     
    214215                        'markup' => $product_level_markup,
    215216                        'lineItemClass' => $freightClass_ltl_gross,
     217                        'fulfillment_offset_days' => $product_level_fulfillment_offset,
    216218                    ];
    217219
     
    330332                        self::$en_request['commdityDetails'][$origin_zip_code][$is_line_item] = $product_item;
    331333                        self::$en_request['originAddress'][$origin_zip_code] = $origin_address;
     334
     335                        // Track maximum fulfillment offset days
     336                        if (is_numeric($product_level_fulfillment_offset) && $product_level_fulfillment_offset > 0) {
     337                            if (!isset(self::$en_request['max_fulfillment_offset_days']) || $product_level_fulfillment_offset > self::$en_request['max_fulfillment_offset_days']) {
     338                                self::$en_request['max_fulfillment_offset_days'] = $product_level_fulfillment_offset;
     339                            }
     340                        }
    332341                    }
    333342                }
     
    405414            // Configure standard plugin with pallet packaging addon
    406415            self::$en_request = apply_filters('en_pallet_identify', array_merge(EnDayrossConnectionSettings::en_static_request_detail(), self::$en_request));
     416
     417            // Add the settings from quote page
     418            self::en_dayross_quote_settings_detail();
    407419
    408420            return self::$en_request;
     
    631643            switch (self::$product_key_name) {
    632644                case '_dropship_location':
     645                    $_post_id = self::$post_id;
    633646                    $enable_dropship = get_post_meta(self::$post_id, '_enable_dropship', true);
     647                   
    634648                    // check for parent id
    635649                    if (empty($enable_dropship) && self::$parent_id > 0 && self::$parent_id != self::$post_id) {
    636                         self::$post_id = self::$parent_id;
    637                         $enable_dropship = get_post_meta(self::$post_id, '_enable_dropship', true);
     650                        $_post_id = self::$parent_id;
     651                        $enable_dropship = get_post_meta($_post_id, '_enable_dropship', true);
    638652                    }
    639653                   
     
    643657                            $all_plugins = apply_filters('active_plugins', get_option('active_plugins'));
    644658                            if (stripos(implode($all_plugins), 'micro-warehouse-shipping.php')  || is_plugin_active_for_network('micro-warehouse-shipping-for-woocommerce/micro-warehouse-shipping.php')) {
    645                                 $locations_dropship = maybe_unserialize(get_post_meta(self::$post_id, '_dropship_location', true));
     659                                $locations_dropship = maybe_unserialize(get_post_meta($_post_id, '_dropship_location', true));
    646660
    647661                                if(!empty($locations_dropship)) {
     
    651665                            }
    652666
    653                             $en_dayross_get_location = self::en_dayross_get_location(get_post_meta(self::$post_id, self::$product_key_name, true));
     667                            $en_dayross_get_location = self::en_dayross_get_location(get_post_meta($_post_id, self::$product_key_name, true));
    654668
    655669                            if (empty($en_dayross_get_location)) {
     
    762776        }
    763777
     778        static public function en_get_product_level_fulfillment_offset_days($_product, $variation_id, $product_id)
     779        {
     780            $fulfillment_offset_days = '';
     781            $field_name = '_eniture_product_level_fulfillment_offset_days';
     782
     783            if ($_product->get_type() == 'variation' && $variation_id > 0) {
     784                $fulfillment_offset_days = get_post_meta($variation_id, $field_name, true);
     785
     786                if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) {
     787                    $parent_id = $_product->get_parent_id();
     788                    if ($parent_id > 0) {
     789                        $fulfillment_offset_days = get_post_meta($parent_id, $field_name, true);
     790                    }
     791                }
     792            } else {
     793                $fulfillment_offset_days = get_post_meta($_product->get_id(), $field_name, true);
     794            }
     795
     796            if (empty($fulfillment_offset_days) || !is_numeric($fulfillment_offset_days)) {
     797                $fulfillment_offset_days = get_post_meta($product_id, $field_name, true);
     798            }
     799
     800            // Validate and sanitize the value before returning
     801            if (is_numeric($fulfillment_offset_days)) {
     802                $value = intval($fulfillment_offset_days);
     803                return $value;
     804            }
     805
     806            // Return empty string if invalid
     807            return '';
     808        }
     809
     810        /**
     811         * Quote settings
     812         * @param array $location
     813         * @return array|false
     814         */
     815        static public function en_dayross_quote_settings_detail() {
     816            $delivery_estimate_option = $cutt_off_time = $fulfilment_offset_days = '';
     817            $settings = $shipment_days = [];
     818            $feature_option = apply_filters("dayross_plans_suscription_and_features", 'order_cutt_off_time');
     819            $en_settings = json_decode(EN_DAYROSS_SET_QUOTE_SETTINGS, true);
     820            extract($en_settings);
     821
     822            // Use product-level fulfillment offset days if available, otherwise use global setting
     823            if (isset(self::$en_request['max_fulfillment_offset_days']) && is_numeric(self::$en_request['max_fulfillment_offset_days']) && self::$en_request['max_fulfillment_offset_days'] > 0) {
     824                $fulfilment_offset_days = self::$en_request['max_fulfillment_offset_days'];
     825            }
     826
     827            if (!is_array($feature_option) && ($delivery_estimate_option == 'delivery_days' || $delivery_estimate_option == 'delivery_date')) {
     828                $settings = [
     829                    'modifyShipmentDateTime' => strlen($cutt_off_time) > 0 || strlen($fulfilment_offset_days) > 0 || !empty($shipment_days) ? true : false,
     830                    'OrderCutoffTime' => $cutt_off_time,
     831                    'shipmentOffsetDays' => $fulfilment_offset_days,
     832                    'storeDateTime' => gmdate('Y-m-d H:i:s'),
     833                    'shipmentWeekDays' => $shipment_days,
     834                ];
     835            }
     836
     837            self::$en_request = array_merge(self::$en_request, $settings);
     838        }
     839
    764840    }
    765841
Note: See TracChangeset for help on using the changeset viewer.