Plugin Directory

Changeset 3434381


Ignore:
Timestamp:
01/07/2026 01:29:20 PM (3 months ago)
Author:
runthingsdev
Message:

Update to version 1.1.1 from GitHub

Location:
runthings-wc-order-departments
Files:
54 added
16 deleted
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • runthings-wc-order-departments/tags/1.1.1/languages/runthings-wc-order-departments.pot

    r3318971 r3434381  
    1 # Copyright (C) 2025 runthingsdev
     1# Copyright (C) 2026 runthingsdev
    22# This file is distributed under the GPLv3 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Order Departments for WooCommerce 1.0.1\n"
     5"Project-Id-Version: Order Departments for WooCommerce 1.1.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/runthings-wc-order-departments\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-06-27T20:54:36+00:00\n"
     12"POT-Creation-Date: 2026-01-07T13:27:40+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.11.0\n"
     14"X-Generator: WP-CLI 2.12.0\n"
    1515"X-Domain: runthings-wc-order-departments\n"
    1616
     
    4040msgstr ""
    4141
    42 #: lib/actions/aw-action-add-order-department.php:20
     42#: lib/automatewoo/actions/aw-action-add-order-department.php:20
    4343msgid "Add Order Department"
    4444msgstr ""
    4545
    46 #: lib/actions/aw-action-add-order-department.php:21
     46#: lib/automatewoo/actions/aw-action-add-order-department.php:21
    4747msgid "Add a department to the order (keeps existing departments)."
    4848msgstr ""
    4949
    50 #: lib/actions/aw-action-add-order-department.php:22
    51 #: lib/actions/aw-action-clear-order-departments.php:21
    52 #: lib/actions/aw-action-remove-order-department.php:22
    53 #: lib/actions/aw-action-set-order-department.php:22
    54 #: lib/triggers/aw-trigger-order-department-added.php:22
    55 #: lib/triggers/aw-trigger-order-department-changed.php:21
    56 #: lib/triggers/aw-trigger-order-department-removed.php:22
     50#: lib/automatewoo/actions/aw-action-add-order-department.php:22
     51#: lib/automatewoo/actions/aw-action-clear-order-departments.php:21
     52#: lib/automatewoo/actions/aw-action-remove-order-department.php:22
     53#: lib/automatewoo/actions/aw-action-set-order-department.php:22
     54#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:22
     55#: lib/automatewoo/triggers/aw-trigger-order-department-changed.php:21
     56#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:22
    5757msgid "Order"
    5858msgstr ""
    5959
    60 #: lib/actions/aw-action-add-order-department.php:32
    61 #: lib/actions/aw-action-remove-order-department.php:32
    62 #: lib/actions/aw-action-set-order-department.php:32
    63 #: lib/triggers/aw-trigger-order-department-added.php:32
    64 #: lib/triggers/aw-trigger-order-department-removed.php:32
     60#: lib/automatewoo/actions/aw-action-add-order-department.php:32
     61#: lib/automatewoo/actions/aw-action-remove-order-department.php:32
     62#: lib/automatewoo/actions/aw-action-set-order-department.php:32
     63#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:32
     64#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:32
    6565msgid "Department"
    6666msgstr ""
    6767
    6868#. translators: %1$s: Workflow ID, %2$s: Department name
    69 #: lib/actions/aw-action-add-order-department.php:89
     69#: lib/automatewoo/actions/aw-action-add-order-department.php:89
     70#, php-format
    7071msgid "[AutomateWoo] Workflow #%1$s added department: %2$s"
    7172msgstr ""
    7273
    73 #: lib/actions/aw-action-clear-order-departments.php:19
     74#: lib/automatewoo/actions/aw-action-clear-order-departments.php:19
    7475msgid "Clear Order Departments"
    7576msgstr ""
    7677
    77 #: lib/actions/aw-action-clear-order-departments.php:20
     78#: lib/automatewoo/actions/aw-action-clear-order-departments.php:20
    7879msgid "Remove all departments from the order."
    7980msgstr ""
    8081
    8182#. translators: %s: Workflow ID
    82 #: lib/actions/aw-action-clear-order-departments.php:50
     83#: lib/automatewoo/actions/aw-action-clear-order-departments.php:50
     84#, php-format
    8385msgid "[AutomateWoo] Workflow #%s cleared all departments"
    8486msgstr ""
    8587
    86 #: lib/actions/aw-action-remove-order-department.php:20
     88#: lib/automatewoo/actions/aw-action-remove-order-department.php:20
    8789msgid "Remove Order Department"
    8890msgstr ""
    8991
    90 #: lib/actions/aw-action-remove-order-department.php:21
     92#: lib/automatewoo/actions/aw-action-remove-order-department.php:21
    9193msgid "Remove a department from the order."
    9294msgstr ""
    9395
    9496#. translators: %1$s: Workflow ID, %2$s: Department name
    95 #: lib/actions/aw-action-remove-order-department.php:89
     97#: lib/automatewoo/actions/aw-action-remove-order-department.php:89
     98#, php-format
    9699msgid "[AutomateWoo] Workflow #%1$s removed department: %2$s"
    97100msgstr ""
    98101
    99 #: lib/actions/aw-action-set-order-department.php:20
     102#: lib/automatewoo/actions/aw-action-set-order-department.php:20
    100103msgid "Set Order Department"
    101104msgstr ""
    102105
    103 #: lib/actions/aw-action-set-order-department.php:21
     106#: lib/automatewoo/actions/aw-action-set-order-department.php:21
    104107msgid "Set a department for the order (replaces all existing departments)."
    105108msgstr ""
    106109
    107110#. translators: %1$s: Workflow ID, %2$s: Department name
    108 #: lib/actions/aw-action-set-order-department.php:89
     111#: lib/automatewoo/actions/aw-action-set-order-department.php:89
     112#, php-format
    109113msgid "[AutomateWoo] Workflow #%1$s set department to: %2$s"
    110114msgstr ""
    111115
    112 #: lib/rules/aw-rule-order-department-count.php:22
     116#: lib/automatewoo/rules/aw-rule-order-department-count.php:22
    113117msgid "Order - Department Count"
    114118msgstr ""
    115119
    116 #: lib/rules/aw-rule-order-department-is.php:22
     120#: lib/automatewoo/rules/aw-rule-order-department-is.php:22
    117121msgid "Order - Department Is"
    118122msgstr ""
    119123
    120 #: lib/rules/aw-rule-order-has-department.php:22
     124#: lib/automatewoo/rules/aw-rule-order-has-department.php:22
    121125msgid "Order - Has Department"
     126msgstr ""
     127
     128#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:20
     129msgid "Order Department Added"
     130msgstr ""
     131
     132#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:21
     133msgid "Triggers when a department is added to an order."
     134msgstr ""
     135
     136#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:33
     137#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:33
     138msgid "Leave blank to trigger for any department."
     139msgstr ""
     140
     141#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:45
     142#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:45
     143msgid "Any department"
     144msgstr ""
     145
     146#: lib/automatewoo/triggers/aw-trigger-order-department-changed.php:19
     147msgid "Order Department Changed"
     148msgstr ""
     149
     150#: lib/automatewoo/triggers/aw-trigger-order-department-changed.php:20
     151msgid "Triggers when order departments are modified in any way."
     152msgstr ""
     153
     154#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:20
     155msgid "Order Department Removed"
     156msgstr ""
     157
     158#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:21
     159msgid "Triggers when a department is removed from an order."
     160msgstr ""
     161
     162#: lib/automatewoo/variables/aw-variable-order-department-count.php:23
     163msgid "Displays the number of departments assigned to the order. Useful for conditional logic."
     164msgstr ""
     165
     166#: lib/automatewoo/variables/aw-variable-order-department-emails.php:26
     167msgid "Displays department email addresses with flexible access options. Use index for specific departments, \"all\" for all departments, or \"count\" for the number of departments."
     168msgstr ""
     169
     170#: lib/automatewoo/variables/aw-variable-order-department-emails.php:30
     171msgid "How to access the department emails."
     172msgstr ""
     173
     174#: lib/automatewoo/variables/aw-variable-order-department-emails.php:32
     175#: lib/automatewoo/variables/aw-variable-order-department-names.php:32
     176msgid "By Index (default)"
     177msgstr ""
     178
     179#: lib/automatewoo/variables/aw-variable-order-department-emails.php:33
     180#: lib/automatewoo/variables/aw-variable-order-department-names.php:33
     181msgid "All Departments"
     182msgstr ""
     183
     184#: lib/automatewoo/variables/aw-variable-order-department-emails.php:34
     185#: lib/automatewoo/variables/aw-variable-order-department-names.php:34
     186msgid "Count of Departments"
     187msgstr ""
     188
     189#: lib/automatewoo/variables/aw-variable-order-department-emails.php:41
     190#: lib/automatewoo/variables/aw-variable-order-department-names.php:41
     191msgid "The index of the department to retrieve (1-based). Default is 1 (first department). Only used when mode is \"index\"."
     192msgstr ""
     193
     194#: lib/automatewoo/variables/aw-variable-order-department-emails.php:48
     195#: lib/automatewoo/variables/aw-variable-order-departments-emails.php:28
     196msgid "The separator to use between email addresses. Default is \", \" (comma space). Use \";\" for semicolon separation."
     197msgstr ""
     198
     199#: lib/automatewoo/variables/aw-variable-order-department-emails.php:55
     200#: lib/automatewoo/variables/aw-variable-order-departments-emails.php:35
     201msgid "Text to add before each email address."
     202msgstr ""
     203
     204#: lib/automatewoo/variables/aw-variable-order-department-emails.php:62
     205#: lib/automatewoo/variables/aw-variable-order-departments-emails.php:42
     206msgid "Text to add after each email address."
     207msgstr ""
     208
     209#: lib/automatewoo/variables/aw-variable-order-department-names.php:26
     210msgid "Displays department names with flexible access options. Use index for specific departments, \"all\" for all departments, or \"count\" for the number of departments."
     211msgstr ""
     212
     213#: lib/automatewoo/variables/aw-variable-order-department-names.php:30
     214msgid "How to access the department names."
     215msgstr ""
     216
     217#: lib/automatewoo/variables/aw-variable-order-department-names.php:48
     218msgid "The separator to use between department names when mode is \"all\". Default is \", \" (comma space)."
     219msgstr ""
     220
     221#: lib/automatewoo/variables/aw-variable-order-department-names.php:55
     222#: lib/automatewoo/variables/aw-variable-order-departments-names.php:34
     223msgid "Text to add before each department name. Example: \"Dept: \" would turn \"Sales\" into \"Dept: Sales\"."
     224msgstr ""
     225
     226#: lib/automatewoo/variables/aw-variable-order-department-names.php:62
     227#: lib/automatewoo/variables/aw-variable-order-departments-names.php:41
     228msgid "Text to add after each department name. Example: \" Dept\" would turn \"Sales\" into \"Sales Dept\"."
     229msgstr ""
     230
     231#: lib/automatewoo/variables/aw-variable-order-departments-emails.php:24
     232msgid "Displays a list of all department email addresses assigned to the order. Useful for the \"To\" field in email actions."
     233msgstr ""
     234
     235#: lib/automatewoo/variables/aw-variable-order-departments-names.php:23
     236msgid "Displays a list of all department names assigned to the order."
     237msgstr ""
     238
     239#: lib/automatewoo/variables/aw-variable-order-departments-names.php:27
     240msgid "The separator to use between department names. Default is \", \" (comma space)."
     241msgstr ""
     242
     243#: lib/settings.php:33
     244msgid "Order Departments Settings"
     245msgstr ""
     246
     247#: lib/settings.php:34
     248msgid "Order Departments"
     249msgstr ""
     250
     251#: lib/settings.php:60
     252msgid "Customer Email Reply-To Settings"
     253msgstr ""
     254
     255#: lib/settings.php:68
     256msgid "Override Reply-To with Department Emails"
     257msgstr ""
     258
     259#: lib/settings.php:77
     260msgid "For Multi-Department Orders"
     261msgstr ""
     262
     263#. translators: %s: Link to WooCommerce email settings
     264#: lib/settings.php:150
     265#, php-format
     266msgid "Configure how customer email replies are routed based on order departments. When disabled, emails use the %s."
     267msgstr ""
     268
     269#: lib/settings.php:151
     270#: lib/settings.php:212
     271msgid "WooCommerce email settings"
     272msgstr ""
     273
     274#: lib/settings.php:168
     275msgid "Override reply-to with department email addresses"
     276msgstr ""
     277
     278#: lib/settings.php:171
     279msgid "When enabled, customer emails will use department email addresses in the reply-to field instead of the default WooCommerce setting."
     280msgstr ""
     281
     282#: lib/settings.php:186
     283msgid "Multi-Department Mode"
     284msgstr ""
     285
     286#: lib/settings.php:193
     287msgid "Use all department emails"
     288msgstr ""
     289
     290#: lib/settings.php:196
     291msgid "Add all unique department email addresses to the reply-to field. All departments will receive customer replies and need to coordinate who responds."
     292msgstr ""
     293
     294#: lib/settings.php:205
     295msgid "Skip override - fall back to WooCommerce default"
     296msgstr ""
     297
     298#. translators: %s: Link to WooCommerce email settings
     299#: lib/settings.php:211
     300#, php-format
     301msgid "Use the default reply-to address from %s instead of department emails when multiple unique email addresses are involved."
     302msgstr ""
     303
     304#: lib/settings.php:218
     305msgid "Note:"
     306msgstr ""
     307
     308#: lib/settings.php:219
     309msgid "Multi-department is determined by the number of unique email addresses, not the number of departments. If multiple departments share the same email address, they are treated as a single department."
    122310msgstr ""
    123311
     
    171359#. translators: %s: Product name
    172360#: lib/taxonomy.php:456
     361#, php-format
    173362msgid "First product: %s"
    174363msgstr ""
     
    176365#. translators: %d: Number of products
    177366#: lib/taxonomy.php:458
     367#, php-format
    178368msgid "%d product"
    179369msgid_plural "%d products"
    180370msgstr[0] ""
    181371msgstr[1] ""
    182 
    183 #: lib/triggers/aw-trigger-order-department-added.php:20
    184 msgid "Order Department Added"
    185 msgstr ""
    186 
    187 #: lib/triggers/aw-trigger-order-department-added.php:21
    188 msgid "Triggers when a department is added to an order."
    189 msgstr ""
    190 
    191 #: lib/triggers/aw-trigger-order-department-added.php:33
    192 #: lib/triggers/aw-trigger-order-department-removed.php:33
    193 msgid "Leave blank to trigger for any department."
    194 msgstr ""
    195 
    196 #: lib/triggers/aw-trigger-order-department-added.php:45
    197 #: lib/triggers/aw-trigger-order-department-removed.php:45
    198 msgid "Any department"
    199 msgstr ""
    200 
    201 #: lib/triggers/aw-trigger-order-department-changed.php:19
    202 msgid "Order Department Changed"
    203 msgstr ""
    204 
    205 #: lib/triggers/aw-trigger-order-department-changed.php:20
    206 msgid "Triggers when order departments are modified in any way."
    207 msgstr ""
    208 
    209 #: lib/triggers/aw-trigger-order-department-removed.php:20
    210 msgid "Order Department Removed"
    211 msgstr ""
    212 
    213 #: lib/triggers/aw-trigger-order-department-removed.php:21
    214 msgid "Triggers when a department is removed from an order."
    215 msgstr ""
    216 
    217 #: lib/variables/aw-variable-order-department-count.php:23
    218 msgid "Displays the number of departments assigned to the order. Useful for conditional logic."
    219 msgstr ""
    220 
    221 #: lib/variables/aw-variable-order-department-emails.php:26
    222 msgid "Displays department email addresses with flexible access options. Use index for specific departments, \"all\" for all departments, or \"count\" for the number of departments."
    223 msgstr ""
    224 
    225 #: lib/variables/aw-variable-order-department-emails.php:30
    226 msgid "How to access the department emails."
    227 msgstr ""
    228 
    229 #: lib/variables/aw-variable-order-department-emails.php:32
    230 #: lib/variables/aw-variable-order-department-names.php:32
    231 msgid "By Index (default)"
    232 msgstr ""
    233 
    234 #: lib/variables/aw-variable-order-department-emails.php:33
    235 #: lib/variables/aw-variable-order-department-names.php:33
    236 msgid "All Departments"
    237 msgstr ""
    238 
    239 #: lib/variables/aw-variable-order-department-emails.php:34
    240 #: lib/variables/aw-variable-order-department-names.php:34
    241 msgid "Count of Departments"
    242 msgstr ""
    243 
    244 #: lib/variables/aw-variable-order-department-emails.php:41
    245 #: lib/variables/aw-variable-order-department-names.php:41
    246 msgid "The index of the department to retrieve (1-based). Default is 1 (first department). Only used when mode is \"index\"."
    247 msgstr ""
    248 
    249 #: lib/variables/aw-variable-order-department-emails.php:48
    250 #: lib/variables/aw-variable-order-departments-emails.php:28
    251 msgid "The separator to use between email addresses. Default is \", \" (comma space). Use \";\" for semicolon separation."
    252 msgstr ""
    253 
    254 #: lib/variables/aw-variable-order-department-emails.php:55
    255 #: lib/variables/aw-variable-order-departments-emails.php:35
    256 msgid "Text to add before each email address."
    257 msgstr ""
    258 
    259 #: lib/variables/aw-variable-order-department-emails.php:62
    260 #: lib/variables/aw-variable-order-departments-emails.php:42
    261 msgid "Text to add after each email address."
    262 msgstr ""
    263 
    264 #: lib/variables/aw-variable-order-department-names.php:26
    265 msgid "Displays department names with flexible access options. Use index for specific departments, \"all\" for all departments, or \"count\" for the number of departments."
    266 msgstr ""
    267 
    268 #: lib/variables/aw-variable-order-department-names.php:30
    269 msgid "How to access the department names."
    270 msgstr ""
    271 
    272 #: lib/variables/aw-variable-order-department-names.php:48
    273 msgid "The separator to use between department names when mode is \"all\". Default is \", \" (comma space)."
    274 msgstr ""
    275 
    276 #: lib/variables/aw-variable-order-department-names.php:55
    277 #: lib/variables/aw-variable-order-departments-names.php:34
    278 msgid "Text to add before each department name. Example: \"Dept: \" would turn \"Sales\" into \"Dept: Sales\"."
    279 msgstr ""
    280 
    281 #: lib/variables/aw-variable-order-department-names.php:62
    282 #: lib/variables/aw-variable-order-departments-names.php:41
    283 msgid "Text to add after each department name. Example: \" Dept\" would turn \"Sales\" into \"Sales Dept\"."
    284 msgstr ""
    285 
    286 #: lib/variables/aw-variable-order-departments-emails.php:24
    287 msgid "Displays a list of all department email addresses assigned to the order. Useful for the \"To\" field in email actions."
    288 msgstr ""
    289 
    290 #: lib/variables/aw-variable-order-departments-names.php:23
    291 msgid "Displays a list of all department names assigned to the order."
    292 msgstr ""
    293 
    294 #: lib/variables/aw-variable-order-departments-names.php:27
    295 msgid "The separator to use between department names. Default is \", \" (comma space)."
    296 msgstr ""
  • runthings-wc-order-departments/tags/1.1.1/lib/automatewoo-integration.php

    r3318971 r3434381  
    2323        }
    2424
    25         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/actions/aw-action-set-order-department.php';
    26         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/actions/aw-action-add-order-department.php';
    27         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/actions/aw-action-remove-order-department.php';
    28         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/actions/aw-action-clear-order-departments.php';
     25        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/actions/aw-action-set-order-department.php';
     26        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/actions/aw-action-add-order-department.php';
     27        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/actions/aw-action-remove-order-department.php';
     28        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/actions/aw-action-clear-order-departments.php';
    2929
    3030        $actions['runthings_set_order_department'] = 'RunthingsWCOrderDepartments\Actions\Set_Order_Department';
     
    4545        }
    4646
    47         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/triggers/aw-trigger-order-department-added.php';
    48         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/triggers/aw-trigger-order-department-removed.php';
    49         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/triggers/aw-trigger-order-department-changed.php';
     47        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/triggers/aw-trigger-order-department-added.php';
     48        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/triggers/aw-trigger-order-department-removed.php';
     49        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/triggers/aw-trigger-order-department-changed.php';
    5050
    5151        $triggers['runthings_order_department_added'] = 'RunthingsWCOrderDepartments\Triggers\Order_Department_Added';
     
    6565        }
    6666
    67         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/rules/aw-rule-order-has-department.php';
    68         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/rules/aw-rule-order-department-count.php';
    69         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/rules/aw-rule-order-department-is.php';
     67        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/rules/aw-rule-order-has-department.php';
     68        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/rules/aw-rule-order-department-count.php';
     69        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/rules/aw-rule-order-department-is.php';
    7070
    7171        $rules['runthings_order_has_department'] = 'RunthingsWCOrderDepartments\Rules\Order_Has_Department';
     
    8585        }
    8686
    87         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-departments-names.php';
    88         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-departments-emails.php';
    89         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-department-names.php';
    90         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-department-emails.php';
    91         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-department-count.php';
     87        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-departments-names.php';
     88        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-departments-emails.php';
     89        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-department-names.php';
     90        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-department-emails.php';
     91        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-department-count.php';
    9292
    9393        // Add department variables to the order group
  • runthings-wc-order-departments/tags/1.1.1/lib/email-interceptor.php

    r3318971 r3434381  
    44
    55use RunthingsWCOrderDepartments\Utils\DepartmentMatcher;
     6use RunthingsWCOrderDepartments\Email\CustomerEmailInterceptor;
     7use RunthingsWCOrderDepartments\Email\AdminEmailInterceptor;
    68
    79if (!defined('WPINC')) {
     
    911}
    1012
     13// Include email interceptor classes
     14require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/email/customer-email-interceptor.php';
     15require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/email/admin-email-interceptor.php';
     16
     17/**
     18 * Manager class that coordinates customer and admin email interception
     19 */
    1120class EmailInterceptor
    1221{
    1322    private $department_matcher;
    1423
    15     public function __construct($taxonomy = 'order_department')
     24    private $settings;
     25
     26    private $customer_interceptor;
     27
     28    private $admin_interceptor;
     29
     30    public function __construct($taxonomy = 'order_department', $settings = null)
    1631    {
    1732        $this->department_matcher = new DepartmentMatcher($taxonomy);
     33        $this->settings = $settings;
    1834
    19         // Hook into WooCommerce email filters to modify recipients for admin notifications
    20         add_filter('woocommerce_email_recipient_new_order', [$this, 'modify_email_recipient'], 10, 2);
    21         add_filter('woocommerce_email_recipient_cancelled_order', [$this, 'modify_email_recipient'], 10, 2);
    22         add_filter('woocommerce_email_recipient_failed_order', [$this, 'modify_email_recipient'], 10, 2);
    23     }
    24    
    25     /**
    26      * Modify email recipients based on order department
    27      *
    28      * @param string $recipient Default recipient email(s)
    29      * @param \WC_Order $order Order object
    30      * @return string Modified recipient email(s)
    31      */
    32     public function modify_email_recipient($recipient, $order)
    33     {
    34         // Make sure we have a valid order
    35         if (!$order instanceof \WC_Order) {
    36             return $recipient;
    37         }
    38 
    39         // Get department recipients using the utility class
    40         $department_emails = $this->department_matcher->get_department_emails($order);
    41 
    42         // If department emails were found, use them instead
    43         if (!empty($department_emails)) {
    44             return $department_emails;
    45         }
    46 
    47         // Otherwise return the original recipient
    48         return $recipient;
     35        // Initialize specialized interceptors
     36        $this->customer_interceptor = new CustomerEmailInterceptor($this->department_matcher, $this->settings);
     37        $this->admin_interceptor = new AdminEmailInterceptor($this->department_matcher);
    4938    }
    5039}
  • runthings-wc-order-departments/tags/1.1.1/lib/utils/department-matcher.php

    r3318971 r3434381  
    1414{
    1515    private $taxonomy;
     16
    1617    private $meta_prefix = 'runthings_wc_od_';
    1718
     
    180181
    181182    /**
    182      * Get department email addresses for an order
     183     * Get unique department email addresses for an order
    183184     *
    184185     * @param \WC_Order $order Order object
    185      * @return string Email addresses separated by commas
    186      */
    187     public function get_department_emails($order)
     186     * @return array Array of clean, unique email addresses
     187     */
     188    public function get_unique_department_emails($order)
    188189    {
    189190        $matching_departments = $this->get_matching_departments($order);
    190        
     191
    191192        // Collect emails from all matching departments
    192193        $destination_emails = [];
    193        
     194
    194195        foreach ($matching_departments as $department) {
    195196            if (!empty($department['emails'])) {
     
    197198            }
    198199        }
    199        
    200         // Remove duplicates and filter out empty values
    201         $destination_emails = array_unique(array_filter($destination_emails));
    202        
    203         // Return comma-separated list of emails (WordPress email format)
    204         return implode(', ', $destination_emails);
     200
     201        // Clean emails: trim whitespace, remove newlines, validate and filter
     202        $clean_emails = [];
     203        foreach ($destination_emails as $email) {
     204            $clean_email = trim(str_replace(["\r", "\n", "\t"], '', $email));
     205            if (!empty($clean_email) && filter_var($clean_email, FILTER_VALIDATE_EMAIL)) {
     206                $clean_emails[] = $clean_email;
     207            }
     208        }
     209
     210        // Remove duplicates and return
     211        return array_unique($clean_emails);
    205212    }
    206213
  • runthings-wc-order-departments/tags/1.1.1/readme.md

    r3318971 r3434381  
    2626
    27271. **Department Taxonomy Management Screen** - Main interface for managing departments, viewing assigned orders, and configuring department settings.
    28    ![Department Management](screenshot-1.png)
     28   ![Department Management](https://raw.githubusercontent.com/runthings-dev/runthings-wc-order-departments/master/.wordpress-org/screenshot-1.png)
    2929
    30302. **Custom Department Menus** - Quick access menus in WooCommerce admin for filtering orders by department.
    31    ![Department Menus](screenshot-2.png)
     31   ![Department Menus](https://raw.githubusercontent.com/runthings-dev/runthings-wc-order-departments/master/.wordpress-org/screenshot-2.png)
    3232
    33333. **Department Meta Box on Order Screen** - View and manage department assignments directly from individual order pages.
    34    ![Order Department Meta Box](screenshot-3.png)
     34   ![Order Department Meta Box](https://raw.githubusercontent.com/runthings-dev/runthings-wc-order-departments/master/.wordpress-org/screenshot-3.png)
    3535
    36364. **Edit Department Screen** - Configure department email addresses, product categories, and specific product assignments.
    37    ![Edit Department](screenshot-4.png)
     37   ![Edit Department](https://raw.githubusercontent.com/runthings-dev/runthings-wc-order-departments/master/.wordpress-org/screenshot-4.png)
    3838
    3939## AutomateWoo Integration
     
    109109- **`{{ order.department_emails | separator: '; ' }}`** → Multiple emails separated by semicolon
    110110
    111 ## Use Cases
     111#### Variable Use Cases
    112112
    113113- **Sales & Technical Support**: Route orders containing software to Technical, hardware to Sales
     
    129129  - Pass `{{ order.departments_names }}` to CRM systems for proper lead assignment
    130130  - Use `{{ order.departments_emails }}` for automated follow-up sequences
     131
     132## Developer Filters
     133
     134The plugin provides filters to customize email handling behavior:
     135
     136### Email ID Filters
     137
     138**`runthings_wc_order_departments_customer_email_ids`**
     139
     140Customize which customer-facing email IDs have their reply-to headers modified by department emails.
     141
     142```php
     143add_filter('runthings_wc_order_departments_customer_email_ids', function($email_ids) {
     144    // Add custom customer email ID
     145    $email_ids[] = 'custom_customer_email';
     146
     147    // Remove an email ID if you don't want it modified
     148    $key = array_search('customer_new_account', $email_ids);
     149    if ($key !== false) {
     150        unset($email_ids[$key]);
     151    }
     152
     153    return $email_ids;
     154});
     155```
     156
     157**Default customer email IDs**: `customer_completed_order`, `customer_cancelled_order`, `customer_failed_order`, `customer_on_hold_order`, `customer_invoice`, `customer_note`, `customer_refunded_order`, `customer_processing_order`, `customer_new_account`, `customer_reset_password`
     158
     159**`runthings_wc_order_departments_admin_email_ids`**
     160
     161Customize which admin-facing email IDs have their recipients modified to use department emails.
     162
     163```php
     164add_filter('runthings_wc_order_departments_admin_email_ids', function($email_ids) {
     165    // Add custom admin email ID
     166    $email_ids[] = 'custom_admin_notification';
     167
     168    // Remove an email ID if you don't want it modified
     169    $key = array_search('backorder', $email_ids);
     170    if ($key !== false) {
     171        unset($email_ids[$key]);
     172    }
     173
     174    return $email_ids;
     175});
     176```
     177
     178**Default admin email IDs**: `new_order`, `cancelled_order`, `failed_order`, `backorder`
     179
     180### Use Cases for Email Filters
     181
     182- **Custom Email Types**: Add support for emails from other plugins or custom implementations
     183- **Selective Email Routing**: Exclude specific email types from department-based routing
     184- **Third-party Integration**: Ensure compatibility with other email-related plugins
    131185
    132186## Installation
     
    151205### Email Routing
    152206
    153 **Important**: Email routing behavior depends on whether the order's assigned departments have email addresses configured:
    154 
    155 - **If the order's assigned departments have email addresses**: The plugin will override WooCommerce admin emails and send them to the department's email addresses instead
     207The plugin provides two types of email routing:
     208
     209#### Admin Email Routing
     210
     211**Admin emails** (new order notifications, etc.) are automatically routed to department email addresses when departments are assigned to orders.
     212
     213#### Customer Email Reply-To Override
     214
     215**Customer emails** can have their reply-to headers modified based on department assignments. Configure this at **Settings > Order Departments**:
     216
     217- **Override reply-to with department emails**: Enable/disable the reply-to override feature
     218- **For multi-department orders**: Choose behavior when multiple unique email addresses are involved:
     219  - **Use all department emails**: Add all unique department emails to reply-to header
     220  - **Skip override - fall back to WooCommerce default**: Use WooCommerce's default reply-to setting
     221
     222**Email routing behavior**:
     223
     224- **Single department orders**: Always use that department's email for reply-to (when override enabled)
     225- **Multi-department orders with same email**: Treated as single department
     226- **Multi-department orders with different emails**: Behavior depends on settings choice
    156227- **If the order's assigned departments have NO email addresses**: The plugin does not attempt to override emails and WooCommerce emails work normally
    157228- **If WooCommerce emails are disabled**: No emails will be sent regardless of department email configuration
     
    210281## Changelog
    211282
     283### 1.1.1 - 7th January 2026
     284
     285- Bump tested up to 6.9
     286
     287### 1.1.0 - 31st July 2025
     288
     289- **New Feature**: Customer email reply-to override system
     290  - Configure reply-to behavior for customer emails based on department assignments
     291  - Settings page at Settings > Order Departments with override toggle and multi-department handling options
     292  - Single department orders always use department email for reply-to
     293  - Multi-department orders can use all department emails or fall back to WooCommerce default
     294- **New Feature**: Email customization filters
     295  - `runthings_wc_order_departments_customer_email_ids` filter to customize which customer emails are modified
     296  - `runthings_wc_order_departments_admin_email_ids` filter to customize which admin emails are modified
     297- **Improvement**: Refactored email system with separate CustomerEmailInterceptor and AdminEmailInterceptor classes
     298- **Improvement**: Enhanced email address validation and cleaning using PHP's filter_var()
     299- **Improvement**: Robust email header manipulation with proper newline handling
     300
     301### 1.0.1 - 27th June 2025
     302
     303- WordPress Plugin Directory release
     304- Update contributors meta in readme.txt to match username
     305
    212306### 1.0.0 - 17th June 2025
    213307
  • runthings-wc-order-departments/tags/1.1.1/readme.txt

    r3318971 r3434381  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.1
     7Stable tag: 1.1.1
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    9797* `{{ order.department_emails | separator: '; ' }}` → Multiple emails separated by semicolon
    9898
    99 = Use Cases =
     99= Variable Use Cases =
    100100
    101101* **Sales & Technical Support**: Route orders containing software to Technical, hardware to Sales
     
    114114  * Pass `{{ order.departments_names }}` to CRM systems for proper lead assignment
    115115  * Use `{{ order.departments_emails }}` for automated follow-up sequences
     116
     117== Developer Filters ==
     118
     119The plugin provides filters to customize email handling behavior:
     120
     121= Email ID Filters =
     122
     123**runthings_wc_order_departments_customer_email_ids**
     124
     125Customize which customer-facing email IDs have their reply-to headers modified by department emails.
     126
     127`add_filter('runthings_wc_order_departments_customer_email_ids', function($email_ids) { // Add custom customer email ID $email_ids[] = 'custom_customer_email'; // Remove an email ID if you don't want it modified $key = array_search('customer_new_account', $email_ids); if ($key !== false) { unset($email_ids[$key]); } return $email_ids; });`
     128
     129**Default customer email IDs**: `customer_completed_order`, `customer_cancelled_order`, `customer_failed_order`, `customer_on_hold_order`, `customer_invoice`, `customer_note`, `customer_refunded_order`, `customer_processing_order`, `customer_new_account`, `customer_reset_password`
     130
     131**runthings_wc_order_departments_admin_email_ids**
     132
     133Customize which admin-facing email IDs have their recipients modified to use department emails.
     134
     135`add_filter('runthings_wc_order_departments_admin_email_ids', function($email_ids) { // Add custom admin email ID $email_ids[] = 'custom_admin_notification'; // Remove an email ID if you don't want it modified $key = array_search('backorder', $email_ids); if ($key !== false) { unset($email_ids[$key]); } return $email_ids; });`
     136
     137**Default admin email IDs**: `new_order`, `cancelled_order`, `failed_order`, `backorder`
     138
     139= Use Cases for Email Filters =
     140
     141* **Custom Email Types**: Add support for emails from other plugins or custom implementations
     142* **Selective Email Routing**: Exclude specific email types from department-based routing
     143* **Third-party Integration**: Ensure compatibility with other email-related plugins
    116144
    117145== Installation ==
     
    136164= Email Routing =
    137165
    138 **Important**: Email routing behavior depends on whether the order's assigned departments have email addresses configured:
    139 
    140 * **If the order's assigned departments have email addresses**: The plugin will override WooCommerce admin emails and send them to the department's email addresses instead
     166The plugin provides two types of email routing:
     167
     168= Admin Email Routing =
     169
     170**Admin emails** (new order notifications, etc.) are automatically routed to department email addresses when departments are assigned to orders.
     171
     172= Customer Email Reply-To Override =
     173
     174**Customer emails** can have their reply-to headers modified based on department assignments. Configure this at **Settings > Order Departments**:
     175
     176* **Override reply-to with department emails**: Enable/disable the reply-to override feature
     177* **For multi-department orders**: Choose behavior when multiple unique email addresses are involved:
     178  * **Use all department emails**: Add all unique department emails to reply-to header
     179  * **Skip override - fall back to WooCommerce default**: Use WooCommerce's default reply-to setting
     180
     181**Email routing behavior**:
     182
     183* **Single department orders**: Always use that department's email for reply-to (when override enabled)
     184* **Multi-department orders with same email**: Treated as single department
     185* **Multi-department orders with different emails**: Behavior depends on settings choice
    141186* **If the order's assigned departments have NO email addresses**: The plugin does not attempt to override emails and WooCommerce emails work normally
    142187* **If WooCommerce emails are disabled**: No emails will be sent regardless of department email configuration
     
    201246
    202247== Changelog ==
     248
     249= 1.1.1 - 7th January 2026 =
     250* Bump tested up to 6.9
     251
     252= 1.1.0 - 31st July 2025 =
     253* **New Feature**: Customer email reply-to override system
     254  * Configure reply-to behavior for customer emails based on department assignments
     255  * Settings page at Settings > Order Departments with override toggle and multi-department handling options
     256  * Single department orders always use department email for reply-to
     257  * Multi-department orders can use all department emails or fall back to WooCommerce default
     258* **New Feature**: Email customization filters
     259  * `runthings_wc_order_departments_customer_email_ids` filter to customize which customer emails are modified
     260  * `runthings_wc_order_departments_admin_email_ids` filter to customize which admin emails are modified
     261* **Improvement**: Refactored email system with separate CustomerEmailInterceptor and AdminEmailInterceptor classes
     262* **Improvement**: Enhanced email address validation and cleaning using PHP's filter_var()
     263* **Improvement**: Robust email header manipulation with proper newline handling
    203264
    204265= 1.0.1 - 27th June 2025 =
     
    235296== Upgrade Notice ==
    236297
     298= 1.1.1 =
     299Bump tested up to 6.9
     300
     301= 1.1.0 =
     302Major update with customer email reply-to override system and new settings page. Configure reply-to behavior for customer emails based on department assignments. Includes new developer filters for email customization.
     303
    237304= 1.0.1 =
    238305Initial release of plugin on WordPress Plugin Directory. Fixed readme.txt contributors meta.
    239 
    240 = 1.0.0 =
    241 Initial release of Order Departments for WooCommerce plugin.
  • runthings-wc-order-departments/tags/1.1.1/runthings-wc-order-departments.php

    r3318971 r3434381  
    55 * Plugin URI: https://runthings.dev/wordpress-plugins/runthings-wc-order-departments/
    66 * Description: Split WooCommerce orders by departments, with AutomateWoo support
    7  * Version: 1.0.1
     7 * Version: 1.1.1
    88 * Author: runthingsdev
    99 * Author URI: https://runthings.dev/
    1010 * Requires at least: 6.3
    11  * Tested up to: 6.8
     11 * Tested up to: 6.9
    1212 * Requires PHP: 7.4
    1313 * Requires Plugins: woocommerce
    1414 * WC requires at least: 8.2
    15  * WC tested up to: 9.9
    1615 * Text Domain: runthings-wc-order-departments
    1716 * Domain Path: /languages
     
    4241}
    4342
    44 define('RUNTHINGS_WC_ORDER_DEPARTMENTS_VERSION', '1.0.1');
     43define('RUNTHINGS_WC_ORDER_DEPARTMENTS_VERSION', '1.1.1');
    4544define('RUNTHINGS_WC_ORDER_DEPARTMENTS_URL', plugin_dir_url(__FILE__));
    4645define('RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR', plugin_dir_path(__FILE__));
     
    5150require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/order-department-assigner.php';
    5251require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo-integration.php';
     52require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/settings.php';
    5353
    5454class RunthingsWCOrderDepartments
     
    5656    public $taxonomy = 'order_department';
    5757
     58    private $settings;
     59
    5860    public function __construct()
    5961    {
     
    6567        add_action('admin_menu', [$this, 'add_departments_management_menu'], 99);
    6668
     69        // Initialize settings first
     70        $this->settings = new Settings();
     71
     72        // Initialize other components, passing settings where needed
    6773        new Taxonomy($this->taxonomy);
    68         new EmailInterceptor($this->taxonomy);
     74        new EmailInterceptor($this->taxonomy, $this->settings);
    6975        new OrderDepartmentAssigner($this->taxonomy);
    7076        new AutomateWooIntegration();
  • runthings-wc-order-departments/trunk/languages/runthings-wc-order-departments.pot

    r3318971 r3434381  
    1 # Copyright (C) 2025 runthingsdev
     1# Copyright (C) 2026 runthingsdev
    22# This file is distributed under the GPLv3 or later.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Order Departments for WooCommerce 1.0.1\n"
     5"Project-Id-Version: Order Departments for WooCommerce 1.1.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/runthings-wc-order-departments\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-06-27T20:54:36+00:00\n"
     12"POT-Creation-Date: 2026-01-07T13:27:40+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.11.0\n"
     14"X-Generator: WP-CLI 2.12.0\n"
    1515"X-Domain: runthings-wc-order-departments\n"
    1616
     
    4040msgstr ""
    4141
    42 #: lib/actions/aw-action-add-order-department.php:20
     42#: lib/automatewoo/actions/aw-action-add-order-department.php:20
    4343msgid "Add Order Department"
    4444msgstr ""
    4545
    46 #: lib/actions/aw-action-add-order-department.php:21
     46#: lib/automatewoo/actions/aw-action-add-order-department.php:21
    4747msgid "Add a department to the order (keeps existing departments)."
    4848msgstr ""
    4949
    50 #: lib/actions/aw-action-add-order-department.php:22
    51 #: lib/actions/aw-action-clear-order-departments.php:21
    52 #: lib/actions/aw-action-remove-order-department.php:22
    53 #: lib/actions/aw-action-set-order-department.php:22
    54 #: lib/triggers/aw-trigger-order-department-added.php:22
    55 #: lib/triggers/aw-trigger-order-department-changed.php:21
    56 #: lib/triggers/aw-trigger-order-department-removed.php:22
     50#: lib/automatewoo/actions/aw-action-add-order-department.php:22
     51#: lib/automatewoo/actions/aw-action-clear-order-departments.php:21
     52#: lib/automatewoo/actions/aw-action-remove-order-department.php:22
     53#: lib/automatewoo/actions/aw-action-set-order-department.php:22
     54#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:22
     55#: lib/automatewoo/triggers/aw-trigger-order-department-changed.php:21
     56#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:22
    5757msgid "Order"
    5858msgstr ""
    5959
    60 #: lib/actions/aw-action-add-order-department.php:32
    61 #: lib/actions/aw-action-remove-order-department.php:32
    62 #: lib/actions/aw-action-set-order-department.php:32
    63 #: lib/triggers/aw-trigger-order-department-added.php:32
    64 #: lib/triggers/aw-trigger-order-department-removed.php:32
     60#: lib/automatewoo/actions/aw-action-add-order-department.php:32
     61#: lib/automatewoo/actions/aw-action-remove-order-department.php:32
     62#: lib/automatewoo/actions/aw-action-set-order-department.php:32
     63#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:32
     64#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:32
    6565msgid "Department"
    6666msgstr ""
    6767
    6868#. translators: %1$s: Workflow ID, %2$s: Department name
    69 #: lib/actions/aw-action-add-order-department.php:89
     69#: lib/automatewoo/actions/aw-action-add-order-department.php:89
     70#, php-format
    7071msgid "[AutomateWoo] Workflow #%1$s added department: %2$s"
    7172msgstr ""
    7273
    73 #: lib/actions/aw-action-clear-order-departments.php:19
     74#: lib/automatewoo/actions/aw-action-clear-order-departments.php:19
    7475msgid "Clear Order Departments"
    7576msgstr ""
    7677
    77 #: lib/actions/aw-action-clear-order-departments.php:20
     78#: lib/automatewoo/actions/aw-action-clear-order-departments.php:20
    7879msgid "Remove all departments from the order."
    7980msgstr ""
    8081
    8182#. translators: %s: Workflow ID
    82 #: lib/actions/aw-action-clear-order-departments.php:50
     83#: lib/automatewoo/actions/aw-action-clear-order-departments.php:50
     84#, php-format
    8385msgid "[AutomateWoo] Workflow #%s cleared all departments"
    8486msgstr ""
    8587
    86 #: lib/actions/aw-action-remove-order-department.php:20
     88#: lib/automatewoo/actions/aw-action-remove-order-department.php:20
    8789msgid "Remove Order Department"
    8890msgstr ""
    8991
    90 #: lib/actions/aw-action-remove-order-department.php:21
     92#: lib/automatewoo/actions/aw-action-remove-order-department.php:21
    9193msgid "Remove a department from the order."
    9294msgstr ""
    9395
    9496#. translators: %1$s: Workflow ID, %2$s: Department name
    95 #: lib/actions/aw-action-remove-order-department.php:89
     97#: lib/automatewoo/actions/aw-action-remove-order-department.php:89
     98#, php-format
    9699msgid "[AutomateWoo] Workflow #%1$s removed department: %2$s"
    97100msgstr ""
    98101
    99 #: lib/actions/aw-action-set-order-department.php:20
     102#: lib/automatewoo/actions/aw-action-set-order-department.php:20
    100103msgid "Set Order Department"
    101104msgstr ""
    102105
    103 #: lib/actions/aw-action-set-order-department.php:21
     106#: lib/automatewoo/actions/aw-action-set-order-department.php:21
    104107msgid "Set a department for the order (replaces all existing departments)."
    105108msgstr ""
    106109
    107110#. translators: %1$s: Workflow ID, %2$s: Department name
    108 #: lib/actions/aw-action-set-order-department.php:89
     111#: lib/automatewoo/actions/aw-action-set-order-department.php:89
     112#, php-format
    109113msgid "[AutomateWoo] Workflow #%1$s set department to: %2$s"
    110114msgstr ""
    111115
    112 #: lib/rules/aw-rule-order-department-count.php:22
     116#: lib/automatewoo/rules/aw-rule-order-department-count.php:22
    113117msgid "Order - Department Count"
    114118msgstr ""
    115119
    116 #: lib/rules/aw-rule-order-department-is.php:22
     120#: lib/automatewoo/rules/aw-rule-order-department-is.php:22
    117121msgid "Order - Department Is"
    118122msgstr ""
    119123
    120 #: lib/rules/aw-rule-order-has-department.php:22
     124#: lib/automatewoo/rules/aw-rule-order-has-department.php:22
    121125msgid "Order - Has Department"
     126msgstr ""
     127
     128#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:20
     129msgid "Order Department Added"
     130msgstr ""
     131
     132#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:21
     133msgid "Triggers when a department is added to an order."
     134msgstr ""
     135
     136#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:33
     137#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:33
     138msgid "Leave blank to trigger for any department."
     139msgstr ""
     140
     141#: lib/automatewoo/triggers/aw-trigger-order-department-added.php:45
     142#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:45
     143msgid "Any department"
     144msgstr ""
     145
     146#: lib/automatewoo/triggers/aw-trigger-order-department-changed.php:19
     147msgid "Order Department Changed"
     148msgstr ""
     149
     150#: lib/automatewoo/triggers/aw-trigger-order-department-changed.php:20
     151msgid "Triggers when order departments are modified in any way."
     152msgstr ""
     153
     154#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:20
     155msgid "Order Department Removed"
     156msgstr ""
     157
     158#: lib/automatewoo/triggers/aw-trigger-order-department-removed.php:21
     159msgid "Triggers when a department is removed from an order."
     160msgstr ""
     161
     162#: lib/automatewoo/variables/aw-variable-order-department-count.php:23
     163msgid "Displays the number of departments assigned to the order. Useful for conditional logic."
     164msgstr ""
     165
     166#: lib/automatewoo/variables/aw-variable-order-department-emails.php:26
     167msgid "Displays department email addresses with flexible access options. Use index for specific departments, \"all\" for all departments, or \"count\" for the number of departments."
     168msgstr ""
     169
     170#: lib/automatewoo/variables/aw-variable-order-department-emails.php:30
     171msgid "How to access the department emails."
     172msgstr ""
     173
     174#: lib/automatewoo/variables/aw-variable-order-department-emails.php:32
     175#: lib/automatewoo/variables/aw-variable-order-department-names.php:32
     176msgid "By Index (default)"
     177msgstr ""
     178
     179#: lib/automatewoo/variables/aw-variable-order-department-emails.php:33
     180#: lib/automatewoo/variables/aw-variable-order-department-names.php:33
     181msgid "All Departments"
     182msgstr ""
     183
     184#: lib/automatewoo/variables/aw-variable-order-department-emails.php:34
     185#: lib/automatewoo/variables/aw-variable-order-department-names.php:34
     186msgid "Count of Departments"
     187msgstr ""
     188
     189#: lib/automatewoo/variables/aw-variable-order-department-emails.php:41
     190#: lib/automatewoo/variables/aw-variable-order-department-names.php:41
     191msgid "The index of the department to retrieve (1-based). Default is 1 (first department). Only used when mode is \"index\"."
     192msgstr ""
     193
     194#: lib/automatewoo/variables/aw-variable-order-department-emails.php:48
     195#: lib/automatewoo/variables/aw-variable-order-departments-emails.php:28
     196msgid "The separator to use between email addresses. Default is \", \" (comma space). Use \";\" for semicolon separation."
     197msgstr ""
     198
     199#: lib/automatewoo/variables/aw-variable-order-department-emails.php:55
     200#: lib/automatewoo/variables/aw-variable-order-departments-emails.php:35
     201msgid "Text to add before each email address."
     202msgstr ""
     203
     204#: lib/automatewoo/variables/aw-variable-order-department-emails.php:62
     205#: lib/automatewoo/variables/aw-variable-order-departments-emails.php:42
     206msgid "Text to add after each email address."
     207msgstr ""
     208
     209#: lib/automatewoo/variables/aw-variable-order-department-names.php:26
     210msgid "Displays department names with flexible access options. Use index for specific departments, \"all\" for all departments, or \"count\" for the number of departments."
     211msgstr ""
     212
     213#: lib/automatewoo/variables/aw-variable-order-department-names.php:30
     214msgid "How to access the department names."
     215msgstr ""
     216
     217#: lib/automatewoo/variables/aw-variable-order-department-names.php:48
     218msgid "The separator to use between department names when mode is \"all\". Default is \", \" (comma space)."
     219msgstr ""
     220
     221#: lib/automatewoo/variables/aw-variable-order-department-names.php:55
     222#: lib/automatewoo/variables/aw-variable-order-departments-names.php:34
     223msgid "Text to add before each department name. Example: \"Dept: \" would turn \"Sales\" into \"Dept: Sales\"."
     224msgstr ""
     225
     226#: lib/automatewoo/variables/aw-variable-order-department-names.php:62
     227#: lib/automatewoo/variables/aw-variable-order-departments-names.php:41
     228msgid "Text to add after each department name. Example: \" Dept\" would turn \"Sales\" into \"Sales Dept\"."
     229msgstr ""
     230
     231#: lib/automatewoo/variables/aw-variable-order-departments-emails.php:24
     232msgid "Displays a list of all department email addresses assigned to the order. Useful for the \"To\" field in email actions."
     233msgstr ""
     234
     235#: lib/automatewoo/variables/aw-variable-order-departments-names.php:23
     236msgid "Displays a list of all department names assigned to the order."
     237msgstr ""
     238
     239#: lib/automatewoo/variables/aw-variable-order-departments-names.php:27
     240msgid "The separator to use between department names. Default is \", \" (comma space)."
     241msgstr ""
     242
     243#: lib/settings.php:33
     244msgid "Order Departments Settings"
     245msgstr ""
     246
     247#: lib/settings.php:34
     248msgid "Order Departments"
     249msgstr ""
     250
     251#: lib/settings.php:60
     252msgid "Customer Email Reply-To Settings"
     253msgstr ""
     254
     255#: lib/settings.php:68
     256msgid "Override Reply-To with Department Emails"
     257msgstr ""
     258
     259#: lib/settings.php:77
     260msgid "For Multi-Department Orders"
     261msgstr ""
     262
     263#. translators: %s: Link to WooCommerce email settings
     264#: lib/settings.php:150
     265#, php-format
     266msgid "Configure how customer email replies are routed based on order departments. When disabled, emails use the %s."
     267msgstr ""
     268
     269#: lib/settings.php:151
     270#: lib/settings.php:212
     271msgid "WooCommerce email settings"
     272msgstr ""
     273
     274#: lib/settings.php:168
     275msgid "Override reply-to with department email addresses"
     276msgstr ""
     277
     278#: lib/settings.php:171
     279msgid "When enabled, customer emails will use department email addresses in the reply-to field instead of the default WooCommerce setting."
     280msgstr ""
     281
     282#: lib/settings.php:186
     283msgid "Multi-Department Mode"
     284msgstr ""
     285
     286#: lib/settings.php:193
     287msgid "Use all department emails"
     288msgstr ""
     289
     290#: lib/settings.php:196
     291msgid "Add all unique department email addresses to the reply-to field. All departments will receive customer replies and need to coordinate who responds."
     292msgstr ""
     293
     294#: lib/settings.php:205
     295msgid "Skip override - fall back to WooCommerce default"
     296msgstr ""
     297
     298#. translators: %s: Link to WooCommerce email settings
     299#: lib/settings.php:211
     300#, php-format
     301msgid "Use the default reply-to address from %s instead of department emails when multiple unique email addresses are involved."
     302msgstr ""
     303
     304#: lib/settings.php:218
     305msgid "Note:"
     306msgstr ""
     307
     308#: lib/settings.php:219
     309msgid "Multi-department is determined by the number of unique email addresses, not the number of departments. If multiple departments share the same email address, they are treated as a single department."
    122310msgstr ""
    123311
     
    171359#. translators: %s: Product name
    172360#: lib/taxonomy.php:456
     361#, php-format
    173362msgid "First product: %s"
    174363msgstr ""
     
    176365#. translators: %d: Number of products
    177366#: lib/taxonomy.php:458
     367#, php-format
    178368msgid "%d product"
    179369msgid_plural "%d products"
    180370msgstr[0] ""
    181371msgstr[1] ""
    182 
    183 #: lib/triggers/aw-trigger-order-department-added.php:20
    184 msgid "Order Department Added"
    185 msgstr ""
    186 
    187 #: lib/triggers/aw-trigger-order-department-added.php:21
    188 msgid "Triggers when a department is added to an order."
    189 msgstr ""
    190 
    191 #: lib/triggers/aw-trigger-order-department-added.php:33
    192 #: lib/triggers/aw-trigger-order-department-removed.php:33
    193 msgid "Leave blank to trigger for any department."
    194 msgstr ""
    195 
    196 #: lib/triggers/aw-trigger-order-department-added.php:45
    197 #: lib/triggers/aw-trigger-order-department-removed.php:45
    198 msgid "Any department"
    199 msgstr ""
    200 
    201 #: lib/triggers/aw-trigger-order-department-changed.php:19
    202 msgid "Order Department Changed"
    203 msgstr ""
    204 
    205 #: lib/triggers/aw-trigger-order-department-changed.php:20
    206 msgid "Triggers when order departments are modified in any way."
    207 msgstr ""
    208 
    209 #: lib/triggers/aw-trigger-order-department-removed.php:20
    210 msgid "Order Department Removed"
    211 msgstr ""
    212 
    213 #: lib/triggers/aw-trigger-order-department-removed.php:21
    214 msgid "Triggers when a department is removed from an order."
    215 msgstr ""
    216 
    217 #: lib/variables/aw-variable-order-department-count.php:23
    218 msgid "Displays the number of departments assigned to the order. Useful for conditional logic."
    219 msgstr ""
    220 
    221 #: lib/variables/aw-variable-order-department-emails.php:26
    222 msgid "Displays department email addresses with flexible access options. Use index for specific departments, \"all\" for all departments, or \"count\" for the number of departments."
    223 msgstr ""
    224 
    225 #: lib/variables/aw-variable-order-department-emails.php:30
    226 msgid "How to access the department emails."
    227 msgstr ""
    228 
    229 #: lib/variables/aw-variable-order-department-emails.php:32
    230 #: lib/variables/aw-variable-order-department-names.php:32
    231 msgid "By Index (default)"
    232 msgstr ""
    233 
    234 #: lib/variables/aw-variable-order-department-emails.php:33
    235 #: lib/variables/aw-variable-order-department-names.php:33
    236 msgid "All Departments"
    237 msgstr ""
    238 
    239 #: lib/variables/aw-variable-order-department-emails.php:34
    240 #: lib/variables/aw-variable-order-department-names.php:34
    241 msgid "Count of Departments"
    242 msgstr ""
    243 
    244 #: lib/variables/aw-variable-order-department-emails.php:41
    245 #: lib/variables/aw-variable-order-department-names.php:41
    246 msgid "The index of the department to retrieve (1-based). Default is 1 (first department). Only used when mode is \"index\"."
    247 msgstr ""
    248 
    249 #: lib/variables/aw-variable-order-department-emails.php:48
    250 #: lib/variables/aw-variable-order-departments-emails.php:28
    251 msgid "The separator to use between email addresses. Default is \", \" (comma space). Use \";\" for semicolon separation."
    252 msgstr ""
    253 
    254 #: lib/variables/aw-variable-order-department-emails.php:55
    255 #: lib/variables/aw-variable-order-departments-emails.php:35
    256 msgid "Text to add before each email address."
    257 msgstr ""
    258 
    259 #: lib/variables/aw-variable-order-department-emails.php:62
    260 #: lib/variables/aw-variable-order-departments-emails.php:42
    261 msgid "Text to add after each email address."
    262 msgstr ""
    263 
    264 #: lib/variables/aw-variable-order-department-names.php:26
    265 msgid "Displays department names with flexible access options. Use index for specific departments, \"all\" for all departments, or \"count\" for the number of departments."
    266 msgstr ""
    267 
    268 #: lib/variables/aw-variable-order-department-names.php:30
    269 msgid "How to access the department names."
    270 msgstr ""
    271 
    272 #: lib/variables/aw-variable-order-department-names.php:48
    273 msgid "The separator to use between department names when mode is \"all\". Default is \", \" (comma space)."
    274 msgstr ""
    275 
    276 #: lib/variables/aw-variable-order-department-names.php:55
    277 #: lib/variables/aw-variable-order-departments-names.php:34
    278 msgid "Text to add before each department name. Example: \"Dept: \" would turn \"Sales\" into \"Dept: Sales\"."
    279 msgstr ""
    280 
    281 #: lib/variables/aw-variable-order-department-names.php:62
    282 #: lib/variables/aw-variable-order-departments-names.php:41
    283 msgid "Text to add after each department name. Example: \" Dept\" would turn \"Sales\" into \"Sales Dept\"."
    284 msgstr ""
    285 
    286 #: lib/variables/aw-variable-order-departments-emails.php:24
    287 msgid "Displays a list of all department email addresses assigned to the order. Useful for the \"To\" field in email actions."
    288 msgstr ""
    289 
    290 #: lib/variables/aw-variable-order-departments-names.php:23
    291 msgid "Displays a list of all department names assigned to the order."
    292 msgstr ""
    293 
    294 #: lib/variables/aw-variable-order-departments-names.php:27
    295 msgid "The separator to use between department names. Default is \", \" (comma space)."
    296 msgstr ""
  • runthings-wc-order-departments/trunk/lib/automatewoo-integration.php

    r3318971 r3434381  
    2323        }
    2424
    25         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/actions/aw-action-set-order-department.php';
    26         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/actions/aw-action-add-order-department.php';
    27         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/actions/aw-action-remove-order-department.php';
    28         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/actions/aw-action-clear-order-departments.php';
     25        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/actions/aw-action-set-order-department.php';
     26        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/actions/aw-action-add-order-department.php';
     27        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/actions/aw-action-remove-order-department.php';
     28        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/actions/aw-action-clear-order-departments.php';
    2929
    3030        $actions['runthings_set_order_department'] = 'RunthingsWCOrderDepartments\Actions\Set_Order_Department';
     
    4545        }
    4646
    47         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/triggers/aw-trigger-order-department-added.php';
    48         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/triggers/aw-trigger-order-department-removed.php';
    49         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/triggers/aw-trigger-order-department-changed.php';
     47        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/triggers/aw-trigger-order-department-added.php';
     48        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/triggers/aw-trigger-order-department-removed.php';
     49        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/triggers/aw-trigger-order-department-changed.php';
    5050
    5151        $triggers['runthings_order_department_added'] = 'RunthingsWCOrderDepartments\Triggers\Order_Department_Added';
     
    6565        }
    6666
    67         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/rules/aw-rule-order-has-department.php';
    68         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/rules/aw-rule-order-department-count.php';
    69         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/rules/aw-rule-order-department-is.php';
     67        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/rules/aw-rule-order-has-department.php';
     68        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/rules/aw-rule-order-department-count.php';
     69        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/rules/aw-rule-order-department-is.php';
    7070
    7171        $rules['runthings_order_has_department'] = 'RunthingsWCOrderDepartments\Rules\Order_Has_Department';
     
    8585        }
    8686
    87         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-departments-names.php';
    88         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-departments-emails.php';
    89         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-department-names.php';
    90         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-department-emails.php';
    91         require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/variables/aw-variable-order-department-count.php';
     87        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-departments-names.php';
     88        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-departments-emails.php';
     89        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-department-names.php';
     90        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-department-emails.php';
     91        require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo/variables/aw-variable-order-department-count.php';
    9292
    9393        // Add department variables to the order group
  • runthings-wc-order-departments/trunk/lib/email-interceptor.php

    r3318971 r3434381  
    44
    55use RunthingsWCOrderDepartments\Utils\DepartmentMatcher;
     6use RunthingsWCOrderDepartments\Email\CustomerEmailInterceptor;
     7use RunthingsWCOrderDepartments\Email\AdminEmailInterceptor;
    68
    79if (!defined('WPINC')) {
     
    911}
    1012
     13// Include email interceptor classes
     14require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/email/customer-email-interceptor.php';
     15require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/email/admin-email-interceptor.php';
     16
     17/**
     18 * Manager class that coordinates customer and admin email interception
     19 */
    1120class EmailInterceptor
    1221{
    1322    private $department_matcher;
    1423
    15     public function __construct($taxonomy = 'order_department')
     24    private $settings;
     25
     26    private $customer_interceptor;
     27
     28    private $admin_interceptor;
     29
     30    public function __construct($taxonomy = 'order_department', $settings = null)
    1631    {
    1732        $this->department_matcher = new DepartmentMatcher($taxonomy);
     33        $this->settings = $settings;
    1834
    19         // Hook into WooCommerce email filters to modify recipients for admin notifications
    20         add_filter('woocommerce_email_recipient_new_order', [$this, 'modify_email_recipient'], 10, 2);
    21         add_filter('woocommerce_email_recipient_cancelled_order', [$this, 'modify_email_recipient'], 10, 2);
    22         add_filter('woocommerce_email_recipient_failed_order', [$this, 'modify_email_recipient'], 10, 2);
    23     }
    24    
    25     /**
    26      * Modify email recipients based on order department
    27      *
    28      * @param string $recipient Default recipient email(s)
    29      * @param \WC_Order $order Order object
    30      * @return string Modified recipient email(s)
    31      */
    32     public function modify_email_recipient($recipient, $order)
    33     {
    34         // Make sure we have a valid order
    35         if (!$order instanceof \WC_Order) {
    36             return $recipient;
    37         }
    38 
    39         // Get department recipients using the utility class
    40         $department_emails = $this->department_matcher->get_department_emails($order);
    41 
    42         // If department emails were found, use them instead
    43         if (!empty($department_emails)) {
    44             return $department_emails;
    45         }
    46 
    47         // Otherwise return the original recipient
    48         return $recipient;
     35        // Initialize specialized interceptors
     36        $this->customer_interceptor = new CustomerEmailInterceptor($this->department_matcher, $this->settings);
     37        $this->admin_interceptor = new AdminEmailInterceptor($this->department_matcher);
    4938    }
    5039}
  • runthings-wc-order-departments/trunk/lib/utils/department-matcher.php

    r3318971 r3434381  
    1414{
    1515    private $taxonomy;
     16
    1617    private $meta_prefix = 'runthings_wc_od_';
    1718
     
    180181
    181182    /**
    182      * Get department email addresses for an order
     183     * Get unique department email addresses for an order
    183184     *
    184185     * @param \WC_Order $order Order object
    185      * @return string Email addresses separated by commas
    186      */
    187     public function get_department_emails($order)
     186     * @return array Array of clean, unique email addresses
     187     */
     188    public function get_unique_department_emails($order)
    188189    {
    189190        $matching_departments = $this->get_matching_departments($order);
    190        
     191
    191192        // Collect emails from all matching departments
    192193        $destination_emails = [];
    193        
     194
    194195        foreach ($matching_departments as $department) {
    195196            if (!empty($department['emails'])) {
     
    197198            }
    198199        }
    199        
    200         // Remove duplicates and filter out empty values
    201         $destination_emails = array_unique(array_filter($destination_emails));
    202        
    203         // Return comma-separated list of emails (WordPress email format)
    204         return implode(', ', $destination_emails);
     200
     201        // Clean emails: trim whitespace, remove newlines, validate and filter
     202        $clean_emails = [];
     203        foreach ($destination_emails as $email) {
     204            $clean_email = trim(str_replace(["\r", "\n", "\t"], '', $email));
     205            if (!empty($clean_email) && filter_var($clean_email, FILTER_VALIDATE_EMAIL)) {
     206                $clean_emails[] = $clean_email;
     207            }
     208        }
     209
     210        // Remove duplicates and return
     211        return array_unique($clean_emails);
    205212    }
    206213
  • runthings-wc-order-departments/trunk/readme.md

    r3318971 r3434381  
    2626
    27271. **Department Taxonomy Management Screen** - Main interface for managing departments, viewing assigned orders, and configuring department settings.
    28    ![Department Management](screenshot-1.png)
     28   ![Department Management](https://raw.githubusercontent.com/runthings-dev/runthings-wc-order-departments/master/.wordpress-org/screenshot-1.png)
    2929
    30302. **Custom Department Menus** - Quick access menus in WooCommerce admin for filtering orders by department.
    31    ![Department Menus](screenshot-2.png)
     31   ![Department Menus](https://raw.githubusercontent.com/runthings-dev/runthings-wc-order-departments/master/.wordpress-org/screenshot-2.png)
    3232
    33333. **Department Meta Box on Order Screen** - View and manage department assignments directly from individual order pages.
    34    ![Order Department Meta Box](screenshot-3.png)
     34   ![Order Department Meta Box](https://raw.githubusercontent.com/runthings-dev/runthings-wc-order-departments/master/.wordpress-org/screenshot-3.png)
    3535
    36364. **Edit Department Screen** - Configure department email addresses, product categories, and specific product assignments.
    37    ![Edit Department](screenshot-4.png)
     37   ![Edit Department](https://raw.githubusercontent.com/runthings-dev/runthings-wc-order-departments/master/.wordpress-org/screenshot-4.png)
    3838
    3939## AutomateWoo Integration
     
    109109- **`{{ order.department_emails | separator: '; ' }}`** → Multiple emails separated by semicolon
    110110
    111 ## Use Cases
     111#### Variable Use Cases
    112112
    113113- **Sales & Technical Support**: Route orders containing software to Technical, hardware to Sales
     
    129129  - Pass `{{ order.departments_names }}` to CRM systems for proper lead assignment
    130130  - Use `{{ order.departments_emails }}` for automated follow-up sequences
     131
     132## Developer Filters
     133
     134The plugin provides filters to customize email handling behavior:
     135
     136### Email ID Filters
     137
     138**`runthings_wc_order_departments_customer_email_ids`**
     139
     140Customize which customer-facing email IDs have their reply-to headers modified by department emails.
     141
     142```php
     143add_filter('runthings_wc_order_departments_customer_email_ids', function($email_ids) {
     144    // Add custom customer email ID
     145    $email_ids[] = 'custom_customer_email';
     146
     147    // Remove an email ID if you don't want it modified
     148    $key = array_search('customer_new_account', $email_ids);
     149    if ($key !== false) {
     150        unset($email_ids[$key]);
     151    }
     152
     153    return $email_ids;
     154});
     155```
     156
     157**Default customer email IDs**: `customer_completed_order`, `customer_cancelled_order`, `customer_failed_order`, `customer_on_hold_order`, `customer_invoice`, `customer_note`, `customer_refunded_order`, `customer_processing_order`, `customer_new_account`, `customer_reset_password`
     158
     159**`runthings_wc_order_departments_admin_email_ids`**
     160
     161Customize which admin-facing email IDs have their recipients modified to use department emails.
     162
     163```php
     164add_filter('runthings_wc_order_departments_admin_email_ids', function($email_ids) {
     165    // Add custom admin email ID
     166    $email_ids[] = 'custom_admin_notification';
     167
     168    // Remove an email ID if you don't want it modified
     169    $key = array_search('backorder', $email_ids);
     170    if ($key !== false) {
     171        unset($email_ids[$key]);
     172    }
     173
     174    return $email_ids;
     175});
     176```
     177
     178**Default admin email IDs**: `new_order`, `cancelled_order`, `failed_order`, `backorder`
     179
     180### Use Cases for Email Filters
     181
     182- **Custom Email Types**: Add support for emails from other plugins or custom implementations
     183- **Selective Email Routing**: Exclude specific email types from department-based routing
     184- **Third-party Integration**: Ensure compatibility with other email-related plugins
    131185
    132186## Installation
     
    151205### Email Routing
    152206
    153 **Important**: Email routing behavior depends on whether the order's assigned departments have email addresses configured:
    154 
    155 - **If the order's assigned departments have email addresses**: The plugin will override WooCommerce admin emails and send them to the department's email addresses instead
     207The plugin provides two types of email routing:
     208
     209#### Admin Email Routing
     210
     211**Admin emails** (new order notifications, etc.) are automatically routed to department email addresses when departments are assigned to orders.
     212
     213#### Customer Email Reply-To Override
     214
     215**Customer emails** can have their reply-to headers modified based on department assignments. Configure this at **Settings > Order Departments**:
     216
     217- **Override reply-to with department emails**: Enable/disable the reply-to override feature
     218- **For multi-department orders**: Choose behavior when multiple unique email addresses are involved:
     219  - **Use all department emails**: Add all unique department emails to reply-to header
     220  - **Skip override - fall back to WooCommerce default**: Use WooCommerce's default reply-to setting
     221
     222**Email routing behavior**:
     223
     224- **Single department orders**: Always use that department's email for reply-to (when override enabled)
     225- **Multi-department orders with same email**: Treated as single department
     226- **Multi-department orders with different emails**: Behavior depends on settings choice
    156227- **If the order's assigned departments have NO email addresses**: The plugin does not attempt to override emails and WooCommerce emails work normally
    157228- **If WooCommerce emails are disabled**: No emails will be sent regardless of department email configuration
     
    210281## Changelog
    211282
     283### 1.1.1 - 7th January 2026
     284
     285- Bump tested up to 6.9
     286
     287### 1.1.0 - 31st July 2025
     288
     289- **New Feature**: Customer email reply-to override system
     290  - Configure reply-to behavior for customer emails based on department assignments
     291  - Settings page at Settings > Order Departments with override toggle and multi-department handling options
     292  - Single department orders always use department email for reply-to
     293  - Multi-department orders can use all department emails or fall back to WooCommerce default
     294- **New Feature**: Email customization filters
     295  - `runthings_wc_order_departments_customer_email_ids` filter to customize which customer emails are modified
     296  - `runthings_wc_order_departments_admin_email_ids` filter to customize which admin emails are modified
     297- **Improvement**: Refactored email system with separate CustomerEmailInterceptor and AdminEmailInterceptor classes
     298- **Improvement**: Enhanced email address validation and cleaning using PHP's filter_var()
     299- **Improvement**: Robust email header manipulation with proper newline handling
     300
     301### 1.0.1 - 27th June 2025
     302
     303- WordPress Plugin Directory release
     304- Update contributors meta in readme.txt to match username
     305
    212306### 1.0.0 - 17th June 2025
    213307
  • runthings-wc-order-departments/trunk/readme.txt

    r3318971 r3434381  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.1
     7Stable tag: 1.1.1
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    9797* `{{ order.department_emails | separator: '; ' }}` → Multiple emails separated by semicolon
    9898
    99 = Use Cases =
     99= Variable Use Cases =
    100100
    101101* **Sales & Technical Support**: Route orders containing software to Technical, hardware to Sales
     
    114114  * Pass `{{ order.departments_names }}` to CRM systems for proper lead assignment
    115115  * Use `{{ order.departments_emails }}` for automated follow-up sequences
     116
     117== Developer Filters ==
     118
     119The plugin provides filters to customize email handling behavior:
     120
     121= Email ID Filters =
     122
     123**runthings_wc_order_departments_customer_email_ids**
     124
     125Customize which customer-facing email IDs have their reply-to headers modified by department emails.
     126
     127`add_filter('runthings_wc_order_departments_customer_email_ids', function($email_ids) { // Add custom customer email ID $email_ids[] = 'custom_customer_email'; // Remove an email ID if you don't want it modified $key = array_search('customer_new_account', $email_ids); if ($key !== false) { unset($email_ids[$key]); } return $email_ids; });`
     128
     129**Default customer email IDs**: `customer_completed_order`, `customer_cancelled_order`, `customer_failed_order`, `customer_on_hold_order`, `customer_invoice`, `customer_note`, `customer_refunded_order`, `customer_processing_order`, `customer_new_account`, `customer_reset_password`
     130
     131**runthings_wc_order_departments_admin_email_ids**
     132
     133Customize which admin-facing email IDs have their recipients modified to use department emails.
     134
     135`add_filter('runthings_wc_order_departments_admin_email_ids', function($email_ids) { // Add custom admin email ID $email_ids[] = 'custom_admin_notification'; // Remove an email ID if you don't want it modified $key = array_search('backorder', $email_ids); if ($key !== false) { unset($email_ids[$key]); } return $email_ids; });`
     136
     137**Default admin email IDs**: `new_order`, `cancelled_order`, `failed_order`, `backorder`
     138
     139= Use Cases for Email Filters =
     140
     141* **Custom Email Types**: Add support for emails from other plugins or custom implementations
     142* **Selective Email Routing**: Exclude specific email types from department-based routing
     143* **Third-party Integration**: Ensure compatibility with other email-related plugins
    116144
    117145== Installation ==
     
    136164= Email Routing =
    137165
    138 **Important**: Email routing behavior depends on whether the order's assigned departments have email addresses configured:
    139 
    140 * **If the order's assigned departments have email addresses**: The plugin will override WooCommerce admin emails and send them to the department's email addresses instead
     166The plugin provides two types of email routing:
     167
     168= Admin Email Routing =
     169
     170**Admin emails** (new order notifications, etc.) are automatically routed to department email addresses when departments are assigned to orders.
     171
     172= Customer Email Reply-To Override =
     173
     174**Customer emails** can have their reply-to headers modified based on department assignments. Configure this at **Settings > Order Departments**:
     175
     176* **Override reply-to with department emails**: Enable/disable the reply-to override feature
     177* **For multi-department orders**: Choose behavior when multiple unique email addresses are involved:
     178  * **Use all department emails**: Add all unique department emails to reply-to header
     179  * **Skip override - fall back to WooCommerce default**: Use WooCommerce's default reply-to setting
     180
     181**Email routing behavior**:
     182
     183* **Single department orders**: Always use that department's email for reply-to (when override enabled)
     184* **Multi-department orders with same email**: Treated as single department
     185* **Multi-department orders with different emails**: Behavior depends on settings choice
    141186* **If the order's assigned departments have NO email addresses**: The plugin does not attempt to override emails and WooCommerce emails work normally
    142187* **If WooCommerce emails are disabled**: No emails will be sent regardless of department email configuration
     
    201246
    202247== Changelog ==
     248
     249= 1.1.1 - 7th January 2026 =
     250* Bump tested up to 6.9
     251
     252= 1.1.0 - 31st July 2025 =
     253* **New Feature**: Customer email reply-to override system
     254  * Configure reply-to behavior for customer emails based on department assignments
     255  * Settings page at Settings > Order Departments with override toggle and multi-department handling options
     256  * Single department orders always use department email for reply-to
     257  * Multi-department orders can use all department emails or fall back to WooCommerce default
     258* **New Feature**: Email customization filters
     259  * `runthings_wc_order_departments_customer_email_ids` filter to customize which customer emails are modified
     260  * `runthings_wc_order_departments_admin_email_ids` filter to customize which admin emails are modified
     261* **Improvement**: Refactored email system with separate CustomerEmailInterceptor and AdminEmailInterceptor classes
     262* **Improvement**: Enhanced email address validation and cleaning using PHP's filter_var()
     263* **Improvement**: Robust email header manipulation with proper newline handling
    203264
    204265= 1.0.1 - 27th June 2025 =
     
    235296== Upgrade Notice ==
    236297
     298= 1.1.1 =
     299Bump tested up to 6.9
     300
     301= 1.1.0 =
     302Major update with customer email reply-to override system and new settings page. Configure reply-to behavior for customer emails based on department assignments. Includes new developer filters for email customization.
     303
    237304= 1.0.1 =
    238305Initial release of plugin on WordPress Plugin Directory. Fixed readme.txt contributors meta.
    239 
    240 = 1.0.0 =
    241 Initial release of Order Departments for WooCommerce plugin.
  • runthings-wc-order-departments/trunk/runthings-wc-order-departments.php

    r3318971 r3434381  
    55 * Plugin URI: https://runthings.dev/wordpress-plugins/runthings-wc-order-departments/
    66 * Description: Split WooCommerce orders by departments, with AutomateWoo support
    7  * Version: 1.0.1
     7 * Version: 1.1.1
    88 * Author: runthingsdev
    99 * Author URI: https://runthings.dev/
    1010 * Requires at least: 6.3
    11  * Tested up to: 6.8
     11 * Tested up to: 6.9
    1212 * Requires PHP: 7.4
    1313 * Requires Plugins: woocommerce
    1414 * WC requires at least: 8.2
    15  * WC tested up to: 9.9
    1615 * Text Domain: runthings-wc-order-departments
    1716 * Domain Path: /languages
     
    4241}
    4342
    44 define('RUNTHINGS_WC_ORDER_DEPARTMENTS_VERSION', '1.0.1');
     43define('RUNTHINGS_WC_ORDER_DEPARTMENTS_VERSION', '1.1.1');
    4544define('RUNTHINGS_WC_ORDER_DEPARTMENTS_URL', plugin_dir_url(__FILE__));
    4645define('RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR', plugin_dir_path(__FILE__));
     
    5150require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/order-department-assigner.php';
    5251require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/automatewoo-integration.php';
     52require_once RUNTHINGS_WC_ORDER_DEPARTMENTS_DIR . 'lib/settings.php';
    5353
    5454class RunthingsWCOrderDepartments
     
    5656    public $taxonomy = 'order_department';
    5757
     58    private $settings;
     59
    5860    public function __construct()
    5961    {
     
    6567        add_action('admin_menu', [$this, 'add_departments_management_menu'], 99);
    6668
     69        // Initialize settings first
     70        $this->settings = new Settings();
     71
     72        // Initialize other components, passing settings where needed
    6773        new Taxonomy($this->taxonomy);
    68         new EmailInterceptor($this->taxonomy);
     74        new EmailInterceptor($this->taxonomy, $this->settings);
    6975        new OrderDepartmentAssigner($this->taxonomy);
    7076        new AutomateWooIntegration();
Note: See TracChangeset for help on using the changeset viewer.