138 lines
4.1 KiB
PHP
138 lines
4.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
//error_reporting(E_ALL);
|
||
|
|
$json = getJSONobj();
|
||
|
|
|
||
|
|
$pll = $sll = $ill = array();
|
||
|
|
$p = $s = $i = 0;
|
||
|
|
|
||
|
|
while (isset($_POST['p_' . $p])) {
|
||
|
|
$pll[] = $json->decode(htmlspecialchars_decode($_POST['p_' . $p]));
|
||
|
|
$_POST['p_' . $p] = '';
|
||
|
|
$p++;
|
||
|
|
}
|
||
|
|
|
||
|
|
while (isset($_POST['s_' . $s])) {
|
||
|
|
$sll[] = $json->decode(htmlspecialchars_decode($_POST['s_' . $s]));
|
||
|
|
$_POST['s_' . $s] = '';
|
||
|
|
$s++;
|
||
|
|
}
|
||
|
|
|
||
|
|
while (isset($_POST['i_' . $i])) {
|
||
|
|
$ill[] = $json->decode(htmlspecialchars_decode($_POST['i_' . $i]));
|
||
|
|
$_POST['i_' . $i] = '';
|
||
|
|
$i++;
|
||
|
|
}
|
||
|
|
|
||
|
|
$_POST = $json->decode(htmlspecialchars_decode($_POST['otherFormData']));
|
||
|
|
|
||
|
|
$_POST['position_list'] = $pll;
|
||
|
|
$_POST['services_list'] = $sll;
|
||
|
|
$_POST['income_list'] = $ill;
|
||
|
|
|
||
|
|
//var_export($pll);
|
||
|
|
//var_export($sll);
|
||
|
|
//var_export($ill);
|
||
|
|
//var_export($_POST);
|
||
|
|
//var_export($_REQUEST);
|
||
|
|
//echo PHP_EOL . 'Done!';
|
||
|
|
//return;
|
||
|
|
|
||
|
|
if (isset($_REQUEST['record']) && $_REQUEST['record'] != '' && $_REQUEST['cache'] != "fromJava") {
|
||
|
|
if (isset($_REQUEST['newWindow']) && $_REQUEST['newWindow'] == '1') {
|
||
|
|
$_REQUEST['newWindow'] = 0;
|
||
|
|
|
||
|
|
$styleString =
|
||
|
|
'
|
||
|
|
<style type="text/css">
|
||
|
|
html, body, div, table, p, ul, li, a, form, input, label { margin: 0px; padding: 0px; }
|
||
|
|
</style>
|
||
|
|
';
|
||
|
|
|
||
|
|
$iframeString =
|
||
|
|
'
|
||
|
|
<iframe style="border: none; width:100%; height: 100%;" frameborder="no" src="index.php?module=EcmServices&action=previewPDF&to_pdf=1&method=I&type=' . $_GET['type'] . 'record="' . $_GET['record'] . '"#toolbar=0&zoom=80%">
|
||
|
|
Yours browser not accept iframes!
|
||
|
|
</iframe>
|
||
|
|
';
|
||
|
|
|
||
|
|
echo $styleString;
|
||
|
|
echo $iframeString;
|
||
|
|
} else {
|
||
|
|
require_once("modules/EcmServices/EcmService.php");
|
||
|
|
$focus = new EcmService();
|
||
|
|
|
||
|
|
$method = (isset($_REQUEST['method']) && $_REQUEST['method'] != '') ? $_REQUEST['method'] : 'D';
|
||
|
|
$focus->getPDF($_REQUEST['record'], $method);
|
||
|
|
}
|
||
|
|
} else if ($_REQUEST['cache'] == "fromJava" && $_GET['from'] != "EcmServices") {
|
||
|
|
|
||
|
|
$_SESSION['PDF_ECMSERVICES'] = $_POST;
|
||
|
|
|
||
|
|
//echo '<pre>1:dump:session:' . var_export($_SESSION['PDF_ECMSERVICES'], true) . PHP_EOL;
|
||
|
|
//return;
|
||
|
|
|
||
|
|
} else if ($_GET['from'] == "EcmServices") {
|
||
|
|
require_once("modules/EcmServices/EcmService.php");
|
||
|
|
|
||
|
|
$focus = new EcmService();
|
||
|
|
|
||
|
|
if (isset($_SESSION['PDF_ECMSERVICES']['record']) && $_SESSION['PDF_ECMSERVICES']['record'] != '') {
|
||
|
|
|
||
|
|
$focus->retrieve($_SESSION['PDF_ECMSERVICES']['record']);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!$focus->ACLAccess('Save')) {
|
||
|
|
|
||
|
|
ACLController::displayNoAccess(true);
|
||
|
|
|
||
|
|
sugar_cleanup(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
foreach ($focus->column_fields as $field) {
|
||
|
|
|
||
|
|
if (isset($_SESSION['PDF_ECMSERVICES'][$field])) {
|
||
|
|
|
||
|
|
$value = $_SESSION['PDF_ECMSERVICES'][$field];
|
||
|
|
|
||
|
|
$focus->$field = $value;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
foreach ($focus->additional_column_fields as $field) {
|
||
|
|
|
||
|
|
if (isset($_SESSION['PDF_ECMSERVICES'][$field])) {
|
||
|
|
|
||
|
|
$value = $_SESSION['PDF_ECMSERVICES'][$field];
|
||
|
|
|
||
|
|
$focus->$field = $value;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if (isset($_SESSION['PDF_ECMSERVICES']['to_is_vat_free']) && $_SESSION['PDF_ECMSERVICES']['to_is_vat_free'])
|
||
|
|
$focus->to_is_vat_free = 1; else
|
||
|
|
$focus->to_is_vat_free = 0;
|
||
|
|
|
||
|
|
$json = getJSONobj();
|
||
|
|
|
||
|
|
$pl = $_SESSION['PDF_ECMSERVICES']['position_list'];
|
||
|
|
$sl = $_SESSION['PDF_ECMSERVICES']['services_list'];
|
||
|
|
$il = $_SESSION['PDF_ECMSERVICES']['income_list'];
|
||
|
|
|
||
|
|
$focus->position_list = $pl;
|
||
|
|
$focus->services_list = $sl;
|
||
|
|
$focus->income_list = $il;
|
||
|
|
|
||
|
|
$focus->document_no = $_SESSION['PDF_ECMSERVICES']['document_no'];
|
||
|
|
|
||
|
|
$focus->ecmpaymentcondition_text = EcmService::getTranslation('EcmPaymentConditions', $focus->ecmpaymentcondition_id, $focus->ecmlanguage);
|
||
|
|
$focus->ecmdeliverycondition_text = EcmService::getTranslation('EcmDeliveryConditions', $focus->ecmdeliverycondition_id, $focus->ecmlanguage);
|
||
|
|
|
||
|
|
//echo 'tid => ' . $focus->template_id;
|
||
|
|
//return;
|
||
|
|
//echo '<pre>2:dump:session:' . var_export($_SESSION['PDF_ECMSERVICES'], true) . PHP_EOL;
|
||
|
|
//return;
|
||
|
|
|
||
|
|
$focus->getPDF();
|
||
|
|
}
|
||
|
|
?>
|