This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,402 @@
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function setSelectionRange(obj) {
if(obj && typeof(obj) == "object" && (obj.type == "text" || obj.type == "textarea")) {
if(obj.createTextRange) {
var range = obj.createTextRange();
range.moveStart("character", 0);
range.moveEnd("character", obj.value.lengh-1);
range.select();
} else {
if(obj.setSelectionRange) {
obj.setSelectionRange(0,obj.value.length);
}
}
obj.focus();
}
if(obj && typeof(obj) == "object" && obj.options) { obj.focus(); }
}
var AjaxSearchItems;
function AjaxSearch(div,displayNone) {
//fields
this.parentDIV = div; //pole w ktorym zawiera sie pole wyszukiwania
this.div; //pole glowne wyszukiwania
this.inputSearch; //input wyszukiwania
this.timeout; //wskaznik zwracany przez setTimeout przy wcisnieciu klawisza
this.searchDelay = 800; //opoznienie wyszukiwania
this.divList; //pole w ktorym wyswietlana bedzie lista znalezionnych elementow
this.ajaxSearchItem; //unikalny identyfikator;
this.module = 'EcmKpkw';
this.inputCode;
this.positionSelected;
//functions
this.setInputCode = function(input) {
this.inputCode = input;
this.inputCode.previousCode = this.inputCode.value;
}
this.inputSearchOnKeyDown = function(e,other) {
var keynum;
if(typeof(e) == "number")
keynum = e;
else {
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
}
if(keynum == 38) { this.selectPreviousPosition(); return false; }
if(keynum == 40) { this.selectNextPosition(); return false; }
if(keynum == 13 || keynum == 9) { this.inputSearchEnterPressed(other); return false; }
if(keynum == 27) { this.div.style.display = 'none'; }
if(this.timeout) { clearTimeout(this.timeout); this.timeout = null; }
this.timeout = setTimeout("document.getElementById('"+this.div.id+"').AjaxSearch.search();", 500);
}
this.inputSearchEnterPressed = function(other) {
if(this.positionSelected) {
var row;
if(N.selectedRow) {
N.selectedRow.setData(this.positionSelected.positionData);
row = N.selectedRow;
}
else {
row = N.addRow().setData(this.positionSelected.positionData);
}
row.calculateTotal();
if((other && other == "clear") || OPT['quick_product_item_adding']==0) {
this.clearList();
this.div.style.display = 'none';
if(OPT['quick_product_item_adding'] == 0) if(N.selectedCell && N.selectedCell.index == 1) N.selectedCell.selectNext();
} else {
row.noHideASP = true;
if(N.selectedRow) row = row.myTable.addRow(row.index+1);
row.select();
row.cells.item(0).select();
setSelectionRange(this.inputSearch);
}
}
else if(N.selectedRow) {
if(this.inputSearch.value != this.inputCode.previousCode || this.inputCode.previousCode == '') {
var data = new Object();
N.selectedRow.setData(data);
N.selectedRow.cells.item(1).select();
}
}
//N.addRow();
}
this.selectNextPosition = function() {
if(this.positionSelected) {
if(this.positionSelected.nextSibling) {
this.positionSelect(this.positionSelected.nextSibling);
return;
}
}
this.positionSelect(this.divList.lastChild);
}
this.selectPreviousPosition = function() {
if(this.positionSelected) {
if(this.positionSelected.previousSibling) {
this.positionSelect(this.positionSelected.previousSibling);
return;
}
}
this.positionSelect(this.divList.firstChild);
}
this.search = function() {
if(this.inputSearch.value == '') { this.clearList(); return; }
var _ajax_search_process_search_ = this;
this.Display = function(result) { _ajax_search_process_search_.processSearch(result.responseText); }
this.Fail = function(result) { alert(result.responseText); }
YAHOO.util.Connect.asyncRequest('POST','index.php',{success:this.Display,failure:this.Fail},'module='+this.module+'&action=AjaxSearchQuery&to_pdf=1&as_inputSearch='+this.inputSearch.value+'&stock_id='+document.forms.EditView.stock_id.value);
}
this.processSearch = function(result) {
this.clearList();
var list = eval(result);
if(typeof(list) != "object") return;
this.fillList(list);
}
this.clearList = function() {
this.divList.innerHTML = '';
this.divList.style.height = '';
this.positionDeselect();
}
this.fillList = function(list) {
for(x in list) {
this.addPosition(list[x]);
}
this.positionSelect();
this.setScrolls();
}
this.setScrolls = function() {
var clientH = -1;
if(window.innerHeight && window.innerHeight > 0) clientH = window.innerHeight;
else if(document.documentElement && document.documentElement.clientHeight > 0) clientH = document.documentElement.clientHeight;
else if(document.body && document.body.clientHeight > 0) clientH = document.body.clientHeight;
var XY = YAHOO.util.Dom.getXY(this.div);
var divTop = (XY[1]+this.div.offsetHeight);
if((divTop - (clientH+document.body.scrollTop)) > 0) {
var newPos = divTop-clientH;
document.body.scrollTop = newPos;
}
}
this.positionSelect = function(div,noScroll) {
if(!div) {
if(!this.positionSelected) {
if(this.divList.firstChild) this.positionSelect(this.divList.firstChild);
}
return;
}
this.positionDeselect();
div.className = 'AjaxSearchPositionDivSelected';
this.positionSelected = div;
if(!noScroll) this.divList.scrollTop = div.offsetTop;
}
this.positionDeselect = function() {
if(this.positionSelected) {
this.positionSelected.className = '';
this.positionSelected = null;
}
}
this.addPosition = function(list) {
if(typeof(list.code) == "undefined") return;
var position = document.createElement('div');
position.positionData = list;
position.onclick = function() { this.parentNode.AjaxSearch.inputSearchEnterPressed(this); }
position.onmouseover = function() { this.parentNode.AjaxSearch.positionSelect(this,true); };
position.innerHTML = '<table width="100%" class="AjaxSearchPositionTable"><tr><td class="AjaxSearchPositionTableCode">'+this.markElement(list['code'])+'</td><td align="right" class="AjaxSearchPositionTablePrice">'+list['stock']+'</b></td></tr><tr><td colspan="2" class="AjaxSearchPositionTableName">'+this.markElement(list['name'])+'</td></tr></table>';
this.divList.appendChild(position);
if((position.offsetTop+position.offsetHeight) > 300) this.divList.style.height = '300px'; else this.divList.style.height = '';
}
this.markElement = function(str) {
var s = "("+this.inputSearch.value+")";
var regExp = new RegExp(s,'gi');
return str.replace(regExp,"<b>$1</b>");
}
this.AjaxSearchFrozen = false;
this.AjaxSearchGetSettings = function () {
var AjaxSearchToReq = this;
YAHOO.util.Connect.asyncRequest(
'POST',
'index.php',
{
success: function(response) {
if(response.responseText) {
var str = response.responseText;
var obj = eval(str);
if(obj && obj[0]) {
obj = obj[0];
//if(obj.frozen) {
AjaxSearchToReq.div.style.left = obj.pos_left;
AjaxSearchToReq.div.style.top = obj.pos_top;
AjaxSearchToReq.AjaxSearchFrozen = !(obj.frozen == "true" ? true : false);
AjaxSearchToReq.AjaxSearchFreezePosition(true);
//}
}
}
},
failure: function(response) {}
},
'module=Home&action=EcmAjaxSearchSettings&function=GetSettings&to_pdf=1&from_module='+this.module
);
}
this.AjaxSearchSaveSettings = function () {
YAHOO.util.Connect.asyncRequest(
'POST',
'index.php',
{
success: function(response) {},
failure: function(response) {}
},
'module=Home&action=EcmAjaxSearchSettings&function=SaveSettings&to_pdf=1&from_module='+this.module+'&pos_top='+this.div.style.top+'&pos_left='+this.div.style.left+'&frozen='+this.AjaxSearchFrozen
);
}
this.AjaxSearchFreezePosition = function (dontSave) {
var img = document.getElementById('AjaxSearchPin');
if(this.AjaxSearchFrozen) {
img.src='modules/'+this.module+'/AjaxSearch/AjaxSearchPinOff.gif';
this.AjaxSearchFrozen = false;
} else {
img.src='modules/'+this.module+'/AjaxSearch/AjaxSearchPinOn.gif';
this.AjaxSearchFrozen = true;
}
if(!dontSave) this.AjaxSearchSaveSettings();
}
this.createForm = function() {
/*
var div = document.createElement('div');
div.className = 'AjaxSearch';
div.AjaxSearch = this;
*/
var tmp = document.createElement('div');
var div = "<div></div>";
tmp.innerHTML = div;
div = tmp.firstChild;
div.className = 'AjaxSearch';
div.AjaxSearch = this;
div.onMouseMoveEvent = function(ev) {
if(!this.isOnMouseDown) return;
ev = ev || window.event;
var x = 0; var y = 0;
if(ev.pageX || ev.pageY) {
x = ev.pageX;
y = ev.pageY;
} else {
x = ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y = ev.clientY + document.body.scrollTop - document.body.clientTop
}
this.style.left = x-this.MouseX;
this.style.top = y-this.MouseY;
}
div.onMouseDownEvent = function(ev) {
if(this.noDrag) { this.noDrag = false; return; }
ev = ev || window.event;
var x = 0; var y = 0;
if(ev.pageX || ev.pageY) {
x = ev.pageX;
y = ev.pageY;
} else {
x = ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y = ev.clientY + document.body.scrollTop - document.body.clientTop
}
this.MouseX = x-this.offsetLeft;
this.MouseY = y-this.offsetTop;
this.isOnMouseDown = true;
this.style.cursor = 'move';
}
div.onmouseup = function() {
this.isOnMouseDown = false;
this.style.cursor = '';
//this.AjaxSearch.AjaxSearchSaveSettings();
}
//div.onmouseout = function() { this.onmouseup(); }
ddiv = document.createElement('div');
ddiv.id = 'AjaxSearch_ddiv';
ddiv.className = 'AjaxSearch_ddiv';
ddiv.appendChild(document.createTextNode('Search Product:'));
ddiv.appendChild(document.createElement('br'));
div.appendChild(ddiv);
/*
var inputSearch = document.createElement('input');
inputSearch.type = 'text';
inputSearch.id = 'as_inputSearch';
inputSearch.className = 'AjaxSearchInputSearch';
inputSearch.AjaxSearch = this;
inputSearch.onkeydown = this.inputSearchOnKeyDown;
this.inputSearch = inputSearch;
div.appendChild(inputSearch);
*/
var img = '<img src="modules/'+this.module+'/AjaxSearch/AjaxSearchPinOff.gif" id="AjaxSearchPin" class="AjaxSearchPin" onclick="this.parentNode.AjaxSearch.AjaxSearchFreezePosition();" />';
img += '<img src="modules/'+this.module+'/AjaxSearch/AjaxSearchCloseIcon.gif" class="AjaxSearchCloseIcon" onclick="this.parentNode.AjaxSearch.inputSearchOnKeyDown(27);" />';
div.innerHTML += img;
var inputSearch = '<input type="text" id="as_inputSearch" class="AjaxSearchInputSearch" onKeyDown="return this.AjaxSearch.inputSearchOnKeyDown(event);">';
div.innerHTML = div.innerHTML + inputSearch;
this.inputSearch = div.lastChild;
this.inputSearch.AjaxSearch = this;
this.inputSearch.onmousedown = function() { this.parentNode.noDrag = true; }
div.appendChild(document.createElement('br'));
div.appendChild(document.createElement('br'));
/*
div.appendChild(document.createTextNode('List:'));
var separator = document.createElement('hr');
separator.className = 'AjaxSearchSeparator';
div.appendChild(separator);
*/
var divList = document.createElement('div');
divList.id = 'as_divList';
divList.className = 'AjaxSearchDivList';
divList.AjaxSearch = this;
this.divList = divList;
divList.onmousedown = function() { this.parentNode.noDrag = true; }
div.appendChild(divList);
var tmpDiv = document.createElement('div');
tmpDiv.style.height = '10px';
div.appendChild(tmpDiv);
this.parentDIV.appendChild(div);
this.div = div;
}
this.KeyDown = function(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
}
//constructor
if(AjaxSearchItems) {
if(typeof(AjaxSearchItems) == "number")
AjaxSearchItem++;
else
AjaxSearchItem = 0;
this.ajaxSearchItem = AjaxSearchItem;
}
this.createForm();
this.div.AjaxSearch = this;
this.div.id = 'AjaxSearch_'+this.AjaxSearchItem;
var AjaxSearch_draganddrop = new YAHOO.util.DD(this.div.id);
AjaxSearch_draganddrop.AjaxSearch = this;
AjaxSearch_draganddrop.endDrag = function(e) {
this.AjaxSearch.AjaxSearchSaveSettings();
};
AjaxSearch_draganddrop.setHandleElId("AjaxSearch_ddiv");
this.div.style.left = (screen.availWidth - this.div.offsetWidth) / 2;
this.div.style.top = (screen.availHeight - this.div.offsetHeight) / 2;
if(displayNone == true) this.div.style.display = 'none';
this.AjaxSearchGetSettings();
};

View File

@@ -0,0 +1,8 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
?>

View File

@@ -0,0 +1,142 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
if(isset($_REQUEST['as_inputSearch']) && $_REQUEST['as_inputSearch'] != '') {
$AS_INPUTSEARCH = strtoupper($_REQUEST['as_inputSearch']);
$stock_id = $_REQUEST['stock_id'];
$language_translate = array(
'en_us' => 'en',
'ge_ge' => 'de',
'pl_pl' => 'pl'
);
if(isset($_REQUEST['ecmlanguage']) && $_REQUEST['ecmlanguage'] != '') {
if(isset($language_translate[$_REQUEST['ecmlanguage']]) && $language_translate[$_REQUEST['ecmlanguage']] != '') {
//$use_language = $language_translate[$_REQUEST['ecmlanguage']];
}
}
$query = "SELECT DISTINCT";
$query .= " `pr`.`id`";
$query .= ", `pr`.`index_dbf`";
$query .= ", `pr`.`unit_name` as unit_name";
$query .= ", `pr`.`name`";
$query .= ", `pr`.`selling_price`";
$query .= ", `pr`.`purchase_price`";
$query .= ", `pr`.`srp_price`";
$query .= ", `pr`.`fob_price`";
$query .= ", `pr`.`vat_id`";
$query .= ", `pr`.`vat_name`";
$query .= ", `pr`.`vat_value`";
$query .= ", `pr`.`exchange_rate_id` as `currency_id`";
$query .= ", `pr`.`product_category_id` as `category_id`";
$query .= ", `pr`.`usage_unit_id` as `unit_id`";
// $query .= ", `pr`.`type` as `type`";
if(isset($use_language)) {
$query .= ", `pr_lang`.`short_description`";
$query .= ", `pr_lang`.`long_description`";
}
$query .= " FROM";
$query .= " `ecmproducts` as `pr`";
if(isset($use_language))
$query .= " RIGHT JOIN `ecmproduct_language_".$use_language."_view` as `pr_lang` ON `pr`.`id` = `pr_lang`.`ecmproduct_id`";
$query .= " WHERE";
$query .= "(";
$query .= "UPPER(`pr`.`index_dbf`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr`.`index_dbf`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`index_dbf`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`name`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr`.`name`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`name`) LIKE '%$AS_INPUTSEARCH%'";
if(isset($use_language)) {
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '$AS_INPUTSEARCH%'";
}
$query .= ")";
$query .= " AND `pr`.`deleted`='0' LIMIT 0,25";
$result = $GLOBALS['db']->query($query);
global $sugar_config;
global $app_list_strings;
$defaultCurrency = $sugar_config['default_currency_symbol'];
$currencies = array ( -99 => $defaultCurrency );
$arr = array();
include_once("modules/EcmStockOperations/EcmStockOperation.php");
$op=new EcmStockOperation();
if($result)
while($row = $GLOBALS['db']->fetchByAssoc($result)) {
//$row['unit_id']=$row['unit_name'];
$lv=return_app_list_strings_language($_REQUEST['ecmlanguage']);
$row['unit_name']=$row['unit_name'];
$row['stock'] = $op->getStock($row['id'], $stock_id);
$row['temp_item_id']=create_guid();
$row['temp_date']=date("Y-m-d H:i:s");
$row['price'] = $row['selling_price'];
$row['purchase_price'] = format_number($row['purchase_price']);
$row['selling_price'] = format_number($row['selling_price']);
/*
if(array_key_exists($row['currency_id'],$currencies))
$row['currency_symbol'] = $currencies[$row['currency_id']];
else {
$query = "SELECT symbol FROM currencies WHERE id='".$row['currency_id']."' AND deleted=0;";
$result2 = $GLOBALS['db']->query($query);
if($result2) {
$row2 = $GLOBALS['db']->fetchByAssoc($result2);
if($row2) {
$currencies[$id] = $row2['symbol'];
$row['currency_symbol'] = $row2['symbol'];
} else $row['currency_symbol'] = '';
} else $row['currency_symbol'] = '';
}
if(isset($use_language)) {
if(strpos(strtoupper($row['short_description']), $AS_INPUTSEARCH) !== false)
$row['name'] = $row['short_description'];
else
if(strpos(strtoupper($row['short_description']), $AS_INPUTSEARCH) !== false)
$row['name'] = $row['short_description'];
else
if(strpos(strtoupper($row['name']), $AS_INPUTSEARCH) === false || strpos(strtoupper($row['code']), $AS_INPUTSEARCH) !== false) {
if(isset($row['short_description']) && $row['short_description'] != '')
$row['name'] = $row['short_description'];
else
if(isset($row['short_description']) && $row['short_description'] != '')
$row['name'] = $row['short_description'];
}
unset($row['short_description'], $row['short_description']);
}
*/
$row['code'] = $row['index_dbf'];
$arr[] = $row;
}
//echo $query; return;
if(count($arr) > 0) {
$json = getJSONobj();
echo str_replace("&quot;", '\"', $json->encode($arr));
}
}
?>

View File

@@ -0,0 +1,87 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Deletes an Account record and then redirects the browser to the
* defined return URL.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $mod_strings;
if(!isset($_REQUEST['record']))
sugar_die($mod_strings['ERR_DELETE_RECORD']);
$focus = new EcmKpkw();
$focus->retrieve($_REQUEST['record']);
if(!$focus->ACLAccess('Delete')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if (isset($_REQUEST['object']) && $_REQUEST['object']="ecmkpkwrevision") {
//delete ecmkpkw revision.
$focus = new EcmKpkwRevision();
UploadFile::unlink_file($_REQUEST['revision_id'],$_REQUEST['filename']);
} else {
//delete ecmkpkw and its revisions.
$focus = new EcmKpkw();
$focus->retrieve($_REQUEST['record']);
$focus->load_relationships('revisions');
$revisions= $focus->get_linked_beans('revisions','EcmKpkwRevision');
if (!empty($revisions) && is_array($revisions)) {
foreach($revisions as $key=>$thisversion) {
UploadFile::unlink_file($thisversion->id,$thisversion->filename);
//mark the version deleted.
$thisversion->mark_deleted($thisversion->id);
}
}
}
$focus->mark_deleted($_REQUEST['record']);
header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']);
?>

View File

@@ -0,0 +1,187 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
goto jumphax;
//require_once('modules/EcmGroupKpkw/HeaderMenu.php');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once('modules/EcmKpkw/EcmKpkw.php');
// require_once('modules/EcmKpkw/Forms.php');
require_once('include/json_config.php');
$json_config = new json_config();
$file = 'modules/EcmGroupKpkw/EcmGroupKpkw.php';
if (file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupKpkw::loadSettings();
}
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height'] * $OPT['rows_on_item_list'] + 40 + $OPT['rows_on_item_list'] * 4;
jumphax:
$focus = new EcmKpkw();
if (isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
// if($focus->total == '')
// $focus->total = '0';
// if($focus->subtotal == '')
// $focus->subtotal = '0';
// $focus->format_all_fields();
// if (isset($_REQUEST['status']) && $_REQUEST['status'] != '') {
// $focus->doNotAccepted();
// }
/*
echo '<pre>PL:' . var_export($focus->getPositionList(true), true) . PHP_EOL;
echo '<pre>PL:' . var_export($focus->getKpkwPositionList(true), true) . PHP_EOL;
echo '<pre>PL:' . var_export($focus->getIncomePositionList(true), true) . PHP_EOL;
exit;
*/
// $focus->position_list = str_replace('&quot;', '\"', $focus->getPositionList());
// $focus->Kpkw_list = str_replace('&quot;', '\"', $focus->getKpkwPositionList());
// $focus->income_list = str_replace('&quot;', '\"', $focus->getIncomePositionList());
$OPT['status'] = $focus->status;
} else {
$OPT['new_number'] = true;
$datef = $current_user->getPreference('datef');
if ($datef != '')
$sugar_config['datef'];
$focus->register_date = date($datef);
$focus->payment_date = date($datef, mktime() + 30 * 24 * 60 * 60);
$focus->sell_date = date($datef);
}
//if access 'Delete' is avaible for user than he is Manager and he can confirm Quotes.
$OPT['user']['access']['send_email'] = $focus->ACLAccess("send_email");
if (isset($_REQUEST['send_email']) && $_REQUEST['send_email'] == '1')
$OPT['setTab'] = 'EMAIL';
$tmp = $current_user->getPreference('num_grp_sep');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_number_grouping_seperator'];
$OPT['sep_1000'] = $tmp;
$tmp = $current_user->getPreference('dec_sep');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_decimal_seperator'];
$OPT['dec_sep'] = $tmp;
$tmp = $current_user->getPreference('default_currency_significant_digits');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_currency_significant_digits'];
$OPT['dec_len'] = $tmp;
$OPT['default_unit'] = "1";
$OPT['default_vat'] = "23.00";
$OPT['default_category'] = "";
// $OPT['type'] = $focus->type;
// $OPT['to_is_vat_free'] = $focus->to_is_vat_free;
$cq = $current_user->getPreference('confirm_quotes');
$OPT['user']['confirm_quotes'] = ((isset($cq) && $cq) ? 1 : 0);
$json = getJSONobj();
$show_pdf = $current_user->getPreference('show_pdf_in_div');
// if (!isset($show_pdf)) {
// require_once('modules/EcmGroupKpkw/EcmGroupKpkw.php');
// $cc = EcmGroupKpkw::loadSettings();
// $show_pdf = $cc['show_pdf_in_div_global'];
// }
$scriptOpt = '
<script language="javascript">
var SHOW_PDF_IN_DIV =' . $show_pdf . ';
var OPT = ' . str_replace('&quot;', '\"', $json->encode($OPT)) . ';
var MOD = ' . str_replace('&quot;', '\"', $json->encode($mod_strings)) . ';
var N, N2;
</script>
';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmKpkw/views/DetailView/view.detail.my.php');
$edit = new ViewDetailMy();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmKpkw';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
//$edit->bean->total = unformat_number($edit->bean->total);
//$edit->bean->total = format_number($edit->bean->total);
$edit->preDisplay();
// $arr_template = $focus->getTemplateList();
if (isset($focus->template_id))
$edit->ss->assign("DOCUMENT_TEMPLATES_OPTIONS", get_select_options_with_id($arr_template, $focus->template_id));
else
$edit->ss->assign("DOCUMENT_TEMPLATES_OPTIONS", get_select_options_with_id($arr_template, ''));
$focus->history = htmlspecialchars_decode($focus->history) ? : '[]';
//echo '<pre>' . var_export(strlen($focus->history), true) . '</pre>';
//echo '<pre>' . var_export(json_decode($focus->history, true), true) . '</pre>';
$edit->ss->assign('HISTORY', json_decode($focus->history, true));
$btn .= '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmKpkw&action=createPDF&to_pdf=1&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż PDF"></div>';
$edit->ss->assign("CREATE_PDF",$btn);
$edit->ss->assign("POSITION_LIST", $focus->position_list);
$edit->ss->assign("SERVICES_LIST", $focus->Kpkw_list);
$edit->ss->assign("INCOME_LIST", $focus->income_list);
//echo '<pre>P' . var_export($focus->position_list, true) . '</pre>' . PHP_EOL;
//echo '<pre>S' . var_export($focus->Kpkw_list, true) . '</pre>' . PHP_EOL;
//echo '<pre>I' . var_export($focus->income_list, true) . '</pre>' . PHP_EOL;
//exit;
// $edit->ss->assign("EMAIL_LINK", $focus->createSendEmailLink());
// $email_link_tab = '<script language="javascript">YAHOO.util.Event.addListener(window,"load",function(){setEMAIL = function(){' . $focus->createSendEmailLink() . '}});</script>';
$edit->ss->assign("EMAIL_LINK_TAB", $email_link_tab);
$edit->ss->assign("OPT", $OPT);
echo $edit->display();
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($focus, 'EcmKpkw');
echo $subpanel->display();

View File

@@ -0,0 +1,91 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/upload_file.php');
require_once('include/upload_file.php');
class EcmKpkwSoap{
var $upload_file;
function EcmKpkwSoap(){
$this->upload_file = new UploadFile('uploadfile');
}
function saveFile($ecmkpkw, $portal = false){
global $sugar_config;
$focus = new EcmKpkw();
if(!empty($ecmkpkw['id'])){
$focus->retrieve($ecmkpkw['id']);
}else{
return '-1';
}
if(!empty($ecmkpkw['file'])){
$decodedFile = base64_decode($ecmkpkw['file']);
$this->upload_file->set_for_soap($ecmkpkw['filename'], $decodedFile);
$ext_pos = strrpos($this->upload_file->stored_file_name, ".");
$this->upload_file->file_ext = substr($this->upload_file->stored_file_name, $ext_pos + 1);
if (in_array($this->upload_file->file_ext, $sugar_config['upload_badext'])) {
$this->upload_file->stored_file_name .= ".txt";
$this->upload_file->file_ext = "txt";
}
$revision = new EcmKpkwRevision();
$revision->filename = $this->upload_file->get_stored_file_name();
$revision->file_mime_type = $this->upload_file->getMimeSoap($revision->filename);
$revision->file_ext = $this->upload_file->file_ext;
//$revision->ecmkpkw_name = ;
$revision->revision = $ecmkpkw['revision'];
$revision->ecmkpkw_id = $document['id'];
$revision->save();
$focus->ecmkpkw_revision_id = $revision->id;
$focus->save();
$return_id = $revision->id;
$this->upload_file->final_move($revision->id);
}else{
return '-1';
}
return $return_id;
}
}
?>

921
modules/EcmKpkw/EcmKpkw.js Normal file
View File

@@ -0,0 +1,921 @@
function dump()
{
var cos = document.forms.EditView.elements;
for ( foo in cos ){
console.log(cos[foo].name + " = " + cos[foo].value);
}
}
function checkcash(){
var val = document.getElementById('ecmcash_id').value;
url='index.php?module=EcmKpkw&action=getcash&kasa='+val+'&to_pdf=1';
var req=mint.Request();
var wal;
req.OnSuccess = function() {
if (this.responseText == -1) return;
if (this.responseText!=''){
this.responseText = this.responseText.replace('.', ',');
wal=this.responseText;
var sel = document.getElementById('currency_id');
var opts = sel.options;
for(var opt, j = 0; opt = opts[j]; j++) {
if(opt.value == wal) {
sel.selectedIndex = j;
break;
}
}
}
}
req.Send(url);
}
function getNBPCurrencyExchange() {
var c_id = document.getElementById('currency_id').value;
var date = document.getElementById('register_date').value;
url='index.php?module=Currencies&action=getNBPCurrencyExchange&c_id='+c_id+'&date='+date+'&to_pdf=1';
var req=mint.Request();
req.OnSuccess = function() {
if (this.responseText == -1) return;
if (this.responseText!=''){
this.responseText = this.responseText.replace('.', ',');
document.getElementById('currency_value').value = (this.responseText);
}
}
req.Send(url);
}
setInterval('getNBPCurrencyExchange();',1000);
function doRequest(where, post, doFunction, error) {
this.Display = function(result) {
doFunction(result.responseText);
}
this.Fail = function(result) {
if (error)
alert(error);
}
YAHOO.util.Connect.asyncRequest('POST', where, {success: this.Display, failure: this.Fail}, post);
}
function changeValidateRequired(formname, name, required) {
for (var i = 0; i < validate[formname].length; i++)
if (validate[formname][i][0] == name) {
validate[formname][i][2] = required;
break;
}
}
function set_focus() {
document.getElementById('ecmkpkw_name').focus();
}
function my_popup(module, field_array, call_back_function, form_name) {
if (!call_back_function)
call_back_function = "set_return";
if (!form_name)
form_name = "EditView";
return open_popup(module, 600, 400, "", true, false, {"call_back_function": call_back_function, "form_name": form_name, "field_to_name_array": field_array});
}
function addEvent(object, eventName, do_function) {
if (typeof(object) == "string")
object = document.getElementById(object);
if (!object) {
alert('No object in function addEvent!');
return;
}
if (object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on' + eventName, do_function);
}
}
function ItemListClear() {
while (N.rowCount() > 0)
N.row(0).deleteRow();
}
preview_pdf = function() {
//console.log('test');
var type = document.getElementById('preview_type').value;
switch(type)
{
default:
type = '';
break;
case 'exp':
type = 'exp';
break;
case 'pl':
type = 'pl';
break;
}
console.log(type);
document.getElementById('previewPDF').innerHTML = '<iframe style="border:none;width:100%;height:1200px;" frameborder="no" src="index.php?module=EcmKpkw&action=previewPDF&type='+type+'&to_pdf=1&method=I&record='+document.forms.DetailView.record.value+'#zoom=75">Yours browser not accept iframes!</iframe>';
}
test = function() {
if (OPT.parent_doc_type=='EcmSales') {
for(var i=0; i<N.rowCount(); i++) {
var data = N.row(i).getData();
getProductQuantity(i, "saveParentReservation");
}
}
}
window.onbeforeunload = function() {
return "";
}
window.onunload = function() {
removeDocumentReservations(document.getElementById("temp_id").value);
if (OPT.parent_doc_type=='EcmSales') {
for(var i=0; i<N.rowCount(); i++) {
var data = N.row(i).getData();
getProductQuantity(i, "saveParentReservation");
}
}
}
// function getAddress() {
// var id = document.getElementById('address_id').value;
// if (id=='') return;
// url='index.php?module=Accounts&action=getAddress&id='+id+'&to_pdf=1';
// var req=mint.Request();
// req.OnSuccess = function() {
// var addr = eval(this.responseText);
// console.log(addr[0].description);
// if (addr[0].description) document.getElementById('parent_shipping_address_name').value = addr[0].description;
// if (addr[0].street) document.getElementById('parent_shipping_address_street').value = addr[0].street;
// if (addr[0].postalcode) document.getElementById('parent_shipping_address_postalcode').value = addr[0].postalcode;
// if (addr[0].city) document.getElementById('parent_shipping_address_city').value = addr[0].city;
// if (addr[0].country) document.getElementById('parent_shipping_address_country').value = addr[0].country;
// }
// req.Send(url);
// }
// getProductType = function(index) {
// var data = N.row(index).getData();
// var url='index.php?module=EcmKpkw&action=getProductType&product_id='+data.id+'&to_pdf=1';
// var req=mint.Request();
// req.OnSuccess = function() {
// var prod = eval(this.responseText);
// data.type = prod[0]['type'];
// N.row(index).setData(data);
// }
// req.Send(url);
// }
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
/*
function updatePaymentDate(){
var rd=document.getElementById("register_date").value;
d=rd.split(".");
var days = 0;
if (document.getElementById('payment_date_d').value!='')
days = document.getElementById('payment_date_d').value;
doRequest('index.php','to_pdf=1&module=EcmKpkw&action=getPaymentDate&day='+d[0]+'&month='+d[1]+'&year='+d[2]+'&days='+days,function(result){
document.getElementById("payment_date").value = result;
}
);
}*/
function updateUnitNames(){
var tab=document.getElementById("tbody");
var tr=tab.getElementsByTagName("tr");
var qtyinstock;
var qty;
var total;
for(var i=0;i<tr.length;i++){
//if(tr[i].getElementsByTagName("input")[4] && tr[i].getElementsByTagName("input")[5]){
//alert(document.getElementById('ecmlanguage').value+" "+tr[i].getElementsByTagName("input")[4]);
if(UNIT_LANG[document.getElementById('ecmlanguage').value][tr[i].getElementsByTagName("input")[8].value])tr[i].getElementsByTagName("input")[9].value=UNIT_LANG[document.getElementById('ecmlanguage').value][tr[i].getElementsByTagName("input")[8].value];
//}
}
return true;
}
function SetTabIndexs(buttons) {
var main = document.getElementById('main');
var td = main.getElementsByTagName('td');
var selectedTable = null;
//var selectingColor = 'red';
//var selectingCellTable = 'green';
var TableIndex = 0;
for(var i=0; i<td.length; i++) {
if(td[i].className == 'tabEditViewDF') {
var TI = 0;
if(td[i].parentNode.cells.item(1) == td[i]) TI = 101+TableIndex; else TI = 102+TableIndex;
var nodes = td[i].getElementsByTagName('input');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
var nodes = td[i].getElementsByTagName('select');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
var nodes = td[i].getElementsByTagName('textarea');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
if(td[i].parentNode.parentNode.parentNode !== selectedTable) {
//if(selectingColor == 'red') selectingColor = 'blue'; else selectingColor = 'red';
selectedTable = td[i].parentNode.parentNode.parentNode;
TableIndex++;
}
}
}
if(buttons==0){
var TableIndex = 0;
for(var i=0; i<td.length; i++) {
if(td[i].className == 'tabEditViewDF') {
var TI = 0;
if(td[i].parentNode.cells.item(1) == td[i]) TI = 101+TableIndex; else TI = 102+TableIndex;
var nodes = td[i].getElementsByTagName('input');
for(var j=0; j<nodes.length; j++) {
if(nodes[j].className=="button")nodes[j].tabIndex = TI+100000;
}
if(td[i].parentNode.parentNode.parentNode !== selectedTable) {
//if(selectingColor == 'red') selectingColor = 'blue'; else selectingColor = 'red';
selectedTable = td[i].parentNode.parentNode.parentNode;
TableIndex++;
}
}
}
}
}
function changeValidateRequired(formname,name,required) {
// for(var i=0; i<validate[formname].length; i++)
// if(validate[formname][i][0] == name) { validate[formname][i][2] = required; break; }
}
function set_focus() { document.getElementById('ecmkpkw_name').focus(); }
function my_popup(module, field_array, call_back_function, form_name) {
if(!call_back_function) call_back_function = "set_return";
if(!form_name) form_name = "EditView";
return open_popup(module, 900, 700, "", true, false, {"call_back_function":call_back_function,"form_name":form_name,"field_to_name_array":field_array});
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function findPos(obj) {
var nleft = 0;
var ntop = 0;
if (obj.offsetParent) {
nleft = obj.offsetLeft
ntop = obj.offsetTop
while (obj = obj.offsetParent) {
nleft += obj.offsetLeft
ntop += obj.offsetTop
}
}
return [nleft,ntop];
}
function changer() {
this.list = new Object();
this.add = function(object,type,do_function,start_value) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) return;
this.list[object.id] = new Object();
this.list[object.id].object = object;
this.list[object.id].type = type;
this.list[object.id].do_function = do_function;
this.list[object.id].start_value = start_value;
this.list[object.id].value = '';
}
this.getValue = function(element) {
var value = null;
if(element.object) {
if(element.type == "innerHTML") value = element.object.innerHTML;
if(element.type == "value") value = element.object.value;
if(element.type == "checked") value = element.object.checked;
}
return value;
}
this.interval = 1000;
this.timer = null;
this.startTimer = function() {
var cc = this;
this.timer = setInterval(
function(){
var list = cc.list;
for(x in list) {
if(list[x].start_value) {
list[x].value = cc.getValue(list[x]);
list[x].start_value = false;
}
else {
var value = cc.getValue(list[x]);
if(list[x].value !== value)
if(list[x].do_function)
list[x].do_function(list[x].object);
list[x].value = value;
}
}
},
this.interval
);
}
this.stopTimer = function () {
clearInterval(this.timer);
this.timer = null;
}
}
var ERROR = false;
var ItemListSave = function(json) { }
function ShowLoadingView() {
var slv = document.getElementById('ShowLoadingView');
if(!slv) {
slv = document.createElement('div');
slv.id = 'ShowLoadingView';
slv.className = 'transparent_class_loading';
slv.style.width = '100%';
slv.style.height = '500%';
var sli = document.createElement('img');
sli.className = 'transparent_class_loading_image';
sli.src = 'themes/default/images/loading.gif';
slv.appendChild(sli);
document.body.appendChild(slv);
}
slv.style.display = '';
}
function HideLoadingView() {
var slv = document.getElementById('ShowLoadingView');
if(slv) slv.style.display = 'none';
}
function SaveForm() {
ShowLoadingView();
setTimeout( function() {
if(OPT['checkbox_demo'] == 1 && document.forms.EditView.record.value == '') { alert(MOD.LBL_DEMO_VERSION_INFORMATION); return; }
ERROR = false;
// document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert(MOD['LBL_SAVE_FORM_ERROR']); HideLoadingView(); return false; }
document.forms.EditView.action.value = 'Save';
if(check_form('EditView')) {
doRequest('index.php',getFormPost('Save'),function(result){
console.log(result);
HideLoadingView();
return;
document.forms.EditView.record.value = result.substring(result.length-36);
alert(MOD['LBL_SAVED']);
window.onbeforeunload='';
window.onunload='';
window.location = 'index.php?module='+document.forms.EditView.module.value+'&action=DetailView&record='+document.forms.EditView.record.value;
HideLoadingView();
},
MOD['LBL_NOT_SAVED']
);
} else { alert(MOD['LBL_NOT_SAVED']); HideLoadingView(); return false; }
},200);
}
function ItemListClear(noNew) {
while(N.rowCount()>0) N.row(0).deleteRow(noNew);
}
function getFormPost(action) {
if(!action) action = 'previewPDF';
var pd = 'to_pdf=1'+'&module=EcmKpkw&action='+action+'&record='+document.forms.EditView.record.value;
pd += '&cache=fromJava'+ItemListSave(true);
//alert(pd);
var record = document.forms.EditView.record.value;
var pd2 = new Object();
pd2['module'] = 'EcmKpkw';
pd2['action'] = action;
pd2['record'] = document.forms.EditView.record.value;
pd2['to_pdf'] = '1';
pd2['cache'] = 'fromJava';
// document.forms.EditView.position_list.value = '';
document.forms["EditView"].action.value = action;
var tmp;
for(var i=0; i<document.forms["EditView"].elements.length; i++) {
tmp = document.forms["EditView"].elements[i];
if(tmp.name != '') {
if(tmp.type == "checkbox")
pd2[document.forms["EditView"].elements[i].name] =(document.forms["EditView"].elements[i].checked ? '1' : '0');
else
pd2[document.forms["EditView"].elements[i].name] = document.forms["EditView"].elements[i].value;
}
}
pd2['module'] = 'EcmKpkw';
pd2['action'] = action;
pd2['record'] = record;
pd2['to_pdf'] = '1';
pd2['cache'] = 'fromJava';
pd += '&otherFormData='+JSON.stringifyNoSecurity(pd2);
return pd;
}
/*
function sendFormPostToPdf() {
ShowLoadingView();
setTimeout( function() {
ERROR = false;
//document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert('There are some errors on list'); HideLoadingView(); return false; }
doRequest("index.php",getFormPost(),function(result){
HideLoadingView();
EcmPreviewPDF('index.php?module=EcmKpkw&action=previewPDF&to_pdf=1&from=EcmKpkw',{zoom:75});
}
);
},200);
}
*/
function sendFormPostToPdf() {
ERROR = false;
document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert('There are some errors on list'); return false; }
doRequest("index.php",getFormPost(),function(result){
if(SHOW_PDF_IN_DIV==1){
HideLoadingView();
//SetTab('PREVIEW');
EcmPreviewPDF('index.php?module=EcmKpkw&action=previewPDF&to_pdf=1&from=EcmKpkw',{zoom:75});
}
else{
SetTab('PREVIEW');
document.getElementById('previewPDF').innerHTML = "<iframe style='border:none;width:100%;height:1200px;' frameborder='no' src='index.php?module=EcmKpkw&action=previewPDF&to_pdf=1&from=EcmKpkw#zoom=75'>Yours browser not accept iframes!</iframe>";
}
}
);
}
function canConfirm() {
if(document.forms.EditView.status.value == "accepted" && !OPT.user.confirm_invoiceouts) {
alert('This option is disabled for You.');
document.forms.EditView.status.value = ((OPT.old_status)?OPT.old_status:'');
}
OPT.old_status = document.forms.EditView.status.value;
}
// function CheckDiscount(noAlert) {
// var discount = 0;
// var tmp = UserFormatNumberToNumber(document.getElementById('discount').value);
// var tmp = UserFormatNumberToNumber("0%");
// if(tmp == -1) {
// if(!noAlert)
// alert(MOD['LBL_DISCOUNT_ERROR']+' ('+document.getElementById('discount').value+')');
// discount = -1;
// document.getElementById('discount').style.color = 'red';
// } else {
// discount = tmp;
// document.getElementById('discount').value = NumberToUserFormatNumber(discount);
// document.getElementById('discount').style.color = 'black';
// }
// return discount;
// }
//document.getElementById('previewPDF').innerHTML = "<iframe style='border:0px; width:100%; height:100%;' src='index.php?module=EcmKpkw&action=InvoicePDFPreview&to_pdf=1'>Yours browser not accept iframes!</iframe>";
//ProductListSave();
//YAHOO.util.Connect.asyncRequest('POST','index.php',{success:this.Display,failure:this.Fail},this.postData());
var AjaxSearchProducts;
var parentFL;
var productFL;
addEvent(
window,
'load',
function () {
var CHANGER = new changer();
CHANGER.interval = 500;
//set_focus();
//initialize table
//N = new MyTable('itemsTable');
//N.divParent = document.getElementById('itemsTableDIV');
var from_popup_return = false;
function returnedData(popup_reply_data) {
from_popup_return = true;
var form_name = popup_reply_data.form_name;
var name_to_value_array = popup_reply_data.name_to_value_array;
for (var the_key in name_to_value_array) {
if(the_key == 'toJSON'){}
else {
var displayValue=name_to_value_array[the_key].replace(/&amp;/gi,'&').replace(/&lt;/gi,'<').replace(/&gt;/gi,'>').replace(/&#039;/gi,'\'').replace(/&quot;/gi,'"');;
var e = document.getElementById(the_key);
if(e) { e.value = displayValue; }
}
}
//if(N.selectedRow) N.selectedRow.calculateTotal();
};
function generateNumber() {
//alert('p');
if(document.getElementById('template_id').value == '') { alert('There are no DocumentTemplates in data base!'); return;}
doRequest(
'index.php',
'to_pdf=1&generate=1&module=EcmKpkw&action=generateNumber&type=normal&template_id='+document.getElementById('template_id').value+'&record='+document.forms.EditView.record.value,
function(result){
var arr = eval(result)[0];
document.getElementById('number').value = arr.number;
document.getElementById('document_no').value = arr.document_no;
//alert('p');
},
''
);
};
if(OPT['new_number']) generateNumber();
// function generateNumber() {
// if(document.getElementById('template_id').value == '') { alert('There are no DocumentTemplates in data base!'); return;}
// doRequest(
// 'index.php',
// 'to_pdf=1&generate=1&module=EcmKpkw&action=generateNumber'+
// '&template_id='
// +document.getElementById('template_id').value+
// '&record='
// +document.forms.EditView.record.value+
// '&type='
// +document.forms.EditView.type.value,
// function(result){
// var arr = eval(result)[0];
// document.getElementById('number').value = arr.number;
// document.getElementById('document_no').value = arr.document_no;
// },
// ''
// );
// };
//if(OPT['new_number']) generateNumber();
//if(document.getElementById('template_id').value != '') document.getElementById('template_id').onchange();
//addEvent('template_id','change',generateNumber);
//addEvent(document.forms.EditView.status,'change',canConfirm);
// setPREVIEW = function() {
// if(CheckDiscount() != -1) {
// calculateTotal();
// sendFormPostToPdf();
// }
// }
//CHANGER.add('ecmpaymentcondition_id', 'value', function(obj){
//updatePaymentDate();
// },
//// false
// );
//CHANGER.add('parent_id','value',function(){alert('zmiana parent');},true);
function setToAddrEmail(str) {
if(str && str != '') str = eval(str); else str = '';
if(typeof(str) == "object") str = str[0]; else str = '';
if(document.getElementById('parent_type').value == 'Accounts') {
//= document.getElementById('to_addrs_field'); if(tmp) tmp.value = (str=='')?'':(((str.name)?str.name:'')+' <'+((str.email1)?str.email1:'')+'>; ');
tmp = document.getElementById('parent_address_street'); if(tmp) tmp.value = (str.billing_address_street)?str.billing_address_street:'';
tmp = document.getElementById('parent_address_city'); if(tmp) tmp.value = (str.billing_address_city)?str.billing_address_city:'';
tmp = document.getElementById('parent_address_postalcode'); if(tmp) tmp.value = (str.billing_address_postalcode)?str.billing_address_postalcode:'';
tmp = document.getElementById('parent_address_country'); if(tmp) tmp.value = (str.billing_address_country)?str.billing_address_country:'';
tmp = document.getElementById('index_dbf'); if(tmp) tmp.value = (str.index_dbf)?str.index_dbf:'';
tmp = document.getElementById('parent_name_copy'); if(tmp) tmp.value = (str.name)?str.name:'';
// tmp = document.getElementById('to_nip'); if(tmp) tmp.value = (str.sic_code)?str.sic_code:'';
}
}
//create Contact
// contactFL = new FormLoader();
// contactFL.load('EcmKpkw','Contacts','contactFL');
// contactFL.onResponseData = function(data) {
// hideSmartInputFloat er(true);
// document.forms.EditView.contact_id.value = data['id'];
// document.forms.EditView.contact_name.value = data['name'];
// document.forms.EditView.parent_contact_name.value = data['name'];
// document.forms.EditView.parent_contact_title.value = data['title'];
// };
// contactFL.setEditDblClick(document.forms.EditView.contact_name);
// contactFL.onEditDblClick = function() {
// var ret = "&fl_record="+document.forms.EditView.contact_id.value;
// if(document.forms.EditView.parent_type.value == "Accounts") ret += "&fl_account_id="+document.forms.EditView.parent_id.value+"&fl_account_name="+document.forms.EditView.parent_name.value;
// var ccc = document.forms.EditView.contact_name.value;
// var cc_pos = ccc.indexOf(" ");
// if(cc_pos != -1) {
// var cc_ = '&fl_first_name='+ccc.substr(0,cc_pos)+'&fl_last_name='+ccc.substr(cc_pos+1,ccc.length);
// ret += cc_;
// }
// return ret;
// }
// contactFL.onButtonClick = function() {
// var ret = "&fl_record="+document.forms.EditView.contact_id.value;
// if(document.forms.EditView.parent_type.value == "Accounts") ret += "&fl_account_id="+document.forms.EditView.parent_id.value+"&fl_account_name="+document.forms.EditView.parent_name.value;
// var ccc = document.forms.EditView.contact_name.value;
// var cc_pos = ccc.indexOf(" ");
// if(cc_pos != -1) {
// var cc_ = '&fl_first_name='+ccc.substr(0,cc_pos)+'&fl_last_name='+ccc.substr(cc_pos+1,ccc.length);
// ret += cc_;
// }
// return ret;
// }
//document.forms.EditView.contact_id.parentNode.appendChild(contactFL.createButton());
function ParentIdChange(obj) {
var list = '';
if(document.getElementById('parent_type').value == 'Accounts') {
list = 'gdModule=Accounts&gdData=sic_code|name|email1|billing_address_street|billing_address_city|billing_address_postalcode|billing_address_country|sic_code|sic_code|vatid|is_vat_free|ecmlanguage|currency_id|ecmpaymentcondition_name|ecmpaymentcondition_id|supplier_code|nip|index_dbf|currency_id|invoice_type|id|payment_method|payment_deadline';
}
if(document.getElementById('parent_type').value == 'Contacts') {
list = 'gdModule=Contacts&gdData=full_name|email1|primary_address_street|primary_address_city|primary_address_postalcode|primary_address_country';
}
if (obj.value != '') {
doRequest('index.php','module=EcmKpkw&action=getData&'+list+'&gdId='+obj.value+'&to_pdf=1',setToAddrEmail);
// getAddresses();
}
}
CHANGER.add('parent_id', 'value', ParentIdChange, OPT['check_parent_id']);
CHANGER.add('contact_id', 'value', function(obj) {
if(obj.value == '') {
document.forms.EditView.parent_contact_name.value = '';
document.forms.EditView.parent_contact_title.value = '';
} else {
doRequest('index.php','module=EcmKpkw&action=getData&gdModule=Contacts&gdData=full_name|title&gdId='+obj.value+'&to_pdf=1', function(str) {
if(str && str != '') str = eval(str); else str = '';
if(typeof(str) == "object") str = str[0]; else str = '';
document.forms.EditView.parent_contact_name.value = str.full_name;
document.forms.EditView.parent_contact_title.value = str.title;
});
}
},false);
if(document.getElementById('parent_id').value == '') ParentIdChange(document.getElementById('parent_id'));
var setTexts = function(no_confirm_question) {
var resp = true;
if(!no_confirm_question)
resp = confirm(MOD.LBL_ALERT_ECMLANGUAGE_CHANGE);
if(resp) {
var el = document.getElementById('ecmlanguage');
if (!el.value || el.value=="") el.value="pl_pl";
//document.forms.EditView.header_text.value = OPT['ecmlanguage'][el.value]['texts']["Accounts"]['header_text'];
//document.forms.EditView.footer_text.value = OPT['ecmlanguage'][el.value]['texts']["Accounts"]['footer_text'];
//document.forms.EditView.ads_text.value = OPT['ecmlanguage'][el.value]['texts']["Accounts"]['ads_text'];
}
}
YAHOO.util.Event.addListener(document.getElementById('ecmlanguage'),'change',function(){setTexts();});
if(document.forms.EditView.record.value == '') setTexts(true);
//create Parent
parentFL = new FormLoader();
parentFL.load('EcmKpkw','Parents','parentFL');
parentFL.onResponseData = function(data) {
document.forms.EditView.parent_id.value = data['id'];
document.forms.EditView.parent_name.value = data['name'];
ParentIdChange(document.forms.EditView.parent_id);
};
//parentFL.setEditDblClick(document.forms.EditView.parent_name);
parentFL.onEditDblClick = function() { parentFL.createModule=document.forms.EditView.parent_type.value; return "&fl_record="+document.forms.EditView.parent_id.value; }
parentFL.onButtonClick = function() { parentFL.createModule=document.forms.EditView.parent_type.value; return "&fl_name="+document.forms.EditView.parent_name.value; }
//document.forms.EditView.parent_id.parentNode.appendChild(parentFL.createButton());
//create Product
productFL = new FormLoader();
productFL.load('EcmQuestions','Parents','productFL');
productFL.onResponseData = function(data) {
data.price = data.selling_price;
data.quantity = '1';
N.selectedRow.setData(data);
N.selectedRow.calculateTotal();
};
CHANGER.add('ecminvoiceout_id', 'value', function(obj) {
if(obj.value != '') ViewCorrectInfo(obj.value);
},
true
);
CHANGER.add('ecminvoiceout_id', 'value', function(obj) {
if(document.getElementById('type').value=="correct"){
addToValidate('EditView', 'ecminvoiceout_id', 'text', false,MOD.LBL_ECMINVOICEOUT_NAME);
}
},
true
);
//setInterval("updateUnitNames();",1000);
//setInterval("updatePaymentDate();",2000);
//quick view
checkcash();
var main = document.getElementById('main');
if(main) {
var h2 = main.getElementsByTagName('h2')[0];
if(h2) {
h2.style.display = 'inline';
var span = document.createElement('span');
span.innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="document_no_h"></span> - <span id="parent_name_h"></span> - <span id="parent_contact_name_h"></span> - <span id="parent_address_street_h"></span>&nbsp; &nbsp;<span id="parent_address_postalcode_h"></span>&nbsp;<span id="parent_address_city_h"></span>&nbsp; &nbsp;<span id="parent_address_country_h"></span> - <span id="total_h"></span>'
h2.parentNode.appendChild(span);
}
}
CHANGER.add('document_no','value',function(obj){document.getElementById('document_no_h').innerHTML = obj.value;},false);
CHANGER.add('parent_contact_name','value',function(obj){document.getElementById('parent_contact_name_h').innerHTML = obj.value;},false);
CHANGER.add('parent_address_street','value',function(obj){document.getElementById('parent_address_street_h').innerHTML = obj.value;},false);
CHANGER.add('parent_address_postalcode','value',function(obj){document.getElementById('parent_address_postalcode_h').innerHTML = obj.value;},false);
CHANGER.add('parent_address_city','value',function(obj){document.getElementById('parent_address_city_h').innerHTML = obj.value;},false);
CHANGER.add('parent_address_country','value',function(obj){document.getElementById('parent_address_country_h').innerHTML = obj.value;},false);
CHANGER.add('total','value',function(obj){document.getElementById('total_h').innerHTML = obj.value;},false);
function ChangeAccessFunction(obj,type) {
var objs = obj.getElementsByTagName('input');
for(var i=0; i<objs.length; i++)
if(objs[i].id != 'parent_name' && objs[i].id != 'parent_id' && objs[i].name != 'btn_parent_name' && objs[i].name != 'btn_clr_parent_name' && objs[i].name != 'btn_create_parent_name')
objs[i].disabled = type;
var objs = obj.getElementsByTagName('textarea');
for(var i=0; i<objs.length; i++)
objs[i].disabled = type;
var objs = obj.getElementsByTagName('select');
for(var i=0; i<objs.length; i++)
if(objs[i].id != 'parent_type')
if (OPT.selectStock!=false && objs[i].id=='stock_id') continue;
else
objs[i].disabled = type;
if(type == 'disabled')
TabsMainBlock = true;
else
TabsMainBlock = false;
}
//mz
if (document.getElementById('parent_type')!='EcmStockDocOuts') {
//addToValidate('EditView', 'stock_id', 'text', false,MOD.LBL_STOCK_NAME);
//addToValidate('EditView', 'stock_name', 'text', false,MOD.LBL_STOCK_ID);
} else {
document.getElementById('stock_id').disabled='disabled';
OPT.selectStock = false;
}
/*
if (OPT.from_wz==false && OPT.from_sale===false) {
TabsMainBlock = true;
document.getElementById("stock_id").onchange= function() {
if (document.getElementById("stock_id").value!="")
this.disabled=true;
if(document.getElementById("stock_id").value!="" && document.getElementById("parent_id").value!=""){
TabsMainBlock = false;
}
else{
TabsMainBlock = true;
}
};
document.getElementById("parent_id").onchange= function() {
alert('change!');
if(document.getElementById("stock_id").value!="" && document.getElementById("parent_id").value!=""){
TabsMainBlock = false;
}
else{
TabsMainBlock = true;
}
};
}
*/
CHANGER.startTimer();
// document.getElementById("payment_date").readOnly=true;
SetTabIndexs(0);
//document.VAT1=VAT;
document.PositionList=N;
document.forms.EditView.parent_name.focus();
//if (OPT.from_sale==true)
//transformSaleIntoTemponaryReservation(document.getElementById("temp_id").value);
}
);
preview_pdf = function() {
console.log('test');
var type = document.getElementById('preview_type').value;
switch(type)
{
default:
type = '';
break;
case 'exp':
type = 'exp';
break;
case 'pl':
type = 'pl';
break;
}
console.log(type);
document.getElementById('previewPDF').innerHTML = '<iframe style="border:none;width:100%;height:1200px;" frameborder="no" src="index.php?module=EcmKpkw&action=previewPDF&type='+type+'&to_pdf=1&method=I&record='+document.forms.DetailView.record.value+'#zoom=75">Yours browser not accept iframes!</iframe>';
}

465
modules/EcmKpkw/EcmKpkw.php Normal file
View File

@@ -0,0 +1,465 @@
<?php
if(!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once ('include/upload_file.php');
// User is used to store Forecast information.
class EcmKpkw extends SugarBean {
var $id;
var $ecmkpkw_name;
var $description;
var $category_id;
var $subcategory_id;
var $status_id;
var $status;
var $created_by;
var $date_entered;
var $date_modified;
var $modified_user_id;
var $active_date;
var $exp_date;
var $ecmkpkw_revision_id;
var $filename;
var $img_name;
var $img_name_bare;
var $related_doc_id;
var $related_doc_name;
var $related_doc_rev_id;
var $related_doc_rev_number;
var $is_template;
var $template_type;
//additional fields.
var $revision;
var $last_rev_create_date;
var $last_rev_created_by;
var $last_rev_created_name;
var $file_url;
var $file_url_noimage;
var $table_name = "ecmkpkw";
var $object_name = "EcmKpkw";
var $user_preferences;
var $encodeFields = Array ();
// This is used to retrieve related fields from form posts.
var $additional_column_fields = Array ('revision');
var $new_schema = true;
var $module_dir = 'EcmKpkw';
var $save_file;
var $relationship_fields = Array(
'contract_id'=>'contracts',
);
function EcmKpkw() {
parent :: SugarBean();
$this->setupCustomFields('EcmKpkw'); //parameter is module name
$this->disable_row_level_security = false;
}
function save($check_notify = false) {
global $current_user;
$db = $GLOBALS ['db'];
// global $db;
$this->number = $this->generateNumber();
$this->document_no = $this->formatNumber();
if($this->dir==1){ $this->document_no='KW/'.$this->document_no; } else {
$this->document_no='KP/'.$this->document_no;
}
$value = $this->amount;
if ($this->dir) {
$value = ($this->amount)*-1;
}
$value = str_replace(",", "", $value);
$return_id = parent::save($check_notify);
if (isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
// edytowanie informacji do listy platnosci
// mysql_query("UPDATE `ecmpayments` SET `value`='".($value)."', `parent_name`='".$this->parent_name."', `parent_id`='".$this->parent_id."', `description`='".$this->description."', `created_by`='".$this->created_by."' WHERE `parent_document_id`='".$this->id."'");
} else {
// dodawanie informacji do listy platnosci
// mysql_query("INSERT INTO `ecmpayments` SET `id`=UUID(), `parent_document_id`='".$return_id."', `name`='".$this->document_no."', `value`='".($value)."', `parent_name`='".$this->parent_name."', `parent_id`='".$this->parent_id."', `description`='".$this->description."', `created_by`='".$this->created_by."'");
}
//echo $this->parent_id; exit;
// $query = "SELECT
// billing_address_street AS `street`,
// billing_address_city AS `city`,
// billing_address_postalcode AS `postalcode`,
// billing_address_country AS `country`,
// index_dbf AS `indeks`
// FROM `accounts`
// WHERE `id` = '".$this->parent_id."';";
// echo $query; exit;
// if($row = $db->fetchByAssoc($db->query($query)))
// {
// $this->parent_name = $row["name"];
// $this->parent_address_street = $row["street"];
// $this->parent_address_city = $row["city"];
// $this->parent_address_postalcode = $row["postalcode"];
// $this->parent_address_country = $row["country"];
// $this->index_dbf = $row["indeks"];
// }
// echo "<pre>".var_export($row,true)."</pre>"; exit;
//echo "<pre>".var_export(array($this->ToArray()),true)."</pre>";
$res_count = $db->query ( "select id from ecmtransactions where record_id='" . $this->id . "' and deleted='0'" );
$count = $res_count->num_rows;
$a=$GLOBALS ['db']->query ("SELECT amount from ecmkpkw where id='" . $this->id . "'");
$r = $GLOBALS ['db']->fetchByAssoc ( $a );
if ($count == 0) {
//$GLOBALS ['db']->query ("INSERT INTO ecmtransactions(id,name,date_entered,date_modified,modified_user_id,created_by,description,deleted,assigned_user_id,value,parent_name,parent_id,payment_date,type,paid,register_date,record_id,record_type,currency_id,currency_value)VALUES('".create_guid()."','".$this->ecmkpkw_name."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','".$_SESSION['authenticated_user_id']."','".$_SESSION['authenticated_user_id']."','".$this->description."','".$this->deleted"','".$this->assigned_user_id."','".$this->amount."','".$this->parent_name."','".$this->parent_id."','".$this->register_date."','".$this->dir."','1','".$this->date_entered."','".$this->id."','EcmKpkw','".$this->currency_id ."','".$this->currency_value ."')");
} else {
//$db->query ( "update ecmtransactions set value=$this->amount where record_id='" . $this->id . "'" );
}
return parent :: save($check_notify);
}
function generateNumber() {
$this->setTemplate();
$this->number = isset($this->template) ? $this->template->generateNumber($this->table_name) : '';
return $this->number;
}
function formatNumber() {
$this->setTemplate();
$this->document_no = isset($this->template) ? $this->template->formatNumber($this->number, $this->module_dir) : '';
return $this->document_no;
}
function setTemplate() {
// if (!isset($this->template_id) || $this->template_id == '')
// return null;
// if (isset($this->template))
// return $this->template;
require_once('modules/EcmDocumentTemplates/EcmDocumentTemplate.php');
$this->template = new EcmDocumentTemplate();
$this->template_id = "97700b0d-fbe9-e366-4016-4b260f058a47";
//$this->template->retrieve($this->template_id);
$this->template->retrieve($this->template_id, true, false);
if (isset($this->template->id) && $this->template->id != '') {
$this->template->format_all_fields();
}
else
$this->template = null;
return $this->template;
}
function get_summary_text() {
return "$this->ecmkpkw_name";
}
function is_authenticated() {
return $this->authenticated;
}
function fill_in_additional_list_fields() {
// $this->modified_user_fullname = get_assigned_user_name($this->modified_user_id);
// $this->created_by_fullname = get_assigned_user_name($this->created_by);
$this->fill_in_additional_detail_fields();
}
function fill_in_additional_detail_fields() {
$this->modified_user_fullname = get_assigned_user_name($this->modified_user_id);
$this->created_by_fullname = get_assigned_user_name($this->created_by);
// echo "<pre>".var_export($this->ToArray(),true)."</pre>";
// exit;
return;
global $theme;
global $current_language;
global $timedate;
global $locale;
parent::fill_in_additional_detail_fields();
$mod_strings = return_module_language($current_language, 'EcmKpkw');
$query = "SELECT filename,revision,file_ext FROM ecmkpkw_revisions WHERE id='$this->document_revision_id'";
$result = $this->db->query($query);
$row = $this->db->fetchByAssoc($result);
//popuplate filename
if(isset($row['filename']))$this->filename = $row['filename'];
//$this->latest_revision = $row['revision'];
if(isset($row['revision']))$this->revision = $row['revision'];
//populate the file url.
//image is selected based on the extension name <ext>_icon_inline, extension is stored in ecmkpkw_revisions.
//if file is not found then default image file will be used.
global $img_name;
global $img_name_bare;
if (!empty ($row['file_ext'])) {
$img_name = SugarThemeRegistry::current()->getImageURL(strtolower($row['file_ext'])."_image_inline.gif");
$img_name_bare = strtolower($row['file_ext'])."_image_inline";
}
//set default file name.
if (!empty ($img_name) && file_exists($img_name)) {
$img_name = $img_name_bare;
} else {
$img_name = "def_image_inline"; //todo change the default image.
}
if($this->ACLAccess('DetailView')){
$this->file_url = "<a href='index.php?entryPoint=download&id=".basename(UploadFile :: get_url($this->filename, $this->ecmkpkw_revision_id))."&type=EcmKpkw' target='_blank'>".SugarThemeRegistry::current()->getImage($img_name, 'alt="'.$mod_strings['LBL_LIST_VIEW_DOCUMENT'].'" border="0"')."</a>";
$this->file_url_noimage = basename(UploadFile :: get_url($this->filename, $this->ecmkpkw_revision_id));
}else{
$this->file_url = "";
$this->file_url_noimage = "";
}
//get last_rev_by user name.
$query = "SELECT first_name,last_name, ecmkpkw_revisions.date_entered as rev_date FROM users, document_revisions WHERE users.id = document_revisions.created_by and document_revisions.id = '$this->document_revision_id'";
$result = $this->db->query($query, true, "Eror fetching user name: ");
$row = $this->db->fetchByAssoc($result);
if (!empty ($row)) {
$this->last_rev_created_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
$this->last_rev_create_date = $timedate->to_display_date_time($row['rev_date']);
}
global $app_list_strings;
if(!empty($this->status_id)) {
//_pp($this->status_id);
$this->status = $app_list_strings['ecmkpkw_status_dom'][$this->status_id];
}
$this->related_doc_name = EcmKpkw::get_ecmkpkw_name($this->related_doc_id);
$this->related_doc_rev_number = EcmKpkwRevision::get_ecmkpkw_revision_name($this->related_doc_rev_id);
$this->save_file = basename($this->file_url_noimage);
}
function list_view_parse_additional_sections(& $list_form, $xTemplateSection) {
return $list_form;
}
function create_export_query(&$order_by, &$where, $relate_link_join='')
{
$custom_join = $this->custom_fields->getJOIN(true, true,$where);
if($custom_join)
$custom_join['join'] .= $relate_link_join;
$query = "SELECT
ecmkpkw.*";
if($custom_join){
$query .= $custom_join['select'];
}
$query .= " FROM ecmkpkw ";
if($custom_join){
$query .= $custom_join['join'];
}
$where_auto = " ecmkpkw.deleted = 0";
if ($where != "")
$query .= " WHERE $where AND ".$where_auto;
else
$query .= " WHERE ".$where_auto;
if ($order_by != "")
$query .= " ORDER BY $order_by";
else
$query .= " ORDER BY ecmkpkw.ecmkpkw_name";
return $query;
}
function get_list_view_data() {
$this->fill_in_additional_detail_fields();
// global $current_language;
// $app_list_strings = return_app_list_strings_language($current_language);
$ecmkpkw_fields = $this->get_list_view_array();
// exit;
// $ecmkpkw_fields['FILE_URL'] = $this->file_url;
// $ecmkpkw_fields['FILE_URL_NOIMAGE'] = $this->file_url_noimage;
// $ecmkpkw_fields['LAST_REV_CREATED_BY'] = $this->last_rev_created_name;
// $ecmkpkw_fields['CATEGORY_ID'] = empty ($this->category_id) ? "" : $app_list_strings['document_category_dom'][$this->category_id];
// $ecmkpkw_fields['SUBCATEGORY_ID'] = empty ($this->subcategory_id) ? "" : $app_list_strings['document_subcategory_dom'][$this->subcategory_id];
$ecmkpkw_fields['MODIFIED_USER_ID'] = '<a href="index.php?module=Users&offset=1&return_module=Users&action=DetailView&record='.$this->modified_user_id.'">'.$this->modified_user_fullname.'</a>';
// $ecmkpkw_fields['DOCUMENT_NAME_JAVASCRIPT'] = $GLOBALS['db']->helper->escape_quote($document_fields['DOCUMENT_NAME']);
// echo "<pre>".var_export($this->get_list_view_array(),true)."</pre>";
// exit;
return $ecmkpkw_fields;
}
function mark_relationships_deleted($id) {
//do nothing, this call is here to avoid default delete processing since
//delete.php handles deletion of ecmkpkw revisions.
}
function bean_implements($interface) {
switch ($interface) {
case 'ACL' :
return true;
}
return false;
}
function createPdfFileName($format = true) {
$arr1 = array('\\', '/', ':', '*', '?', '"', '<', '>', '|', ' ');
$arr2 = array('', '', '', '', '', '\'', '[', ']', '', '_');
$tmp = $this->document_no;
if ($format) {
if ($this->type == "normal")
$tmp = str_replace($arr1, $arr2, 'Invoice_' . $tmp . '.pdf');
else
if ($this->type == "correct")
$tmp = str_replace($arr1, $arr2, 'Correct_' . $tmp . '__to_Invoice_' . $this->ecmkpkw->document_no . '.pdf');
}
else
$tmp = 'Kpkw ' . $tmp . '.pdf';
//$mod = return_module_language($current_language, 'EcmInvoiceOuts');
//return urlencode(
// return $mod['LBL_PDF_INVOICE_FILE_NAME'].$tmp.'.pdf';//);
return $tmp; //);
}
//static function.
function get_ecmkpkw_name($doc_id){
if (empty($doc_id)) return null;
$db = DBManagerFactory::getInstance();
$query="select ecmkpkw_name from ecmkpkw where id='$doc_id'";
$result=$db->query($query);
if (!empty($result)) {
$row=$db->fetchByAssoc($result);
if (!empty($row)) {
return $row['ecmkpkw_name'];
}
}
return null;
}
function DrawMainPDF($pdf, $type = null) {
global $mod_strings;
// $arr = $this->template->getTemplateFile($_REQUEST['module']);
//var_dump($type ? : $this->pdf_type); exit;
include($this->template->getTemplateFile('subheader.php'));
include($this->template->getTemplateFile('subfooter.php'));
//exit;
return;
}
function getPDF($id = null, $method = 'I', $name = null, $type = null) {
global $sugar_config;
if ($id != null) {
$this->retrieve($id);
if ($this->id == '')
return;
}
global $mod_strings;
// require_once('modules/EcmTexts/EcmText.php');
// if (isset($this->ecmlanguage) && $this->ecmlanguage != '') {
// $data = EcmText::LoadText(null, null, "EcmKpkw", $this->ecmlanguage);
// if (isset($data[0]) && isset($data[0]['data']) && isset($data[0]['data']['labels'])) {
// $data = $data[0]['data']['labels'];
// foreach ($data as $key => $value) {
// $mod_strings[$value['label']] = $value['translation'];
// }
// }
// }
$this->format_all_fields();
$this->setTemplate();
//$type = $_REQUEST['type'];
if (isset($this->template->id) && $this->template->id != '') {
$this->template->setPDF($this->template_id);
$this->template->pdf->SetAutoPageBreak(true, 40);
$this->DrawMainPDF($this->template->pdf, $type);
$this->template->outputPDF((($name) ? $name : $this->createPdfFileName()), $method);
}
}
}
?>

View File

@@ -0,0 +1,784 @@
function doRequest(where, post, doFunction, error) {
this.Display = function(result) {
doFunction(result.responseText);
}
this.Fail = function(result) {
if (error)
alert(error);
}
YAHOO.util.Connect.asyncRequest('POST', where, {success: this.Display, failure: this.Fail}, post);
}
function changeValidateRequired(formname, name, required) {
for (var i = 0; i < validate[formname].length; i++)
if (validate[formname][i][0] == name) {
validate[formname][i][2] = required;
break;
}
}
function set_focus() {
document.getElementById('name').focus();
}
function my_popup(module, field_array, call_back_function, form_name) {
if (!call_back_function)
call_back_function = "set_return";
if (!form_name)
form_name = "EditView";
return open_popup(module, 600, 400, "", true, false, {"call_back_function": call_back_function, "form_name": form_name, "field_to_name_array": field_array});
}
function addEvent(object, eventName, do_function) {
if (typeof(object) == "string")
object = document.getElementById(object);
if (!object) {
alert('No object in function addEvent!');
return;
}
if (object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on' + eventName, do_function);
}
}
function ItemListClear() {
while (N.rowCount() > 0)
N.row(0).deleteRow();
}
addEvent(
window,
'load',
function() {
//initialize table
N = new MyTable('itemsTable');
N.onRefreshRowIndex = function(row) {
var data = new Object();
data['index'] = (row.index + 1).toString();
row.cells.item(0).setData(data);
}
N.onCreateRow = function(row) {
row.newPos = false;
row.ondblclick = function() {
this.newPos = !this.newPos;
var img = this.cells.item(1).getElementsByTagName('img');
if (!this.newPos)
img[0].src = "modules/EcmKpkw/images/edit.gif";
else
img[0].src = "modules/EcmKpkw/images/editset.gif";
for (var i = 0; i < this.myTable.colCount(); i++)
this.cells.item(i).change(!this.newPos);
}
row.onSelect = function() {
for (var i = 0; i < this.myTable.colCount(); i++) {
this.cells.item(i).style.height = OPT['row_item_height_selected'];
this.cells.item(i).change(!this.newPos);
}
}
row.onDeselect = function() {
for (var i = 0; i < this.myTable.colCount(); i++) {
this.cells.item(i).style.height = OPT['row_item_height'];
this.cells.item(i).change(false);
}
}
row.calculateTotal = function() {
//do nothing :)
}
}
N.onCreateCell = function(cell) {
var i = cell.index;
cell.change = function(select) {
};
//cell.style.height = OPT['row_item_height'];
cell.style.height = 50;
cell.noSelect = true;
if (i == 0) {
cell.setData = function(data) {
if (data.index)
cell.firstChild.value = data.index;
};
cell.getData = function(data) {
data.index = cell.firstChild.value;
}
cell.select = function() {
this.selectNext();
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('readOnly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 1) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.code = cn[0].value;
data.id = cn[1].value;
data.unit_name = cn[2].value;
data.vat_id = cn[3].value;
data.category_id = cn[4].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if (data.code)
cn[0].value = data.code;
if (data.id)
cn[1].value = data.id;
if (data.unit_name)
cn[2].value = data.unit_name;
if (data.vat_id)
cn[3].value = data.vat_id;
if (data.category_id)
cn[4].value = data.category_id;
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" autocomplete="off" >';
cell.innerHTML = edit;
cell.align = 'right';
var id = document.createElement('input');
id.setAttribute('type', 'hidden');
cell.appendChild(id);
var unit_id = document.createElement('input');
unit_id.setAttribute('type', 'hidden');
//unit_id.setAttribute('value',OPT['default_unit']);
unit_id.setAttribute('value', 'TMP');
cell.appendChild(unit_id);
var vat_id = document.createElement('input');
vat_id.setAttribute('type', 'hidden');
//vat_id.setAttribute('value',OPT['default_vat']);
vat_id.setAttribute('value', '23');
cell.appendChild(vat_id);
var category_id = document.createElement('input');
category_id.setAttribute('type', 'hidden');
category_id.setAttribute('value', '');
cell.appendChild(category_id);
}
if (i == 2) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('textarea');
data.name = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('textarea');
if (data.name)
cn[0].value = data.name;
}
var textarea = '<textarea tabindex="1" readonly="readonly" style="height:100%" class="inputs"></textarea>';
cell.innerHTML = textarea;
}
if (i == 3) {
cell.getData = function(data, noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value);
if (tmp == -1) {
ERROR = true;
//if(!noAlert)
//alert(MOD['LBL_FORMAT_NUMBER_ERROR']+' ('+this.firstChild.value+')');
data.quantity = 0;
this.firstChild.style.color = 'red';
} else {
data.quantity = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
if (data.quantity)
this.firstChild.value = NumberToUserFormatNumber(data.quantity);
else
this.firstChild.value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" style="text-align:right;" autocomplete="off" class="inputs" value="' + NumberToUserFormatNumber(1) + '">';
cell.innerHTML = edit;
}
if (i == 4) {
cell.getData = function(data, noAlert) {
data.unit_id = this.firstChild.value;
}
cell.setData = function(data) {
this.firstChild.value = data.unit_id;
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="">';
cell.innerHTML = edit;
}
if (i == 5) {
cell.getData = function(data, noAlert) {
}
cell.setData = function(data) {
var value;
if (data.startprice)
value = data.startprice;
else
value = 0;
this.firstChild.value = NumberToUserFormatNumber(value);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="0">';
cell.innerHTML = edit;
}
if (i == 6) {
cell.getData = function(data, noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value, '%');
if (tmp == -1) {
ERROR = true;
if (!noAlert)
alert(MOD['LBL_FORMAT_NUMBER_ERROR'] + ' (' + this.firstChild.value + ')');
data.discount = 0;
this.firstChild.style.color = 'red';
} else {
data.discount = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
if (data.discount)
this.firstChild.value = NumberToUserFormatNumber(data.discount, '%');
else
this.firstChild.value = NumberToUserFormatNumber(0, '%');
}
cell.selectNext = function() {
var row = this.parentNode.selectNext();
row.select();
row.cells.item(0).select();
};
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="' + NumberToUserFormatNumber(0, '%') + '">';
cell.innerHTML = edit;
}
if (i == 7) {
cell.getData = function(data, noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value);
if (tmp == -1) {
ERROR = true;
if (!noAlert)
alert(MOD['LBL_FORMAT_NUMBER_ERROR'] + ' (' + this.firstChild.value + ')');
data.price = 0;
this.firstChild.style.color = 'red';
} else {
data.price = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.subprice) cn[0].value = NumberToUserFormatNumber(data.subprice);
else cn[0].value = NumberToUserFormatNumber(0);
if(data.price) cn[1].value = NumberToUserFormatNumber(data.price);
else cn[1].value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'"><br><input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'">';
cell.innerHTML = edit;
}
if (i == 8) {
cell.getData = function(data, noAlert) {
var cn = this.getElementsByTagName('input');
data.vat_value = cn[0].value;
data.vat_id = cn[1].value;
if (VAT[cn[1].value])
data.vat_name = VAT[cn[1].value].name;
}
cell.setData = function(data) {
if (data.vat_value)
this.getElementsByTagName('input')[0].value = data.vat_value;
if (data.vat_id)
this.getElementsByTagName('input')[1].value = data.vat_id;
if (data.vat_name)
this.getElementsByTagName('input')[2].value = data.vat_name;
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if (!ERROR) {
data.vat_id = data.vat_id;
this.setData(data);
}
}
var inp = document.createElement('input');
inp.setAttribute('type', 'hidden');
cell.appendChild(inp);
var inp = document.createElement('input');
inp.setAttribute('type', 'hidden');
cell.appendChild(inp);
var inp;
inp = document.createElement('input');
inp.setAttribute('type', 'text');
inp.className = 'inputs';
inp.style.textAlign = "right";
inp.cell = cell;
cell.appendChild(inp);
}
if (i == 9) {
//cell.select = function() { };
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
if (cn[0]) data.subtotal = UserFormatNumberToNumber(cn[0].value);
else data.subtotal = 0;
if (cn[1]) data.total = UserFormatNumberToNumber(cn[1].value);
else data.total = 0;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.subtotal) cn[0].value = NumberToUserFormatNumber(data.subtotal);
else cn[0].value = NumberToUserFormatNumber(0);
if(data.total) cn[1].value = NumberToUserFormatNumber(data.total);
else cn[1].value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'"><br><input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'">';
cell.innerHTML = edit;
}
}
N.onSetCellData = function(row, cell, data) {
if (cell.innerHTML == '')
cell.innerHTML = '&nbsp;';
}
var pl = document.getElementById('position_list').value;
if (pl && pl != '') {
try {
pl = eval(pl);
for (x in pl) {
if (typeof(pl[x].code) != "undefined") {
var pl_row = pl[x];
N.addRow().setData(pl_row);
}
}
} catch (err) {
pl = null;
}
;
}
if (N.rowCount() == 0)
N.addRow();
calculateTotal = function() {
var vats = new Object();
var subtotal = 0;
var total = 0;
//var cbm_total = 0;
for(var i=0; i<N.rowCount(); i++) {
var data = N.row(i).getData();
console.log(data);
if(data.vat_id && data.name != '') {
if(typeof(vats[data.vat_id]) != "object") { vats[data.vat_id] = new Object(); vats[data.vat_id]['vat'] = 0;}
vats[data.vat_id]['vat'] += data.subtotal;
}
subtotal += data.subtotal;
//cbm_total += data.cbm;
}
console.log(subtotal);
total = subtotal;
var rt = document.getElementById('result_table');
for(var i=1; i<rt.rows.length-1; i++) { if(!vats[rt.rows.item(i).id]) { rt.deleteRow(i); --i; } else vats[rt.rows.item(i).id]['node'] = rt.rows.item(i); }
for(var x in vats) {
if(VAT[x]){
vats[x]['vat'] = vats[x]['vat']*(parseFloat(VAT[x].value)/100);
total += vats[x]['vat'];
var txL = MOD['LBL_VAT']+' ('+VAT[x].name+')';
var txF = NumberToUserFormatNumber(vats[x]['vat']);
}
if(vats[x]['node']) {
vats[x]['node'].id = x;
vats[x]['node'].cells.item(0).innerHTML = txL;
vats[x]['node'].cells.item(1).innerHTML = "<input type='text' readonly='readonly' style='border:0px;font-weight:900;width:100%;text-align:right;' value='"+txF+"'>";
} else {
rt.insertRow(1);
rt.rows.item(1).id = x;
rt.rows.item(1).insertCell(0);
rt.rows.item(1).cells.item(0).className = 'positionsLabel';
rt.rows.item(1).cells.item(0).innerHTML = txL;
rt.rows.item(1).insertCell(1);
rt.rows.item(1).cells.item(1).className = 'positionsField';
rt.rows.item(1).cells.item(1).innerHTML = "<input type='text' readonly='readonly' style='border:0px;font-weight:900;width:100%;text-align:right;' value='"+txF+"'>";
}
}
var total2 = total;
var discount;
// if((discount = CheckDiscount(true)) == -1) discount = 0;
discount = 0;
var discount2 = subtotal*discount/100;
total = total2-discount2;
discount2 = NumberToUserFormatNumber(discount2).toString();
total2 = ((OPT['type'] == "correct")?'-':'')+NumberToUserFormatNumber(total2).toString();
total = ((OPT['type'] == "correct")?'-':'')+NumberToUserFormatNumber(total).toString();
document.getElementById('subtotal').value = NumberToUserFormatNumber(subtotal);
if(document.getElementById('total_2')) document.getElementById('total_2').value = total2;
//rt.rows.item(rt.rows.length-2).cells.item(0).innerHTML = MOD['LBL_DISCOUNT']+' ('+NumberToUserFormatNumber(discount,'%')+')';
//document.getElementById('discount_2').value = discount2;
document.getElementById('total').value = total2;
//document.getElementById('cbm_total').value = cbm_total;
}
calculateTotal();
function HideLoadingView() {
var slv = document.getElementById('ShowLoadingView');
if (slv)
slv.style.display = 'none';
}
setPREVIEW = function() {
if (SHOW_PDF_IN_DIV == 1) {
HideLoadingView();
//SetTab('preview_PREVIEW');
EcmPreviewPDF('index.php?module=EcmKpkw&action=previewPDF&to_pdf=1&method=I&record=' + document.forms.DetailView.record.value + '&type=' + type, {zoom: 75});
}
else {
SetTab('panel_PREVIEW');
}
}
preview_pdf = function() {
console.log('test');
var type = document.getElementById('preview_type').value;
switch(type)
{
default:
type = '';
break;
case 'exp':
type = 'exp';
break;
case 'pl':
type = 'pl';
break;
}
console.log(type);
document.getElementById('previewPDF').innerHTML = '<iframe style="border:none;width:100%;height:1200px;" frameborder="no" src="index.php?module=EcmKpkw&action=previewPDF&type='+type+'&to_pdf=1&method=I&record='+document.forms.DetailView.record.value+'#zoom=75">Yours browser not accept iframes!</iframe>';
}
setEMAIL = function(noCheck) {
SetTab('panel_EMAIL');
document.getElementById('emailTAB').innerHTML = '<iframe id="emailIFRAME" style="border:none;width:100%;height:670px;" frameborder="no" src="index.php?module=EcmKpkw&action=Emails&to_pdf=1&type=out&pTypeTo=' + document.forms.DetailView.parent_type.value + '&pIdTo=' + document.forms.DetailView.parent_id.value + '&pTypeFrom=Users&pIdFrom=' + document.forms.DetailView.assigned_user_id.value + '&kpkw_id=' + document.forms.DetailView.record.value + '&record=' + document.forms.DetailView.email_id.value + '&type=' + type + '">Yours browser not accept iframes!</iframe>';
}
setInterval(function() {
doRequest('index.php', "module=EcmKpkw&action=subpanels&to_pdf=1&record=" + document.forms.DetailView.record.value,
function(result) {
if (result != '' && document.getElementById('subpanels_div'))
document.getElementById('subpanels_div').innerHTML = result;
}
);
},
10000
);
//quick view
var main = document.getElementById('main');
if (main) {
var h2 = main.getElementsByTagName('h2')[0];
if (h2) {
h2.style.display = 'inline';
var quickInfoH2 = document.getElementById('quickInfoH2');
if (quickInfoH2) {
h2.parentNode.appendChild(quickInfoH2);
quickInfoH2.style.display = '';
}
}
}
if (OPT['setTab'] && OPT['setTab'] != '') {
if (OPT['setTab'] == 'EMAIL')
setEMAIL();
}
for(var i=0; i<N.rowCount(); i++) {
//N.row(i).calculateTotal();
}
}
);

View File

@@ -0,0 +1,839 @@
function dump()
{
var cos = document.forms.EditView.elements;
for ( foo in cos ){
console.log(cos[foo].name + " = " + cos[foo].value);
}
}
function doRequest(where, post, doFunction, error) {
this.Display = function(result) {
doFunction(result.responseText);
}
this.Fail = function(result) {
if (error)
alert(error);
}
YAHOO.util.Connect.asyncRequest('POST', where, {success: this.Display, failure: this.Fail}, post);
}
function changeValidateRequired(formname, name, required) {
for (var i = 0; i < validate[formname].length; i++)
if (validate[formname][i][0] == name) {
validate[formname][i][2] = required;
break;
}
}
function set_focus() {
document.getElementById('ecmkpkw_name').focus();
}
function my_popup(module, field_array, call_back_function, form_name) {
if (!call_back_function)
call_back_function = "set_return";
if (!form_name)
form_name = "EditView";
return open_popup(module, 600, 400, "", true, false, {"call_back_function": call_back_function, "form_name": form_name, "field_to_name_array": field_array});
}
function addEvent(object, eventName, do_function) {
if (typeof(object) == "string")
object = document.getElementById(object);
if (!object) {
alert('No object in function addEvent!');
return;
}
if (object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on' + eventName, do_function);
}
}
function ItemListClear() {
while (N.rowCount() > 0)
N.row(0).deleteRow();
}
preview_pdf = function() {
//console.log('test');
var type = document.getElementById('preview_type').value;
switch(type)
{
default:
type = '';
break;
case 'exp':
type = 'exp';
break;
case 'pl':
type = 'pl';
break;
}
console.log(type);
document.getElementById('previewPDF').innerHTML = '<iframe style="border:none;width:100%;height:1200px;" frameborder="no" src="index.php?module=EcmKpkw&action=previewPDF&type='+type+'&to_pdf=1&method=I&record='+document.forms.DetailView.record.value+'#zoom=75">Yours browser not accept iframes!</iframe>';
}
test = function() {
if (OPT.parent_doc_type=='EcmSales') {
for(var i=0; i<N.rowCount(); i++) {
var data = N.row(i).getData();
getProductQuantity(i, "saveParentReservation");
}
}
}
window.onbeforeunload = function() {
return "";
}
window.onunload = function() {
removeDocumentReservations(document.getElementById("temp_id").value);
if (OPT.parent_doc_type=='EcmSales') {
for(var i=0; i<N.rowCount(); i++) {
var data = N.row(i).getData();
getProductQuantity(i, "saveParentReservation");
}
}
}
// function getAddress() {
// var id = document.getElementById('address_id').value;
// if (id=='') return;
// url='index.php?module=Accounts&action=getAddress&id='+id+'&to_pdf=1';
// var req=mint.Request();
// req.OnSuccess = function() {
// var addr = eval(this.responseText);
// console.log(addr[0].description);
// if (addr[0].description) document.getElementById('parent_shipping_address_name').value = addr[0].description;
// if (addr[0].street) document.getElementById('parent_shipping_address_street').value = addr[0].street;
// if (addr[0].postalcode) document.getElementById('parent_shipping_address_postalcode').value = addr[0].postalcode;
// if (addr[0].city) document.getElementById('parent_shipping_address_city').value = addr[0].city;
// if (addr[0].country) document.getElementById('parent_shipping_address_country').value = addr[0].country;
// }
// req.Send(url);
// }
// getProductType = function(index) {
// var data = N.row(index).getData();
// var url='index.php?module=EcmKpkw&action=getProductType&product_id='+data.id+'&to_pdf=1';
// var req=mint.Request();
// req.OnSuccess = function() {
// var prod = eval(this.responseText);
// data.type = prod[0]['type'];
// N.row(index).setData(data);
// }
// req.Send(url);
// }
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function updatePaymentDate(){
var rd=document.getElementById("register_date").value;
d=rd.split(".");
var days = 0;
if (document.getElementById('payment_date_d').value!='')
days = document.getElementById('payment_date_d').value;
doRequest('index.php','to_pdf=1&module=EcmKpkw&action=getPaymentDate&day='+d[0]+'&month='+d[1]+'&year='+d[2]+'&days='+days,function(result){
document.getElementById("payment_date").value = result;
}
);
}
function updateUnitNames(){
var tab=document.getElementById("tbody");
var tr=tab.getElementsByTagName("tr");
var qtyinstock;
var qty;
var total;
for(var i=0;i<tr.length;i++){
//if(tr[i].getElementsByTagName("input")[4] && tr[i].getElementsByTagName("input")[5]){
//alert(document.getElementById('ecmlanguage').value+" "+tr[i].getElementsByTagName("input")[4]);
if(UNIT_LANG[document.getElementById('ecmlanguage').value][tr[i].getElementsByTagName("input")[8].value])tr[i].getElementsByTagName("input")[9].value=UNIT_LANG[document.getElementById('ecmlanguage').value][tr[i].getElementsByTagName("input")[8].value];
//}
}
return true;
}
function SetTabIndexs(buttons) {
var main = document.getElementById('main');
var td = main.getElementsByTagName('td');
var selectedTable = null;
//var selectingColor = 'red';
//var selectingCellTable = 'green';
var TableIndex = 0;
for(var i=0; i<td.length; i++) {
if(td[i].className == 'tabEditViewDF') {
var TI = 0;
if(td[i].parentNode.cells.item(1) == td[i]) TI = 101+TableIndex; else TI = 102+TableIndex;
var nodes = td[i].getElementsByTagName('input');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
var nodes = td[i].getElementsByTagName('select');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
var nodes = td[i].getElementsByTagName('textarea');
for(var j=0; j<nodes.length; j++) nodes[j].tabIndex = TI;
if(td[i].parentNode.parentNode.parentNode !== selectedTable) {
//if(selectingColor == 'red') selectingColor = 'blue'; else selectingColor = 'red';
selectedTable = td[i].parentNode.parentNode.parentNode;
TableIndex++;
}
}
}
if(buttons==0){
var TableIndex = 0;
for(var i=0; i<td.length; i++) {
if(td[i].className == 'tabEditViewDF') {
var TI = 0;
if(td[i].parentNode.cells.item(1) == td[i]) TI = 101+TableIndex; else TI = 102+TableIndex;
var nodes = td[i].getElementsByTagName('input');
for(var j=0; j<nodes.length; j++) {
if(nodes[j].className=="button")nodes[j].tabIndex = TI+100000;
}
if(td[i].parentNode.parentNode.parentNode !== selectedTable) {
//if(selectingColor == 'red') selectingColor = 'blue'; else selectingColor = 'red';
selectedTable = td[i].parentNode.parentNode.parentNode;
TableIndex++;
}
}
}
}
}
function changeValidateRequired(formname,name,required) {
// for(var i=0; i<validate[formname].length; i++)
// if(validate[formname][i][0] == name) { validate[formname][i][2] = required; break; }
}
function set_focus() { document.getElementById('ecmkpkw_name').focus(); }
function my_popup(module, field_array, call_back_function, form_name) {
if(!call_back_function) call_back_function = "set_return";
if(!form_name) form_name = "EditView";
return open_popup(module, 900, 700, "", true, false, {"call_back_function":call_back_function,"form_name":form_name,"field_to_name_array":field_array});
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function findPos(obj) {
var nleft = 0;
var ntop = 0;
if (obj.offsetParent) {
nleft = obj.offsetLeft
ntop = obj.offsetTop
while (obj = obj.offsetParent) {
nleft += obj.offsetLeft
ntop += obj.offsetTop
}
}
return [nleft,ntop];
}
function changer() {
this.list = new Object();
this.add = function(object,type,do_function,start_value) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) return;
this.list[object.id] = new Object();
this.list[object.id].object = object;
this.list[object.id].type = type;
this.list[object.id].do_function = do_function;
this.list[object.id].start_value = start_value;
this.list[object.id].value = '';
}
this.getValue = function(element) {
var value = null;
if(element.object) {
if(element.type == "innerHTML") value = element.object.innerHTML;
if(element.type == "value") value = element.object.value;
if(element.type == "checked") value = element.object.checked;
}
return value;
}
this.interval = 1000;
this.timer = null;
this.startTimer = function() {
var cc = this;
this.timer = setInterval(
function(){
var list = cc.list;
for(x in list) {
if(list[x].start_value) {
list[x].value = cc.getValue(list[x]);
list[x].start_value = false;
}
else {
var value = cc.getValue(list[x]);
if(list[x].value !== value)
if(list[x].do_function)
list[x].do_function(list[x].object);
list[x].value = value;
}
}
},
this.interval
);
}
this.stopTimer = function () {
clearInterval(this.timer);
this.timer = null;
}
}
var ERROR = false;
var ItemListSave = function(json) { }
function ShowLoadingView() {
var slv = document.getElementById('ShowLoadingView');
if(!slv) {
slv = document.createElement('div');
slv.id = 'ShowLoadingView';
slv.className = 'transparent_class_loading';
slv.style.width = '100%';
slv.style.height = '500%';
var sli = document.createElement('img');
sli.className = 'transparent_class_loading_image';
sli.src = 'themes/default/images/loading.gif';
slv.appendChild(sli);
document.body.appendChild(slv);
}
slv.style.display = '';
}
function HideLoadingView() {
var slv = document.getElementById('ShowLoadingView');
if(slv) slv.style.display = 'none';
}
function SaveForm() {
ShowLoadingView();
setTimeout( function() {
if(OPT['checkbox_demo'] == 1 && document.forms.EditView.record.value == '') { alert(MOD.LBL_DEMO_VERSION_INFORMATION); return; }
ERROR = false;
// document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert(MOD['LBL_SAVE_FORM_ERROR']); HideLoadingView(); return false; }
document.forms.EditView.action.value = 'Save';
if(check_form('EditView')) {
doRequest('index.php',getFormPost('Save'),function(result){
console.log(result);
HideLoadingView();
return;
document.forms.EditView.record.value = result.substring(result.length-36);
alert(MOD['LBL_SAVED']);
window.onbeforeunload='';
window.onunload='';
window.location = 'index.php?module='+document.forms.EditView.module.value+'&action=DetailView&record='+document.forms.EditView.record.value;
HideLoadingView();
},
MOD['LBL_NOT_SAVED']
);
} else { alert(MOD['LBL_NOT_SAVED']); HideLoadingView(); return false; }
},200);
}
function ItemListClear(noNew) {
while(N.rowCount()>0) N.row(0).deleteRow(noNew);
}
function getFormPost(action) {
if(!action) action = 'previewPDF';
var pd = 'to_pdf=1'+'&module=EcmKpkw&action='+action+'&record='+document.forms.EditView.record.value;
pd += '&cache=fromJava'+ItemListSave(true);
//alert(pd);
var record = document.forms.EditView.record.value;
var pd2 = new Object();
pd2['module'] = 'EcmKpkw';
pd2['action'] = action;
pd2['record'] = document.forms.EditView.record.value;
pd2['to_pdf'] = '1';
pd2['cache'] = 'fromJava';
// document.forms.EditView.position_list.value = '';
document.forms["EditView"].action.value = action;
var tmp;
for(var i=0; i<document.forms["EditView"].elements.length; i++) {
tmp = document.forms["EditView"].elements[i];
if(tmp.name != '') {
if(tmp.type == "checkbox")
pd2[document.forms["EditView"].elements[i].name] =(document.forms["EditView"].elements[i].checked ? '1' : '0');
else
pd2[document.forms["EditView"].elements[i].name] = document.forms["EditView"].elements[i].value;
}
}
pd2['module'] = 'EcmKpkw';
pd2['action'] = action;
pd2['record'] = record;
pd2['to_pdf'] = '1';
pd2['cache'] = 'fromJava';
pd += '&otherFormData='+JSON.stringifyNoSecurity(pd2);
return pd;
}
/*
function sendFormPostToPdf() {
ShowLoadingView();
setTimeout( function() {
ERROR = false;
//document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert('There are some errors on list'); HideLoadingView(); return false; }
doRequest("index.php",getFormPost(),function(result){
HideLoadingView();
EcmPreviewPDF('index.php?module=EcmKpkw&action=previewPDF&to_pdf=1&from=EcmKpkw',{zoom:75});
}
);
},200);
}
*/
function sendFormPostToPdf() {
ERROR = false;
document.getElementById('position_list').value = ItemListSave(true);
if(ERROR) { alert('There are some errors on list'); return false; }
doRequest("index.php",getFormPost(),function(result){
if(SHOW_PDF_IN_DIV==1){
HideLoadingView();
//SetTab('PREVIEW');
EcmPreviewPDF('index.php?module=EcmKpkw&action=previewPDF&to_pdf=1&from=EcmKpkw',{zoom:75});
}
else{
SetTab('PREVIEW');
document.getElementById('previewPDF').innerHTML = "<iframe style='border:none;width:100%;height:1200px;' frameborder='no' src='index.php?module=EcmKpkw&action=previewPDF&to_pdf=1&from=EcmKpkw#zoom=75'>Yours browser not accept iframes!</iframe>";
}
}
);
}
function canConfirm() {
if(document.forms.EditView.status.value == "accepted" && !OPT.user.confirm_invoiceouts) {
alert('This option is disabled for You.');
document.forms.EditView.status.value = ((OPT.old_status)?OPT.old_status:'');
}
OPT.old_status = document.forms.EditView.status.value;
}
function CheckDiscount(noAlert) {
var discount = 0;
//var tmp = UserFormatNumberToNumber(document.getElementById('discount').value);
var tmp = UserFormatNumberToNumber("0%");
if(tmp == -1) {
if(!noAlert)
alert(MOD['LBL_DISCOUNT_ERROR']+' ('+document.getElementById('discount').value+')');
discount = -1;
//document.getElementById('discount').style.color = 'red';
} else {
discount = tmp;
//document.getElementById('discount').value = NumberToUserFormatNumber(discount);
//document.getElementById('discount').style.color = 'black';
}
return discount;
}
//document.getElementById('previewPDF').innerHTML = "<iframe style='border:0px; width:100%; height:100%;' src='index.php?module=EcmKpkw&action=InvoicePDFPreview&to_pdf=1'>Yours browser not accept iframes!</iframe>";
//ProductListSave();
//YAHOO.util.Connect.asyncRequest('POST','index.php',{success:this.Display,failure:this.Fail},this.postData());
var AjaxSearchProducts;
var parentFL;
var productFL;
addEvent(
window,
'load',
function () {
var CHANGER = new changer();
CHANGER.interval = 500;
set_focus();
//initialize table
//N = new MyTable('itemsTable');
//N.divParent = document.getElementById('itemsTableDIV');
var from_popup_return = false;
function returnedData(popup_reply_data) {
from_popup_return = true;
var form_name = popup_reply_data.form_name;
var name_to_value_array = popup_reply_data.name_to_value_array;
for (var the_key in name_to_value_array) {
if(the_key == 'toJSON'){}
else {
var displayValue=name_to_value_array[the_key].replace(/&amp;/gi,'&').replace(/&lt;/gi,'<').replace(/&gt;/gi,'>').replace(/&#039;/gi,'\'').replace(/&quot;/gi,'"');;
var e = document.getElementById(the_key);
if(e) { e.value = displayValue; }
}
}
//if(N.selectedRow) N.selectedRow.calculateTotal();
};
// function generateNumber() {
// if(document.getElementById('template_id').value == '') { alert('There are no DocumentTemplates in data base!'); return;}
// doRequest(
// 'index.php',
// 'to_pdf=1&generate=1&module=EcmKpkw&action=generateNumber'+
// '&template_id='
// +document.getElementById('template_id').value+
// '&record='
// +document.forms.EditView.record.value+
// '&type='
// +document.forms.EditView.type.value,
// function(result){
// var arr = eval(result)[0];
// document.getElementById('number').value = arr.number;
// document.getElementById('document_no').value = arr.document_no;
// },
// ''
// );
// };
//if(OPT['new_number']) generateNumber();
//if(document.getElementById('template_id').value != '') document.getElementById('template_id').onchange();
//addEvent('template_id','change',generateNumber);
//addEvent(document.forms.EditView.status,'change',canConfirm);
setPREVIEW = function() {
if(CheckDiscount() != -1) {
calculateTotal();
sendFormPostToPdf();
}
}
//CHANGER.add('ecmpaymentcondition_id', 'value', function(obj){
//updatePaymentDate();
// },
//// false
// );
//CHANGER.add('parent_id','value',function(){alert('zmiana parent');},true);
function setToAddrEmail(str) {
if(str && str != '') str = eval(str); else str = '';
if(typeof(str) == "object") str = str[0]; else str = '';
if(document.getElementById('parent_type').value == 'Accounts') {
//= document.getElementById('to_addrs_field'); if(tmp) tmp.value = (str=='')?'':(((str.name)?str.name:'')+' <'+((str.email1)?str.email1:'')+'>; ');
tmp = document.getElementById('parent_address_street'); if(tmp) tmp.value = (str.billing_address_street)?str.billing_address_street:'';
tmp = document.getElementById('parent_address_city'); if(tmp) tmp.value = (str.billing_address_city)?str.billing_address_city:'';
tmp = document.getElementById('parent_address_postalcode'); if(tmp) tmp.value = (str.billing_address_postalcode)?str.billing_address_postalcode:'';
tmp = document.getElementById('parent_address_country'); if(tmp) tmp.value = (str.billing_address_country)?str.billing_address_country:'';
// tmp = document.getElementById('to_nip'); if(tmp) tmp.value = (str.sic_code)?str.sic_code:'';
}
}
//create Contact
contactFL = new FormLoader();
contactFL.load('EcmKpkw','Contacts','contactFL');
contactFL.onResponseData = function(data) {
//hideSmartInputFloat er(true);
document.forms.EditView.contact_id.value = data['id'];
document.forms.EditView.contact_name.value = data['name'];
document.forms.EditView.parent_contact_name.value = data['name'];
document.forms.EditView.parent_contact_title.value = data['title'];
};
// contactFL.setEditDblClick(document.forms.EditView.contact_name);
contactFL.onEditDblClick = function() {
var ret = "&fl_record="+document.forms.EditView.contact_id.value;
if(document.forms.EditView.parent_type.value == "Accounts") ret += "&fl_account_id="+document.forms.EditView.parent_id.value+"&fl_account_name="+document.forms.EditView.parent_name.value;
var ccc = document.forms.EditView.contact_name.value;
var cc_pos = ccc.indexOf(" ");
if(cc_pos != -1) {
var cc_ = '&fl_first_name='+ccc.substr(0,cc_pos)+'&fl_last_name='+ccc.substr(cc_pos+1,ccc.length);
ret += cc_;
}
return ret;
}
contactFL.onButtonClick = function() {
var ret = "&fl_record="+document.forms.EditView.contact_id.value;
if(document.forms.EditView.parent_type.value == "Accounts") ret += "&fl_account_id="+document.forms.EditView.parent_id.value+"&fl_account_name="+document.forms.EditView.parent_name.value;
var ccc = document.forms.EditView.contact_name.value;
var cc_pos = ccc.indexOf(" ");
if(cc_pos != -1) {
var cc_ = '&fl_first_name='+ccc.substr(0,cc_pos)+'&fl_last_name='+ccc.substr(cc_pos+1,ccc.length);
ret += cc_;
}
return ret;
}
//document.forms.EditView.contact_id.parentNode.appendChild(contactFL.createButton());
function ParentIdChange(obj) {
var list = '';
if(document.getElementById('parent_type').value == 'Accounts') {
list = 'gdModule=Accounts&gdData=sic_code|name|email1|billing_address_street|billing_address_city|billing_address_postalcode|billing_address_country|sic_code|sic_code|vatid|is_vat_free|ecmlanguage|currency_id|ecmpaymentcondition_name|ecmpaymentcondition_id|supplier_code|nip|index_dbf|currency_id|invoice_type|id|payment_method|payment_deadline';
}
if(document.getElementById('parent_type').value == 'Contacts') {
list = 'gdModule=Contacts&gdData=full_name|email1|primary_address_street|primary_address_city|primary_address_postalcode|primary_address_country';
}
if (obj.value != '') {
doRequest('index.php','module=EcmKpkw&action=getData&'+list+'&gdId='+obj.value+'&to_pdf=1',setToAddrEmail);
// getAddresses();
}
}
CHANGER.add('parent_id', 'value', ParentIdChange, OPT['check_parent_id']);
CHANGER.add('contact_id', 'value', function(obj) {
if(obj.value == '') {
document.forms.EditView.parent_contact_name.value = '';
document.forms.EditView.parent_contact_title.value = '';
} else {
doRequest('index.php','module=EcmKpkw&action=getData&gdModule=Contacts&gdData=full_name|title&gdId='+obj.value+'&to_pdf=1', function(str) {
if(str && str != '') str = eval(str); else str = '';
if(typeof(str) == "object") str = str[0]; else str = '';
document.forms.EditView.parent_contact_name.value = str.full_name;
document.forms.EditView.parent_contact_title.value = str.title;
});
}
},false);
if(document.getElementById('parent_id').value == '') ParentIdChange(document.getElementById('parent_id'));
var setTexts = function(no_confirm_question) {
var resp = true;
if(!no_confirm_question)
resp = confirm(MOD.LBL_ALERT_ECMLANGUAGE_CHANGE);
if(resp) {
var el = document.getElementById('ecmlanguage');
if (!el.value || el.value=="") el.value="pl_pl";
//document.forms.EditView.header_text.value = OPT['ecmlanguage'][el.value]['texts']["Accounts"]['header_text'];
//document.forms.EditView.footer_text.value = OPT['ecmlanguage'][el.value]['texts']["Accounts"]['footer_text'];
//document.forms.EditView.ads_text.value = OPT['ecmlanguage'][el.value]['texts']["Accounts"]['ads_text'];
}
}
YAHOO.util.Event.addListener(document.getElementById('ecmlanguage'),'change',function(){setTexts();});
if(document.forms.EditView.record.value == '') setTexts(true);
//create Parent
parentFL = new FormLoader();
parentFL.load('EcmKpkw','Parents','parentFL');
parentFL.onResponseData = function(data) {
document.forms.EditView.parent_id.value = data['id'];
document.forms.EditView.parent_name.value = data['name'];
ParentIdChange(document.forms.EditView.parent_id);
};
//parentFL.setEditDblClick(document.forms.EditView.parent_name);
parentFL.onEditDblClick = function() { parentFL.createModule=document.forms.EditView.parent_type.value; return "&fl_record="+document.forms.EditView.parent_id.value; }
parentFL.onButtonClick = function() { parentFL.createModule=document.forms.EditView.parent_type.value; return "&fl_name="+document.forms.EditView.parent_name.value; }
//document.forms.EditView.parent_id.parentNode.appendChild(parentFL.createButton());
//create Product
productFL = new FormLoader();
productFL.load('EcmQuestions','Parents','productFL');
productFL.onResponseData = function(data) {
data.price = data.selling_price;
data.quantity = '1';
N.selectedRow.setData(data);
N.selectedRow.calculateTotal();
};
CHANGER.add('ecminvoiceout_id', 'value', function(obj) {
if(obj.value != '') ViewCorrectInfo(obj.value);
},
true
);
CHANGER.add('ecminvoiceout_id', 'value', function(obj) {
if(document.getElementById('type').value=="correct"){
addToValidate('EditView', 'ecminvoiceout_id', 'text', false,MOD.LBL_ECMINVOICEOUT_NAME);
}
},
true
);
//setInterval("updateUnitNames();",1000);
//setInterval("updatePaymentDate();",2000);
//quick view
var main = document.getElementById('main');
if(main) {
var h2 = main.getElementsByTagName('h2')[0];
if(h2) {
h2.style.display = 'inline';
var span = document.createElement('span');
span.innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="document_no_h"></span> - <span id="parent_name_h"></span> - <span id="parent_contact_name_h"></span> - <span id="parent_address_street_h"></span>&nbsp; &nbsp;<span id="parent_address_postalcode_h"></span>&nbsp;<span id="parent_address_city_h"></span>&nbsp; &nbsp;<span id="parent_address_country_h"></span> - <span id="total_h"></span>'
h2.parentNode.appendChild(span);
}
}
CHANGER.add('document_no','value',function(obj){document.getElementById('document_no_h').innerHTML = obj.value;},false);
CHANGER.add('parent_contact_name','value',function(obj){document.getElementById('parent_contact_name_h').innerHTML = obj.value;},false);
CHANGER.add('parent_address_street','value',function(obj){document.getElementById('parent_address_street_h').innerHTML = obj.value;},false);
CHANGER.add('parent_address_postalcode','value',function(obj){document.getElementById('parent_address_postalcode_h').innerHTML = obj.value;},false);
CHANGER.add('parent_address_city','value',function(obj){document.getElementById('parent_address_city_h').innerHTML = obj.value;},false);
CHANGER.add('parent_address_country','value',function(obj){document.getElementById('parent_address_country_h').innerHTML = obj.value;},false);
CHANGER.add('total','value',function(obj){document.getElementById('total_h').innerHTML = obj.value;},false);
function ChangeAccessFunction(obj,type) {
var objs = obj.getElementsByTagName('input');
for(var i=0; i<objs.length; i++)
if(objs[i].id != 'parent_name' && objs[i].id != 'parent_id' && objs[i].name != 'btn_parent_name' && objs[i].name != 'btn_clr_parent_name' && objs[i].name != 'btn_create_parent_name')
objs[i].disabled = type;
var objs = obj.getElementsByTagName('textarea');
for(var i=0; i<objs.length; i++)
objs[i].disabled = type;
var objs = obj.getElementsByTagName('select');
for(var i=0; i<objs.length; i++)
if(objs[i].id != 'parent_type')
if (OPT.selectStock!=false && objs[i].id=='stock_id') continue;
else
objs[i].disabled = type;
if(type == 'disabled')
TabsMainBlock = true;
else
TabsMainBlock = false;
}
//mz
if (document.getElementById('parent_type')!='EcmStockDocOuts') {
//addToValidate('EditView', 'stock_id', 'text', false,MOD.LBL_STOCK_NAME);
//addToValidate('EditView', 'stock_name', 'text', false,MOD.LBL_STOCK_ID);
} else {
document.getElementById('stock_id').disabled='disabled';
OPT.selectStock = false;
}
/*
if (OPT.from_wz==false && OPT.from_sale===false) {
TabsMainBlock = true;
document.getElementById("stock_id").onchange= function() {
if (document.getElementById("stock_id").value!="")
this.disabled=true;
if(document.getElementById("stock_id").value!="" && document.getElementById("parent_id").value!=""){
TabsMainBlock = false;
}
else{
TabsMainBlock = true;
}
};
document.getElementById("parent_id").onchange= function() {
alert('change!');
if(document.getElementById("stock_id").value!="" && document.getElementById("parent_id").value!=""){
TabsMainBlock = false;
}
else{
TabsMainBlock = true;
}
};
}
*/
CHANGER.startTimer();
// document.getElementById("payment_date").readOnly=true;
SetTabIndexs(0);
//document.VAT1=VAT;
document.PositionList=N;
document.forms.EditView.parent_name.focus();
//if (OPT.from_sale==true)
//transformSaleIntoTemponaryReservation(document.getElementById("temp_id").value);
}
);

View File

@@ -0,0 +1,784 @@
function doRequest(where, post, doFunction, error) {
this.Display = function(result) {
doFunction(result.responseText);
}
this.Fail = function(result) {
if (error)
alert(error);
}
YAHOO.util.Connect.asyncRequest('POST', where, {success: this.Display, failure: this.Fail}, post);
}
function changeValidateRequired(formname, name, required) {
for (var i = 0; i < validate[formname].length; i++)
if (validate[formname][i][0] == name) {
validate[formname][i][2] = required;
break;
}
}
function set_focus() {
document.getElementById('name').focus();
}
function my_popup(module, field_array, call_back_function, form_name) {
if (!call_back_function)
call_back_function = "set_return";
if (!form_name)
form_name = "EditView";
return open_popup(module, 600, 400, "", true, false, {"call_back_function": call_back_function, "form_name": form_name, "field_to_name_array": field_array});
}
function addEvent(object, eventName, do_function) {
if (typeof(object) == "string")
object = document.getElementById(object);
if (!object) {
alert('No object in function addEvent!');
return;
}
if (object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on' + eventName, do_function);
}
}
function ItemListClear() {
while (N.rowCount() > 0)
N.row(0).deleteRow();
}
addEvent(
window,
'load',
function() {
//initialize table
N = new MyTable('itemsTable');
N.onRefreshRowIndex = function(row) {
var data = new Object();
data['index'] = (row.index + 1).toString();
row.cells.item(0).setData(data);
}
N.onCreateRow = function(row) {
row.newPos = false;
row.ondblclick = function() {
this.newPos = !this.newPos;
var img = this.cells.item(1).getElementsByTagName('img');
if (!this.newPos)
img[0].src = "modules/EcmInvoiceOuts/images/edit.gif";
else
img[0].src = "modules/EcmInvoiceOuts/images/editset.gif";
for (var i = 0; i < this.myTable.colCount(); i++)
this.cells.item(i).change(!this.newPos);
}
row.onSelect = function() {
for (var i = 0; i < this.myTable.colCount(); i++) {
this.cells.item(i).style.height = OPT['row_item_height_selected'];
this.cells.item(i).change(!this.newPos);
}
}
row.onDeselect = function() {
for (var i = 0; i < this.myTable.colCount(); i++) {
this.cells.item(i).style.height = OPT['row_item_height'];
this.cells.item(i).change(false);
}
}
row.calculateTotal = function() {
//do nothing :)
}
}
N.onCreateCell = function(cell) {
var i = cell.index;
cell.change = function(select) {
};
//cell.style.height = OPT['row_item_height'];
cell.style.height = 50;
cell.noSelect = true;
if (i == 0) {
cell.setData = function(data) {
if (data.index)
cell.firstChild.value = data.index;
};
cell.getData = function(data) {
data.index = cell.firstChild.value;
}
cell.select = function() {
this.selectNext();
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('readOnly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 1) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.code = cn[0].value;
data.id = cn[1].value;
data.unit_name = cn[2].value;
data.vat_id = cn[3].value;
data.category_id = cn[4].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if (data.code)
cn[0].value = data.code;
if (data.id)
cn[1].value = data.id;
if (data.unit_name)
cn[2].value = data.unit_name;
if (data.vat_id)
cn[3].value = data.vat_id;
if (data.category_id)
cn[4].value = data.category_id;
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" autocomplete="off" >';
cell.innerHTML = edit;
cell.align = 'right';
var id = document.createElement('input');
id.setAttribute('type', 'hidden');
cell.appendChild(id);
var unit_id = document.createElement('input');
unit_id.setAttribute('type', 'hidden');
//unit_id.setAttribute('value',OPT['default_unit']);
unit_id.setAttribute('value', 'TMP');
cell.appendChild(unit_id);
var vat_id = document.createElement('input');
vat_id.setAttribute('type', 'hidden');
//vat_id.setAttribute('value',OPT['default_vat']);
vat_id.setAttribute('value', '23');
cell.appendChild(vat_id);
var category_id = document.createElement('input');
category_id.setAttribute('type', 'hidden');
category_id.setAttribute('value', '');
cell.appendChild(category_id);
}
if (i == 2) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('textarea');
data.name = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('textarea');
if (data.name)
cn[0].value = data.name;
}
var textarea = '<textarea tabindex="1" readonly="readonly" style="height:100%" class="inputs"></textarea>';
cell.innerHTML = textarea;
}
if (i == 3) {
cell.getData = function(data, noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value);
if (tmp == -1) {
ERROR = true;
//if(!noAlert)
//alert(MOD['LBL_FORMAT_NUMBER_ERROR']+' ('+this.firstChild.value+')');
data.quantity = 0;
this.firstChild.style.color = 'red';
} else {
data.quantity = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
if (data.quantity)
this.firstChild.value = NumberToUserFormatNumber(data.quantity);
else
this.firstChild.value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" style="text-align:right;" autocomplete="off" class="inputs" value="' + NumberToUserFormatNumber(1) + '">';
cell.innerHTML = edit;
}
if (i == 4) {
cell.getData = function(data, noAlert) {
data.unit_id = this.firstChild.value;
}
cell.setData = function(data) {
this.firstChild.value = data.unit_id;
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="">';
cell.innerHTML = edit;
}
if (i == 5) {
cell.getData = function(data, noAlert) {
}
cell.setData = function(data) {
var value;
if (data.startprice)
value = data.startprice;
else
value = 0;
this.firstChild.value = NumberToUserFormatNumber(value);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="0">';
cell.innerHTML = edit;
}
if (i == 6) {
cell.getData = function(data, noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value, '%');
if (tmp == -1) {
ERROR = true;
if (!noAlert)
alert(MOD['LBL_FORMAT_NUMBER_ERROR'] + ' (' + this.firstChild.value + ')');
data.discount = 0;
this.firstChild.style.color = 'red';
} else {
data.discount = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
if (data.discount)
this.firstChild.value = NumberToUserFormatNumber(data.discount, '%');
else
this.firstChild.value = NumberToUserFormatNumber(0, '%');
}
cell.selectNext = function() {
var row = this.parentNode.selectNext();
row.select();
row.cells.item(0).select();
};
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="' + NumberToUserFormatNumber(0, '%') + '">';
cell.innerHTML = edit;
}
if (i == 7) {
cell.getData = function(data, noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value);
if (tmp == -1) {
ERROR = true;
if (!noAlert)
alert(MOD['LBL_FORMAT_NUMBER_ERROR'] + ' (' + this.firstChild.value + ')');
data.price = 0;
this.firstChild.style.color = 'red';
} else {
data.price = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.subprice) cn[0].value = NumberToUserFormatNumber(data.subprice);
else cn[0].value = NumberToUserFormatNumber(0);
if(data.price) cn[1].value = NumberToUserFormatNumber(data.price);
else cn[1].value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'"><br><input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'">';
cell.innerHTML = edit;
}
if (i == 8) {
cell.getData = function(data, noAlert) {
var cn = this.getElementsByTagName('input');
data.vat_value = cn[0].value;
data.vat_id = cn[1].value;
if (VAT[cn[1].value])
data.vat_name = VAT[cn[1].value].name;
}
cell.setData = function(data) {
if (data.vat_value)
this.getElementsByTagName('input')[0].value = data.vat_value;
if (data.vat_id)
this.getElementsByTagName('input')[1].value = data.vat_id;
if (data.vat_name)
this.getElementsByTagName('input')[2].value = data.vat_name;
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if (!ERROR) {
data.vat_id = data.vat_id;
this.setData(data);
}
}
var inp = document.createElement('input');
inp.setAttribute('type', 'hidden');
cell.appendChild(inp);
var inp = document.createElement('input');
inp.setAttribute('type', 'hidden');
cell.appendChild(inp);
var inp;
inp = document.createElement('input');
inp.setAttribute('type', 'text');
inp.className = 'inputs';
inp.style.textAlign = "right";
inp.cell = cell;
cell.appendChild(inp);
}
if (i == 9) {
//cell.select = function() { };
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
if (cn[0]) data.subtotal = UserFormatNumberToNumber(cn[0].value);
else data.subtotal = 0;
if (cn[1]) data.total = UserFormatNumberToNumber(cn[1].value);
else data.total = 0;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.subtotal) cn[0].value = NumberToUserFormatNumber(data.subtotal);
else cn[0].value = NumberToUserFormatNumber(0);
if(data.total) cn[1].value = NumberToUserFormatNumber(data.total);
else cn[1].value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'"><br><input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'">';
cell.innerHTML = edit;
}
}
N.onSetCellData = function(row, cell, data) {
if (cell.innerHTML == '')
cell.innerHTML = '&nbsp;';
}
var pl = document.getElementById('position_list').value;
if (pl && pl != '') {
try {
pl = eval(pl);
for (x in pl) {
if (typeof(pl[x].code) != "undefined") {
var pl_row = pl[x];
N.addRow().setData(pl_row);
}
}
} catch (err) {
pl = null;
}
;
}
if (N.rowCount() == 0)
N.addRow();
calculateTotal = function() {
var vats = new Object();
var subtotal = 0;
var total = 0;
//var cbm_total = 0;
for(var i=0; i<N.rowCount(); i++) {
var data = N.row(i).getData();
console.log(data);
if(data.vat_id && data.name != '') {
if(typeof(vats[data.vat_id]) != "object") { vats[data.vat_id] = new Object(); vats[data.vat_id]['vat'] = 0;}
vats[data.vat_id]['vat'] += data.subtotal;
}
subtotal += data.subtotal;
//cbm_total += data.cbm;
}
console.log(subtotal);
total = subtotal;
var rt = document.getElementById('result_table');
for(var i=1; i<rt.rows.length-1; i++) { if(!vats[rt.rows.item(i).id]) { rt.deleteRow(i); --i; } else vats[rt.rows.item(i).id]['node'] = rt.rows.item(i); }
for(var x in vats) {
if(VAT[x]){
vats[x]['vat'] = vats[x]['vat']*(parseFloat(VAT[x].value)/100);
total += vats[x]['vat'];
var txL = MOD['LBL_VAT']+' ('+VAT[x].name+')';
var txF = NumberToUserFormatNumber(vats[x]['vat']);
}
if(vats[x]['node']) {
vats[x]['node'].id = x;
vats[x]['node'].cells.item(0).innerHTML = txL;
vats[x]['node'].cells.item(1).innerHTML = "<input type='text' readonly='readonly' style='border:0px;font-weight:900;width:100%;text-align:right;' value='"+txF+"'>";
} else {
rt.insertRow(1);
rt.rows.item(1).id = x;
rt.rows.item(1).insertCell(0);
rt.rows.item(1).cells.item(0).className = 'positionsLabel';
rt.rows.item(1).cells.item(0).innerHTML = txL;
rt.rows.item(1).insertCell(1);
rt.rows.item(1).cells.item(1).className = 'positionsField';
rt.rows.item(1).cells.item(1).innerHTML = "<input type='text' readonly='readonly' style='border:0px;font-weight:900;width:100%;text-align:right;' value='"+txF+"'>";
}
}
var total2 = total;
var discount;
// if((discount = CheckDiscount(true)) == -1) discount = 0;
discount = 0;
var discount2 = subtotal*discount/100;
total = total2-discount2;
discount2 = NumberToUserFormatNumber(discount2).toString();
total2 = ((OPT['type'] == "correct")?'-':'')+NumberToUserFormatNumber(total2).toString();
total = ((OPT['type'] == "correct")?'-':'')+NumberToUserFormatNumber(total).toString();
document.getElementById('subtotal').value = NumberToUserFormatNumber(subtotal);
if(document.getElementById('total_2')) document.getElementById('total_2').value = total2;
//rt.rows.item(rt.rows.length-2).cells.item(0).innerHTML = MOD['LBL_DISCOUNT']+' ('+NumberToUserFormatNumber(discount,'%')+')';
//document.getElementById('discount_2').value = discount2;
document.getElementById('total').value = total2;
//document.getElementById('cbm_total').value = cbm_total;
}
calculateTotal();
function HideLoadingView() {
var slv = document.getElementById('ShowLoadingView');
if (slv)
slv.style.display = 'none';
}
setPREVIEW = function() {
if (SHOW_PDF_IN_DIV == 1) {
HideLoadingView();
//SetTab('preview_PREVIEW');
EcmPreviewPDF('index.php?module=EcmInvoiceOuts&action=previewPDF&to_pdf=1&method=I&record=' + document.forms.DetailView.record.value + '&type=' + type, {zoom: 75});
}
else {
SetTab('panel_PREVIEW');
}
}
preview_pdf = function() {
console.log('test');
var type = document.getElementById('preview_type').value;
switch(type)
{
default:
type = '';
break;
case 'exp':
type = 'exp';
break;
case 'pl':
type = 'pl';
break;
}
console.log(type);
document.getElementById('previewPDF').innerHTML = '<iframe style="border:none;width:100%;height:1200px;" frameborder="no" src="index.php?module=EcmInvoiceOuts&action=previewPDF&type='+type+'&to_pdf=1&method=I&record='+document.forms.DetailView.record.value+'#zoom=75">Yours browser not accept iframes!</iframe>';
}
setEMAIL = function(noCheck) {
SetTab('panel_EMAIL');
document.getElementById('emailTAB').innerHTML = '<iframe id="emailIFRAME" style="border:none;width:100%;height:670px;" frameborder="no" src="index.php?module=EcmInvoiceOuts&action=Emails&to_pdf=1&type=out&pTypeTo=' + document.forms.DetailView.parent_type.value + '&pIdTo=' + document.forms.DetailView.parent_id.value + '&pTypeFrom=Users&pIdFrom=' + document.forms.DetailView.assigned_user_id.value + '&invoiceout_id=' + document.forms.DetailView.record.value + '&record=' + document.forms.DetailView.email_id.value + '&type=' + type + '">Yours browser not accept iframes!</iframe>';
}
setInterval(function() {
doRequest('index.php', "module=EcmInvoiceOuts&action=subpanels&to_pdf=1&record=" + document.forms.DetailView.record.value,
function(result) {
if (result != '' && document.getElementById('subpanels_div'))
document.getElementById('subpanels_div').innerHTML = result;
}
);
},
10000
);
//quick view
var main = document.getElementById('main');
if (main) {
var h2 = main.getElementsByTagName('h2')[0];
if (h2) {
h2.style.display = 'inline';
var quickInfoH2 = document.getElementById('quickInfoH2');
if (quickInfoH2) {
h2.parentNode.appendChild(quickInfoH2);
quickInfoH2.style.display = '';
}
}
}
if (OPT['setTab'] && OPT['setTab'] != '') {
if (OPT['setTab'] == 'EMAIL')
setEMAIL();
}
for(var i=0; i<N.rowCount(); i++) {
//N.row(i).calculateTotal();
}
}
);

View File

@@ -0,0 +1,350 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
global $sugar_config, $current_user, $mod_strings, $current_user, $app_list_strings;
// include_once('modules/EcmQuotes/EcmQuote.php');
require_once('modules/EcmKpkw/EcmKpkw.php');
// require_once('modules/EcmKpkw/Forms.php');
require_once('include/json_config.php');
$json_config = new json_config();
// $file = 'modules/EcmGroupKpkw/EcmGroupKpkw.php';
// if (file_exists($file)) {
// $cc = array();
// require_once($file);
// $cc = EcmGroupKpkw::loadSettings();
// }
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height'] * $OPT['rows_on_item_list'] + 40 + $OPT['rows_on_item_list'] * 4;
$OPT['quick_product_item_adding'] = $cc['quick_product_item_adding'];
$OPT['check_parent_id'] = true;
$cq = $current_user->getPreference('confirm_quotes');
$OPT['user']['confirm_quotes'] = ((isset($cq) && $cq) ? 1 : 0);
$focus = new EcmKpkw();
$OPT['auto_commiting'] = $focus->ACLAccess('auto_commiting');
echo 'test'.$focus->table_name;
if (isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
if (isset($focus->id) && $focus->id != '') {
if ($focus->accepted == 1) {
return;
}
$focus->format_all_fields();
// $focus->position_list = str_replace('&quot;', '\'', $focus->getPositionList());
// $focus->Kpkw_list = str_replace('&quot;', '\'', $focus->getKpkwPositionList());
// $focus->income_list = str_replace('&quot;', '\'', $focus->getIncomePositionList());
if (!isset($focus->status) || $focus->status == '')
$focus->status = 's10';
elseif ($focus->status = 's40')
$focus->status = 's10';
//$focus->deleteReservations();
// $focus->unreserve();
$OPT['save_temp_reservations'] = true;
}
}
else {
$OPT['new_number'] = true;
$focus->status = 'registered';
}
$OPT['new_number'] = true;
if ($_REQUEST['ecmquote_id']) {
$quo = new EcmQuote();
$quo->retrieve($_REQUEST['ecmquote_id']);
$arr = array('parent_id', 'parent_name', 'status', 'name', 'register_date', 'currency_id', 'template_id', 'validtill_date', 'is_vat_free', 'to_vatid', 'ecmlanguage', 'parent_address_street', 'parent_address_city', 'parent_address_postalcode', 'parent_address_country', 'parent_name_copy', 'parent_contact_name', 'parent_contact_title', 'show_primary_params', 'show_advanced_params');
foreach ($arr as $a) {
$focus->$a = $quo->$a;
}
}
$OPT['user']['access']['send_email'] = $focus->ACLAccess('send_email');
$OPT['old_status'] = (isset($focus->status) && $focus->status != '') ? $focus->status : 'not_accepted';
if ($_REQUEST['isDuplicate'] == 'true') {
$_POST['isDuplicate'] = true;
$focus->id = '';
$OPT['isDuplicate'] = true;
$OPT['new_number'] = true;
}
if (!isset($focus->discount) || $focus->discount == '')
$focus->discount = 0.00;
if ($OPT['new_number'] == true) {
$datef = $current_user->getPreference('datef');
if ($datef != '')
$sugar_config['datef'];
$focus->register_date = date($datef);
$focus->payment_date = date($datef, mktime() + 30 * 24 * 60 * 60);
$focus->sell_date = date($datef);
}
$tmp = $current_user->getPreference('num_grp_sep');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_number_grouping_seperator'];
$OPT['sep_1000'] = $tmp;
$tmp = $current_user->getPreference('dec_sep');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_decimal_seperator'];
$OPT['dec_sep'] = $tmp;
$tmp = $current_user->getPreference('default_currency_significant_digits');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_currency_significant_digits'];
$OPT['dec_len'] = $tmp;
$OPT['default_unit'] = 'SZT.';
$OPT['default_vat'] = '23.00';
$OPT['default_category'] = '';
$OPT['default_currency'] = '-99';
$OPT['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
require_once('modules/EcmTexts/EcmText.php');
foreach ($app_list_strings['ecmlanguages_dom'] as $key => $value) {
$data = EcmText::LoadText(null, null, 'EcmKpkw', $key);
if (isset($data[0]) && isset($data[0]['data']))
$d = $data[0]['data']; else {
$d = $PDFLL;
if (!isset($d['labels']))
$d['labels'] = $PDFLL['labels'];
if (!isset($d['texts']['Contacts']['header_text']))
$d['texts']['Contacts']['header_text'] = $mod_strings['LBL_DEFAULT_CONTACT_HEADER_TEXT'];
if (!isset($d['texts']['Contacts']['footer_text']))
$d['texts']['Contacts']['footer_text'] = $mod_strings['LBL_DEFAULT_CONTACT_FOOTER_TEXT'];
if (!isset($d['texts']['Contacts']['ads_text']))
$d['texts']['Contacts']['ads_text'] = $mod_strings['LBL_DEFAULT_CONTACT_ADS_TEXT'];
if (!isset($d['texts']['Accounts']['header_text']))
$d['texts']['Accounts']['header_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_HEADER_TEXT'];
if (!isset($d['texts']['Accounts']['footer_text']))
$d['texts']['Accounts']['footer_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_FOOTER_TEXT'];
if (!isset($d['texts']['Accounts']['ads_text']))
$d['texts']['Accounts']['ads_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_ADS_TEXT'];
}
$OPT['ecmlanguage'][$key]['texts'] = $d['texts'];
}
// $show_pdf = $current_user->getPreference('show_pdf_in_div');
// if (!isset($show_pdf)) {
// require_once('modules/EcmGroupKpkw/EcmGroupKpkw.php');
// $cc = EcmGroupKpkw::loadSettings();
// $show_pdf = $cc['show_pdf_in_div_global'];
// }
$w = $GLOBALS[db]->query('select name,id,value from ecmvats where deleted=\'0\' order by name');
$nvats = mysql_num_rows($w);
while ($r = $GLOBALS[db]->fetchByAssoc($w)) {
$VAT[$r['id']] = array(
'id' => $r['id'],
'name' => $r['name'],
'value' => $r['value']
);
}
//echo '<pre>' . var_export($OPT, true); exit;
$json = getJSONobj();
$scriptOpt = '
<script language="javascript">
var SHOW_PDF_IN_DIV = ' . ($show_pdf ? : 'false') . ';
var OPT = ' . str_replace('&quot;', '"', $json->encode($OPT)) . ';
var MOD = ' . str_replace('&quot;', '"', $json->encode($mod_strings)) . ';
var N, N2;
</script>
';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmKpkw/views/EditView/view.edit.ecmkpkw.php');
$edit = new ViewEditEcmKpkw();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmKpkw';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/EditView/Tabs/EditView.tpl';
// Build rw stock and pw stock option lists.
$w = $GLOBALS['db']->query("select name,id from ecmstocks where deleted='0' order by name asc");
$stock_id = ($focus->stock_id ? : $GLOBALS['app_list_strings']['ecmKpkw_stock_id_dom']);
$pw_stock_id = ($focus->pw_stock_id ? : $GLOBALS['app_list_strings']['ecmKpkw_pw_stock_id_dom']);
$stocks[] = $pw_stocks[] = '<option value="">' . $GLOBALS['app_list_strings']['stock_select'] . '</option>';
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
$option = '<option value="'. $r['id'] . '"%s>' . $r['name'] . '</option>';
$stock_selected = $r['id'] == $stock_id;
$pw_stock_selected = $r['id'] == $pw_stock_id;
array_push($stocks , sprintf($option, $stock_selected ? ' selected' : ''));
array_push($pw_stocks , sprintf($option, $pw_stock_selected ? ' selected' : ''));
}
$status = array();
foreach($app_list_strings['ecmKpkw_status_dom'] as $key => $value)
{
$option = '<option value="'. $key . '"%s>' . $value . '</option>';
$selected = ($key == $focus->status);
//var_dump($key, $value, $selected);
array_push($status , sprintf($option, $selected ? ' selected' : ''));
}
$edit->ss->assign('STATUS', implode($status));
$repair_status = array();
foreach($app_list_strings['ecmKpkw_repair_status_dom'] as $key => $value) {
$option = '<option value="' . $key . '"%s>' . $value . '</option>';
$selected = ($key == $focus->repair_status);
array_push($repair_status, sprintf($option, $selected ? ' selected' : ''));
}
$edit->ss->assign('REPAIR_STATUS', implode($repair_status));
$focus->history = htmlspecialchars_decode($focus->history) ? : '[]';
//echo '<pre>' . var_export(strlen($focus->history), true) . '</pre>';
//echo '<pre>' . var_export(json_decode($focus->history, true), true) . '</pre>';
$edit->ss->assign('HISTORY', json_decode($focus->history, true));
$edit->ss->assign('STOCK', implode($stocks));
$edit->ss->assign('PW_STOCK', implode($pw_stocks));
$edit->ss->assign('OPT', $OPT);
$edit->preDisplay();
// Build templates option list.
// $arr_template = $focus->getTemplateList();
// $tt = array();
// foreach ($arr_template as $k => $v) {
// $option = '<option value="'. $k . '"%s>' . $v . '</option>';
// $selected = ($k == $focus->template_id);
// array_push($tt , sprintf($option, $selected ? ' selected' : ''));
// }
// $edit->ss->assign('DOCUMENT_TEMPLATES_OPTIONS', implode($tt));
if (count($_REQUEST['check']) > 0) {
foreach ($_REQUEST['check'] as $ch) {
$r = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query('select * from ecmquoteitems where id=' . $ch . ''));
$pos = EcmQuote::getPosition($r);
$pos['item_id'] = $ch;
$ret[] = $pos;
}
//print_r($ret);die();
$focus->position_list = $json->encode($ret);
}
if (!$focus->id)
$temp_id = create_guid();
else
$temp_id = $focus->id;
$edit->ss->assign('TEMP_ID', $temp_id);
$pk = array(
array(
'wn' => 123.0,
'amo' => 123.1,
'ma' => 123.2,
),
);
$regisry = array(
array(
'wn' => 321.0,
'amo' => 321.1,
'ma' => 321.2,
),
);
$pkTemp = $json->encode($pk);
$registryTemp = $json->encode($regisry);
//echo '<pre>' . var_export($pkTemp, true) . '</pre>';
//echo '<pre>' . var_export($registryTemp, true) . '</pre>';
//exit;
if($focus->created_by==''){
$us=$current_user->id;
} else {
$us=$focus->created_by;
}
$r=$GLOBALS['db']->query("select c.name,c.id,c.currency_id from ecmcashs as c
join ecmcashs_ecmkpkw as rel on c.id=rel.ecmcash_id where rel.user_id='".$us."';
");
// kasy
$kasa='<select name="ecmcash_id" id="ecmcash_id" title="" tabindex="102" onChange="checkcash();">';
while($dn = $GLOBALS['db']->fetchByAssoc($r)){
if($dn['id']==$focus->ecmcash_id){$sel='selected';}else{$sel='';}
$kasa.='<option label="'.$dn['name'].'" value="'.$dn['id'].'" '.$sel.'>'.$dn['name'].'</option>';
}
$kasa.='</select>';
// end kasy
$edit->ss->assign('CASH', $kasa);
$edit->ss->assign('USER_ID', $us);
$edit->ss->assign('PK_LIST', $pkTemp);
$edit->ss->assign('REGISTRY_LIST', $registryTemp);
//$edit->ss->assign('foobar', "test");
// $edit->ss->assign('MFP', $focus->loadParserArray());
echo $edit->display();
//echo '<div id='subpanels'>';
//require_once('subpanels.php');
//echo '</div>';

View File

@@ -0,0 +1,52 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
//updates the link between contract and ecmkpkw with latest revision of
//the ecmkpkw and sends the control back to calling page.
require_once('modules/EcmKpkw/EcmKpkw.php');
require_once('include/formbase.php');
if (!empty($_REQUEST['record'])) {
$ecmkpkw = new EcmKpkw();
$ecmkpkw->retrieve($_REQUEST['record']);
if (!empty($ecmkpkw->document_revision_id) && !empty($_REQUEST['get_latest_for_id'])) {
$query="update linked_ecmkpkw set ecmkpkw_revision_id='{$document->document_revision_id}', date_modified='".gmdate($GLOBALS['timedate']->get_db_date_time_format())."' where id ='{$_REQUEST['get_latest_for_id']}' ";
$ecmkpkw->db->query($query);
}
}
handleRedirect();
?>

63
modules/EcmKpkw/Menu.php Normal file
View File

@@ -0,0 +1,63 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $mod_strings;
global $current_user;
if(ACLController::checkAccess('EcmKpkw', 'edit', true))$module_menu[]=Array("index.php?module=EcmKpkw&action=EditView&return_module=EcmKpkw&return_action=DetailView", $mod_strings['LNK_NEW_DOCUMENT'],"CreateEcmKpkw");
if(ACLController::checkAccess('EcmKpkw', 'list', true))$module_menu[]=Array("index.php?module=EcmKpkw&action=index", $mod_strings['LNK_DOCUMENT_LIST'],"EcmKpkw");
if(ACLController::checkAccess('EcmKpkw', 'list', true))$module_menu[]=Array("index.php?module=EcmKpkw&action=kpkw_report&return_module=EcmKpkw&return_action=DetailView", $mod_strings['LNK_ECMKPKW_REPORT'],"EcmKpkw");
if(ACLController::checkAccess('EcmKpkw', 'edit', true)){
$admin = new Administration();
$admin->retrieveSettings();
$user_merge = $current_user->getPreference('mailmerge_on');
if ($user_merge == 'on' && isset($admin->settings['system_mailmerge_on']) && $admin->settings['system_mailmerge_on']){
$module_menu[]=Array("index.php?module=MailMerge&action=index&reset=true", $mod_strings['LNK_NEW_MAIL_MERGE'],"EcmKpkw");
}
}
?>

2317
modules/EcmKpkw/MyTable.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,134 @@
<?php
$w = "35"; // first column width
$w2 = "15"; // second column width
if($focus->dir==1){
$title='wypłaty'; // dla
$parent_title='DLA:';
} else {
$title='wpłaty'; // komu
$parent_title='KOMU:';
}
$content = '
<table style="width: 100%; font-size: 8pt;">
<tr>
<td style="width: ' . $w . '%; vertical-align: top;">
<b><h1>Dowód '.$title.'</h1></b>
</td>
<td style="width: ' . $w . '%; vertical-align: top;"><b><h1>' . $focus->document_no . '</h1></b>z dnia: <b>' . date("d.m.Y", strtotime($focus->date_entered)) . '</b><br><br><br><br><br>
</td>
<td style="width: ' . $w2 . '%">
</td>
<td style="text-align: right">
</td>
</tr>
<tr>
<td style="width: ' . $w . '%">
<b>WYSTAWACA:</b>
</td>
<td style="width: ' . $w . '%">
<b>'.$parent_title.'</b>
</td>
<td style="width: ' . $w2 . '%">
</td>
<td style="text-align: right">
</td>
</tr>
<tr>
<td style="width: ' . $w . '%; vertical-align: top;">
'.$comp['name'].'<br>'.$addr[0].'<br>'.$addr[1].'<br>'.$comp['footer_nip'].'
</td>
<td style="width: ' . $w . '%; vertical-align: top;">
'.$focus->parent_name.'<br>'.$focus->parent_address_street.'<br>'.$focus->parent_address_postalcode.' '.$focus->parent_address_city.'<br>'.$acc->to_vatid.'
</td>
<td style="width: ' . $w2 . '%; vertical-align: top;">
</td>
<td style="text-align: right; vertical-align: top;">
</td>
</tr>
</table><br>
';
if ($focus->name && $focus->name != '') {
$content .= '
<table style="width: 100%; text-align: center">
<tr><td>
<b>' . $focus->name . '</b>
</td></tr>
</table>
';
}
$content .= '<br>';
// start items table
$columns = array ();
$columns ['price'] = array (
'field' => array (
'price'
),
'label' => 'Tytułem',
'height'=> '30',
'align' => 'center'
);
$columns ['total'] = array (
'field' => array (
'total'
),
'label' => 'Kwota',
'align' => 'center'
);
// set widths
$totals = array ();
$columns ['price'] ['width'] = '80';
$columns ['total'] ['width'] = '20';
// rysujemy :)
$content .= '
<table style="width: 100%; font-size: 7pt; border: 0.1 solid black; border-collapse: collapse"><thead>
<tr>
';
foreach ( $columns as $col ) {
$content .= '
<th style="border: 0.1 solid black; width: ' . $col ['width'] . '%;height: ' . $col ['height'] . 'px;text-align: ' . $col ['align'] . ';background-color: #E6E6FA;">' . $col ['label'] . '</th>
';
}
$content .= '
</tr></thead><tbody>
';
$content .= '<tr>';
$content .= '<td style="border: 0.1 solid black; text-align: left;height:20px;">'.$focus->ecmkpkw_name.'';
$content .= '</td>';
$content .= '<td style="border: 0.1 solid black; text-align: right;">'.number_format($focus->amount,2,',', ' ').' '.$cur->name;
$content .= '</td>';
$content .= '</tr>';
// waluty
switch ($focus->currency_id) {
case 'PLN':
echo 'ok';
break;
case '6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf':
$kwota->setCurrency(array('euro', 'euro', 'euro'),array('eurocent', 'eurocenty', 'eurocentów'));
break;
case '3c8d317e-513b-9a9b-d0e6-511e2abee625':
$kwota->setCurrency(array('funt', 'funty', 'funtów'),array('cent', 'centy', 'centów'));
break;
case '98b2b752-b0be-37c2-d2eb-511e29f81cab':
$kwota->setCurrency(array('dolar', 'dolary', 'dolarów'),array('cent', 'centy', 'centów'));
break;
}
$content .= '
</tbody></table><p style="text-align:right;font-size: 8pt;">Słownie: '.$kwota->convertPrice($focus->amount).'</p><br><br><br>
<table style="width: 100%; font-size: 8pt;"><tr><td style="width: 50%;"><b>Wystawił:</b><br>' . $user->full_name . '</td><td style="width: 50%;text-align: right;">.................................................<br>Kwotę powyższą otrzymałem</td></tr></table>
';

View File

@@ -0,0 +1,12 @@
<?php
$header = '
<table style="font-size: 7pt; width: 100%"><tr>
<td style="width: 80%">
&nbsp;
</td>
<td style="text-align: right; vertical-align: bottom;">
www.e5.pl
</td>
</tr></table>
<hr>
';

View File

@@ -0,0 +1,28 @@
<?php
function formatPDFPositions($positions, $focus) {
$result = array();
foreach ($positions as $pos) {
$pos['position'] = intval($pos['position'])+1;
$pos['quantity'] = format_number($pos['quantity'],4,2);
$pos['price']=format_number($pos['price']);
$pos['total']=format_number($pos['total']);
$result[] = $pos;
}
return $result;
}
function mysql_escape_gpc($dirty)
{
if (ini_get('magic_quotes_gpc'))
{
return $dirty;
}
else
{
return mysql_real_escape_string($dirty);
}
}

View File

@@ -0,0 +1,498 @@
<?php
/**
* Biblioteka KwotaSlownie
*
* Przede wszystkim potrafi zamienic kwote z postaci liczbowa na postac slowna,
* Z ktora na pewno kazdy sie spotkal na rachunkach lub fakturach
* Biblioteka obsluguje rozne typu danych string, integer, float
* Dlatego mozna podawac jej kwote z kropka, z przecinkiem lub liczbe calkowita
* Z kazda z nich biblioteka sobie poradzi wlaczajac w to oczywiscie kwoty ujemne.
* Biblioteka potrafi takze prawidlowo odmieniac po polsku (tysiac, tysiecy) itd.
* Dzieki zapewnionej konfigurowalnosci mozna decydowac czy kwota zdawkowa
* Ma byc prezentowana tak jak kwota podstawowa, czy tez w formie liczbowej
* Mozna takze okreslic w bibliotece walute, gdy potrzebujesz uzyc innej niz polski zloty
* Bez problemu mozemy nakazac jej odmieniac dolary, euro, jeny czy jakakolwiek inna walute
* Tyczy sie to takze kwoty zdawkowej czyli grosze, centy, pensy
*
* @link http://www.kwotaslownie.pl
* @author Maciej Strączkowski <m.straczkowski@gmail.com>
* @copyright Maciej Strączkowski
* @category Libraries
* @since 06.11.2011
* @version 1.3 [03.06.2012]
* @license LGPL (http://www.kwotaslownie.pl/license.txt)
*/
class KwotaSlownie {
// Wlasciwosc przechowujaca skladowe
private $aComponents = array();
// Tablica przechowujaca poformatowane czesci kwoty
private $aOutput = array();
// Czy kwota zdawkowa ma byc takze konwertowana na slowa
private $bRestWords = true;
// Aktualna wersja aplikacji
static public $sVersion = '1.3';
// --------------------------------------------------------------------
/**
* Metoda __construct();
*
* Metoda tworzy wlasciwosc prywatna, ktora jest tablica
* Zawiera ona czesci skladowe cen w postaci slownej
* Te dane sa zapisywane jako wlasciwosc, aby miec do nich
* Dostep w obrebie calej projektowanej biblioteki
*
* @access public
* @return void
*/
public function __construct()
{
$this->aComponents = array(
'unities' => array(
'zero', 'jeden', 'dwa', 'trzy', 'cztery', 'pięć',
'sześć', 'siedem', 'osiem', 'dziewięć', 'dziesięć',
'jedenaście', 'dwanaście', 'trzynaście', 'czternaście',
'piętnaście', 'szesnaście', 'siedemnaście', 'osiemnaście',
'dziewiętnaście'
),
'tens' => array(
'', 'dziesięć', 'dwadzieścia', 'trzydzieści', 'czterdzieści',
'pięćdziesiąt', 'sześćdziesiąt', 'siedemdziesiąt', 'osiemdziesiąt',
'dziewięćdziesiąt'
),
'hundreds' => array(
'', 'sto', 'dwieście', 'trzysta', 'czterysta',
'pięćset', 'sześćset', 'siedemset', 'osiemset',
'dziewięćset'
),
'thousands' => array(
'tysiąc', 'tysiące', 'tysięcy'
),
'milions' => array(
'milion', 'miliony', 'milionów'
),
'billions' => array(
'miliard', 'miliardy', 'miliardów'
),
'currency' => array(
'złoty', 'złote', 'złotych'
),
'currency_rest' => array(
'grosz', 'grosze', 'groszy'
)
);
}//end of __construct() method
// --------------------------------------------------------------------
/**
* Metoda setCasualMode();
*
* Metoda pozwala ustawic czy kwota zdawkowa ma byc konwertowana
* Tak samo jak kwota podstawowa na postac slowna
* Czy tez ma byc konwertowana na postac liczbowa (np. 10/100)
* Jezeli zostanie podana wartosc inna wartosc niz (text lub number)
* Zostanie ustawiona wartosc domyslna czyli konwersja slowna
*
* @access public
* @param string $sMode - text (slownie) lub number (liczbowo)
* @return boolean
*/
public function setCasualMode($sMode = 'text')
{
switch($sMode)
{
case 'text': $this->bRestWords = true; break;
case 'number': $this->bRestWords = false; break;
default: $this->bRestWords = true; break;
}
return true;
}//end of setCasualMode() method
// --------------------------------------------------------------------
/**
* Metoda setCurrency();
*
* Metoda pozwala na reczne ustawienie waluty przez uzytkownika
* Mozna zdefiniowac inna walute niz domyslne zlotowki/grosze
* Nalezy przekazac metodzie dwa parametry pierwszy jest tablica
* Zawierajaca odmiany waluty kwoty podstawowej, drugi jest tablica
* Zawierajaca odmiany waluty kwoty zdawkowej, czyli dla przykladu
* $aPrimary = array('dolar', 'dolary', 'dolarów');
* $aSecondary = array('cent', 'centy', 'centów');
*
* @access public
* @param array $aPrimary - Tablica z odmianami waluty kwoty podstawowej
* @param array $aSecondary - Tablica z odmianami waluty kwoty zdawkowej
* @return boolean
*/
public function setCurrency($aPrimary, $aSecondary)
{
$this->aComponents['currency'] = $aPrimary;
$this->aComponents['currency_rest'] = $aSecondary;
return true;
}//end of setCurrency()
// --------------------------------------------------------------------
/**
* Metoda convertPrice();
*
* Metoda dokonuje konwersji przekazanej kwoty z postaci liczbowej
* Na postac slowna, uzywajac do tego celu metod prywatnych
* Automatycznie zamienia przecinki na kropki oraz zaokragla kwote
* Do dwoch miejsc po przecinku
*
* @access public
* @param integer $iPrice - Kwota do zamiany
* @return string - Kwota przedstawiona w postaci slownej
*/
public function convertPrice($iPrice)
{
$iPrice = str_replace(',', '.', $iPrice);
if(!is_numeric($iPrice)){
return '';
}
$iPrice = number_format($iPrice, 2, '.', '');
if($iPrice >= 1000000000000 || $iPrice <= -1000000000000){
return '';
}
if($iPrice < 0){
$this->aOutput[] = 'minus';
$iPrice = $iPrice*-1;
$iPrice = number_format($iPrice, 2, '.', '');
}
$aParts = explode('.', $iPrice);
$iFirst = $aParts[0];
if(isset($aParts[1]) && $aParts[1] == '00'){
unset($aParts[1]);
}
if(isset($aParts[1])){
$iSecond = $aParts[1];
if(strlen($iSecond) < 2){
$iSecond = $iSecond.'0';
}
}
else {
$iSecond = 0;
}
$this->_convertRouter($iFirst);
$this->_convertVariety($iFirst, 'currency');
if($this->bRestWords === true){
$this->_convertRouter($iSecond);
}
else {
$this->aOutput[] = $iSecond.'/100';
}
$this->_convertVariety($iSecond, 'currency_rest');
$sReturn = implode(' ', $this->aOutput);
unset($this->aOutput);
return $sReturn;
}//end of convertPrice() method.
// --------------------------------------------------------------------
/**
* Metoda _convertRouter();
*
* Metoda okresla ilosc znakow wystepujacych w przekazanej kwocie
* Na jej podstawie decyduje co w danej chwili trzeba konwertowac
* Ilosc znakow > 9 - konwertuj miliardy
* Ilosc znakow >= 7 - konwertuj miliony
* Ilosc znakow >= 4 - konwertuj tysiace
* Ilosc znakow >= 3 - konwertuj setki
* Ilosc znakow >= 2 - konwertuj dziesiatki
* Ilosc znakow >= 1 - konwertuj jednostki
*
* @access private
* @param integer $iPrice - Kwota do zamiany
* @return boolean
*/
private function _convertRouter($iPrice)
{
$iLenght = strlen($iPrice);
if($iLenght > 9){
$this->_convertBillions($iPrice, $iLenght);
return true;
}
elseif($iLenght >= 7) {
$this->_convertMilions($iPrice, $iLenght);
return true;
}
elseif($iLenght >= 4) {
$this->_convertThousands($iPrice, $iLenght);
return true;
}
elseif($iLenght >= 3) {
$this->_convertHundreds($iPrice);
return true;
}
elseif($iLenght >= 2) {
$this->_convertTens($iPrice);
return true;
}
elseif($iLenght >= 1) {
$this->_convertUnities($iPrice);
return true;
}
return false;
}//end of _convertRouter() method.
// --------------------------------------------------------------------
/**
* Metoda _convertBillions();
*
* Metoda zapisuje ilosc znakow wystepujacych w przekazanej kwocie
* Na jej podstawie decyduje jakie czesci trzeba obciac za pomoca substr
* Obciete czesci kwoty ponownie sa wysylana do routera
* Dodatkowo dobierana jest poprawna odmiana slowa "miliard"
*
* @access private
* @param integer $iPrice - Kwota
* @param integr $iLength - Dlugosc
* @return boolean
*/
private function _convertBillions($iPrice, $iLength)
{
if($iLength >= 12) {
$iSliced = substr($iPrice, -12, 3);
$iNextSliced = substr($iPrice, 3, 12);
}
elseif($iLength >= 11) {
$iSliced = substr($iPrice, -11, 2);
$iNextSliced = substr($iPrice, 2, 11);
}
elseif($iLength >= 10) {
$iSliced = substr($iPrice, -10, 1);
$iNextSliced = substr($iPrice, 1, 10);
}
else {
return false;
}
if($iSliced != 1){
$this->_convertRouter($iSliced);
}
if($iSliced != 0){
$this->_convertVariety($iSliced, 'billions');
}
$this->_convertRouter($iNextSliced);
return true;
}//end of _convertBillions() method.
// --------------------------------------------------------------------
/**
* Metoda _convertMilions();
*
* Metoda zapisuje ilosc znakow wystepujacych w przekazanej kwocie
* Na jej podstawie decyduje jakie czesci trzeba obciac za pomoca substr
* Obciete czesci kwoty ponownie sa wysylana do routera
* Dodatkowo dobierana jest poprawna odmiana slowa "milion"
*
* @access private
* @param integer $iPrice - Kwota
* @param integr $iLength - Dlugosc
* @return boolean
*/
private function _convertMilions($iPrice, $iLength)
{
if($iLength >= 9) {
$iSliced = substr($iPrice, -9, 3);
$iNextSliced = substr($iPrice, 3, 9);
}
elseif($iLength >= 8) {
$iSliced = substr($iPrice, -8, 2);
$iNextSliced = substr($iPrice, 2, 8);
}
elseif($iLength >= 7) {
$iSliced = substr($iPrice, -7, 1);
$iNextSliced = substr($iPrice, 1, 7);
}
else {
return false;
}
if($iSliced != 1){
$this->_convertRouter($iSliced);
}
if($iSliced != 0){
$this->_convertVariety($iSliced, 'milions');
}
$this->_convertRouter($iNextSliced);
return true;
}//end of _convertMilions() method.
// --------------------------------------------------------------------
/**
* Metoda _convertThousands();
*
* Metoda zapisuje ilosc znakow wystepujacych w przekazanej kwocie
* Na jej podstawie decyduje jakie czesci trzeba obciac za pomoca substr
* Obciete czesci kwoty ponownie sa wysylana do routera
* Dodatkowo dobierana jest poprawna odmiana slowa "tysiac"
*
* @access private
* @param integer $iPrice - Kwota
* @param integr $iLength - Dlugosc
* @return boolean
*/
private function _convertThousands($iPrice, $iLength)
{
if($iLength >= 6) {
$iSliced = substr($iPrice, -6, 3);
$iNextSliced = substr($iPrice, 3, 6);
}
elseif($iLength >= 5) {
$iSliced = substr($iPrice, -5, 2);
$iNextSliced = substr($iPrice, 2, 5);
}
elseif($iLength >= 4) {
$iSliced = substr($iPrice, -4, 1);
$iNextSliced = substr($iPrice, 1, 4);
}
else {
return false;
}
if($iSliced != 1){
$this->_convertRouter($iSliced);
}
if($iSliced != 0){
$this->_convertVariety($iSliced, 'thousands');
}
$this->_convertRouter($iNextSliced);
return true;
}//end of _convertThousands() method.
// --------------------------------------------------------------------
/**
* Metoda _convertHundreds();
*
* Metoda wycina pierwszy znak liczby, ktora jest setka
* I wstawia go jako index tablicy skladowych "hundreds"
* Przyklad: 200 - 2 - hundreds[2] - dwiescie
* Nastepnie sprawdzane sa kolejne znaki przez substr
*
* @access private
* @param integer $iPrice - Kwota
* @return boolean
*/
private function _convertHundreds($iPrice)
{
$iIndex = substr($iPrice, -3, 1);
$this->aOutput[] = $this->aComponents['hundreds'][$iIndex];
if(substr($iPrice, 1, 2) > 0){
$this->_convertRouter(substr($iPrice, 1, 2));
}
else {
$this->_convertTens(substr($iPrice, 1, 2));
}
return true;
}//end of _convertHundreds() method.
// --------------------------------------------------------------------
/**
* Metoda _convertTens();
*
* Metoda sprawdza czy podanej kwoty nie mozna dopasowac do jednostek
* Jezeli nie mozna, wycinany jest pierwszy znak kwoty
* I wstawiany jest jako index tablicy skladowych "tens"
* Kolejny znak jest wysylany znowu do routera
*
* @access private
* @param integer $iPrice - Kwota
* @return boolean
*/
private function _convertTens($iPrice)
{
if(array_key_exists((string)$iPrice, $this->aComponents['unities']) && substr($iPrice, 1, 2) != 0){
$this->aOutput[] = $this->aComponents['unities'][$iPrice];
return true;
}
$iIndex = substr($iPrice, 0, 1);
$this->aOutput[] = $this->aComponents['tens'][$iIndex];
if(substr($iPrice, 1, 2) != 0){
$this->_convertRouter(substr($iPrice, 1, 2));
}
return true;
}//end of _convertTens() method.
// --------------------------------------------------------------------
/**
* Metoda _convertUnities();
*
* Metoda wstawia otrzymana liczbe jako index tablicy "unities"
* Dzieki temu wiadomo na jakie slowo zamienic dana liczbe
* 1 - unities[1] - jeden, 2 - unities[2] - dwa itd
*
* @access private
* @param integer $iPrice - Kwota
* @return boolean
*/
private function _convertUnities($iPrice)
{
$this->aOutput[] = $this->aComponents['unities'][$iPrice];
return true;
}//end of _convertUnities() method.
// --------------------------------------------------------------------
/**
* Metoda _convertVariety();
*
* Metoda na podstawie otrzymanego typu i kwoty
* Decyduje o prawidlowej polskiej odmianie
* Typ jest niczym innym jak indexem tablicy skladowych
* Przyklad: currency, thousands, bilions, milions
*
* @access private
* @param integer $iPrice - Kwota
* @param boolean $sType - Typ
* @return boolean
*/
private function _convertVariety($iPrice, $sType)
{
if($iPrice > 9){
$iLastIntegers = substr($iPrice, -2);
$sOneCurrency = $this->aComponents[$sType][2];
}
else {
$iLastIntegers = substr($iPrice, -1);
$sOneCurrency = $this->aComponents[$sType][0];
}
if($iLastIntegers >= 15){
$iLastIntegers = substr($iLastIntegers, 1, 2);
}
if($iLastIntegers >= 11){
$this->aOutput[] = $this->aComponents[$sType][2];
}
elseif($iLastIntegers == 0) {
$this->aOutput[] = $this->aComponents[$sType][2];
}
elseif($iLastIntegers == 1) {
$this->aOutput[] = $sOneCurrency;
}
elseif($iLastIntegers >= 5) {
$this->aOutput[] = $this->aComponents[$sType][2];
}
elseif($iLastIntegers >= 2) {
$this->aOutput[] = $this->aComponents[$sType][1];
}
return true;
}//end of _convertVariety() method
}//end of KwotaSlownie Library
?>

46
modules/EcmKpkw/Popup.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/EcmKpkw/Popup_picker.php');
$popup = new Popup_Picker();
echo $popup->process_page();
?>

View File

@@ -0,0 +1,183 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
-->
<!-- BEGIN: main -->
<!-- BEGIN: SearchHeader -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="edit view">
<tr>
<td>
<form action="index.php" method="post" name="popup_query_form" id="popup_query_form">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td scope="row" nowrap="nowrap">{MOD.LBL_DOC_NAME}</td>
<td nowrap="nowrap"><input type="text" name="ecmkpkw_name" size="10" value="{DOCUMENT_NAME}"/></td>
<td scope="row" nowrap="nowrap">{MOD.LBL_DET_IS_TEMPLATE}</td>
<td nowrap="nowrap"><select name="is_template" >{IS_TEMPLATE_OPTIONS}</select></td>
</tr>
<tr>
<td scope="row" nowrap="nowrap">{MOD.LBL_DET_TEMPLATE_TYPE}</td>
<td nowrap="nowrap"><select name="template_type" >{TEMPLATE_TYPE_OPTIONS}</select></td>
<td scope="row" nowrap="nowrap">{MOD.LBL_CATEGORY_VALUE}</td>
<td nowrap="nowrap"><select name="category_id" >{CATEGORY_OPTIONS}</select></td>
</tr>
<tr>
<td scope="row" nowrap="nowrap">{MOD.LBL_SUBCATEGORY_VALUE}</td>
<td nowrap="nowrap"><select name="subcategory_id" >{SUB_CATEGORY_OPTIONS}</select></td>
<td align="right" colspan=2>
<input type="hidden" name="module" value="{MODULE_NAME}" />
<input type="hidden" name="action" value="Popup" />
<input type="hidden" name="query" value="true" />
<input type="hidden" name="func_name" value="" />
<input type="hidden" name="request_data" value="{request_data}" />
<input type="hidden" name="populate_parent" value="false" />
<input type="hidden" name="record_id" value="" />
<input type="submit" name="button" class="button"
title="{APP.LBL_SEARCH_BUTTON_TITLE}"
accessKey="{APP.LBL_SEARCH_BUTTON_KEY}"
value="{APP.LBL_SEARCH_BUTTON_LABEL}" />
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<!-- BEGIN: TreeView -->
<script type="text/javascript" src="include/JSON.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/popup_helper.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script type='text/javascript' src='include/javascript/yui/connection.js'></script>
{SITEURL}
{TREEHEADER}
{SET_RETURN_JS}
<script type="text/javascript">
<!--
/* initialize the popup request from the parent */
if(typeof window.ecmkpkw.forms['popup_query_form'] != 'undefined' && window.document.forms['popup_query_form'].request_data.value == "")
{
window.ecmkpkw.forms['popup_query_form'].request_data.value
= JSON.stringify(window.opener.get_popup_request_data());
}
-->
</script>
<script>
function select_ecmkpkw(treeid) {
var node=YAHOO.namespace(treeid).selectednode;
send_back('EcmKpkw',node.data.id);
}
function populate_parent_search(treeid) {
var node=YAHOO.namespace(treeid).selectednode;
if (node.depth==1) {
new_subcategory_id=node.data.id;
if (new_subcategory_id == 'null') new_subcategory_id='';
new_category_id=node.parent.data.id;
if (new_category_id == 'null') new_category_id='';
} else {
new_category_id=node.data.id;
if (new_category_id == 'null') new_category_id='';
new_subcategory_id='';
}
if(!window.opener.ecmkpkw.getElementById('EcmKpkwadvanced_searchSearchForm')) {
window.opener.location = 'index.php?searchFormTab=advanced_search&module=EcmKpkw&action=index&query=true&category_id_advanced' +'='+escape(new_category_id)+'&subcategory_id_advanced='+escape(new_subcategory_id);
} else {
var searchTab = (window.opener.ecmkpkw.getElementById('EcmKpkwadvanced_searchSearchForm').style.display == '') ? 'advanced' : 'basic';
window.opener.location = 'index.php?searchFormTab='+searchTab+'_search&module=EcmKpkw&action=index&query=true&category_id_'+searchTab+'='+escape(new_category_id)+'&subcategory_id_'+searchTab+'='+escape(new_subcategory_id);
}
window.close();
}
function populate_search(treeid) {
var node=YAHOO.namespace(treeid).selectednode;
if (node.depth==1) {
new_subcategory_id=node.data.id;
if (new_subcategory_id == 'null') new_subcategory_id='';
new_category_id=node.parent.data.id;
if (new_category_id == 'null') new_category_id='';
} else {
new_category_id=node.data.id;
if (new_category_id == 'null') new_category_id='';
new_subcategory_id='';
}
ecmkpkw.popup_query_form.subcategory_id.value=new_subcategory_id;
ecmkpkw.popup_query_form.category_id.value=new_category_id;
ecmkpkw.popup_query_form.submit();
}
</script>
<table cellpadding="0" cellspacing="0" style="border-left:1px solid; border-right:1px solid; border-bottom:1px solid" width="100%" class="edit view">
<tr>
<td width="100%" valign="top" style="border-right: 1px">
<div id="doctree">
{TREEINSTANCE}
</div>
</td>
</tr>
</table>
<!-- END: TreeView -->
<!-- END: SearchHeader -->
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="list view">
<!-- BEGIN: list_nav_row -->
{PAGINATION}
<!-- END: list_nav_row -->
<tr height="20" >
<td scope="col" width="33%" nowrap="nowrap"><a href="{ORDER_BY}ecmkpkw_name" class="listViewThLinkS1">{MOD.LBL_LIST_DOCUMENT}{arrow_start}{name_arrow}{arrow_end}</a></td>
<td scope="col" width="33%" nowrap="nowrap">{MOD.LBL_LIST_REVISION}</td>
<td scope="col" width="34%" nowrap="nowrap">{MOD.LBL_LIST_STATUS}</td>
</tr>
<!-- BEGIN: row -->
<tr height="20" class="{ROW_COLOR}S1">
<td scope="row" valign="top"><a href="#" onclick="send_back('EcmKpkw','{DOCUMENT.ID}');" >{DOCUMENT.DOCUMENT_NAME}</a></td>
<td valign="top">{DOCUMENT.LATEST_REVISION}</td>
<td valign="top">{DOCUMENT.STATUS_ID}</td>
</tr>
<!-- END: row -->
</table>
{ASSOCIATED_JAVASCRIPT_DATA}
<!-- END: main -->

View File

@@ -0,0 +1,219 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
global $theme;
//include tree view classes.
require_once('include/ytree/Tree.php');
require_once('include/ytree/Node.php');
require_once('modules/EcmKpkw/TreeData.php');
class Popup_Picker
{
/*
*
*/
function Popup_Picker()
{
;
}
/*
*
*/
function _get_where_clause()
{
$where = '';
if(isset($_REQUEST['query']))
{
$where_clauses = array();
append_where_clause($where_clauses, "ecmkpkw_name", "ecmkpkw.document_name");
append_where_clause($where_clauses, "category_id", "ecmkpkw.category_id");
append_where_clause($where_clauses, "subcategory_id", "ecmkpkw.subcategory_id");
append_where_clause($where_clauses, "template_type", "ecmkpkw.template_type");
append_where_clause($where_clauses, "is_template", "ecmkpkw.is_template");
$where = generate_where_statement($where_clauses);
}
return $where;
}
/**
*
*/
function process_page()
{
global $theme;
global $mod_strings;
global $app_strings;
global $currentModule;
global $sugar_version, $sugar_config;
global $app_list_strings;
global $sugar_config;
$b_from_ecmkpkw=false;
if (isset($_REQUEST['caller']) && $_REQUEST['caller']=='EcmKpkw') {
$b_from_ecmkpkw=true;
}
//initalize template
$form = new XTemplate('modules/EcmKpkw/Popup_picker.html');
$form->assign('MOD', $mod_strings);
$form->assign('APP', $app_strings);
$form->assign('THEME', $theme);
$form->assign('MODULE_NAME', $currentModule);
//tree header.
$doctree=new Tree('doctree');
$doctree->set_param('module','EcmKpkw');
if ($b_from_ecmkpkw) {
$doctree->set_param('caller','EcmKpkw');
$href_string = "javascript:populate_parent_search('doctree')";
} else {
$href_string = "javascript:populate_search('doctree')";
}
$nodes=get_category_nodes($href_string);
foreach ($nodes as $node) {
$doctree->add_node($node);
}
$form->assign("TREEHEADER",$doctree->generate_header());
$form->assign("TREEINSTANCE",$doctree->generate_nodes_array());
$site_data = "<script> var site_url= {\"site_url\":\"".getJavascriptSiteURL()."\"};</script>\n";
$form->assign("SITEURL",$site_data);
$form->parse('main.SearchHeader.TreeView');
$treehtml = $form->text('main.SearchHeader.TreeView');
$form->reset('main.SearchHeader.TreeView');
//end tree
if (isset($_REQUEST['caller']) && $_REQUEST['caller']=='EcmKpkw') {
///process treeview and return.
return insert_popup_header($theme).$treehtml.insert_popup_footer();
}
////////////////////////process full search form and list view.//////////////////////////////
$output_html = '';
$where = '';
$where = $this->_get_where_clause();
$name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
$ecmkpkw_name = empty($_REQUEST['document_name']) ? '' : $_REQUEST['document_name'];
$category_id = empty($_REQUEST['category_id']) ? '' : $_REQUEST['category_id'];
$subcategory_id = empty($_REQUEST['subcategory_id']) ? '' : $_REQUEST['subcategory_id'];
$template_type = empty($_REQUEST['template_type']) ? '' : $_REQUEST['template_type'];
$is_template = empty($_REQUEST['is_template']) ? '' : $_REQUEST['is_template'];
$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
$hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
if(!$hide_clear_button)
{
$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CLEAR_BUTTON_KEY']."' value=' "
.$app_strings['LBL_CLEAR_BUTTON_LABEL']." ' />\n";
}
$button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
.$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CANCEL_BUTTON_KEY']."' value=' "
.$app_strings['LBL_CANCEL_BUTTON_LABEL']." ' />\n";
$button .= "</form>\n";
$form->assign('NAME', $name);
$form->assign('DOCUMENT_NAME', $ecmkpkw_name);
$form->assign('request_data', $request_data);
$form->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['ecmkpkw_category_dom'], $category_id));
$form->assign("SUB_CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['ecmkpkw_subcategory_dom'], $subcategory_id));
$form->assign("IS_TEMPLATE_OPTIONS", get_select_options_with_id($app_list_strings['checkbox_dom'], $is_template));
$form->assign("TEMPLATE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['ecmkpkw_template_type_dom'], $template_type));
ob_start();
insert_popup_header($theme);
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$form->parse('main.SearchHeader');
$output_html .= $form->text('main.SearchHeader');
// Reset the sections that are already in the page so that they do not print again later.
$form->reset('main.SearchHeader');
//add tree view to output_html.
$output_html .= $treehtml;
// create the listview
$seed_bean = new EcmKpkw();
$ListView = new ListView();
$ListView->show_select_menu = false;
$ListView->show_delete_button = false;
$ListView->show_export_button = false;
$ListView->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
$ListView->setHeaderText($button);
$ListView->setQuery($where, '', 'ecmkpkw_name', 'DOCUMENT');
$ListView->setModStrings($mod_strings);
ob_start();
$ListView->processListView($seed_bean, 'main', 'DOCUMENT');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= insert_popup_footer();
return $output_html;
}
} // end of class Popup_Picker
?>

View File

@@ -0,0 +1,139 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/ytree/Node.php');
//function returns an array of objects of Node type.
function get_node_data($params,$get_array=false) {
$ret=array();
$click_level=$params['TREE']['depth'];
$subcat_id=$params['NODES'][$click_level]['id'];
$cat_id=$params['NODES'][$click_level-1]['id'];
$href=true;
if (isset($params['TREE']['caller']) and $params['TREE']['caller']=='EcmKpkw' ) {
$href=false;
}
$nodes=get_ecmkpkw($cat_id,$subcat_id,$href);
foreach ($nodes as $node) {
$ret['nodes'][]=$node->get_definition();
}
$json = new JSON(JSON_LOOSE_TYPE);
$str=$json->encode($ret);
return $str;
}
/*
*
*
*/
function get_category_nodes($href_string){
$nodes=array();
global $mod_strings;
global $app_list_strings;
$query="select distinct category_id, subcategory_id from ecmkpkw where deleted=0 order by category_id, subcategory_id";
$result=$GLOBALS['db']->query($query);
$current_cat_id=null;
$cat_node=null;
while (($row=$GLOBALS['db']->fetchByAssoc($result))!= null) {
if (empty($row['category_id'])) {
$cat_id='null';
$cat_name=$mod_strings['LBL_CAT_OR_SUBCAT_UNSPEC'];
} else {
$cat_id=$row['category_id'];
$cat_name=$app_list_strings['ecmkpkw_category_dom'][$row['category_id']];
}
if (empty($current_cat_id) or $current_cat_id != $cat_id) {
$current_cat_id = $cat_id;
if (!empty($cat_node)) $nodes[]=$cat_node;
$cat_node = new Node($cat_id, $cat_name);
$cat_node->set_property("href", $href_string);
$cat_node->expanded = true;
$cat_node->dynamic_load = false;
}
if (empty($row['subcategory_id'])) {
$subcat_id='null';
$subcat_name=$mod_strings['LBL_CAT_OR_SUBCAT_UNSPEC'];
} else {
$subcat_id=$row['subcategory_id'];
$subcat_name=$app_list_strings['ecmkpkw_subcategory_dom'][$row['subcategory_id']];
}
$subcat_node = new Node($subcat_id, $subcat_name);
$subcat_node->set_property("href", $href_string);
$subcat_node->expanded = false;
$subcat_node->dynamic_load = true;
$cat_node->add_node($subcat_node);
}
if (!empty($cat_node)) $nodes[]=$cat_node;
return $nodes;
}
function get_ecmkpkw($cat_id, $subcat_id,$href=true) {
$nodes=array();
$href_string = "javascript:select_ecmkpkw('doctree')";
$query="select * from ecmkpkw where deleted=0";
if ($cat_id != 'null') {
$query.=" and category_id='$cat_id'";
} else {
$query.=" and category_id is null";
}
if ($subcat_id != 'null') {
$query.=" and subcategory_id='$subcat_id'";
} else {
$query.=" and subcategory_id is null";
}
$result=$GLOBALS['db']->query($query);
$current_cat_id=null;
while (($row=$GLOBALS['db']->fetchByAssoc($result))!= null) {
$node = new Node($row['id'], $row['ecmkpkw_name']);
if ($href) {
$node->set_property("href", $href_string);
}
$node->expanded = true;
$node->dynamic_load = false;
$nodes[]=$node;
}
return $nodes;
}
?>

122
modules/EcmKpkw/_Save.php Normal file
View File

@@ -0,0 +1,122 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
/* * ***************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
*
* All Rights Reserved.
* ****************************************************************************** */
$_REQUEST = $_POST;
require_once("modules/EcmKpkw/EcmKpkw.php");
//require_once('include/formbase.php');
$focus = new EcmInvoiceOut();
if (isset($_POST['record']) && $_POST['record'] != '') {
$focus->retrieve($_POST['record']);
//$focus->id = $_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;
}
*/
$check_notify = FALSE;
/*
$json = getJSONobj();
$wi = $json->decode(htmlspecialchars_decode($_POST['work_items']));
$focus->work_items = $wi;
*/
//var_dump($_POST);
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;
}
}
var_export($focus->toArray());
//$focus->paid_val = unformat_number($focus->paid_val);
//$focus->prepaid = unformat_number($focus->prepaid);
$focus->save($check_notify);
$return_id = $focus->id;
/*
$r=$GLOBALS[db]->fetchByAssoc($GLOBALS[db]->query("select type,document_no from ecminvoiceouts where id='".$return_id."'"));
$file="modules/EcmKpkw/xml/".str_replace(" ","",str_replace("/","",$r['document_no'])).".xml";
fopen($file);
if($r['type']=="correct")$xml=createCorrectInvoiceXml($return_id);
else $xml=createInvoiceXml($return_id);
file_put_contents($file,$xml);
chmod($file,0777); */
echo $return_id;
die();
//header("Location: index.php?module=EcmKpkw&action=index");
//handleRedirect($return_id,'EcmKpkw');

View File

@@ -0,0 +1,10 @@
<?php
// ini_set('display_errors', '1');
// error_reporting(E_ALL);
error_reporting(E_ERROR);
class EcmKpkwController extends SugarController {
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
<?php
$db = $GLOBALS ['db'];
ini_set('display_errors',1);
if (! $_REQUEST ['record'] || $_REQUEST ['record'] == '')
die ( 'Brak rekordu' );
else
$record = $_REQUEST ['record'];
include_once ("modules/EcmKpkw/PDFTemplate/helper.php");
include_once ("modules/EcmKpkw/PDFTemplate/kwota.php");
$focus = new EcmKpkw ();
$focus->retrieve ( $record );
$kwota=new KwotaSlownie();
$user = new User ();
$user->retrieve ( $focus->created_by );
$acc = new Account();
$acc->retrieve ( $focus->parent_id );
$cur = New Currency();
$cur->retrieve($focus->currency_id);
$r=$db->query ("select name,footer_address,footer_nip from ecmdocumenttemplates where id='75997203-f430-7f64-10e0-4b0a912673fa'");
$comp=$db->fetchByAssoc($r);
$addr = explode(",", $comp['footer_address']);
include_once ("include/MPDF57/mpdf.php");
$p = new mPDF ( '', 'A4', null, 'helvetica', 10, 10, 30, 45, 5, 5 );
$mpdf->mirrorMargins = 1;
// document pdf
// document already exist?
$res = $db->query ( "SELECT footer, content FROM ecmstockdocin_pdf WHERE id='$record'" );
if ($res->num_rows == 0) {
// create and save document
//$positions = formatPDFPositions ( $focus->getPositionList ( true ), $focus );
// get header
$header = '';
include_once ("modules/EcmKpkw/PDFTemplate/header.php");
$content = '';
include_once ("modules/EcmKpkw/PDFTemplate/content.php");
global $current_user;
$db->query ( "INSERT INTO ecmstockdocin_pdf VALUES ('$record','$current_user->id', NOW(),'" . mysql_real_escape_string ( $header ) . "', '" . mysql_real_escape_string ( $content ) . "')" );
} else {
//$positions = formatPDFPositions ( $focus->getPositionList ( true ), $focus );
$row = $db->fetchByAssoc ( $res );
$header = htmlspecialchars_decode ( $row ['footer'] ); // punk rock!
$content = htmlspecialchars_decode ( $row ['content'] );
$header = '';
include_once ("modules/EcmKpkw/PDFTemplate/header.php");
$content = '';
include_once ("modules/EcmKpkw/PDFTemplate/content.php");
}
$p->SetHTMLHeader ( $header );
$p->WriteHTML ( $content );
// draw PDF
$p->Output ();

View File

@@ -0,0 +1,83 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Contains field arrays that are used for caching
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$fields_array['EcmKpkw'] = array ('column_fields' => Array("id"
,"ecmkpkw_name"
,"description"
,"category_id"
,"subcategory_id"
,"status_id"
,"active_date"
,"exp_date"
,"date_entered"
,"date_modified"
,"created_by"
,"modified_user_id"
,"ecmkpkw_revision_id"
,"related_doc_id"
,"related_doc_rev_id"
,"is_template"
,"template_type"
),
'list_fields' => Array("id"
,"ecmkpkw_name"
,"description"
,"category_id"
,"subcategory_id"
,"status_id"
,"active_date"
,"exp_date"
,"date_entered"
,"date_modified"
,"created_by"
,"modified_user_id"
,"ecmkpkw_revision_id"
,"last_rev_create_date"
,"last_rev_created_by"
,"latest_revision"
,"file_url"
,"file_url_noimage"
),
'required_fields' => Array("ecmkpkw_name"=>1,"active_date"=>1,"revision"=>1),
);
?>

View File

@@ -0,0 +1,164 @@
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function changeValidateRequired(formname,name,required) {
for(var i=0; i<validate[formname].length; i++)
if(validate[formname][i][0] == name) { validate[formname][i][2] = required; break; }
}
function my_popup(module, field_array, call_back_function, form_name) {
if(!call_back_function) call_back_function = "set_return";
if(!form_name) form_name = "EditView";
return open_popup(module, 900, 700, "", true, false, {"call_back_function":call_back_function,"form_name":form_name,"field_to_name_array":field_array});
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function FormLoader() {
this.module;
this.createModule;
this.fieldName;
this.buttonName = 'FormLoaderButton';
this.load = function(module,createModule,fieldName) {
this.module = module;
this.createModule = createModule;
this.fieldName = fieldName;
}
this.createButton = function() {
var b = document.createElement('input');
b.type = 'button';
b.className = 'button';
b.name = this.buttonName;
b.value = 'Create';
b.FL = this;
b.onclick = function() {
if(this.FL.createModule == '') return;
if(this.FL.onButtonClick) var data = this.FL.onButtonClick();
window.open("index.php?module="+this.FL.module+"&action=formloader&to_pdf=1&loaderAction=ViewForm&loaderFieldName="+this.FL.fieldName+"&createModule="+this.FL.createModule+(data?data:''),"Create10"+this.FL.module,"resizable=yes,scrollbars=no,status=no,height=540,width=700").focus();
}
return b;
}
// this.setEditDblClick = function(edit) { edit.FL=this; edit.ondblclick=this.editDblClick; }
this.editDblClick = function() {
if(this.FL.createModule == '') return;
if(this.FL.onEditDblClick) var data = this.FL.onEditDblClick();
window.open("index.php?module="+this.FL.module+"&action=formloader&to_pdf=1&loaderAction=ViewForm&loaderFieldName="+this.FL.fieldName+"&createModule="+this.FL.createModule+(data?data:''),"Create10"+this.FL.module,"resizable=yes,scrollbars=no,status=no,height=540,width=700").focus();
}
this.responseData = function(data) {
if(this.onResponseData) this.onResponseData(data);
}
this.onResponseData;
this.addPostData = function() {
if(this.onAddPostData)
return this.onAddPostData();
else
return '';
}
this.onAddPostData;
this.onButtonClick;
}

View File

@@ -0,0 +1,25 @@
<?php
require_once('modules/EcmKpkw/EcmKpkw.php');
$focus = new EcmKpkw();
if(isset($_REQUEST['generate']) && $_REQUEST['generate'] == '1') {
try {
if(isset($_REQUEST['record']) && $_REQUEST['record'] != '') $focus->retrieve($_REQUEST['record']);
$focus->template_id = $_REQUEST['template_id'];
$focus->type = $_REQUEST['type'];
$focus->setTemplate();
$arr = array();
$arr['number'] = (isset($focus->id) && $focus->id != '') ? $focus->number : $focus->generateNumber();
$arr['document_no'] = $focus->formatNumber();
}
catch (Exception $e) { echo ''; return; }
$json = getJSONobj();
echo '['.$json->encode($arr).']';
return;
}
?>

View File

@@ -0,0 +1,66 @@
<?php
//get formatted name and email from account by id
function getFormattedEmailFromAccounById($id) {
if(!isset($id) || $id == '') return false;
require_once('modules/Accounts/Account.php');
$acc = new Account();
$acc->retrieve($id);
if(isset($acc->id) && $acc->id != '') {
return $acc->name.' <'.$acc->email1.'>; ';
}
return '';
}
//get formatted name and email from user
function getFormattedEmailFromUserId($id) {
if(!isset($id) || $id == '') return false;
require_once('modules/Users/User.php');
$us = new User();
$us->retrieve($id);
if(isset($us->id) && $us->id != '') {
return $us->full_name.' <'.$us->email1.'>; ';
}
return '';
}
//get info from module by Id
function getInfoFromModuleById($module, $id, $arr = '') {
if(!isset($id) || $id == '') return false;
global $beanFiles, $beanList;
require_once($beanFiles[$beanList[$module]]);
$bean = new $beanList[$module]();
$bean->retrieve($id);
if(isset($bean->id) && $bean->id != '') {
$arr = explode('|', $arr);
$tmp = array();
for($i=0; $i<count($arr); $i++)
$tmp[$arr[$i]] = htmlspecialchars_decode($bean->$arr[$i]);
$json = getJSONobj();
return '['.$json->encode($tmp).']';
}
return '';
}
if(isset($_REQUEST['data']) && $_REQUEST['data'] == 'EFA' && isset($_REQUEST['id']) && $_REQUEST['id'] != '')
echo getFormattedEmailFromAccounById($_REQUEST['id']);
if(isset($_REQUEST['data']) && $_REQUEST['data'] == 'EFAUID' && isset($_REQUEST['id']) && $_REQUEST['id'] != '')
echo getFormattedEmailFromUserId($_REQUEST['id']);
if(isset($_REQUEST['gdData']) && $_REQUEST['gdData'] != '' && isset($_REQUEST['gdId']) && $_REQUEST['gdId'] != '' && isset($_REQUEST['gdData']) && $_REQUEST['gdData'] != '')
echo getInfoFromModuleById($_REQUEST['gdModule'],$_REQUEST['gdId'],$_REQUEST['gdData']);
?>

View File

@@ -0,0 +1,14 @@
<?php
$user = $_REQUEST['kasa'];
if (!$user) {echo '-1'; return;}
$dn = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select currency_id from ecmcashs where id='".$user."';
"));
echo $dn['currency_id']; return;
?>

View File

@@ -0,0 +1,301 @@
<?php
ini_set('display_errors',1);
/**
* EcmKpkw report
*/
require_once('include/utils.php');
global $db,$app_strings;
$stop = new DateTime('NOW');
$start = clone $stop;
$start->sub(new DateInterval('P3Y'));
$currentTo = @$_GET['date_to'] ? : $stop->format('t.m.Y');
$currentFrom = @$_GET['date_from'] ? : $start->format('01.m.Y');
?>
<script type="text/javascript">
window.onbeforeunload = function() {
return '';
};
window.onunload = function() {
var req = mint.Request();
var url = 'index.php?module=EcmReports&action=interruptQuery';
req.OnSuccess = function() {
console.log(this.responseText);
}
req.Send(url);
};
</script>
<style type="text/css">
table.report {
margin: 15px 0;
width: 100%;
border-spacing: 1px;
font-family: 'Calibri';
font-size: 13px;
}
table.report thead tr th,
table.report tbody tr td {
padding: 2px 5px;
border: 1px solid #CCCCCC;
text-align: center;
}
table.report thead tr th {
background: #ebebeb;
}
table.report tbody tr.odd {
background: #f6f6f6;
}
table.report tbody tr.even {
background: #ffffff;
}
</style>
<?php if($_GET['to_pdf']!=1){?>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<h2><?php echo translate('LBL_RAPORT_TITLE', 'EcmKpkw'); ?></h2>
</td>
</tr>
</table>
<br />
<ul class="tablist">
<li>
<a class="current" href="#">Opcje</a>
</li>
</ul>
<form action="index.php" method="get" name="search_reports">
<input type="hidden" name="module" value="EcmKpkw" />
<input type="hidden" name="action" value="kpkw_report" />
<input type="hidden" name="process" value="yes" />
<table style="border-top: 0px none; margin-bottom: 4px; width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="dataLabel" width="5%" nowrap="nowrap">
<?php echo translate('LBL_DATE_START', 'EcmKpkw');?>
</td>
<td class="dataField" width="10%" nowrap="nowrap">
<input autocomplete="off" name="date_from" id="date_from" value="<? echo $currentFrom; ?>" title="" tabindex="" size="11" maxlength="10" type="text">
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_from_trigger" align="absmiddle" border="0">
<script type="text/javascript">
Calendar.setup ({
inputField : "date_from",
daFormat : '<? echo str_replace(array('d', 'm', 'Y'), array('%d', '%m', '%Y'), $GLOBALS['timedate']->get_date_format()); ?>',
button : 'date_from_trigger',
singleClick : true,
dateStr : '',
step : 1
});
</script>
</td>
<td class="dataLabel" width="5%" nowrap="nowrap">
<?php echo translate('LBL_DATE_END', 'EcmKpkw');?>
</td>
<td class="dataField" width="10%" nowrap="nowrap">
<input autocomplete="off" name="date_to" id="date_to" value="<? echo $currentTo; ?>" title="" tabindex="" size="11" maxlength="10" type="text">
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger" align="absmiddle" border="0">
<script type="text/javascript">
Calendar.setup ({
inputField : "date_to",
daFormat : '<? echo str_replace(array('d', 'm', 'Y'), array('%d', '%m', '%Y'), $GLOBALS['timedate']->get_date_format()); ?>',
button : 'date_to_trigger',
singleClick : true,
dateStr : '',
step : 1
});
</script>
</td>
<td class="dataLabel" width="5%" nowrap="nowrap">
<?php echo translate('LBL_CASH2', 'EcmKpkw');?>
</td>
<td class="dataField" width="10%" nowrap="nowrap">
<input autocomplete="off" name="ecmcash_id" id="ecmcash_id" type="hidden" value="<?php echo $_GET['ecmcash_id'];?>" title="" tabindex="" size="11" maxlength="10" type="text">
<input autocomplete="off" name="id_currency" id="id_currency" type="hidden" value="<?php echo $_GET['id_currency'];?>" title="" tabindex="" size="11" maxlength="10" type="text">
<input autocomplete="off" name="cash_name" id="cash_name" value="<?php echo $_GET['cash_name'];?>" title="" tabindex="" size="11" maxlength="10" type="text">
<input title="Wybierz [Alt+T]" accesskey="T" type="button" class="button" value="<?php echo translate('LBL_SELECT', 'EcmKpkw');?>" name="btn1" onclick='open_popup("EcmCashs", 600, 400, "", true, false,
{"call_back_function":"set_return","form_name":"search_reports","field_to_name_array":
{"id":"ecmcash_id","name":"cash_name","currency_id":"id_currency"}}, "single", true);'></span>
</td>
<td class="dataLabel" width="5%" nowrap="nowrap">
<?php echo translate('LBL_CASH_USER2', 'EcmKpkw');?>
</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select name="kasjer" id="kasjer">
<option value=""><?php echo translate('LBL_ALL', 'EcmKpkw');?></option>
<?php
$r=$GLOBALS['db']->query("select u.first_name,u.last_name,u.id from users as u join ecmcashs_ecmkpkw as rel on rel.user_id=u.id group by u.id");
while($dn = $GLOBALS['db']->fetchByAssoc($r)){
echo '<option value="'.$dn['id'].'" '.$sel.'>'.$dn['first_name'].' '.$dn['last_name'].'</option>';
}
?>
</select>
</td>
<td class="dataLabel" width="70%" nowrap="nowrap"></td>
</tr>
</tbody>
</table>
<?php
$url="index.php?action=wydruk_raport&module=EcmKpkw&process=yes&to_pdf=1&date_from=".$_GET['date_from']."&date_to=".$_GET['date_to']."&kasjer=".$_GET['kasjer']."&ecmcash_id=".$_GET['ecmcash_id']."&cash_name=".$_GET['cash_name']."&id_currency=".$_GET['id_currency'];
?>
<input class="button" value="<?php echo translate('LBL_SUBMIT', 'EcmKpkw');?>" type="submit"/>
<input class="button" value="<?php echo translate('LBL_PRINT_PDF', 'EcmKpkw');?>" type="button" onClick="location.href='<?php echo $url;?>'"/>
</form>
<?php }?>
<div id="mainTable" style="overflow-x: scroll; width: 100%">
<?php if(isset($_REQUEST['process'])) : ?>
<?php
$additionalWhereConditions = array(
'\'' . $start->format('Y-m-01') . '\'',
'\'' . $stop->format('Y-m-t') . '\'',
);
if($from = @$_GET['date_from']) {
$fromDate = new DateTime($from);
$additionalWhereConditions[0] = '\'' . $fromDate->format('Y-m-d') . '\'';
}
if($to = @$_GET['date_to']) {
$toDate = new DateTime($to);
$additionalWhereConditions[1] = '\'' . $toDate->format('Y-m-d') . '\'';
}
if($_GET['kasjer']!=''){
$kasjer=" and `created_by`='".$_GET['kasjer']."'";
}
$additionalWhere = '`date_entered` BETWEEN ' . implode(' AND ', $additionalWhereConditions)." and `ecmcash_id`='".$_GET['ecmcash_id']."'".$kasjer;
$query = '
SELECT
`description`,`ecmkpkw_name`,`amount`,`document_no`,
`parent_address_street`,`parent_address_city`,`parent_address_postalcode`,
`parent_address_country`,`parent_contact_name`,`parent_contact_title`,
`date_entered`,`dir`,`parent_name`
FROM `ecmkpkw`
WHERE
' . (additionalWhere ? ($additionalWhere) : '') . '
ORDER BY
`date_entered` ASC;
';
// echo $query; //exit;
$result = $db->query($query);
$query_bo = "SELECT SUM(IF(dir = 0, amount, -amount)) AS `sum` FROM `ecmkpkw` WHERE `date_entered` < ".$additionalWhereConditions[0]." and `ecmcash_id`='".$_GET['ecmcash_id']."'".$kasjer;
//echo $query_bo; exit;
$result_bo = $db->query($query_bo);
if($row_bo = $db->fetchByAssoc($db->query($query_bo)))
{
$bo = $row_bo["sum"];
//ECHO $row["sum"];
}
?>
<?php if($result->num_rows > 0) : ?>
<center><h1><?php echo translate('LBL_RAPORT_LABEL', 'EcmKpkw'); ?> <br><?php echo translate('LBL_TIME', 'EcmKpkw');?> <?php echo $fromDate->format('01/m/Y')." - ".$toDate->format('t/m/Y'); ?>
<?php if($_GET['cash_name']!='') echo ", ".translate('LBL_CASH', 'EcmKpkw').": ".$_GET['cash_name'].", ".translate('LBL_CURRENCY_PDF', 'EcmKpkw').": ".$_GET['id_currency'];
if($_GET['kasjer']!=''){
$us=new User;
$us->retrieve($_GET['kasjer']);
echo ", ".translate('LBL_CASH_USER', 'EcmKpkw').": ". $us->full_name;
}
?></h1></center><br>
<table class="report" style="padding-top: 0px; margin-top:0px;">
<tbody>
<?php
$i = 0;
$suma1 = 0;
$suma2 = 0;
?>
<?php while($row = $db->fetchByAssoc($result)) : ?>
<?php $class = ($i % 2) ? 'odd' : 'even'; $i++; ?>
<tr class="<?php echo $class; ?>">
<td width="5%"><?php echo $i ?></td>
<td width="15%" style="text-align:left;"><table class="report" style="padding-top: 0px; margin-top:0px;"><tr class="<?php echo $class; ?>"><td style="text-align:left;"><?php echo $row['document_no']; ?></td></tr><tr><td style="text-align:left;"><?php echo date("d.m.Y", strtotime($row['date_entered'])); ?></td></tr></table></td>
<td width="22%" style="text-align:left;"><?php echo $row['ecmkpkw_name']; ?></td>
<td width="22%" style="text-align:left;"><?php echo $row['parent_name']; ?></td>
<td width="17%" style="text-align:right;"><?php if($row['dir']==0) { echo format_number($row['amount']); $suma1 += $row['amount']; } else echo "&nbsp;";?>
<td width="17%" style="text-align:right;"><?php if($row['dir']==1) { echo format_number($row['amount']); $suma2 += $row['amount']; } else echo "&nbsp;";?>
</td>
</tr>
<?php endwhile; ?>
<tr class="<?php
$class = ($i % 2) ? 'odd' : 'even'; $i++;
echo $class; ?>">
<td width="45%" style="border: 0px; background: #fff;" colspan="2">&nbsp;</td>
<td width="15%" style="border: 0px; background: #fff;"></td>
<td width="15%" style="text-align:left;"><?php echo translate('LBL_VALUE', 'EcmKpkw'); ?></td>
<td width="15%" style="text-align:right;"><?php echo format_number(($suma1)); ?></td>
<td width="20%" style="text-align:right;"><?php echo format_number(($suma2)); ?></td>
<td width="20%" style="border: 0px;background: #fff;">&nbsp;
</td>
</tr>
<tr class="<?php
$class = ($i % 2) ? 'odd' : 'even'; $i++;
echo $class; ?>">
<td width="45%" style="border: 0px; background: #fff;" colspan="2">&nbsp;</td>
<td width="15%" style="border: 0px; background: #fff;"></td>
<td width="15%" style="text-align:left;"><?php echo translate('LBL_VALUE_BEFORE', 'EcmKpkw'); ?>:</td>
<td width="15%" style="text-align:right;"><?php echo format_number(($bo)); ?></td>
<td width="20%" style="text-align:right;"></td>
<td width="20%" style="border: 0px;background: #fff;">&nbsp;
</td>
</tr>
<tr class="<?php
$class = ($i % 2) ? 'odd' : 'even'; $i++;
echo $class; ?>">
<td width="45%" style="border: 0px; background: #fff;" colspan="2">&nbsp;</td>
<td width="15%" style="border: 0px; background: #fff;"></td>
<td width="15%" style="text-align:left;"><?php echo translate('LBL_VALUE_TOTAL', 'EcmKpkw'); ?>:</td>
<td width="15%" style="text-align:right;"><?php echo format_number((($bo+$suma1)-$suma2)); ?></td>
<td width="20%" style="text-align:right;"></td>
<td width="20%" style="border: 0px;background: #fff;">&nbsp;
</td>
</tr>
</tbody>
<thead>
<tr>
<th><?php echo translate('LBL_NUMBER_LP', 'EcmKpkw'); ?></th>
<th><?php echo translate('LBL_DOCUMENT_NO', 'EcmKpkw'); ?><br><?php echo translate('LBL_CREATE_LAB', 'EcmKpkw'); ?></th>
<th><?php echo translate('LBL_TITLE', 'EcmKpkw'); ?></th>
<th><?php echo translate('LBL_PARENT_NAME', 'EcmKpkw'); ?></th>
<th><?php echo translate('LBL_AMOUNT_PLUS', 'EcmKpkw'); ?></th>
<th><?php echo translate('LBL_AMOUNT_MINUS', 'EcmKpkw'); ?></th>
</tr>
</thead>
</table>
<?php else : ?>
<p>Brak wyników dla danego okresu.</p>
<?php endif; ?>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,174 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
//module
'LNK_ECMKPKW_REPORT' => 'Report',
'LBL_MODULE_NAME' => 'EcmKpkw',
'LBL_MODULE_TITLE' => 'EcmKpkw: Home',
'LNK_NEW_DOCUMENT' => 'Create EcmKpkw',
'LNK_DOCUMENT_LIST'=> 'View EcmKpkw',
'LBL_DOC_REV_HEADER' => 'EcmKpkw Revisions',
'LBL_SEARCH_FORM_TITLE'=> 'EcmKpkw Search',
//vardef labels
'LBL_DOCUMENT_NO' => 'Number',
'LBL_PARENT_NAME' => 'To',
'LBL_PARENT_ID' => 'To Id',
'LBL_AMOUNT'=>'Amount:',
'LBL_DOCUMENT_ID' => 'EcmKpkw ID',
'LBL_NAME' => 'EcmKpkw Name',
'LBL_DESCRIPTION' => 'Description',
'LBL_CATEGORY' => 'Category',
'LBL_SUBCATEGORY' => 'Sub Category',
'LBL_STATUS' => 'Status',
'LBL_CREATED_BY'=> 'Created by',
'LBL_DATE_ENTERED'=> 'Date Entered',
'LBL_DATE_MODIFIED'=> 'Date Modified',
'LBL_DELETED' => 'Deleted',
'LBL_MODIFIED'=> 'Modified by ID',
'LBL_MODIFIED_USER' => 'Modified by',
'LBL_CREATED'=> 'Created by',
'LBL_REVISIONS'=>'Revisions',
'LBL_RELATED_DOCUMENT_ID'=>'Related EcmKpkw ID',
'LBL_RELATED_DOCUMENT_REVISION_ID'=>'Related EcmKpkw Revision ID',
'LBL_IS_TEMPLATE'=>'Is a Template',
'LBL_TEMPLATE_TYPE'=>'EcmKpkw Type',
'LBL_ASSIGNED_TO_NAME'=>'Assigned to:',
'LBL_REVISION_NAME' => 'Revision Number',
'LBL_MIME' => 'Mime Type',
'LBL_REVISION' => 'Revision',
'LBL_DOCUMENT' => 'Related EcmKpkw',
'LBL_LATEST_REVISION' => 'Latest Revision',
'LBL_CHANGE_LOG'=> 'Change Log',
'LBL_ACTIVE_DATE'=> 'Publish Date',
'LBL_EXPIRATION_DATE' => 'Expiration Date',
'LBL_FILE_EXTENSION' => 'File Extension',
'LBL_LAST_REV_MIME_TYPE' => 'Last revision MIME type',
'LBL_CAT_OR_SUBCAT_UNSPEC'=>'Unspecified',
//quick search
'LBL_NEW_FORM_TITLE' => 'New EcmKpkw',
//ecmkpkw edit and detail view
'LBL_DOC_NAME' => 'EcmKpkw Name:',
'LBL_FILENAME' => 'File Name:',
'LBL_DOC_VERSION' => 'Revision:',
'LBL_CATEGORY_VALUE' => 'Category:',
'LBL_SUBCATEGORY_VALUE'=> 'Sub Category:',
'LBL_DOC_STATUS'=> 'Status:',
'LBL_LAST_REV_CREATOR' => 'Revision Created By:',
'LBL_LASTEST_REVISION_NAME' => 'Lastest revision name:',
'LBL_SELECTED_REVISION_NAME' => 'Selected revision name:',
'LBL_CONTRACT_STATUS' => 'Contract status:',
'LBL_CONTRACT_NAME' => 'Contract name:',
'LBL_LAST_REV_DATE' => 'Revision Date:',
'LBL_DOWNNLOAD_FILE'=> 'Download File:',
'LBL_DET_RELATED_DOCUMENT'=>'Related EcmKpkw:',
'LBL_DET_RELATED_DOCUMENT_VERSION'=>"Related EcmKpkw Revision:",
'LBL_DET_IS_TEMPLATE'=>'Template? :',
'LBL_DET_TEMPLATE_TYPE'=>'EcmKpkw Type:',
'LBL_DOC_DESCRIPTION'=>'Description:',
'LBL_DOC_ACTIVE_DATE'=> 'Publish Date:',
'LBL_DOC_EXP_DATE'=> 'Expiration Date:',
//ecmkpkw list view.
'LBL_DIRECTION' => 'Type of transaction:',
'LBL_EDIT_INFORMATION' => 'Informations about document',
'LBL_LIST_FORM_TITLE' => 'EcmKpkw List',
'LBL_LIST_DOCUMENT' => 'EcmKpkw',
'LBL_LIST_CATEGORY' => 'Category',
'LBL_LIST_SUBCATEGORY' => 'Sub Category',
'LBL_LIST_REVISION' => 'Revision',
'LBL_LIST_LAST_REV_CREATOR' => 'Published By',
'LBL_LIST_LAST_REV_DATE' => 'Revision Date',
'LBL_LIST_VIEW_DOCUMENT'=>'View',
'LBL_LIST_DOWNLOAD'=> 'Download',
'LBL_LIST_ACTIVE_DATE' => 'Publish Date',
'LBL_LIST_EXP_DATE' => 'Expiration Date',
'LBL_LIST_STATUS'=>'Status',
'LBL_LINKED_ID' => 'Linked id',
'LBL_SELECTED_REVISION_ID' => 'Selected revision id',
'LBL_LATEST_REVISION_ID' => 'Latest revision id',
'LBL_SELECTED_REVISION_FILENAME' => 'Selected revision filename',
'LBL_FILE_URL' => 'File url',
'LBL_REVISIONS_PANEL' => 'Revision Details',
'LBL_REVISIONS_SUBPANEL' => 'Revisions',
//ecmkpkw search form.
'LBL_SF_DOCUMENT' => 'EcmKpkw Name:',
'LBL_SF_CATEGORY' => 'Category:',
'LBL_SF_SUBCATEGORY'=> 'Sub Category:',
'LBL_SF_ACTIVE_DATE' => 'Publish Date:',
'LBL_SF_EXP_DATE'=> 'Expiration Date:',
'DEF_CREATE_LOG' => 'EcmKpkw Created',
//error messages
'ERR_DOC_NAME'=>'EcmKpkw Name',
'ERR_DOC_ACTIVE_DATE'=>'Publish Date',
'ERR_DOC_EXP_DATE'=> 'Expiration Date',
'ERR_FILENAME'=> 'File Name',
'ERR_DOC_VERSION'=> 'EcmKpkw Version',
'ERR_DELETE_CONFIRM'=> 'Do you want to delete this ecmkpkw revision?',
'ERR_DELETE_LATEST_VERSION'=> 'You are not allowed to delete the latest revision of a ecmkpkw.',
'LNK_NEW_MAIL_MERGE' => 'Mail Merge',
'LBL_MAIL_MERGE_DOCUMENT' => 'Mail Merge Template:',
'LBL_TREE_TITLE' => 'EcmKpkw',
//sub-panel vardefs.
'LBL_LIST_DOCUMENT_NAME'=>'EcmKpkw Name',
'LBL_CONTRACT_NAME'=>'Contract Name:',
'LBL_LIST_IS_TEMPLATE'=>'Template?',
'LBL_LIST_TEMPLATE_TYPE'=>'EcmKpkw Type',
'LBL_LIST_SELECTED_REVISION'=>'Selected Revision',
'LBL_LIST_LATEST_REVISION'=>'Latest Revision',
'LBL_CONTRACTS_SUBPANEL_TITLE'=>'Related Contracts',
'LBL_LAST_REV_CREATE_DATE'=>'Last Revision Create Date',
//'LNK_DOCUMENT_CAT'=>'EcmKpkw Categories',
'LBL_CONTRACTS' => 'Contracts',
'LBL_CREATED_USER' => 'Created User',
'LBL_THEREVISIONS_SUBPANEL_TITLE' => 'Reversions',
'LBL_DOCUMENT_INFORMATION' => 'EcmKpkw Overview',
);
?>

View File

@@ -0,0 +1,194 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* pl_pl.lang.ext.php,v for SugarCRM 4.5.1-->>
* Translator: Krzysztof Morawski
* All Rights Reserved.
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
//module
'LNK_ECMKPKW_REPORT' => 'Raport',
'LBL_MODULE_NAME' => 'Dokumenty',
'LBL_MODULE_TITLE' => 'Dokumenty: Strona główna',
'LNK_NEW_DOCUMENT' => 'Utwórz dokument',
'LNK_DOCUMENT_LIST'=> 'Lista dokumentów',
'LBL_DOC_REV_HEADER' => 'Wersja dokumentu',
'LBL_SEARCH_FORM_TITLE'=> 'Szukanie dokumentów',
//vardef labels
'LBL_PARENT_NAME' => 'Firma',
'LBL_PARENT_ID' => 'Firma Id',
'LBL_AMOUNT'=>'Kwota:',
'LBL_DOCUMENT_ID' => 'ID dokumentu',
'LBL_NAME' => 'Nazwa dokumentu',
'LBL_DESCRIPTION' => 'Opis',
'LBL_CATEGORY' => 'Kategoria',
'LBL_SUBCATEGORY' => 'Podkategoria',
'LBL_STATUS' => 'Status',
'LBL_CREATED_BY'=> 'Utworzony przez',
'LBL_DATE_ENTERED'=> 'Data wprowadzenia',
'LBL_DATE_MODIFIED'=> 'Data modyfikacji',
'LBL_DELETED' => 'Usunięty',
'LBL_CURRENCY_VALUE' => 'Kurs waluty',
'LBL_MODIFIED'=> 'Zmodyfikowany przez ID',
'LBL_MODIFIED_USER'=> 'Zmodyfikowany przez',
'LBL_CREATED'=> 'Utworzony przez',
'LBL_REVISIONS'=>'Wersje',
'LBL_CASH'=>'Kasa',
'LBL_RELATED_DOCUMENT_ID'=>'ID dokumentów połączonych',
'LBL_RELATED_DOCUMENT_REVISION_ID'=>'ID wersji dokumentów połączonych',
'LBL_IS_TEMPLATE'=>'Jest szablonem',
'LBL_TEMPLATE_TYPE'=>'Typ dokumentu',
'LBL_ASSIGNED_TO_NAME'=>'Przydzielone do:',
'LBL_REVISION_NAME' => 'Numer wersji',
'LBL_MIME' => 'Typ mime',
'LBL_REVISION' => 'Wersja',
'LBL_DOCUMENT' => 'Połączone dokumenty',
'LBL_LATEST_REVISION' => 'Najnowsza wersja',
'LBL_CHANGE_LOG'=> 'Dziennik zmian',
'LBL_PAYMENT_DATE'=>'Data dokumentu',
'LBL_ACTIVE_DATE'=> 'Data publikacji',
'LBL_EXPIRATION_DATE' => 'Data wyganiecia',
'LBL_FILE_EXTENSION' => 'Rozszerzenie pliku',
'LBL_PARENT_ADDRESS_STREET' => 'Ulica',
'LBL_PARENT_ADDRESS_POSTALCODE'=> 'Kod pocztowy',
'LBL_PARENT_ADDRESS_CITY'=>'Miasto',
'LBL_PARENT_ADDRESS_COUNTRY'=>'Państwo',
'LBL_CAT_OR_SUBCAT_UNSPEC'=>'Niesprecyzowany',
//quick search
'LBL_NEW_FORM_TITLE' => 'Nowy dokument',
//ecmkpkw edit and detail view
'LBL_DOCUMENT_NO' => 'Numer',
'LBL_DOC_NAME' => 'Nazwa dokumentu:',
'LBL_FILENAME' => 'Nazwa pliku:',
'LBL_DOC_VERSION' => 'Wersja:',
'LBL_CATEGORY_VALUE' => 'Kategoria:',
'LBL_SUBCATEGORY_VALUE'=> 'Podkategoria:',
'LBL_DOC_STATUS'=> 'Status:',
'LBL_LAST_REV_CREATOR' => 'Wersja utworzona przez:',
'LBL_LAST_REV_DATE' => 'Data wersji:',
'LBL_DOWNNLOAD_FILE'=> 'Ściągnij plik:',
'LBL_DET_RELATED_DOCUMENT'=>'Dokumenty połączone:',
'LBL_DET_RELATED_DOCUMENT_VERSION'=>"Wersja dokumentów połaczonych:",
'LBL_DET_IS_TEMPLATE'=>'Szkic? :',
'LBL_DET_TEMPLATE_TYPE'=>'Typ dokumentu:',
'LBL_TEAM'=> 'Zespół:',
'LBL_DOC_DESCRIPTION'=>'Opis:',
'LBL_DOC_ACTIVE_DATE'=> 'Data publikacji:',
'LBL_DOC_EXP_DATE'=> 'Data wygaśnięcia:',
// RAPORT && PDF
'LBL_NUMBER_LP' => 'Lp',
'LBL_DOCUMENT_NO'=>'Nr dokumentu',
'LBL_CREATE_LAB'=>'Data wystawienia',
'LBL_TITLE'=>'Tytuł',
'LBL_PARENT_NAME'=>'Kontrahent',
'LBL_AMOUNT_PLUS'=>'Przychód',
'LBL_AMOUNT_MINUS'=>'Rozchód',
'LBL_VALUE'=>'Suma',
'LBL_VALUE_BEFORE'=>'Stan kasy poprzednio',
'LBL_VALUE_TOTAL'=>'Stan kasy obecny',
'LBL_RAPORT_TITLE'=>'Zestawienie KPKW',
'LBL_RAPORT_TITLE2'=>'RAPORT KASOWY',
'LBL_RAPORT_LABEL'=>'Raport kasowy',
'LBL_TIME'=>'okres',
'LBL_TIME2'=>'Okres',
'LBL_CASH'=>'kasa',
'LBL_CURRENCY_PDF'=>'waluta',
'LBL_CURRENCY_PDF2'=>'Waluta',
'LBL_CASH_USER'=>'kasjer',
'LBL_DATE_START'=>'Od',
'LBL_DATE_END'=>'Do',
'LBL_CASH2'=>'Kasa',
'LBL_CASH_USER2'=>'Kasjer',
'LBL_SUBMIT'=>'Wykonaj',
'LBL_SELECT'=>'Wybierz',
'LBL_ALL'=>'Wszyscy',
'LBL_PRINT_PDF'=>'Drukuj PDF',
//ecmkpkw list =v=iew. ,
'LBL_PREVIEW' => 'Podgląd',
'LBL_EDIT_INFORMATION' => 'Informacje o dokumencie',
'LBL_PREVIEW_TAB' => 'Podgląd PDF',
'LBL_DIRECTION' => 'Rodzaj transakcji',
'LBL_LIST_FORM_TITLE' => 'Lista dokumentów',
'LBL_LIST_DOCUMENT' => 'Dokument',
'LBL_LIST_CATEGORY' => 'Kategoria',
'LBL_LIST_SUBCATEGORY' => 'Podkategoria',
'LBL_LIST_REVISION' => 'Wersja',
'LBL_LIST_LAST_REV_CREATOR' => 'Opublikowany przez',
'LBL_LIST_LAST_REV_DATE' => 'Data wersji',
'LBL_LIST_VIEW_DOCUMENT'=>'Podgląd',
'LBL_LIST_DOWNLOAD'=> 'Pobierz',
'LBL_LIST_ACTIVE_DATE' => 'Data publikacji',
'LBL_LIST_EXP_DATE' => 'Data wygaśnięcia',
'LBL_LIST_STATUS'=>'Status',
//ecmkpkw search form.
'LBL_SF_DOCUMENT' => 'Nazwa dokumentu:',
'LBL_SF_CATEGORY' => 'Kategoria:',
'LBL_SF_SUBCATEGORY'=> 'Podkategoria:',
'LBL_SF_ACTIVE_DATE' => 'Data publikacji:',
'LBL_SF_EXP_DATE'=> 'Data wygaśnięcia:',
'DEF_CREATE_LOG' => 'Dokument utworzony przez',
//error messages
'ERR_DOC_NAME'=>'Nazwa dokumentu',
'ERR_DOC_ACTIVE_DATE'=>'Data publikacji',
'ERR_DOC_EXP_DATE'=> 'Data wygaśniecia',
'ERR_FILENAME'=> 'Nazwa pliku',
'ERR_DOC_VERSION'=> 'Wersja dokumentu',
'ERR_DELETE_CONFIRM'=> 'Czy chcesz usunąć tę wersję dokumentu?',
'ERR_DELETE_LATEST_VERSION'=> 'Nie jesteś uprawiony do usunięcia najnowszej wersji dokumentu.',
'LNK_NEW_MAIL_MERGE' => 'Scalanie poczty',
'LBL_MAIL_MERGE_DOCUMENT' => 'Szablon scalania poczty:',
'LBL_TREE_TITLE' => 'Dokumenty',
//sub-panel vardefs.
'LBL_LIST_DOCUMENT_NAME'=>'Nazwa dokument',
'LBL_CONTRACT_NAME'=>'Nazwa kontraktu:',
'LBL_LIST_IS_TEMPLATE'=>'Szkic?',
'LBL_LIST_TEMPLATE_TYPE'=>'Typ dokumentu',
'LBL_LIST_SELECTED_REVISION'=>'Wybrane wersje',
'LBL_LIST_LATEST_REVISION'=>'Najnowsze wydanie',
'LBL_CONTRACTS_SUBPANEL_TITLE'=>'Połączone kontrakty',
'LBL_LAST_REV_CREATE_DATE'=>'Data utworzenia ostatniego wydania',
//'LNK_DOCUMENT_CAT'=>'EcmKpkw Categories',
'LBL_CONTRACTS' => 'Kontrakty',
'LBL_CREATED_USER' => 'Użytkownik tworzący',
'LBL_THEREVISIONS_SUBPANEL_TITLE' => 'Rewersje',
'LBL_DOCUMENT_INFORMATION' => 'Podgląd dokumentu',
'LBL_PARENT_NAME_COPY' => 'Pełna nazwa',
'LBL_INDEX' => 'Index',
// PDFY && RAPORT
);
?>

View File

@@ -0,0 +1,47 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$searchFields['EcmKpkw'] =
array (
'ecmkpkw_name' => array( 'query_type'=>'default'),
'category_id'=> array('query_type'=>'default', 'options' => 'ecmkpkw_category_dom', 'template_var' => 'CATEGORY_OPTIONS'),
'subcategory_id'=> array('query_type'=>'default', 'options' => 'ecmkpkw_subcategory_dom', 'template_var' => 'SUBCATEGORY_OPTIONS'),
'active_date'=> array('query_type'=>'default'),
'exp_date'=> array('query_type'=>'default'),
);
?>

View File

@@ -0,0 +1,140 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$viewdefs['EcmKpkw']['DetailView'] = array(
'templateMeta' => array('maxColumns' => '2',
'form' => array('hidden'=>array('<input type="hidden" name="old_id" value="{$fields.ecmkpkw_revision_id.value}">')),
'widths' => array(
array('label' => '10', 'field' => '30'),
array('label' => '10', 'field' => '30')
),
'buttons' => array(
array(
'customCode' => '{if $bean->aclAccess("edit") && $bean->status=="registered"}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'EcmEcmKpkw\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$id}\'; this.form.action.value=\'EditView\';" type="submit" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if}'
),
),
'includes' => array(
array(
'file' => 'include/JSON.js',
),
array(
'file' => 'modules/EcmKpkw/MyTable.js',
),
array(
'file' => 'modules/EcmFkBooks/EcmFkBooks.js',
),
array(
'file' => 'modules/EcmFkBooks/EcmFkBooksDetailView.js',
),
array(
'file' => 'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js',
),
),
),
'panels' => array(
'lbl_document_information' =>
array (
array (
array (
'name' => 'ecmkpkw_name',
'label' => 'LBL_DOC_NAME',
),
array (
'name' => 'document_no',
'label' => 'LBL_DOCUMENT_NO',
'value' => 'document_no',
),
),
array (
array (
'name' => 'amount',
'label' => 'LBL_AMOUNT',
),
array (
'name' => 'description',
'label' => 'LBL_DOC_DESCRIPTION',
),
),
array (
array (
'name' => 'modified_by_name',
'label' => 'LBL_MODIFIED_USER',
),
array (
'name' => 'date_modified',
'label' => 'LBL_DATE_MODIFIED',
),
),
array (
array (
'name' => 'created_by',
'label' => 'LBL_CREATED',
),
array (
'name' => 'date_entered',
'label' => 'LBL_DATE_ENTERED',
),
),
),
'LBL_PREVIEW_TAB' => array(
array(
array(
'name' => 'preview_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<select id="preview_type" name="preview_type">
<option value="">Faktura</option>
<option value="exp">Lista rozchodowa</option>
<option value="pl">Specyfikacja wysyłki</option>
</select>
<input type="button" class="button" onClick="preview_pdf();" value="Generuj"/>
<hr/>
<span id="previewPDF" width="100%" height="100%"></span>
',
),
),
),
),
);

View File

@@ -0,0 +1,186 @@
<?php
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
*
* "Powered by SugarCRM".
* ****************************************************************************** */
$viewdefs['EcmKpkw']['DetailView'] = array(
'templateMeta' => array(
'maxColumns' => '2',
'form' => array(
'buttons' => array (
array (
'customCode' => '{$CREATE_PDF}'
),
),
),
'widths' => array(
array(
'label' => '10',
'field' => '30',
),
array(
'label' => '10',
'field' => '30',
),
),
'includes' => array(
array('file' => 'include/JSON.js'),
//array('file' => 'modules/EcmKpkw/MyTable.js'),
array('file' => 'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js'),
array('file' => 'modules/EcmKpkw/EcmKpkw.js'),
),
),
'panels' => array(
'lbl_document_information' =>
array (
array (
array (
'name' => 'ecmkpkw_name',
'label' => 'LBL_DOC_NAME',
),
array (
'name' => 'document_no',
'label' => 'LBL_DOCUMENT_NO',
),
),
array (
array (
'name' => 'amount',
'label' => 'LBL_AMOUNT',
),
array (
'name' => 'description',
'label' => 'LBL_DOC_DESCRIPTION',
),
),
array (
array (
'name' => 'modified_user_fullname',
'label' => 'LBL_MODIFIED_USER',
),
array (
'name' => 'date_modified',
'label' => 'LBL_DATE_MODIFIED',
),
),
array (
array (
'name' => 'created_by_fullname',
'label' => 'LBL_CREATED',
),
array (
'name' => 'date_entered',
'label' => 'LBL_DATE_ENTERED',
),
),
array(
array('name' => 'currency_id', 'label' => 'LBL_CURRENCY'),
array('name' => 'currency_value', 'label' => 'LBL_CURRENCY_VALUE'),
),
array (
array (
'name' => 'register_date',
'label' => 'LBL_PAYMENT_DATE',
),
),
array(
array(
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_TO_INFORMATIONS}</h4>'
),
),
array (
'parent_name',
'dbf_index',
),
array (
'parent_address_street',
'parent_address_postalcode',
),
array (
'parent_address_city',
'parent_address_country',
),
),
'LBL_PREVIEW_TAB' => array(
array(
array(
'name' => 'preview_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<select id="preview_type" name="preview_type">
<option value="">KPKW</option>
</select>
<input type="button" class="button" onClick="preview_pdf();" value="Generuj"/>
<hr/>
<span id="previewPDF" width="100%" height="100%"></span>
',
),
),
),
),
);
/*
id
date_entered
date_modified
date_package
date_document
modified_user_id
created_by
description
deleted
package_date
package_name
package_number
package_amount
package_acc_ma
package_acc_wn
package_position
package_symbol
package_identifier
*/

View File

@@ -0,0 +1,177 @@
<?php
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
*
* "Powered by SugarCRM".
* ****************************************************************************** */
global $sugar_config;
$viewdefs['EcmKpkw']['EditView'] = array(
'templateMeta' => array(
'form' => array(
'enctype' => 'multipart/form-data',
'hidden' => array(
'<input type="hidden" id="template_id" name="template_id" value="97700b0d-fbe9-e366-4016-4b260f058a47">',
'<input type="hidden" name="parent_type" id="parent_type" value="Accounts">',
'<input type="hidden" name="ecmlanguage" id="ecmlanguage" value=\'\'>',
'<input type="hidden" name="kasier" id="kasier" value="{$USER_ID}">',
),
'buttons'=>array(
'SAVE',
//array('customCode' => '<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="return SaveForm();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">'),
array('customCode' => '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="window.location=\'index.php?module=EcmKpkw&action=index\';" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">'),
//array('customCode' => '<input class="button" onclick="test();" type="button" name="button" value="test">'),
//todo: create 'cancel function in js
),
),
'maxColumns' => '3',
'widths' => array(
array(
'label' => '10',
'field' => '30',
),
array(
'label' => '10',
'field' => '30',
),
array(
'label' => '10',
'field' => '30',
),
),
'includes' => array(
array('file'=>'include/JSON.js'),
array('file'=>'include/javascript/quicksearch.js'),
array('file'=>'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js'),
array('file'=>'modules/EcmKpkw/AjaxSearch/AjaxSearch.js'),
array('file'=>'modules/EcmKpkw/formloader.js'),
array('file'=>'modules/EcmKpkw/MyTable.js'),
array('file'=>'modules/EcmKpkw/EcmKpkw.js'),
array('file'=>'modules/EcmProducts/mintajax.js'),
array('file'=>'modules/EcmProducts/helper.js'),
),
),
'panels' => array(
'LBL_EDIT_INFORMATION' => array(
array(
'ecmkpkw_name',
'description',
),
array(
array(
'name' => 'document_no',
'tabIndex' => '1',
'customCode' => '<div id="tst" style="display:none;"></div><input readonly="readonly" type="text" name="document_no" id="document_no" value=\'{$fields.document_no.value}\'>
<input type="hidden" name="number" id="number" value=\'{$fields.number.value}\'>'
),),
array(
0=>'parent_name',
1=>'document',
2=>'',
),
array(
0=>'dir',
1=>'',
2=>'',
),
array(
0=>'amount',
1=>'currency_id',
2=>'',
),
array(
array('name'=>'currency_value','label'=>'LBL_CURRENCY_VALUE'),
'register_date',
),
array(
array('name'=>'ecmcash_id','label'=>'LBL_CASH','customCode' => '{$CASH}'),
),
array(
array(
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;margin-bottom: 15px;margin-top:15px"></div><h4>{$MOD.LBL_TO_INFORMATIONS}</h4>'
),
),
array (
0=>array(
'name' => 'parent_name_copy',
'customCode' => '<input type="text" name="parent_name_copy" id="parent_name_copy" value="{$fields.parent_name.value}" readOnly="readonly" style="vertical-align:top;width:350px;margin-left:2px" />'
),
/*1=>array(
'name' => 'index_dbf',
'customCode' => '<input type="text" name="index_dbf" id="index_dbf" value="{$fields.index_dbf.value}" size="30" />'
),*/
1=>'',
2=>'',
),
array (
array(
'name' => 'parent_address_street',
'tabIndex' => '1',
//'customCode' => '<textarea tabindex="1" id="parent_address_street" name="parent_address_street" rows="2" cols="45" maxlength="150" >{$fields.parent_address_street.value}</textarea>',
'customCode' => '<input id="parent_address_street" name="parent_address_street" maxlength="150" value="{$fields.parent_address_street.value}" style="vertical-align:top;width:250px;margin-left:2px">',
),
),
array (
array(
'name' => 'parent_address_postalcode',
'tabIndex' => '1',
'customCode' => '<input maxlength="8" type="text" name="parent_address_postalcode" id="parent_address_postalcode" value="{$fields.parent_address_postalcode.value}" style="vertical-align:top;width:50px;margin-left:2px" />'
),
),
array (
array(
'name' => 'parent_address_city',
'tabIndex' => '1',
'customCode' => '<input type="text" name="parent_address_city" id="parent_address_city" value="{$fields.parent_address_city.value}" style="margin-left:2px;vertical-align:top;width:150px;" />'
),
),
array (
array(
'name' => 'parent_address_country',
'tabIndex' => '1',
),
),
),
),
);

View File

@@ -0,0 +1,104 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$listViewDefs['EcmKpkw'] = array(
'ECMKPKW_NAME' =>
array (
'width' => '15%',
'label' => 'LBL_NAME',
'link' => true,
'default' => true,
'bold' => true,
),
'DOCUMENT_NO' =>
array (
'width' => '15%',
'label' => 'LBL_DOCUMENT_NO',
'link' => true,
'default' => true,
'bold' => true,
),
'AMOUNT' =>
array (
'width' => '15%',
'label' => 'LBL_AMOUNT',
'link' => false,
'default' => true,
'bold' => true,
),
'PARENT_NAME' =>
array (
'width' => '15%',
'label' => 'LBL_PARENT_NAME',
'link' => true,
'default' => true,
'bold' => true,
),
'DESCRIPTION' =>
array (
'width' => '15%',
'label' => 'LBL_DESCRIPTION',
'link' => false,
'default' => true,
'bold' => true,
),
'MODIFIED_USER_ID' =>
array (
// 'width' => '10%',
'label' => 'LBL_MODIFIED_USER',
// 'module' => 'Users',
// 'link' => true,
'default' => true,
// 'bold' => true,
// 'customCode' => 'sadadsas',
),
'MODIFIED_USER_FULLNAME' =>
array (
// 'width' => '10%',
'label' => 'LBL_MODIFIED_USER',
// 'module' => 'Users',
// 'link' => true,
'default' => false,
// 'bold' => true,
// 'customCode' => 'sadadsas',
)
);
?>

View File

@@ -0,0 +1,106 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$viewdefs['EcmKpkw']['QuickCreate'] = array(
'templateMeta' => array('form' => array('enctype'=>'multipart/form-data',
'hidden'=>array('<input type="hidden" name="old_id" value="{$fields.ecmkpkw_revision_id.value}">',
'<input type="hidden" name="parent_id" value="{$smarty.request.parent_id}">',
'<input type="hidden" name="parent_type" value="{$smarty.request.parent_type}">',)),
'maxColumns' => '2',
'widths' => array(
array('label' => '10', 'field' => '30'),
array('label' => '10', 'field' => '30')
),
'includes' =>
array (
array('file' => 'include/javascript/popup_parent_helper.js'),
array('file' => 'include/jsolait/init.js'),
array('file' => 'include/jsolait/lib/urllib.js'),
array('file' => 'include/javascript/jsclass_base.js'),
array('file' => 'include/javascript/jsclass_async.js'),
array('file' => 'modules/EcmKpkw/ecmkpkw.js'),
),
),
'panels' =>array (
'default' =>
array (
array (
array('name'=>'uploadfile',
'customCode' => '<input type="hidden" name="escaped_ecmkpkw_name"><input name="uploadfile" type="file" size="30" maxlength="" onchange="setvalue(this);" value="{$fields.filename.value}">{$fields.filename.value}',
'displayParams'=>array('required'=>true),
),
'status_id',
),
array (
'ecmkpkw_name',
array('name'=>'revision',
'customCode' => '<input name="revision" type="text" value="{$fields.revision.value}">'
),
),
array (
array (
'name' => 'template_type',
'label' => 'LBL_DET_TEMPLATE_TYPE',
),
array (
'name' => 'is_template',
'label' => 'LBL_DET_IS_TEMPLATE',
),
),
array (
array('name'=>'active_date','displayParams'=>array('required'=>true)),
'category_id',
),
array (
'exp_date',
'subcategory_id',
),
array (
array('name'=>'description', 'displayParams'=>array('rows'=>10, 'cols'=>120)),
),
),
)
);
?>

View File

@@ -0,0 +1,55 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$searchdefs['EcmKpkw'] = array(
'templateMeta' => array('maxColumns' => '3',
'widths' => array('label' => '10', 'field' => '30'),
),
'layout' => array(
'basic_search' => array(
'ecmkpkw_name',
),
'advanced_search' => array(
'ecmkpkw_name',
'category_id',
'subcategory_id',
'active_date',
'exp_date',
),
),
);
?>

View File

@@ -0,0 +1,65 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$GLOBALS['studioDefs']['EcmKpkw'] = array(
'LBL_DETAILVIEW'=>array(
'template'=>'xtpl',
'template_file'=>'modules/EcmKpkw/DetailView.html',
'php_file'=>'modules/EcmKpkw/DetailView.php',
'type'=>'DetailView',
),
'LBL_EDITVIEW'=>array(
'template'=>'xtpl',
'template_file'=>'modules/EcmKpkw/EditView.html',
'php_file'=>'modules/EcmKpkw/EditView.php',
'type'=>'EditView',
),
'LBL_LISTVIEW'=>array(
'template'=>'listview',
'meta_file'=>'modules/EcmKpkw/listviewdefs.php',
'type'=>'ListView',
),
'LBL_SEARCHFORM'=>array(
'template'=>'xtpl',
'template_file'=>'modules/EcmKpkw/SearchForm.html',
'php_file'=>'modules/EcmKpkw/ListView.php',
'type'=>'SearchForm',
),
);

View File

@@ -0,0 +1,55 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
// $layout_defs['EcmKpkw'] = array(
//list of what Subpanels to show in the DetailView
// 'subpanel_setup' => array(
// 'therevisions' => array(
// 'order' => 10,
// 'sort_order' => 'desc',
// 'sort_by' => 'revision',
// 'module' => 'EcmKpkwRevisions',
// 'subpanel_name' => 'default',
// 'title_key' => 'LBL_DOC_REV_HEADER',
// 'get_subpanel_data' => 'revisions',
// 'fill_in_additional_fields'=>true,
// ),
// ),
// );
?>

View File

@@ -0,0 +1,90 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmKpkw','field_to_name_array'=>array('ecmkpkw_revision_id'=>'REL_ATTRIBUTE_document_revision_id')),
),
'where' => '',
'list_fields'=> array(
'ecmkpkw_name'=> array(
'name' => 'ecmkpkw_name',
'vname' => 'LBL_LIST_DOCUMENT_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '30%',
),
'is_template'=>array(
'name' => 'is_template',
'vname' => 'LBL_LIST_IS_TEMPLATE',
'width' => '5%',
'widget_type'=>'checkbox',
),
'template_type'=>array(
'name' => 'template_types',
'vname' => 'LBL_LIST_TEMPLATE_TYPE',
'width' => '15%',
),
'latest_revision'=>array(
'name' => 'latest_revision',
'vname' => 'LBL_LATEST_REVISION',
'width' => '10%',
'sortable' => false
),
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'remove_button'=>array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'ecmkpkw_revision_id'=>array(
'usage'=>'query_only'
),
),
);
?>

View File

@@ -0,0 +1,110 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmKpkw','field_to_name_array'=>array('ecmkpkw_revision_id'=>'REL_ATTRIBUTE_document_revision_id')),
),
'where' => '',
'list_fields'=> array(
'object_image'=>array(
'vname' => 'LBL_OBJECT_IMAGE',
'widget_class' => 'SubPanelIcon',
'width' => '2%',
'image2'=>'attachment',
'image2_url_field'=>array('id_field'=>'selected_revision_id','filename_field'=>'selected_revision_filename'),
'attachment_image_only'=>true,
),
'ecmkpkw_name'=> array(
'name' => 'ecmkpkw_name',
'vname' => 'LBL_LIST_DOCUMENT_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '30%',
),
'is_template'=>array(
'name' => 'is_template',
'vname' => 'LBL_LIST_IS_TEMPLATE',
'width' => '5%',
'widget_type'=>'checkbox',
),
'template_type'=>array(
'name' => 'template_types',
'vname' => 'LBL_LIST_TEMPLATE_TYPE',
'width' => '15%',
),
'selected_revision_name'=>array(
'name' => 'selected_revision_name',
'vname' => 'LBL_LIST_SELECTED_REVISION',
'width' => '10%',
),
'latest_revision_name'=>array(
'name' => 'latest_revision_name',
'vname' => 'LBL_LIST_LATEST_REVISION',
'width' => '10%',
),
'get_latest'=>array(
'widget_class' => 'SubPanelGetLatestButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'load_signed'=>array(
'widget_class' => 'SubPanelLoadSignedButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'remove_button'=>array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
),
);
?>

View File

@@ -0,0 +1,87 @@
<?php
error_reporting(E_ALL);
$json = getJSONobj();
$pll = array();
$i = 0;
while (isset($_POST['p_' . $i])) {
$pll[] = $json->decode(htmlspecialchars_decode($_POST['p_' . $i]));
$_POST['p_' . $i] = '';
$i++;
}
$_POST = $json->decode(htmlspecialchars_decode($_POST['otherFormData']));
$_POST['position_list'] = $pll;
if (isset($_REQUEST['record']) && $_REQUEST['record'] != '' && $_REQUEST['cache'] != "fromJava") {
require_once("modules/EcmKpkw/EcmKpkw.php");
$focus = new EcmKpkw();
$method = (isset($_REQUEST['method']) && $_REQUEST['method'] != '') ? $_REQUEST['method'] : 'D';
$focus->getPDF($_REQUEST['record'], $method, null, @$_REQUEST['type']);
} else
if ($_REQUEST['cache'] == "fromJava" && $_GET['from'] != "EcmKpkw") {
$_SESSION['PDF_ECMKPKW'] = $_POST;
} else
if ($_GET['from'] == "EcmKpkw") {
require_once("modules/EcmKpkw/EcmKpkw.php");
$focus = new EcmKpkw();
if (isset($_SESSION['PDF_ECMKPKW']['record']) && $_SESSION['PDF_ECMKPKW']['record'] != '') {
$focus->retrieve($_SESSION['PDF_ECMKPKW']['record']);
}
if (!$focus->ACLAccess('Save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
foreach ($focus->column_fields as $field) {
if (isset($_SESSION['PDF_ECMKPKW'][$field])) {
$value = $_SESSION['PDF_ECMKPKW'][$field];
$focus->$field = $value;
}
}
foreach ($focus->additional_column_fields as $field) {
if (isset($_SESSION['PDF_ECMKPKW'][$field])) {
$value = $_SESSION['PDF_ECMKPKW'][$field];
$focus->$field = $value;
}
}
// if (isset($_SESSION['PDF_ECMKPKW']['to_is_vat_free']) && $_SESSION['PDF_ECMKPKW']['to_is_vat_free'])
// $focus->to_is_vat_free = 1;
// else
// $focus->to_is_vat_free = 0;
// $json = getJSONobj();
// $pl = $_SESSION['PDF_ECMKPKW']['position_list'];
// $focus->position_list = $pl;
$focus->document_no = $_SESSION['PDF_ECMKPKW']['document_no'];
// $focus->wz_id = $_SESSION['PDF_ECMKPKW']['out_id'];
// $focus->ecmpaymentcondition_text = EcmKpkw::getTranslation('EcmPaymentConditions', $focus->ecmpaymentcondition_id, $focus->ecmlanguage);
//die();
$focus->getPDF();
}

View File

@@ -0,0 +1,88 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmKpkw','field_to_name_array'=>array('ecmkpkw_revision_id'=>'REL_ATTRIBUTE_document_revision_id')),
),
'where' => '',
'list_fields'=> array(
'ecmkpkw_name'=> array(
'name' => 'ecmkpkw_name',
'vname' => 'LBL_LIST_DOCUMENT_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '30%',
),
'is_template'=>array(
'name' => 'is_template',
'vname' => 'LBL_LIST_IS_TEMPLATE',
'width' => '5%',
'widget_type'=>'checkbox',
),
'template_type'=>array(
'name' => 'template_types',
'vname' => 'LBL_LIST_TEMPLATE_TYPE',
'width' => '15%',
),
'latest_revision'=>array(
'name' => 'latest_revision',
'vname' => 'LBL_LATEST_REVISION',
'width' => '10%',
'sortable' => false
),
'edit_button'=>array(
'widget_class' => 'SubPanelEditButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'remove_button'=>array(
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'ecmkpkw_revision_id'=>array(
'usage'=>'query_only'
),
),
);
?>

View File

@@ -0,0 +1,107 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmKpkw','field_to_name_array'=>array('ecmkpkw_revision_id'=>'REL_ATTRIBUTE_document_revision_id')),
),
'where' => '',
'list_fields'=> array(
'object_image'=>array(
'widget_class' => 'SubPanelIcon',
'width' => '2%',
'image2'=>'attachment',
'image2_url_field'=>array('id_field'=>'selected_revision_id','filename_field'=>'selected_revision_filename'),
'attachment_image_only'=>true,
),
'ecmkpkw_name'=> array(
'name' => 'ecmkpkw_name',
'vname' => 'LBL_LIST_DOCUMENT_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '30%',
),
'is_template'=>array(
'name' => 'is_template',
'vname' => 'LBL_LIST_IS_TEMPLATE',
'width' => '5%',
'widget_type'=>'checkbox',
),
'template_type'=>array(
'name' => 'template_types',
'vname' => 'LBL_LIST_TEMPLATE_TYPE',
'width' => '15%',
),
'selected_revision_name'=>array(
'name' => 'selected_revision_name',
'vname' => 'LBL_LIST_SELECTED_REVISION',
'width' => '10%',
),
'latest_revision_name'=>array(
'name' => 'latest_revision_name',
'vname' => 'LBL_LIST_LATEST_REVISION',
'width' => '10%',
),
'get_latest'=>array(
'widget_class' => 'SubPanelGetLatestButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'load_signed'=>array(
'widget_class' => 'SubPanelLoadSignedButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'edit_button'=>array(
'widget_class' => 'SubPanelEditButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
'remove_button'=>array(
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmKpkw',
'width' => '5%',
),
),
);
?>

457
modules/EcmKpkw/vardefs.php Normal file
View File

@@ -0,0 +1,457 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$dictionary['EcmKpkw'] = array('table' => 'ecmkpkw'
,'fields' => array (
'id' => array(
'name' => 'id',
'vname' => 'LBL_ID',
'type' => 'id',
'required' => true,
'reportable' => true,
'comment' => 'Unique identifier',
),
'created_by' => array(
'name' => 'created_by',
'rname' => 'user_name',
'id_name' => 'modified_user_id',
'vname' => 'LBL_CREATED_ID',
'type' => 'assigned_user_name',
'table' => 'users',
'isnull' => 'false',
'dbType' => 'id',
'group' => 'created_by_name',
'comment' => 'User who created record',
),
'assigned_user_name' =>
array (
'name' => 'assigned_user_name',
'vname' => 'LBL_ASSIGNED_TO',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'table' => 'users',
'id_name' => 'assigned_user_id',
'module' => 'Users',
'duplicate_merge' => 'disabled',
'massupdate' => false,
),
'created_by_name' => array(
'name' => 'created_by_name',
'vname' => 'LBL_CREATED',
'type' => 'relate',
'reportable' => false,
'link' => 'created_by_link',
'rname' => 'user_name',
'source' => 'non-db',
'table' => 'users',
'id_name' => 'created_by',
'module' => 'Users',
'duplicate_merge' => 'disabled',
'importable' => 'false',
),
'modified_by_name' => array(
'name' => 'modified_by_name',
'vname' => 'LBL_MODIFIED_USER',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'rname' => 'first_name',
'table' => 'users',
'id_name' => 'modified_user_id',
'module' => 'Users',
'link' => 'modified_user_link',
'duplicate_merge' => 'disabled',
),
'modified_by_surname' => array(
'name' => 'modified_by_surname',
'vname' => 'LBL_MODIFIED_USER',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'rname' => 'last_name',
'table' => 'users',
'id_name' => 'modified_user_id',
'module' => 'Users',
'link' => 'modified_user_link',
'duplicate_merge' => 'disabled',
),
'modified_user_fullname' =>
array (
'name' => 'modified_user_fullname',
'vname' => 'LBL_MODIFIED_USER',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'table' => 'users',
'id_name' => 'modified_user_id',
'module' => 'Users',
'duplicate_merge' => 'disabled',
'massupdate' => false,
),
'created_by_fullname' =>
array (
'name' => 'created_by_fullname',
'vname' => 'LBL_CREATED',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'table' => 'users',
'id_name' => 'created_by',
'module' => 'Users',
'duplicate_merge' => 'disabled',
'massupdate' => false,
),
'date_entered' => array(
'name' => 'date_entered',
'vname' => 'LBL_DATE_ENTERED',
'type' => 'date',
'comment' => 'Date record created',
),
'date_modified' => array(
'name' => 'date_modified',
'vname' => 'LBL_DATE_MODIFIED',
'type' => 'date',
'comment' => 'Date record last modified',
),
'modified_user_id' => array(
'name' => 'modified_user_id',
'rname' => 'user_name',
'id_name' => 'modified_user_id',
'vname' => 'LBL_CREATED_ID',
'type' => 'assigned_user_name',
'table' => 'users',
'isnull' => 'false',
'dbType' => 'id',
'group' => 'created_by_name',
'comment' => 'User who created record',
),
'ecmkpkw_name' => array (
'name' => 'ecmkpkw_name',
'vname' => 'LBL_NAME',
'type' => 'varchar',
'len' => '255',
'required'=>false,
'importable' => 'required',
),
'parent_name' => array(
'name'=> 'parent_name',
'parent_type'=>'ecmquotes_parent_dom' ,
// 'type_name'=>'parent_type',
'id_name'=>'parent_id',
'vname'=>'LBL_PARENT_NAME',
'type'=>'relate',
'group'=>'parent_name',
'dbtype' => 'varchar',
'len' => '255',
//'source'=>'non-db',
'module' => 'Accounts',
'massupdate' => false,
// 'options'=> 'ecmquotes_parent_dom',
'required' => true,
),
'parent_id' => array (
'name' => 'parent_id',
'type' => 'id',
'module' => 'Accounts',
'vname' => 'LBL_PARENT_ID',
'group'=>'parent_name',
'massupdate' => false,
'reportable'=>false,
'required' => true,
),
'ecmcash_id' => array (
'name' => 'ecmcash_id',
'type' => 'id',
'module' => 'EcmCashs',
'vname' => 'LBL_PARENT_ID',
'massupdate' => false,
'reportable'=>false,
'required' => true,
),
'amount' => array(
'name' => 'amount',
'vname' => 'LBL_AMOUNT',
'type' => 'decimal',
'len' => '15,2',
'required' => true,
),
'description' => array (
'type' => 'text',
'name' => 'description',
'vname' => 'LBL_DESCRIPTION',
'comment' => 'Description',
'unified_search' => true,
//'required' => true,
),
'number' => array(
'name' => 'number',
'vname' => 'LBL_NUMBER',
'type' => 'varchar',
'required_option' => true,
'unified_search' => true,
'required' => true,
'len' => '20',
),
'document_no' => array(
'name' => 'document_no',
'vname' => 'LBL_DOCUMENT_NO',
'type' => 'varchar',
'required_option' => true,
'unified_search' => true,
'required' => true,
'len' => '30',
),
'register_date' => array (
'name' => 'register_date',
'vname' => 'LBL_PAYMENT_DATE',
'type' => 'date',
'reportable' => false,
'showFormats' => true,
'massupdate' => false,
'required' => false
),
'dir' => array (
'name' => 'dir',
'vname' => 'LBL_DIRECTION',
'type' => 'enum',
'size' => '2',
'required' => true,
'options' => 'ecmkpkw_type_dir',
'massupdate' => false,
),
'parent_name_copy' => array(
'name' => 'parent_name_copy',
'vname' => 'LBL_PARENT_NAME_COPY',
'type' => 'varchar',
'source' => 'non-db',
),
'parent_contact_name' => array (
'name' => 'parent_contact_name',
'vname' => 'LBL_PARENT_CONTACT_NAME',
'type' => 'varchar',
'len' => '255',
'merge_filter' => 'enabled',
),
'parent_contact_title' => array (
'name' => 'parent_contact_title',
'vname' => 'LBL_PARENT_CONTACT_TITLE',
'type' => 'varchar',
'len' => '255',
'merge_filter' => 'enabled',
),
'currency_id' => array (
'name' => 'currency_id',
'type' => 'enum',
'options' => 'currency_dom',
'label' => 'LBL_CURRENCY'
),
'currency_value' => array (
'name' => 'currency_value',
'type' => 'decimal',
'len' => '5,4',
'vname' => 'LBL_CURRENCY_VALUE',
'reportable' => false,
'required' => false
),
'parent_address_street' =>
array (
'name' => 'parent_address_street',
'vname' => 'LBL_PARENT_ADDRESS_STREET',
'type' => 'varchar',
'len' => '150',
'comment' => 'The street address used for parent address',
'group' => 'parent_address',
'merge_filter' => 'enabled',
),
'parent_address_city' =>
array (
'name' => 'parent_address_city',
'vname' => 'LBL_PARENT_ADDRESS_CITY',
'type' => 'varchar',
'len' => '100',
'comment' => 'The city used for parent address',
'group' => 'parent_address',
'merge_filter' => 'enabled',
),
'parent_address_postalcode' =>
array (
'name' => 'parent_address_postalcode',
'vname' => 'LBL_PARENT_ADDRESS_POSTALCODE',
'type' => 'varchar',
'len' => '20',
'group' => 'parent_address',
'comment' => 'The postal code used for parent address',
'merge_filter' => 'enabled',
),
'parent_address_country' =>
array (
'name' => 'parent_address_country',
'vname' => 'LBL_PARENT_ADDRESS_COUNTRY',
'type' => 'varchar',
'group' => 'parent_address',
'comment' => 'The country used for the parent address',
'merge_filter' => 'enabled',
),
'index_dbf' =>
array (
'name' => 'index_dbf',
'vname' => 'LBL_INDEX',
'type' => 'varchar',
'group' => 'parent_address',
//'comment' => 'The country used for the parent address',
'merge_filter' => 'enabled',
),
'created_by' => array (
'name' => 'created_by',
'rname' => 'user_name',
'id_name' => 'created_by',
'vname' => 'LBL_CREATED',
'type' => 'assigned_user_name',
'table' => 'created_by_users',
'isnull' => 'false',
'dbType' => 'varchar',
'len' => 36,
'comment' => 'User that created the record'
),
'created_by_link' => array (
'name' => 'created_by_link',
'type' => 'link',
'relationship' => 'ecmkpkw'.'_created_by',
'vname' => 'LBL_CREATED_BY_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db',
),
'modified_user_link' => array (
'name' => 'modified_user_link',
'type' => 'link',
'relationship' => 'ecmkpkw'.'_modified_user',
'vname' => 'LBL_MODIFIED_BY_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db',
),
'assigned_user_link' => array (
'name' => 'assigned_user_link',
'type' => 'link',
'relationship' => 'ecmkpkw'.'_assigned_user',
'vname' => 'LBL_ASSIGNED_TO_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db',
'duplicate_merge' => 'enabled',
'rname' => 'user_name',
'id_name' => 'assigned_user_id',
'table' => 'users',
),
//END fields used for contract ecmkpkw subpanel.
),
'relationships' => array (
'ecmkpkw_ecmstockdocouts' => array(
'lhs_module'=> 'EcmStockDocOuts',
'lhs_table'=> 'ecmstockdocouts',
'lhs_key' => 'id',
'rhs_module'=> 'EcmKpkw',
'rhs_table'=> 'ecmkpkw',
'rhs_key' => 'wz_id',
'relationship_type'=>'one-to-many'),
'ecmkpkw'.'_modified_user' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmKpkw',
'rhs_table' => 'ecmkpkw',
'rhs_key' => 'modified_user_id',
'relationship_type' => 'one-to-many'
),
'ecmkpkw'.'_created_by' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmKpkw',
'rhs_table' => 'ecmkpkw',
'rhs_key' => 'created_by',
'relationship_type' => 'one-to-many'
),
'ecmkpkw'.'_account' => array (
'lhs_module' => 'Accounts', 'lhs_table' => 'accounts', 'lhs_key' => 'id',
'rhs_module' => 'EcmKpkw', 'rhs_table' => 'ecmkpkw', 'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecmkpkw'.'_project' => array (
'lhs_module' => 'Project', 'lhs_table' => 'project', 'lhs_key' => 'id',
'rhs_module' => 'EcmKpkw', 'rhs_table' => 'ecmkpkw', 'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecmkpkw'.'_bug' => array (
'lhs_module' => 'Bugs', 'lhs_table' => 'bugs', 'lhs_key' => 'id',
'rhs_module' => 'EcmKpkw', 'rhs_table' => 'ecmkpkw', 'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecmkpkw'.'_case' => array (
'lhs_module' => 'Cases', 'lhs_table' => 'cases', 'lhs_key' => 'id',
'rhs_module' => 'EcmKpkw', 'rhs_table' => 'ecmkpkw', 'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
'ecmkpkw'.'_task' => array (
'lhs_module' => 'Tasks', 'lhs_table' => 'tasks', 'lhs_key' => 'id',
'rhs_module' => 'EcmKpkw', 'rhs_table' => 'ecmkpkw', 'rhs_key' => 'parent_id',
'relationship_type' => 'one-to-many'
),
)
);
// VardefManager::createVardef('EcmKpkw','EcmKpkw', array('default',
// ));

View File

@@ -0,0 +1,288 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{{include file="modules/EcmSerices/views/DetailView/headerx.tpl"}}
{sugar_include include=$includes}
{{* Render tag for VCR control if SHOW_VCR_CONTROL is true *}}
{{if $SHOW_VCR_CONTROL}}
<table width='100%' border='0' style="border-bottom:0px;" cellspacing='{$gridline}' cellpadding='0' class='tabDetailView'>
{$PAGINATION}
</table>
{{/if}}
{literal}
<script language="javascript">console.log(123);
var SelectedTab = "";
function SetTab(tab_name) {
var TabMenu = document.getElementById('groupTabsPanels');
var tabs = TabMenu.getElementsByTagName('li');
for(i=0;i<tabs.length;i++) {
if((tab_name+'_menu') === tabs[i].id) {
tabs[i].className = 'active';
tabs[i].getElementsByTagName('a')[0].className = 'current';
} else {
tabs[i].className = '';
tabs[i].getElementsByTagName('a')[0].className = '';
}
}
var prev = document.getElementById(SelectedTab);
var curr = document.getElementById(tab_name);
prev.style.display = 'none';
curr.style.display = '';
SelectedTab = tab_name;
}
</script>
{/literal}
<ul class="subpanelTablist" style="margin-top:10px;" id="groupTabsPanels">
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{if $panel[0][0].field.type == 'tab'}}
{{if $label=='EMAIL'}}
{{else}}
<li class="{{if $panel[0][0].field.active}}active{{/if}}" id="panel_{{$label}}_menu">
<script language="javascript">
var set{{$label}} = function() {literal} { {/literal} SetTab('panel_{{$label}}'); {literal} }; {/literal}
{{if $panel[0][0].field.active}}SelectedTab="panel_{{$label}}";{{/if}}
</script>
<a class="{{if $panel[0][0].field.active}}current{{else}}other{{/if}}" href="javascript:set{{$label}}();">{sugar_translate label='LBL_{{$label}}_TAB' module='{{$module}}'}</a>
</li>
{{/if}}
{{/if}}
{{/foreach}}
<li class="" id="panel_EMAIL_menu">
<a class="" href="javascript:{$EMAIL_LINK}">{sugar_translate label='LBL_EMAIL_TAB' module='EcmSerices'}</a>
</li>
</ul>
{{* Loop through all top level panels first *}}
{{counter name="panelCount" print=false start=0 assign="panelCount"}}
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{assign var='panel_id' value=$panelCount}}
<div {{if $panel[0][0].field.active == false}}style="display:none"{{/if}} id='panel_{{$label}}'>
{counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
{{* Print out the panel title if one exists*}}
{{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
{{* See function.sugar_include.php *}}
{{if !is_array($panel)}}
{sugar_include type='php' file='{{$panel}}'}
{{else}}
<!--
{{if !empty($label) && !is_int($label) && $label != 'DEFAULT'}}
<h4 class="dataLabel">{sugar_translate label='{{$label}}' module='{{$module}}'}</h4><br>
{{/if}}
-->
{{* Print out the table data *}}
<table width='100%' border='0' style="border-top:0px" cellspacing='{$gridline}' cellpadding='0' class='tabDetailView'>
{{if $panelCount == 0}}
{{counter name="panelCount" print=false}}
{{/if}}
{{foreach name=rowIteration from=$panel key=row item=rowData}}
<tr>
{{assign var='columnsInRow' value=$rowData|@count}}
{{assign var='columnsUsed' value=0}}
{{foreach name=colIteration from=$rowData key=col item=colData}}
{{if $colData.field.allCols == false}}
<td width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' class='tabDetailViewDL' NOWRAP>
{{if isset($colData.field.customLabel)}}
{{$colData.field.customLabel}}
{{elseif isset($colData.field.label) && strpos($colData.field.label, '$')}}
{capture name="label" assign="label"}
{{$colData.field.label}}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($colData.field.label)}}
{capture name="label" assign="label"}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($fields[$colData.field.name])}}
{capture name="label" assign="label"}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{else}}
&nbsp;
{{/if}}
</td>
{{/if}}
<td width='{{if $colData.field.allCols == true}}100{{else}}{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}{{/if}}%' class='tabDetailViewDF' {{if $colData.field.allCols == true}}colspan='4'{{else}}{{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}{{/if}}>
{{if $colData.field.customCode || $colData.field.assign}}
{counter name="panelFieldCount"}
{{sugar_evalcolumn var=$colData.field colData=$colData}}
{{elseif $fields[$colData.field.name] && !empty($colData.field.fields) }}
{{foreach from=$colData.field.fields item=subField}}
{{if $fields[$subField]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' tabindex=$tabIndex vardef=$fields[$subField] displayType='detailView'}}&nbsp;
{{else}}
{counter name="panelFieldCount"}
{{$subField}}
{{/if}}
{{/foreach}}
{{elseif $fields[$colData.field.name]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' vardef=$fields[$colData.field.name] displayType='detailView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type}}
{{/if}}
&nbsp;
</td>
{{/foreach}}
</tr>
{{/foreach}}
</table>
{{/if}}
</div>
{if $panelFieldCount == 0}
<script>document.getElementById("panel_{{$panel_id}}").style.display='none';</script>
{/if}
{{/foreach}}
{{include file="modules/EcmSerices/views/DetailView/footer.tpl"}}

View File

@@ -0,0 +1,37 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
</form>

View File

@@ -0,0 +1,105 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{{* Add the preForm code if it is defined (used for vcards) *}}
{{if $preForm}}
{{$preForm}}
{{/if}}
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
<td style="padding-bottom: 2px;" align="left" NOWRAP>
<form action="index.php" method="post" name="DetailView" id="form">
<input type="hidden" name="module" value="{$module}">
<input type="hidden" name="record" value="{$fields.id.value}">
<input type="hidden" name="return_action">
<input type="hidden" name="return_module">
<input type="hidden" name="return_id">
<input type="hidden" name="isDuplicate" value="false">
<input type="hidden" name="offset" value="{$offset}">
<input type="hidden" name="action" value="EditView">
{{if isset($form.hidden)}}
{{foreach from=$form.hidden item=field}}
{{$field}}
{{/foreach}}
{{/if}}
{{if !isset($form.buttons)}}
<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$id}'; this.form.action.value='EditView'" type="submit" name="Edit" id='edit_button' value=" {$APP.LBL_EDIT_BUTTON_LABEL} ">
<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='index'; this.form.isDuplicate.value=true; this.form.action.value='EditView'" type="submit" name="Duplicate" value=" {$APP.LBL_DUPLICATE_BUTTON_LABEL} " id='duplicate_button'>
<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='ListView'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value=" {$APP.LBL_DELETE_BUTTON_LABEL} " >
{{else}}
{{counter assign="num_buttons" start=0 print=false}}
{{foreach from=$form.buttons key=val item=button}}
{{if !is_array($button) && in_array($button, $built_in_buttons)}}
{{counter print=false}}
{{sugar_button module="$module" id="$button" view="EditView"}}
{{/if}}
{{/foreach}}
{{if isset($closeFormBeforeCustomButtons)}}
</form>
</td>
{{/if}}
{{if count($form.buttons) > $num_buttons}}
{{foreach from=$form.buttons key=val item=button}}
{{if is_array($button) && $button.customCode}}
<td style="padding-bottom: 2px;" align="left" NOWRAP>
{{sugar_button module="$module" id="$button" view="EditView"}}
</td>
{{/if}}
{{/foreach}}
{{/if}}
{{/if}}
{{if !isset($closeFormBeforeCustomButtons)}}
</form>
</td>
{{/if}}
{{if empty($form.hideAudit) || !$form.hideAudit}}
<td style="padding-bottom: 2px;" align="left" NOWRAP>
{{sugar_button module="$module" id="Audit" view="EditView"}}
</td>
{{/if}}
<td align="right" width="100%">{$ADMIN_EDIT}</td>
{{* Add $form.links if they are defined *}}
{{if !empty($form) && isset($form.links)}}
<td align="right" width="10%">&nbsp;</td>
<td align="right" width="100%" NOWRAP>
{{foreach from=$form.links item=link}}
{{$link}}&nbsp;
{{/foreach}}
</td>
{{/if}}
</tr>
</table>

View File

@@ -0,0 +1,92 @@
<?php
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* ****************************************************************************** */
require_once('include/DetailView/DetailView2.php');
class ViewDetailMy extends SugarView {
var $type = 'detail';
var $dv;
var $tplFile = 'include/DetailView/DetailView.tpl';
function ViewDetailMy() {
$this->options['show_subpanels'] = true;
parent::SugarView();
}
function preDisplay() {
$metadataFile = null;
$foundViewDefs = false;
if (file_exists('custom/modules/' . $this->module . '/metadata/detailviewdefs.php')) {
$metadataFile = 'custom/modules/' . $this->module . '/metadata/detailviewdefs.php';
$foundViewDefs = true;
} else {
if (file_exists('custom/modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('custom/modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['detailviewdefs'])) {
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
$foundViewDefs = true;
}
} elseif (file_exists('modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['detailviewdefs'])) {
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=" . $metadataFile);
if (!$foundViewDefs && file_exists('modules/' . $this->module . '/metadata/detailviewdefs.php')) {
$metadataFile = 'modules/' . $this->module . '/metadata/detailviewdefs.php';
}
$this->dv = new DetailView2();
$this->dv->ss = & $this->ss;
$this->dv->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
}
function display() {
if (empty($this->bean->id)) {
global $app_strings;
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$this->dv->process();
echo $this->dv->display();
}
}

View File

@@ -0,0 +1,420 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{literal}
<style type="text/css">
.dataLabel { padding: 2px; }
.dataField { padding: 2px; }
.tabEditViewDF { padding: 2px; }
td .dataLabel { padding: 2px; }
td .dataField { padding: 2px; }
td .tabEditViewDF { padding: 2px; }
.tabForm { border-top:none; }
</style>
{/literal}
{{include file='modules/EcmKpKw/view/EditView/header.tpl'}}
{sugar_include include=$includes}
<table width="100%" cellspacing="0" cellpadding="0" class='tabDetailView' id='tabFormPagination'>
{{if $panelCount == 0}}
{{* Render tag for VCR control if SHOW_VCR_CONTROL is true *}}
{{if $SHOW_VCR_CONTROL}}
{$PAGINATION}
{{/if}}
{{/if}}
</table>
{literal}
<script language="javascript">
var SelectedTab = "";
function SetTab(tab_name) {
var TabMenu = document.getElementById('groupTabs');
var tabs = TabMenu.getElementsByTagName('li');
for(i=0;i<tabs.length;i++) {
if((tab_name+'_menu') === tabs[i].id) {
tabs[i].className = 'active';
tabs[i].getElementsByTagName('a')[0].className = 'current';
} else {
tabs[i].className = '';
tabs[i].getElementsByTagName('a')[0].className = '';
}
}
var prev = document.getElementById(SelectedTab);
var curr = document.getElementById(tab_name);
prev.style.display = 'none';
curr.style.display = '';
SelectedTab = tab_name;
}
</script>
{/literal}
<ul class="tabList" style="margin-top:10px;" id="groupTabs">
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{if $panel[0][0].field.type == 'tab'}}
<li class="{{if $panel[0][0].field.active}}active{{/if}}" id="{{$label}}_menu">
<script language="javascript">
var set{{$label}} = function() {literal} { {/literal} SetTab('{{$label}}'); {literal} }; {/literal}
{{if $panel[0][0].field.active}}SelectedTab="{{$label}}";{{/if}}
</script>
<a class="{{if $panel[0][0].field.active}}current{{/if}}" href="javascript:set{{$label}}();">{sugar_translate label='LBL_{{$label}}_TAB' module='{{$module}}'}</a>
</li>
{{/if}}
{{/foreach}}
</ul>
{{* Loop through all top level panels first *}}
{{counter name="panelCount" start=-1 print=false assign="panelCount"}}
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{counter name="panelCount" print=false}}
{{* Print out the table data *}}
<div id="{{$label}}" style="display:{{if !$panel[0][0].field.active}}none{{/if}};">
{counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
{{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
{{* See function.sugar_include.php *}}
{{if !is_array($panel)}}
{sugar_include type='php' file='{{$panel}}'}
{{else}}
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="{$def.templateMeta.panelClass|default:tabForm}">
{{* Only show header if it is not default or an int value *}}
{{if !empty($label) && !is_int($label) && $label != 'DEFAULT'}}
<th class="dataLabel" align="left" colspan="8">
<h4>{sugar_translate label='LBL_{{$label}}' module='{{$module}}'}</h4>
</th>
{{/if}}
{{assign var='rowCount' value=0}}
{{foreach name=rowIteration from=$panel key=row item=rowData}}
<tr>
{{assign var='columnsInRow' value=$rowData|@count}}
{{assign var='columnsUsed' value=0}}
{{* Loop through each column and display *}}
{{counter name="colCount" start=0 print=false assign="colCount"}}
{{foreach name=colIteration from=$rowData key=col item=colData}}
{{counter name="colCount" print=false}}
{{math assign="tabIndex" equation="$panelCount * $maxColumns + $colCount"}}
{{if count($rowData) == $colCount}}
{{assign var="colCount" value=0}}
{{/if}}
{{if empty($def.templateMeta.labelsOnTop) && empty($colData.field.hideLabel)}}
<td valign="top" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' class="dataLabel" NOWRAP>
{{if isset($colData.field.customLabel)}}
{{$colData.field.customLabel}}
{{elseif isset($colData.field.label)}}
{capture name="label" assign="label}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($fields[$colData.field.name])}}
{capture name="label" assign="label}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{/if}}
{{* Show the required symbol if field is required, but override not set. Or show if override is set *}}
{{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
(isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
<span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
{{/if}}
</td>
{{/if}}
<td valign="top" width='{{if $colData.field.allCols}}100%{{else}}{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}{{/if}}%' class='tabEditViewDF' {{if $colData.field.allCols}}colspan='8'{{else}}{{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}{{/if}} NOWRAP>
{{if !empty($def.templateMeta.labelsOnTop)}}
{{if isset($colData.field.label)}}
{{if !empty($colData.field.label)}}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}:
{{/if}}
{{elseif isset($fields[$colData.field.name])}}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}:
{{/if}}
{{* Show the required symbol if field is required, but override not set. Or show if override is set *}}
{{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
(isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
<span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
{{/if}}
{{if !isset($colData.field.label) || !empty($colData.field.label)}}
<br>
{{/if}}
{{/if}}
{{if $fields[$colData.field.name] && !empty($colData.field.fields) }}
{{foreach from=$colData.field.fields item=subField}}
{{if $fields[$subField.name]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$subField.name] displayType='editView' displayParams=$subField.displayParams formName=$form_name}}&nbsp;
{{/if}}
{{/foreach}}
{{elseif !empty($colData.field.customCode)}}
{counter name="panelFieldCount"}
{{sugar_evalcolumn var=$colData.field.customCode colData=$colData tabindex=$colData.field.tabindex}}
{{elseif $fields[$colData.field.name]}}
{counter name="panelFieldCount"}
{{$colData.displayParams}}
{{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$colData.field.name] displayType='editView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type formName=$form_name}}
{{/if}}
{{/foreach}}
</tr>
{{/foreach}}
</table>
{{/if}}
</div>
{if $panelFieldCount == 0}
<script>document.getElementById("{{$label}}").style.display='none';</script>
{/if}
{{/foreach}}
{{include file='modules/EcmInvoiceOuts/view/EditView/footer.tpl'}}

View File

@@ -0,0 +1,62 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{{if empty($form.button_location) || $form.button_location == 'bottom'}}
<div style="padding-top: 2px">
{{if !empty($form) && !empty($form.buttons)}}
{{foreach from=$form.buttons key=val item=button}}
{{sugar_button module="$module" id="$button" view="$view"}}
{{/foreach}}
{{else}}
{{sugar_button module="$module" id="SAVE" view="$view"}}
{{sugar_button module="$module" id="CANCEL" view="$view"}}
{{/if}}
{{sugar_button module="$module" id="Audit" view="$view"}}
</div>
{{/if}}
</form>
{{if $externalJSFile}}
require_once("'".$externalJSFile."'");
{{/if}}
{$set_focus_block}
{{if isset($scriptBlocks)}}
<!-- Begin Meta-Data Javascript -->
{{$scriptBlocks}}
<!-- End Meta-Data Javascript -->
{{/if}}

View File

@@ -0,0 +1,80 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<form action="index.php" method="POST" name="{$form_name}" id="{$form_id}" {$enctype}>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-bottom: 2px;">
<input type="hidden" name="module" value="{$module}">
{if isset($smarty.request.isDuplicate) && $smarty.request.isDuplicate eq "true"}
<input type="hidden" name="record" value="">
{else}
<input type="hidden" name="record" value="{$fields.id.value}">
{/if}
<input type="hidden" name="isDuplicate" value="false">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{$smarty.request.return_module}">
<input type="hidden" name="return_action" value="{$smarty.request.return_action}">
<input type="hidden" name="return_id" value="{$smarty.request.return_id}">
<input type="hidden" name="contact_role">
{if !empty($smarty.request.return_module)}
<input type="hidden" name="relate_to" value="{$smarty.request.return_module}">
<input type="hidden" name="relate_id" value="{$smarty.request.return_id}">
{/if}
<input type="hidden" name="offset" value="{$offset}">
{{if isset($form.hidden)}}
{{foreach from=$form.hidden item=field}}
{{$field}}
{{/foreach}}
{{/if}}
{{if empty($form.button_location) || $form.button_location == 'top'}}
{{if !empty($form) && !empty($form.buttons)}}
{{foreach from=$form.buttons key=val item=button}}
{{sugar_button module="$module" id="$button" view="$view"}}
{{/foreach}}
{{else}}
{{sugar_button module="$module" id="SAVE" view="$view"}}
{{sugar_button module="$module" id="CANCEL" view="$view"}}
{{/if}}
{{if empty($form.hideAudit) || !$form.hideAudit}}
{{sugar_button module="$module" id="Audit" view="$view"}}
{{/if}}
{{/if}}
</td>
<td align='right'>{{$ADMIN_EDIT}}</td>
</tr>
</table>

View File

@@ -0,0 +1,112 @@
<?php
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
*
* "Powered by SugarCRM".
* ****************************************************************************** */
require_once('include/EditView/EditView2.php');
class ViewEditEcmKpkw extends SugarView {
var $ev;
var $type = 'edit';
var $useForSubpanel = false; //boolean variable to determine whether view can be used for subpanel creates
var $showTitle = true;
var $tplFile = 'include/EditView/EditView.tpl';
function ViewEditEcmKpkw() {
parent::SugarView();
}
function preDisplay() {
$metadataFile = null;
$foundViewDefs = false;
if (file_exists('custom/modules/' . $this->module . '/metadata/editviewdefs.php')) {
$metadataFile = 'custom/modules/' . $this->module . '/metadata/editviewdefs.php';
$foundViewDefs = true;
} else {
if (file_exists('custom/modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('custom/modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['editviewdefs'])) {
$metadataFile = $metafiles[$this->module]['editviewdefs'];
$foundViewDefs = true;
}
} elseif (file_exists('modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['editviewdefs'])) {
$metadataFile = $metafiles[$this->module]['editviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=" . $metadataFile);
if (!$foundViewDefs && file_exists('modules/' . $this->module . '/metadata/editviewdefs.php')) {
$metadataFile = 'modules/' . $this->module . '/metadata/editviewdefs.php';
}
$this->ev = new EditView();
$this->ev->ss = & $this->ss;
$this->ev->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
}
function display() {
$this->ev->process();
echo $this->ev->display($this->showTitle);
}
}

View File

@@ -0,0 +1,289 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{{include file="modules/EcmSerices/views/DetailView/headerx.tpl"}}
{sugar_include include=$includes}
{{* Render tag for VCR control if SHOW_VCR_CONTROL is true *}}
{{if $SHOW_VCR_CONTROL}}
<table width='100%' border='0' style="border-bottom:0px;" cellspacing='{$gridline}' cellpadding='0' class='tabDetailView'>
{$PAGINATION}
</table>
{{/if}}
{literal}
<script language="javascript">console.log(123);
var SelectedTab = "";
function SetTab(tab_name) {
var TabMenu = document.getElementById('groupTabsPanels');
var tabs = TabMenu.getElementsByTagName('li');
for(i=0;i<tabs.length;i++) {
if((tab_name+'_menu') === tabs[i].id) {
tabs[i].className = 'active';
tabs[i].getElementsByTagName('a')[0].className = 'current';
} else {
tabs[i].className = '';
tabs[i].getElementsByTagName('a')[0].className = '';
}
}
var prev = document.getElementById(SelectedTab);
var curr = document.getElementById(tab_name);
prev.style.display = 'none';
curr.style.display = '';
SelectedTab = tab_name;
}
</script>
{/literal}
<ul class="subpanelTablist" style="margin-top:10px;" id="groupTabsPanels">
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{if $panel[0][0].field.type == 'tab'}}
{{if $label=='EMAIL'}}
{{else}}
<li class="{{if $panel[0][0].field.active}}active{{/if}}" id="panel_{{$label}}_menu">
<script language="javascript">
var set{{$label}} = function() {literal} { {/literal} SetTab('panel_{{$label}}'); {literal} }; {/literal}
{{if $panel[0][0].field.active}}SelectedTab="panel_{{$label}}";{{/if}}
</script>
<a class="{{if $panel[0][0].field.active}}current{{else}}other{{/if}}" href="javascript:set{{$label}}();">{sugar_translate label='LBL_{{$label}}_TAB' module='{{$module}}'}</a>
</li>
{{/if}}
{{/if}}
{{/foreach}}
<li class="" id="panel_EMAIL_menu">
<a class="" href="javascript:{$EMAIL_LINK}">{sugar_translate label='LBL_EMAIL_TAB' module='EcmSerices'}</a>
</li>
</ul>
{{* Loop through all top level panels first *}}
{{counter name="panelCount" print=false start=0 assign="panelCount"}}
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{assign var='panel_id' value=$panelCount}}
<div {{if $panel[0][0].field.active == false}}style="display:none"{{/if}} id='panel_{{$label}}'>
{counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
{{* Print out the panel title if one exists*}}
{{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
{{* See function.sugar_include.php *}}
{{if !is_array($panel)}}
{sugar_include type='php' file='{{$panel}}'}
{{else}}
<!--
{{if !empty($label) && !is_int($label) && $label != 'DEFAULT'}}
<h4 class="dataLabel">{sugar_translate label='{{$label}}' module='{{$module}}'}</h4><br>
{{/if}}
-->
{{* Print out the table data *}}
<table width='100%' border='0' style="border-top:0px" cellspacing='{$gridline}' cellpadding='0' class='tabDetailView'>
{{if $panelCount == 0}}
{{counter name="panelCount" print=false}}
{{/if}}
{{foreach name=rowIteration from=$panel key=row item=rowData}}
<tr>
{{assign var='columnsInRow' value=$rowData|@count}}
{{assign var='columnsUsed' value=0}}
{{foreach name=colIteration from=$rowData key=col item=colData}}
{{if $colData.field.allCols == false}}
<td width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' class='tabDetailViewDL' NOWRAP>
{{if isset($colData.field.customLabel)}}
{{$colData.field.customLabel}}
{{elseif isset($colData.field.label) && strpos($colData.field.label, '$')}}
{capture name="label" assign="label"}
{{$colData.field.label}}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($colData.field.label)}}
{capture name="label" assign="label"}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($fields[$colData.field.name])}}
{capture name="label" assign="label"}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{else}}
&nbsp;
{{/if}}
</td>
{{/if}}
<td width='{{if $colData.field.allCols == true}}100{{else}}{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}{{/if}}%' class='tabDetailViewDF' {{if $colData.field.allCols == true}}colspan='4'{{else}}{{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}{{/if}}>
{{if $colData.field.customCode || $colData.field.assign}}
{counter name="panelFieldCount"}
{{sugar_evalcolumn var=$colData.field colData=$colData}}
{{elseif $fields[$colData.field.name] && !empty($colData.field.fields) }}
{{foreach from=$colData.field.fields item=subField}}
{{if $fields[$subField]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' tabindex=$tabIndex vardef=$fields[$subField] displayType='detailView'}}&nbsp;
{{else}}
{counter name="panelFieldCount"}
{{$subField}}
{{/if}}
{{/foreach}}
{{elseif $fields[$colData.field.name]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' vardef=$fields[$colData.field.name] displayType='detailView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type}}
{{/if}}
&nbsp;
</td>
{{/foreach}}
</tr>
{{/foreach}}
</table>
{{/if}}
</div>
{if $panelFieldCount == 0}
<script>document.getElementById("panel_{{$panel_id}}").style.display='none';</script>
{/if}
{{/foreach}}
{{include file="modules/EcmSerices/views/DetailView/footer.tpl"}}

View File

@@ -0,0 +1,37 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
</form>

View File

@@ -0,0 +1,105 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{{* Add the preForm code if it is defined (used for vcards) *}}
{{if $preForm}}
{{$preForm}}
{{/if}}
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
<td style="padding-bottom: 2px;" align="left" NOWRAP>
<form action="index.php" method="post" name="DetailView" id="form">
<input type="hidden" name="module" value="{$module}">
<input type="hidden" name="record" value="{$fields.id.value}">
<input type="hidden" name="return_action">
<input type="hidden" name="return_module">
<input type="hidden" name="return_id">
<input type="hidden" name="isDuplicate" value="false">
<input type="hidden" name="offset" value="{$offset}">
<input type="hidden" name="action" value="EditView">
{{if isset($form.hidden)}}
{{foreach from=$form.hidden item=field}}
{{$field}}
{{/foreach}}
{{/if}}
{{if !isset($form.buttons)}}
<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='DetailView'; this.form.return_id.value='{$id}'; this.form.action.value='EditView'" type="submit" name="Edit" id='edit_button' value=" {$APP.LBL_EDIT_BUTTON_LABEL} ">
<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='index'; this.form.isDuplicate.value=true; this.form.action.value='EditView'" type="submit" name="Duplicate" value=" {$APP.LBL_DUPLICATE_BUTTON_LABEL} " id='duplicate_button'>
<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value='{$module}'; this.form.return_action.value='ListView'; this.form.action.value='Delete'; return confirm('{$APP.NTC_DELETE_CONFIRMATION}')" type="submit" name="Delete" value=" {$APP.LBL_DELETE_BUTTON_LABEL} " >
{{else}}
{{counter assign="num_buttons" start=0 print=false}}
{{foreach from=$form.buttons key=val item=button}}
{{if !is_array($button) && in_array($button, $built_in_buttons)}}
{{counter print=false}}
{{sugar_button module="$module" id="$button" view="EditView"}}
{{/if}}
{{/foreach}}
{{if isset($closeFormBeforeCustomButtons)}}
</form>
</td>
{{/if}}
{{if count($form.buttons) > $num_buttons}}
{{foreach from=$form.buttons key=val item=button}}
{{if is_array($button) && $button.customCode}}
<td style="padding-bottom: 2px;" align="left" NOWRAP>
{{sugar_button module="$module" id="$button" view="EditView"}}
</td>
{{/if}}
{{/foreach}}
{{/if}}
{{/if}}
{{if !isset($closeFormBeforeCustomButtons)}}
</form>
</td>
{{/if}}
{{if empty($form.hideAudit) || !$form.hideAudit}}
<td style="padding-bottom: 2px;" align="left" NOWRAP>
{{sugar_button module="$module" id="Audit" view="EditView"}}
</td>
{{/if}}
<td align="right" width="100%">{$ADMIN_EDIT}</td>
{{* Add $form.links if they are defined *}}
{{if !empty($form) && isset($form.links)}}
<td align="right" width="10%">&nbsp;</td>
<td align="right" width="100%" NOWRAP>
{{foreach from=$form.links item=link}}
{{$link}}&nbsp;
{{/foreach}}
</td>
{{/if}}
</tr>
</table>

View File

@@ -0,0 +1,92 @@
<?php
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* ****************************************************************************** */
require_once('include/DetailView/DetailView2.php');
class ViewDetailMy extends SugarView {
var $type = 'detail';
var $dv;
var $tplFile = 'include/DetailView/DetailView.tpl';
function ViewDetailMy() {
$this->options['show_subpanels'] = true;
parent::SugarView();
}
function preDisplay() {
$metadataFile = null;
$foundViewDefs = false;
if (file_exists('custom/modules/' . $this->module . '/metadata/detailviewdefs.php')) {
$metadataFile = 'custom/modules/' . $this->module . '/metadata/detailviewdefs.php';
$foundViewDefs = true;
} else {
if (file_exists('custom/modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('custom/modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['detailviewdefs'])) {
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
$foundViewDefs = true;
}
} elseif (file_exists('modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['detailviewdefs'])) {
$metadataFile = $metafiles[$this->module]['detailviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=" . $metadataFile);
if (!$foundViewDefs && file_exists('modules/' . $this->module . '/metadata/detailviewdefs.php')) {
$metadataFile = 'modules/' . $this->module . '/metadata/detailviewdefs.php';
}
$this->dv = new DetailView2();
$this->dv->ss = & $this->ss;
$this->dv->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
}
function display() {
if (empty($this->bean->id)) {
global $app_strings;
sugar_die($app_strings['ERROR_NO_RECORD']);
}
$this->dv->process();
echo $this->dv->display();
}
}

View File

@@ -0,0 +1,341 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{literal}
<style type="text/css">
.dataLabel {
padding: 2px;
}
.dataField {
padding: 2px;
}
.tabEditViewDF {
padding: 2px;
}
td .dataLabel {
padding: 2px;
}
td .dataField {
padding: 2px;
}
td .tabEditViewDF {
padding: 2px;
}
.tabForm {
border-top:none;
}
</style>
{/literal}
{{include file='modules/EcmEcmKpkw/views/EditView/header.tpl'}}
{sugar_include include=$includes}
<table width="100%" cellspacing="0" cellpadding="0" class='tabDetailView' id='tabFormPagination'>
{{if $panelCount == 0}}
{{* Render tag for VCR control if SHOW_VCR_CONTROL is true *}}
{{if $SHOW_VCR_CONTROL}}
{$PAGINATION}
{{/if}}
{{/if}}
</table>
{literal}
<script language="javascript">
var SelectedTab = "";
var TabsMainBlock = false;
function SetTab(tab_name) {
if (TabsMainBlock) {
return;
}
var TabMenu = document.getElementById('groupTabs');
var tabs = TabMenu.getElementsByTagName('li');
for (i = 0; i < tabs.length; i++) {
if ((tab_name + '_menu') === tabs[i].id) {
tabs[i].className = 'active';
tabs[i].getElementsByTagName('a')[0].className = 'current';
} else {
tabs[i].className = '';
tabs[i].getElementsByTagName('a')[0].className = '';
}
}
var prev = document.getElementById(SelectedTab);
var curr = document.getElementById(tab_name);
prev.style.display = 'none';
curr.style.display = '';
SelectedTab = tab_name;
}
</script>
{/literal}
<ul class="tabList" style="margin-top:10px;" id="groupTabs">
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{if $panel[0][0].field.type == 'tab'}}
<li class="{{if $panel[0][0].field.active}}active{{/if}}" id="{{$label}}_menu">
<script language="javascript">
var set{{$label}} = function() {literal} {{/literal}
SetTab('{{$label}}');
{literal} };{/literal}
{{if $panel[0][0].field.active}}SelectedTab = "{{$label}}";{{/if}}
</script>
<a class="{{if $panel[0][0].field.active}}current{{/if}}" href="javascript:set{{$label}}();">{sugar_translate label='LBL_{{$label}}_TAB' module='{{$module}}'}</a>
</li>
{{/if}}
{{/foreach}}
</ul>
{{* Loop through all top level panels first *}}
{{counter name="panelCount" start=-1 print=false assign="panelCount"}}
{{foreach name=section from=$sectionPanels key=label item=panel}}
{{counter name="panelCount" print=false}}
{{* Print out the table data *}}
<div id="{{$label}}" style="display:{{if !$panel[0][0].field.active}}none{{/if}};">
{counter name="panelFieldCount" start=0 print=false assign="panelFieldCount"}
{{* Check to see if the panel variable is an array, if not, we'll attempt an include with type param php *}}
{{* See function.sugar_include.php *}}
{{if !is_array($panel)}}
{sugar_include type='php' file='{{$panel}}'}
{{else}}
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="{$def.templateMeta.panelClass|default:tabForm}">
{{* Only show header if it is not default or an int value *}}
{{if !empty($label) && !is_int($label) && $label != 'DEFAULT'}}
<th class="dataLabel" align="left" colspan="8">
<h4>{sugar_translate label='LBL_{{$label}}' module='{{$module}}'}</h4>
</th>
{{/if}}
{{assign var='rowCount' value=0}}
{{foreach name=rowIteration from=$panel key=row item=rowData}}
<tr>
{{assign var='columnsInRow' value=$rowData|@count}}
{{assign var='columnsUsed' value=0}}
{{* Loop through each column and display *}}
{{counter name="colCount" start=0 print=false assign="colCount"}}
{{foreach name=colIteration from=$rowData key=col item=colData}}
{{counter name="colCount" print=false}}
{{math assign="tabIndex" equation="$panelCount * $maxColumns + $colCount"}}
{{if count($rowData) == $colCount}}
{{assign var="colCount" value=0}}
{{/if}}
{{if empty($def.templateMeta.labelsOnTop) && empty($colData.field.hideLabel)}}
<td valign="top" width='{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].label}}%' class="dataLabel" NOWRAP>
{{if isset($colData.field.customLabel)}}
{{$colData.field.customLabel}}
{{elseif isset($colData.field.label)}}
{capture name="label" assign="label}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{elseif isset($fields[$colData.field.name])}}
{capture name="label" assign="label}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}
{/capture}
{$label|strip_semicolon}:
{{/if}}
{{* Show the required symbol if field is required, but override not set. Or show if override is set *}}
{{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
(isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
<span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
{{/if}}
</td>
{{/if}}
<td valign="top" width='{{if $colData.field.allCols}}100%{{else}}{{$def.templateMeta.widths[$smarty.foreach.colIteration.index].field}}{{/if}}%' class='tabEditViewDF' {{if $colData.field.allCols}}colspan='8'{{else}}{{if $colData.colspan}}colspan='{{$colData.colspan}}'{{/if}}{{/if}} NOWRAP>
{{if !empty($def.templateMeta.labelsOnTop)}}
{{if isset($colData.field.label)}}
{{if !empty($colData.field.label)}}
{sugar_translate label='{{$colData.field.label}}' module='{{$module}}'}:
{{/if}}
{{elseif isset($fields[$colData.field.name])}}
{sugar_translate label='{{$fields[$colData.field.name].vname}}' module='{{$module}}'}:
{{/if}}
{{* Show the required symbol if field is required, but override not set. Or show if override is set *}}
{{if ($fields[$colData.field.name].required && (!isset($colData.field.displayParams.required) || $colData.field.displayParams.required)) ||
(isset($colData.field.displayParams.required) && $colData.field.displayParams.required)}}
<span class="required">{{$APP.LBL_REQUIRED_SYMBOL}}</span>
{{/if}}
{{if !isset($colData.field.label) || !empty($colData.field.label)}}
<br>
{{/if}}
{{/if}}
{{if $fields[$colData.field.name] && !empty($colData.field.fields) }}
{{foreach from=$colData.field.fields item=subField}}
{{if $fields[$subField.name]}}
{counter name="panelFieldCount"}
{{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$subField.name] displayType='editView' displayParams=$subField.displayParams formName=$form_name}}&nbsp;
{{/if}}
{{/foreach}}
{{elseif !empty($colData.field.customCode)}}
{counter name="panelFieldCount"}
{{sugar_evalcolumn var=$colData.field.customCode colData=$colData tabindex=$colData.field.tabindex}}
{{elseif $fields[$colData.field.name]}}
{counter name="panelFieldCount"}
{{$colData.displayParams}}
{{sugar_field parentFieldArray='fields' tabindex=$colData.field.tabindex vardef=$fields[$colData.field.name] displayType='editView' displayParams=$colData.field.displayParams typeOverride=$colData.field.type formName=$form_name}}
{{/if}}
{{/foreach}}
</tr>
{{/foreach}}
</table>
{{/if}}
</div>
{if $panelFieldCount == 0}
<script>document.getElementById("{{$label}}").style.display='none';</script>
{/if}
{{/foreach}}
{{include file='modules/EcmEcmKpkw/views/EditView/footer.tpl'}}

View File

@@ -0,0 +1,62 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
{{if empty($form.button_location) || $form.button_location == 'bottom'}}
<div style="padding-top: 2px">
{{if !empty($form) && !empty($form.buttons)}}
{{foreach from=$form.buttons key=val item=button}}
{{sugar_button module="$module" id="$button" view="$view"}}
{{/foreach}}
{{else}}
{{sugar_button module="$module" id="SAVE" view="$view"}}
{{sugar_button module="$module" id="CANCEL" view="$view"}}
{{/if}}
{{sugar_button module="$module" id="Audit" view="$view"}}
</div>
{{/if}}
</form>
{{if $externalJSFile}}
require_once("'".$externalJSFile."'");
{{/if}}
{$set_focus_block}
{{if isset($scriptBlocks)}}
<!-- Begin Meta-Data Javascript -->
{{$scriptBlocks}}
<!-- End Meta-Data Javascript -->
{{/if}}

View File

@@ -0,0 +1,80 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<form action="index.php" method="POST" name="{$form_name}" id="{$form_id}" {$enctype}>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-bottom: 2px;">
<input type="hidden" name="module" value="{$module}">
{if isset($smarty.request.isDuplicate) && $smarty.request.isDuplicate eq "true"}
<input type="hidden" name="record" value="">
{else}
<input type="hidden" name="record" value="{$fields.id.value}">
{/if}
<input type="hidden" name="isDuplicate" value="false">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{$smarty.request.return_module}">
<input type="hidden" name="return_action" value="{$smarty.request.return_action}">
<input type="hidden" name="return_id" value="{$smarty.request.return_id}">
<input type="hidden" name="contact_role">
{if !empty($smarty.request.return_module)}
<input type="hidden" name="relate_to" value="{$smarty.request.return_module}">
<input type="hidden" name="relate_id" value="{$smarty.request.return_id}">
{/if}
<input type="hidden" name="offset" value="{$offset}">
{{if isset($form.hidden)}}
{{foreach from=$form.hidden item=field}}
{{$field}}
{{/foreach}}
{{/if}}
{{if empty($form.button_location) || $form.button_location == 'top'}}
{{if !empty($form) && !empty($form.buttons)}}
{{foreach from=$form.buttons key=val item=button}}
{{sugar_button module="$module" id="$button" view="$view"}}
{{/foreach}}
{{else}}
{{sugar_button module="$module" id="SAVE" view="$view"}}
{{sugar_button module="$module" id="CANCEL" view="$view"}}
{{/if}}
{{if empty($form.hideAudit) || !$form.hideAudit}}
{{sugar_button module="$module" id="Audit" view="$view"}}
{{/if}}
{{/if}}
</td>
<td align='right'>{{$ADMIN_EDIT}}</td>
</tr>
</table>

View File

@@ -0,0 +1,112 @@
<?php
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
*
* "Powered by SugarCRM".
* ****************************************************************************** */
require_once('include/EditView/EditView2.php');
class ViewEditEcmKpkw extends SugarView {
var $ev;
var $type = 'edit';
var $useForSubpanel = false; //boolean variable to determine whether view can be used for subpanel creates
var $showTitle = true;
var $tplFile = 'include/EditView/EditView.tpl';
function ViewEditEcmEcmKpkw() {
parent::SugarView();
}
function preDisplay() {
$metadataFile = null;
$foundViewDefs = false;
if (file_exists('custom/modules/' . $this->module . '/metadata/editviewdefs.php')) {
$metadataFile = 'custom/modules/' . $this->module . '/metadata/editviewdefs.php';
$foundViewDefs = true;
} else {
if (file_exists('custom/modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('custom/modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['editviewdefs'])) {
$metadataFile = $metafiles[$this->module]['editviewdefs'];
$foundViewDefs = true;
}
} elseif (file_exists('modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['editviewdefs'])) {
$metadataFile = $metafiles[$this->module]['editviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=" . $metadataFile);
if (!$foundViewDefs && file_exists('modules/' . $this->module . '/metadata/editviewdefs.php')) {
$metadataFile = 'modules/' . $this->module . '/metadata/editviewdefs.php';
}
$this->ev = new EditView();
$this->ev->ss = & $this->ss;
$this->ev->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
}
function display() {
$this->ev->process();
echo $this->ev->display($this->showTitle);
}
}

View File

@@ -0,0 +1,62 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: This file is used to override the default Meta-data EditView behavior
* to provide customization specific to the Calls module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/views/view.detail.php');
class EcmKpkwViewDetail extends ViewDetail
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
$params = array();
$params[] = $this->_getModuleTitleListParam();
$params[] = $this->bean->ecmkpkw_name;
return $params;
}
}

View File

@@ -0,0 +1,178 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: This file is used to override the default Meta-data EditView behavior
* to provide customization specific to the Calls module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/views/view.edit.php');
class EcmKpkwViewEdit extends ViewEdit
{
/**
* @see SugarView::display()
*/
public function display()
{
global $app_list_strings, $mod_strings;
/*
$this->bean->category_name = $app_list_strings['ecmkpkw_category_dom'][$this->bean->category_id];
$this->bean->subcategory_name = $app_list_strings['ecmkpkw_subcategory_dom'][$this->bean->subcategory_id];
if(isset($this->bean->status_id)) {
$this->bean->status = $app_list_strings['ecmkpkw_status_dom'][$this->bean->status_id];
}
$this->bean->related_doc_name = EcmKpkw::get_ecmkpkw_name($this->bean->related_doc_id);
$this->bean->related_doc_rev_number = EcmKpkwRevision::get_ecmkpkw_revision_name($this->bean->related_doc_rev_id);
$this->bean->save_file = basename($this->bean->file_url_noimage);
*/
$load_signed=false;
if ((isset($_REQUEST['load_signed_id']) && !empty($_REQUEST['load_signed_id']))) {
$load_signed=true;
if (isset($_REQUEST['record'])) {
$this->bean->related_doc_id=$_REQUEST['record'];
}
if (isset($_REQUEST['selected_revision_id'])) {
$this->bean->related_doc_rev_id=$_REQUEST['selected_revision_id'];
}
$this->bean->id=null;
$this->bean->ecmkpkw_name=null;
$this->bean->filename=null;
$this->bean->is_template=0;
} //if
if (!empty($this->bean->id)) {
$this->ss->assign("FILE_OR_HIDDEN", "hidden");
if (!$this->ev->isDuplicate) {
$this->ss->assign("DISABLED", "disabled");
}
} else {
global $timedate;
$format = $timedate->get_cal_date_format();
$format = str_replace('%', '', $format);
$this->bean->active_date = date($format);
$this->bean->revision = 1;
$this->ss->assign("FILE_OR_HIDDEN", "file");
}
$popup_request_data = array(
'call_back_function' => 'ecmkpkw_set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'related_doc_id',
'ecmkpkw_name' => 'related_document_name',
),
);
$json = getJSONobj();
$this->ss->assign('encoded_ecmkpkw_popup_request_data', $json->encode($popup_request_data));
//get related ecmkpkw name.
if (!empty($this->bean->related_doc_id)) {
$this->ss->assign("RELATED_DOCUMENT_NAME",EcmKpkw::get_ecmkpkw_name($this->bean->related_doc_id));
$this->ss->assign("RELATED_DOCUMENT_ID",$this->bean->related_doc_id);
if (!empty($this->bean->related_doc_rev_id)) {
$this->ss->assign("RELATED_DOCUMENT_REVISION_OPTIONS", get_select_options_with_id(EcmKpkwRevision::get_ecmkpkw_revisions($this->bean->related_doc_id), $this->bean->related_doc_rev_id));
} else {
$this->ss->assign("RELATED_DOCUMENT_REVISION_OPTIONS", get_select_options_with_id(EcmKpkwRevision::get_ecmkpkw_revisions($this->bean->related_doc_id), ''));
}
} else {
$this->ss->assign("RELATED_DOCUMENT_REVISION_DISABLED", "disabled");
}
//set parent information in the form.
if (isset($_REQUEST['parent_id'])) {
$this->ss->assign("PARENT_ID",$_REQUEST['parent_id']);
} //if
if (isset($_REQUEST['parent_name'])) {
$this->ss->assign("PARENT_NAME", $_REQUEST['parent_name']);
if (!empty($_REQUEST['parent_type'])) {
switch (strtolower($_REQUEST['parent_type'])) {
case "contracts" :
$this->ss->assign("LBL_PARENT_NAME",$mod_strings['LBL_CONTRACT_NAME']);
break;
//todo remove leads case.
case "leads" :
$this->ss->assign("LBL_PARENT_NAME",$mod_strings['LBL_CONTRACT_NAME']);
break;
} //switch
} //if
} //if
if (isset($_REQUEST['parent_type'])) {
$this->ss->assign("PARENT_TYPE",$_REQUEST['parent_type']);
}
if ($load_signed) {
$this->ss->assign("RELATED_DOCUMENT_REVISION_DISABLED", "disabled");
$this->ss->assign("RELATED_DOCUMENT_BUTTON_AVAILABILITY", "hidden");
$this->ss->assign("LOAD_SIGNED_ID",$_REQUEST['load_signed_id']);
} else {
$this->ss->assign("RELATED_DOCUMENT_BUTTON_AVAILABILITY", "button");
} //if-else
parent::display();
}
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
$params = array();
$params[] = $this->_getModuleTitleListParam();
if(!empty($this->bean->id)){
$params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->ecmkpkw_name."</a>";
$params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
}else{
$params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
}
return $params;
}
}

View File

@@ -0,0 +1,157 @@
<?php
ini_set('display_errors',1);
global $db;
require_once('include/utils.php');
$stop = new DateTime('NOW');
$start = clone $stop;
$start->sub(new DateInterval('P3Y'));
$currentTo = @$_GET['date_to'] ? : $stop->format('t.m.Y');
$currentFrom = @$_GET['date_from'] ? : $start->format('01.m.Y');
include_once ("include/MPDF57/mpdf.php");
$p = new mPDF ( '', 'A4', null, 'helvetica', 8, 8, 30, 30, 5, 5 );
$mpdf->mirrorMargins = 1;
$i=0;
if(isset($_GET['process'])){
echo 'AAAA';
$additionalWhereConditions = array(
'\'' . $start->format('Y-m-01') . '\'',
'\'' . $stop->format('Y-m-t') . '\'',
);
if($from = @$_GET['date_from']) {
$fromDate = new DateTime($from);
$additionalWhereConditions[0] = '\'' . $fromDate->format('Y-m-d') . '\'';
}
if($to = @$_GET['date_to']) {
$toDate = new DateTime($to);
$additionalWhereConditions[1] = '\'' . $toDate->format('Y-m-d') . '\'';
}
if($_GET['kasjer']!=''){
$kasjer=" and `created_by`='".$_GET['kasjer']."'";
}
$additionalWhere = '`date_entered` BETWEEN ' . implode(' AND ', $additionalWhereConditions)." and `ecmcash_id`='".$_GET['ecmcash_id']."'".$kasjer;
$query = '
SELECT
`description`,`ecmkpkw_name`,`amount`,`document_no`,
`parent_address_street`,`parent_address_city`,`parent_address_postalcode`,
`parent_address_country`,`parent_contact_name`,`parent_contact_title`,
`date_entered`,`dir`,`parent_name`
FROM `ecmkpkw`
WHERE
' . (additionalWhere ? ($additionalWhere) : '') . '
ORDER BY
`date_entered` ASC;
';
$result = $db->query($query);
$query_bo = "SELECT SUM(IF(dir = 0, amount, -amount)) AS `sum` FROM `ecmkpkw` WHERE `date_entered` < ".$additionalWhereConditions[0]." and `ecmcash_id`='".$_GET['ecmcash_id']."'".$kasjer;
//echo $query_bo; exit;
$result_bo = $db->query($query_bo);
if($row_bo = $db->fetchByAssoc($db->query($query_bo)))
{
$bo = $row_bo["sum"];
//ECHO $row["sum"];
}
$tabelka='<br><br><table style="padding-top: 0px; margin-top:0px; border: 0.1 solid black; border-collapse: collapse;width:100%;font-size: 10pt;">
<thead>
<tr style="border: 0.1 solid black;">
<th style="border: 0.1 solid black; width:3%; height:50px;background-color: #E6E6FA;">Lp</th>
<th style="border: 0.1 solid black; width:18%;background-color: #E6E6FA;">Nr dokumentu<br>Data wystawienia</th>
<th style="border: 0.1 solid black; width:24%;background-color: #E6E6FA;">Tytuł</th>
<th style="border: 0.1 solid black; width:24%;background-color: #E6E6FA;">Kontrahent</th>
<th style="border: 0.1 solid black; width:15%;background-color: #E6E6FA;">Przychód</th>
<th style="border: 0.1 solid black; width:15%;background-color: #E6E6FA;">Rozchód </th>
</tr>
</thead>';
$suma1=0;
$suma2=0;
while($row = $db->fetchByAssoc($result)){
if($row['dir']==0) { $liczba1=format_number($row['amount']); $suma1 += $row['amount']; } else $liczba1="&nbsp;";
if($row['dir']==1) { $liczba2=format_number($row['amount']); $suma2 += $row['amount']; } else $liczba2="&nbsp;";
$i++;
$tabelka.='<tr style="border: 0.1 solid black;">
<td style="border: 0.1 solid black; width:3%;font-size: 8pt;text-align:center;">'.$i.'</td>
<td style="border: 0.1 solid black; width:18%;font-size: 8pt;text-align:center;"><table><tr style="width:100%;font-size: 8pt;"><td style="width:100%;font-size: 8pt;">'.$row['document_no'].'</td></tr><tr style="width:100%;"><td style="width:100%;font-size: 8pt;">'.date("d.m.Y", strtotime($row['date_entered'])).'</td></tr></table></td>
<td style="border: 0.1 solid black; width:24%;font-size: 8pt;text-align:left;">&nbsp;'.$row['ecmkpkw_name'].'</td>
<td style="border: 0.1 solid black; width:24%;font-size: 8pt;text-align:left;">&nbsp;'.$row['parent_name'].'</td>
<td style="border: 0.1 solid black; width:15%;font-size: 8pt;text-align:right;">'.$liczba1.'</td>
<td style="border: 0.1 solid black; width:15%;font-size: 8pt;text-align:right;">'.$liczba2.'</td>
</tr>';
}
$tabelka.='</table>';
}
$tabelka.='<br>
<table style="padding-top: 0px; margin-top:0px; border: 0 solid black; border-collapse: collapse;width:100%;font-size: 10pt;">
<tr>
<td style="border: 0 solid black; width:3%;font-size: 8pt;text-align:center;"></td>
<td style="border: 0 solid black; width:18%;font-size: 8pt;text-align:center;"></td>
<td style="border: 0 solid black; width:24%;font-size: 8pt;text-align:left;"></td>
<td style="border: 0.1 solid black; width:24%;font-size: 8pt;text-align:left;">'.translate('LBL_VALUE', 'EcmKpkw').':</td>
<td style="border: 0.1 solid black; width:15%;font-size: 8pt;text-align:right;">'.format_number(($suma1)).'</td>
<td style="border: 0.1 solid black; width:15%;font-size: 8pt;text-align:right;">'.format_number(($suma2)).'</td>
</tr>
<tr>
<td style="border: 0 solid black; width:3%;font-size: 8pt;text-align:center;"></td>
<td style="border: 0 solid black; width:18%;font-size: 8pt;text-align:center;"></td>
<td style="border: 0 solid black; width:24%;font-size: 8pt;text-align:left;"></td>
<td style="border: 0.1 solid black; width:24%;font-size: 8pt;text-align:left;">'.translate('LBL_VALUE_BEFORE', 'EcmKpkw').':</td>
<td style="border: 0.1 solid black; width:15%;font-size: 8pt;text-align:right;">'.format_number(($bo)).'</td>
<td style="border: 0.1 solid black; width:15%;font-size: 8pt;text-align:right;"></td>
</tr>
<tr>
<td style="border: 0 solid black; width:3%;font-size: 8pt;text-align:center;"></td>
<td style="border: 0 solid black; width:18%;font-size: 8pt;text-align:center;"></td>
<td style="border: 0 solid black; width:24%;font-size: 8pt;text-align:left;"></td>
<td style="border: 0.1 solid black; width:24%;font-size: 8pt;text-align:left;">'.translate('LBL_VALUE_TOTAL', 'EcmKpkw').':</td>
<td style="border: 0.1 solid black; width:15%;font-size: 8pt;text-align:right;">'.format_number((($bo+$suma1)-$suma2)).'</td>
<td style="border: 0.1 solid black; width:15%;font-size: 8pt;text-align:right;"></td>
</tr>
</table>';
$header='<h2 style="text-align:center;">'.translate('LBL_RAPORT_TITLE2', 'EcmKpkw').'</h2>
<table style="width: 100%;">
<tr>
<td style="width: 70%;"></td>
<td style="width: 10%;font-size: 8pt;"><b>'.translate('LBL_TIME2', 'EcmKpkw').':</b></td>
<td style="width: 20%;font-size: 8pt;">'.$fromDate->format('d.m.Y')." - ".$toDate->format('d.m.Y').'</td>
</tr>
<tr>
<td style="width: 70%;"></td>
<td style="width: 10%;font-size: 8pt;"><b>'.translate('LBL_CASH2', 'EcmKpkw').':</b></td>
<td style="width: 20%;font-size: 8pt;">'.$_GET['cash_name'].'</td>
</tr>
<tr>
<td style="width: 70%;"></td>
<td style="width: 10%;font-size: 8pt;"><b>'.translate('LBL_CURRENCY_PDF2', 'EcmKpkw').':</b></td>
<td style="width: 20%;font-size: 8pt;">'.$_GET['id_currency'].'</td>
</tr>';
if($_GET['kasjer']!=''){
$us=new User;
$us->retrieve($_GET['kasjer']);
$header.=' <tr>
<td style="width: 70%;"></td>
<td style="width: 10%;font-size: 8pt;"><b>Kasjer:</b></td>
<td style="width: 20%;font-size: 8pt;">'. $us->full_name.'</td>
</tr>';
}
$header.='</table>';
$p->SetHTMLHeader ( $header );
$p->WriteHTML ($tabelka );
$p->Output ();
echo $header;