Plugin Directory

Changeset 3451339


Ignore:
Timestamp:
02/01/2026 11:29:35 AM (2 months ago)
Author:
bookpodplugin1
Message:

Version 2.1.2: Improved shipping logic for combined orders

Location:
bookpod-author-tools
Files:
11 edited
48 copied

Legend:

Unmodified
Added
Removed
  • bookpod-author-tools/tags/2.1.1/bookpod-author-tools.php

    r3449910 r3451339  
    33 * Plugin Name: BookPod Author Tools
    44 * Description: A plugin for managing books and orders through Bookpod.
    5  * Version:     2.1.1
     5 * Version:     2.1.2
    66 * Author:      Rachel Stern
    77 * Text Domain: bookpod-author-tools
  • bookpod-author-tools/tags/2.1.1/bpat-book.php

    r3449910 r3451339  
    483483        plugins_url( 'assets/bpat-form.css', __FILE__ ),
    484484        array(),
    485         '2.1.1'
     485        '2.1.2'
    486486    );
    487487
     
    490490        plugins_url( 'assets/bpat-form.js', __FILE__ ),
    491491        array(),
    492         '2.1.1',
     492        '2.1.2',
    493493        true
    494494    );
  • bookpod-author-tools/tags/2.1.1/languages/bookpod-author-tools-he_IL.po

    r3449910 r3451339  
    864864#: bpat-order.php:1205
    865865msgid "Search by city or street..."
    866 msgstr "חפשי לפי עיר או רחוב..."
     866msgstr "חפש לפי עיר או רחוב..."
    867867
    868868#: bpat-book.php:1186
  • bookpod-author-tools/tags/2.1.1/readme-he_IL.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/tags/2.1.1/readme.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/tags/2.1.1/trunk/bookpod-author-tools.php

    r3449910 r3451339  
    33 * Plugin Name: BookPod Author Tools
    44 * Description: A plugin for managing books and orders through Bookpod.
    5  * Version:     2.1.1
     5 * Version:     2.1.2
    66 * Author:      Rachel Stern
    77 * Text Domain: bookpod-author-tools
  • bookpod-author-tools/tags/2.1.1/trunk/bpat-book.php

    r3449910 r3451339  
    483483        plugins_url( 'assets/bpat-form.css', __FILE__ ),
    484484        array(),
    485         '2.1.1'
     485        '2.1.2'
    486486    );
    487487
     
    490490        plugins_url( 'assets/bpat-form.js', __FILE__ ),
    491491        array(),
    492         '2.1.1',
     492        '2.1.2',
    493493        true
    494494    );
  • bookpod-author-tools/tags/2.1.1/trunk/bpat-order.php

    r3449910 r3451339  
    286286
    287287    if ($shipping_code === 1) {
    288          if ( empty( $pickup_point_id ) ) {
     288        if ( empty( $pickup_point_id ) && $is_combined_order && ! $redirect_combined_orders_pickup ) {
     289            $pickup_point_id = bpat_find_pickup_point_id_by_city( $address_details['city'] ?? '' );
     290            if ( empty( $pickup_point_id ) ) {
     291                $pickup_point_id = '0000';
     292            }
     293        }
     294
     295        if ( empty( $pickup_point_id ) ) {
    289296             $pickup_point_id = bpat_extract_pickup_point_from_order( $order );
    290297         }
     
    317324         $shipping_details['floor']            = $floor_num;
    318325         $shipping_details['notes']            = $address_notes;
    319          $shipment_remarks_parts = array_filter( array( $customer_note, $delivery_notes ), 'strlen' );
    320          if ( ! empty( $shipment_remarks_parts ) ) {
    321              $shipping_details['shipment_remarks'] = implode( ' | ', $shipment_remarks_parts );
    322          }
     326         $shipping_details['shipment_remarks'] = $delivery_notes;
    323327     }
    324328
     
    11041108}
    11051109
     1110function bpat_find_pickup_point_id_by_city( $city ) {
     1111    $normalized_city = bpat_normalize_scalar_value( $city );
     1112    if ( $normalized_city === '' ) {
     1113        return '';
     1114    }
     1115
     1116    if ( function_exists( 'mb_strtolower' ) ) {
     1117        $normalized_city = mb_strtolower( $normalized_city );
     1118    } else {
     1119        $normalized_city = strtolower( $normalized_city );
     1120    }
     1121
     1122    $points = bpat_get_pickup_points_list();
     1123    if ( empty( $points ) || ! is_array( $points ) ) {
     1124        return '';
     1125    }
     1126
     1127    $candidates = array();
     1128
     1129    foreach ( $points as $point ) {
     1130        if ( ! is_array( $point ) ) {
     1131            continue;
     1132        }
     1133
     1134        $point_city = $point['city'] ?? $point['city_name'] ?? $point['cityName'] ?? '';
     1135        $point_city = bpat_normalize_scalar_value( $point_city );
     1136        if ( $point_city === '' ) {
     1137            continue;
     1138        }
     1139
     1140        if ( function_exists( 'mb_strtolower' ) ) {
     1141            $point_city = mb_strtolower( $point_city );
     1142        } else {
     1143            $point_city = strtolower( $point_city );
     1144        }
     1145
     1146        if ( $point_city !== $normalized_city ) {
     1147            continue;
     1148        }
     1149
     1150        $candidate_id = $point['n_code'] ?? $point['id'] ?? $point['pointId'] ?? null;
     1151        if ( ! $candidate_id ) {
     1152            continue;
     1153        }
     1154
     1155        $candidates[] = (string) $candidate_id;
     1156    }
     1157
     1158    if ( empty( $candidates ) ) {
     1159        return '';
     1160    }
     1161
     1162    $random_index = wp_rand( 0, count( $candidates ) - 1 );
     1163    return $candidates[ $random_index ];
     1164}
    11061165
    11071166add_action('wp_ajax_bpat_get_pickup_points', 'bpat_ajax_get_pickup_points');
  • bookpod-author-tools/tags/2.1.1/trunk/languages/bookpod-author-tools-he_IL.po

    r3449910 r3451339  
    864864#: bpat-order.php:1205
    865865msgid "Search by city or street..."
    866 msgstr "חפשי לפי עיר או רחוב..."
     866msgstr "חפש לפי עיר או רחוב..."
    867867
    868868#: bpat-book.php:1186
  • bookpod-author-tools/tags/2.1.1/trunk/readme-he_IL.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/tags/2.1.1/trunk/readme.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/tags/2.1.2/bookpod-author-tools.php

    r3449910 r3451339  
    33 * Plugin Name: BookPod Author Tools
    44 * Description: A plugin for managing books and orders through Bookpod.
    5  * Version:     2.1.1
     5 * Version:     2.1.2
    66 * Author:      Rachel Stern
    77 * Text Domain: bookpod-author-tools
  • bookpod-author-tools/tags/2.1.2/bpat-book.php

    r3449910 r3451339  
    483483        plugins_url( 'assets/bpat-form.css', __FILE__ ),
    484484        array(),
    485         '2.1.1'
     485        '2.1.2'
    486486    );
    487487
     
    490490        plugins_url( 'assets/bpat-form.js', __FILE__ ),
    491491        array(),
    492         '2.1.1',
     492        '2.1.2',
    493493        true
    494494    );
  • bookpod-author-tools/tags/2.1.2/bpat-order.php

    r3449910 r3451339  
    286286
    287287    if ($shipping_code === 1) {
    288          if ( empty( $pickup_point_id ) ) {
     288        if ( empty( $pickup_point_id ) && $is_combined_order && ! $redirect_combined_orders_pickup ) {
     289            $pickup_point_id = bpat_find_pickup_point_id_by_city( $address_details['city'] ?? '' );
     290            if ( empty( $pickup_point_id ) ) {
     291                $pickup_point_id = '0000';
     292            }
     293        }
     294
     295        if ( empty( $pickup_point_id ) ) {
    289296             $pickup_point_id = bpat_extract_pickup_point_from_order( $order );
    290297         }
     
    317324         $shipping_details['floor']            = $floor_num;
    318325         $shipping_details['notes']            = $address_notes;
    319          $shipment_remarks_parts = array_filter( array( $customer_note, $delivery_notes ), 'strlen' );
    320          if ( ! empty( $shipment_remarks_parts ) ) {
    321              $shipping_details['shipment_remarks'] = implode( ' | ', $shipment_remarks_parts );
    322          }
     326         $shipping_details['shipment_remarks'] = $delivery_notes;
    323327     }
    324328
     
    11041108}
    11051109
     1110function bpat_find_pickup_point_id_by_city( $city ) {
     1111    $normalized_city = bpat_normalize_scalar_value( $city );
     1112    if ( $normalized_city === '' ) {
     1113        return '';
     1114    }
     1115
     1116    if ( function_exists( 'mb_strtolower' ) ) {
     1117        $normalized_city = mb_strtolower( $normalized_city );
     1118    } else {
     1119        $normalized_city = strtolower( $normalized_city );
     1120    }
     1121
     1122    $points = bpat_get_pickup_points_list();
     1123    if ( empty( $points ) || ! is_array( $points ) ) {
     1124        return '';
     1125    }
     1126
     1127    $candidates = array();
     1128
     1129    foreach ( $points as $point ) {
     1130        if ( ! is_array( $point ) ) {
     1131            continue;
     1132        }
     1133
     1134        $point_city = $point['city'] ?? $point['city_name'] ?? $point['cityName'] ?? '';
     1135        $point_city = bpat_normalize_scalar_value( $point_city );
     1136        if ( $point_city === '' ) {
     1137            continue;
     1138        }
     1139
     1140        if ( function_exists( 'mb_strtolower' ) ) {
     1141            $point_city = mb_strtolower( $point_city );
     1142        } else {
     1143            $point_city = strtolower( $point_city );
     1144        }
     1145
     1146        if ( $point_city !== $normalized_city ) {
     1147            continue;
     1148        }
     1149
     1150        $candidate_id = $point['n_code'] ?? $point['id'] ?? $point['pointId'] ?? null;
     1151        if ( ! $candidate_id ) {
     1152            continue;
     1153        }
     1154
     1155        $candidates[] = (string) $candidate_id;
     1156    }
     1157
     1158    if ( empty( $candidates ) ) {
     1159        return '';
     1160    }
     1161
     1162    $random_index = wp_rand( 0, count( $candidates ) - 1 );
     1163    return $candidates[ $random_index ];
     1164}
    11061165
    11071166add_action('wp_ajax_bpat_get_pickup_points', 'bpat_ajax_get_pickup_points');
  • bookpod-author-tools/tags/2.1.2/languages/bookpod-author-tools-he_IL.po

    r3449910 r3451339  
    864864#: bpat-order.php:1205
    865865msgid "Search by city or street..."
    866 msgstr "חפשי לפי עיר או רחוב..."
     866msgstr "חפש לפי עיר או רחוב..."
    867867
    868868#: bpat-book.php:1186
  • bookpod-author-tools/tags/2.1.2/readme-he_IL.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/tags/2.1.2/readme.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/tags/2.1.2/trunk/bookpod-author-tools.php

    r3449910 r3451339  
    33 * Plugin Name: BookPod Author Tools
    44 * Description: A plugin for managing books and orders through Bookpod.
    5  * Version:     2.1.1
     5 * Version:     2.1.2
    66 * Author:      Rachel Stern
    77 * Text Domain: bookpod-author-tools
  • bookpod-author-tools/tags/2.1.2/trunk/bpat-book.php

    r3449910 r3451339  
    483483        plugins_url( 'assets/bpat-form.css', __FILE__ ),
    484484        array(),
    485         '2.1.1'
     485        '2.1.2'
    486486    );
    487487
     
    490490        plugins_url( 'assets/bpat-form.js', __FILE__ ),
    491491        array(),
    492         '2.1.1',
     492        '2.1.2',
    493493        true
    494494    );
  • bookpod-author-tools/tags/2.1.2/trunk/bpat-order.php

    r3449910 r3451339  
    286286
    287287    if ($shipping_code === 1) {
    288          if ( empty( $pickup_point_id ) ) {
     288        if ( empty( $pickup_point_id ) && $is_combined_order && ! $redirect_combined_orders_pickup ) {
     289            $pickup_point_id = bpat_find_pickup_point_id_by_city( $address_details['city'] ?? '' );
     290            if ( empty( $pickup_point_id ) ) {
     291                $pickup_point_id = '0000';
     292            }
     293        }
     294
     295        if ( empty( $pickup_point_id ) ) {
    289296             $pickup_point_id = bpat_extract_pickup_point_from_order( $order );
    290297         }
     
    317324         $shipping_details['floor']            = $floor_num;
    318325         $shipping_details['notes']            = $address_notes;
    319          $shipment_remarks_parts = array_filter( array( $customer_note, $delivery_notes ), 'strlen' );
    320          if ( ! empty( $shipment_remarks_parts ) ) {
    321              $shipping_details['shipment_remarks'] = implode( ' | ', $shipment_remarks_parts );
    322          }
     326         $shipping_details['shipment_remarks'] = $delivery_notes;
    323327     }
    324328
     
    11041108}
    11051109
     1110function bpat_find_pickup_point_id_by_city( $city ) {
     1111    $normalized_city = bpat_normalize_scalar_value( $city );
     1112    if ( $normalized_city === '' ) {
     1113        return '';
     1114    }
     1115
     1116    if ( function_exists( 'mb_strtolower' ) ) {
     1117        $normalized_city = mb_strtolower( $normalized_city );
     1118    } else {
     1119        $normalized_city = strtolower( $normalized_city );
     1120    }
     1121
     1122    $points = bpat_get_pickup_points_list();
     1123    if ( empty( $points ) || ! is_array( $points ) ) {
     1124        return '';
     1125    }
     1126
     1127    $candidates = array();
     1128
     1129    foreach ( $points as $point ) {
     1130        if ( ! is_array( $point ) ) {
     1131            continue;
     1132        }
     1133
     1134        $point_city = $point['city'] ?? $point['city_name'] ?? $point['cityName'] ?? '';
     1135        $point_city = bpat_normalize_scalar_value( $point_city );
     1136        if ( $point_city === '' ) {
     1137            continue;
     1138        }
     1139
     1140        if ( function_exists( 'mb_strtolower' ) ) {
     1141            $point_city = mb_strtolower( $point_city );
     1142        } else {
     1143            $point_city = strtolower( $point_city );
     1144        }
     1145
     1146        if ( $point_city !== $normalized_city ) {
     1147            continue;
     1148        }
     1149
     1150        $candidate_id = $point['n_code'] ?? $point['id'] ?? $point['pointId'] ?? null;
     1151        if ( ! $candidate_id ) {
     1152            continue;
     1153        }
     1154
     1155        $candidates[] = (string) $candidate_id;
     1156    }
     1157
     1158    if ( empty( $candidates ) ) {
     1159        return '';
     1160    }
     1161
     1162    $random_index = wp_rand( 0, count( $candidates ) - 1 );
     1163    return $candidates[ $random_index ];
     1164}
    11061165
    11071166add_action('wp_ajax_bpat_get_pickup_points', 'bpat_ajax_get_pickup_points');
  • bookpod-author-tools/tags/2.1.2/trunk/languages/bookpod-author-tools-he_IL.po

    r3449910 r3451339  
    864864#: bpat-order.php:1205
    865865msgid "Search by city or street..."
    866 msgstr "חפשי לפי עיר או רחוב..."
     866msgstr "חפש לפי עיר או רחוב..."
    867867
    868868#: bpat-book.php:1186
  • bookpod-author-tools/tags/2.1.2/trunk/readme-he_IL.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/tags/2.1.2/trunk/readme.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/trunk/bookpod-author-tools.php

    r3449910 r3451339  
    33 * Plugin Name: BookPod Author Tools
    44 * Description: A plugin for managing books and orders through Bookpod.
    5  * Version:     2.1.1
     5 * Version:     2.1.2
    66 * Author:      Rachel Stern
    77 * Text Domain: bookpod-author-tools
  • bookpod-author-tools/trunk/bpat-book.php

    r3449910 r3451339  
    483483        plugins_url( 'assets/bpat-form.css', __FILE__ ),
    484484        array(),
    485         '2.1.1'
     485        '2.1.2'
    486486    );
    487487
     
    490490        plugins_url( 'assets/bpat-form.js', __FILE__ ),
    491491        array(),
    492         '2.1.1',
     492        '2.1.2',
    493493        true
    494494    );
  • bookpod-author-tools/trunk/bpat-order.php

    r3449910 r3451339  
    286286
    287287    if ($shipping_code === 1) {
    288          if ( empty( $pickup_point_id ) ) {
     288        if ( empty( $pickup_point_id ) && $is_combined_order && ! $redirect_combined_orders_pickup ) {
     289            $pickup_point_id = bpat_find_pickup_point_id_by_city( $address_details['city'] ?? '' );
     290            if ( empty( $pickup_point_id ) ) {
     291                $pickup_point_id = '0000';
     292            }
     293        }
     294
     295        if ( empty( $pickup_point_id ) ) {
    289296             $pickup_point_id = bpat_extract_pickup_point_from_order( $order );
    290297         }
     
    317324         $shipping_details['floor']            = $floor_num;
    318325         $shipping_details['notes']            = $address_notes;
    319          $shipment_remarks_parts = array_filter( array( $customer_note, $delivery_notes ), 'strlen' );
    320          if ( ! empty( $shipment_remarks_parts ) ) {
    321              $shipping_details['shipment_remarks'] = implode( ' | ', $shipment_remarks_parts );
    322          }
     326         $shipping_details['shipment_remarks'] = $delivery_notes;
    323327     }
    324328
     
    11041108}
    11051109
     1110function bpat_find_pickup_point_id_by_city( $city ) {
     1111    $normalized_city = bpat_normalize_scalar_value( $city );
     1112    if ( $normalized_city === '' ) {
     1113        return '';
     1114    }
     1115
     1116    if ( function_exists( 'mb_strtolower' ) ) {
     1117        $normalized_city = mb_strtolower( $normalized_city );
     1118    } else {
     1119        $normalized_city = strtolower( $normalized_city );
     1120    }
     1121
     1122    $points = bpat_get_pickup_points_list();
     1123    if ( empty( $points ) || ! is_array( $points ) ) {
     1124        return '';
     1125    }
     1126
     1127    $candidates = array();
     1128
     1129    foreach ( $points as $point ) {
     1130        if ( ! is_array( $point ) ) {
     1131            continue;
     1132        }
     1133
     1134        $point_city = $point['city'] ?? $point['city_name'] ?? $point['cityName'] ?? '';
     1135        $point_city = bpat_normalize_scalar_value( $point_city );
     1136        if ( $point_city === '' ) {
     1137            continue;
     1138        }
     1139
     1140        if ( function_exists( 'mb_strtolower' ) ) {
     1141            $point_city = mb_strtolower( $point_city );
     1142        } else {
     1143            $point_city = strtolower( $point_city );
     1144        }
     1145
     1146        if ( $point_city !== $normalized_city ) {
     1147            continue;
     1148        }
     1149
     1150        $candidate_id = $point['n_code'] ?? $point['id'] ?? $point['pointId'] ?? null;
     1151        if ( ! $candidate_id ) {
     1152            continue;
     1153        }
     1154
     1155        $candidates[] = (string) $candidate_id;
     1156    }
     1157
     1158    if ( empty( $candidates ) ) {
     1159        return '';
     1160    }
     1161
     1162    $random_index = wp_rand( 0, count( $candidates ) - 1 );
     1163    return $candidates[ $random_index ];
     1164}
    11061165
    11071166add_action('wp_ajax_bpat_get_pickup_points', 'bpat_ajax_get_pickup_points');
  • bookpod-author-tools/trunk/languages/bookpod-author-tools-he_IL.po

    r3449910 r3451339  
    864864#: bpat-order.php:1205
    865865msgid "Search by city or street..."
    866 msgstr "חפשי לפי עיר או רחוב..."
     866msgstr "חפש לפי עיר או רחוב..."
    867867
    868868#: bpat-book.php:1186
  • bookpod-author-tools/trunk/readme-he_IL.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • bookpod-author-tools/trunk/readme.txt

    r3449910 r3451339  
    44Requires at least: 5.8
    55Tested up to: 6.9
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.