| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
$ws = new Mbe_Shipping_Model_Ws(); |
| 7 |
$customer = $ws->getCustomer(); |
| 8 |
$availableShipping = $ws->getAllowedShipmentServices( $customer ); |
| 9 |
$serviceOptions = null; |
| 10 |
//if ($ws->isCustomerActive()) { |
| 11 |
if ( $customer->Enabled ) { |
| 12 |
if ( $availableShipping ) { |
| 13 |
foreach ( $availableShipping as $key => $array ) { |
| 14 |
$serviceOptions[ $array['value'] ] = $array['label']; |
| 15 |
} |
| 16 |
} else { |
| 17 |
$serviceOptions = array( '' => __( 'Set ws parameters and save to retrieve available shipment types', 'mail-boxes-etc' ) ); |
| 18 |
} |
| 19 |
} else { |
| 20 |
$serviceOptions = array( '' => __( 'Your user is not active', 'mail-boxes-etc' ) ); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
$shipmentTypeOptions = array( 'GENERIC' => __( 'Generic', 'mail-boxes-etc' ) ); |
| 25 |
|
| 26 |
if ( $customer && $customer->Permissions->canChooseMBEShipType ) { |
| 27 |
$shipmentTypeOptions['ENVELOPE'] = __( 'Envelope', 'mail-boxes-etc' ); |
| 28 |
} |
| 29 |
|
| 30 |
$this->update_option( 'mbe_can_create_courier_waybill', (int) $customer->Permissions->canCreateCourierWaybill ); |
| 31 |
|
| 32 |
$countries_obj = new WC_Countries(); |
| 33 |
$countries = version_compare( WC()->version, '2.1', '>=' ) ? $countries_obj->__get( 'countries' ) : $countries_obj->get_allowed_countries(); |
| 34 |
|
| 35 |
// Closure mode options |
| 36 |
$closureModeOptions = array( |
| 37 |
Mbe_Shipping_Helper_Data::MBE_CLOSURE_MODE_AUTOMATICALLY => __( 'Automatically', 'mail-boxes-etc' ), |
| 38 |
Mbe_Shipping_Helper_Data::MBE_CLOSURE_MODE_MANUALLY => __( 'Manually', 'mail-boxes-etc' ), |
| 39 |
); |
| 40 |
|
| 41 |
$closureTimeOptions = array(); |
| 42 |
for ( $i = 0; $i < 24; $i ++ ) { |
| 43 |
$closureTimeOptions[ $i . ':00:00' ] = $i . ':00'; |
| 44 |
$closureTimeOptions[ $i . ':30:00' ] = $i . ':30'; |
| 45 |
} |
| 46 |
|
| 47 |
// Closure mode options |
| 48 |
$creationModeOptions = array( |
| 49 |
Mbe_Shipping_Helper_Data::MBE_CREATION_MODE_AUTOMATICALLY => __( 'Automatically', 'mail-boxes-etc' ), |
| 50 |
Mbe_Shipping_Helper_Data::MBE_CREATION_MODE_MANUALLY => __( 'Manually', 'mail-boxes-etc' ), |
| 51 |
); |
| 52 |
|
| 53 |
|
| 54 |
$customInputs = array(); |
| 55 |
$helper = new Mbe_Shipping_Helper_Data(); |
| 56 |
$selectedServices = $helper->getAllowedShipmentServices(); |
| 57 |
|
| 58 |
if ( ! empty( $selectedServices ) ) { |
| 59 |
foreach ( $selectedServices as $t ) { |
| 60 |
$index = array_search( $t, array_column( $availableShipping, 'value' ) ); |
| 61 |
$shippingLabel = ""; |
| 62 |
if ( isset( $availableShipping[ $index ]['label'] ) ) { |
| 63 |
$shippingLabel = $availableShipping[ $index ]['label']; |
| 64 |
} |
| 65 |
$labelDom = sprintf( __( 'Free shipping Thresholds %s', 'mail-boxes-etc' ), $shippingLabel ) . ' - ' . __( 'Domestic', 'mail-boxes-etc' ); |
| 66 |
$customInputs[] = array( 'label' => $labelDom, 'name' => 'mbelimit_' . strtolower( $t ) . '_dom' ); |
| 67 |
$labelWw = sprintf( __( 'Free shipping Thresholds %s', 'mail-boxes-etc' ), $shippingLabel ) . ' - ' . __( 'Rest of the world', 'mail-boxes-etc' ); |
| 68 |
$customInputs[] = array( 'label' => $labelWw, 'name' => 'mbelimit_' . strtolower( $t ) . '_ww' ); |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
$csvModeOptions = array( |
| 74 |
Mbe_Shipping_Helper_Data::MBE_CSV_MODE_DISABLED => __( 'Disabled', 'mail-boxes-etc' ), |
| 75 |
Mbe_Shipping_Helper_Data::MBE_CSV_MODE_PARTIAL => __( 'Partial', 'mail-boxes-etc' ), |
| 76 |
Mbe_Shipping_Helper_Data::MBE_CSV_MODE_TOTAL => __( 'Total', 'mail-boxes-etc' ), |
| 77 |
); |
| 78 |
|
| 79 |
$insuranceModeOptions = array( |
| 80 |
Mbe_Shipping_Helper_Data::MBE_INSURANCE_WITH_TAXES => __( 'With Taxes', 'mail-boxes-etc' ), |
| 81 |
Mbe_Shipping_Helper_Data::MBE_INSURANCE_WITHOUT_TAXES => __( 'Without Taxes', 'mail-boxes-etc' ), |
| 82 |
); |
| 83 |
|
| 84 |
$shipmentsCsvFileUrl = ""; |
| 85 |
if ( $helper->getShipmentsCsvFileUrl() ) { |
| 86 |
$shipmentsCsvFileUrl = sprintf( __( '<a href="%s" target="_blank">Download current file</a>', 'mail-boxes-etc' ), $helper->getShipmentsCsvFileUrl() ); |
| 87 |
} |
| 88 |
|
| 89 |
$shipmentsCsvTemplateFileUrl = sprintf( __( '<a href="%s" target="_blank">Download template file</a>', 'mail-boxes-etc' ), $helper->getShipmentsCsvTemplateFileUrl() ); |
| 90 |
/** |
| 91 |
* Array of settings |
| 92 |
*/ |
| 93 |
$result = array( |
| 94 |
'mbe_version' => array( |
| 95 |
'title' => 'v.' . MBE_E_LINK_PLUGIN_VERSION, |
| 96 |
'type' => 'hidden', |
| 97 |
), |
| 98 |
'mbe_debug' => array( |
| 99 |
'title' => __( 'Debug', 'mail-boxes-etc' ), |
| 100 |
'type' => 'select', |
| 101 |
'options' => array( 1 => __( 'Yes', 'mail-boxes-etc' ), 0 => __( 'No', 'mail-boxes-etc' ) ), |
| 102 |
'label' => __( 'Debug', 'mail-boxes-etc' ), |
| 103 |
'description' => __( 'Activate Debug mode to save MBE e-Link logs', 'mail-boxes-etc' ), |
| 104 |
'default' => 0, |
| 105 |
) |
| 106 |
); |
| 107 |
$debugButton = []; |
| 108 |
if ( is_file( $helper->getLogPluginPath() ) || is_file( $helper->getLogWsPath() ) ) { |
| 109 |
$debugButton = array( |
| 110 |
'debug_download' => array( |
| 111 |
'title' => __( 'Download debug files', 'mail-boxes-etc' ), |
| 112 |
'type' => 'mbebutton', |
| 113 |
'caption' => __( 'Download now', 'mail-boxes-etc' ), |
| 114 |
'class' => 'button-secondary', |
| 115 |
'confirm' => false, |
| 116 |
'onclick' => get_admin_url() . 'admin-post.php?action=mbe_download_log_files', |
| 117 |
'blank' => true, |
| 118 |
), |
| 119 |
'debug_delete' => array( |
| 120 |
'title' => __( 'Delete debug files', 'mail-boxes-etc' ), |
| 121 |
'type' => 'mbebutton', |
| 122 |
'caption' => __( 'Delete now', 'mail-boxes-etc' ), |
| 123 |
'class' => 'button-secondary', |
| 124 |
'confirm' => true, |
| 125 |
'onclick' => get_admin_url() . 'admin-post.php?action=mbe_delete_log_files', |
| 126 |
'blank' => false, |
| 127 |
'confirm_txt' => __( 'Do you want to permanentely delete the log files ?' ), |
| 128 |
), |
| 129 |
); |
| 130 |
} |
| 131 |
$result = array_merge( $result, $debugButton ); |
| 132 |
$result = array_merge( $result, array( |
| 133 |
'mbe_active' => array( |
| 134 |
'title' => __( 'Enable', 'mail-boxes-etc' ), |
| 135 |
'type' => 'select', |
| 136 |
'options' => array( 1 => __( 'Yes', 'mail-boxes-etc' ), 0 => __( 'No', 'mail-boxes-etc' ) ), |
| 137 |
'label' => __( 'Enable', 'mail-boxes-etc' ), |
| 138 |
'default' => 0, |
| 139 |
), |
| 140 |
'country' => array( |
| 141 |
'title' => __( 'Country', 'mail-boxes-etc' ), |
| 142 |
'type' => 'select', |
| 143 |
'options' => array( |
| 144 |
'IT' => __( 'Italy', 'mail-boxes-etc' ), |
| 145 |
'ES' => __( 'Spain', 'mail-boxes-etc' ), |
| 146 |
'DE' => __( 'Germany', 'mail-boxes-etc' ), |
| 147 |
'FR' => __( 'France', 'mail-boxes-etc' ), |
| 148 |
'AT' => __( 'Austria', 'mail-boxes-etc' ), |
| 149 |
'PL' => __( 'Poland', 'mail-boxes-etc' ), |
| 150 |
'HR' => __( 'Croatia', 'mail-boxes-etc' ) |
| 151 |
), |
| 152 |
'description' => __( 'Select your MBE Center\'s country', 'mail-boxes-etc' ), |
| 153 |
'desc_tip' => true, |
| 154 |
), |
| 155 |
'url' => array( |
| 156 |
'title' => __( 'OnlineMBE web-service URL', 'mail-boxes-etc' ), |
| 157 |
'type' => 'text', |
| 158 |
'description' => __( 'Please contact your MBE Center', 'mail-boxes-etc' ), |
| 159 |
), |
| 160 |
'username' => array( |
| 161 |
'title' => __( 'Login MBE e-LINK *', 'mail-boxes-etc' ), |
| 162 |
'description' => __('provided by the MBE Center or created by the customer on MBE Online, if enabled', 'mail-boxes-etc' ), |
| 163 |
'type' => 'text', |
| 164 |
), |
| 165 |
'password' => array( |
| 166 |
'title' => __( 'Passphrase MBE e-LINK *', 'mail-boxes-etc' ), |
| 167 |
'description' => __('provided by the MBE Center or created by the customer on MBE Online, if enabled', 'mail-boxes-etc' ), |
| 168 |
'type' => 'password', |
| 169 |
), |
| 170 |
'description' => array( |
| 171 |
'title' => __( 'MBE shipping description', 'mail-boxes-etc' ), |
| 172 |
'type' => 'text', |
| 173 |
), |
| 174 |
'default_shipment_type' => array( |
| 175 |
'title' => __( 'Default Shipment type', 'mail-boxes-etc' ), |
| 176 |
'label' => __( 'Default Shipment type', 'mail-boxes-etc' ), |
| 177 |
'type' => 'select', |
| 178 |
'options' => $shipmentTypeOptions, |
| 179 |
), |
| 180 |
'allowed_shipment_services' => array( |
| 181 |
'title' => __( 'MBE Services', 'mail-boxes-etc' ), |
| 182 |
'label' => __( 'MBE Services', 'mail-boxes-etc' ), |
| 183 |
'type' => 'multiselect', |
| 184 |
'options' => $serviceOptions, |
| 185 |
'description' => __( 'Select MBE Services available to your Customers', 'mail-boxes-etc' ), |
| 186 |
), |
| 187 |
) ); |
| 188 |
|
| 189 |
if ( ! empty( $selectedServices ) ) { |
| 190 |
// Custom label for selected methods |
| 191 |
$customLabels = []; |
| 192 |
foreach ( $selectedServices as $t ) { |
| 193 |
$index = array_search( $t, array_column( $availableShipping, 'value' ) ); |
| 194 |
if ( isset( $availableShipping[ $index ]['label'] ) ) { |
| 195 |
$customLabels[ 'mbe_custom_label_' . strtolower( $t ) ] = array( |
| 196 |
'title' => __( 'Custom name for', 'mail-boxes-etc' ) . ' ' . $availableShipping[ $index ]['label'], |
| 197 |
'type' => 'text', |
| 198 |
'description' => __( 'Insert the custom name for the shipment method. Leave blank if you don\'t want to change the default value', 'mail-boxes-etc' ), |
| 199 |
); |
| 200 |
} |
| 201 |
} |
| 202 |
$result = array_merge( $result, $customLabels ); |
| 203 |
|
| 204 |
// Default method mapping |
| 205 |
$result['mbe_enable_custom_mapping'] = |
| 206 |
array( |
| 207 |
'title' => __( 'Default shipping methods mapping', 'mail-boxes-etc' ), |
| 208 |
'type' => 'select', |
| 209 |
'default' => 'no', |
| 210 |
'options' => array( 'yes' => __( 'Yes', 'mail-boxes-etc' ), 'no' => __( 'No', 'mail-boxes-etc' ) ), |
| 211 |
'label' => __( 'Enable default methods mapping', 'mail-boxes-etc' ), |
| 212 |
'description' => __( 'Enable the function to map default shipping methods to MBE services (MBE methods will not be available on the frontend)', 'mail-boxes-etc' ), |
| 213 |
); |
| 214 |
|
| 215 |
if ( $helper->isEnabledCustomMapping() ) { |
| 216 |
$defaultMethods = WC()->shipping()->get_shipping_methods(); |
| 217 |
// Remove mbe_shipping from default methods |
| 218 |
if (isset($defaultMethods['wf_mbe_shipping'])) { |
| 219 |
unset($defaultMethods['wf_mbe_shipping']); |
| 220 |
} |
| 221 |
$customMapping = []; |
| 222 |
$selectedOptions = []; |
| 223 |
// Remove UPS Delivery point method as it doesn't make sense as a mapping |
| 224 |
foreach ( array_diff($selectedServices,[MBE_UAP_SERVICE]) as $key => $value ) { |
| 225 |
$index = array_search( $value, array_column( $availableShipping, 'value' ) ); |
| 226 |
if ( isset( $availableShipping[ $index ]['label'] ) ) { |
| 227 |
$selectedOptions[ $value ] = __( $availableShipping[ $index ]['label'], 'mail-boxes-etc' ); |
| 228 |
} |
| 229 |
} |
| 230 |
foreach ( $defaultMethods as $default_method ) { |
| 231 |
if ( isset( $default_method->id ) ) { |
| 232 |
$customMapping[ 'mbe_custom_mapping_' . strtolower( $default_method->id ) ] = array( |
| 233 |
'title' => __( 'Custom mapping for', 'mail-boxes-etc' ) . ' ' . $default_method->method_title, |
| 234 |
'type' => 'select', |
| 235 |
'default' => '', |
| 236 |
'description' => __( 'Select the custom mapping for the default shipping method. Leave blank if you don\'t want to map it', 'mail-boxes-etc' ), |
| 237 |
'options' => ( array_merge( [ '' => '' ], $selectedOptions ) ) |
| 238 |
); |
| 239 |
} |
| 240 |
} |
| 241 |
$result = array_merge( $result, $customMapping ); |
| 242 |
} |
| 243 |
|
| 244 |
} |
| 245 |
|
| 246 |
|
| 247 |
$result = array_merge( $result, array( |
| 248 |
'default_shipment_mode' => array( |
| 249 |
'title' => __( 'Shipment configuration mode', 'mail-boxes-etc' ), |
| 250 |
'description' => __( 'WARNING: activating the option \'Create one Shipment per Item\' with COD payment, the shopping cart\'s amount will be split and charged evenly on each shipment (based on number of items, not on their value)', 'mail-boxes-etc' ), |
| 251 |
'label' => __( 'Shipment configuration mode', 'mail-boxes-etc' ), |
| 252 |
'type' => 'select', |
| 253 |
'options' => array( |
| 254 |
'1' => __( 'Create one Shipment per Item', 'mail-boxes-etc' ), |
| 255 |
'2' => __( 'Create one Shipment per shopping cart (parcels calculated based on weight)', 'mail-boxes-etc' ), |
| 256 |
'3' => __( 'Create one Shipment per shopping cart with one parcel per Item', 'mail-boxes-etc' ), |
| 257 |
), |
| 258 |
) |
| 259 |
)); |
| 260 |
// CSV PACKAGES |
| 261 |
if ($helper->getShipmentConfigurationMode()==2) { |
| 262 |
$result = array_merge( $result, array( |
| 263 |
'use_packages_csv' => [ |
| 264 |
'title' => __( 'Csv for standard packages', 'mail-boxes-etc' ), |
| 265 |
'type' => 'select', |
| 266 |
'options' => [ 0 => __( 'No', 'mail-boxes-etc' ), 1 => __( 'Yes', 'mail-boxes-etc' ) ], |
| 267 |
'label' => __( 'Csv for standard packages', 'mail-boxes-etc' ), |
| 268 |
'description' => __( 'Load the standard packages via csv file', 'mail-boxes-etc' ), |
| 269 |
'default' => 0, |
| 270 |
], |
| 271 |
)); |
| 272 |
|
| 273 |
if ($helper->isCsvStandardPackageEnabled()) { |
| 274 |
$result = array_merge( $result, [ |
| 275 |
'packages_csv' => [ |
| 276 |
'title' => __( 'Packages via csv - File upload', 'mail-boxes-etc' ), |
| 277 |
'type' => 'file', |
| 278 |
], |
| 279 |
'packages_csv_file' => [ |
| 280 |
'title' => '', |
| 281 |
'type' => 'hidden', |
| 282 |
], |
| 283 |
'packages_csv_download' => [ |
| 284 |
'title' => '', |
| 285 |
'type' => 'mbebutton', |
| 286 |
'caption' => __( 'Download current file', 'mail-boxes-etc' ), |
| 287 |
'class' => (empty($helper->getPackagesCsvFile())?'disabled ':'').'button-secondary', |
| 288 |
'confirm' => false, |
| 289 |
'onclick' => get_admin_url() . 'admin-post.php?action=mbe_download_standard_package_file&mbe_filetype=package', |
| 290 |
'blank' => true, |
| 291 |
'custom_attributes' => [(empty($helper->getPackagesCsvFile())?'disabled':'') => ''] |
| 292 |
], |
| 293 |
'packages_template_download' => [ |
| 294 |
'title' => '', |
| 295 |
'type' => 'mbebutton', |
| 296 |
'caption' => __( 'Download template file', 'mail-boxes-etc' ), |
| 297 |
'class' => 'button-secondary', |
| 298 |
'confirm' => false, |
| 299 |
'onclick' => get_admin_url() . 'admin-post.php?action=mbe_download_standard_package_file&mbe_filetype=package-template', |
| 300 |
'blank' => true, |
| 301 |
], |
| 302 |
'packages_product_csv' => [ |
| 303 |
'title' => __( 'Packages for products via csv - File upload', 'mail-boxes-etc' ), |
| 304 |
'type' => 'file', |
| 305 |
], |
| 306 |
'packages_product_csv_file' => [ |
| 307 |
'title' => '', |
| 308 |
'type' => 'hidden', |
| 309 |
], |
| 310 |
'packages_product_csv_download' => [ |
| 311 |
'title' => '', |
| 312 |
'type' => 'mbebutton', |
| 313 |
'caption' => __( 'Download current file', 'mail-boxes-etc' ), |
| 314 |
'class' => (empty($helper->getPackagesProductCsvFile())?'disabled ':'').'button-secondary', |
| 315 |
'confirm' => false, |
| 316 |
'onclick' => get_admin_url() . 'admin-post.php?action=mbe_download_standard_package_file&mbe_filetype=package-product', |
| 317 |
'blank' => true, |
| 318 |
'custom_attributes' => [(empty($helper->getPackagesProductCsvFile())?'disabled':'') => ''] |
| 319 |
], |
| 320 |
'packages_product_template_download' => [ |
| 321 |
'title' => '', |
| 322 |
'type' => 'mbebutton', |
| 323 |
'caption' => __( 'Download template file', 'mail-boxes-etc' ), |
| 324 |
'class' => 'button-secondary', |
| 325 |
'confirm' => false, |
| 326 |
'onclick' => get_admin_url() . 'admin-post.php?action=mbe_download_standard_package_file&mbe_filetype=package-product-template', |
| 327 |
'blank' => true, |
| 328 |
], |
| 329 |
'csv_packages_default' => [ |
| 330 |
'title' => __( 'Default shipping package', 'mail-boxes-etc' ), |
| 331 |
'type' => 'select', |
| 332 |
'label' => __( 'Default shipping package', 'mail-boxes-etc' ), |
| 333 |
'description' => __( 'Set the package to be used as default if the product doesn\'t have a related one', 'mail-boxes-etc' ), |
| 334 |
'options' => $helper->getStandardPackagesForSelect() |
| 335 |
], |
| 336 |
]); |
| 337 |
} |
| 338 |
} |
| 339 |
|
| 340 |
// STANDARD PACKAGE SETTINGS |
| 341 |
if (!$helper->useCsvStandardPackages()) { |
| 342 |
$result = array_merge( $result, array( |
| 343 |
'default_length' => array( |
| 344 |
'title' => __( 'Default Package Length', 'mail-boxes-etc' ), |
| 345 |
'type' => 'text', |
| 346 |
), |
| 347 |
'default_width' => array( |
| 348 |
'title' => __( 'Default Package Width', 'mail-boxes-etc' ), |
| 349 |
'type' => 'text', |
| 350 |
), |
| 351 |
'default_height' => array( |
| 352 |
'title' => __( 'Default Package Height', 'mail-boxes-etc' ), |
| 353 |
'type' => 'text', |
| 354 |
), |
| 355 |
'max_package_weight' => array( |
| 356 |
'title' => __( 'Maximum Package Weight', 'mail-boxes-etc' ) . ' (' . esc_html( get_option( 'woocommerce_weight_unit' ) ) . ')', |
| 357 |
'type' => 'text', |
| 358 |
'description' => __( 'Check if any limitation is applied with your MBE Center', 'mail-boxes-etc' ), |
| 359 |
) |
| 360 |
) ); |
| 361 |
} |
| 362 |
|
| 363 |
$result = array_merge( $result, array( |
| 364 |
'max_shipment_weight' => array( |
| 365 |
'title' => __( 'Maximum shipment weight', 'mail-boxes-etc' ) . ' (' . esc_html( get_option( 'woocommerce_weight_unit' ) ) . ')', |
| 366 |
'type' => 'text', |
| 367 |
), |
| 368 |
'handling_type' => array( |
| 369 |
'title' => __( 'Markup - Application rule', 'mail-boxes-etc' ), |
| 370 |
'type' => 'select', |
| 371 |
'options' => array( |
| 372 |
'P' => __( 'Percentage', 'mail-boxes-etc' ), |
| 373 |
'F' => __( 'Fixed amount', 'mail-boxes-etc' ), |
| 374 |
), |
| 375 |
), |
| 376 |
'handling_action' => array( |
| 377 |
'title' => __( 'Markup - Amount', 'mail-boxes-etc' ), |
| 378 |
'type' => 'select', |
| 379 |
'options' => array( |
| 380 |
'S' => __( 'Shipment', 'mail-boxes-etc' ), |
| 381 |
'P' => __( 'Parcel', 'mail-boxes-etc' ), |
| 382 |
), |
| 383 |
), |
| 384 |
'handling_fee' => array( |
| 385 |
'title' => __( 'Handling Fee', 'mail-boxes-etc' ), |
| 386 |
'type' => 'text', |
| 387 |
), |
| 388 |
'handling_fee_rounding' => array( |
| 389 |
'title' => __( 'Markup - Apply rounding', 'mail-boxes-etc' ), |
| 390 |
'type' => 'select', |
| 391 |
'options' => array( |
| 392 |
'1' => __( 'No rounding', 'mail-boxes-etc' ), |
| 393 |
'2' => __( 'Round up or down automatically', 'mail-boxes-etc' ), |
| 394 |
'3' => __( 'Always round down', 'mail-boxes-etc' ), |
| 395 |
'4' => __( 'Always round up', 'mail-boxes-etc' ), |
| 396 |
), |
| 397 |
), |
| 398 |
'handling_fee_rounding_amount' => array( |
| 399 |
'title' => __( 'Markup - Rounding unit (in €)', 'mail-boxes-etc' ), |
| 400 |
'type' => 'select', |
| 401 |
'options' => array( |
| 402 |
'1' => '1', |
| 403 |
'2' => '0.5', |
| 404 |
), |
| 405 |
), |
| 406 |
'sallowspecific' => array( |
| 407 |
'title' => __( 'Ship to Applicable Countries', 'mail-boxes-etc' ), |
| 408 |
'type' => 'select', |
| 409 |
'options' => array( |
| 410 |
'0' => __( 'All Allowed Countries', 'mail-boxes-etc' ), |
| 411 |
'1' => __( 'Specific Countries', 'mail-boxes-etc' ), |
| 412 |
), |
| 413 |
), |
| 414 |
'specificcountry' => array( |
| 415 |
'title' => __( 'Country', 'mail-boxes-etc' ), |
| 416 |
'type' => 'multiselect', |
| 417 |
'options' => $countries, |
| 418 |
), |
| 419 |
// 'sort_order' => array( |
| 420 |
// 'title' => __( 'Sort Order', 'mail-boxes-etc' ), |
| 421 |
// 'type' => 'text', |
| 422 |
// ), |
| 423 |
// 'mbe_shipping_specificerrmsg' => array( |
| 424 |
// 'title' => __( 'Displayed Error Message', 'mail-boxes-etc' ), |
| 425 |
// 'type' => 'textarea', |
| 426 |
// ), |
| 427 |
'shipments_closure_mode' => array( |
| 428 |
'title' => __( 'OnlineMBE daily shipments closure - Mode', 'mail-boxes-etc' ), |
| 429 |
'type' => 'select', |
| 430 |
'options' => $closureModeOptions, |
| 431 |
), |
| 432 |
'shipments_closure_time' => array( |
| 433 |
'title' => __( 'OnlineMBE daily time shipments closure (automatic mode only)', 'mail-boxes-etc' ), |
| 434 |
'type' => 'select', |
| 435 |
'options' => $closureTimeOptions, |
| 436 |
), |
| 437 |
'shipments_creation_mode' => array( |
| 438 |
'title' => __( 'Shipments creation in OnlineMBE - Mode', 'mail-boxes-etc' ), |
| 439 |
'type' => 'select', |
| 440 |
'options' => $creationModeOptions, |
| 441 |
), |
| 442 |
'mbe_add_track_id' => array( |
| 443 |
'title' => __( 'Add tracking id to email', 'mail-boxes-etc' ), |
| 444 |
'type' => 'select', |
| 445 |
'options' => array( 1 => __( 'Yes', 'mail-boxes-etc' ), 0 => __( 'No', 'mail-boxes-etc' ) ), |
| 446 |
'label' => __( 'Add tracking id to email', 'mail-boxes-etc' ), |
| 447 |
'description' => __( 'Select if you want to add the tracking code to the email order detail', 'mail-boxes-etc' ), |
| 448 |
'default' => 0, |
| 449 |
), |
| 450 |
'shipments_csv' => array( |
| 451 |
'title' => __( 'Custom prices via csv - File upload', 'mail-boxes-etc' ), |
| 452 |
'type' => 'file', |
| 453 |
), |
| 454 |
'shipments_csv_file' => array( |
| 455 |
'title' => '', |
| 456 |
'type' => 'hidden', |
| 457 |
'description' => $shipmentsCsvFileUrl, |
| 458 |
), |
| 459 |
'shipments_csv_template_file' => array( |
| 460 |
'title' => '', |
| 461 |
'type' => 'hidden', |
| 462 |
'description' => $shipmentsCsvTemplateFileUrl, |
| 463 |
), |
| 464 |
'shipments_csv_mode' => array( |
| 465 |
'title' => __( 'Custom prices via csv - File mode', 'mail-boxes-etc' ), |
| 466 |
'type' => 'select', |
| 467 |
'options' => $csvModeOptions, |
| 468 |
), |
| 469 |
|
| 470 |
|
| 471 |
'mbe_shipments_csv_insurance_min' => array( |
| 472 |
'title' => __( 'Custom prices via csv - Min price for insurance extra-service', 'mail-boxes-etc' ), |
| 473 |
'type' => 'text', |
| 474 |
), |
| 475 |
'mbe_shipments_csv_insurance_per' => array( |
| 476 |
'title' => __( 'Custom prices via csv - Percentage for insurance extra-service price calculation', 'mail-boxes-etc' ), |
| 477 |
'type' => 'text', |
| 478 |
), |
| 479 |
'mbe_shipments_ins_mode' => array( |
| 480 |
'title' => __( 'Insurance extra-service - Declared value calculation', 'mail-boxes-etc' ), |
| 481 |
'type' => 'select', |
| 482 |
'options' => $insuranceModeOptions, |
| 483 |
) |
| 484 |
) ); |
| 485 |
|
| 486 |
// UAP Option |
| 487 |
/* |
| 488 |
if ( in_array( 'UST', ( explode( ',', $customer->Permissions->enabledCourierServices ) ? explode( ',', $customer->Permissions->enabledCourierServices ) : [] ) ) |
| 489 |
&& in_array( 'MDP', ( is_array( $selectedServices ) ? $selectedServices : [] ) ) |
| 490 |
&& $customer->Permissions->enabledShipUAP |
| 491 |
) { |
| 492 |
$result['mbe_ship_to_UAP'] = |
| 493 |
array( |
| 494 |
'title' => __( 'Ship to UAP', 'mail-boxes-etc' ), |
| 495 |
'type' => 'select', |
| 496 |
'default' => 0, |
| 497 |
'options' => array( 1 => __( 'Yes', 'mail-boxes-etc' ), 0 => __( 'No', 'mail-boxes-etc' ) ), |
| 498 |
'label' => __( 'Ship to UAP', 'mail-boxes-etc' ), |
| 499 |
'description' => __( 'Enable the option to ship to an UAP', 'mail-boxes-etc' ), |
| 500 |
); |
| 501 |
} |
| 502 |
*/ |
| 503 |
|
| 504 |
foreach ( $customInputs as $input ) { |
| 505 |
$result[ $input['name'] ] = array( |
| 506 |
'title' => __( $input['label'], 'mail-boxes-etc' ), |
| 507 |
'type' => 'text', |
| 508 |
); |
| 509 |
} |
| 510 |
|
| 511 |
return $result; |