diff --git a/B1_B2_WORKFLOW_TODO.md b/B1_B2_WORKFLOW_TODO.md new file mode 100644 index 0000000..eb6662a --- /dev/null +++ b/B1_B2_WORKFLOW_TODO.md @@ -0,0 +1,275 @@ +# B1โ†’B2 Global Masters Workflow - Implementation Guide + +**Status:** Search methods added, ready to implement full workflow +**Campaign Type:** Global comm (B-series status codes) +**Test Campaign:** NUTELLA PLANT-BASED LAUNCH (676f2bcde4c7bcf7ef783e97f7495069bf50b6bc) + +--- + +## โœ… Already Complete + +1. **StatusManager Methods** โœ… + - `searchGlobalCampaigns()` - Search for Global comm campaigns + - `searchAllCampaignTypes()` - Search for both Local and Global + - Updated debug search to show both campaign types + +2. **Test Campaign Verified** โœ… + - Folder ID: 676f2bcde4c7bcf7ef783e97f7495069bf50b6bc + - Name: NUTELLA PLANT-BASED LAUNCH + - Status: B1 + - Campaign Type: Global comm + - Accessible via API + +--- + +## ๐Ÿ“‹ TODO: PHP Interface (B1โ†’B2 Workflow) + +### 1. Add New Tab in workflow_v3.php + +**Location:** After Upload from Box tab, before closing tabs div + +**Add:** +```php + +``` + +### 2. Add Tab Content Section + +**Template (copy from Download Workflow A1โ†’A2):** +```php + +
+

๐ŸŒ Global Masters Workflow: B1 โ†’ B2

+

Download Global Master assets and prepare for re-mastering

+ +
+ + + +
+ + +
+``` + +### 3. Add Action Handlers + +**Actions to add:** +- `load_campaigns_b1` - Load campaigns with status B1 +- `select_campaign_b1` - Select a B1 campaign +- `get_global_master_assets` - Get master assets from campaign +- `download_global_asset` - Download individual asset +- `download_all_global_assets` - Download all assets +- `download_and_upload_global_to_box` - Download from DAM, upload to Box +- `update_status_to_b2` - Update status B1 โ†’ B2 +- `reset_to_b1` - Reset status to B1 (for testing) + +### 4. Add Status Change Buttons in Debug View + +**Location:** In the debug campaign display (around line 1920) + +**Add for each campaign:** +```php + + + + + +``` + +--- + +## ๐Ÿ“‹ TODO: Python Script (b1_to_b2_download.py) + +### Create New Script + +**File:** `Python-Version/scripts/b1_to_b2_download.py` + +**Differences from A1โ†’A2:** +1. Search for B1 status (not A1) +2. Search for "Global comm" campaigns (not "Local Adaptation") +3. Use `dam.search_campaigns(status='B1')` - need to update DAM client +4. Update status B1 โ†’ B2 (not A1 โ†’ A2) +5. Same folder logic (348304357505) +6. Same Box upload with tracking IDs +7. Same all-done check +8. Different email templates (b1_to_b2_complete, b1_to_b2_partial) + +### Update DAM Client + +**File:** `Python-Version/scripts/shared/dam_client.py` + +**Add method:** +```python +def search_global_campaigns(self, status=None): + """Search for Global comm campaigns (B-series)""" + # Change search condition value to 'Global comm' +``` + +### Email Templates + +**Add to notifier.py:** +- `b1_to_b2_complete` - Success email for B1โ†’B2 +- `b1_to_b2_partial` - Partial completion for B1โ†’B2 + +--- + +## ๐Ÿ”ง Implementation Steps + +### Step 1: PHP Interface (2-3 hours) +1. Add B1โ†’B2 tab to workflow +2. Copy and adapt A1โ†’A2 workflow code +3. Update action handlers for B1/B2 +4. Add status change buttons +5. Test with folder: 676f2bcde4c7bcf7ef783e97f7495069bf50b6bc + +### Step 2: Python Script (1-2 hours) +1. Copy a1_to_a2_download.py โ†’ b1_to_b2_download.py +2. Update search to use Global comm campaigns +3. Update status codes (B1, B2) +4. Add email templates +5. Test with B1 campaign + +### Step 3: Testing (1 hour) +1. Test PHP workflow with NUTELLA campaign +2. Test Python script +3. Verify Box uploads +4. Verify database storage +5. Verify status changes +6. Verify emails + +--- + +## ๐Ÿ“ Code Templates + +### loadCampaignsByStatus for B1 + +```php +function loadCampaignsByStatusB1($testRunner, $status) +{ + $statusManager = createStatusManager($testRunner); + $response = $statusManager->searchGlobalCampaigns($testRunner); + + if ($response['success']) { + $allCampaigns = CampaignFormatter::getActionableCampaigns($response['body'], []); + $filteredCampaigns = CampaignFormatter::getActionableCampaigns($response['body'], ['status' => $status]); + return $filteredCampaigns; + } + + return []; +} +``` + +### Python DAM Client Search + +```python +def search_global_campaigns(self, status=None): + """Search for Global comm campaigns (B-series)""" + search_condition = { + "search_condition_list": { + "search_condition": [ + { + "type": "com.artesia.search.SearchScalarCondition", + "metadata_field_id": "ARTESIA.FIELD.CONTAINER TYPE NAME", + "relational_operator_id": "ARTESIA.OPERATOR.CHAR.CONTAINS", + "value": "GLOBALCAMPAING", + "left_paren": "(", + "right_paren": ")" + }, + { + "type": "com.artesia.search.SearchScalarCondition", + "metadata_field_id": "FERRERO.FIELD.CAMPAIGN TYPE", + "relational_operator_id": "ARTESIA.OPERATOR.CHAR.CONTAINS", + "value": "Global comm", + "relational_operator": "and" + } + ] + } + } + # ... rest same as search_campaigns +``` + +--- + +## ๐ŸŽฏ Expected Behavior + +**B1โ†’B2 PHP Workflow:** +1. Load campaigns with status B1 (Global comm campaigns) +2. Select campaign (e.g., NUTELLA PLANT-BASED LAUNCH) +3. Get Global Master Assets +4. Download assets +5. Upload to Box with tracking IDs +6. Update status B1 โ†’ B2 when all done + +**B1โ†’B2 Python Script:** +```bash +python scripts/b1_to_b2_download.py +``` +- Searches for B1 Global campaigns +- Processes first one +- Downloads master assets +- Uploads to Box +- Updates B1 โ†’ B2 +- Sends webhook and email + +**Cron Setup:** +```bash +# A1โ†’A2: Local Adaptation every 5 minutes +*/5 * * * * python scripts/a1_to_a2_download.py + +# B1โ†’B2: Global Masters every 5 minutes +*/5 * * * * python scripts/b1_to_b2_download.py +``` + +--- + +## ๐Ÿงช Testing Checklist + +- [ ] B1 campaigns appear in debug view +- [ ] Can select B1 campaign +- [ ] Can get Global Master Assets +- [ ] Can download assets +- [ ] Can upload to Box +- [ ] Status updates B1 โ†’ B2 +- [ ] Can reset B2 โ†’ B1 +- [ ] Python script finds B1 campaigns +- [ ] Python script processes Global campaign +- [ ] Email notifications work +- [ ] Webhook sent to Make.com + +--- + +## ๐Ÿ“ Files to Modify/Create + +### PHP (Modify): +- `src/StatusManager.php` โœ… Done +- `workflow_v3.php` - Add tab, actions, handlers + +### Python (Create): +- `scripts/b1_to_b2_download.py` - New script +- `scripts/shared/dam_client.py` - Add search_global_campaigns() +- `scripts/shared/notifier.py` - Add B1โ†’B2 email templates + +### Configuration: +- `.env` - No changes needed +- `config/config.yaml` - No changes needed +- `config/field_mappings.yaml` - No changes needed + +--- + +**Estimated Time:** 4-6 hours total +**Status:** Foundation complete, ready to build +**Test Campaign Available:** NUTELLA PLANT-BASED LAUNCH (B1) + +--- + +**Load this file in next session to continue with B1โ†’B2 implementation!**