executeQuery($sql, [$contact_id]); if ($rs === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } $old_getName = array(); foreach ($rs as $row) { array_push($old_getName, $row['rights_granted']); } return (count($old_getName) ? implode(',',$old_getName) : ''); } //IF THERE IS VENDOR_PROPOSED_TERM_ID PASSED IN, USE TABLE VENDOR_PROPOSED_TERM, OTHERWISE, USE VENDOR_CONTRACT TABLE $table = ($vendor_proposed_term_id) ? 'vendor_proposed_term' : 'vendor_contract'; $dataParams = []; //GET DATA FROM CURRENT CONTRACT if(!$vendor_proposed_term_id){ if($vendor_type == "vendor"){ $sql = 'SELECT cont_start as contract_start, exclusive, orchrep_name, carve_out, territory_carve_out, dms_carve_out, dms_master_carve_out, encoding_fees_cap_back_ctlg, encoding_fees_cap_new_release, digital_split, physical_split, advance_recoupable_percentage, possible_track_restrictions, oms_type, oms_fee_percentage, negotiated_changes, negotiated_change_comments, marketing_restrictions, orchard_assignment_right_restriction, currency_id, third_party_responsibility, third_party_responsibility_detail, possible_track_restriction_detail, extend_until_recouped, sync_admin_territory, sync_admin_commission, sync_admin_response_time, sync_admin_type_of_deal, royalty_collection_territory, topspin_rate_territory, royalty_collection_commission, publishing_admin_commission, publishing_admin_territory, publishing_admin_limit_grant_of_rights, publishing_admin_misc_provisions, ringtone_publishing_type, other_rights_option, other_rights_text, special_product_split, special_product_carve_out, payment_interval, pay_after, sx_royalty_collection_commission, topspin_rate, show_credit_card, (select group_concat(distribution_type_id) from vendor_contract_distribution_type where vendor_contract_id = vcon.id) as dist_type, vcon.cont_end AS contract_end, parent_vendor_contract_id, (select group_concat(rights_granted order by rights_granted) from vendor_contract_rights_granted vcdt where vcdt.contract_id=vcon.id) as rights_granted FROM vendor_contract vcon LEFT JOIN vendor_contract_distribution_type vcdt on vcdt.vendor_contract_id = vcon.id WHERE vcon.id = ?'; }else{ $sql = 'SELECT cont_start as contract_start, sync_admin_territory, sync_admin_commission, sync_admin_response_time, sync_admin_type_of_deal, royalty_collection_territory, topspin_rate_territory, royalty_collection_commission, publishing_admin_commission, publishing_admin_territory, publishing_admin_limit_grant_of_rights, publishing_admin_misc_provisions, vcon.cont_end AS contract_end, parent_vendor_contract_id, other_rights_option, other_rights_text, special_product_split, special_product_carve_out, payment_interval, pay_after, sx_royalty_collection_commission, topspin_rate, show_credit_card FROM vendor_contract vcon WHERE vcon.id = ?'; } $dataParams[] = $id; }else{ if($vendor_type == "vendor"){ $sql = 'SELECT distinct cont_start as contract_start, exclusive, orchrep_name, proposed_territory_carve_out as territory_carve_out, proposed_dms_carve_out as dms_carve_out, proposed_dms_master_carve_out as dms_master_carve_out, encoding_fees_cap_back_ctlg, encoding_fees_cap_new_release, digital_split, physical_split, advance_recoupable_percentage, possible_track_restrictions, oms_type, oms_fee_percentage, negotiated_changes, negotiated_change_comments, marketing_restrictions, orchard_assignment_right_restriction, currency_id, third_party_responsibility, third_party_responsibility_detail, possible_track_restriction_detail, extend_until_recouped, sync_admin_territory, sync_admin_commission, sync_admin_response_time, sync_admin_type_of_deal, royalty_collection_territory, topspin_rate_territory, royalty_collection_commission, sx_royalty_collection_commission, topspin_rate, publishing_admin_commission, publishing_admin_territory, publishing_admin_limit_grant_of_rights, publishing_admin_misc_provisions, vpt.cont_end AS contract_end, parent_vendor_contract_id, vpt.rights_granted, vpt.ringtone_publishing_type, other_rights_option, other_rights_text, special_product_split, special_product_carve_out, payment_interval, pay_after, show_credit_card, (select group_concat(distribution_type_id) from vendor_proposed_term_distribution_type where vendor_proposed_term_id = vpt.vendor_proposed_term_id) as dist_type FROM vendor_proposed_term vpt LEFT JOIN vendor_proposed_term_distribution_type vptd on vptd.vendor_proposed_term_id = vpt.vendor_proposed_term_id WHERE vpt.vendor_proposed_term_id = ?'; }else{ $sql = 'SELECT distinct cont_start as contract_start, sync_admin_territory, sync_admin_commission, sync_admin_response_time, sync_admin_type_of_deal, royalty_collection_territory, topspin_rate_territory, royalty_collection_commission, sx_royalty_collection_commission, topspin_rate, publishing_admin_commission, publishing_admin_territory, publishing_admin_limit_grant_of_rights, publishing_admin_misc_provisions, vpt.cont_end AS contract_end, parent_vendor_contract_id, vpt.rights_granted, other_rights_option, other_rights_text, special_product_split, special_product_carve_out, payment_interval, pay_after, show_credit_card FROM vendor_proposed_term vpt WHERE vpt.vendor_proposed_term_id = ?'; } $dataParams[] = $vendor_proposed_term_id; } $rs = $wrapperObj->executeQuery($sql, $dataParams); if ($rs === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } $fields_after_amendment = array(); $fields_after_amendment = $rs[0]; if($fields_after_amendment['parent_vendor_contract_id']){ if($vendor_type == "vendor"){ $sql = 'SELECT distinct cont_start as contract_start, exclusive, orchrep_name, territory_carve_out, dms_carve_out, dms_master_carve_out, encoding_fees_cap_back_ctlg, encoding_fees_cap_new_release, digital_split, physical_split, advance_recoupable_percentage, possible_track_restrictions, oms_type, oms_fee_percentage, negotiated_changes, negotiated_change_comments, marketing_restrictions, orchard_assignment_right_restriction, currency_id, third_party_responsibility, third_party_responsibility_detail, possible_track_restriction_detail, extend_until_recouped, sync_admin_territory, sync_admin_commission, sync_admin_response_time, sync_admin_type_of_deal, royalty_collection_territory, topspin_rate_territory, royalty_collection_commission, sx_royalty_collection_commission, topspin_rate, publishing_admin_commission, publishing_admin_territory, publishing_admin_limit_grant_of_rights, publishing_admin_misc_provisions, ringtone_publishing_type, other_rights_option, other_rights_text, special_product_split, special_product_carve_out, payment_interval, pay_after, show_credit_card, (select group_concat(distribution_type_id) from vendor_contract_distribution_type where vendor_contract_id = vcon.id) as dist_type, vcon.cont_end AS contract_end, parent_vendor_contract_id, (select group_concat(rights_granted order by rights_granted) from vendor_contract_rights_granted vcdt where vcdt.contract_id=vcon.id order by rights_granted) as rights_granted FROM vendor_contract vcon WHERE vcon.id = ?'; }else{ $sql = 'SELECT distinct cont_start as contract_start, sync_admin_territory, sync_admin_commission, sync_admin_response_time, sync_admin_type_of_deal, royalty_collection_territory, topspin_rate_territory, royalty_collection_commission, sx_royalty_collection_commission, topspin_rate, publishing_admin_commission, publishing_admin_territory, publishing_admin_limit_grant_of_rights, publishing_admin_misc_provisions, vcon.cont_end AS contract_end, parent_vendor_contract_id, other_rights_option, other_rights_text, special_product_split, special_product_carve_out, payment_interval, pay_after, show_credit_card, (select group_concat(rights_granted) from vendor_contract_rights_granted vcdt where vcdt.contract_id=vcon.id order by rights_granted) as rights_granted FROM vendor_contract vcon WHERE vcon.id = ?'; } $rs = $wrapperObj->executeQuery($sql, [$fields_after_amendment['parent_vendor_contract_id']]); if ($rs === false) { show_pdo_error($sql, $wrapperObj->getLastStatement()); } $fields_before_amendment = array(); $fields_before_amendment = $rs[0]; //compare two array $carveout_fields = array('parent_vendor_contract_id','contract_start','contract_end'); $has_difference = false; if(count($fields_before_amendment)){ foreach($fields_before_amendment as $key=>$detail){ if(!is_numeric($key) && $fields_before_amendment[$key] != $fields_after_amendment[$key] && !in_array($key,$carveout_fields)){ if($key=="dist_type"){ $temp_distA = asort(explode(',',$fields_before_amendment[$key])); $temp_distB = asort(explode(',',$fields_after_amendment[$key])); if($temp_distA == $temp_distB) continue; } if($key=="rights_granted"){ $temp_distA = asort(explode(',',$fields_before_amendment[$key])); $temp_distB = asort(explode(',',$fields_after_amendment[$key])); if($temp_distA == $temp_distB) continue; } $has_difference = true; break; } } } if($has_difference){ ?>

Amendment Changes

$details){ if($fields_before_amendment[$key] != $fields_after_amendment[$key] && !in_array($key,$carveout_fields)){ if(!is_numeric($key)){ $detail = $fields_before_amendment[$key]; $new_v = $fields_after_amendment[$key]; if($key=="territory_carve_out" || $key == "sync_admin_territory" || $key == "royalty_collection_territory" || $key == "publishing_admin_territory" || $key == "topspin_rate_territory"){ $details = GetTerrName($details, $wrapperObj); $changes = added_removed($fields_before_amendment[$key], $fields_after_amendment[$key]); $new_v = ""; foreach ($changes as $k=>$val){ if($k == 'added' && $changes[$k]){ $new_v .= "Added: ".GetTerrName($val, $wrapperObj)."
"; } if($k == 'removed' && $changes[$k]){ $new_v .= "Removed: ".GetTerrName($val, $wrapperObj)."
"; } } } if($key=="dms_carve_out"){ $details = GetCMName($details, $wrapperObj); $changes = added_removed($fields_before_amendment[$key], $fields_after_amendment[$key]); $new_v = ""; foreach ($changes as $k=>$val){ if($k == 'added' && $changes[$k]){ $new_v .= "Added: ".GetCMName($val, $wrapperObj)."
"; } if($k == 'removed' && $changes[$k]){ $new_v .= "Removed: ".GetCMName($val, $wrapperObj)."
"; } } } if($key=="dms_master_carve_out"){ $details = GetCMMName($details, $wrapperObj); $changes = added_removed($fields_before_amendment[$key], $fields_after_amendment[$key]); $new_v = ""; foreach ($changes as $k=>$val){ if($k == 'added' && $changes[$k]){ $new_v .= "Added: ".GetCMMName($val, $wrapperObj)."
"; } if($k == 'removed' && $changes[$k]){ $new_v .= "Removed: ".GetCMMName($val, $wrapperObj)."
"; } } } if($key=="dist_type"){ if($details){ $details = GetDistName($details, $wrapperObj); // if(!is_array(added_removed($fields_before_amendment[$key], $fields_after_amendment[$key]))){ // echo '------'.$key.'----'.$fields_before_amendment[$key].'------'.$fields_after_amendment[$key].'----'.added_removed($fields_before_amendment[$key], $fields_after_amendment[$key]); // } $changes = added_removed($fields_before_amendment[$key], $fields_after_amendment[$key]); $new_v = ""; if($changes){ foreach ($changes as $k=>$val){ if($k == 'added' && $changes[$k]){ $new_v .= "Added: ".GetDistName($val, $wrapperObj)."
"; } if($k == 'removed' && $changes[$k]){ $new_v .= "Removed: ".GetDistName($val, $wrapperObj)."
"; } } } } } if($key=="orchrep_name"){ $details = getRepName($details, $wrapperObj); $new_v = getRepName($new_v, $wrapperObj); } if($key=="publishing_admin_limit_grant_of_rights"){ $details = GetRightsName($details, $fields_after_amendment['parent_vendor_contract_id'], $wrapperObj); $new_v = GetRightsName($new_v, $fields_after_amendment['parent_vendor_contract_id'], $wrapperObj); } ?>
Deal Point Previously Amended To