function display()
 {
     global $sugar_config, $mod_strings, $app_strings;
     $focus = new ServiceBookings();
     $db = DBManagerFactory::getInstance();
     // ONLY LOAD A RECORD IF A RECORD ID IS GIVEN;
     // A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR
     $record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : '';
     $template = file_get_contents('modules/ServiceBookings/tpls/export.tpl');
     //$sql = "select * from tours where id ='".$record."' and deleted = 0";
     $sql = "\r\n                SELECT\r\n                  srv.code,\r\n                  srv.res_address,\r\n                  srv.attn_res_name,\r\n                  srv.attn_res_phone,\r\n                  srv.res_tel,\r\n                  srv.res_fax,\r\n                  srv.company,\r\n                  srv.assigned_user_id,\r\n                  srv.attn_phone,\r\n                  srv.attn_id,\r\n                  srv.attn_email,\r\n                  srv.attn_tel,\r\n                  srv.attn_fax,\r\n                  srv.nationlity,\r\n                  srv.notes,\r\n                  srv.confirmed,\r\n                  srv.date,\r\n                  srv.deparment,\r\n                  srv.date_time,\r\n                  srv.operating_date,\r\n                  srv.quantity_pax,\r\n                  srv.guide,\r\n                  srv.guide_id,\r\n                  srv.guide_phone,\r\n                  ser.name,\r\n                  ser.code as ser_code,\r\n                  grp.groupprogram_code\r\n                FROM servicebookings srv\r\n                  LEFT JOIN services_sevicebookings_c sersvr\r\n                    ON srv.id = sersvr.services_sb358ookings_idb\r\n                      AND sersvr.deleted = 0\r\n                  LEFT JOIN services ser\r\n                    ON ser.id = sersvr.services_sde2fervices_ida\r\n                      AND ser.deleted = 0\r\n                  LEFT JOIN groupprogravicebookings_c grpsrv\r\n                    ON srv.id = grpsrv.groupprogrf47aookings_idb\r\n                      AND grpsrv.deleted = 0\r\n                  LEFT JOIN groupprograms grp\r\n                    ON grpsrv.groupprogr0d2frograms_ida = grp.id\r\n                      AND grp.deleted = 0\r\n                WHERE srv.deleted = 0\r\n                    AND srv.id = '" . $record . "'\r\n            ";
     $result = $db->query($sql);
     $row = $db->fetchByAssoc($result);
     $template = str_replace("{LBL_TO}", $mod_strings['LBL_TO'], $template);
     $template = str_replace("{LBL_RES_ADDRESS}", $mod_strings['LBL_RES_ADDRESS'], $template);
     $template = str_replace("{LBL_ATTN_RES_NAME}", $mod_strings['LBL_ATTN_RES_NAME'], $template);
     $template = str_replace("{LBL_RES_TEL}", $mod_strings['LBL_RES_TEL'], $template);
     $template = str_replace("{LBL_RES_FAX}", $mod_strings['LBL_RES_FAX'], $template);
     $template = str_replace("{LBL_FROM}", $mod_strings['LBL_FROM'], $template);
     $template = str_replace("{LBL_ATTN_NAME}", $mod_strings['LBL_ATTN_NAME'], $template);
     $template = str_replace("{LBL_EMAIL}", $mod_strings['LBL_EMAIL'], $template);
     $template = str_replace("{LBL_ATTN_PHONE}", $mod_strings['LBL_ATTN_PHONE'], $template);
     $template = str_replace("{LBL_FAX}", $mod_strings['LBL_FAX'], $template);
     $template = str_replace("{LBL_TITLE}", $mod_strings['LBL_TITLE'], $template);
     $template = str_replace("{LBL_OPERATING_DATE}", $mod_strings['LBL_OPERATING_DATE'], $template);
     $template = str_replace("{LBL_MADE_TOUR}", $mod_strings['LBL_MADE_TOUR'], $template);
     $template = str_replace("{LBL_NATIONLITY}", $mod_strings['LBL_NATIONLITY'], $template);
     $template = str_replace("{LBL_QUANTITY_PAX}", $mod_strings['LBL_QUANTITY_PAX'], $template);
     $template = str_replace("{LBL_GUIDE}", $mod_strings['LBL_GUIDE'], $template);
     $template = str_replace("{LBL_SERVICE}", $mod_strings['LBL_SERVICE'], $template);
     $template = str_replace("{LBL_QUANTITY}", $mod_strings['LBL_QUANTITY'], $template);
     $template = str_replace("{LBL_UNITPRICE}", $mod_strings['LBL_UNITPRICE'], $template);
     $template = str_replace("{LBL_MENU}", $mod_strings['LBL_MENU'], $template);
     $template = str_replace("{LBL_NOTICE}", $mod_strings['LBL_NOTICE'], $template);
     $template = str_replace("{LBL_CONFIRM_SERVICE}", $mod_strings['LBL_CONFIRM_SERVICE'], $template);
     $template = str_replace("{LBL_DATE}", $mod_strings['LBL_DATE'], $template);
     $template = str_replace("{LBL_CONFIRM_CARNIVAL}", $mod_strings['LBL_CONFIRM_CARNIVAL'], $template);
     /////////////
     $template = str_replace("{SITE_URL}", $sugar_config['site_url'], $template);
     $template = str_replace("{RES}", $row['name'], $template);
     $template = str_replace("{ADDRESS}", $row['res_address'], $template);
     $template = str_replace("{ATTN_RES_NAME}", $row['attn_res_name'], $template);
     $template = str_replace("{ATTN_RES_PHONE}", $row['attn_res_phone'], $template);
     $template = str_replace("{RES_TEL}", $row['res_tel'], $template);
     $template = str_replace("{RES_FAX}", $row['res_fax'], $template);
     $template = str_replace("{FROM}", $row['company'], $template);
     //$template = str_replace("{ATTN_NAME}", $row['attn_name'],$template );
     $user = new User();
     $user->retrieve($row['assigned_user_id']);
     $template = str_replace("{ATTN_NAME}", $user->name, $template);
     $template = str_replace("{ATTN_PHONE}", $row['attn_phone'], $template);
     $template = str_replace("{ATTN_EMAIL}", $row['attn_email'], $template);
     $template = str_replace("{TEL}", $row['attn_tel'], $template);
     $template = str_replace("{FAX}", $row['attn_fax'], $template);
     $template = str_replace("{DATE_TIME}", $row['date_time'], $template);
     $template = str_replace("{OPERATING_DATE}", $row['operating_date'], $template);
     $template = str_replace("{QUANTITY_PAX}", $row['quantity_pax'], $template);
     $template = str_replace("{GUIDE}", $row['guide'], $template);
     $template = str_replace("{GUIDE_PHONE}", $row['guide_phone'], $template);
     $template = str_replace("{MADETOUR}", $row['groupprogram_code'], $template);
     if (!empty($row['nationlity'])) {
         $template = str_replace("{NATIONLITY}", translate('countries_dom', '', $row['nationlity']), $template);
     } else {
         $template = str_replace("{NATIONLITY}", "", $template);
     }
     $template = str_replace("{BOOKINGLINE}", $focus->get_servicebooking_detailview($record), $template);
     $template = str_replace("{NOTES}", html_entity_decode(nl2br($row['notes'])), $template);
     if ($row['confirmed'] == 0) {
         $template = str_replace("{CONFIRM}", 'No', $template);
     } else {
         $template = str_replace("{CONFIRM}", 'Yes', $template);
     }
     $template = str_replace("{DATE}", date("d/m/Y", strtotime($row['date'])), $template);
     $template = str_replace("{DEPARMENT}", $row['deparment'], $template);
     $size = strlen($template);
     $filename = "Service_Booking_" . $row['code'] . "_To_" . $row['ser_code'] . ".doc";
     ob_end_clean();
     header("Cache-Control: private");
     header("Content-Type: application/force-download;");
     header("Content-Disposition:attachment; filename=\"{$filename}\"");
     header("Content-length:{$size}");
     echo $template;
     ob_flush();
 }
Example #2
0
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
require_once 'modules/ServiceBookings/ServiceBookings.php';
require_once 'modules/ServiceBookings/Forms.php';
require_once 'data/Tracker.php';
require_once 'modules/Releases/Release.php';
global $db;
global $app_strings;
global $mod_strings;
global $mod_strings;
global $current_user;
global $sugar_version, $sugar_config, $app_list_strings;
$focus = new ServiceBookings();
$seedRelease = new Release();
$json = getJSONobj();
$ss = new Sugar_Smarty();
if (isset($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $focus->id = "";
    $focus->number = "";
}
// BUILD MODULE TITLE LINE
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_ID'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true);
echo "\n</p>\n";
global $theme;
Example #3
0
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
require_once 'modules/ServiceBookings/ServiceBookings.php';
require_once 'include/formbase.php';
require_once 'modules/ServiceBookingsLine/ServiceBookingsLine.php';
include "config.php";
global $sugar_config, $mod_strings;
$focus = new ServiceBookings();
$focus->retrieve($_POST['record']);
if (!$focus->ACLAccess('Save')) {
    ACLController::displayNoAccess(true);
    sugar_cleanup(true);
}
if (!empty($_POST['assigned_user_id']) && $focus->assigned_user_id != $_POST['assigned_user_id'] && $_POST['assigned_user_id'] != $current_user->id) {
    $check_notify = TRUE;
} else {
    $check_notify = FALSE;
}
foreach ($focus->column_fields as $field) {
    if (isset($_POST[$field])) {
        $value = $_POST[$field];
        $focus->{$field} = $value;
    }
}
foreach ($focus->additional_column_fields as $field) {
    if (isset($_POST[$field])) {
        $value = $_POST[$field];
        $focus->{$field} = $value;
 function createServiceBooking($bean, $dichvu = '')
 {
     global $db;
     $sql = "\r\n            SELECT \r\n              a.id \r\n            FROM\r\n              `servicebookings` a \r\n              JOIN `services_sevicebookings_c` b \r\n                ON a.`id` = b.`services_sb358ookings_idb` \r\n                AND b.`deleted` = 0 \r\n                AND b.`services_sde2fervices_ida` = '{$dichvu->services_name}' \r\n              JOIN `groupprogravicebookings_c` c \r\n                ON c.`groupprogrf47aookings_idb` = a.`id` \r\n                AND c.`deleted` = 0 \r\n                AND c.`groupprogr0d2frograms_ida` = '{$bean->id}' \r\n            WHERE a.`deleted` = 0  \r\n            ";
     $ServiceBooking = new ServiceBookings();
     $result = $db->query($sql);
     while ($row = $db->fetchByAssoc($result)) {
         $ServiceBooking->id = $row['id'];
     }
     $ServiceBooking->groupprograebookings_name = $bean->groupprogram_code;
     $ServiceBooking->groupprogr0d2frograms_ida = $bean->id;
     $service = new Services();
     $service->retrieve($dichvu->services_name);
     $ServiceBooking->services_sde2fervices_ida = $service->id;
     $ServiceBooking->services_seebookings_name = $service->name;
     $ServiceBooking->res_address = $service->address;
     $ServiceBooking->res_tel = $service->tel;
     $ServiceBooking->res_fax = $service->fax;
     $ServiceBooking->confirm = 0;
     $ServiceBooking->name = 'Service Bookings To ' . $service->name;
     $ServiceBooking->assigned_user_name = $bean->assigned_user_name;
     $ServiceBooking->assigned_user_id = $bean->assigned_user_id;
     $return = $ServiceBooking->save();
     return $return;
 }