php js css php js css

Scripts

Save Script Run
Attached Artifacts
Title
PHP Code
<?php $rows = \Components\Commerce\Discounts::getAll(['filter' => ['discount_title', '=', 'Course exclusion - Presentation Demo'], 'limit' => 1]); $discount = reset($rows); \Components\Commerce\Discounts::save(['discount_id' => $discount['discount_id'], 'discount_entity_type' => '\Components\AF\Courses\CollectiveCourses']); \Components\Marketing\Automation::save(['automation_id' => 75, 'automation_event_configuration' => ['onmembership_products' => 'products', 'onmembership_product_entities' => [519], 'attach_membership_card' => 1], 'automation_is_enabled' => 0]); echo json_encode([ 'discount' => $discount['discount_id'], 'private_purchased' => \Components\AF\Courses\Hours::getTotalForCourse(378), 'private_allocated' => \Components\AF\Courses\Units::getTotalAllocatedForCourse(378), 'private_remaining' => \Components\AF\Courses\PrivateCourses::getRemainingHourBalance(378), 'guard_enabled' => \Components\AF\Courses\PrivateCourses::configGetValue('prevent_scheduling_beyond_paid_hours'), 'missing_answer_key' => \Components\AF\PlacementTests::isMissingAnswerKey(\Components\AF\PlacementTests::get(32)), 'membership_valid' => \Components\AF\Memberships::isValid(\Components\AF\Memberships::get(144)), 'invoice_total' => \Components\Commerce\Sales::getColumn(1541, 'sale_total'), 'teacher_hours' => \Components\AF\Teachers\Hours::getFilteredHours(['teacher_id' => 1393, 'date_from' => strtotime('2026-10-01'), 'date_to' => strtotime('2026-10-31 23:59:59')]), ], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);

Run Log

▼ Today 4:33am ✓ Completed 0.1s
{
    "discount": "26",
    "private_purchased": 10,
    "private_allocated": 3,
    "private_remaining": 7,
    "guard_enabled": "1",
    "missing_answer_key": true,
    "membership_valid": true,
    "invoice_total": "65.00",
    "teacher_hours": {
        "Administration - Presentation Demo": {
            "count": 2,
            "entities": [
                {
                    "hour_id": "13",
                    "hour_date": "2026-10-06",
                    "hour_start_time": "09:00:00",
                    "hour_end_time": "11:00:00",
                    "hour_billing_status": "unpaid",
                    "hour_comment": "Presentation Demo - preparation and administration",
                    "location_id": null,
                    "hour_type_id": "32",
                    "teacher_id": "1393",
                    "contact_id": "1393",
                    "contact_global_id": null,
                    "contact_created_datetime": "2026-10-08 00:55:07",
                    "contact_updated_datetime": "2026-10-08 00:55:07",
                    "contact_last_online": "2026-10-08 00:55:07",
                    "contact_username": null,
                    "contact_email": "af-presentation-camille@example.invalid",
                    "contact_email_secondary": null,
                    "contact_email_secondary_cc": "0",
                    "contact_email_marketing_status": "unsubscribed",
                    "contact_email_bounce_count_soft": "0",
                    "contact_email_bounce_count_hard": "0",
                    "contact_general_communication_unsubscribe": null,
                    "contact_cookie_token": "",
                    "contact_cookie_seed": null,
                    "contact_cookie_token_tracking": null,
                    "contact_password_lost": null,
                    "contact_password_url": null,
                    "contact_password_requires_change": "0",
                    "contact_password_active_datetime": null,
                    "contact_type": "Individual",
                    "contact_gender": null,
                    "contact_title": null,
                    "contact_first_name": "Camille",
                    "contact_last_name": "Presentation Demo",
                    "contact_address": null,
                    "contact_suburb_city": null,
                    "contact_postcode": null,
                    "contact_state": null,
                    "country_id": "AUS",
                    "contact_timezone": null,
                    "contact_dob": "1995-06-15",
                    "contact_company": null,
                    "contact_company_number_type": null,
                    "contact_company_number": null,
                    "contact_company_tax_registered": "1",
                    "contact_phone_home": null,
                    "contact_phone_work": null,
                    "contact_phone_mobile": null,
                    "contact_phone_mobile_e164": null,
                    "contact_phone_mobile_verification_code": null,
                    "contact_phone_mobile_verification_code_datetime": null,
                    "contact_phone_mobile_sms_optout": "0",
                    "contact_phone_mobile_sms_bounce_count": "0",
                    "contact_fax": null,
                    "contact_social_facebook_url": null,
                    "contact_social_twitter_url": null,
                    "contact_social_linkedin_url": null,
                    "contact_social_youtube": null,
                    "contact_social_instagram": null,
                    "contact_website": null,
                    "contact_picture": null,
                    "contact_profile": "0",
                    "contact_profile_about": null,
                    "contact_signature": null,
                    "contact_page_registered": "",
                    "contact_referrer_type_id": null,
                    "contact_referrer_type_detail_id": null,
                    "contact_referrer_url": null,
                    "contact_referrer_text": null,
                    "contact_screen_width": null,
                    "contact_screen_height": null,
                    "contact_privacy_email_unsubscribed": "0",
                    "contact_privacy_no_online_status": "0",
                    "contact_privacy_no_contact_messages": "0",
                    "language_id": null,
                    "affiliate_id": null,
                    "affiliate_date": null,
                    "contact_sale_balance": null,
                    "contact_library_permission": "Active",
                    "contact_nric": null,
                    "contact_mother_tongue": null,
                    "contact_age": null,
                    "contact_interest": null,
                    "contact_parent_phone_number_": null,
                    "contact_name_of_dog": null,
                    "contact_gives_presents_to_the_teacher": null,
                    "contact_nationality": null,
                    "contact_af_settings": "{\"theme\":\"default\",\"general_settings\":{\"show_teacher_email_in_student_portal\":false},\"notification_settings\":{\"email_student_on_new_post\":true,\"email_student_on_updated_post\":true,\"email_student_on_post_comments_and_replies\":true,\"email_student_on_new_document\":true,\"email_student_on_new_assignment\":true,\"email_student_on_assignment_graded\":true,\"email_teacher_on_new_post\":true,\"email_teacher_on_updated_post\":true,\"email_teacher_on_post_comments_and_replies\":true,\"email_teacher_on_new_assignment_submission\":true}}",
                    "contact_qbo_id": null,
                    "contact_cdp": null,
                    "contact_photo_consent": null,
                    "contact_gael_candidate_number": null,
                    "contact_gael_language_id": null,
                    "contact_gael_nationality_id": null,
                    "contact_gael_country_of_birth_code": null,
                    "contact_city_of_birth": null,
                    "contact_has_disability": null,
                    "contact_qbo_sync_token": null,
                    "contact_file_upload": null,
                    "unique_hour_id": "13"
                }
            ]
        },
        "days_worked": 1
    }
}