REPLACE INTO `hb_language_locales` (`language_id`,`section`,`keyword`,`value`)
SELECT id, 'global', 'editOrderOwnership','Edit Order Ownership' FROM hb_language WHERE target='admin'
UNION SELECT id, 'global', 'editOrderTakeOwnership','Take Order Ownership' FROM hb_language WHERE target='admin'
UNION SELECT id, 'global', 'lackpriviliges_ownership','You do not have privileges to change ownership' FROM hb_language WHERE target='admin'
UNION SELECT id, 'global', 'hbownershipchange','Hostbill Order Ownership change ' FROM hb_language WHERE target='admin'
UNION SELECT id, 'global', 'hbownershipchangetome','Hostbill Order assigned to me' FROM hb_language WHERE target='admin'
UNION SELECT id, 'global', 'staffownership','Staff ownership' FROM hb_language WHERE target='admin'
UNION SELECT id, 'global', 'takeownership','Take Ownership' FROM hb_language WHERE target='admin';
##########
ALTER TABLE `hb_orders`
ADD COLUMN `staff_member_id` INT NOT NULL DEFAULT '0' AFTER `client_id`;
##########
ALTER TABLE `hb_order_drafts`
ADD COLUMN `staff_member_id` INT NOT NULL DEFAULT '0' AFTER `client_id`;
##########
INSERT INTO `hb_email_templates` (`tplname`, `group`, `for`, `language_id`, `subject`, `message`, `send`, `plain`, `system`, `hidden`) 
VALUES ('Admin:Order Ownership Changed', 'General', 'Admin', 1, 'Admin:Order Ownership Changed', 'Ownership for Order ID: {$order.id} has been  {if $order.staff_member_id}changed to {$order.admin_firstname} {$order.admin_lastname}{else}removed{/if}\r\n\r\n---------------------------------------------------------------\r\nOrder Info\r\n---------------------------------------------------------------\r\n# Order ID: {$order.id}\r\n# Order Number: {$order.number}\r\n# Date Created: {$order.date_created|dateformat:$date_format}\r\n# Invoice Number: {$order.invoice_id}\r\n# Payment Method: {$order.module}\r\n{if $order.fraudscore}# FraudModule risk score: {$order.fraudscore}{/if}\r\n\r\n---------------------------------------------------------------\r\nClient Info\r\n---------------------------------------------------------------\r\n# ID: {$client.id}\r\n# Name: {$client.firstname} {$client.lastname}\r\n# Email: {$client.email}\r\n# Company: {$client.companyname}\r\n# Address 1: {$client.address1}\r\n# Address 2: {$client.address2}\r\n# City: {$client.city}\r\n# State/Region: {$client.state}\r\n# Zip Code: {$client.postcode}\r\n# Country: {$client.country}\r\n# Phone Number: {$client.phonenumber}\r\n\r\n---------------------------------------------------------------\r\nOrder Items\r\n---------------------------------------------------------------\r\n{if $order_details}\r\n{foreach from=$order_details item=item}\r\n #  {$item.amount|price:$currency} - {$item.description}\r\n{/foreach}\r\n\r\nTotal(+tax): {$order.total|price:$currency}\r\n{else}\r\nNo items to list.\r\n{/if}\r\n\r\n\r\n---------------------------------------------------------------\r\nIP: {$ip_addr}\r\nHost: {$host_addr}', 1, 1, 1, 0);
##########
INSERT INTO `hb_email_templates` (`tplname`, `group`, `for`, `language_id`, `subject`, `message`, `send`, `plain`, `system`, `hidden`) 
VALUES ('Admin:Assigned Order Ownership', 'General', 'Admin', 1, 'Admin:Assigned Order Ownership', 'You were assigned to Order ID: {$order.id}\r\n\r\n---------------------------------------------------------------\r\nOrder Info\r\n---------------------------------------------------------------\r\n# Order ID: {$order.id}\r\n# Order Number: {$order.number}\r\n# Date Created: {$order.date_created|dateformat:$date_format}\r\n# Invoice Number: {$order.invoice_id}\r\n# Payment Method: {$order.module}\r\n{if $order.fraudscore}# FraudModule risk score: {$order.fraudscore}{/if}\r\n\r\n---------------------------------------------------------------\r\nClient Info\r\n---------------------------------------------------------------\r\n# ID: {$client.id}\r\n# Name: {$client.firstname} {$client.lastname}\r\n# Email: {$client.email}\r\n# Company: {$client.companyname}\r\n# Address 1: {$client.address1}\r\n# Address 2: {$client.address2}\r\n# City: {$client.city}\r\n# State/Region: {$client.state}\r\n# Zip Code: {$client.postcode}\r\n# Country: {$client.country}\r\n# Phone Number: {$client.phonenumber}\r\n\r\n---------------------------------------------------------------\r\nOrder Items\r\n---------------------------------------------------------------\r\n{if $order_details}\r\n{foreach from=$order_details item=item}\r\n #  {$item.amount|price:$currency} - {$item.description}\r\n{/foreach}\r\n\r\nTotal(+tax): {$order.total|price:$currency}\r\n{else}\r\nNo items to list.\r\n{/if}\r\n\r\n\r\n---------------------------------------------------------------\r\nIP: {$ip_addr}\r\nHost: {$host_addr}', 1, 1, 1, 0);
