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,68 @@
<?php
$actions_access => array (
'user_manager_role' => array (
's10' => true,
's20' => false,
's30' => true,
's40' => true,
's50' => array('ifnot'=>array('s10','s20','s40')),
's60' => array('ifnot'=>array('s10','s20','s40')),
's70' => array('ifnot'=>array('s10','s20','s40')),
),
'user_representative_extra_role' => array (
's10' => array('if'=>array('s40')),
's20' => false,
's30' => true,
's40' => false,
's50' => array('ifnot'=>array('s10','s20','s40')),
's60' => array('ifnot'=>array('s10','s20','s40')),
's70' => array('ifnot'=>array('s10','s20','s40')),
),
'user_representative_role' => array (
'list' => true,
'index' => true,
case 'listview':
return ACLController::checkAccess($this->module_dir,'list', true);
case 'edit':
return (ACLController::checkAccess($this->module_dir,'edit', $is_owner) && ($this->status == "s10" || $this->status == "s40"));
case 'save':
case 'popupeditview':
case 'editview':
return (ACLController::checkAccess($this->module_dir,'edit', $is_owner));
case 'view':
case 'detail':
case 'detailview':
return ACLController::checkAccess($this->module_dir,'view', $is_owner);
case 'delete':
return (ACLController::checkAccess($this->module_dir,'delete', $is_owner) && $this->status == "s10");
case 'export':
return ACLController::checkAccess($this->module_dir,'export', $is_owner);
case 'import':
return ACLController::checkAccess($this->module_dir,'import', true);
case 'quote_to_service':
case 'quote_to_invoice':
return ($this->status != "s10" && $this->status != "s20" && $this->status != "s40" && $this->status != "s60");
case 'send_to_confirm':
return ($this->status == "s10");
case 'send_email':
return ($this->status != "s10" && $this->status != "s20" && $this->status != "s40");
case 'can_commit':
return false;
case 'confirming':
return false;
case 'auto_commiting':
return false;
),
'admin' => array(
's10' => true,
's20' => false,
's30' => true,
's40' => true,
's50' => array('ifnot'=>array('s10','s20','s40')),
's60' => array('ifnot'=>array('s10','s20','s40')),
's70' => array('ifnot'=>array('s10','s20','s40')),
)
);
?>

View File

@@ -0,0 +1,31 @@
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();
}
}

View File

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

View File

@@ -0,0 +1,439 @@
var AjaxSearch1Items;
function AjaxSearch1(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 = 1500; //opoznienie wyszukiwania
this.divList; //pole w ktorym wyswietlana bedzie lista znalezionnych elementow
this.ajaxSearchItem; //unikalny identyfikator;
this.module = 'EcmServices';//modul
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();", this.searchDelay);
}
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);
}
var postData =
'module=' + this.module +
'&action=AjaxSearchQuery&to_pdf=1&as_inputSearch=' + this.inputSearch.value +
'&stock_id=' + document.forms.EditView.stock_id.value +
'&type=article';
YAHOO.util.Connect.asyncRequest(
'POST',
'index.php'
,{
success: this.Display,
failure: this.Fail
},
postData
);
}
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(AjaxSearch1Items) {
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,439 @@
var AjaxSearch2Items;
function AjaxSearch2(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 = 1500; //opoznienie wyszukiwania
this.divList; //pole w ktorym wyswietlana bedzie lista znalezionnych elementow
this.ajaxSearchItem; //unikalny identyfikator;
this.module = 'EcmServices';//modul
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();", this.searchDelay);
}
this.inputSearchEnterPressed = function(other) {
if(this.positionSelected) {
var row;
if(N2.selectedRow) {
N2.selectedRow.setData(this.positionSelected.positionData);
row = N2.selectedRow;
}
else {
row = N2.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(N2.selectedCell && N2.selectedCell.index == 1) N2.selectedCell.selectNext();
} else {
row.noHideASP = true;
if(N2.selectedRow) row = row.myTable.addRow(row.index+1);
row.select();
row.cells.item(0).select();
setSelectionRange(this.inputSearch);
}
}
else if(N2.selectedRow) {
if(this.inputSearch.value != this.inputCode.previousCode || this.inputCode.previousCode == '') {
var data = new Object();
N2.selectedRow.setData(data);
N2.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);
}
var postData =
'module=' + this.module +
'&action=AjaxSearchQuery&to_pdf=1&as_inputSearch=' + this.inputSearch.value +
'&stock_id=' + document.forms.EditView.stock_id.value +
'&type=service';
YAHOO.util.Connect.asyncRequest(
'POST',
'index.php'
,{
success: this.Display,
failure: this.Fail
},
postData
);
}
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('AjaxSearch2Pin');
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 = 'AjaxSearch2_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 = 'as2_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="AjaxSearch2Pin" 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="as2_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 = 'as2_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(AjaxSearch2Items) {
if(typeof(AjaxSearch2Items) == "number")
AjaxSearchItem++;
else
AjaxSearchItem = 0;
this.ajaxSearchItem = AjaxSearchItem;
}
this.createForm();
this.div.AjaxSearch = this;
this.div.id = 'AjaxSearch2_' + 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("AjaxSearch2_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,439 @@
var AjaxSearch3Items;
function AjaxSearch3(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 = 1500; //opoznienie wyszukiwania
this.divList; //pole w ktorym wyswietlana bedzie lista znalezionnych elementow
this.ajaxSearchItem; //unikalny identyfikator;
this.module = 'EcmServices';//modul
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();", this.searchDelay);
}
this.inputSearchEnterPressed = function(other) {
if(this.positionSelected) {
var row;
if(N3.selectedRow) {
N3.selectedRow.setData(this.positionSelected.positionData);
row = N3.selectedRow;
}
else {
row = N3.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(N3.selectedCell && N3.selectedCell.index == 1) N3.selectedCell.selectNext();
} else {
row.noHideASP = true;
if(N3.selectedRow) row = row.myTable.addRow(row.index+1);
row.select();
row.cells.item(0).select();
setSelectionRange(this.inputSearch);
}
}
else if(N3.selectedRow) {
if(this.inputSearch.value != this.inputCode.previousCode || this.inputCode.previousCode == '') {
var data = new Object();
N3.selectedRow.setData(data);
N3.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);
}
var postData =
'module=' + this.module +
'&action=AjaxSearchQuery&to_pdf=1&as_inputSearch=' + this.inputSearch.value +
'&stock_id=' + document.forms.EditView.stock_id.value +
'&type=income';
YAHOO.util.Connect.asyncRequest(
'POST',
'index.php'
,{
success: this.Display,
failure: this.Fail
},
postData
);
}
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('AjaxSearch3Pin');
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 = 'AjaxSearch3_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 = 'as3_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="AjaxSearch3Pin" 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="as3_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 = 'as3_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(AjaxSearch3Items) {
if(typeof(AjaxSearch3Items) == "number")
AjaxSearchItem++;
else
AjaxSearchItem = 0;
this.ajaxSearchItem = AjaxSearchItem;
}
this.createForm();
this.div.AjaxSearch = this;
this.div.id = 'AjaxSearch3_' + 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("AjaxSearch3_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,139 @@
<?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'
);
$use_language = null;
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) && false == is_null($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`.`code`) 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`.`short_description`) LIKE '%$AS_INPUTSEARCH%'";
}
$query .= ')';
// $types = array('article', 'income', 'service');
// $query .= ' AND `type` ' . (in_array($type = $_REQUEST['type'], $types) ? 1 : '\'article\'') . '';
$query .= ' AND pr.`type` ' . ((@$_REQUEST['type'] == 'service') ? '=' : '!=' ) . ' \'service\'';
$query .= ' AND pr.`deleted`=\'0\'';
$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;
}
if (count($arr) > 0) {
$json = getJSONobj();
echo str_replace("&quot;", '\"', $json->encode($arr));
}
}

View File

@@ -0,0 +1,9 @@
// JavaScript Document
/*
function komunikat() {
var cos = new YAHOO.widget.Dialog("CreateItemDialog",{width:"450px",height:"520px",fixedcenter:true,draggable:false,visible:false,effect:[{effect:YAHOO.widget.ContainerEffect.SLIDETOP,duration:0.5},{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}],modal:true,close:false});
document.getElementById('CreateItemDialog').style.display=''
}
YAHOO.util.Event.addListener(window, "load", komunikat);
*/

View File

@@ -0,0 +1,284 @@
<?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/EcmServices/EcmService.php');
require_once('modules/EcmServices/Forms.php');
require_once('include/json_config.php');
$json_config = new json_config();
$file = 'modules/EcmGroupServices/EcmGroupService.php';
if (file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupService::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 EcmService();
$OPT['auto_commiting'] = $focus->ACLAccess('auto_commiting');
if (true) {
$OPT['new_number'] = true;
$focus->status = 'registered';
if (isset($cc)) {
//payment condition
$cc_list = EcmGroupService::getPositionList('ecmpaymentconditions');
$focus->ecmpaymentcondition_id = $cc['default_payment_condition'];
$focus->ecmpaymentcondition_name = $cc_list[$cc['default_payment_condition']];
//delivery condition
$cc_list = EcmGroupService::getPositionList('ecmdeliveryconditions');
$focus->ecmdeliverycondition_id = $cc['default_delivery_condition'];
$focus->ecmdeliverycondition_name = $cc_list[$cc['default_delivery_condition']];
//default template
$focus->template_id = $cc['default_document_template'];
$fftemplateid = $focus->template_id;
}
}
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'] = ture;
$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, 'EcmServices', $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/EcmGroupServices/EcmGroupService.php');
$cc = EcmGroupService::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']
);
}
$json = getJSONobj();
$scriptOpt = '
<script language="javascript">
var VAT = ' . str_replace('&quot;', '"', $json->encode($VAT)) . ';
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; var N2; var N3;
</script>
';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmServices/views/CreateView/view.create.ecmservices.php');
$create = new ViewCreateEcmServices();
$create->ss = new Sugar_Smarty();
$create->module = 'EcmServices';
$create->bean = $focus;
$create->tplFile = 'include/ECM/EcmViews/CreateView/Tabs/CreateView.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']['ecmservices_stock_id_dom']);
$pw_stock_id = ($focus->pw_stock_id ? : $GLOBALS['app_list_strings']['ecmservices_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['ecmservices_status_dom'] as $key => $value)
{
$option = '<option value="'. $key . '"%s>' . $value . '</option>';
$selected = ($key == $focus->status);
//var_dump($selected);
array_push($status , sprintf($option, $selected ? ' selected' : ''));
}
$create->ss->assign('STATUS', implode($status));
$create->ss->assign('STOCK', implode($stocks));
$create->ss->assign('PW_STOCK', implode($pw_stocks));
$create->ss->assign('OPT', $OPT);
$create->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' : ''));
}
$create->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);
}
$temp_id = !$focus->id ? create_guid() : $focus->temp_id;
$create->ss->assign('TEMP_ID', $temp_id);
$create->ss->assign('INCOME_LIST', $focus->position_list);
//$create->ss->assign('POSITION_LIST', $focus->position_list);
//$create->ss->assign('SERVICES_LIST', $focus->services_list);
$create->ss->assign('MFP', $focus->loadParserArray());
echo $create->display();

View File

@@ -0,0 +1,204 @@
<?php
error_reporting(E_ALL);
set_time_limit(999999);
include_once("modules/EcmServices/EcmService.php");
include_once("modules/EcmDocumentTemplates/EcmDocumentTemplate.php");
$q=new EcmService();
$q->retrieve($_REQUEST['record']);
require_once('modules/EcmTexts/EcmText.php');
if(isset($q->ecmlanguage) && $q->ecmlanguage != '') {
$data = EcmText::LoadText(null,null,"EcmServices",$q->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'];
}
}
}
$t=new EcmDocumentTemplate();
$t=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecmdocumenttemplates where id='".$q->template_id."'"));
set_include_path('include/PHPExcel/');
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
include 'PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("E5 CRM");
$objPHPExcel->getProperties()->setLastModifiedBy("E5 CRM");
$objPHPExcel->getProperties()->setTitle("Office 2007 QUOTE");
$objPHPExcel->getProperties()->setSubject("Office 2007 QUOTE");
$objPHPExcel->getProperties()->setDescription("QUOTE");
$alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(50);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$t->footer_text=str_replace("/$dt_account_name",$t['account_name'],$t['footer_text']);
$ftt=explode("
",$t['footer_text']);
foreach($ftt as $ft){
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$ft);
}
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('A1',$t['account_name']);
$i+=2;
$objPHPExcel->getActiveSheet()->getStyle('A'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$mod_strings['LBL_PDF_QUOTE_FOR']);
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_NUMBER']);
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$q->parent_name);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->document_no);
$i++;
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_DATE_REGISTER']);
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->register_date);
$i++;
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_OWNER']);
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$q->assigned_user_name);
$i++;
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setSize(24);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$q->name);
$i+=2;
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
)
),
"A".$i.":G".$i
);
$objPHPExcel->getActiveSheet()->getStyle('A'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('B'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('C'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('D'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('E'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$mod_strings['LBL_PDF_LIST_POSITION']);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$mod_strings['LBL_PDF_LIST_CODE']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$mod_strings['LBL_PDF_LIST_DESCRIPTION']);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$mod_strings['LBL_PDF_LIST_QUANTITY']);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$mod_strings['LBL_PDF_LIST_UNIT']);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_LIST_PRICE']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$mod_strings['LBL_PDF_LIST_TOTAL']);
$ii++;
$i++;
//$lv=return_app_list_strings_language($this->ecmlanguage);
$ww=$GLOBALS['db']->query("select * from ecmserviceitems where ecmservice_id='".$q->id."' and deleted='0'");
while($p=$GLOBALS['db']->fetchByAssoc($ww)){
$w=$GLOBALS['db']->query("select code,name,quantity,ecmcomponent_id from ecmproductcomponents where ecmproduct_id='".$p['ecmproduct_id']."' and deleted='0' and position='0'");
if(mysql_num_rows($w)>0){
$r=$GLOBALS['db']->fetchByAssoc($w);
$p_name=$r['name'];
$p_code=$r['code'];
}
else {
$p_name=$p['name'];
$p_code=$p['code'];
}
$total_netto+=$p['price']*$p['quantity'];
$total_vat+=$p['price']*$p['quantity']*$p['ecmvat_value']/100;
$vats[$p['ecmvat_value']]+=$p['price']*$p['quantity']*$p['ecmvat_value']/100;
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,$ii);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$p_code);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$p_name);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$p['quantity']);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$lv['ecmproducts_unit_dom'][$p['dd_unit_id']]);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$p['price']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$p['total']);
if($p['ecmproduct_id']){
$w=$GLOBALS['db']->query("select code,name,quantity,ecmcomponent_id from ecmproductcomponents where ecmproduct_id='".$p['ecmproduct_id']."' and deleted='0' and position>0 order by name asc");
if(mysql_num_rows($w)>0){
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$i++;
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$i,"+");
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$i,$r['code']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$i,$r['name']);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$i,$r['quantity']);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$i,$lv['ecmproducts_unit_dom'][$r['dd_unit_id']]);
}
$i++;
}
}
$i++;
$ii++;
}
$sumary_start=$i;
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_TOTAL']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$total_netto);
foreach($vats as $k=>$v){
$i++;
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_VAT']." (".$k."%)");
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,$v);
}
$i++;
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$i,$mod_strings['LBL_PDF_END_TOTAL']);
$objPHPExcel->getActiveSheet()->SetCellValue('G'.$i,($total_netto+$total_vat));
$summary_end=$i;
$objPHPExcel->getActiveSheet()->duplicateStyleArray(
array(
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_SOLID,
'color' => array('argb' => 'FFCCFFCC')
),
'borders' => array(
'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
)
),
"F".$sumary_start.":G".$summary_end
);
$objPHPExcel->getActiveSheet()->setTitle('Simple');
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
chmod("cache/upload",0777);
$microtime=str_replace(".","",str_replace(" ","",microtime()));
$name="cache/upload/Quote".$microtime.".xlsx";
$objWriter->save($name);
chmod($name,0777);
header("Location: ".$name);
?>

View File

@@ -0,0 +1,117 @@
<?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 - 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".
*/
global $current_user;
$dashletData['MyEcmServicesDashlet']['searchFields'] = array('name' => array('default' => ''),
'date_entered' => array('default' => ''),
'status' => array('default' => ''),
'assigned_user_id' => array('type' => 'assigned_user_name',
'default' => $current_user->name));
$dashletData['MyEcmServicesDashlet']['columns'] = array(
'STATUS' => array(
'width' => '1',
'label' => '&nbsp;',
'default' => true,
),
'DOCUMENT_NO' => array(
'width' => '8',
'label' => 'LBL_DOCUMENT_NO',
'sortable' => true,
'link' => true,
'default' => true,
),
'NAME' => array(
'width' => '15',
'label' => 'LBL_NAME',
'sortable' => true,
'link' => false,
//'customCode' => '<a href="index.php?module=EcmServices&action=EditView&record={$ID}">{$NAME}</a>',
'default' => true,
),
'REGISTER_DATE'=>array(
'width'=>15,
'label'=>'LBL_REGISTER_DATE',
'default'=>true,
'sortable'=>true,
),
'PARENT_ID'=>array(
'width'=>0,
'label'=>'&nbsp;',
'customCode'=>'&nbsp;',
'default'=>true,
'sortable'=>false,
),
'PARENT_NAME' => array(
'width' => '15',
'label' => 'LBL_PARENT_NAME',
'default' => true,
'id'=>'PARENT_ID',
'module'=>'Accounts',
'link'=>true,
),
'TOTAL' => array(
'width' => '10',
'label' => 'LBL_TOTAL',
'default' => true,
'align' => 'left',
),
'ASSIGNED_USER_NAME' => array(
'width' => '10',
'label' => 'LBL_LIST_ASSIGNED_USER',
'default' => true
),
'OPTIONS' => array(
'width' => '5',
'label' => '&nbsp;',
'link' => false,
'default' => true,
'sortable' => false,
'align' => 'right',
),
'date_entered' => array('width' => '15',
'label' => 'LBL_DATE_ENTERED'),
);
k
?>

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 - 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".
*/
global $app_strings;
$dashletMeta['MyEcmServicesDashlet'] = array('module' => 'EcmServices',
'title' => translate('LBL_DASHLET_MY_ECMSERVICES', 'EcmServices'),
'description' => 'A customizable view into Quotes',
'category' => 'Module Views',
'hidden' => true);
?>

View File

@@ -0,0 +1,61 @@
<?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 - 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/Dashlets/DashletGeneric.php');
require_once('modules/EcmServices/EcmService.php');
class MyEcmServicesDashlet extends DashletGeneric {
function MyEcmServicesDashlet($id, $def = null) {
global $current_user, $app_strings;
require('modules/EcmServices/Dashlets/MyEcmServicesDashlet/MyEcmServicesDashlet.data.php');
parent::DashletGeneric($id, $def);
if(empty($def['title'])) $this->title = translate('LBL_DASHLET_MY_ECMSERVICES', 'EcmServices');
$this->searchFields = $dashletData['MyEcmServicesDashlet']['searchFields'];
$this->columns = $dashletData['MyEcmServicesDashlet']['columns'];
$this->seedBean = new EcmService();
$this->lvs->quickViewLinks = false;
}
}
?>

View File

@@ -0,0 +1,142 @@
<?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.
********************************************************************************/
require_once('modules/EcmServices/EcmService.php');
$focus = new EcmService();
// PERFORM THE DELETE IF GIVEN A RECORD TO DELETE
if(!isset($_REQUEST['record']))
sugar_die("A record number must be specified to delete the record.");
$focus->retrieve($_REQUEST['record']);
if(!$focus->ACLAccess('Delete')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$focus->deleteAssignedPositions();
$focus->mark_deleted($_REQUEST['record']);
// NOW THAT THE DELETE HAS BEEN PERFORMED, RETURN TO GIVEN LOCATION
header("Location: index.php?module=".$_REQUEST['return_module']."&action=".$_REQUEST['return_action']."&record=".$_REQUEST['return_id']);
?>

View File

@@ -0,0 +1,205 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
//require_once('modules/EcmGroupServices/HeaderMenu.php');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once('modules/EcmServices/EcmService.php');
require_once('modules/EcmServices/Forms.php');
require_once('include/json_config.php');
$json_config = new json_config();
$file = 'modules/EcmGroupServices/EcmGroupService.php';
if (file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupService::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;
$focus = new EcmService();
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->getServicePositionList(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->services_list = str_replace('&quot;', '\"', $focus->getServicePositionList());
$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();
$nvats = 100;
for ($i = 0; $i <= 99; $i++) {
$VAT[$i] = array(
"id" => $i,
"name" => $i . "%",
"value" => $i
);
}
$show_pdf = $current_user->getPreference('show_pdf_in_div');
if (!isset($show_pdf)) {
require_once('modules/EcmGroupServices/EcmGroupService.php');
$cc = EcmGroupService::loadSettings();
$show_pdf = $cc['show_pdf_in_div_global'];
}
$scriptOpt = '
<script language="javascript">
var SHOW_PDF_IN_DIV =' . $show_pdf . ';
var NOOFVATS =' . $nvats . ';
var VAT = ' . str_replace('&quot;', '\"', $json->encode($VAT)) . ';
var OPT = ' . str_replace('&quot;', '\"', $json->encode($OPT)) . ';
var MOD = ' . str_replace('&quot;', '\"', $json->encode($mod_strings)) . ';
var N; var N2; var N3;
</script>
';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmServices/views/DetailView/view.detail.my.php');
$edit = new ViewDetailMy();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmServices';
$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));
$edit->ss->assign("POSITION_LIST", $focus->position_list);
$edit->ss->assign("SERVICES_LIST", $focus->services_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->services_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());
$desc.='<input title="Generuj PDF" class="button" onclick="if(document.getElementById(\'div_desc\').style.display==\'none\')document.getElementById(\'div_desc\').style.display=\'block\';else document.getElementById(\'div_desc\').style.display=\'none\';" type="button" name="productcard" id="productcard" value="Generuj PDF">';
$desc .= '<div id="div_desc" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
$desc .= 'Typ: <select name="preview_type" id="preview_type"><option value="income">Otwarcie</option>
<option value="qty">Wykaz ilościowy</option>
<option value="val">Wykaz wartościowy</option>
<option value="warranty">Protokół</option>
<option value="fault">Usterka</option></select><br /><br />';
$desc .= '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.location = \'index.php?module=EcmServices&action=previewPDF&to_pdf=1&record='.$_REQUEST['record'].'\';" type="button" value="Pokaż PDF"></div>';
$edit->ss->assign("CATALOGUE",$desc);
$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, 'EcmServices');
echo $subpanel->display();
echo 'tt';

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,816 @@
window.onbeforeunload = function() {
removeDocumentReservations(document.getElementById("temp_id").value);
//saveDocumentReservations(document.getElementById("temp_id").value);
alert("Wprowadzone zmiany nie zostały zapisane");
}
function BlockProducts(){
var tab = document.getElementById("tbody");
var tr = tab.getElementsByTagName("tr");
var qty;
var total;
for(var i=0; i < tr.length; i++){
var inp=tr[i].getElementsByTagName("input");
var img=tr[i].getElementsByTagName("img");
var tx=tr[i].getElementsByTagName("textarea");
//console.log(inp);
if (inp[2].value!='') {
inp[1].setAttribute('readonly', 'readonly');
inp[1].setAttribute('onkeydown', '');
img[2].setAttribute('style', 'display:none');
//img[1].setAttribute('style', 'display:none');
}
//if(inp[8].value==1)deleteEmptyComponents(inp[11].value);
}
return true;
}
function saveDocumentReservations(temp_id, operation) {
url = 'index.php?module=EcmStockOperations&action=saveDocumentReservations&temp_doc_id='+temp_id+'&to_pdf=1';
var req = mint.Request();
req.OnSuccess = function() {
switch(operation)
{
case 'cancel':
case 'list':
default:
//window.location = "index.php?module=EcmServices&action=index";
break;
}
return;
}
req.Send(url);
}
function removeDocumentReservations(temp_id, operation) {
url = 'index.php?module=EcmStockOperations&action=deleteDocumentReservations&temp_doc_id='+temp_id+'&to_pdf=1';
var req = mint.Request();
req.OnSuccess = function() {
switch(operation)
{
case 'cancel':
case 'list':
default:
window.location = "index.php?module=EcmServices&action=index";
break;
}
return;
}
req.Send(url);
}
function getProductQuantity(rowIndex, operation) {
//console.log('getProductQuantity');
var stock_id = document.getElementById("stock_id").value;
var product_id = N.row(rowIndex).getData().id;
url='index.php?module=EcmStockStates&action=getProductQuantity&stock_id=' + stock_id + '&product_id=' + product_id + '&to_pdf=1';
//console.log(url);
var req = mint.Request();
req.OnSuccess = function()
{
//console.log("getProductQuantity:OnSuccess");
//return;
var data = N.row(rowIndex).getData();
//console.log(data);
data.stock = this.responseText;
N.row(rowIndex).setData(data);
if (!data.reserved)
data.reserved = 0;
if (operation == "saveReservation") {
N.row(rowIndex).className='';
saveReservation(rowIndex, false);
//console.log(data);
if(parseFloat(data.stock) >= data.rq) {
N.row(rowIndex).addClass('greenRow');
} else {
N.row(rowIndex).addClass('redRow');
}
return;
//console.log(data);
//N.row(rowIndex).className='';
//if qty = 0 do clear reserved field
if (data.rq == 0 ) {
N.row(rowIndex).setData();
removeReservation(rowIndex);
}
if(data.quantity >= data.rq)
{
/*
saveReservation(rowIndex, false);
return;
*/
if (data.stock >= data.rq) {
saveReservation(rowIndex, false);
return;
}
if ((data.stock < data.rq) && (parseFloat(data.stock) + parseFloat(data.rq) > 0)) {
console.log(data.stock);
console.log(data.rq);
console.log( parseFloat(data.stock) + parseFloat(data.rq));
saveReservation(rowIndex, true, parseFloat(data.stock) + parseFloat(data.rq)); // orange row true;
return;
}
if (data.quantity==0) {
data.reserved = 0;
N.row(rowIndex).setData();
removeReservation(rowIndex);
setTimeout(function() {getProductQuantity(rowIndex);},1000);
return;
}
/*
//stock > qty - all OK, can reserve
if (data.stock>=data.quantity-data.reserved) {
saveReservation(rowIndex, false);
return;
}
if ((data.stock<(data.quantity-data.reserved)) && (parseFloat(data.stock)+parseFloat(data.reserved)>0)) {
saveReservation(rowIndex, true, parseFloat(data.stock)+parseFloat(data.reserved)); //orange row true;
return;
}
//stock <= qty + res, sand reserve, do nothing
if (data.stock<(data.quantity-data.reserved)) {
N.row(rowIndex).className = 'redRow';
return;
}
*/
}
//if (data.stock < data.rq || data.quantity > data.rq) {
N.row(rowIndex).addClass('redRow');//className = 'redRow';
// return;
//}
}
}
req.Send(url);
}
function saveReservation(rowIndex, orangeRow, qty){
//console.log('saveReservation');
var data = N.row(rowIndex).getData();
//console.log(data);
var product_id = data.id;
var temp_item_id = data.temp_item_id;
var quantity;
if (qty)
quantity = qty;
else
quantity = data.rq;
var date = document.getElementById("temp_date").value;
var stock_id = document.getElementById("stock_id").value;
var temp_doc_id = document.getElementById("temp_id").value;
var url='index.php?module=EcmStockOperations&action=saveReservation&stock_id='+stock_id+'&product_id='+product_id+'&temp_doc_id='+temp_doc_id+'&temp_item_id='+temp_item_id+'&date='+date+'&quantity='+quantity+'&to_pdf=1';
//console.log(url);
var req = mint.Request();
req.OnSuccess = function(){
//console.log("saveReservation:OnSuccess");
var data = N.row(rowIndex).getData();
data.reserved = quantity;
N.row(rowIndex).setData(data);
//N.row(rowIndex).cell(3).getElementById("reservation_info").innerHtml="("+data.reserved+")";
//N.row(rowIndex).cells.item(4).getElementsByTagName('input')[0].value = NumberToUserFormatNumber(data.reserved);
//cell(3).getElementById("reservation_info").innerHtml
if (orangeRow == true)
N.row(rowIndex).addClass('orangeRow'); //.className = 'orangeRow';
else
N.row(rowIndex).addClass('greenRow'); //.className = 'greenRow';
getProductQuantity(rowIndex);
}
req.Send(url);
}
function removeReservation(index) {
//Console.log('removeReservation');
var data = N.row(index).getData();
var temp_item_id = data.temp_item_id;
url='index.php?module=EcmStockOperations&action=deleteReservation&temp_item_id='+temp_item_id+'&to_pdf=1';
//console.log('removeReservation: ' + url);
var req=mint.Request();
req.OnSuccess = function() {
//console.log('removeReservation OnSuccess');
}
req.Send(url);
}
function SetTabIndexs() {
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++;
}
}
}
}
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, met, 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, met, 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 cursorEOT(isField) {
isRange = isField.createTextRange();
isRange.move("textedit");
isRange.select();
testOverflow = isField.scrollTop;
if (testOverflow != 0){
return true
}
else {
return false
}
}
function adjustRows(isField) {
while (cursorEOT(isField)){
isField.rows++
}
}
function insertText(isField,isText) {
isField.value = testText;
isField.focus();
}
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) {
return "";
}
var ServiceListSave = function(json) {
return "";
}
var IncomeListSave = function(json) {
return "";
}
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 saveItems(){
document.getElementById("position_list").value = ItemsList(true);
}
function saveServices(){
document.getElementById("services_list").value = ServicesList(true);
}
function checkStockQuantity(){
var tab=document.getElementById("tbody");
var tr=tab.getElementsByTagName("tr");
var qtyinstock;
var qty;
var total;
for(var i=0;i<tr.length;i++){
qtyinstock=tr[i].getElementsByTagName("input")[18].value;
qty=tr[i].getElementsByTagName("input")[17].value;
total=parseFloat(qtyinstock)-parseFloat(qty);
if(tr[i].getElementsByTagName("input")[17].checked==true && tr[i].getElementsByTagName("input")[2].value && parseInt(qtyinstock)-parseInt(qty)<0){
alert("Brakuje produktów na magazynie aby zrobic rezerwacje");
tr[i].getElementsByTagName("input")[17].value=parseInt(qtyinstock);
if(tr[i].getElementsByTagName("input")[9].value<tr[i].getElementsByTagName("input")[18].value){
tr[i].getElementsByTagName("input")[18].value=parseInt(tr[i].getElementsByTagName("input")[9].value);
}
return false;
}
}
return true;
}
function removeHistoryRecord(id) {
var historyElement = document.forms.EditView.history;
var historyValue = JSON.parse(historyElement.value);
historyValue[id] = null;
//console.log(historyElement.value);
//console.log('Length: ' + historyValue.length);
historyElement.value = JSON.stringifyNoSecurity(historyValue);
return true;
}
function removeHistory(a) {
var paretLi = a.parentNode.parentNode;
var idParts = paretLi.id.split('_');
if(idParts[1] >= 0) {
removeHistoryRecord(idParts[1]);
//paretLi.removeChild(idParts[1]);
paretLi.style.display = 'none';
}
//console.log(paretLi.parentNode.children );
// Hide no-results item if needed.
if(paretLi.parentNode.children.length == 0) {
//
}
return true;
}
function addHistoryRecord(date, owner, record) {
var historyRecord = [
date,
owner,
record
];
var historyElement = document.forms.EditView.history;
var historyValue = JSON.parse(historyElement.value);
historyValue.unshift(historyRecord);
historyElement.value = JSON.stringifyNoSecurity(historyValue);
// Bof: Build list item.
{
var recordLi = document.createElement('li');
var dateP = document.createElement('p');
dateP.appendChild(document.createTextNode(date));
dateP.appendChild(document.createTextNode(', '));
dateP.appendChild(document.createTextNode(owner));
dateP.appendChild(document.createTextNode(':'));
//var ownerP = document.createElement('p');
//ownerP.appendChild(document.createTextNode(owner));
var recordP = document.createElement('p');
recordP.appendChild(document.createTextNode(record));
recordLi.appendChild(dateP);
//recordLi.appendChild(ownerP)
recordLi.appendChild(recordP);
}
// Eof: Build list item.
// Prepend new history record.
var wrapperList = document.getElementById('history_wrapper').children[0];
// Hide no-results item if needed.
if(wrapperList.children.length == 1 && wrapperList.children[0].getAttribute('class') == 'no-results') {
wrapperList.children[0].style.display = 'none';
}
wrapperList.insertBefore(recordLi, wrapperList.firstChild);
return true;
}
function addHistory() {
// Grab important form fields.
var owner = document.forms.EditView.history_owner;
var date = document.forms.EditView.history_date;
var record = document.forms.EditView.history_record;
// Check values.
if(owner.value.length == 0 || date.value.length == 0 || record.value.length == 0) {
alert('Wypełnij wszystkie pola.');
return false;
}
// Create row, update hidden history value.
addHistoryRecord(date.value, owner.value, record.value);
var date = new Date();
// Reset form.
owner.value = '';
date.value = date.toString('d.m.Y');
record.value = '';
return true;
}
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")) {
//var result = confirm(MOD.LBL_CONFIRM_QUESTION);
//if(result) document.forms.EditView.status.value = (OPT["auto_commiting"]?"s30":"s20");
doRequest(
"index.php",
getFormPost("Save"),
function(result){
/*
console.log(result);
HideLoadingView();
return;
*/
document.forms.EditView.record.value = result.substring(result.length - 36);
if(OPT["setEmailTab"])
setEMAIL(true);
else
window.location = "index.php?module="+document.forms.EditView.module.value+"&action=DetailView&record="+document.forms.EditView.record.value;
},
MOD["LBL_NOT_SAVED"]
);
} else {
alert(MOD["LBL_NOT_SAVED"]);
HideLoadingView();
return false;
}
},
200);
}
function ItemListClear() {
while(N.rowCount() > 0)
N.row(0).deleteRow();
}
function getFormPost(action) {
if(!action)
action = "previewPDF";
var pd =
"to_pdf=1" +
"&module=EcmServices&action=" +
action +
"&record=" +
document.forms.EditView.record.value;
pd += "&cache=fromJava" + ItemListSave(true) + ServiceListSave(true) + IncomeListSave(true);
pd += '&history=' + document.forms.EditView.history.value;
var pd2 = new Object();
pd2["module"] = "EcmServices";
pd2["action"] = action;
pd2["record"] = document.forms.EditView.record.value;
pd2["to_pdf"] = "1";
pd2["cache"] = "fromJava";
//pd2['history'] = document.forms.EditView.history.value;
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;
}
}
pd += "&otherFormData=" + JSON.stringifyNoSecurity(pd2);
return pd;
}
function sendFormPostToPdf(type, panel) {
var tab = '_';
if(type != null) {
tab += type.toUpperCase();
}
ERROR = false;
document.getElementById("position_list").value = ItemListSave(true);
document.getElementById("services_list").value = ServiceListSave(true);
document.getElementById("income_list").value = IncomeListSave(true);
if(ERROR) {
alert("There are some errors on list");
return false;
}
doRequest(
"index.php",
getFormPost("previewPDF"),
function(result) {
//console.log(result);
//return;
if(SHOW_PDF_IN_DIV==1){
HideLoadingView();
EcmPreviewPDF(
"index.php?module=EcmServices&action=previewPDF&to_pdf=1&from=EcmServices&type=" + type,
{
zoom:75
}
);
}
else{
SetTab((panel ? "panel_" : "" )+ "PREVIEW" + tab);
document.getElementById("previewPDF" + tab).innerHTML = '<iframe style="border: none; width: 100%; height: 1200px;" frameborder="no" src="index.php?module=EcmServices&action=previewPDF&to_pdf=1&from=EcmServices&type=' + type + '#zoom=75">Yours browser not accept iframes!</iframe>';
}
}
);
}
preview_pdf = function() {
var type = document.getElementById('preview_type').value;
switch(type)
{
default:
type = 'income';
case 'fault':
case 'income':
case 'qty':
case 'val':
case 'warranty':
break;
}
doRequest(
"index.php",
getFormPost("previewPDF"),
function(result) {
//console.log(result);
//return;
if(SHOW_PDF_IN_DIV==1){
HideLoadingView();
EcmPreviewPDF(
"index.php?module=EcmServices&action=previewPDF&to_pdf=1&from=EcmServices&type=" + type,
{
zoom:75
}
);
}
else{
document.getElementById("previewPDF").innerHTML = '<iframe style="border: none; width: 100%; height: 1200px;" frameborder="no" src="index.php?module=EcmServices&action=previewPDF&to_pdf=1&from=EcmServices&type=' + type + '#zoom=75">Yours browser not accept iframes!</iframe>';
}
}
);
//document.getElementById('previewPDF').innerHTML = '<iframe style="border:none;width:100%;height:1200px;" frameborder="no" src="index.php?module=EcmServices&action=previewPDF&type=' + type + '&to_pdf=1&method=I&record=' + document.forms.DetailView.record.value + '#zoom=75">Yours browser not accept iframes!</iframe>';
}
function canConfirm() {
if(document.forms.EditView.status.value == "accepted" && !OPT.user.confirm_quotes) {
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;
return 0;
}
var AjaxSearch1Items;
var AjaxSearch2Items;
var AjaxSearch3Items;
var parentFL;
var productFL;
var contactFL;

View File

@@ -0,0 +1,641 @@
window.onbeforeunload = function() {
removeDocumentReservations(document.getElementById("temp_id").value);
alert("Wprowadzone zmiany nie zostały zapisane");
}
function BlockProducts(){
var tab = document.getElementById("tbody");
var tr = tab.getElementsByTagName("tr");
var qty;
var total;
for(var i=0; i < tr.length; i++){
var inp=tr[i].getElementsByTagName("input");
var img=tr[i].getElementsByTagName("img");
var tx=tr[i].getElementsByTagName("textarea");
//console.log(inp);
if (inp[2].value!='') {
inp[1].setAttribute('readonly', 'readonly');
inp[1].setAttribute('onkeydown', '');
img[2].setAttribute('style', 'display:none');
//img[1].setAttribute('style', 'display:none');
}
//if(inp[8].value==1)deleteEmptyComponents(inp[11].value);
}
return true;
}
function removeDocumentReservations(temp_id, operation) {
url = 'index.php?module=EcmStockOperations&action=deleteDocumentReservations&temp_doc_id='+temp_id+'&to_pdf=1';
var req = mint.Request();
req.OnSuccess = function() {
if (operation) {
if (operation=='cancel')
window.location="index.php?module=EcmStockDocOuts&action=index";
if (operation=='list')
window.location="index.php?module=EcmStockDocOuts&action=index";
}
}
req.Send(url);
}
function getProductQuantity2(input,product_id, stock_id,old_qty, row){
url="index.php?module=EcmStockStates&action=getProductQuantity&stock_id="+stock_id+"&product_id="+product_id+"&to_pdf=1";
var req=mint.Request();
req.OnLoading=function()
{
input.innerHTML="loading";
}
req.OnSuccess = function()
{
if (row) {
if (parseFloat(this.responseText) != old_qty) {
row.className="orangeRow";
setTimeout(function() {
row.className="selectedRow";
}, 1500);
}
}
input.value=this.responseText;
}
req.Send(url);
}
function getProductQuantity(rowIndex, operation) {
//console.log('getProductQuantity');
var stock_id = document.getElementById("stock_id").value;
var product_id = N.row(rowIndex).getData().id;
url='index.php?module=EcmStockStates&action=getProductQuantity&stock_id=' + stock_id + '&product_id=' + product_id + '&to_pdf=1';
console.log(url);
var req = mint.Request();
req.OnSuccess = function()
{
//console.log("getProductQuantity:OnSuccess");
//return;
var data = N.row(rowIndex).getData();
data.stock = this.responseText;
N.row(rowIndex).setData(data);
if (!data.reserved)
data.reserved = 0;
if (operation == "saveReservation") {
N.row(rowIndex).className='';
//if qty = 0 do clear reserved field
if (data.rq == 0) {
N.row(rowIndex).setData();
removeReservation(rowIndex);
setTimeout(
function() {
getProductQuantity(rowIndex);
},
1000
);
return;
}
//stock > qty - all OK, can reserve
if (data.stock >= data.reserved) {
saveReservation(rowIndex, false);
return;
}
if ((data.stock < data.reserved) && (parseFloat(data.stock) + parseFloat(data.reserved) > 0)) {
saveReservation(rowIndex, true, parseFloat(data.stock)+parseFloat(data.reserved)); //orange row true;
return;
}
//stock <= qty + res, sand reserve, do nothing
if (data.stock < data.reserved) {
N.row(rowIndex).className = 'redRow';
return;
}
}
}
req.Send(url);
}
function saveReservation2(rowIndex, orangeRow, qty){
//block change RW stock
//document.getElementById("stock_id").disabled=true;
//document.getElementById("pw_stock_id").disabled=true;
var data = N.row(rowIndex).getData();
var product_id = data.id;
var temp_item_id = data.temp_item_id;
var quantity;
if (qty)
quantity = qty;
else
quantity = data.quantity;
console.log(data.name+" qty: "+quantity);
var date = document.getElementById("temp_date").value;
var stock_id = document.getElementById("stock_id").value;
var temp_doc_id = document.getElementById("temp_id").value;
var url='index.php?module=EcmStockOperations&action=saveReservation&stock_id='+stock_id+'&product_id='+product_id+'&temp_doc_id='+temp_doc_id+'&temp_item_id='+temp_item_id+'&date='+date+'&quantity='+quantity+'&to_pdf=1';
var req=mint.Request();
req.OnSuccess = function(){
var data = N.row(rowIndex).getData();
data.reserved = quantity;
N.row(rowIndex).setData(data);
//N.row(rowIndex).cell(3).getElementById("reservation_info").innerHtml="("+data.reserved+")";
N.row(rowIndex).cells.item(3).getElementsByTagName('p')[0].innerHTML = NumberToUserFormatNumber(data.reserved);
//cell(3).getElementById("reservation_info").innerHtml
if (orangeRow==true) N.row(rowIndex).className = 'orangeRow';
else N.row(rowIndex).className = 'greenRow';
getProductQuantity(rowIndex, '');
}
req.Send(url);
}
function saveReservation(rowIndex, orangeRow, qty){
//block change RW stock. Why ?
//document.getElementById("stock_id").disabled = true;
//document.getElementById("pw_stock_id").disabled = true;
var data = N.row(rowIndex).getData();
var product_id = data.id;
var temp_item_id = data.temp_item_id;
var quantity;
if (qty)
quantity = qty;
else
quantity = data.rq;
var date = document.getElementById("temp_date").value;
var stock_id = document.getElementById("stock_id").value;
var temp_doc_id = document.getElementById("temp_id").value;
var url='index.php?module=EcmStockOperations&action=saveReservation&stock_id='+stock_id+'&product_id='+product_id+'&temp_doc_id='+temp_doc_id+'&temp_item_id='+temp_item_id+'&date='+date+'&quantity='+quantity+'&to_pdf=1';
//console.log(url);
var req=mint.Request();
req.OnSuccess = function(){
//console.log("saveReservation:OnSuccess");
var data = N.row(rowIndex).getData();
data.reserved = quantity;
N.row(rowIndex).setData(data);
//N.row(rowIndex).cell(3).getElementById("reservation_info").innerHtml="("+data.reserved+")";
N.row(rowIndex).cells.item(3).getElementsByTagName('p')[0].innerHTML = NumberToUserFormatNumber(data.reserved);
//cell(3).getElementById("reservation_info").innerHtml
if (orangeRow == true)
N.row(rowIndex).className = 'orangeRow';
else
N.row(rowIndex).className = 'greenRow';
getProductQuantity(rowIndex, '');
}
req.Send(url);
}
function removeReservation(index) {
//Console.log('removeReservation');
var data = N.row(index).getData();
var temp_item_id = data.temp_item_id;
url='index.php?module=EcmStockOperations&action=deleteReservation&temp_item_id='+temp_item_id+'&to_pdf=1';
//console.log('removeReservation: ' + url);
var req=mint.Request();
req.OnSuccess = function() {
//console.log('removeReservation OnSuccess');
}
req.Send(url);
}
function SetTabIndexs() {
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++;
}
}
}
}
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, met, 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, met, 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 cursorEOT(isField) {
isRange = isField.createTextRange();
isRange.move("textedit");
isRange.select();
testOverflow = isField.scrollTop;
if (testOverflow != 0){
return true
}
else {
return false
}
}
function adjustRows(isField) {
while (cursorEOT(isField)){
isField.rows++
}
}
function insertText(isField,isText) {
isField.value = testText;
isField.focus();
}
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) {
return "";
}
var ServiceListSave = function(json) {
return "";
}
var IncomeListSave = function(json) {
return "";
}
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 saveItems(){
document.getElementById("position_list").value = ItemsList(true);
}
function saveServices(){
document.getElementById("services_list").value = ServicesList(true);
}
function checkStockQuantity(){
var tab=document.getElementById("tbody");
var tr=tab.getElementsByTagName("tr");
var qtyinstock;
var qty;
var total;
for(var i=0;i<tr.length;i++){
qtyinstock=tr[i].getElementsByTagName("input")[18].value;
qty=tr[i].getElementsByTagName("input")[17].value;
total=parseFloat(qtyinstock)-parseFloat(qty);
if(tr[i].getElementsByTagName("input")[17].checked==true && tr[i].getElementsByTagName("input")[2].value && parseInt(qtyinstock)-parseInt(qty)<0){
alert("Brakuje produktów na magazynie aby zrobic rezerwacje");
tr[i].getElementsByTagName("input")[17].value=parseInt(qtyinstock);
if(tr[i].getElementsByTagName("input")[9].value<tr[i].getElementsByTagName("input")[18].value){
tr[i].getElementsByTagName("input")[18].value=parseInt(tr[i].getElementsByTagName("input")[9].value);
}
return false;
}
}
return true;
}
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")) {
//var result = confirm(MOD.LBL_CONFIRM_QUESTION);
//if(result) document.forms.EditView.status.value = (OPT["auto_commiting"]?"s30":"s20");
doRequest(
"index.php",
getFormPost("Save"),
function(result){
console.log(result);
HideLoadingView();
return;
document.forms.EditView.record.value = result.substring(result.length - 36);
if(OPT["setEmailTab"])
setEMAIL(true);
else
window.location = "index.php?module="+document.forms.EditView.module.value+"&action=DetailView&record="+document.forms.EditView.record.value;
},
MOD["LBL_NOT_SAVED"]
);
} else {
alert(MOD["LBL_NOT_SAVED"]);
HideLoadingView();
return false;
}
},
200);
}
function ItemListClear() {
while(N.rowCount()>0) N.row(0).deleteRow();
}
function getFormPost(action) {
if(!action)
action = "previewPDF";
var pd =
"to_pdf=1" +
"&module=EcmServices&action=" +
action +
"&record=" +
document.forms.EditView.record.value;
pd += "&cache=fromJava" + ItemListSave(true) + ServiceListSave(true) + IncomeListSave(true);
var pd2 = new Object();
pd2["module"] = "EcmServices";
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;
}
}
pd += "&otherFormData=" + JSON.stringifyNoSecurity(pd2);
return pd;
}
function sendFormPostToPdf(type, panel) {
var tab = '_';
if(type != null) {
tab += type.toUpperCase();
}
ERROR = false;
document.getElementById("position_list").value = ItemListSave(true);
document.getElementById("services_list").value = ServiceListSave(true);
document.getElementById("income_list").value = IncomeListSave(true);
if(ERROR) {
alert("There are some errors on list");
return false;
}
doRequest(
"index.php",
getFormPost("previewPDF"),
function(result) {
//console.log(result);
//return;
if(SHOW_PDF_IN_DIV==1){
HideLoadingView();
EcmPreviewPDF(
"index.php?module=EcmServices&action=previewPDF&to_pdf=1&from=EcmServices&type=" + type,
{
zoom:75
}
);
}
else{
SetTab((panel ? "panel_" : "" )+ "PREVIEW" + tab);
document.getElementById("previewPDF" + tab).innerHTML = '<iframe style="border: none; width: 100%; height: 1200px;" frameborder="no" src="index.php?module=EcmServices&action=previewPDF&to_pdf=1&from=EcmServices&type=' + type + '#zoom=75">Yours browser not accept iframes!</iframe>';
}
}
);
}
function canConfirm() {
if(document.forms.EditView.status.value == "accepted" && !OPT.user.confirm_quotes) {
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;
return 0;
}
var AjaxSearch1Items;
var AjaxSearch2Items;
var AjaxSearch3Items;
var parentFL;
var productFL;
var contactFL;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,296 @@
<?php
error_reporting(E_ALL);
set_time_limit(30);
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/EcmServices/EcmService.php');
require_once('modules/EcmServices/Forms.php');
require_once('include/json_config.php');
$json_config = new json_config();
$file = 'modules/EcmGroupServices/EcmGroupService.php';
if (file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupService::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 EcmService();
$OPT['auto_commiting'] = $focus->ACLAccess('auto_commiting');
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->services_list = str_replace('&quot;', '\'', $focus->getServicePositionList());
$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';
}
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'] = ture;
$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, 'EcmServices', $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/EcmGroupServices/EcmGroupService.php');
$cc = EcmGroupService::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']
);
}
$json = getJSONobj();
$scriptOpt = '
<script language="javascript">
var VAT = ' . str_replace('&quot;', '"', $json->encode($VAT)) . ';
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; var N2; var N3;
</script>
';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmServices/views/EditView/view.edit.ecmservices.php');
$edit = new ViewEditEcmServices();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmServices';
$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']['ecmservices_stock_id_dom']);
$pw_stock_id = ($focus->pw_stock_id ? : $GLOBALS['app_list_strings']['ecmservices_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['ecmservices_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['ecmservices_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);
$edit->ss->assign('POSITION_LIST', $focus->position_list);
$edit->ss->assign('SERVICES_LIST', $focus->services_list);
$edit->ss->assign('INCOME_LIST', $focus->income_list);
$edit->ss->assign('MFP', $focus->loadParserArray());
echo $edit->display();
//echo '<div id='subpanels'>';
//require_once('subpanels.php');
//echo '</div>';

1018
modules/EcmServices/Email.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,378 @@
<?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 - 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".
* *******************************************************************************/
/*********************************************************************************
* Description:
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
* Reserved. Contributor(s): ______________________________________..
*********************************************************************************/
/*
if(isset($_REQUEST['type']) && $_REQUEST['type'] == "save_template_changes") {
require_once('modules/EmailTemplates/EmailTemplate.php');
$et = new EmailTemplate();
$et->retrieve($_REQUEST['email_template']);
if(isset($et->id) && $et->id != '') {
$et->name = $_REQUEST['new_template_name'];
$et->body = $_REQUEST['description'];
$et->body_html = $_REQUEST['descriptin_html'];
$et->save();
}
header("Location: index.php?action=Emails&module=EcmServices&to_pdf=1&type=out&record=$return_id&quote_id=".$_REQUEST['quote_id']."&sended=1&pTypeFrom=Users&pIdFrom=".$_REQUEST['pIdFrom']."&pTypeTo=".$_REQUEST['pTypeTo']."&pIdTo=".$_REQUEST['pIdTo']);
}
if(isset($_REQUEST['type']) && $_REQUEST['type'] == "save_template_as_new") {
echo "save_template_as_new";
die();
}
*/
//var_dump($_POST); die();
require_once('modules/Emails/Email.php');
$mod_strings = return_module_language($current_language, 'Emails');
///////////////////////////////////////////////////////////////////////////////
//// EMAIL SEND/SAVE SETUP
$focus = new Email();
if(!isset($prefix)) {
$prefix = '';
}
if(isset($_POST[$prefix.'meridiem']) && !empty($_POST[$prefix.'meridiem'])) {
$_POST[$prefix.'time_start'] = $timedate->merge_time_meridiem($_POST[$prefix.'time_start'], $timedate->get_time_format(true), $_POST[$prefix.'meridiem']);
}
//retrieve the record
if(isset($_POST['record']) && !empty($_POST['record'])) {
$focus->retrieve($_POST['record']);
}
if(isset($_REQUEST['user_id'])) {
$focus->assigned_user_id = $_REQUEST['user_id'];
}
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;
}
//populate the fields of this Email
$allfields = array_merge($focus->column_fields, $focus->additional_column_fields);
foreach($allfields as $field) {
if(isset($_POST[$field])) {
$value = $_POST[$field];
$focus->$field = $value;
}
}
if (!isset($_REQUEST['to_addrs'])) {
$_REQUEST['to_addrs'] = "";
}
if (!isset($_REQUEST['to_addrs_ids'])) {
$_REQUEST['to_addrs_ids'] = "";
}
if (!isset($_REQUEST['to_addrs_names'])) {
$_REQUEST['to_addrs_names'] = "";
}
if (!isset($_REQUEST['to_addrs_emails'])) {
$_REQUEST['to_addrs_emails'] = "";
}
//compare the 3 fields and return list of contact_ids to link:
$focus->to_addrs_arr = $focus->parse_addrs($_REQUEST['to_addrs'], $_REQUEST['to_addrs_ids'], $_REQUEST['to_addrs_names'], $_REQUEST['to_addrs_emails']);
// make sure the cc_* and bcc_* fields are at least empty if not set
$fields_to_check = array(
'cc_addrs',
'cc_addrs_ids',
'bcc_addrs',
'bcc_addrs_ids',
'cc_addrs_names',
'cc_addrs_emails',
'bcc_addrs_emails',
);
foreach ($fields_to_check as $field_to_check) {
if (!isset($_REQUEST[$field_to_check])) {
$_REQUEST[$field_to_check] = '';
}
}
$focus->cc_addrs_arr = $focus->parse_addrs($_REQUEST['cc_addrs'], $_REQUEST['cc_addrs_ids'], $_REQUEST['cc_addrs_names'], $_REQUEST['cc_addrs_emails']);
$focus->bcc_addrs_arr = $focus->parse_addrs($_REQUEST['bcc_addrs'], $_REQUEST['bcc_addrs_ids'], $_REQUEST['to_addrs_names'], $_REQUEST['bcc_addrs_emails']);
if(!empty($_REQUEST['type'])) {
$focus->type = $_REQUEST['type'];
} elseif(empty($focus->type)) { // cn: from drafts/quotes
$focus->type = 'archived';
}
///////////////////////////////////////////////////////////////////////////////
//// PREP FOR ATTACHMENTS
if(empty($focus->id)){
$focus->id = create_guid();
$focus->new_with_id = true;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// ATTACHMENT HANDLING
$focus->handleAttachments();
if(isset($_REQUEST['quote_id']) && $_REQUEST['quote_id'] != '') {
require_once('modules/EcmServices/EcmService.php');
$off = new EcmService();
$off->retrieve($_REQUEST['quote_id']);
$off->formatNumber();
if(isset($off->id) && $off->id != '') {
require_once('modules/Notes/Note.php');
$n = new Note();
$n->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$off->createPdfFileName(false);
$n->filename = $off->createPdfFileName();
$n->file_mime_type = 'application/pdf';
$n->parent_id = $focus->id;
$n->parent_type = $focus->module_dir;
$n->parent_name = $focus->name;
$nid = $n->save();
//var_dump($sugar_config['upload_dir'].'oferta.pdf'); die();
//echo $off->name; die();
//global $sugar_config;
if($nid) $off->getPDF(null,'F',$sugar_config['upload_dir'].$nid);
$focus->saved_attachments[] = $n;
}
$off->setTemplate();
$off->loadParser();
$focus->name = $off->template->mfp->parseText($focus->name);
$focus->description = $off->template->mfp->parseText($focus->description);
$focus->description_html = $off->template->mfp->parseText($focus->description_html);
}
///////////////////////////////////////////////////////////////////////////////
//// TEMPLATE PARSING
// cn: bug 7244 - need to pass an empty bean to parse email templates
$object_arr = array();
if(!empty($focus->parent_id)) {
$object_arr[$focus->parent_type] = $focus->parent_id;
}
if(isset($focus->to_addrs_arr[0]['contact_id'])) {
$object_arr['Contacts'] = $focus->to_addrs_arr[0]['contact_id'];
}
if(empty($object_arr)) {
$object_arr = array('Contacts' => '123');
}
// do not parse email templates if the email is being saved as draft....
if($focus->type != 'draft' && count($object_arr) > 0) {
require_once($beanFiles['EmailTemplate']);
$focus->name = EmailTemplate::parse_template($focus->name, $object_arr);
$focus->description = EmailTemplate::parse_template($focus->description, $object_arr);
$focus->description_html = EmailTemplate::parse_template($focus->description_html, $object_arr);
// if($focus->description == '') $focus->description = strip_tags(str_replace("<br>","\n",$focus->description_html));
// if($focus->description_html == '') $focus->description_html = str_replace("\n","<br>",$focus->description);
}
//// END TEMPLATE PARSING
///////////////////////////////////////////////////////////////////////////////
/*
var_dump($focus->parent_id);
var_dump($focus->saved_attachments[0]->name);
var_dump($focus->saved_attachments[0]->parent_name);
*/
//var_dump($focus->saved_attachments[0]->file);
//die();
//// END ATTACHMENT HANDLING
///////////////////////////////////////////////////////////////////////////////
$focus->status = 'draft';
if($focus->type == 'archived' ) {
$focus->status= 'archived';
} elseif(($focus->type == 'out' || $focus->type == 'forward') && isset($_REQUEST['send']) && $_REQUEST['send'] == '1') {
///////////////////////////////////////////////////////////////////////////
//// REPLY PROCESSING
$old = array('&lt;','&gt;');
$new = array('<','>');
if($_REQUEST['from_addr'] != $_REQUEST['from_addr_name'].' &lt;'.$_REQUEST['from_addr_email'].'&gt;') {
if(false === strpos($_REQUEST['from_addr'], '&lt;')) { // we have an email only?
$focus->from_addr = $_REQUEST['from_addr'];
$focus->from_name = '';
} else { // we have a compound string
$newFromAddr = str_replace($old, $new, $_REQUEST['from_addr']);
$focus->from_addr = substr($newFromAddr, (1 + strpos($newFromAddr, '<')), (strpos($newFromAddr, '>') - strpos($newFromAddr, '<')) -1 );
$focus->from_name = substr($newFromAddr, 0, (strpos($newFromAddr, '<') -1));
}
} elseif(!empty($_REQUEST['from_addr_email']) && isset($_REQUEST['from_addr_email'])) {
$focus->from_addr = $_REQUEST['from_addr_email'];
$focus->from_name = $_REQUEST['from_addr_name'];
} else {
$focus->from_addr = $focus->getSystemDefaultEmail();
}
//// REPLY PROCESSING
///////////////////////////////////////////////////////////////////////////
if($focus->send()) {
$focus->status = 'sent';
} else {
$focus->status = 'send_error';
}
}
$focus->to_addrs = $_REQUEST['to_addrs'];
// delete the existing relationship of all the email addresses with this email
$query = "update emails_email_addr_rel set deleted = 1 WHERE email_id = '{$focus->id}'";
$focus->db->query($query);
// delete al the relationship of this email with all the beans
$query = "update emails_beans set deleted = 1, bean_id = '', bean_module = '' WHERE email_id = '{$focus->id}'";
$focus->db->query($query);
if(isset($_REQUEST['object_type']) && !empty($_REQUEST['object_type']) && isset($_REQUEST['object_id']) && !empty($_REQUEST['object_id'])) {
//run linking code only if the object_id has not been linked as part of the contacts above
$GLOBALS['log']->debug("CESELY".$_REQUEST['object_type']);
if(!in_array($_REQUEST['object_id'],$exContactIds)){
$rel = strtolower($_REQUEST['object_type']);
$focus->load_relationship($rel);
$focus->$rel->add($_REQUEST['object_id']);
$GLOBALS['log']->debug("CESELY LOADED".$_REQUEST['object_type']);
}
}
//// handle legacy parent_id/parent_type relationship calls
elseif(isset($_REQUEST['parent_type']) && !empty($_REQUEST['parent_type']) && isset($_REQUEST['parent_id']) && !empty($_REQUEST['parent_id'])) {
//run linking code only if the object_id has not been linked as part of the contacts above
if(!isset($exContactIds) || !in_array($_REQUEST['parent_id'],$exContactIds)){
$rel = strtolower($_REQUEST['parent_type']);
$focus->load_relationship($rel);
$focus->$rel->add($_REQUEST['parent_id']);
}
}
//// END RELATIONSHIP LINKING
///////////////////////////////////////////////////////////////////////////////
// If came from email archiving edit view, this would have been set from form input.
if (!isset($focus->date_start))
{
$today = gmdate('Y-m-d H:i:s');
$focus->date_start = $timedate->to_display_date($today);
$focus->time_start = $timedate->to_display_time($today, true);
}
$focus->date_sent = "";
$focus->save(false);
//zmiana statusu na Sent
if(isset($_REQUEST['quote_id']) && $_REQUEST['quote_id'] != '') {
$query = "UPDATE ecmservices SET status='s50' WHERE id='".$_REQUEST['quote_id']."'";
$result = $GLOBALS['db']->query($query);
}
//// END EMAIL SAVE/SEND SETUP
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// RELATIONSHIP LINKING
$focus->load_relationship('users');
$focus->users->add($current_user->id);
if(!empty($_REQUEST['to_addrs_ids'])) {
$focus->load_relationship('contacts');
$exContactIds = explode(';', $_REQUEST['to_addrs_ids']);
foreach($exContactIds as $contactId) {
$contactId = trim($contactId);
$focus->contacts->add($contactId);
}
}
///////////////////////////////////////////////////////////////////////////////
//// PAGE REDIRECTION
///////////////////////////////////////////////////////////////////////////////
$return_id = $focus->id;
if(empty($_POST['return_module'])) {
$return_module = "Emails";
} else {
$return_module = $_POST['return_module'];
}
if(empty($_POST['return_action'])) {
$return_action = "DetailView";
} else {
$return_action = $_POST['return_action'];
}
$GLOBALS['log']->debug("Saved record with id of ".$return_id);
require_once('include/formbase.php');
if($focus->type == 'draft') {
if($return_module == 'Emails') {
header("Location: index.php?module=$return_module&action=ListViewDrafts");
} else {
handleRedirect($return_id, 'Emails');
}
} elseif($focus->type == 'out') {
if($return_module == 'Home') {
header('Location: index.php?module='.$return_module.'&action=index');
}
if(!empty($_REQUEST['return_id'])) {
$return_id = $_REQUEST['return_id'];
}
header('Location: index.php?action='.$return_action.'&module='.$return_module.'&record='.$return_id.'&assigned_user_id='.$current_user->id.'&type=inbound');
} elseif(isset($_POST['return_id']) && $_POST['return_id'] != "") {
$return_id = $_POST['return_id'];
}
if(isset($_REQUEST['quote_id']) && $_REQUEST['quote_id'] != '') {
require_once('modules/EcmServices/EcmService.php');
$off = new EcmService();
$off->retrieve($_REQUEST['quote_id']);
if(isset($off->id) && $off->id != '') {
$off->format_all_fields();
$off->email_id = $return_id;
$off->save();
}
}
header("Location: index.php?action=Emails&module=EcmServices&to_pdf=1&type=out&quote_id=".$_REQUEST['quote_id']."&sended=1&pTypeFrom=Users&pIdFrom=".$_REQUEST['pIdFrom']."&pTypeTo=".$_REQUEST['pTypeTo']."&pIdTo=".$_REQUEST['pIdTo']."&bodyclass=".$_REQUEST['bodyclass']);
?>

View File

@@ -0,0 +1,557 @@
<!--
/**
* EditView for Email
*
* 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".
*/
-->
<!-- BEGIN: main -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="">
<title></title>
<script type="text/javascript" src="include/javascript/sugar_grp1_yui.js?s=5.0.0c&c="></script>
<script type="text/javascript" src="include/javascript/sugar_grp1.js?s=5.0.0c&c="></script>
<script type="text/javascript" src="include/javascript/sugar_3.js?s=5.0.0c&c="></script>
<script type="text/javascript" src="include/javascript/sugar_grp1.js?s=5.0.0c&c="></script>
<script type="text/javascript" src="jscalendar/lang/calendar-en.js?s=5.0.0c&c="></script>
<script type="text/javascript" src="include/SugarFields/Fields/Address/SugarFieldAddress.js?s=5.0.0c&c="></script>
<script type="text/javascript" src="cache/jsLanguage/en_us.js?s=5.0.0c&c=&j=1">
</script><script type="text/javascript" src="cache/jsLanguage/Accounts/en_us.js?s=5.0.0c&c=&j=1"></script>
<script type="text/javascript" src="jssource/src_files/include/SugarEmailAddress/SugarEmailAddress.js?s=5.0.0c&c="></script>
<link rel="stylesheet" type="text/css" href="themes/Sugar/navigation.css?s=5.0.0c&c=" />
<link rel="stylesheet" type="text/css" href="themes/Sugar/style.css?s=5.0.0c&c=" />
<link rel="stylesheet" type="text/css" href="themes/Sugar/colors.sugar.css?s=5.0.0c&c=" id="current_color_style" />
<link rel="stylesheet" type="text/css" href="themes/Sugar/fonts.normal.css?s=5.0.0c&c=" id="current_font_style"/>
<script language="javascript" src="themes/default/SiteMapJS.js?s=5.0.0c&c="></script>
<script language="javascript" src="themes/menu.js?s=5.0.0c&c="></script>
<script language="javascript" src="themes/cookie.js?s=5.0.0c&c="></script>
<script language="javascript" src="themes/Sugar/style.js?s=5.0.0c&c="></script>
<script language="javascript" src="include/JSON.js?s=5.0.0c&c="></script>
<script type="text/javascript" language="Javascript">
{JS_VARS}
</script>
</head>
<body class="{BODYCLASS}" style="border:none;" onload="">
<script type="text/javascript" src="include/jsolait/init.js?s={SUGAR_VERSION}&amp;c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/jsclass_base.js?s={SUGAR_VERSION}&amp;c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/jsclass_async.js?s={SUGAR_VERSION}&amp;c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="modules/EcmServices/Email.js?s={SUGAR_VERSION}&amp;c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="modules/Documents/documents.js?s={SUGAR_VERSION}&amp;c={JS_CUSTOM_VERSION}"></script>
{MESSAGE}
<script language="javascript">
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 saveEmailTemplate() {
doRequest(
'index.php',
'module=EcmServices&action=saveEmailTemplate&template_id='+document.forms.EditView.email_template.value+'&template_name='+document.forms.EditView.new_template_name.value+'&name='+document.forms.EditView.name.value+'&'
);
}
*/
function saveTemplateChanges() {
document.forms.EditView.module.value="EcmServices";
document.forms.EditView.action.value="EmailSave";
document.forms.EditView.type.value="save_template_changes";
}
function saveTemplateAsNew() {
document.forms.EditView.module.value="EcmServices";
document.forms.EditView.action.value="EmailSave";
document.forms.EditView.type.value="save_template_as_new";
}
</script>
<form action="index.php" method="post" name="EditView" enctype="multipart/form-data">
<input type="hidden" name="module" value="EcmServices" />
<input type="hidden" name="action" value="EmailSave" />
<input type="hidden" name="to_pdf" value="1" />
<input type="hidden" name="contact_id" value="{CONTACT_ID}" />
<input type="hidden" name="user_id" value="{USER_ID}" />
<input type="hidden" name="return_module" value="{RETURN_MODULE}" />
<input type="hidden" name="return_id" value="{RETURN_ID}" />
<input type="hidden" name="send" value="" />
<input type="hidden" name="type" value="out" />
<input type="hidden" name="record" value="{ID}" />
<input type="hidden" name="return_action" value="{RETURN_ACTION}" />
<input type="hidden" name="inbound_email_id" value="{INBOUND_EMAIL_ID}" />
<input type="hidden" name="assigned_user_id" value="{ASSIGNED_USER_ID}" />
<input type="hidden" name="object_type" value="{OBJECT_TYPE}" />
<input type="hidden" name="object_id" value="{OBJECT_ID}" />
<input type="hidden" name="group" value="{GROUP}" />
<input type="hidden" name="origType" value="{TYPE}" />
<input type="hidden" name="quote_id" value="{QUOTE_ID}" />
<input type="hidden" name="pIdFrom" value="{PIDFROM}" />
<input type="hidden" name="pTypeFrom" value="{PTYPEFROM}" />
<input type="hidden" name="pIdTo" value="{PIDTO}" />
<input type="hidden" name="pTypeTo" value="{PTYPETO}" />
<input type="hidden" name="bodyclass" value="{BODYCLASS}" />
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-bottom: 2px;">
<input type="submit" name="button" class="button" {disable_send} title="{MOD.LBL_SEND_BUTTON_TITLE}" accesskey="{MOD.LBL_SEND_BUTTON_KEY}" value=" {MOD.LBL_SEND_BUTTON_LABEL} " onclick="return quoteAlert('save');" />
<!--
<input type="submit" name="button" class="button" title="{MOD.LBL_SAVE_AS_DRAFT_BUTTON_TITLE}" accesskey="{MOD.LBL_SAVE_AS_DRAFT_BUTTON_KEY}" value=" {MOD.LBL_SAVE_AS_DRAFT_BUTTON_LABEL} " onclick="return quoteAlert('save_draft');" />
<input type="submit" name="button" class="button" title="{APP.LBL_CANCEL_BUTTON_TITLE}" accesskey="{APP.LBL_CANCEL_BUTTON_KEY}" value=" {APP.LBL_CANCEL_BUTTON_LABEL} " onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'; {MYINBOX}" />
-->
</td>
<td align="right" nowrap>
</td>
<td align='right'>
{ADMIN_EDIT}
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- BEGIN: open_source_1 -->
<td nowrap>
<slot>
</slot>
</td>
<td nowrap>
<slot>
</slot>
</td>
<!-- END: open_source_1 -->
<td nowrap>
<slot>
</slot>
</td>
<td class="dataLabel" valign="top" align="right">
<div style="display:none;">
<slot>
<select tabindex='2' name='parent_type' onchange=" document.EditView.parent_name.value='';
changeQS();
checkParentType(document.EditView.parent_type.value, document.EditView.change_parent);">
{TYPE_OPTIONS}</select>&nbsp;
</slot>
</div>
</td>
<td class="dataField" nowrap>
<div style="display:none;">
<slot>
<input id='parent_id' name='parent_id' type="hidden" value='{PARENT_ID}'>
<input class="sqsEnabled" id='parent_name' name='parent_name' tabindex='2' type='text' value="{PARENT_NAME}">
&nbsp;{CHANGE_PARENT_BUTTON}
</slot>
</div>
</td>
</tr>
<tr>
<td class="dataLabel">
<div style="display:none;">
<slot>
{APP.LBL_ASSIGNED_TO}&nbsp;
</slot>
</div>
</td>
<td class="dataField">
<div style="display:none;">
<slot>
<input class="sqsEnabled" tabindex='1' id="assigned_user_name" name='assigned_user_name' type="text" value="{ASSIGNED_USER_NAME}">
<input id='assigned_user_id' name='assigned_user_id' type="hidden" value="{ASSIGNED_USER_ID}" />
<input title="{APP.LBL_SELECT_BUTTON_TITLE}" accesskey="{APP.LBL_SELECT_BUTTON_KEY}" type="button" tabindex='1' class="button" value='{APP.LBL_SELECT_BUTTON_LABEL}' name="btn1" onclick='open_popup("Users", 600, 400, "", true, false, {encoded_users_popup_request_data});' />
</slot>
</div>
</td>
<td nowrap>
<slot>
</slot>
</td>
<td nowrap>
<slot>
</slot>
</td>
<td nowrap>
<slot>
</slot>
</td>
</tr>
<tr>
<td colspan="5">
&nbsp;
</td>
</tr>
<tr>
<td colspan="1">
&nbsp;
</td>
<td colspan="4">
{MOD.LBL_NOTE_SEMICOLON}
</td>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr valign="top">
<td class="dataLabel">
<slot>
{MOD.LBL_TO}
</slot>
</td>
<td colspan="4" class="dataField" nowrap="NOWRAP">
<slot>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<textarea id="to_addrs_field" name='to_addrs' tabindex='3' cols="80" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" value="{TO_ADDRS}">{TO_ADDRS}</textarea>
<input type="hidden" id="to_addrs_ids" name="to_addrs_ids" value="{TO_ADDRS_IDS}" />
<input type="hidden" id="to_addrs_emails" name="to_addrs_emails" value="{TO_ADDRS_EMAILS}" />
<input type="hidden" id="to_addrs_names" name="to_addrs_names" value="{TO_ADDRS_NAMES}" />
</td>
<td style="padding-left: 4px;">
{CHANGE_TO_ADDRS_BUTTON}
</td>
</tr>
</table>
</slot>
</td>
</tr>
<tr>
<td class="dataLabel">
<slot>
{MOD.LBL_CC}
</slot>
</td>
<td class="dataField" colspan="4" nowrap="NOWRAP">
<slot>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<textarea id="cc_addrs_field" name='cc_addrs' tabindex='3' cols="80" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" value="{CC_ADDRS}">{CC_ADDRS}</textarea>
<input type="hidden" id="cc_addrs_ids" name="cc_addrs_ids" value="{CC_ADDRS_IDS}" />
<input type="hidden" id="cc_addrs_emails" name="cc_addrs_emails" value="{CC_ADDRS_EMAILS}" />
<input type="hidden" id="cc_addrs_names" name="cc_addrs_names" value="{CC_ADDRS_NAMES}" />
</td>
<td style="padding-left: 4px;">
{CHANGE_CC_ADDRS_BUTTON}
</td>
</tr>
</table>
</slot>
</td>
</tr>
<tr valign="top">
<td class="dataLabel">
<slot>
{MOD.LBL_BCC}
</slot>
</td>
<td class="dataField" colspan="4" nowrap="NOWRAP">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<textarea id="bcc_addrs_field" name='bcc_addrs' tabindex='3' cols="80" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" value="{BCC_ADDRS}">{BCC_ADDRS}</textarea>
<input type="hidden" id="bcc_addrs_ids" name="bcc_addrs_ids" value="{BCC_ADDRS_IDS}" />
<input type="hidden" id="bcc_addrs_emails" name="bcc_addrs_emails" value="{BCC_ADDRS_EMAILS}" />
<input type="hidden" id="bcc_addrs_names" name="bcc_addrs_names" value="{BCC_ADDRS_NAMES}" />
</td>
<td style="padding-left: 4px;">
{CHANGE_BCC_ADDRS_BUTTON}
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td class="dataLabel">
<slot>
{MOD.LBL_FROM}
</slot>
</td>
<td class="dataField" colspan="4" nowrap="NOWRAP">
<slot>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<textarea id="from_addr_field" name='from_addr' tabindex='3' cols="80" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" value="{FROM_ADDR}">{FROM_ADDR}</textarea> {FROM_ADDR_GROUP}
<input type="hidden" id="from_addr_email" name="from_addr_email" />
<input type="hidden" id="from_addr_name" name="from_addr_name" />
</td>
</tr>
</table>
</slot>
</td>
</tr>
<tr>
<td colspan="5">
&nbsp;
</td>
</tr>
<tr>
<td class="dataLabel">
<slot>
{MOD.LBL_SUBJECT}
</slot>
</td>
<td colspan='4' class="dataField">
<slot>
<textarea name='name' tabindex='4' cols="100" rows="1" style="height: 1.6.em; overflow-y:auto; font-family:sans-serif,monospace; font-size:inherit;" id="subjectfield">{NAME}</textarea>
</slot>
</td>
</tr>
<tr>
<td valign="top" class="dataLabel">
{MOD.LBL_BODY}
</td>
<!-- BEGIN: htmlarea -->
<td colspan="2" class="dataField">
<div style="display:none;">
<slot>
<div id="editor_select">
<input id="setEditor" name="setEditor" value="1" {EMAIL_EDITOR_OPTION} type="checkbox" onclick="toggle_textonly();" />
{MOD.LBL_EMAIL_EDITOR_OPTION}
</div>
</slot>
</div>
</td>
<td class="dataLabel" valign="top">
<slot>
{MOD.LBL_USE_TEMPLATE}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select tabindex='2' name='email_template' onchange="fill_email(this.options[this.selectedIndex].value);">
{EMAIL_TEMPLATE_OPTIONS}
</select>
&nbsp;&nbsp;
<input type="button" class="button" name="clear" id="clear" value="Clear" onclick="fill_email('');">
&nbsp;&nbsp;
<input type="button" class="button" name="new_template" id="new_template" value="Template Fields" onclick="document.getElementById('template_fields').style.display='';" />
</slot>
</td>
<td class="dataField" nowrap width="1">
<slot>
</slot>
</td>
</tr>
<tr>
<td></td>
<td colspan="4">
<div id="template_fields" style="display:none">
<table>
<tr>
<td valign="top" class="dataLabel">
Templatate Fields:
</td>
<td colspan="5" class="dataField">
<slot>
{MFP}
<input type="button" class="button" name="cancel_template_fields" id="cancel_template_fields" value="Hide" onclick="document.getElementById('template_fields').style.display='none';">
</slot>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td valign="top" class="dataLabel">
&nbsp;
</td>
<td colspan="4" class="dataField">
{TINY}
<slot>
<div style="display:none;">
<div id="html_div">
<textarea id="description_html" onblur="">{DESCRIPTION_HTML}</textarea>
</div>
</div>
<div style="display:none;">
<div id="alt_text_div">
<input id="toggle_textarea_elem" onclick="toggle_textarea();" type="checkbox" name="toggle_html">
{MOD.LBL_EDIT_ALT_TEXT}
</div>
</div>
<div id="text_div" style="display: none;">
</div>
<textarea tabindex='5' id="description" name='description' cols="100" rows="20">{DESCRIPTION}</textarea>
</slot>
</td>
<!-- END: htmlarea -->
</tr>
<tr>
<td valign="top" class="dataLabel">
{MOD.LBL_ATTACHMENTS}
</td>
<td colspan="4">
{ATTACHMENTS_JAVASCRIPT} {ATTACHMENTS}
<div id="template_attachments">
</div>
<div id="uploads_div">
<div style="display: none" id="file0">
<input id='email_attachment0' name='email_attachment0' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('0');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file1">
<input id='email_attachment1' name='email_attachment1' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('1');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file2">
<input id='email_attachment2' name='email_attachment2' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('2');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file3">
<input id='email_attachment3' name='email_attachment3' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('3');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file4">
<input id='email_attachment4' name='email_attachment4' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('4');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file5">
<input id='email_attachment5' name='email_attachment5' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('5');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file6">
<input id='email_attachment6' name='email_attachment6' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('6');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file7">
<input id='email_attachment7' name='email_attachment7' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('7');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file8">
<input id='email_attachment8' name='email_attachment8' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('8');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="file9">
<input id='email_attachment9' name='email_attachment9' tabindex='0' size='40' type='file' />
&nbsp;<input type="button" onclick="deleteFile('9');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document0">
<input name='documentId0' id='documentId0' tabindex='0' type='hidden' />
<input name='documentName0' id='documentName0' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('0');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('0');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document1">
<input name='documentId1' id='documentId1' tabindex='1' type='hidden' />
<input name='documentName1' id='documentName1' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('1');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('1');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document2">
<input name='documentId2' id='documentId2' tabindex='2' type='hidden' />
<input name='documentName2' id='documentName2' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('2');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('2');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document3">
<input name='documentId3' id='documentId3' tabindex='3' type='hidden' />
<input name='documentName3' id='documentName3' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('3');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('3');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document4">
<input name='documentId4' id='documentId4' tabindex='4' type='hidden' />
<input name='documentName4' id='documentName4' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('4');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('4');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document5">
<input name='documentId5' id='documentId5' tabindex='5' type='hidden' />
<input name='documentName5' id='documentName5' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('5');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('5');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document6">
<input name='documentId6' id='documentId6' tabindex='6' type='hidden' />
<input name='documentName6' id='documentName6' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('6');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('6');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document7">
<input name='documentId7' id='documentId7' tabindex='7' type='hidden' />
<input name='documentName7' id='documentName7' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('7');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('7');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document8">
<input name='documentId8' id='documentId8' tabindex='8' type='hidden' />
<input name='documentName8' id='documentName8' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('8');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('8');" class="button" value="{APP.LBL_REMOVE}" />
</div>
<div style="display: none" id="document9">
<input name='documentId9' id='documentId9' tabindex='9' type='hidden' />
<input name='documentName9' id='documentName9' disabled size='40' type='text' />
&nbsp;<input type="button" onclick="selectDocument('9');" class="button" value="{APP.LBL_SELECT_BUTTON_LABEL}" /><input type="button" onclick="deleteDocument('9');" class="button" value="{APP.LBL_REMOVE}" />
</div>
</div>
<input type="button" name="add_file_button" onclick="addFile();" value="{MOD.LBL_ADD_FILE}" class="button" />
<input type="button" name="add_document_button" onclick="addDocument();" value="{MOD.LBL_ADD_DOCUMENT}" class="button" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
{JAVASCRIPT}
</body>
</html>
<!-- END: main -->

View File

@@ -0,0 +1,889 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* EditView for Email
*
* 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".
*/
$toTemplate = '';
if(isset($_REQUEST['pTypeTo']) && $_REQUEST['pTypeTo']!='' && isset($_REQUEST['pIdTo']) && $_REQUEST['pIdTo']!='') {
if($_REQUEST['pTypeTo'] == "Accounts") {
require_once('modules/Accounts/Account.php');
$acc = new Account();
$acc->retrieve($_REQUEST['pIdTo']);
if(isset($acc->id) && $acc->id!='') {
$_REQUEST['to_addrs'] = $acc->name.' <'.$acc->email1.'>; ';
}
}
if($_REQUEST['pTypeTo'] == "Contacts") {
require_once('modules/Contacts/Contact.php');
$con = new Contact();
$con->retrieve($_REQUEST['pIdTo']);
if(isset($con->id) && $con->id!='') {
$_REQUEST['to_addrs'] = $con->name.' <'.$con->email1.'>; ';
}
}
}
if(isset($_REQUEST['pTypeTo']) && $_REQUEST['pTypeTo']!='')
if($_REQUEST['pTypeTo'] == "Accounts") $toTemplate = 'QuoteTemplateAccount';
else
if($_REQUEST['pTypeTo'] == "Contacts") $toTemplate = 'QuoteTemplateContact';
if(isset($_REQUEST['pTypeFrom']) && $_REQUEST['pTypeFrom']!='' && isset($_REQUEST['pIdFrom']) && $_REQUEST['pIdFrom']!='') {
if($_REQUEST['pTypeFrom'] == "Users") {
require_once('modules/Users/User.php');
$us = new User();
global $current_user;
$us->retrieve($current_user->id);//$_REQUEST['pIdFrom']);
if(isset($us->id) && $us->id!='') {
$_REQUEST['from_addr'] = $us->name.' <'.$us->email1.'>; ';
}
}
}
echo '<script type="text/javascript">var asynchronous_key = "'.$_SESSION['asynchronous_key'].'";</script>';
$GLOBALS['log']->info("Email edit view");
require_once('include/SugarTinyMCE.php');
require_once('modules/Emails/Email.php');
require_once('modules/EmailTemplates/EmailTemplate.php');
require_once('XTemplate/xtpl.php');
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once($theme_path.'layout_utils.php');
global $app_strings;
global $app_list_strings;
global $current_user;
global $sugar_version, $sugar_config;
global $timedate;
$mod_strings = return_module_language($current_language, 'Emails');
$OPT = array();
if(isset($_REQUEST['quote_id']) && $_REQUEST['quote_id']!='') {
$OPT['quote_id'] = $_REQUEST['quote_id'];
} else $OPT['quote_id'] = '';
if(isset($_REQUEST['sended']) && $_REQUEST['sended']!='') {
$OPT['sended'] = $_REQUEST['sended'];
} else $OPT['sended'] = '0';
$json = getJSONobj();
echo '<script language="javascript">
var OPT = '.$json->encode($OPT).';
function quoteAlert(method) {
if(OPT[\'quote_id\']==\'\') {
alert(\'Quote not saved!\');
return false;
}
if(method == \'save\') {
prepSave(); document.forms.EditView.action.value=\'EmailSave\'; document.forms.EditView.send.value=\'1\'; document.forms.EditView.type.value=\'out\'; return fill_form(\'out\', \''.$mod_strings['ERR_NOT_ADDRESSED'].'\');
}
if(method == \'save_draft\') {
document.forms.EditView.action.value=\'EmailSave\'; document.forms.EditView.send.value=\'0\'; document.forms.EditView.type.value=\'draft\'; fill_form(\'draft\', \''.$mod_strings['ERR_NOT_ADDRESSED'].'\');
}
};
if(OPT[\'sended\']==\'1\') alert(\'Email was sended\');
</script>';
///////////////////////////////////////////////////////////////////////////////
//// PREPROCESS BEAN DATA FOR DISPLAY
$focus = new Email();
$email_type = 'archived';
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
}
if(!empty($_REQUEST['type'])) {
$email_type = $_REQUEST['type'];
} elseif(!empty($focus->id)) {
$email_type = $focus->type;
}
$focus->type = $email_type;
//needed when creating a new email with default values passed in
if(isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) {
$focus->contact_name = $_REQUEST['contact_name'];
}
if(!empty($_REQUEST['load_id']) && !empty($beanList[$_REQUEST['load_module']])) {
$class_name = $beanList[$_REQUEST['load_module']];
require_once($beanFiles[$class_name]);
$contact = new $class_name();
if($contact->retrieve($_REQUEST['load_id'])) {
$link_id = $class_name . '_id';
$focus->$link_id = $_REQUEST['load_id'];
$focus->contact_name = (isset($contact->full_name)) ? $contact->full_name : $contact->name;
$focus->to_addrs_names = $focus->contact_name;
$focus->to_addrs_ids = $_REQUEST['load_id'];
//Retrieve the email address.
//If Opportunity or Case then Oppurtinity/Case->Accounts->(email_addr_bean_rel->email_addresses)
//If Contacts, Leads etc.. then Contact->(email_addr_bean_rel->email_addresses)
$sugarEmailAddress = new SugarEmailAddress();
if($class_name == 'Opportunity' || $class_name == 'aCase'){
$account = new Account();
if($contact->account_id != null && $account->retrieve($contact->account_id)){
$sugarEmailAddress->handleLegacyRetrieve($account);
if(isset($account->email1)){
$focus->to_addrs_emails = $account->email1;
$focus->to_addrs = "$focus->contact_name <$account->email1>";
}
}
}
else{
$sugarEmailAddress->handleLegacyRetrieve($contact);
if(isset($contact->email1)){
$focus->to_addrs_emails = $contact->email1;
$focus->to_addrs = "$focus->contact_name <$contact->email1>";
}
}
if(!empty($_REQUEST['parent_type']) && empty($app_list_strings['record_type_display'][$_REQUEST['parent_type']])){
if(!empty($app_list_strings['record_type_display'][$_REQUEST['load_module']])){
$_REQUEST['parent_type'] = $_REQUEST['load_module'];
$_REQUEST['parent_id'] = $focus->contact_id;
$_REQUEST['parent_name'] = $focus->to_addrs_names;
} else {
unset($_REQUEST['parent_type']);
unset($_REQUEST['parent_id']);
unset($_REQUEST['parent_name']);
}
}
}
}
if(isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) {
$focus->contact_id = $_REQUEST['contact_id'];
}
if(isset($_REQUEST['parent_name'])) {
$focus->parent_name = $_REQUEST['parent_name'];
}
if(isset($_REQUEST['parent_id'])) {
$focus->parent_id = $_REQUEST['parent_id'];
}
if(isset($_REQUEST['parent_type'])) {
$focus->parent_type = $_REQUEST['parent_type'];
}
elseif(is_null($focus->parent_type)) {
$focus->parent_type = $app_list_strings['record_type_default_key'];
}
if(isset($_REQUEST['to_email_addrs'])) {
$focus->to_addrs = $_REQUEST['to_email_addrs'];
}
// needed when clicking through a Contacts detail view:
if(isset($_REQUEST['to_addrs_ids'])) {
$focus->to_addrs_ids = $_REQUEST['to_addrs_ids'];
}
if(isset($_REQUEST['to_addrs_emails'])) {
$focus->to_addrs_emails = $_REQUEST['to_addrs_emails'];
}
if(isset($_REQUEST['to_addrs_names'])) {
$focus->to_addrs_names = $_REQUEST['to_addrs_names'];
}
if(isset($_REQUEST['to_addrs'])) {
$focus->to_addrs = $_REQUEST['to_addrs'];
}// user's email, go through 3 levels of precedence:
if(isset($_REQUEST['from_addr'])) {
$focus->from_addr = $_REQUEST['from_addr'];
}// user's email, go through 3 levels of precedence:
$from = $current_user->getEmailInfo();
//// END PREPROCESSING
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// XTEMPLATE ASSIGNMENT
if($email_type == 'archived') {
// echo get_module_title('Emails', $mod_strings['LBL_ARCHIVED_MODULE_NAME'].":", true);
$xtpl=new XTemplate('modules/Emails/EditViewArchive.html');
} else {
// echo get_module_title('Emails', $mod_strings['LBL_COMPOSE_MODULE_NAME'].":", true);
$xtpl=new XTemplate('modules/EcmServices/Emails.html');
}
echo "\n</p>\n";
// CHECK USER'S EMAIL SETTINGS TO ENABLE/DISABLE 'SEND' BUTTON
if(!$focus->check_email_settings() &&($email_type == 'out' || $email_type == 'draft')) {
print "<font color='red'>".$mod_strings['WARNING_SETTINGS_NOT_CONF']." <a href='index.php?module=Users&action=EditView&record=".$current_user->id."&return_module=Emails&type=out&return_action=EditView'>".$mod_strings['LBL_EDIT_MY_SETTINGS']."</a></font>";
$xtpl->assign("DISABLE_SEND", 'DISABLED');
}
// CHECK THAT SERVER HAS A PLACE TO PUT UPLOADED TEMP FILES SO THAT ATTACHMENTS WILL WORK
// cn: Bug 5995
$tmpUploadDir = ini_get('upload_tmp_dir');
if(!empty($tmpUploadDir)) {
if(!is_writable($tmpUploadDir)) {
echo "<font color='red'>{$mod_strings['WARNING_UPLOAD_DIR_NOT_WRITABLE']}</font>";
}
} else {
//echo "<font color='red'>{$mod_strings['WARNING_NO_UPLOAD_DIR']}</font>";
}
///////////////////////////////////////////////////////////////////////////////
//// INBOUND EMAIL HANDLING
if(isset($_REQUEST['email_name'])) {
$name = str_replace('_',' ',$_REQUEST['email_name']);
}
if(isset($_REQUEST['inbound_email_id'])) {
$ieMail = new Email();
$ieMail->retrieve($_REQUEST['inbound_email_id']);
$quoted = '';
// cn: bug 9725: replies/forwards lose real content
$quotedHtml = $ieMail->quoteHtmlEmail($ieMail->description_html);
// plain-text
$desc = nl2br(trim($ieMail->description));
$exDesc = explode('<br />', $desc);
foreach($exDesc as $k => $line) {
$quoted .= '> '.trim($line)."\r";
}
// prefill empties with the other's contents
if(empty($quotedHtml) && !empty($quoted)) {
$quotedHtml = nl2br($quoted);
}
if(empty($quoted) && !empty($quotedHtml)) {
$quoted = strip_tags(br2nl($quotedHtml));
}
// forwards have special text
if($_REQUEST['type'] == 'forward') {
$header = $ieMail->getForwardHeader();
// subject is handled in Subject line handling below
} else {
// we have a reply in focus
$header = $ieMail->getReplyHeader();
}
$quoted = br2nl($header.$quoted);
$quotedHtml = $header.$quotedHtml;
// if not a forward: it's a reply
if($_REQUEST['type'] != 'forward') {
$ieMailName = 'RE: '.$ieMail->name;
} else {
$ieMailName = $ieMail->name;
}
$focus->id = null; // nulling this to prevent overwriting a replied email(we're basically doing a "Duplicate" function)
$focus->to_addrs = $ieMail->from_addr;
$focus->description = $quoted; // don't know what i was thinking: ''; // this will be filled on save/send
$focus->description_html = $quotedHtml; // cn: bug 7357 - htmlentities() breaks FCKEditor
$focus->parent_type = $ieMail->parent_type;
$focus->parent_id = $ieMail->parent_id;
$focus->parent_name = $ieMail->parent_name;
$focus->name = $ieMailName;
$xtpl->assign('INBOUND_EMAIL_ID',$_REQUEST['inbound_email_id']);
// un/READ flags
if(!empty($ieMail->status)) {
// "Read" flag for InboundEmail
if($ieMail->status == 'unread') {
// creating a new instance here to avoid data corruption below
$e = new Email();
$e->retrieve($ieMail->id);
$e->status = 'read';
$e->save();
$email_type = $e->status;
}
}
///////////////////////////////////////////////////////////////////////////
//// PRIMARY PARENT LINKING
if(empty($focus->parent_type) && empty($focus->parent_id)) {
$focus->fillPrimaryParentFields();
}
//// END PRIMARY PARENT LINKING
///////////////////////////////////////////////////////////////////////////
// setup for my/mailbox email switcher
$mbox = $ieMail->getMailboxDefaultEmail();
$user = $current_user->getPreferredEmail();
$useGroup = '&nbsp;<input id="use_mbox" name="use_mbox" type="checkbox" CHECKED onClick="switchEmail()" >
<script type="text/javascript">
function switchEmail() {
var mboxName = "'.$mbox['name'].'";
var mboxAddr = "'.$mbox['email'].'";
var userName = "'.$user['name'].'";
var userAddr = "'.$user['email'].'";
if(document.getElementById("use_mbox").checked) {
document.getElementById("from_addr_field").value = mboxName + " <" + mboxAddr + ">";
document.getElementById("from_addr_name").value = mboxName;
document.getElementById("from_addr_email").value = mboxAddr;
} else {
document.getElementById("from_addr_field").value = userName + " <" + userAddr + ">";
document.getElementById("from_addr_name").value = userName;
document.getElementById("from_addr_email").value = userAddr;
}
}
</script>';
$useGroup .= $mod_strings['LBL_USE_MAILBOX_INFO'];
$xtpl->assign('FROM_ADDR_GROUP', $useGroup);
}
//// END INBOUND EMAIL HANDLING
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// SUBJECT FIELD MANIPULATION
$name = '';
if(!empty($_REQUEST['parent_id']) && !empty($_REQUEST['parent_type'])) {
$focus->parent_id = $_REQUEST['parent_id'];
$focus->parent_type = $_REQUEST['parent_type'];
}
if(!empty($focus->parent_id) && !empty($focus->parent_type)) {
if($focus->parent_type == 'Cases') {
require_once('modules/Cases/Case.php');
$myCase = new aCase();
$myCase->retrieve($focus->parent_id);
$myCaseMacro = $myCase->getEmailSubjectMacro();
if(isset($ieMail->name) && !empty($ieMail->name)) { // if replying directly to an InboundEmail
$oldEmailSubj = $ieMail->name;
} elseif(isset($_REQUEST['parent_name']) && !empty($_REQUEST['parent_name'])) {
$oldEmailSubj = $_REQUEST['parent_name'];
} else {
$oldEmailSubj = $focus->name; // replying to an email using old subject
}
if(!preg_match('/^re:/i', $oldEmailSubj)) {
$oldEmailSubj = 'RE: '.$oldEmailSubj;
}
$focus->name = $oldEmailSubj;
if(strpos($focus->name, str_replace('%1',$myCase->case_number,$myCaseMacro))) {
$name = $focus->name;
} else {
$name = $focus->name.' '.str_replace('%1',$myCase->case_number,$myCaseMacro);
}
} else {
$name = $focus->name;
}
} else {
if(empty($focus->name)) {
$name = '';
} else {
$name = $focus->name;
}
}
if($email_type == 'forward') {
$name = 'FW: '.$name;
}
//// END SUBJECT FIELD MANIPULATION
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// GENERAL TEMPLATE ASSIGNMENTS
$xtpl->assign('MOD', return_module_language($current_language, 'Emails'));
$xtpl->assign('APP', $app_strings);
if(!isset($focus->id)) $xtpl->assign('USER_ID', $current_user->id);
if(!isset($focus->id) && isset($_REQUEST['contact_id'])) $xtpl->assign('CONTACT_ID', $_REQUEST['contact_id']);
$xtpl->assign("QUOTE_ID",$_REQUEST['quote_id']);
if(isset($_REQUEST['return_module']) && !empty($_REQUEST['return_module'])) {
$xtpl->assign('RETURN_MODULE', $_REQUEST['return_module']);
} else {
$xtpl->assign('RETURN_MODULE', 'Emails');
}
if(isset($_REQUEST['return_action']) && !empty($_REQUEST['return_action']) && ($_REQUEST['return_action'] != 'SubPanelViewer')) {
$xtpl->assign('RETURN_ACTION', $_REQUEST['return_action']);
} else {
$xtpl->assign('RETURN_ACTION', 'DetailView');
}
if(isset($_REQUEST['return_id']) && !empty($_REQUEST['return_id'])) {
$xtpl->assign('RETURN_ID', $_REQUEST['return_id']);
}
// handle Create $module then Cancel
if(empty($_REQUEST['return_id']) && !isset($_REQUEST['type'])) {
$xtpl->assign('RETURN_ACTION', 'index');
}
$xtpl->assign('THEME', $theme);
$xtpl->assign('IMAGE_PATH', $image_path);$xtpl->assign('PRINT_URL', 'index.php?'.$GLOBALS['request_string']);
if(isset($_REQUEST['bodyclass']) && $_REQUEST['bodyclass'] != '') $xtpl->assign('BODYCLASS',$_REQUEST['bodyclass']);
require_once('modules/EcmServices/EcmService.php');
$m = new EcmService();
$mfp = $m->loadParserArray('email');
$xtpl->assign("MFP",$mfp);
///////////////////////////////////////////////////////////////////////////////
//// QUICKSEARCH CODE
require_once('include/QuickSearchDefaults.php');
$qsd = new QuickSearchDefaults();
$sqs_objects = array('parent_name' => $qsd->getQSParent(),
'assigned_user_name' => $qsd->getQSUser(),
);
$json = getJSONobj();
$quicksearch_js = $qsd->getQSScripts();
$sqs_objects_encoded = $json->encode($sqs_objects);
$quicksearch_js .= <<<EOQ
<script type="text/javascript" language="javascript">sqs_objects = $sqs_objects_encoded;
function changeQS() {
//new_module = document.getElementById('parent_type').value;
new_module = document.EditView.parent_type.value;
if(new_module == 'Contacts' || new_module == 'Leads' || typeof(disabledModules[new_module]) != 'undefined') {
sqs_objects['parent_name']['disable'] = true;
document.getElementById('parent_name').readOnly = true;
}
else {
sqs_objects['parent_name']['disable'] = false;
document.getElementById('parent_name').readOnly = false;
}
sqs_objects['parent_name']['module'] = new_module;
}
changeQS();
</script>
EOQ;
$xtpl->assign('JAVASCRIPT', get_set_focus_js().$quicksearch_js);
//// END QUICKSEARCH CODE
///////////////////////////////////////////////////////////////////////////////
// cn: bug 14191 - duping archive emails overwrites the original
if(!isset($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] != 'true') {
$xtpl->assign('ID', $focus->id);
}
if(isset($_REQUEST['parent_type']) && !empty($_REQUEST['parent_type']) && isset($_REQUEST['parent_id']) && !empty($_REQUEST['parent_id'])) {
$xtpl->assign('OBJECT_ID', $_REQUEST['parent_id']);
$xtpl->assign('OBJECT_TYPE', $_REQUEST['parent_type']);
}
$xtpl->assign('FROM_ADDR', $focus->from_addr);
//// prevent TO: prefill when type is 'forward'
if($email_type != 'forward') {
$xtpl->assign('TO_ADDRS', $focus->to_addrs);
$xtpl->assign('FROM_ADDRS', $focus->from_addrs);
$xtpl->assign('TO_ADDRS_IDS', $focus->to_addrs_ids);
$xtpl->assign('TO_ADDRS_NAMES', $focus->to_addrs_names);
$xtpl->assign('TO_ADDRS_EMAILS', $focus->to_addrs_emails);
$xtpl->assign('CC_ADDRS', $focus->cc_addrs);
$xtpl->assign('CC_ADDRS_IDS', $focus->cc_addrs_ids);
$xtpl->assign('CC_ADDRS_NAMES', $focus->cc_addrs_names);
$xtpl->assign('CC_ADDRS_EMAILS', $focus->cc_addrs_emails);
$xtpl->assign('BCC_ADDRS', $focus->bcc_addrs);
$xtpl->assign('BCC_ADDRS_IDS', $focus->bcc_addrs_ids);
$xtpl->assign('BCC_ADDRS_NAMES', $focus->bcc_addrs_names);
$xtpl->assign('BCC_ADDRS_EMAILS', $focus->bcc_addrs_emails);
}
//$xtpl->assign('FROM_ADDR', $from['name'].' <'.$from['email'].'>');
$xtpl->assign('FROM_ADDR_NAME', $from['name']);
$xtpl->assign('FROM_ADDR_EMAIL', $from['email']);
$xtpl->assign('NAME', from_html($name));
//$xtpl->assign('DESCRIPTION_HTML', from_html($focus->description_html));
$xtpl->assign('DESCRIPTION', $focus->description);
$xtpl->assign('TYPE',$email_type);
// Unimplemented until jscalendar language files are fixed
// $xtpl->assign('CALENDAR_LANG',((empty($cal_codes[$current_language])) ? $cal_codes[$default_language] : $cal_codes[$current_language]));
$xtpl->assign('CALENDAR_LANG', 'en');
$xtpl->assign('CALENDAR_DATEFORMAT', $timedate->get_cal_date_format());
$xtpl->assign('DATE_START', $focus->date_start);
$xtpl->assign('TIME_FORMAT', '('. $timedate->get_user_time_format().')');
$xtpl->assign('TIME_START', substr($focus->time_start,0,5));
$xtpl->assign('TIME_MERIDIEM', $timedate->AMPMMenu('',$focus->time_start));
$parent_types = $app_list_strings['record_type_display'];
$disabled_parent_types = ACLController::disabledModuleList($parent_types,false, 'list');
foreach($disabled_parent_types as $disabled_parent_type){
if($disabled_parent_type != $focus->parent_type){
unset($parent_types[$disabled_parent_type]);
}
}
$xtpl->assign('TYPE_OPTIONS', get_select_options_with_id($parent_types, $focus->parent_type));
$xtpl->assign('USER_DATEFORMAT', '('. $timedate->get_user_date_format().')');
$xtpl->assign('PARENT_NAME', $focus->parent_name);
$xtpl->assign('PARENT_ID', $focus->parent_id);
if(empty($focus->parent_type)) {
$xtpl->assign('PARENT_RECORD_TYPE', '');
} else {
$xtpl->assign('PARENT_RECORD_TYPE', $focus->parent_type);
}
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){
$record = '';
if(!empty($_REQUEST['record'])){
$record = $_REQUEST['record'];
}
$xtpl->assign('ADMIN_EDIT',"<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$record. "'>".get_image($image_path."EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
//// END GENERAL TEMPLATE ASSIGNMENTS
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////
///
/// SETUP PARENT POPUP
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'parent_id',
'name' => 'parent_name',
),
);
$encoded_popup_request_data = $json->encode($popup_request_data);
/// Users Popup
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'assigned_user_id',
'user_name' => 'assigned_user_name',
),
);
$xtpl->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
//
///////////////////////////////////////
$change_parent_button = '<input type="button" name="button" tabindex="2" class="button" '
. 'title="' . $app_strings['LBL_SELECT_BUTTON_TITLE'] . '" '
. 'accesskey="' . $app_strings['LBL_SELECT_BUTTON_KEY'] . '" '
. 'value="' . $app_strings['LBL_SELECT_BUTTON_LABEL'] . '" '
. "onclick='open_popup(document.EditView.parent_type.value,600,400,\"&tree=ProductsProd\",true,false,$encoded_popup_request_data);' />\n";
$xtpl->assign("CHANGE_PARENT_BUTTON", $change_parent_button);
$button_attr = '';
if(!ACLController::checkAccess('Contacts', 'list', true)){
$button_attr = 'disabled="disabled"';
}
$change_to_addrs_button = '<input type="button" name="to_button" tabindex="3" class="button" '
. 'title="' . $app_strings['LBL_SELECT_BUTTON_TITLE'] . '" '
. 'accesskey="' . $app_strings['LBL_SELECT_BUTTON_KEY'] . '" '
. 'value="' . $mod_strings['LBL_EMAIL_SELECTOR'] . '" '
. "onclick='button_change_onclick(this);' $button_attr />\n";
$xtpl->assign("CHANGE_TO_ADDRS_BUTTON", $change_to_addrs_button);
$change_cc_addrs_button = '<input type="button" name="cc_button" tabindex="3" class="button" '
. 'title="' . $app_strings['LBL_SELECT_BUTTON_TITLE'] . '" '
. 'accesskey="' . $app_strings['LBL_SELECT_BUTTON_KEY'] . '" '
. 'value="' . $mod_strings['LBL_EMAIL_SELECTOR'] . '" '
. "onclick='button_change_onclick(this);' $button_attr />\n";
$xtpl->assign("CHANGE_CC_ADDRS_BUTTON", $change_cc_addrs_button);
$change_bcc_addrs_button = '<input type="button" name="bcc_button" tabindex="3" class="button" '
. 'title="' . $app_strings['LBL_SELECT_BUTTON_TITLE'] . '" '
. 'accesskey="' . $app_strings['LBL_SELECT_BUTTON_KEY'] . '" '
. 'value="' . $mod_strings['LBL_EMAIL_SELECTOR'] . '" '
. "onclick='button_change_onclick(this);' $button_attr />\n";
$xtpl->assign("CHANGE_BCC_ADDRS_BUTTON", $change_bcc_addrs_button);
///////////////////////////////////////
//// USER ASSIGNMENT
global $current_user;
if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
$record = '';
if(!empty($_REQUEST['record'])) {
$record = $_REQUEST['record'];
}
$xtpl->assign('ADMIN_EDIT',"<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action'] ."&from_module=".$_REQUEST['module'] ."&record=".$record. "'>".get_image($image_path."EditLayout","border='0' alt='Edit Layout' align='bottom'")."</a>");
}
if(empty($focus->assigned_user_id) && empty($focus->id))
$focus->assigned_user_id = $current_user->id;
if(empty($focus->assigned_name) && empty($focus->id))
$focus->assigned_user_name = $current_user->user_name;
$xtpl->assign('ASSIGNED_USER_OPTIONS', get_select_options_with_id(get_user_array(TRUE, 'Active', $focus->assigned_user_id), $focus->assigned_user_id));
$xtpl->assign('ASSIGNED_USER_NAME', $focus->assigned_user_name);
$xtpl->assign('ASSIGNED_USER_ID', $focus->assigned_user_id);
$xtpl->assign('DURATION_HOURS', $focus->duration_hours);
$xtpl->assign('TYPE_OPTIONS', get_select_options_with_id($parent_types, $focus->parent_type));
$xtpl->assign("PIDFROM",$_REQUEST['pIdFrom']);
$xtpl->assign("PTYPEFROM",$_REQUEST['pTypeFrom']);
$xtpl->assign("PIDTO",$_REQUEST['pIdTo']);
$xtpl->assign("PTYPETO",$_REQUEST['pTypeTo']);
if(isset($focus->duration_minutes)) {
$xtpl->assign('DURATION_MINUTES_OPTIONS', get_select_options_with_id($focus->minutes_values,$focus->duration_minutes));
}
//// END USER ASSIGNMENT
///////////////////////////////////////
//Add Custom Fields
require_once('modules/DynamicFields/templates/Files/EditView.php');
require_once("modules/Notes/Note.php");
///////////////////////////////////////
//// ATTACHMENTS
$attachments = '';
if(!empty($focus->id) || (!empty($_REQUEST['record']) && $_REQUEST['type'] == 'forward')) {
$attachments = "<input type='hidden' name='removeAttachment' id='removeAttachment' value=''>\n";
$ids = '';
$focusId = empty($focus->id) ? $_REQUEST['record'] : $focus->id;
$note = new Note();
$where = "notes.parent_id='{$focusId}' AND notes.filename IS NOT NULL";
$notes_list = $note->get_full_list("", $where,true);
if(!isset($notes_list)) {
$notes_list = array();
}
for($i = 0;$i < count($notes_list);$i++) {
$the_note = $notes_list[$i];
if(empty($the_note->filename)) {
continue;
}
// cn: bug 8034 - attachments from forwards/replies lost when saving drafts
if(!empty($ids)) {
$ids .= ",";
}
$ids .= $the_note->id;
$attachments .= "
<div id='noteDiv{$the_note->id}'>
<img onclick='deletePriorAttachment(\"{$the_note->id}\");' src='themes/{$theme}/images/delete_inline.gif' value='{$the_note->id}'>&nbsp;";
$attachments .= '<a href="'.UploadFile::get_url($the_note->filename,$the_note->id).'" target="_blank">'. $the_note->filename .'</a></div>';
}
// cn: bug 8034 - attachments from forwards/replies lost when saving drafts
$attachments .= "<input type='hidden' name='prior_attachments' value='{$ids}'>";
// workaround $mod_strings being overriden by Note object instantiation above.
global $current_language, $mod_strings;
$mod_strings = return_module_language($current_language, 'Emails');
}
$attJs = '<script type="text/javascript">';
$attJs .= 'var file_path = "'.$sugar_config['site_url'].'/'.$sugar_config['upload_dir'].'";';
$attJs .= 'var lnk_remove = "'.$app_strings['LNK_REMOVE'].'";';
$attJs .= '</script>';
$xtpl->assign('ATTACHMENTS', $attachments);
$xtpl->assign('ATTACHMENTS_JAVASCRIPT', $attJs);
//// END ATTACHMENTS
///////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// DOCUMENTS
$popup_request_data = array(
'call_back_function' => 'document_set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => 'related_doc_id',
'document_name' => 'related_document_name',
),
);
$json = getJSONobj();
$xtpl->assign('encoded_document_popup_request_data', $json->encode($popup_request_data));
//// END DOCUMENTS
///////////////////////////////////////////////////////////////////////////////
$parse_open = true;
if($parse_open) {
$xtpl->parse('main.open_source_1');
}
///////////////////////////////////////////////////////////////////////////////
//// EMAIL TEMPLATES
if(ACLController::checkAccess('EmailTemplates', 'list', true) && ACLController::checkAccess('EmailTemplates', 'view', true)) {
$et = new EmailTemplate();
$etResult = $focus->db->query($et->create_list_query('','',''));
$email_templates_arr[] = '';
$toTemplateId = '';
while($etA = $focus->db->fetchByAssoc($etResult)) {
if($toTemplate == $etA['name']) { $toTemplateId = $etA['id']; }
$email_templates_arr[$etA['id']] = $etA['name'];
}
} else {
$email_templates_arr = array('' => $app_strings['LBL_NONE']);
}
$xtpl->assign('EMAIL_TEMPLATE_OPTIONS', get_select_options_with_id($email_templates_arr, $toTemplateId));
//// END EMAIL TEMPLATES
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////
//// TEXT EDITOR
// cascade from User to Sys Default
$editor = $focus->getUserEditorPreference();
if($editor != 'plain') {
// this box is checked by Javascript on-load.
$xtpl->assign('EMAIL_EDITOR_OPTION', 'CHECKED');
}
$description_html = from_html($focus->description_html);
$description = $focus->description;
/////////////////////////////////////////////////
// signatures
if($sig = $current_user->getDefaultSignature()) {
if(!$focus->hasSignatureInBody($sig) && $focus->type != 'draft') {
if($current_user->getPreference('signature_prepend')) {
$description_html = '<br />'.from_html($sig['signature_html']).'<br /><br />'.$description_html;
$description = "\n".$sig['signature']."\n\n".$description;
} else {
$description_html .= '<br /><br />'.from_html($sig['signature_html']);
$description = $description."\n\n".$sig['signature'];
}
}
}
$xtpl->assign('DESCRIPTION', $description);
// sigs
/////////////////////////////////////////////////
$tiny = new SugarTinyMCE();
$ed = $tiny->getInstance("description_html");
$xtpl->assign("TINY", $ed);
$xtpl->assign("DESCRIPTION_HTML", $description_html);
if((!isset($_REQUEST['record']) || $_REQUEST['record'] == '') && isset($toTemplateId) && $toTemplateId != "") {
require_once('modules/EmailTemplates/EmailTemplate.php');
$et = new EmailTemplate();
$et->retrieve($toTemplateId);
if(isset($et->id) && $et->id != '') {
$xtpl->assign("NAME",$et->subject);
$xtpl->assign("DESCRIPTION",$et->body);
$xtpl->assign("DESCRIPTION_HTML",$et->body_html);
}
}
$xtpl->parse('main.htmlarea');
//// END TEXT EDITOR
///////////////////////////////////////
///////////////////////////////////////
//// SPECIAL INBOUND LANDING SCREEN ASSIGNS
if(!empty($_REQUEST['inbound_email_id'])) {
if(!empty($_REQUEST['start'])) {
$parts = $focus->getStartPage(base64_decode($_REQUEST['start']));
$xtpl->assign('RETURN_ACTION', $parts['action']);
$xtpl->assign('RETURN_MODULE', $parts['module']);
$xtpl->assign('GROUP', $parts['group']);
}
$xtpl->assign('ASSIGNED_USER_ID', $current_user->id);
$xtpl->assign('MYINBOX', 'this.form.type.value=\'inbound\';');
}
//// END SPECIAL INBOUND LANDING SCREEN ASSIGNS
///////////////////////////////////////
echo '<script>var disabledModules='. $json->encode($disabled_parent_types) . ';</script>';
$jsVars = 'var lbl_send_anyways = "'.$mod_strings['LBL_SEND_ANYWAYS'].'";';
$xtpl->assign('JS_VARS', $jsVars);
$xtpl->parse("main");
$xtpl->out("main");
echo '<script>checkParentType(document.EditView.parent_type.value, document.EditView.change_parent);</script>';
//// END XTEMPLATE ASSIGNMENT
///////////////////////////////////////////////////////////////////////////////
require_once('include/javascript/javascript.php');
$javascript = new javascript();
$javascript->setFormName('email_EditView');
$javascript->setSugarBean($focus);
$skip_fields = array();
if($email_type == 'out') {
$skip_fields['name'] = 1;
$skip_fields['date_start'] = 1;
}
$javascript->addAllFields('',$skip_fields);
$javascript->addToValidateBinaryDependency('parent_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_MEMBER_OF'], 'false', '', 'parent_id');
$javascript->addToValidateBinaryDependency('parent_type', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $mod_strings['LBL_MEMBER_OF'], 'false', '', 'parent_id');
$javascript->addToValidateBinaryDependency('user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
if($email_type == 'archived') {
$javascript->addFieldIsValidDate('date_start', 'date', $mod_strings['LBL_DATE'], $mod_strings['ERR_DATE_START'], true);
$javascript->addFieldIsValidTime('time_start', 'time', $mod_strings['LBL_TIME'], $mod_strings['ERR_TIME_START'], true);
}
echo $javascript->getScript();

View File

@@ -0,0 +1,65 @@
<?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.
********************************************************************************/
/*******************************************************************************
* CREATE JAVASCRIPT TO VALIDATE THE DATA ENTERED INTO A RECORD.
*******************************************************************************/
function get_validate_record_js () {
}
/*******************************************************************************
* CREATE FORM FOR MENU RAPID CREATE
*******************************************************************************/
function get_new_record_form () {
}
?>

View File

@@ -0,0 +1,78 @@
/*
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 list_setQuoteStatus(record, status) {
if(typeof(record) == "string") {
YAHOO.util.Connect.asyncRequest(
'POST',
'index.php',
{
success: function(results) {
results = results.responseText;
//alert(results);
var obj = eval(results);
if(obj[0]) obj = obj[0];
if(typeof(obj) == "object") {
alert(obj['message']);
if(typeof(obj['record']) == "string" && obj['record'].length == 36) {
var status = document.getElementById('statusListEcmService_'+obj['record']);
if(status) status.innerHTML = obj['status']['image'];
if(obj['list_images']) {
var list_images = document.getElementById('optionsListEcmService_'+obj['record']);
if(list_images && list_images.parentNode) list_images.parentNode.innerHTML = obj['list_images'];
}
}
}
},
failure: function() {}
},
'module=EcmServices&action=SetStatus&to_pdf=1&status='+status+'&record='+record+'&ListQuotesModule='+ListQuotesModule+'&ListQuotesAction='+ListQuotesAction
);
}
}
var UserAccessToListItems = new Object();
function list_showStatusMenu(record) {
var div = document.getElementById('list_statusMenu');
if(!div) {
div = document.createElement('div');
div.className = 'list_statusMenu';
div.id = 'list_statusMenu';
document.body.appendChild(div);
}
if(div) {
var statusSpan = document.getElementById('statusListEcmService_'+record);
if(statusSpan) {
var XY = YAHOO.util.Dom.getXY(statusSpan);
div.style.left = XY[0]+statusSpan.offsetWidth;
div.style.top = XY[1];
if(typeof(EcmServicesStatusMenu) == "object") {
var html = '';
for(x in EcmServicesStatusMenu) {
html += EcmServicesStatusMenu[x]['enabled'];
}
div.innerHTML = html;
}
}
}
}
function list_hideStatusMenu(record) {
alert('hide');
}
YAHOO.util.Event.addListener(
window,
"load",
function() {
//alert(EcmServicesStatusMenu);
}
);

View File

@@ -0,0 +1,68 @@
<?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.
* ****************************************************************************** */
// require_once('modules/EcmGroupServices/Menu.php');
global $mod_strings, $current_user;
if (ACLController::checkAccess('EcmServices', "edit", true)) {
$module_menu [] = Array("index.php?module=" . 'EcmServices' . "&action=EditView&return_module=" . 'EcmServices' . "&return_action=DetailView", translate('LNK_NEW_' . 'ECMSERVICE', 'EcmServices'), "CreateEcmServices", 'EcmServices');
// $module_menu [] = Array("index.php?module=" . 'EcmServices' . "&action=EditView&return_module=" . 'EcmServices' . "&return_action=DetailView", translate('LNK_NEW_' . 'ECMSERVICE', 'EcmServices'), "CreateEcmServices", 'EcmServices');
}
if (ACLController::checkAccess('EcmServices', "list", true))
$module_menu [] = Array("index.php?module=EcmServices&action=index&return_module=EcmServices&return_action=DetailView", translate('LNK_ECMSERVICES_LIST', 'EcmServices'), "EcmServices", 'EcmServices');
if (ACLController::checkAccess('EcmServices', 'list', true) && is_admin($current_user))
$module_menu [] = Array("index.php?module=EcmServces&action=PDFLanguages&return_module=EcmServices&return_action=index", $mod_strings['LNK_ECMSERVICES_PDFLANGUAGES'], "PDFlanguages", 'EcmServices');

View File

@@ -0,0 +1,223 @@
<?php
class ModuleFieldsParser {
var $modules;
var $name;
function ModuleFieldsParser($name = 'mfp') {
$this->modules = Array();
if(file_exists('modules/EcmServices/ModuleFieldsParser/config.php')) {
require_once('modules/EcmServices/ModuleFieldsParser/config.php');
$this->modules = $mfp_modules;
}
$this->name = $name;
}
function getModulesSelectOptions($fieldRealNames = false) {
global $app_list_strings;
$arr = array();
if(count($this->modules)>0) {
foreach($this->modules as $key => $value) {
if(isset($value['name']) && $value['name'] != '')
if(isset($app_list_strings['moduleList'][$value['name']]) && $app_list_strings['moduleList'][$value['name']] != '')
$value['name'] = $app_list_strings['moduleList'][$value['name']];
$arr[$key]['name'] = $value['name'];
$arr[$key]['fields'] = $this->getModuleFieldsSelectOptions($key,$fieldRealNames);
}
}
return $arr;
}
function getModuleFieldsSelectOptions($module,$fieldRealNames = false) {
global $beanList, $current_language, $GLOBALS;
$dict = null;
$file = 'cache/modules/'.$module.'/'.$beanList[$module].'vardefs.php';
if(file_exists($file)) {
include($file);
$dict = $GLOBALS['dictionary'][$beanList[$module]]['fields'];
}
else {
$file = 'modules/'.$module.'/vardefs.php';
if(file_exists($file)) { include($file); $dict = $dictionary[$beanList[$module]]['fields']; }
}
if($dict) {
$mod = return_module_language($current_language, $module);
$arr = array();
foreach($dict as $key => $value) {
$tmp = '$'.$this->modules[$module]['prefix'].$value['name'];
if(!$fieldRealNames)
$arr[$tmp] = ((isset($mod[$value['vname']]) && $mod[$value['vname']] != '') ? $mod[$value['vname']] : $value['name']);
else
$arr[$tmp] = $value['name'];
}
return $arr;
}
return array();
}
function getJS() {
$json = getJSONobj();
$js = '<script language="javascript">';
$js .= 'var '.$this->name.'_data = '.$json->encode($this->getModulesSelectOptions()).';';
$js .= 'function '.$this->name.'_loadModules() { var ms = document.getElementById("'.$this->name.'_module"); for(x in '.$this->name.'_data) { ms.options[ms.options.length] = new Option('.$this->name.'_data[x]["name"],x,false); }; }';
$js .= 'function '.$this->name.'_loadFields() { var ms = document.getElementById("'.$this->name.'_module"); var fs = document.getElementById("'.$this->name.'_fields"); while(fs.options.length>0) fs.remove(0); var fields = '.$this->name.'_data[ms.value]["fields"]; for(x in fields) fs.options[fs.options.length] = new Option(fields[x],x,false); fs.onchange(); };';
$js .= 'function '.$this->name.'_loadField() { var fs = document.getElementById("'.$this->name.'_fields"); var fe = document.getElementById("'.$this->name.'_field"); fe.value = fs.value; };';
$js .= $this->name.'_loadModules(); '.$this->name.'_loadFields(); '.$this->name.'_loadField();';
$js .= '</script>';
return $js;
}
function getFormHTML($smarty = false, $name = '') {
if($name != '') $this->name = $name;
$html = '
<span>
<select id="'.$this->name.'_module" name="'.$this->name.'_module" onChange="'.$this->name.'_loadFields();"></select>&nbsp;
<select id="'.$this->name.'_fields" name="'.$this->name.'_fields" onChange="'.$this->name.'_loadField()"></select>&nbsp;
<input id="'.$this->name.'_field" name="'.$this->name.'_field" value="" size="40">'
.($smarty ? '{literal}' : '').$this->getJS().($smarty ? '{/literal}' : '').
'</span>';
return $html;
}
function fillFocusToModules() {
foreach($this->modules as $key => $value) {
if((!isset($value['focus']) || $value['focus'] == '') && (isset($value['id']) && $value['id'] != '')) {
global $beanFiles, $beanList;
$path = $beanFiles[$beanList[$key]];
if(file_exists($path)) {
require_once($path);
$this->modules[$key]['focus'] = new $beanList[$key]();
$this->modules[$key]['focus']->format_all_fields();
}
}
}
}
function parseText($text) {
$this->fillFocusToModules();
$temp = $this->getModulesSelectOptions(true);
foreach($this->modules as $module => $arr) {
if(isset($arr['focus']) && $arr['focus']!='') {
foreach($temp[$module]['fields'] as $field => $value) {
//$text = str_replace($field,((isset($this->modules[$module]['focus']->$value) && $this->modules[$module]['focus']->$value != '')?$this->modules[$module]['focus']->$value:''),$text);
}
}
}
return $text;
}
};
?>

View File

@@ -0,0 +1,75 @@
<?php
global $app_list_strings;
$mfp_modules = Array(
'EcmServices' => array(
'name' => $app_list_strings['moduleList']['EcmServices'],
'prefix' => 'off_',
'id' => '',
'focus' => ''
),
'EcmDocumentTemplates' => array(
'name' => $app_list_strings['moduleList']['EcmDocumentTemplates'],
'prefix' => 'dt_',
'id' => '',
'focus' => ''
),
'Accounts' => array(
'name' => $app_list_strings['moduleList']['Accounts'],
'prefix' => 'acc_',
'id' => '',
'focus' => ''
),
'Contacts' => array(
'name' => $app_list_strings['moduleList']['Contacts'],
'prefix' => 'con_',
'id' => '',
'focus' => ''
),
'Users' => array(
'name' => $app_list_strings['moduleList']['Users'],
'prefix' => 'us_',
'id' => '',
'focus' => ''
),
);
?>

View File

@@ -0,0 +1,944 @@
var reg = /[\s]/g;
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent)
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return [curleft,curtop];
}
function generateSelectOptions(arr, selected) {
var tmp = '';
for(x in arr) {
tmp += '<option value="'+x+'" '+((arr[x]===selected)?'selected':'')+'>'+arr[x]+'</option>';
}
return tmp;
}
function NumberToUserFormatNumber(number,add) {
if(!number)
number = 0;
number = parseFloat(number);
//var tmp = number.toFixed(OPT['dec_len']);
var tmp = number.toFixed(2);
//var s1 = tmp.substring(0,tmp.length-1-OPT['dec_len']);
var s1 = tmp.substring(0,tmp.length-1-2);
//var s2 = tmp.substring(tmp.length-OPT['dec_len'],tmp.length);
var s2 = tmp.substring(tmp.length-2,tmp.length);
var tmp = '';
for(var i=s1.length;i>0;i-=3) {
// tmp = ((i<=3)?"":OPT['sep_1000'])+s1.substring(i-3,i)+tmp;
tmp=s1.substring(i-3,i)+tmp;
if (i>3) tmp = '.' + tmp;
}
s1 = tmp;
//return (s1+OPT['dec_sep']+s2).toString()+((add)?add:'');
return (s1+','+s2).toString()+((add)?add:'');
}
function UserFormatNumberToNumber(ufn,add) {
if(add) {
var match = /add/g;
ufn = ufn.replace(match,'');
}
var match = /Err/g;
ufn = ufn.replace(match,'');
if(!ufn)
return parseFloat(0);
var pos = ufn.indexOf(OPT['dec_sep']);
var s1='', s2='';
if(pos==-1) {
s1 = ufn;
s2 = '';
}
else {
s1 = ufn.substring(0,pos);
s2 = ufn.substring(pos+1,ufn.length);
}
/*
if(OPT['sep_1000'] != "")
for(var i=s1.length-4;i>=0;i-=4)
if(s1.charAt(i) != OPT['sep_1000']) return -1;
if(s1.charAt(0) == OPT['sep_1000']) return -1;
*/
var pos = -1;
while((pos = s1.indexOf(OPT['sep_1000'])) != -1)
s1 = s1.substring(0,pos)+s1.substring(pos+1,s1.length);
//alert(s1);
return parseFloat(s1+"."+s2);
}
function keyPressedNumber(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
return keynum;
}
function isEnterOrTabPressed(e) {
var keynum = keyPressedNumber(e);
if(keynum == 9 || keynum == 13) return true; else return false;
}
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();
}
}
/*
function keyPressed = function(e, method) {
var keynumkey = PressedNumber(e);
if((keynum == 9) || (keynum == 13)) {
//this.calculateTotal();
//if(this.selectedCell.lp == 1) setTimeout( function() { N.selectNextCell(); } , 100);
//this.selectNextCell();
return false;
}
//if(keynum == 40) this.selectNextRow();
//if(keynum == 38) this.selectPreviousRow();
if(e.shiftKey && (method == "decimalNumber" || method == "onlyNumber")) return false;
if(method == "decimalNumber") return this.OnlyNumbers(keynum);
if(method == "onlyNumber") return this.OnlyNumbers(keynum, true);
return true;
}
this.OnlyNumbers = function(e, noInvoiceOut) {
var keynum = e, keychar, numcheck;
keychar = String.fromCharCode(keynum);
numcheck = /\d/;
return numcheck.test(keychar)
|| ((!noInvoiceOut)?(keynum == 190):false)
|| (keynum == 8) //backspace
|| (keynum == 13) //enter
|| (keynum == 0) //special keys with FF
|| (keynum == 37) //left arrow
|| (keynum == 39) //right arrow
|| (keynum == 188) //,
|| (keynum >= 95 && keynum <= 105) //numeric keyboard
|| (keynum == 110);
}
*/
function MyTable(name) {
this.myTableName = name;
this.table = document.getElementById(this.myTableName);
this.thead = this.table.tHead;
this.tbody = this.table.tBodies.item(0);
this.cellSelectedClass = 'selectedCell';
this.rowSelectedClass = 'selectedRow';
this.selectedRow;
this.selectedCell;
this.divParent;
this.rowCount = function() {
return this.tbody.rows.length;
}
this.colCount = function() {
return this.thead.rows.item(0).cells.length;
};
this.colWidth = function(i) {
return this.thead.rows.item(0).cells.item(i).width;
};
this.moveUpRow = function() {
if(this.selectedRow)
this.selectedRow.moveUp();
};
this.moveDownRow = function() {
if(this.selectedRow)
this.selectedRow.moveDown();
};
this.insertRow = function(row, newRow) {
if(!row)
if(this.rowCount())
if(typeof(row) == "number")
row = this.tbody.rows.item(row);
else
row = this.tbody.rows.item(this.tbody.rows.length-1);
var row_tmp;
if((newRow) && (row)) row_tmp = newRow;
else {
row_tmp = this.createRow();
this.fillWithDefaultData(row_tmp);
}
if(this.rowCount() > 0 && row.nextSibling)
this.tbody.insertBefore(row_tmp, row.nextSibling);
else
this.tbody.appendChild(row_tmp);
return row_tmp;
};
/*
this.deleteRow = function(row) {
if(!row)
if(this.rowCount())
if(typeof(row) == "number")
row = this.tbody.rows.item(row);
else
row = this.tbody.rows.item(this.tbody.rows.length-1);
if(!row) return;
if(row.nextSibling) this.selectNextRow();
else if(row.previousSibling) this.selectPreviousRow();
this.tbody.removeChild(row);
this.deselectRow();
this.deselectCell();
if(this.rowCount() == 0)
setTimeout( function() { N.insertRow(); } , 1000);
}
this.changeRowMode = function(row) {
row.isnew = !row.isnew;
this.setEditNames(row,!row.isnew);
var img = row.firstChild.nextSibling.lastChild.previousSibling.previousSibling;
if(row.isnew)
img.setAttribute('src','modules/EcmInvoiceOuts/images/newproductset.gif');
else
img.setAttribute('src','modules/EcmInvoiceOuts/images/newproduct.gif');
}
*/
this.refreshRowIndex = function() {
for(var i=0; i<this.rowCount(); i++) {
this.tbody.rows.item(i).index = i;
if(this.onRefreshRowIndex) this.onRefreshRowIndex(this.tbody.rows.item(i));
}
}
this.onRefreshRowIndex;
this.addRow = function(i, data) {
if(this.rowCount() > 0) {
try {
if(typeof(i) != "undefined") {
var r = i;
if(typeof(i) == "object") {}
else if(typeof(i) == "number") r = this.tbody.rows.item(i - 1);
if(this.isProductLoaded(r.cells.item(0)) == false) {
return 0;
}
}
} catch(e) {
return 0;
}
}
var row = this.createRow();
if(this.selectedRow)
this.selectedRow.deselect();
if(this.selectedCell)
this.selectedCell.deselect();
row.myTable = this;
if(typeof(i) == "number")
this.tbody.insertBefore(row,this.tbody.rows.item(i));
else
this.tbody.appendChild(row);
this.refreshRowIndex();
this.setRowData(row, data);
for(var i=0; i<this.colCount(); i++)
row.cells.item(i).afterCreate();
return row;
}
this.createRow = function(row) {
var row = document.createElement('tr');
row.myTable = this;
row.isnew = false;
row.onclick = function() {
this.select();
}
row.select = function() {
if(!this.myTable.selectedRow || this.myTable.selectedRow !== this) {
if(this.myTable.selectedRow) this.myTable.selectedRow.deselect();
this.myTable.selectedRow = this;
$(this).addClass(this.myTable.rowSelectedClass);//this.className = this.myTable.rowSelectedClass;
if(row.onSelect) row.onSelect();
if(this.myTable.divParent)
if(((this.offsetTop+this.offsetHeight-this.myTable.divParent.scrollTop) > (this.myTable.divParent.offsetHeight+5)) || ((this.offsetTop-this.myTable.divParent.scrollTop) < (-10))) this.myTable.divParent.scrollTop = this.offsetTop;
}
}
row.deselect = function() {
if(this.myTable.selectedRow === this) {
$(this).removeClass(this.myTable.rowSelectedClass);//this.className = '';
this.myTable.selectedRow = '';
if(row.onDeselect) row.onDeselect();
}
};
row.calculateTotal = function() {};
row.selectNext = function() {
if(this.index < this.myTable.rowCount()-1) {
this.deselect();
this.nextSibling.select();
return this.nextSibling;
}
else {
if(this.noAddNew) return this;
this.deselect();
var row = this.myTable.addRow();
return row;
}
}
row.selectPrevious = function() {
this.deselect();
if(this.previousSibling) {
this.previousSibling.select();
return this.previousSibling;
}else return this;
}
row.deleteRow = function(noNew) {
if(this.myTable.selectedCell) this.myTable.selectedCell.deselect();
if(this.myTable.selectedRow) this.myTable.selectedRow.deselect();
if(this.myTable.rowCount() == 1 && !noNew) {
var MyTaBlE = this.myTable;
setTimeout( function() {
MyTaBlE.addRow();
} , 1000);
}
this.myTable.tbody.removeChild(this);
this.myTable.refreshRowIndex();
calculateTotal();
}
row.moveUp = function() {
if(!this.previousSibling) return;
this.myTable.tbody.insertBefore(this,this.previousSibling);
this.myTable.refreshRowIndex();
}
row.moveDown = function() {
if(!this.nextSibling) this.myTable.addRow(row);
this.myTable.tbody.insertBefore(this.nextSibling,this);
this.myTable.refreshRowIndex();
}
row.setData = function(data) {
if(!data || typeof(data) != "object") {
return;
};
for(var i=0; i<this.myTable.colCount(); i++) {
this.cells.item(i).setData(data);
}
}
row.getData = function() {
var data = new Object();
for(var i=0; i<this.myTable.colCount(); i++) {
if(this.cells.item(i).getData) this.cells.item(i).getData(data,true);
}
return data;
}
for(var i=0; i<this.colCount(); i++) {
var cell = this.createCell(i);
row.appendChild(cell);
}
if(this.onCreateRow)
this.onCreateRow(row);
return row;
};
this.onCreateRow; //function(row) {}
this.cellCodeIndex = 1;
this.isProductLoaded = function(cell) {
if(this.selectedRow && typeof(this.selectedRow) != "undefined" && this.selectedRow === cell.parentNode) {
var data = this.selectedRow.getData();
if(data.id && data.id != "" && data.code && data.code != "") {
} else {
if(this.selectedCell !== cell && cell === this.selectedRow.cells.item(1)) {
return true;
} else {}
if(cell.parentNode.cells.item(1).firstChild.focus && !cell.parentNode.cells.item(1).noSelect) setSelectionRange(cell.parentNode.cells.item(1).firstChild);
return false;
}
} else {
if(typeof(cell) != "undefined" && cell.index != this.cellCodeIndex) {
cell.parentNode.select();
cell.parentNode.cells.item(1).select();
return false;
}
}
return true;
}
this.createCell = function(i) {
var cell = document.createElement('td');
cell.index = i;
cell.myTable = this;
cell.onclick = function() {
this.select();
}
cell.select = function() {
if(this.myTable.isProductLoaded(this) == false) return;
if(!this.myTable.selectedCell || this.myTable.selectedCell !== this) {
if(this.myTable.selectedCell)
this.myTable.selectedCell.deselect();
this.myTable.selectedCell = this;
if(this.firstChild.focus && !this.noSelect)
setSelectionRange(this.firstChild);
if(this.onSelect)
this.onSelect();
this.className = this.myTable.cellSelectedClass;
}
}
cell.deselect = function() {
if(this.myTable.selectedCell === this) {
if(cell.onDeselect) cell.onDeselect();
if(cell.onDeselect2) cell.onDeselect2();
this.className = '';
this.selected = false;
this.myTable.selectedCell = '';
this.parentNode.calculateTotal();
}
};
cell.selectNext = function() {
this.deselect();
if(this.nextSibling) this.nextSibling.select();
else {
if(!this.parentNode.nextSibling) this.myTable.addRow();
this.parentNode.nextSibling.select();
this.parentNode.nextSibling.firstChild.select();
}
}
cell.afterCreate = function() {}
cell.setData = function(data) {}
cell.getData = function(data) {}
if(this.onCreateCell)
this.onCreateCell(cell);
return cell;
};
this.onCreateCell; //function(cell) {}
this.setRowData = function(row,data) {
for(var i=0; i<this.colCount(); i++) {
this.setCellData(row,row.cells.item(i),data);
}
}
this.setCellData = function(row,cell,data) {
if(typeof(row) == "number")
if(this.tbody.rows.item(row)) row = this.tbody.rows.item(row);
if(typeof(cell) != "object")
if(typeof(cell) == "number" && typeof(row) == "object") {
if(row.cells.item(cell))
cell = row.cells.item(cell);
else return;
}
else return;
if(this.onSetCellData) this.onSetCellData(row,cell,data);
}
this.onSetCellData; //function(row,cell,data) {}
this.setEditNames = function(row,isset) {
if(isset)
for(var i=0; i<row.cells.length; i++) {
if(i!=0 && i!=6 && i!=7) {
var c = row.cells.item(i).firstChild;
if(c.parentNode.lp == 1) {
c.name = 'parent_wi';
c.id = 'parent_wi';
c=c.nextSibling.nextSibling.nextSibling.nextSibling;
c.name = 'parent_name_wi';
c.id = 'parent_name_wi';
c.className = 'sqsEnabled';
//alert(c);
c=c.nextSibling;
c.name = 'parent_id_wi';
c.id = 'parent_id_wi';
/*
c=c.nextSibling;
c.name = 'vat_id_p'; c.id = 'vat_id_p';
c=c.nextSibling;
c.name = 'category_id_p'; c.id = 'category_id_p';
*/
}
/*
if(c.parentNode.lp == 2) {
c.name = 'name_p'; c.id = 'name_p'; c.className = 'sqsEnabled';
}
if(c.parentNode.lp == 3) {
c.name = 'quantity_p'; c.id = 'quantity_p';
}
if(c.parentNode.lp == 4) {
c.name = 'price_p'; c.id = 'price_p';
}
if(c.parentNode.lp == 5) {
c.name = 'discount_p'; c.id = 'discount_p';
}
*/
}
}
else
for(var i=0; i<row.cells.length; i++) {
if(i!=0 && i!=5) {
var c = row.cells.item(i).firstChild;
c.name = '';
c.id = '';
if(i == 1) {
c=c.nextSibling.nextSibling.nextSibling.nextSibling;
c.name = '';
c.id = '';
c=c.nextSibling;
c.name = '';
c.id = '';
/*
c=c.nextSibling;
c.name = ''; c.id = '';
c=c.nextSibling;
c.name = ''; c.id = '';
*/
}
}
}
}
this.deselectRow = function() {
if(!this.selectedRow) return;
this.setEditNames(this.selectedRow,false);
this.selectedRow.className = '';
this.deselectCell();
this.selectedRow = null;
}
this.selectRow = function(row) {
if(this.selectedRow === row) return;
if(this.selectedRow) this.deselectRow();
this.selectedRow = row;
this.selectedRow.className = this.rowSelectedClass;
this.setEditNames(this.selectedRow,!this.selectedRow.isnew);
}
this.selectNextRow = function() {
if(!this.selectedRow) return;
if(!this.selectedRow.nextSibling) this.insertRow();
var cell_id = this.selectedCell.lp;
this.selectRow(this.selectedRow.nextSibling);
this.selectCell(this.selectedRow.cells.item(cell_id));
}
this.selectPreviousRow = function() {
if(!this.selectedRow) return;
if(!this.selectedRow.previousSibling) return;
if(this.selectedRow === this.tbody.rows.item(0)) return;
var cell_id = this.selectedCell.lp;
this.selectRow(this.selectedRow.previousSibling);
this.selectCell(this.selectedRow.cells.item(cell_id));
}
this.calculateSubtotal = function(row,sub) {
if(!row) if(this.selectedRow) row = this.selectedRow; else return 0;
if(row.cells.item(4).err || row.cells.item(5).err) {
row.cells.item(6).firstChild.value = NumberToUserFormatNumber(0);
row.cells.item(6).firstChild.style.color = 'red';
row.title = 'Bad number format';
} else if(row.cells.item(2).firstChild.value == '' && UserFormatNumberToNumber(row.cells.item(4).firstChild.value) != 0 && !row.cells.item(4).err) {
row.cells.item(6).firstChild.style.color = 'red';
row.title = 'Position have price, but didin\'t have a description';
} else {
var quantity = parseInt(row.cells.item(3).firstChild.value);
if(row.cells.item(1).firstChild.nextSibling.nextSibling.value == 3)
quantity = 1;
var price = UserFormatNumberToNumber(tmp = row.cells.item(4).firstChild.value);
var discount = UserFormatNumberToNumber(row.cells.item(5).firstChild.value,"%");
var total = NumberToUserFormatNumber(quantity*price-quantity*price*(discount/100));
row.cells.item(6).firstChild.value = total;
row.cells.item(6).firstChild.style.color = 'black';
row.title = '';
}
//if(!sub)
// this.calculateTotal();
}
this.calculateTotal = function() {
var vats = new Object();
var subtotal = 0;
var total = 0;
for(var i=0; i < this.rowCount(); i++) {
if(!OPT['to_is_vat_free']) {
var v_tmp = this.tbody.rows.item(i).cells.item(1).firstChild.nextSibling.nextSibling.nextSibling.value;
if(v_tmp && this.tbody.rows.item(i).cells.item(2).firstChild.value != '') {
if(typeof(vats[v_tmp]) != "object") {
vats[v_tmp] = new Object();
vats[v_tmp]['vat'] = 0;
}
vats[v_tmp]['vat'] += UserFormatNumberToNumber(this.tbody.rows.item(i).cells.item(6).firstChild.value);
}
} else if(typeof(vats['0.00']) != "object") {
vats['0.00'] = new Object();
vats['0.00']['vat'] = 0;
}
subtotal += UserFormatNumberToNumber(this.tbody.rows.item(i).cells.item(6).firstChild.value);
}
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(x in vats) {
vats[x]['vat'] = vats[x]['vat']*(parseFloat(x)/100);
total += vats[x]['vat'];
var txL = 'VAT'+' ('+NumberToUserFormatNumber(parseFloat(x),'%')+')';
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 = 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 = txF;
}
}
document.getElementById('subtotal_span').innerHTML = NumberToUserFormatNumber(subtotal);
document.getElementById('subtotal').value = NumberToUserFormatNumber(subtotal);
total = ((iType == "correct")?'-':'')+NumberToUserFormatNumber(total).toString();
document.getElementById('total_span').innerHTML = total;
document.getElementById('total').value = total;
}
this.deselectCell = function() {
if(!this.selectedCell) return;
var tmp = 0;
var c = this.selectedCell;
/*
if(c.lp == 4)
if(c.firstChild.value != "") {
tmp = UserFormatNumberToNumber(this.selectedCell.firstChild.value);
if(tmp == -1) {
alert('Error with format number: '+c.firstChild.value);
c.err = true;
c.firstChild.style.color = 'red';
}
else {
c.firstChild.value = NumberToUserFormatNumber(tmp);
c.firstChild.style.color = 'black';
c.err = false;
}
}
if(c.lp == 5)
if(c.firstChild.value != "") {
tmp = UserFormatNumberToNumber(this.selectedCell.firstChild.value,"%");
if(tmp == -1) {
alert('Error with format number: '+c.firstChild.value);
c.err = true;
c.firstChild.style.color = 'red';
}
else {
c.firstChild.value = NumberToUserFormatNumber(tmp,"%");
c.firstChild.style.color = 'black';
c.err = false;
}
}
*/
//this.calculateSubtotal(c.parentNode);
this.selectedCell.className = '';
this.selectedCell = null;
}
this.selectCell = function(cell) {
if(this.selectedCell === cell) return;
if(this.selectedCell) this.deselectCell();
this.selectedCell = cell;
if(!cell.noSelect) {
this.selectedCell.className = this.cellSelectedClass;
this.setCellFocus(this.selectedCell);
}
}
this.selectNextCell = function() {
if(!this.selectedCell) return;
if(this.selectedCell.lp == 4) {
this.selectNextRow();
this.selectCell(this.selectedRow.firstChild.nextSibling);
}
else
this.selectCell(this.selectedCell.nextSibling);
}
this.setCellFocus = function(cell,input) {
if(typeof(cell) == 'number') {
cell = this.selectedRow.cells.item(cell);
}
var edit = ((input)?input:cell.firstChild);
if(edit && typeof(edit) == "object" && (edit.type == "text" || edit.type == "textarea")) {
if(edit.createTextRange) {
var range = edit.createTextRange();
range.moveStart("character", 0);
range.moveEnd("character", edit.value.lengh-1);
range.select();
} else {
if(edit.setSelectionRange) {
edit.setSelectionRange(0,edit.value.length);
}
}
edit.focus();
}
if(edit && typeof(edit) == "object" && edit.options) {
edit.focus();
}
}
this.fillWithDefaultData = function(row) {
//this.setCellData(3,1,row);
//this.setCellData(5,0,row);
//this.setCellData(6,0,row);
}
this.refreshNumeration = function() {
for(var i=0; i<this.tbody.rows.length; i++)
this.tbody.rows.item(i).cells.item(0).firstChild.value = i+1;
}
/*
this.setCellData = function(i,data,row) {
if(!row) if(this.selectedRow) row = this.selectedRow; else return null;
//if(i == 3) { row.firstChild.nextSibling.nextSibling.nextSibling.firstChild.value = data; }
//if(i == 5) { row.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.value = NumberToUserFormatNumber(data,"%"); }
//if(i == 6) { row.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.value = NumberToUserFormatNumber(data); }
}
*/
this.insertRowFromArray = function(arr) {
var row = this.insertRow();
row.cells.item(1).firstChild.value = arr['code'];
row.cells.item(1).firstChild.nextSibling.value = arr['id'];
row.cells.item(1).firstChild.nextSibling.nextSibling.value = arr['unit_id'];
row.cells.item(1).firstChild.nextSibling.nextSibling.nextSibling.value = arr['vat_id'];
row.cells.item(1).firstChild.nextSibling.nextSibling.nextSibling.nextSibling.value = arr['category_id'];
row.cells.item(2).firstChild.value = arr['name'];
row.cells.item(3).firstChild.value = arr['quantity'];
row.cells.item(4).firstChild.value = NumberToUserFormatNumber(arr['price']);
row.cells.item(5).firstChild.value = NumberToUserFormatNumber(arr['discount'],'%');
row.cells.item(6).firstChild.value = NumberToUserFormatNumber(arr['total']);
}
this.getRowData = function(row) {
if(typeof(row) == "number") row = this.tbody.rows.item(row);
var rData = new Object();
rData['id'] = row.cells.item(1).firstChild.nextSibling.value;
rData['unit_id'] = row.cells.item(1).firstChild.nextSibling.nextSibling.value;
if(!rData['unit_id']) rData['unit_id'] = OPT['default_unit']; //szt
rData['vat_id'] = row.cells.item(1).firstChild.nextSibling.nextSibling.nextSibling.value;
if(!rData['vat_id']) rData['vat_id'] = OPT['default_vat']; //standard
rData['category_id'] = row.cells.item(1).firstChild.nextSibling.nextSibling.nextSibling.nextSibling.value;
if(!rData['category_id']) rData['category_id'] = OPT['default_category']; //no category
rData['code'] = row.cells.item(1).firstChild.value;
rData['name'] = row.cells.item(2).firstChild.value;
rData['quantity'] = row.cells.item(3).firstChild.value;
rData['price'] = UserFormatNumberToNumber(row.cells.item(4).firstChild.value);
rData['discount'] = UserFormatNumberToNumber(row.cells.item(5).firstChild.value,'%');
rData['total'] = UserFormatNumberToNumber(row.cells.item(6).firstChild.value);
if(rData['code'] == '' && rData['name'] == '') return ''; else return rData;
}
this.prepareToSend = function(json) {
var rData = new Object();
var l = 0, tmp;
for(var i=0; i<this.rowCount(); i++) {
//this.calculateSubtotal(this.tbody.rows.item(i),true);
tmp = this.getRowData(i);
if(tmp != '') {
rData[l.toString()] = tmp;
l++;
}
}
//this.calculateTotal();
if(!json)
return JSON.stringifyNoSecurity(rData);
else
return rData;
}
this.KeyPressedNumber = function(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
return keynum;
}
this.KeyPressed = function(e, cell, method, noArrow) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
if((keynum == 9) || (keynum == 13 && cell.index != 2)) {
//this.calculateTotal();
//if(this.selectedCell.lp == 1) setTimeout( function() { N.selectNextCell(); } , 100);
//this.selectNextCell();
if(cell.index == 1 || cell.index == 2) cell.parentNode.calculateTotal();
cell.selectNext();
return false;
}
if(!noArrow) {
if(keynum == 40) {
var id = cell.index;
var row = cell.parentNode.selectNext();
if(row) {
row.select();
row.cells.item(id).select();
}
}
if(keynum == 38) {
var id = cell.index;
var row = cell.parentNode.selectPrevious();
if(row) {
row.select();
row.cells.item(id).select();
}
}
} else return true;
if(e.shiftKey && (method == "decimalNumber" || method == "onlyNumber")) return false;
if(method == "decimalNumber") return this.OnlyNumbers(keynum);
if(method == "onlyNumber") return this.OnlyNumbers(keynum, true);
return true;
}
this.OnlyNumbers = function(e, noInvoiceOut) {
var keynum = e, keychar, numcheck;
keychar = String.fromCharCode(keynum);
numcheck = /\d/;
return numcheck.test(keychar)
|| ((!noInvoiceOut)?(keynum == 190):false)
|| (keynum == 8) //backspace
|| (keynum == 46) //delete
|| (keynum == 13) //enter
|| (keynum == 0) //special keys with FF
|| (keynum == 37) //left arrow
|| (keynum == 39) //right arrow
|| (keynum == 188) //,
|| (keynum >= 95 && keynum <= 105) //numeric keyboard
|| (keynum == 110);
}
this.row = function(i) {
if(this.tbody.rows.item(i)) return this.tbody.rows.item(i);
}
this.cells = function(i,j) {
if(this.tbody.rows.item(i).cells.item(i)) return this.tbody.rows.item(i).cells.item(i);
}
}
//var N;
var parent_options;
/*
function ItemListSave(json) {
if(N.selectedCell) N.selectedCell.deselect();
if(N.selectedRow) N.selectedRow.deselect();
var data = new Object();
for(var i=0; i<N.rowCount(); i++) {
data[i.toString()] = N.row(i).getData();
}
return json ? JSON.stringifyNoSecurity(data) : data;
}
function ItemListClear() {
while(N.rowCount()>0) N.row(0).deleteRow();
}
*/
function ItemListFill(list) {
/*
var start_list_count = 6;
var count = 0;
var arr = '';
if(list)
arr = list;
else
if(document.getElementById('position_list').value!="")
arr = eval(document.getElementById('position_list').value);
if(arr != '')
for(x in arr) {
N.insertRowFromArray(arr[x]);
count++;
}
for(var i=count; i<start_list_count; i++) N.insertRow();
N.calculateTotal();
*/
}

View File

@@ -0,0 +1,31 @@
<?php
$PDFLabelList = array (
'LBL_PDF_LIST_POSITION',
'LBL_PDF_LIST_CODE',
'LBL_PDF_LIST_IMAGE',
'LBL_PDF_LIST_QUANTITY',
'LBL_PDF_LIST_UNIT',
'LBL_PDF_LIST_DESCRIPTION',
'LBL_PDF_LIST_PRICE',
'LBL_PDF_LIST_DISCOUNT',
'LBL_PDF_LIST_VAT',
'LBL_PDF_LIST_TOTAL',
'LBL_PDF_LIST_RECIPIENT_CODE',
'LBL_PDF_TOTAL',
'LBL_PDF_DISCOUNT',
'LBL_PDF_END_TOTAL',
'LBL_PDF_VAT',
'LBL_PDF_VATID',
'LBL_PDF_NUMBER',
'LBL_PDF_DATE_REGISTER',
'LBL_PDF_VALIDTILL_DATE',
'LBL_PDF_OWNER',
'LBL_PDF_DOCUMENT_NAME',
'LBL_PDF_CODE',
'LBL_PDF_QUOTE_FOR',
);
?>

View File

@@ -0,0 +1,137 @@
<!-- BEGIN: main -->
<script type="text/javascript" src="include/javascript/popup_parent_helper.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/JSON.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="modules/EcmServices/PDFLanguagesMT.js"></script>
<link rel="stylesheet" type="text/css" href="modules/EcmServices/MyTable.css" />
<script type="text/javascript" src="modules/EcmServices/PDFLanguages.js?s={SUGAR_VERSION}&c={JS_CUSTOM_VERSION}"></script>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<form name="PDFLanguages" onsubmit="return ItemListSave(true);" method="POST" action="index.php">
<input type="hidden" name="module" value="EcmServices">
<input type="hidden" name="action" value="PDFLanguagesSave">
<input type="hidden" name="return_module" value="{RETURN_MODULE}">
<input type="hidden" name="return_id" value="{RETURN_ID}">
<input type="hidden" name="return_action" value="{RETURN_ACTION}">
<input type="hidden" id="phone_list" name="phone_list" value='{PHONE_LIST}' >
<td style="padding-bottom: 2px;">
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" tabindex="1" class="button"
onclick="ItemListSave(true);"
type="button" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" tabindex="1" class="button"
onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'"
type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
</td>
<td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
<td align='right'>{ADMIN_EDIT}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80%" valign="top" class="dataLabel">
<span sugar="slot4">{MOD.LBL_ECMLANGUAGE} <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span>
</span sugar="slot">
&nbsp;&nbsp;
<span sugar="slot4b">
<select tabindex='1' id='ecmlanguage' name='ecmlanguage' onChange="ItemListClear(true,this.lastSelected);ItemListFill();">{ECMLANGUAGES_OPTIONS}</select>
</span sugar="slot">
</td>
<td width="20%" class="dataField">
</td>
</tr>
<tr>
<td width="80%" class="dataLabel" valign="top"><span sugar='slot1'> </span sugar='slot'>
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:400px;max-height:400px;overflow:auto;">
<table class="positions" style="width:100%;" id="PDFLanguagesTable">
<thead id="head">
<tr id="tr">
<td width="10%">No.</td>
<td width="50%">Label</td>
<td width="40%">Translation</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
</td>
<td width="20%" colspan="" valign="top" class="dataLabel"><span sugar="slot4"></span sugar="slot"></td>
</tr>
<tr>
<td width="80%" colspan="4" valign="top" class="dataLabel"><span sugar="slot4"><br /></span sugar="slot"></td>
<td width="20%" colspan="" valign="top" class="dataLabel"><span sugar="slot4"></span sugar="slot"></td>
</tr>
<tr>
<td width="80%" colspan="4" valign="top" class="dataLabel">
<table width="80%"><tr><td style="width:250px;" class="dataLabel">
<span sugar="slot4">{MOD.LBL_HEADER_TEXT} &nbsp;&nbsp;&nbsp;
</span sugar="slot">
</td><td align="right">
{MFP.header} &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <select id="header_parent" style="display:none;" onchange="FillText('header',this);">{PARENT_OPTIONS}</select>
</td></tr></table>
<textarea id="header_text" name="header_text" rows="5" style="width:80%;">{HEADER_TEXT}</textarea>
</td>
<td width="20%" colspan="" valign="top" class="dataLabel"><span sugar="slot4"></span sugar="slot"></td>
</tr>
<tr>
<td width="80%" colspan="4" valign="top" class="dataLabel">
<table width="80%"><tr><td style="width:250px;" class="dataLabel">
<span sugar="slot4">{MOD.LBL_FOOTER_TEXT} &nbsp;&nbsp;&nbsp;
</span sugar="slot">
</td><td align="right">
{MFP.footer} &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <select id="footer_parent" style="display:none;" onchange="FillText('footer',this);">{PARENT_OPTIONS}</select>
</td></tr></table>
<textarea id="footer_text" name="footer_text" rows="5" style="width:80%;">{FOOTER_TEXT}</textarea>
</td>
<td width="20%" colspan="" valign="top" class="dataLabel"><span sugar="slot4"></span sugar="slot"></td>
</tr>
<tr>
<td width="80%" colspan="4" valign="top" class="dataLabel">
<table width="80%"><tr><td style="width:250px;" class="dataLabel">
<span sugar="slot4">{MOD.LBL_ADS_TEXT} &nbsp;&nbsp;&nbsp;
</span sugar="slot">
</td><td align="right">
{MFP.ads} &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <select id="ads_parent" style="display:none;" onchange="FillText('ads',this);">{PARENT_OPTIONS}</select>
</td></tr></table>
<textarea id="ads_text" name="ads_text" rows="5" style="width:80%;display:block !important;">{ADS_TEXT}</textarea>
</td>
<td width="20%" colspan="" valign="top" class="dataLabel"><span sugar="slot4"></span sugar="slot"></td>
</tr>
</table>
</td>
</tr>
</table>
<div style="padding-top: 2px">
<input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" tabindex="1" class="button"
onclick="ItemListSave(true);"
type="button" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} " >
<input title="{APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{APP.LBL_CANCEL_BUTTON_KEY}" tabindex="1" class="button" onclick="this.form.action.value='{RETURN_ACTION}'; this.form.module.value='{RETURN_MODULE}'; this.form.record.value='{RETURN_ID}'" type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} ">
</div>
</form>
{JAVASCRIPT}
<!-- END: main -->

View File

@@ -0,0 +1,361 @@
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);
}
}
var tbody_;
var ItemListSave;
var ItemListClear;
var ItemListFil;
var FillText;
addEvent(
window,
'load',
function() {
var PDFLanguagesTable = new PDFLanguagesMT('PDFLanguagesTable');
PDFLanguagesTable.onRefreshRowIndex = function(row) {
var data = new Object();
data['index'] = (row.index+1).toString();
row.cells.item(0).setData(data);
}
PDFLanguagesTable.onCreateRow = function(row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function() {}
row.onSelect = function() {
for(var i=0; i<this.myTable.colCount(); i++)
this.cells.item(i).change(!this.newPos);
}
row.onDeselect = function() {
for(var i=0; i<this.myTable.colCount(); i++)
this.cells.item(i).change(false);
}
}
PDFLanguagesTable.onCreateCell = function(cell) {
var i = cell.index;
cell.change = function(select) {};
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.change = function(select) {}
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.label = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.label) cn[0].value = data.label;
}
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 == 2) {
cell.noNewAdd = true;
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.translation = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.translation) cn[0].value = data.translation;
}
var edit = '<input type="text" onFocus="this.parentNode.select();" tabindex="1" class="inputs" style="height:16px;" autocomplete="off" onKeyDown="return this.parentNode.myTable.KeyPressed(event,this.parentNode);">';
cell.innerHTML = edit;
}
}
PDFLanguagesTable.onSetCellData = function(row,cell,data) {
if(cell.innerHTML == '') cell.innerHTML = '&nbsp;';
}
ItemListSave = function(json,el) {
var data = new Object();
var tmp;
var ecmlanguage = document.getElementById('ecmlanguage').value;
if(typeof(el) == "string") ecmlanguage = el;
if(!PDFLanguagesOptions.ecmlanguage) PDFLanguagesOptions.ecmlanguage = new Object();
for(var i=0; i<PDFLanguagesTable.rowCount(); i++) {
data[i.toString()] = PDFLanguagesTable.row(i).getData();
}
PDFLanguagesOptions['ecmlanguage'][ecmlanguage]['labels'] = data;
FillText('header',document.getElementById('header_parent'));
FillText('footer',document.getElementById('footer_parent'));
FillText('ads',document.getElementById('ads_parent'));
if(json) {
var r = JSON.stringifyNoSecurity(PDFLanguagesOptions['ecmlanguage']);
doRequest(
'index.php',
'module=EcmServices&action=PDFLanguagesSave&to_pdf=1&ecmlanguage='+document.getElementById('ecmlanguage').value+'&pdflanguagelist='+r,
function(result) {
if(result.indexOf("Saved") >= 0) alert("Saving done!"); else alert("Error with saving!");
}
);
}
}
ItemListClear = function(noNew,save) {
if(typeof(save)=="string") ItemListSave(null,save);
while(PDFLanguagesTable.rowCount()>0) PDFLanguagesTable.row(0).deleteRow(noNew);
}
ItemListFill = function() {
var ecmlanguage = document.getElementById('ecmlanguage').value;
var pl;
if(PDFLanguagesOptions && PDFLanguagesOptions.ecmlanguage && PDFLanguagesOptions['ecmlanguage'][ecmlanguage]) {
pl = PDFLanguagesOptions['ecmlanguage'][ecmlanguage]['labels'];
}
FillText('header',document.getElementById('header_parent'));
FillText('footer',document.getElementById('footer_parent'));
FillText('ads',document.getElementById('ads_parent'));
if(pl && pl != '') {
try {
pl = eval(pl);
for(x in pl) { var pl_row = pl[x]; PDFLanguagesTable.addRow().setData(pl_row); }
} catch(err) { pl = null; };
}
document.getElementById('ecmlanguage').lastSelected = document.getElementById('ecmlanguage').value;
//if(PDFLanguagesTable.rowCount() == 0) PDFLanguagesTable.addRow();
}
FillText = function(name, parent) {
var text = document.getElementById(name+'_text');
var el = document.getElementById('ecmlanguage');
if(!parent.lastSelected) {
parent.lastSelected = parent.value;
parent.lastSelectedEcmLanguage = el.value;
}
else
PDFLanguagesOptions['ecmlanguage'][parent.lastSelectedEcmLanguage]['texts'][parent.lastSelected][name+'_text'] = text.value;
text.value = PDFLanguagesOptions['ecmlanguage'][el.value]['texts'][parent.value][name+'_text'];
parent.lastSelected = parent.value;
parent.lastSelectedEcmLanguage = el.value;
}
//PDFLanguagesTable.addRow();
ItemListFill();
}
);

View File

@@ -0,0 +1,174 @@
<?php
echo 1;
exit;
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
global $current_user;
if (!is_admin($current_user)) {
ACLController::displayNoAccess();
return;
}
//require_once('modules/EcmGroupServices/HeaderMenu.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".
* ****************************************************************************** */
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
global $app_list_strings;
require_once('modules/EcmServices/EcmService.php');
require_once('modules/EcmTexts/EcmText.php');
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once ($theme_path . 'layout_utils.php');
$xtpl = new XTemplate('modules/EcmServices/PDFLanguages.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
if (isset($_REQUEST['return_module']))
$xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
if (isset($_REQUEST['return_action']))
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
if (isset($_REQUEST['return_id']))
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
if (empty($_REQUEST['return_id']))
$xtpl->assign("RETURN_ACTION", 'index');
$PDFLanguagesOptions = array();
require_once('modules/EcmServices/PDFLabelList.php');
$PDFLL = array();
foreach ($PDFLabelList as $value)
$PDFLL [] = array('label' => $value, 'translation' => '');
$PDFLanguagesOptions['PDFLabelList'] = $PDFLL;
$PDFLL = array(
'labels' => $PDFLL,
'texts' => array(
'Contacts' => array(
'header_text' => $mod_strings['LBL_DEFAULT_CONTACT_HEADER_TEXT'],
'footer_text' => $mod_strings['LBL_DEFAULT_CONTACT_FOOTER_TEXT'],
'ads_text' => $mod_strings['LBL_DEFAULT_CONTACT_ADS_TEXT'],
),
'Accounts' => array(
'header_text' => $mod_strings['LBL_DEFAULT_ACCOUNT_HEADER_TEXT'],
'footer_text' => $mod_strings['LBL_DEFAULT_ACCOUNT_FOOTER_TEXT'],
'ads_text' => $mod_strings['LBL_DEFAULT_ACCOUNT_ADS_TEXT'],
)
)
);
foreach ($app_list_strings['ecmlanguages_dom'] as $key => $value) {
$data = EcmText::LoadText(null, null, "EcmServices", $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'];
}
$tmp2 = array();
foreach ($d['labels'] as $k => $v)
$tmp2[$v['label']] = $v['translation'];
$tmp = array();
$count = 0;
foreach ($PDFLanguagesOptions['PDFLabelList'] as $k => $v)
$tmp[strval($count)] = array('index' => strval($count++), 'label' => $v['label'], 'translation' => $tmp2[$v['label']]);
$d['labels'] = $tmp;
$PDFLanguagesOptions['ecmlanguage'][$key] = $d;
}
//$xtpl->assign("PHONE_LIST", EcmService::getPhoneList());
$json = getJSONobj();
$scriptOpt = '<script language="javascript">
var PDFLanguagesOptions = ' . str_replace('&quot;', '\"', $json->encode($PDFLanguagesOptions)) . '
var MOD = ' . str_replace('&quot;', '\"', $json->encode($mod_strings)) . ';
</script>';
echo $scriptOpt;
require_once('modules/EcmServices/EcmService.php');
$ecmservice = new EcmService();
$xtpl->assign("MFP", $ecmservice->loadParserArray());
$xtpl->assign("ECMLANGUAGES_OPTIONS", get_select_options_with_id($app_list_strings['ecmlanguages_dom'], ''));
$xtpl->assign("PARENT_OPTIONS", get_select_options_with_id($app_list_strings['ecmservcices_parent_dom'], ''));
echo "\n<p>\n";
echo get_module_title('EcmServices', $GLOBALS['mod_strings']['LBL_ECMSERVICES_PDFLANGUAGES_TITLE'], true);
echo "\n</p>\n";
$xtpl->parse("main");
$xtpl->out("main");
require_once('include/javascript/javascript.php');
$javascript = new javascript();
$javascript->setFormName('PDFLanguages');
// $javascript->addAllFields('');
//BUILDER:START Pro only
// $javascript->addFieldGeneric( 'team_name', 'varchar', $app_strings['LBL_TEAM'] ,'true');
// $javascript->addToValidateBinaryDependency('team_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_TEAM'], 'false', '', 'team_id');
//BUILDER:END Pro only
// $javascript->addFieldGeneric('central_areacode', 'varchar', $mod_strings['LBL_CENTRAL_AREACODE'] , 'true');
// $javascript->addToValidateBinaryDependency('central_areacode', 'alpha' ,$app_strings['ERR_SQS_NO_MATCH_FIELD'].$mod_strings['LBL_CENTRAL_AREACODE'], 'false', '', 'team_id');
// $javascript->addToValidateBinaryDependency('assigned_user_name', 'alpha', $app_strings['ERR_SQS_NO_MATCH_FIELD'] . $app_strings['LBL_ASSIGNED_TO'], 'false', '', 'assigned_user_id');
echo $javascript->getScript();

View File

@@ -0,0 +1,369 @@
function keyPressedNumber(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
return keynum;
}
function isEnterOrTabPressed(e) {
var keynum = keyPressedNumber(e);
if(keynum == 9 || keynum == 13) return true; else return false;
}
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(); }
}
function PDFLanguagesMT(name) {
this.myTableName = name;
this.table = document.getElementById(this.myTableName);
this.thead = this.table.tHead;
this.tbody = this.table.tBodies.item(0);
this.cellSelectedClass = 'selectedCell';
this.rowSelectedClass = 'selectedRow';
this.selectedRow;
this.selectedCell;
this.rowCount = function() {
return this.tbody.rows.length;
}
this.colCount = function() {
return this.thead.rows.item(0).cells.length;
};
this.colWidth = function(i) {
return this.thead.rows.item(0).cells.item(i).width;
};
this.moveUpRow = function() {
if(this.selectedRow) this.selectedRow.moveUp();
};
this.moveDownRow = function() {
if(this.selectedRow) this.selectedRow.moveDown();
};
this.insertRow = function(row, newRow) {
if(!row)
if(this.rowCount())
if(typeof(row) == "number")
row = this.tbody.rows.item(row);
else
row = this.tbody.rows.item(this.tbody.rows.length-1);
var row_tmp;
if((newRow) && (row)) row_tmp = newRow; else { row_tmp = this.createRow(); this.fillWithDefaultData(row_tmp); }
if(this.rowCount() > 0 && row.nextSibling)
this.tbody.insertBefore(row_tmp, row.nextSibling);
else
this.tbody.appendChild(row_tmp);
return row_tmp;
};
this.refreshRowIndex = function() {
for(var i=0; i<this.rowCount(); i++) {
this.tbody.rows.item(i).index = i;
if(this.onRefreshRowIndex) this.onRefreshRowIndex(this.tbody.rows.item(i));
}
}
this.onRefreshRowIndex;
this.addRow = function(i,data) {
var row = this.createRow();
if(this.selectedRow) this.selectedRow.deselect();
if(this.selectedCell) this.selectedCell.deselect();
row.myTable = this;
if(i || i===0)
this.tbody.insertBefore(row,this.tbody.rows.item(i));
else
this.tbody.appendChild(row);
this.refreshRowIndex();
this.setRowData(row, data);
for(var i=0; i<this.colCount(); i++) row.cells.item(i).afterCreate();
return row;
}
this.createRow = function(row) {
var row = document.createElement('tr');
row.myTable = this;
row.isnew = false;
row.onclick = function() { this.select(); }
row.select = function() {
if(!this.myTable.selectedRow || this.myTable.selectedRow !== this) {
if(this.myTable.selectedRow) this.myTable.selectedRow.deselect();
this.myTable.selectedRow = this;
this.className = this.myTable.rowSelectedClass;
if(row.onSelect) row.onSelect();
}
}
row.deselect = function() {
if(this.myTable.selectedRow === this) {
this.className = '';
this.myTable.selectedRow = '';
if(row.onDeselect) row.onDeselect();
}
};
row.selectNext = function() {
if(this.index < this.myTable.rowCount()-1) { this.deselect(); this.nextSibling.select(); return this.nextSibling; }
else {
if(this.noAddNew) return this;
this.deselect();
var row = this.myTable.addRow(); return row;
}
}
row.selectPrevious = function() {
this.deselect();
if(this.previousSibling && this.index > 0) { this.previousSibling.select(); return this.previousSibling; }else return this;
}
row.deleteRow = function(noNew) {
if(this.myTable.selectedCell) this.myTable.selectedCell.deselect();
if(this.myTable.selectedRow) this.myTable.selectedRow.deselect();
if(this.myTable.rowCount() == 1 && !noNew) {
var MyTaBlE = this.myTable;
setTimeout( function() { MyTaBlE.addRow(); } , 1000);
}
this.myTable.tbody.removeChild(this);
this.myTable.refreshRowIndex();
}
row.moveUp = function() {
if(!this.previousSibling) return;
this.myTable.tbody.insertBefore(this,this.previousSibling);
this.myTable.refreshRowIndex();
}
row.moveDown = function() {
if(!this.nextSibling) this.myTable.addRow(row);
this.myTable.tbody.insertBefore(this.nextSibling,this);
this.myTable.refreshRowIndex();
}
row.setData = function(data) {
if(!data || typeof(data) != "object") { return; };
for(var i=0; i<this.myTable.colCount(); i++) {
this.cells.item(i).setData(data);
}
}
row.getData = function() {
var data = new Object();
for(var i=0; i<this.myTable.colCount(); i++) {
if(this.cells.item(i).getData) this.cells.item(i).getData(data,true);
}
return data;
}
for(var i=0; i<this.colCount(); i++) {
var cell = this.createCell(i);
row.appendChild(cell);
}
if(this.onCreateRow) this.onCreateRow(row);
return row;
};
this.onCreateRow; //function(row) {}
this.createCell = function(i) {
var cell = document.createElement('td');
cell.index = i;
cell.myTable = this;
cell.onclick = function() { this.select(); }
cell.select = function() {
if(!this.myTable.selectedCell || this.myTable.selectedCell !== this) {
if(this.myTable.selectedCell) this.myTable.selectedCell.deselect();
this.myTable.selectedCell = this;
if(this.firstChild.focus && !this.noSelect) setSelectionRange(this.firstChild);
if(this.onSelect) this.onSelect();
this.className = this.myTable.cellSelectedClass;
}
}
cell.deselect = function() {
if(this.myTable.selectedCell === this) {
if(cell.onDeselect) cell.onDeselect();
this.className = '';
this.selected = false;
this.myTable.selectedCell = '';
}
};
cell.selectNext = function() {
this.deselect();
if(this.nextSibling) this.nextSibling.select();
else {
if(!this.parentNode.nextSibling) { if(this.noNewAdd) return; else this.myTable.addRow(); }
this.parentNode.nextSibling.select();
this.parentNode.nextSibling.firstChild.select();
}
}
cell.afterCreate = function() {}
cell.setData = function(data) {}
cell.getData = function(data) {}
if(this.onCreateCell) this.onCreateCell(cell);
return cell;
};
this.onCreateCell; //function(cell) {}
this.setRowData = function(row,data) {
for(var i=0; i<this.colCount(); i++) {
this.setCellData(row,row.cells.item(i),data);
}
}
this.setCellData = function(row,cell,data) {
if(typeof(row) == "number")
if(this.tbody.rows.item(row)) row = this.tbody.rows.item(row);
if(typeof(cell) != "object")
if(typeof(cell) == "number" && typeof(row) == "object") {
if(row.cells.item(cell))
cell = row.cells.item(cell);
else return;
}
else return;
if(this.onSetCellData) this.onSetCellData(row,cell,data);
}
this.onSetCellData; //function(row,cell,data) {}
this.selectRow = function(row) {
if(this.selectedRow === row) return;
if(this.selectedRow) this.deselectRow();
this.selectedRow = row;
this.selectedRow.className = this.rowSelectedClass;
this.setEditNames(this.selectedRow,!this.selectedRow.isnew);
}
this.selectNextRow = function() {
if(!this.selectedRow) return;
if(!this.selectedRow.nextSibling) this.insertRow();
var cell_id = this.selectedCell.lp;
this.selectRow(this.selectedRow.nextSibling);
this.selectCell(this.selectedRow.cells.item(cell_id));
}
this.selectPreviousRow = function() {
if(!this.selectedRow) return;
if(!this.selectedRow.previousSibling) return;
if(this.selectedRow === this.tbody.rows.item(0)) return;
var cell_id = this.selectedCell.lp;
this.selectRow(this.selectedRow.previousSibling);
this.selectCell(this.selectedRow.cells.item(cell_id));
}
this.refreshNumeration = function() {
for(var i=0; i<this.tbody.rows.length; i++)
this.tbody.rows.item(i).cells.item(0).firstChild.value = i+1;
}
this.KeyPressedNumber = function(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
return keynum;
}
this.KeyPressed = function(e, cell, method) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
if((keynum == 9) || (keynum == 13)) {
cell.selectNext();
return false;
}
if(keynum == 40) { var id = cell.index; var row = cell.parentNode.selectNext(); if(row) { row.select(); row.cells.item(id).select(); } }
if(keynum == 38) { var id = cell.index; var row = cell.parentNode.selectPrevious(); if(row) { row.select(); row.cells.item(id).select(); } }
if(e.shiftKey && (method == "decimalNumber" || method == "onlyNumber")) return false;
if(method == "decimalNumber") return this.OnlyNumbers(keynum);
if(method == "onlyNumber") return this.OnlyNumbers(keynum, true);
return true;
}
this.OnlyNumbers = function(e, noQuote) { var keynum = e, keychar, numcheck;
keychar = String.fromCharCode(keynum);
numcheck = /\d/;
return numcheck.test(keychar) || ((!noQuote)?(keynum == 190):false)
|| (keynum == 8) //backspace
|| (keynum == 46) //delete
|| (keynum == 13) //enter || (keynum == 0) //special keys with FF
|| (keynum == 37) //left arrow
|| (keynum == 39) //right arrow
|| (keynum == 188); //,
}
this.row = function(i) { if(this.tbody.rows.item(i)) return this.tbody.rows.item(i); }
this.cells = function(i,j) { if(this.tbody.rows.item(i).cells.item(i)) return this.tbody.rows.item(i).cells.item(i); }
}

View File

@@ -0,0 +1,28 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $current_user;
if(!is_admin($current_user)) {
ACLController::displayNoAccess();
return;
}
if(isset($_REQUEST['ecmlanguage']) && $_REQUEST['ecmlanguage'] != '' && isset($_REQUEST['pdflanguagelist']) && $_REQUEST['pdflanguagelist'] != '') {
require_once('modules/EcmTexts/EcmText.php');
$json = getJSONobj();
$pdfll = $json->decode(htmlspecialchars_decode($_REQUEST['pdflanguagelist']));
global $app_list_strings;
foreach($app_list_strings['ecmlanguages_dom'] as $key => $value) {
if(isset($pdfll[$key]) && count($pdfll[$key]) > 0)
EcmText::SaveText(null,null,'EcmServices',$key,$pdfll[$key]);
}
echo 'Saved';
}
?>

View File

@@ -0,0 +1,158 @@
<?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.
* ****************************************************************************** */
$json = getJSONobj();
$pll = $sll = $ill = array();
$i = $j = $k = 0;
// Article/Item type items.
while (isset($_POST['p_' . $i])) {
$pll[] = $json->decode(htmlspecialchars_decode($_POST['p_' . $i]));
$_POST['p_' . $i] = '';
$i++;
}
// Service type items.
while (isset($_POST['s_' . $j])) {
$sll[] = $json->decode(htmlspecialchars_decode($_POST['s_' . $j]));
$_POST['s_' . $j] = '';
$j++;
}
// Income type items.
while (isset($_POST['i_' . $k])) {
$ill[] = $json->decode(htmlspecialchars_decode($_POST['i_' . $k]));
$_POST['i_' . $k] = '';
$k++;
}
$_POST = $json->decode(htmlspecialchars_decode($_POST['otherFormData']));
$_POST['position_list'] = $pll;
$_POST['services_list'] = $sll;
$_POST['income_list'] = $ill;
// Get ridd of hashes in encoded by javascript json string.
$_POST['history'] = $json->decode(htmlspecialchars_decode($_POST['history']));
$_POST['history'] = array_values(array_filter($_POST['history'], 'is_array'));
//echo var_export($_POST['history'], true);
//return;
$_POST['history'] = $json->encode($_POST['history']);
$_REQUEST = $_POST;
require_once('modules/EcmServices/EcmService.php');
require_once('include/formbase.php');
$focus = new EcmService();
if (isset($_POST['record']) && $_POST['record'] != '') {
$focus->retrieve($_POST['record']);
}
if (!$focus->ACLAccess('Save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$check_notify = FALSE;
foreach ($focus->column_fields as $field) {
if (isset($_POST[$field])) {
$value = $_POST[$field];
$focus->$field = $value;
}
}
foreach ($focus->additional_column_fields as $field) {
if (isset($_POST[$field])) {
$value = $_POST[$field];
$focus->$field = $value;
}
}
if (isset($_POST['to_is_vat_free']) && $_POST['to_is_vat_free'])
$focus->to_is_vat_free = 1;
else
$focus->to_is_vat_free = 0;
$pl = $_POST['position_list'];
$sl = $_POST['services_list'];
$il = $_POST['income_list'];
//echo var_export($pl);
//exit;
$focus->position_list = $pl;
$focus->services_list = $sl;
$focus->income_list = $il;
//echo var_export($focus->history, true);exit;
//return;
//if($focus->status != 'closed')
$focus->save($check_notify);
if($_POST['stock_doc_inside_in'])
$focus->saveStockDocInsideIn();
$return_id = $focus->id;
//echo 'KONIEC';
echo $return_id;
die();
//handleRedirect($return_id,'EcmServices');

View File

@@ -0,0 +1,14 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
extract($_POST, EXTR_PREFIX_SAME, "wddx");
global $app_list_strings, $mod_strings;
require_once('modules/EcmServices/EcmService.php');
$arr = EcmService::setStatus($record,$status);
$json = getJSONobj();
echo '['.str_replace('&quot;','\"',$json->encode($arr)).']';
?>

View File

@@ -0,0 +1,42 @@
<?php
$status_access = array(
'user_manager_role' => array (
's10' => true,
's20' => false,
's30' => true,
's40' => true,
's50' => array('ifnot'=>array('s10','s20','s40')),
's60' => array('ifnot'=>array('s10','s20','s40')),
's70' => array('ifnot'=>array('s10','s20','s40')),
),
'user_representative_extra_role' => array (
's10' => array('if'=>array('s40')),
's20' => false,
's30' => true,
's40' => false,
's50' => array('ifnot'=>array('s10','s20','s40')),
's60' => array('ifnot'=>array('s10','s20','s40')),
's70' => array('ifnot'=>array('s10','s20','s40')),
),
'user_representative_role' => array (
's10' => array('if'=>array('s40')),
's20' => array('if'=>array('s10')),
's30' => false,
's40' => false,
's50' => array('ifnot'=>array('s10','s20','s40')),
's60' => array('ifnot'=>array('s10','s20','s40')),
's70' => array('ifnot'=>array('s10','s20','s40')),
),
'admin' => array(
's10' => true,
's20' => false,
's30' => true,
's40' => true,
's50' => array('ifnot'=>array('s10','s20','s40')),
's60' => array('ifnot'=>array('s10','s20','s40')),
's70' => array('ifnot'=>array('s10','s20','s40')),
)
);
?>

View File

@@ -0,0 +1,50 @@
<?php
//ini_set('display_errors', '1');
//error_reporting(E_ALL);
require_once('modules/EcmServices/EcmService.php');
$uids = explode(',', @$_REQUEST['uid']);
$e = array();
foreach ($uids as $uid) {
// var_dump($uid);
$focus = new EcmService();
$focus->retrieve($uid);
$focus->format_all_fields();
$focus->position_list = $focus->getPositionList(true);
/*
var_dump($a = ($focus->status != 'closed'));
var_dump($b = (!count($focus->position_list)));
var_dump($a && $b);
exit;
*/
if (!count($focus->position_list) && $focus->status != 'closed') {
// WZ
$focus->saveStockDocOut();
// Status
$focus->close();
$focus->save();
} else {
$e[] = sprintf($mod_strings['ERR_SERVICE_CLOSE'], $focus->document_no);
}
}
$uri = 'index.php?module=EcmServices';
if (count($e)) {
echo '<style>ul.error-list li { color: red; margin: 10px 0; padding: 5px 0; font-weight: bold; }</style><ul class="error-list"><li>' . implode('</li><li>', $e) . '</li></ul>';
header('Refresh: 3;url=' . $uri);
exit;
} else {
header('Location: ' . $uri);
exit;
}

View File

@@ -0,0 +1,56 @@
<?php
//sugar_die('Deprecated!');
//ini_set('display_errors', '1');
//error_reporting(E_ALL);
require_once('modules/EcmServices/EcmService.php');
$uids = explode(',', @$_REQUEST['uid']);
$e = array();
foreach ($uids as $uid) {
$focus = new EcmService();
$focus->retrieve($uid);
$focus->format_all_fields();
if ($focus->status != 'closed') {
$url = 'index.php?module=EcmInvoiceOuts&action=EditView&parent_doc_type=EcmServices&uid=' . $uid;
header("Location: $url");
exit;
/*
// DEPRECATED !
// WZ
//$focus->saveStockDocOut();
// FK
$inv_id = $focus->saveInvoiceOut();
// Status
$focus->close();
//TODO przenieść rezerwacje ze zlecenia wewnętrznego na fakturę
//TODO nie przenoszą się ceny jednostkowe na FV (tylko wartośc)
$focus->save();
*/
} else {
$e[] = 'Nie można zamknąć zlecenia ' . $focus->document_no . ' ponieważ jest już zamknięte.';
}
}
// pozujemy stworzoną fakturkę (do zaakceptowania)
//$uri = 'index.php?module=EcmInvoiceOuts&action=EditView&record='.$inv_id;
$uri = 'index.php?module=EcmServices';
if (count($e)) {
echo '<style>ul.error-list li { color: red; margin: 10px 0; padding: 5px 0; font-weight: bold; }</style><ul class="error-list"><li>' . implode('</li><li>', $e) . '</li></ul>';
header('Refresh: 3;url=' . $uri);
exit;
} else {
header('Location: ' . $uri);
exit;
}

View File

@@ -0,0 +1,60 @@
<?php
//sugar_die('Deprecated!');
//ini_set('display_errors', '1');
//error_reporting(E_ALL);
require_once('modules/EcmServices/EcmService.php');
$uids = explode(',', @$_REQUEST['uid']);
$e = array();
foreach ($uids as $uid) {
//var_dump($uid);
$focus = new EcmService();
$focus->retrieve($uid);
$focus->format_all_fields();
/*
var_dump($a = ($focus->status != 'closed'));
exit;
*/
// var_dump($focus->toArray());
if ($focus->status != 'closed') {
$url = 'index.php?module=EcmStockDocInsideOuts&action=EditView&parent_doc_type=EcmServices&uid=' . $uid;
header("Location: $url");
exit;
/*
// DEPRECATED !
// WZ
// $focus->saveStockDocOut();
// RW
$focus->saveStockDocInsideOut();
// Status
$focus->close();
$focus->save();
*/
} else {
$e[] = 'Nie można zamknąć zlecenia ' . $focus->document_no . ' ponieważ jest już zamknięte.';
}
}
$uri = 'index.php?module=EcmServices';
if (count($e)) {
echo '<style>ul.error-list li { color: red; margin: 10px 0; padding: 5px 0; font-weight: bold; }</style><ul class="error-list"><li>' . implode('</li><li>', $e) . '</li></ul>';
header('Refresh: 3;url=' . $uri);
exit;
} else {
header('Location: ' . $uri);
exit;
}

View File

@@ -0,0 +1,49 @@
<?php
//ini_set('display_errors', '1');
//error_reporting(E_ALL);
class EcmServicesController extends SugarController {
/**
* Close service.
*/
public function action_close() {
if (!empty($_REQUEST['uid'])) {
$url = 'index.php?module=EcmServices&action=action_close&uid=' . $_REQUEST['uid'];
header("Location: $url");
}
sugar_die('');
}
/**
* FK.
*/
public function action_invoice() {
if (!empty($_REQUEST['uid'])) {
$url = 'index.php?module=EcmServices&action=action_invoice&uid=' . $_REQUEST['uid'];
//$url = 'index.php?module=EcmInvoiceOuts&action=EditView&parent_doc_type=EcmServices&uid=' . $_REQUEST['uid'];
header("Location: $url");
}
sugar_die('');
}
/**
* RW.
*/
public function action_rw() {
if (!empty($_REQUEST['uid'])) {
$url = 'index.php?module=EcmServices&action=action_rw&uid=' . $_REQUEST['uid'];
//$url = 'index.php?module=EcmStockDocInsideOuts&action=EditView&parent_doc_type=EcmServices&uid=' . $_REQUEST['uid'];
header("Location: $url");
}
sugar_die('');
}
}

View File

@@ -0,0 +1,153 @@
<?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.
********************************************************************************/
$fields_array['EcmService'] = array (
'column_fields' => Array (
'id',
'name',
'description',
'date_entered',
'date_modified',
'deleted',
'modified_user_id',
'assigned_user_id',
'created_by',
//NEW COLUMN FIELDS
'number',
'parent_type',
'parent_name',
'parent_id',
'type',
'status',
'register_date',
'parent_address_street',
'parent_address_city',
'parent_address_postalcode',
'parent_address_country',
'subtotal',
'total',
'discount',
'to_vatid',
'ecmlanguage',
'to_is_vat_free',
'header_text',
'footer_text',
'ads_text',
'template_id',
'template_name',
'email_id',
'ecmpaymentcondition_id',
'ecmpaymentcondition_name',
'ecmdeliverycondition_id',
'ecmdeliverycondition_name',
'validtill_date',
'order_origin',
'contact_id',
'contact_name',
'show_images_on_offers',
'parent_name_copy',
'parent_contact_name',
'parent_contact_title',
'pricebook_id',
'currency_name',
'currency_id',
'show_recipient_code',
),
'list_fields' => Array (
'number',
'document_no',
'parent_type',
'parent_name',
'parent_id',
'type',
'status',
'register_date',
'parent_address_street',
'parent_address_city',
'parent_address_postalcode',
'parent_address_country',
'subtotal',
'total',
'discount',
'to_vatid',
'ecmlanguage',
'to_is_vat_free',
'header_text',
'footer_text',
'ads_text',
'template_id',
'template_name',
'email_id',
'ecmpaymentcondition_id',
'ecmpaymentcondition_name',
'ecmpaymentcondition_text',
'ecmdeliverycondition_id',
'ecmdeliverycondition_name',
'ecmdeliverycondition_text',
'validtill_date',
'order_origin',
'contact_id',
'contact_name',
'show_images_on_offers',
'parent_name_copy',
'parent_contact_name',
'parent_contact_title',
'pricebook_id',
'currency_name',
'currency_id',
'show_recipient_code',
),
'required_fields' => array (
'number' => 1
),
);
?>

View File

@@ -0,0 +1,163 @@
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.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,212 @@
<?php
/**
* form loader.
*/
$module = $_REQUEST['module'];
$cM = $_REQUEST['createModule'];
$lA = $_REQUEST['loaderAction'];
$fN = $_REQUEST['loaderFieldName'];
$record = $_REQUEST['record'];
if ($lA == "EditView") {
ob_start();
$_REQUEST['module'] = $cM;
$_REQUEST['action'] = "EditView";
$_REQUEST['record'] = $record;
$_POST['module'] = $cM;
$_POST['action'] = "EditView";
$_POST['record'] = $record;
$_GET['record'] = $record;
include('index.php');
$out = ob_get_contents();
ob_end_clean();
echo $out;
return;
}
if ($lA == "get_module_fields") {
global $beanList, $beanFiles;
$file = 'cache/modules/' . $cM . '/' . $beanList[$cM] . 'vardefs.php';
if (file_exists($file)) {
include($file);
$dict = $GLOBALS['dictionary'][$beanList[$cM]]['fields'];
} else {
$file = 'modules/' . $cM . '/vardefs.php';
if (file_exists($file)) {
include($file);
$dict = $dictionary[$beanList[$cM]]['fields'];
} else
return;
}
$file = $beanFiles[$beanList[$cM]];
if (file_exists($file)) {
require_once($file);
$bean = new $beanList[$cM]();
$bean->retrieve($record);
if (isset($bean->id) && $bean->id != '') {
$arr = array();
foreach ($dict as $key => $value) {
if (isset($bean->$value['name']) && (is_string($bean->$value['name']) || is_float($bean->$value['name']) || is_int($bean->$value['name']) || is_bool($bean->$value['name'])))
$arr[$value['name']] = $bean->$value['name'];
}
$json = getJSONobj();
echo '[' . str_replace('&quot;', '\"', $json->encode($arr)) . ']';
} else
return;
}
return;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<title></title>
<script type="text/javascript" src="include/javascript/sugar_grp1_yui.js?s=5.0.0c&c="></script>
</head>
<body>
<div id="hidder" style="position:absolute;left:0;top:0;width:105%;height:100%;background-color:white;visibility:visible;text-align:center;padding:40px;"><img src="themes/default/images/loading.gif"/></div>
<script language="javascript">
function doRequest(where,post,success,error) {
this.Display = function(result) { success(result.responseText); }
this.Fail = function(result){ if(error) error(result); }
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function iframeLoad() {
var frame = document.getElementById("input_create");
var doc = frame.contentDocument;
if(typeof(doc) == "undefined" || !doc)
doc = frame.contentWindow.document;
if(doc && doc.forms && ((doc.forms.EditView || doc.forms.DetailView || doc.forms.Save) || doc.return_module_fields)) {
if(doc.forms.EditView) {
} else
if(doc.forms.DetailView) {
var record = doc.forms.DetailView.record;
if(record && record.value != "") {
doRequest(
"index.php",
"module="+module+"&action=formloader&loaderAction=get_module_fields&createModule="+cM+"&to_pdf=1&record="+record.value,
function(result) {
if(result == '')
window.close();
else {
var obj = eval(result);
if(obj) {
obj = obj[0];
eval('window.opener.'+fN+'.responseData(obj)');
}
window.close();
}
},
function(result) {
window.close();
}
);
} else window.close();
} else {
if(doc.forms.Save) {
}
}
} else {
window.close();
return;
}
var main = doc.getElementById('main');
if(main) {
var dd = doc.createElement('div');
dd.innerHTML = '<table style="width:100%;"><tr id="main2"></tr></table>';
doc.body.insertBefore(dd,doc.body.firstChild);
doc.getElementById('main2').appendChild(main);
main.style.position = 'absolute';
main.style.left = 0;
main.style.top = 0;
for(var i=1; i<doc.body.childNodes.length; i++) if(doc.body.childNodes[i] !== main && doc.body.childNodes[i].style) {
doc.body.childNodes[i].style.visibility = 'hidden';
}
if(doc && doc.forms && !doc.forms.DetailView)
doc.body.FormLoader = true;
}
}
var oldLocation = '';
setInterval(function(){
var frame = document.getElementById("input_create");
if(frame) {
var doc = frame.contentDocument;
if(doc == undefined || doc == null)
doc = frame.contentWindow.document;
if(doc && doc.body && doc.body.FormLoader) {
if(hidder.style.visibility = "visible")
hidder.style.visibility = "hidden";
} else {
if(hidder.style.visibility = "hidden")
hidder.style.visibility = "visible"
}
}
},
60);
</script>
<?php
if ($lA == "ViewForm") {
echo '<script language="javascript">
var module = "' . $module . '";
var cM = "' . $cM . '";
var lA = "' . $lA . '";
var fN = "' . $fN . '";
</script>';
$data = '';
foreach ($_REQUEST as $key => $value) {
if (strpos($key, "fl_") === 0) {
$data .= "&" . substr($key, 3) . "=" . $value;
}
}
echo "<iframe onload='iframeLoad();' frameborder='no' width='100%' height='100%' id='input_create' name='input_create' src='index.php?module=$module&action=formloader&to_pdf=1&loaderAction=EditView&createModule=$cM" . $data . "'></iframe>";
}
?>
</body>
</html>

View File

@@ -0,0 +1,29 @@
<?php
require_once('modules/EcmServices/EcmService.php');
$focus = new EcmService();
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]] = $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,263 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
$mod_strings = array(
// 080313 mh
'SERVICE_PW_NAME' => 'PW zamówienia serwisowego %s',
'SERVICE_WZ_NAME' => 'WZ zamówienia serwisowego %s',
//
'ERR_SERVICE_CLOSE' => 'Nie można zamknąć zlecenia %s ponieważ posiada listę materiałów lub jest już zamknięte.',
'ERR_SERVICE_FK' => 'Nie można wystawić faktury dla zlecenia %s ponieważ jest ono już zamknięte.',
'ERR_SERVICE_RW' => 'Nie można wystawić RW dla zlecenia %s ponieważ jest już zamknięte.',
//
'LBL_ACCEPTED' => 'Accepted',
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
'LBL_ACCEPT_BUTTON_LABEL' => 'Accept',
'LBL_ACCEPT_BUTTON_TITLE' => 'Accept [Alt+Z]',
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => 'You don\'t have a permission to send Email, because this Quote is not accepted by Manager!',
'LBL_ADS_TEXT' => 'Ads Text',
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Would you like to load default texts correspondencing to this language?',
'LBL_ARTICLES_SUBTOTAL' => 'Suma netto materiałów',
'LBL_ARTICLES_TOTAL' => 'Suma brutto materiałów',
'LBL_ASSIGNED_TO' => 'Assigned To',
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
'LBL_ASSIGNED_TO_USER' => 'Assigned To',
'LBL_CONFIRM_QUESTION' => 'Would you like to confirm this Quote?',
'LBL_CONTACT_ID' => 'Contact Id',
'LBL_CONTACT_NAME' => 'Contact',
'LBL_CREATED' => 'Created by',
'LBL_CREATED_BY_USER' => 'Created by',
'LBL_CREATE_ECMINVOICEOUT_BUTTON_LABEL' => 'Create Invoice',
'LBL_CURRENCY' => 'Currency',
'LBL_DASHLET_MY_ECMSERVICES' => 'Quotes',
'LBL_DATE_ENTERED' => 'Date Entered',
'LBL_DATE_MODIFIED' => 'Date Modified',
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla:',
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
'LBL_DELETED_BY' => 'Deleted by',
'LBL_DELETE_ROW' => 'Delete row',
'LBL_DELIVERYCONDITION_ID' => 'Delivery Condition ID',
'LBL_DELIVERYCONDITION_NAME' => 'Delivery Condition',
'LBL_DEMO_VERSION_INFORMATION' => 'This is only demo version.
Please contact us at ca@more7.com.',
'LBL_DESCRIPTION' => 'Description',
'LBL_DETAILS' => 'Quote details:',
'LBL_DETAILS_TAB' => 'Details',
'LBL_DETAIL_BUTTON' => 'Details',
'LBL_DISCOUNT' => 'Discount',
'LBL_DISCOUNT_ERROR' => 'Discount Format Number Error',
'LBL_DOCUMENT_NO' => 'Number',
'LBL_ECMLANGUAGE' => 'Language',
'LBL_ECMSERVICES_PDFLANGUAGES_TITLE' => 'PDF Languages Settings',
'LBL_ECMSERVICE_ID' => 'Quote Id',
'LBL_ECMSERVICE_NAME' => 'Quote Name',
'LBL_ECMSERVICE_NAME_OTHER' => 'Inne',
'LBL_ECMSERVICE_NAME_PAYABLE' => 'Płatne',
'LBL_ECMSERVICE_NAME_WARRANTY' => 'Gwarancyjne',
'LBL_ECMSERVICE_STATUS_CLOSED' => 'Zamknięte',
'LBL_ECMSERVICE_STATUS_IN_PROGRESS' => 'W trakcie realizacji',
'LBL_ECMSERVICE_STATUS_OPEN' => 'Otwarte',
'LBL_ECMSERVICE_STATUS_OTHER' => 'Inne',
'LBL_ECMTEAM_ID' => 'Team ID',
'LBL_ECMTEAM_NAME' => 'Team',
'LBL_EDITTABLE_CODE' => 'Code',
'LBL_EDITTABLE_DISCOUNT' => 'Discount',
'LBL_EDITTABLE_NAME' => 'Name',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_OPTIONS' => 'Opt',
'LBL_EDITTABLE_PRICE' => 'Price',
'LBL_EDITTABLE_QUANTITY' => 'Quant',
'LBL_EDITTABLE_RECIPIENT_CODE' => 'Recipient Code',
'LBL_EDITTABLE_RESERVATION' => 'Reservation',
'LBL_EDITTABLE_SERVICE' => 'Service number',
'LBL_EDITTABLE_TOTAL' => 'Total',
'LBL_EDITTABLE_UNIT' => 'Unit',
'LBL_EDITTABLE_VAT' => 'VAT',
'LBL_EMAIL' => 'Create Email:',
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emails',
'LBL_EMAIL_TAB' => 'Email',
'LBL_FK_PARENT_ID' => 'Faktura zlecenia',
'LBL_FOOTER_TEXT' => 'Footer Text',
'LBL_FORMAT_NUMBER_ERROR' => 'Format Number Error!',
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Go to list',
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Go to quotes list [Alt+G]',
'LBL_HEADER_TEXT' => 'Header Text',
'LBL_ID' => 'Id',
'LBL_IMG_EDIT' => 'Edit',
'LBL_IMG_NEW' => 'New, add to base',
'LBL_IMG_SEARCH' => 'Search',
'LBL_INCOME' => 'Na serwis',
'LBL_INCOME_TAB' => 'Income items',
'LBL_INSERT_NEW_ROW' => 'Insert new row',
'LBL_ITEMS' => 'Items included:',
'LBL_ITEMS_TAB' => 'Items',
'LBL_LISTVIEW_CREATE_INVOICE' => 'Create invoice',
'LBL_LISTVIEW_REALIZATION_LIST' => 'Realization List',
'LBL_LISTVIEW_SERVICE_CLOSE' => 'Zamknij zlecenie',
'LBL_LISTVIEW_SERVICE_INVOICE' => 'Faktura',
'LBL_LISTVIEW_SERVICE_RW' => 'Rozchód wewnętrzny',
'LBL_LIST_ACCEPT' => 'Accept',
'LBL_LIST_DOWNLOAD_PDF' => 'Download PDF',
'LBL_LIST_DUPLICATE' => 'Duplicate',
'LBL_LIST_FORM_TITLE' => 'Quotes List',
'LBL_LIST_PREVIEW_PDF' => 'Preview Quote',
'LBL_LIST_REJECT' => 'Reject',
'LBL_LIST_SEND_TO_CONFIRM' => 'Send To Confirm',
'LBL_LIST_TO_INVOICE' => 'Create Invoice.',
'LBL_LIST_TO_SERVICE' => 'Create Services Order.',
'LBL_MODIFIED' => 'Last Modified',
'LBL_MODIFIED_BY_USER' => 'Modified by',
'LBL_MODIFIED_USER' => 'Modified By',
'LBL_MODULE_ID' => 'EcmServices',
'LBL_MODULE_NAME' => 'Quotes',
'LBL_MODULE_TITLE' => 'Quotes: Home',
'LBL_MOVE_ROW_DOWN' => 'Move Down',
'LBL_MOVE_ROW_UP' => 'Move Up',
'LBL_NAME' => 'Name',
'LBL_NEW_FORM_TITLE' => 'New Quote',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notes',
'LBL_NOT_SAVED' => 'Quote not saved. Please check all fields are correct!',
'LBL_NUMBER' => 'Number',
'LBL_ORDER_ORIGIN' => 'Order Origin',
'LBL_PARENT' => 'To',
'LBL_PARENT_ADDRESS_CITY' => 'Postalcode / City',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Country',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Postalcode',
'LBL_PARENT_ADDRESS_STREET' => 'Street',
'LBL_PARENT_COMMENT' => 'Opis zleceniodawcy',
'LBL_PARENT_CONTACT_NAME' => 'Contact Person',
'LBL_PARENT_CONTACT_PHONE_FAX' => 'Telefon kontaktowy',
'LBL_PARENT_CONTACT_TITLE' => 'Contact Title',
'LBL_PARENT_ID' => 'Account Id',
'LBL_PARENT_NAME' => 'Account',
'LBL_PARENT_NAME_COPY' => 'Company Name',
'LBL_PAYMENTCONDITION_ID' => 'Payment Condition ID',
'LBL_PAYMENTCONDITION_NAME' => 'Payment Condition',
'LBL_PAYMENT_DATE' => 'Payment Date',
'LBL_PDF_ARTICLES_TOTAL' => 'Razem materiały',
'LBL_PDF_CODE' => '',
'LBL_PDF_DATE_REGISTER' => 'Data wystawienia',
'LBL_PDF_DISCOUNT' => 'RABAT',
'LBL_PDF_DOCUMENT_AFTER_CORRECT' => 'After Correct: ',
'LBL_PDF_DOCUMENT_BEFORE_CORRECT' => 'Before Correct: ',
'LBL_PDF_DOCUMENT_CORRECT_DIFFERENCE' => 'Difference: ',
'LBL_PDF_DOCUMENT_NAME' => 'Oferta',
'LBL_PDF_END_TOTAL' => 'Suma koncowa',
'LBL_PDF_FILENAME' => 'Quote_',
'LBL_PDF_INCOME_DOCUMENT_NAME' => 'Otwarcie zlecenia',
'LBL_PDF_LIST_CODE' => 'Index',
'LBL_PDF_LIST_DESCRIPTION' => 'Opis',
'LBL_PDF_LIST_DISCOUNT' => 'Rabat',
'LBL_PDF_LIST_NAME' => 'Nazwa',
'LBL_PDF_LIST_POSITION' => 'Poz.',
'LBL_PDF_LIST_PRICE' => 'Cena',
'LBL_PDF_LIST_QUANTITY' => 'Ilosc',
'LBL_PDF_LIST_TOTAL' => 'Suma',
'LBL_PDF_LIST_UNIT' => '',
'LBL_PDF_LIST_VAT' => 'VAT',
'LBL_PDF_NUMBER' => 'Numer',
'LBL_PDF_OWNER' => 'Wystawil',
'LBL_PDF_QTY_DOCUMENT_NAME' => 'Wykaz ilościowy',
'LBL_PDF_SERVICES_TOTAL' => 'Razem usługi',
'LBL_PDF_TOTAL' => 'Suma',
'LBL_PDF_VALIDTILL_DATE' => 'Waznosc oferty',
'LBL_PDF_VAL_DOCUMENT_NAME' => 'Wykaz wartościowy',
'LBL_PDF_VAT' => 'VAT',
'LBL_PDF_VATID' => 'VAT-ID',
'LBL_PDF_WARRANTY_DOCUMENT_NAME' => 'Protokół rozpatrzenia reklamacji',
'LBL_PREVIEW' => 'Preview PDF:',
'LBL_PREVIEW_HEADER_CLOSE' => 'Close',
'LBL_PREVIEW_HEADER_NAME' => 'Preview',
'LBL_PREVIEW_INCOME' => 'Otwarcie',
'LBL_PREVIEW_INCOME_TAB' => 'Otwarcie',
'LBL_PREVIEW_QTY' => 'Wykaz ilościowy',
'LBL_PREVIEW_QTY_TAB' => 'Wykaz ilościowy',
'LBL_PREVIEW_TAB' => 'Preview',
'LBL_PREVIEW_VAL' => 'Wykaz wartościowy',
'LBL_PREVIEW_VAL_TAB' => 'Wykaz wartościowy',
'LBL_PREVIEW_WARRANTY' => 'Protokół',
'LBL_PREVIEW_WARRANTY_TAB' => 'Protokół',
'LBL_PRICEBOOK' => 'Price Book',
'LBL_PRINT_INCOME_PDF_BUTTON_LABEL' => 'Wydrukuj PDF przyjęcia',
'LBL_PRINT_INCOME_PDF_BUTTON_TITLE' => 'Wydrukuj PDF przyjęcia',
'LBL_PRINT_SERVICE_PDF_BUTTON_LABEL' => 'Wydrukuj PDF serwisowy',
'LBL_PRINT_SERVICE_PDF_BUTTON_TITLE' => 'Wydrukuj PDF serwisowy',
'LBL_PRINT_WARRANTY_PDF_BUTTON_LABEL' => 'Wydrukuj PDF relkamacyjny',
'LBL_PRINT_WARRANTY_PDF_BUTTON_TITLE' => 'Wydrukuj PDF relkamacyjny',
'LBL_PW_STOCK_ID' => 'Id magazynu PW',
'LBL_PW_STOCK_NAME' => 'Magazyn PW',
'LBL_QUOTE_PDF' => 'Show PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Show PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Show Quote in PDF file.',
'LBL_QUOTE_TO_INVOICE' => 'Create Invoice',
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Create Invoice [Alt+I]',
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Create Invoice.',
'LBL_QUOTE_TO_SERVICE' => 'Create Services Order',
'LBL_QUOTE_TO_SERVICE_BUTTON_KEY' => 'Create Services Order [Alt+O]',
'LBL_QUOTE_TO_SERVICE_BUTTON_TITLE' => 'Create Services Order.',
'LBL_QUOTE_XLS' => 'Create XLS',
'LBL_QUOTE_XLS_BUTTON_KEY' => 'Show XLS [Alt+X]',
'LBL_QUOTE_XLS_BUTTON_TITLE' => 'Show Quote in XLS file.',
'LBL_REGISTER_DATE' => 'Document Date',
'LBL_REJECT_BUTTON_KEY' => 'R',
'LBL_REJECT_BUTTON_LABEL' => 'Reject',
'LBL_REJECT_BUTTON_TITLE' => 'Reject [Alt+R]',
'LBL_REPAIR_BUTTON_KEY' => 'R',
'LBL_REPAIR_BUTTON_LABEL' => 'Repair',
'LBL_REPAIR_BUTTON_TITLE' => 'Repair [Alt+R]',
'LBL_SAVED' => 'Quote saved successfully.',
'LBL_SAVE_FORM_ERROR' => 'There are some errors on items list or in form!',
'LBL_SEARCH_FORM_TITLE' => 'Quotes Search',
'LBL_SELL_DATE' => 'Sell Date',
'LBL_SENDEMAIL_BUTTON' => 'Send Email',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Save & Send',
'LBL_SEND_BUTTON_TITLE' => 'Save & Send [Alt+D]',
'LBL_SEND_TO_CONFIRM' => 'Send To Confirm',
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Send To Confirm [Alt+C]',
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Send This Quote To Confirm.',
'LBL_SEND_TO_CONFIRM_ERROR' => 'Sending Quote to confirm error! Refresh site and try again.',
'LBL_SERVICER' => 'Serwisant',
'LBL_SERVICER_ID' => 'Id serwisanta',
'LBL_SERVICES' => 'Services included:',
'LBL_SERVICES_SUBTOTAL' => 'Suma netto usług',
'LBL_SERVICES_TAB' => 'Services',
'LBL_SERVICES_TOTAL' => 'Suma brutto usług',
'LBL_SERVICE_COMMENT' => 'Opis zleceniobiorcy',
'LBL_SHOW_ADVANCED_PARAMS' => 'Pokaż par. rozszerzone',
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Show images on offers',
'LBL_SHOW_PRIMARY_PARAMS' => 'Pokaż par. podstawowe',
'LBL_SHOW_RECIPIENT_CODE' => 'Show recipient code',
'LBL_STATUS' => 'Status',
'LBL_STATUS_s10_SET_MESSAGE' => 'Quote status is set.',
'LBL_STATUS_s20_FAIL_MESSAGE' => 'Sending Quote to confirm error! Refresh site and try again.',
'LBL_STATUS_s20_SET_MESSAGE' => 'Now Quote is waiting for confimations.',
'LBL_STATUS_s30_SET_MESSAGE' => 'Quote is confirmed.',
'LBL_STATUS_s40_SET_MESSAGE' => 'Quote status is set.',
'LBL_STATUS_s70_SET_MESSAGE' => 'Quote status is set to Lost :(',
'LBL_STOCK_ID' => 'Id magazynu RW',
'LBL_STOCK_NAME' => 'Magazyn RW',
'LBL_SUBTOTAL' => 'Subtotal',
'LBL_TEMPLATE_ID' => 'Template Id',
'LBL_TEMPLATE_NAME' => 'Template',
'LBL_TEXTS' => 'Texts to PDF:',
'LBL_TEXTS_TAB' => 'Texts',
'LBL_TOTAL' => 'Total',
'LBL_TO_INFORMATIONS' => 'To Informations:',
'LBL_TO_IS_VAT_FREE' => 'Is VAT Free?',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TYPE' => 'Type',
'LBL_VALIDTILL_DATE' => 'Valid Till',
'LBL_VAT' => 'VAT',
'LBL_WZ_PARENT_ID' => 'WZ zlecenia',
'LNK_ECMSERVICES_LIST' => 'List service requests',
'LNK_ECMSERVICES_PDFLANGUAGES' => 'PDF Settings',
'LNK_NEW_ECMSERVICE' => 'Create service request',
);

View File

@@ -0,0 +1,273 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
$mod_strings = array(
// 080313 mh
'SERVICE_PW_NAME' => 'PW zamówienia serwisowego %s',
'SERVICE_WZ_NAME' => 'WZ zamówienia serwisowego %s',
//
'ERR_SERVICE_CLOSE' => 'Nie można zamknąć zlecenia %s ponieważ posiada listę materiałów lub jest już zamknięte.',
'ERR_SERVICE_FK' => 'Nie można wystawić faktury dla zlecenia %s ponieważ jest ono już zamknięte.',
'ERR_SERVICE_RW' => 'Nie można wystawić RW dla zlecenia %s ponieważ jest już zamknięte.',
//
'LBL_ACCEPTED' => 'Zaakceptowane',
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
'LBL_ACCEPT_BUTTON_LABEL' => 'Zaakceptuj',
'LBL_ACCEPT_BUTTON_TITLE' => 'Zaakceptuj [Alt+Z]',
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => 'You don\'t have a permission to send Email, because this Correct Document is not accepted by Manager!',
'LBL_ADS_TEXT' => 'Dodatkowy tekst',
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Czy zaladowac domyslne teksty dla tego jezyka?',
'LBL_ARTICLES_SUBTOTAL' => 'Suma netto materiałów',
'LBL_ARTICLES_TOTAL' => 'Suma brutto materiałów',
'LBL_ASSIGNED_TO' => 'Przypisane Do',
'LBL_ASSIGNED_TO_ID' => 'Przypisane Do',
'LBL_ASSIGNED_TO_USER' => 'Przypisane Do',
'LBL_CONFIRM_QUESTION' => 'Chcesz potwierdzic tš Zamówienie?',
'LBL_CONTACT_ID' => 'Id Kontaktu',
'LBL_CONTACT_NAME' => 'Kontakt',
'LBL_CREATED' => 'Utworzone Przez',
'LBL_CREATED_BY_USER' => 'Utworzone Przez',
'LBL_CREATE_ECMINVOICEOUT_BUTTON_LABEL' => 'Create Invoice',
'LBL_CURRENCY' => 'Waluta',
'LBL_DASHLET_MY_ECMSERVICES' => 'Zlecenia',
'LBL_DATE_ENTERED' => 'Data dodania',
'LBL_DATE_MODIFIED' => 'Date modyfikacji',
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Zlecenie dla $account_name.',
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
'LBL_DELETED_BY' => 'Usuniete Przez',
'LBL_DELETE_ROW' => 'Usun wiersz',
'LBL_DELIVERYCONDITION_ID' => 'Warunki Dostawy ID',
'LBL_DELIVERYCONDITION_NAME' => 'Warunki Dostawy',
'LBL_DEMO_VERSION_INFORMATION' => 'This is only demo version.
Please contact us at ca@more7.com.',
'LBL_DESCRIPTION' => 'Opis',
'LBL_DETAILS' => 'Szczególy Zlecenia',
'LBL_DETAILS_TAB' => 'Szczególy',
'LBL_DETAIL_BUTTON' => 'Szczegóły',
'LBL_DISCOUNT' => 'Upust',
'LBL_DISCOUNT_ERROR' => 'Blad formatu upustu',
'LBL_DOCUMENT_NO' => 'Numer',
'LBL_ECMLANGUAGE' => 'Język',
'LBL_ECMSERVICES_PDFLANGUAGES_TITLE' => 'Ustawienia jezyków PDFa',
'LBL_ECMSERVICE_ID' => 'Id Zlecenia',
'LBL_ECMSERVICE_NAME' => 'Nazwa zlecenia',
'LBL_ECMSERVICE_NAME_OTHER' => 'Inne',
'LBL_ECMSERVICE_NAME_PAYABLE' => 'Płatne',
'LBL_ECMSERVICE_NAME_WARRANTY' => 'Gwarancyjne',
//
'LBL_ECMSERVICE_STATUS_CLOSED' => 'Zamknięte',
'LBL_ECMSERVICE_STATUS_IN_PROGRESS' => 'W trakcie realizacji',
'LBL_ECMSERVICE_STATUS_OPEN' => 'Otwarte',
'LBL_ECMSERVICE_STATUS_OTHER' => 'Inne',
//
'LBL_ECMSERVICE_REPAIR_STATUS_WAITING' => 'Oczekujące',
'LBL_ECMSERVICE_REPAIR_STATUS_IN_PROGRESS' => 'Rozpoczęta naprawa',
'LBL_ECMSERVICE_REPAIR_STATUS_FAULT' => 'Wysłane do producenta',
//
'LBL_ECMTEAM_ID' => 'Team ID',
'LBL_ECMTEAM_NAME' => 'Team',
'LBL_EDITTABLE_CODE' => 'Kod',
'LBL_EDITTABLE_DISCOUNT' => 'Upust',
'LBL_EDITTABLE_NAME' => 'Nazwa',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_OPTIONS' => 'Opcje',
'LBL_EDITTABLE_PRICE' => 'Cena',
'LBL_EDITTABLE_QUANTITY' => 'Ilosc',
'LBL_EDITTABLE_RECIPIENT_CODE' => 'Kod Odbiorcy',
'LBL_EDITTABLE_RESERVATION' => 'Rezerwacja',
'LBL_EDITTABLE_SERVICE' => 'Numer zamówienia',
'LBL_EDITTABLE_TOTAL' => 'Wartoœć',
'LBL_EDITTABLE_UNIT' => 'J.m.',
'LBL_EDITTABLE_VAT' => 'VAT',
'LBL_EMAIL' => 'Stwórz Email:',
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emaile',
'LBL_EMAIL_TAB' => 'Email',
'LBL_FK_PARENT_ID' => 'Faktura zlecenia',
'LBL_FOOTER_TEXT' => 'Tekst stopki',
'LBL_FORMAT_NUMBER_ERROR' => 'Blad formatu numeru!',
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Idz do listy zleceń',
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Idz do listy zleceń [Alt+G]',
'LBL_HEADER_TEXT' => 'Tekst naglówka',
'LBL_ID' => 'Id',
'LBL_IMG_EDIT' => 'Edycja',
'LBL_IMG_NEW' => 'Nowy, dodaj do bazy',
'LBL_IMG_SEARCH' => 'Wyszukiwanie',
'LBL_INCOME' => 'Na serwis',
'LBL_INCOME_TAB' => 'Na serwis',
'LBL_INSERT_NEW_ROW' => 'Wstaw nowy wiersz',
'LBL_ITEMS' => 'Zalaczone materiały:',
'LBL_ITEMS_TAB' => 'Materiały',
'LBL_LISTVIEW_CREATE_INVOICE' => 'Utwórz fakturę',
'LBL_LISTVIEW_REALIZATION_LIST' => 'Lista realizacji',
'LBL_LISTVIEW_SERVICE_CLOSE' => 'Zamknij zlecenie',
'LBL_LISTVIEW_SERVICE_INVOICE' => 'Faktura',
'LBL_LISTVIEW_SERVICE_RW' => 'Rozchód wewnętrzny',
'LBL_LIST_ACCEPT' => 'Akceptuj',
'LBL_LIST_DOWNLOAD_PDF' => 'Pobierz PDF',
'LBL_LIST_DUPLICATE' => 'Duplikuj',
'LBL_LIST_FORM_TITLE' => 'Lista Zamówień',
'LBL_LIST_PREVIEW_PDF' => 'Podgląd Zlecenia',
'LBL_LIST_REJECT' => 'Nie akceptuj',
'LBL_LIST_SEND_TO_CONFIRM' => 'Wyslij do Potwierdzenia',
'LBL_LIST_TO_INVOICE' => 'Stwórz Fakture.',
'LBL_LIST_TO_SERVICE' => 'Stwórz Zamówienie Sprzedazy.',
'LBL_MODIFIED' => 'Ostatnio modyfikowane',
'LBL_MODIFIED_BY_USER' => 'Zmodyfikowane Przez',
'LBL_MODIFIED_USER' => 'Zmodyfikowane Przez',
'LBL_MODULE_ID' => 'EcmServices',
'LBL_MODULE_NAME' => 'Zlecenia',
'LBL_MODULE_TITLE' => 'Zlecenia: Strona Główna',
'LBL_MOVE_ROW_DOWN' => 'W dól',
'LBL_MOVE_ROW_UP' => 'W góre',
'LBL_NAME' => 'Nazwa',
'LBL_NEW_FORM_TITLE' => 'Nowa Zlecenie',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notatki',
'LBL_NOT_SAVED' => 'Zlecenie nie zostało zapisana. Sprawdz czy wszytskie pola sa poprawne!',
'LBL_NUMBER' => 'Numer',
'LBL_ORDER_ORIGIN' => 'Zródlo zamówienia',
'LBL_PARENT' => 'Do',
'LBL_PARENT_ADDRESS_CITY' => 'Kod pocztowy / Miasto',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Panstwo',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Kod pocztowy',
'LBL_PARENT_ADDRESS_STREET' => 'Ulica',
'LBL_PARENT_COMMENT' => 'Opis zleceniodawcy',
'LBL_PARENT_CONTACT_NAME' => 'Osoba Kontaktowa',
'LBL_PARENT_CONTACT_PHONE_FAX' => 'Telefon kontaktowy',
'LBL_PARENT_CONTACT_TITLE' => 'Tytul Kontaktu',
'LBL_PARENT_ID' => 'Firma Id',
'LBL_PARENT_NAME' => 'Firma',
'LBL_PARENT_NAME_COPY' => 'Nazwa Firmy',
'LBL_PAYMENTCONDITION_ID' => 'Warunki Platnosci ID',
'LBL_PAYMENTCONDITION_NAME' => 'Warunki Platnosci',
'LBL_PAYMENT_DATE' => 'Data Platnosci',
'LBL_PDF_ARTICLES_TOTAL' => 'Razem mariały',
'LBL_PDF_CODE' => 'QUO',
'LBL_PDF_DATE_REGISTER' => 'Data wystawienia',
'LBL_PDF_DISCOUNT' => 'RABAT',
'LBL_PDF_DOCUMENT_AFTER_CORRECT' => 'After Correct: ',
'LBL_PDF_DOCUMENT_BEFORE_CORRECT' => 'Before Correct: ',
'LBL_PDF_DOCUMENT_CORRECT_DIFFERENCE' => 'Difference: ',
'LBL_PDF_DOCUMENT_NAME' => 'Zlecenie',
'LBL_PDF_END_TOTAL' => 'Suma koncowa',
'LBL_PDF_FILENAME' => 'Zlecenie_',
'LBL_PDF_INCOME_DOCUMENT_NAME' => 'Otwarcie zlecenia',
'LBL_PDF_LIST_CODE' => 'Indeks',
'LBL_PDF_LIST_DESCRIPTION' => 'Opis',
'LBL_PDF_LIST_DISCOUNT' => 'Rabat',
'LBL_PDF_LIST_NAME' => 'Nazwa',
'LBL_PDF_LIST_POSITION' => 'Poz.',
'LBL_PDF_LIST_PRICE' => 'Cena',
'LBL_PDF_LIST_QUANTITY' => 'Ilosc',
'LBL_PDF_LIST_TOTAL' => 'Suma',
'LBL_PDF_LIST_UNIT' => '',
'LBL_PDF_LIST_VAT' => 'VAT',
'LBL_PDF_NUMBER' => 'Numer',
'LBL_PDF_OWNER' => 'Wystawil',
'LBL_PDF_QTY_DOCUMENT_NAME' => 'Wykaz ilościowy',
'LBL_PDF_SERVICES_TOTAL' => 'Razem usługi',
'LBL_PDF_TOTAL' => 'Razem',
'LBL_PDF_VALIDTILL_DATE' => 'Waznosc oferty',
'LBL_PDF_VAL_DOCUMENT_NAME' => 'Wykaz wartościowy',
'LBL_PDF_VAT' => 'VAT',
'LBL_PDF_VATID' => 'VAT-ID',
'LBL_PDF_WARRANTY_DOCUMENT_NAME' => 'Protokół rozpatrzenia reklamacji',
'LBL_HISTORY_TAB' => 'Historia',
'LBL_PREVIEW' => 'Podgląd PDFa:',
'LBL_PREVIEW_HEADER_CLOSE' => 'Zamknij',
'LBL_PREVIEW_HEADER_NAME' => 'Podgląd',
'LBL_PREVIEW_INCOME' => 'Otwarcie',
'LBL_PREVIEW_INCOME_TAB' => 'Otwarcie',
'LBL_PREVIEW_QTY' => 'Wykaz ilościowy',
'LBL_PREVIEW_QTY_TAB' => 'Wykaz ilościowy',
'LBL_PREVIEW_TAB' => 'Podgld',
'LBL_PREVIEW_VAL' => 'Wykaz wartościowy',
'LBL_PREVIEW_VAL_TAB' => 'Wykaz wartościowy',
'LBL_PREVIEW_WARRANTY' => 'Protokół',
'LBL_PREVIEW_WARRANTY_TAB' => 'Protokół',
'LBL_PRICEBOOK' => 'Cennik',
'LBL_PRINT_INCOME_PDF_BUTTON_LABEL' => 'Wydrukuj PDF przyjęcia',
'LBL_PRINT_INCOME_PDF_BUTTON_TITLE' => 'Wydrukuj PDF przyjęcia',
'LBL_PRINT_SERVICE_PDF_BUTTON_LABEL' => 'Wydrukuj PDF serwisowy',
'LBL_PRINT_SERVICE_PDF_BUTTON_TITLE' => 'Wydrukuj PDF serwisowy',
'LBL_PRINT_WARRANTY_PDF_BUTTON_LABEL' => 'Wydrukuj PDF relkamacyjny',
'LBL_PRINT_WARRANTY_PDF_BUTTON_TITLE' => 'Wydrukuj PDF relkamacyjny',
'LBL_PW_STOCK_ID' => 'Id magazynu PW',
'LBL_PW_STOCK_NAME' => 'Magazyn PW',
'LBL_QUOTE_PDF' => 'Pokaz PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Pokaz PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Pokaz Zamówienie w pliku PDF.',
'LBL_QUOTE_TO_INVOICE' => 'Stwórz Fakture',
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Stwórz Fakture [Alt+I]',
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Stwórz Fakture.',
'LBL_QUOTE_TO_SERVICE' => 'Stwórz Zamówienie Sprzedazy',
'LBL_QUOTE_TO_SERVICE_BUTTON_KEY' => 'Stwórz Zamówienie Sprzedazy [Alt+O]',
'LBL_QUOTE_TO_SERVICE_BUTTON_TITLE' => 'Stwórz Zamówienie Sprzedazy.',
'LBL_QUOTE_XLS' => 'Create XLS',
'LBL_QUOTE_XLS_BUTTON_KEY' => 'Show XLS [Alt+X]',
'LBL_QUOTE_XLS_BUTTON_TITLE' => 'Show Quote in XLS file.',
'LBL_REGISTER_DATE' => 'Data dokumentu',
'LBL_REJECT_BUTTON_KEY' => 'R',
'LBL_REJECT_BUTTON_LABEL' => 'Nie akceptuj',
'LBL_REJECT_BUTTON_TITLE' => 'Nie akceptuj [Alt+R]',
'LBL_REPAIR_BUTTON_KEY' => 'R',
'LBL_REPAIR_BUTTON_LABEL' => 'Napraw',
'LBL_REPAIR_BUTTON_TITLE' => 'Napraw [Alt+R]',
'LBL_SAVED' => 'Zlecenie zostało zapisana pomyslnie.',
'LBL_SAVE_FORM_ERROR' => 'Wystepuja bledy na liscie produktów albo w formularzu!',
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie',
'LBL_SELL_DATE' => 'Data Sprzedazy',
'LBL_SENDEMAIL_BUTTON' => 'Wyslij Email',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Zapisz i Wyslij',
'LBL_SEND_BUTTON_TITLE' => 'Zapisz i Wyslij [Alt+D]',
'LBL_SEND_TO_CONFIRM' => 'Wyslij Do Potwierdzenia',
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Wyslij Do Potwierdzenia [Alt+C]',
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Wyslij Do Potwierdzenia.',
'LBL_SEND_TO_CONFIRM_ERROR' => 'Sending Correct Document to confirm error! Refresh site and try again.',
'LBL_SERVICER' => 'Serwisant',
'LBL_SERVICER_ID' => 'Id serwisanta',
'LBL_SERVICES' => 'Wykonane usługi:',
'LBL_SERVICES_SUBTOTAL' => 'Suma netto usług',
'LBL_SERVICES_TAB' => 'Usługi',
'LBL_SERVICES_TOTAL' => 'Suma brutto usług',
'LBL_SERVICE_COMMENT' => 'Opinia serwisu',
'LBL_FAULT_COMMENT' => 'Usterka',
'LBL_HISTORY' => 'Historia',
'LBL_SHOW_ADVANCED_PARAMS' => 'Pokaż par. rozszerzone',
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Pokaż obrazki w PDFie',
'LBL_SHOW_PRIMARY_PARAMS' => 'Pokaż par. podstawowe',
'LBL_SHOW_RECIPIENT_CODE' => 'Pokaż kod odbiorcy',
'LBL_STATUS' => 'Status',
'LBL_REPAIR_STATUS' => 'Status naprawy',
'LBL_STATUS_s10_SET_MESSAGE' => 'Status Zlecenia ustawiony.',
'LBL_STATUS_s20_FAIL_MESSAGE' => 'Blad wysylki do potwierdzenia! Odswiez strone i sprobuj ponownie.',
'LBL_STATUS_s20_SET_MESSAGE' => 'Zlecenie czeka na potwierdzenie.',
'LBL_STATUS_s30_SET_MESSAGE' => 'Zlecenie jest potwierdzony.',
'LBL_STATUS_s40_SET_MESSAGE' => 'Status Zlecenia ustawiony.',
'LBL_STATUS_s70_SET_MESSAGE' => 'Quote status is set to Lost :(',
'LBL_STOCK_ID' => 'Id magazynu RW',
'LBL_STOCK_NAME' => 'Magazyn RW',
'LBL_SUBTOTAL' => 'Suma netto',
'LBL_TEMPLATE_ID' => 'Id Szablonu',
'LBL_TEMPLATE_NAME' => 'Szablon',
'LBL_TEXTS' => 'Teksty do PDFa:',
'LBL_TEXTS_TAB' => 'Teksty',
'LBL_TOTAL' => 'Suma brutto',
'LBL_TO_INFORMATIONS' => 'Informacje dodatkowe',
'LBL_TO_IS_VAT_FREE' => 'Czy jest wolne od vatu?',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TYPE' => 'Typ',
'LBL_VALIDTILL_DATE' => 'Wazne do',
'LBL_VAT' => 'VAT',
'LBL_WZ_PARENT_ID' => 'WZ zlecenia',
'LNK_ECMSERVICES_LIST' => 'Lista zleceń serwisowych',
'LNK_ECMSERVICES_PDFLANGUAGES' => 'Ustawienia PDF',
'LNK_NEW_ECMSERVICE' => 'Utwórz zlecenie serwisowe',
);

View File

@@ -0,0 +1,125 @@
<?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.
********************************************************************************/
$searchFields['EcmServices'] = array (
'name' => array ( 'query_type' => 'default' ),
'description' => array ( 'query_type' => 'default' ),
'current_user_only' => array ( 'query_type' => 'default', 'db_field' => array ( 'assigned_user_id' ), 'my_items' => true ),
'assigned_user_id' => array ( 'query_type' => 'default' ),
'status' => array ( 'query_type' => 'default' ),
'register_date' => array ( 'query_type' => 'default' ),
'parent_name' => array( 'query' => 'default' ),
);
?>

View File

@@ -0,0 +1,412 @@
<?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".
* ****************************************************************************** */
global $sugar_config;
$viewdefs['EcmServices']['CreateView'] = array(
'templateMeta' => array(
'form' => array(
'enctype' => 'multipart/form-data',
'buttons' => array(
array(
'customCode' =>
'
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="window.onbeforeunload=\'\';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="removeDocumentReservations(this.form.temp_id.value,\'cancel\');" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
',
),
array(
'customCode' =>
'
&nbsp;
<input title="{$MOD.LBL_GO_TO_LIST_BUTTON_TITLE}" accessKey="{$MOD.LBL_GO_TO_LIST_BUTTON_KEY}" class="button" onclick="removeDocumentReservations(this.form.temp_id.value,\'list\');" type="button" name="button" value="{$MOD.LBL_GO_TO_LIST_BUTTON_LABEL}" />
',
),
// array(
// 'customCode' =>
// '
// <input title="{$MOD.LBL_PRINT_INCOME_PDF_BUTTON_TITLE}" onclick="removeDocumentReservations(this.form.temp_id.value,\'income_pdf\');" class="button" type="button" name="button" value="{$MOD.LBL_PRINT_INCOME_PDF_BUTTON_LABEL}" />
// ',
// ),
// array(
// 'customCode' =>
// '
// <input title="{$MOD.LBL_PRINT_SERVICE_PDF_BUTTON_TITLE}" onclick="removeDocumentReservations(this.form.temp_id.value,\'income_pdf\');" class="button" type="button" name="button" value="{$MOD.LBL_PRINT_SERVICE_PDF_BUTTON_LABEL}" />
// ',
// ),
// array(
// 'customCode' =>
// '
// <input title="{$MOD.LBL_PRINT_WARRANTY_PDF_BUTTON_TITLE}" onclick="removeDocumentReservations(this.form.temp_id.value,\'income_pdf\');" class="button" type="button" name="button" value="{$MOD.LBL_PRINT_WARRANTY_PDF_BUTTON_LABEL}" />
// ',
// ),
),
'hidden' => array(
'<input type="hidden" name="stock_doc_inside_in" id="stock_doc_inside_in" value=\'1\'>', // temp ?
'<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>',
'<input type="hidden" name="services_list" id="services_list" value=\'{$SERVICES_LIST}\'>',
'<input type="hidden" name="income_list" id="income_list" value=\'{$INCOME_LIST}\'>',
'<input type="hidden" name="email_id" id="email_id" value="">',
'<input type="hidden" name="temp_id" id="temp_id" value="{$TEMP_ID}">',
'<input type="hidden" name="parent_type" id="parent_type" value="Accounts">',
// Fieds used for searching account etc.
'<input type="hidden" name="parent_address_postalcode" id="parent_address_postalcode" value="{$fields.parent_address_postalcode.value}" />',
'<input type="hidden" name="parent_address_city" id="parent_address_city" value="{$fields.parent_address_city.value}" />',
'<input type="hidden" name="parent_address_street" id="parent_address_street" value="{$fields.parent_address_street.value}" />',
'<input type="hidden" name="to_is_vat_free" id="to_is_vat_free" value="{$fields.to_is_vat_free.value}" />',
'<input type="hidden" name="parent_name_copy" id="parent_name_copy" value="{$fields.parent_name.value}" />',
),
),
'maxColumns' => '2',
'widths' => array(
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/EcmServices/AjaxSearch/AjaxSearch.js',
),
// array(
// 'file' => 'modules/EcmServices/AjaxSearch/AjaxSearch1.js',
// ),
// array(
// 'file' => 'modules/EcmServices/AjaxSearch/AjaxSearch2.js',
// ),
array(
'file' => 'modules/EcmServices/AjaxSearch/AjaxSearch3.js',
),
array(
'file' => 'modules/EcmServices/formloader.js',
),
array(
'file' => 'modules/EcmServices/MyTable.js',
),
array(
'file' => 'modules/EcmServices/EcmServices.js',
),
array(
'file' => 'modules/EcmServices/EcmServicesCreateView.js',
),
array(
'file' => 'modules/EcmServices/CreateItem.js',
),
array(
'file' => 'modules/EcmProducts/mintajax.js',
),
array(
'file' => 'modules/EcmProducts/helper.js',
),
),
),
'panels' => array(
'LBL_DETAILS_TAB' => array(
array(
array(
'type' => 'tab',
'active' => true,
),
),
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(
'name' => 'currency_id',
'label' => 'LBL_CURRENCY',
),
),
array(
array(
'name' => 'parent_name',
'tabIndex' => '1',
),
'ecmpaymentcondition_name',
),
array(
'name',
'ecmdeliverycondition_name',
),
array(
//'status',
//'status',
array(
'label' => 'LBL_STATUS',
'name' => 'status',
'customCode' =>
'
<select name="status" id="status">
{$STATUS}
</select>
',
),
array(
'label' => 'LBL_TEMPLATE_NAME',
'tabIndex' => '1',
'customCode' =>
'
<select tabindex="1" id="template_id" name="template_id" onChange="document.getElementById(\'template_name\').value=this.options[this.selectedIndex].text;">
{$DOCUMENT_TEMPLATES_OPTIONS}
</select>
<input type="hidden" id="template_name" name="template_name" value="{$fields.template_name.value}">
',
),
),
array(
array(
'name' => 'register_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array(
'showFormats' => true,
),
),
array(
'label' => 'LBL_STOCK_NAME',
'name' => 'stock_id',
'customCode' =>
'
<select name="stock_id" id="stock_id">
{$STOCK}
</select>
',
),
),
array(
array(
'name' => 'validtill_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array(
'showFormats' => true,
),
),
array(
'label' => 'LBL_PW_STOCK_NAME',
'name' => 'pw_stock_id',
'customCode' =>
'
<select name="pw_stock_id" id="pw_stock_id">
{$PW_STOCK}
</select>
',
),
),
// Informations section.
array(
array(
'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(
array(
'allCols' => true,
'name' => 'parent_comment',
'tabIndex' => '1',
'customCode' =>
'
<textarea name="parent_comment" id="parent_comment" style="width: 90%; resize: vertical;">{$fields.parent_comment.value}</textarea>
',
),
),
array(
array(
'allCols' => true,
'name' => 'service_comment',
'tabIndex' => '1',
'customCode' =>
'
<textarea name="service_comment" id="service_comment" style="width: 90%; resize: vertical;">{$fields.service_comment.value}</textarea>
',
),
),
// array(
// array(
// 'name' => 'parent_name_copy',
// 'tabIndex' => '1',
// 'customCode' =>
// '
// <input type="text" name="parent_name_copy" id="parent_name_copy" value="{$fields.parent_name.value}" readOnly="readonly" size="30" />
// ',
// ),
// 'ecmlanguage',
// ),
array(
'parent_contact_name',
array(
'name' => 'assigned_user_name',
'tabIndex' => '1',
),
),
array(
'parent_contact_phone_fax',
array(
'name' => 'servicer_user_name',
'tabIndex' => '1',
),
),
// array(
// 'parent_contact_title',
// array(
// 'name' => 'to_is_vat_free',
// 'tabIndex' => '1',
// 'customCode' =>
// '
// <input tabindex="1" type="checkbox" id="to_is_vat_free" name="to_is_vat_free" value="{$fields.to_is_vat_free.value}" {if $fields.to_is_vat_free.value == 1}checked{/if}>
// ',
// ),
// ),
// array(
// array(
// 'name' => 'parent_address_street',
// 'tabIndex' => '1',
// 'customCode' =>
// '
// <textarea tabindex="1" id="parent_address_street" name="parent_address_street" rows="2" cols="30" maxlength="150" >
// {$fields.parent_address_street.value}
// </textarea>
// ',
// ),
// 'show_primary_params',
// ),
// array(
// array(
// 'name' => 'parent_address_city',
// '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:80px;" />
// &nbsp;&nbsp;
// <input type="text" name="parent_address_city" id="parent_address_city" value="{$fields.parent_address_city.value}" style="vertical-align:top;width:150px;" />
// ',
// ),
// 'show_advanced_params',
// ),
// array(
// 'parent_address_country',
// '',
// ),
),
'LBL_INCOME_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmServices/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmServices/AjaxSearch/AjaxSearch.css" />
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="incomeTableDIV">
<table class="positions" style="width:100%;" id="incomeTable">
<thead id="head">
<tr id="tr">
<td width="4%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="16%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="39%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_OPTIONS}</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
',
)
),
),
'LBL_PREVIEW_INCOME_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id=\'previewPDF_INCOME\' width="100%" height="100%"></span>
',
),
),
),
),
);

View File

@@ -0,0 +1,546 @@
<?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".
* ****************************************************************************** */
global $sugar_config;
$viewdefs['EcmServices']['DetailView'] = array(
'templateMeta' => array(
'form' => array(
// 'enctype' => 'multipart/form-data',
'buttons' => array(
array(
'customCode' =>
'
<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="location.href=\'index.php?module=EcmServices&action=EditView&record={$id}\';" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">
',
),
array(
'customCode' => '{$CATALOGUE}'
),
// array(
// 'customCode' =>
// '
// <input title="Utwórz fakturę zaliczkową" accessKey="" class="button" onclick="location.href=\'index.php?module=EcmPrepaymentInvoices&action=EditView&ecmservice_id={$id}\';" type="button" name="ecmprepaymentinvoice" id="ecmprepaymentinvoice_button" value="Utwórz fakturę zaliczkową">
// ',
// ),
// array(
// 'customCode' =>
// '
// <input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="removeDocumentReservations(this.form.temp_id.value,\'cancel\');" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
// ',
// ),
// array(
// 'customCode' =>
// '
// &nbsp;
// <input title="{$MOD.LBL_GO_TO_LIST_BUTTON_TITLE}" accessKey="{$MOD.LBL_GO_TO_LIST_BUTTON_KEY}" class="button" onclick="removeDocumentReservations(this.form.temp_id.value,\'list\');" type="button" name="button" value="{$MOD.LBL_GO_TO_LIST_BUTTON_LABEL}" />
// ',
// ),
// array(
// 'customCode' =>
// '
// <input title="{$MOD.LBL_PRINT_INCOME_PDF_BUTTON_TITLE}" onclick="removeDocumentReservations(this.form.temp_id.value,\'income_pdf\');" class="button" type="button" name="button" value="{$MOD.LBL_PRINT_INCOME_PDF_BUTTON_LABEL}" />
// ',
// ),
// array(
// 'customCode' =>
// '
// <input title="{$MOD.LBL_PRINT_SERVICE_PDF_BUTTON_TITLE}" onclick="removeDocumentReservations(this.form.temp_id.value,\'income_pdf\');" class="button" type="button" name="button" value="{$MOD.LBL_PRINT_SERVICE_PDF_BUTTON_LABEL}" />
// ',
// ),
// array(
// 'customCode' =>
// '
// <input title="{$MOD.LBL_PRINT_WARRANTY_PDF_BUTTON_TITLE}" onclick="removeDocumentReservations(this.form.temp_id.value,\'income_pdf\');" class="button" type="button" name="button" value="{$MOD.LBL_PRINT_WARRANTY_PDF_BUTTON_LABEL}" />
// ',
// ),
array(
'customCode' =>
'
&nbsp;
<input title="{$MOD.LBL_GO_TO_LIST_BUTTON_TITLE}" accessKey="{$MOD.LBL_GO_TO_LIST_BUTTON_KEY}" class="button" onclick="window.location=\'index.php?module=EcmServices&action=index\';" type="button" name="button" value="{$MOD.LBL_GO_TO_LIST_BUTTON_LABEL}" />
',
),
),
'hidden' => array(
'<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>',
'<input type="hidden" name="services_list" id="services_list" value=\'{$SERVICES_LIST}\'>',
'<input type="hidden" name="income_list" id="income_list" value=\'{$INCOME_LIST}\'>',
'<input type="hidden" name="discount" id="discount" value=\'{$fields.discount.value}\'>',
'<input type="hidden" name="parent_type" id="parent_type" value="{$fields.parent_type.value}">',
'<input type="hidden" name="parent_id" id="parent_id" value="{$fields.parent_id.value}">',
'<input type="hidden" name="assigned_user_id" id="assigned_user_id" value="{$fields.assigned_user_id.value}">',
'<input type="hidden" name="email_id" id="email_id" value="">',
'<input type="hidden" name="history" id="history" value="{$fields.history.value|htmlspecialchars}" />',
'<span id="quickInfoH2" style="display:none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>{$fields.document_no.value}</span> - <span>{$fields.parent_name.value}</span> - <span>{$fields.parent_contact_name.value}</span> - <span>{$fields.parent_address_street.value}</span>&nbsp; &nbsp;<span>{$fields.parent_address_postalcode.value}</span>&nbsp;<span>{$fields.parent_address_city.value}</span>&nbsp; &nbsp;<span>{$fields.parent_address_country.value}</span> - <span>{$fields.total.value}</span></span>',
),
),
'maxColumns' => '2',
'widths' => array(
array(
'label' => '10',
'field' => '30',
),
array(
'label' => '10',
'field' => '30',
),
),
'includes' => array(
array(
'file' => 'include/JSON.js',
),
array(
'file' => 'modules/EcmServices/MyTable.js',
),
array(
'file' => 'modules/EcmServices/EcmServices.js',
),
array(
'file' => 'modules/EcmServices/EcmServicesDetailView.js',
),
array(
'file' => 'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js',
),
// array(
// 'file' => 'modules/EcmProducts/mintajax.js',
// ),
// array(
// 'file' => 'modules/EcmProducts/helper.js',
// ),
),
),
'panels' => array(
'LBL_DETAILS_TAB' => array(
array(
'document_no',
array(
'name' => 'currency_id',
'label' => 'LBL_CURRENCY',
),
),
array(
'total',
'subtotal',
),
array(
array(
'name'=> 'fk_parent_id',
'label'=> 'LBL_FK_PARENT_ID',
),
array(
'name'=> 'wz_parent_id',
'label'=> 'LBL_WZ_PARENT_ID',
),
),
array(
array(
'name' => 'parent_name',
'customCode' =>
'
<a href="index.php?module=Accounts&action=DetailView&record={$fields.parent_id.value}">
{$fields.parent_name.value}
</a>
',
),
'ecmpaymentcondition_name',
),
array(
'name',
'ecmdeliverycondition_name',
),
array(
array(
'name' => 'status',
'type' => 'enum',
'customCode' =>
'
<span id="statusEcmService">
{$fields.status.options[$fields.status.value]}
</span>
',
),
'template_name',
),
array(
array(
'name' => 'repair_status',
'type' => 'enum',
'customCode' =>
'
<span id="repair_statusEcmService">
{$fields.repair_status.options[$fields.repair_status.value]}
</span>
',
),
'stock_name',
),
array(
'register_date',
'pw_stock_name',
),
array(
'validtill_date',
'',
),
// Informations section.
array(
array(
'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(
array(
//'allCols' => true,
'name' => 'parent_comment',
),
),
array(
array(
//'allCols' => true,
'name' => 'service_comment',
),
),
array(
array(
//'allCols' => true,
'name' => 'fault_comment',
),
),
array(
'parent_contact_name',
'assigned_user_name',
),
array(
'parent_contact_phone_fax',
'servicer_user_name'
),
),
'LBL_INCOME_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmServices/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmServices/AjaxSearch/AjaxSearch.css" />
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="incomeTableDIV">
<table class="positions" style="width:100%;" id="incomeTable">
<thead id="head">
<tr id="tr">
<td width="4%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="16%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="39%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
',
)
),
),
'LBL_ITEMS_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmServices/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmServices/AjaxSearch/AjaxSearch.css" />
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="itemsTableDIV">
<table class="positions" style="width:100%;" id="itemsTable">
<thead id="head">
<tr id="tr">
<td width="4%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="16%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="39%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
<td width="8%">{$MOD.LBL_EDITTABLE_RESERVATION}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_DISCOUNT}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_VAT}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_UNIT}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_TOTAL}</td>
<td width="8%">Mag.</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="55%" class="dataLabel" valign="top">
<a href="javascript: N.moveUpRow();" >{$MOD.LBL_MOVE_ROW_UP}</a> - <a href="javascript: N.moveDownRow();" >{$MOD.LBL_MOVE_ROW_DOWN}</a>
</td> <!--color:#b3b9cf;-->
<td width="40%" class="dataField" style="text-align: left;">
<br>
<table id="position_result_table" cellpadding="0" cellspacing="0" style="width:100%; height:100%; border: 1px solid rgb(48,192,255);">
<tr id="subtotal_tr">
<td class="positionsLabel" style="border-top:0px;">{$MOD.LBL_ARTICLES_SUBTOTAL}</td>
<td class="positionsField" style="border-top:0px;">
<input tabindex="127" type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="articles_subtotal" id="articles_subtotal" value=\'{$fields.articles_subtotal.value}\'>
</td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_ARTICLES_TOTAL}</td>
<td class="positionsField">
<input tabindex="127" type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="articles_total" id="articles_total" value=\'{$fields.articles_total.value}\'>
</td>
</tr>
</table>
</td>
<td width="5%" class="dataField" style="text-align: left;">&nbsp;</td>
</tr>
</table>
',
)
),
),
'LBL_SERVICES_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmServices/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmServices/AjaxSearch/AjaxSearch.css" />
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="servicesTableDIV">
<table class="positions" style="width:100%;" id="servicesTable">
<thead id="head">
<tr id="tr">
<td width="4%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="16%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="39%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_DISCOUNT}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_VAT}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_TOTAL}</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="55%" class="dataLabel" valign="top">
<a href="javascript: N.moveUpRow();" >{$MOD.LBL_MOVE_ROW_UP}</a> - <a href="javascript: N.moveDownRow();" >{$MOD.LBL_MOVE_ROW_DOWN}</a>
</td> <!--color:#b3b9cf;-->
<td width="40%" class="dataField" style="text-align: left;">
<br>
<table id="services_result_table" cellpadding="0" cellspacing="0" style="width:100%; height:100%; border: 1px solid rgb(48,192,255);">
<tr id="subtotal_tr">
<td class="positionsLabel" style="border-top:0px;">{$MOD.LBL_SERVICES_SUBTOTAL}</td>
<td class="positionsField" style="border-top:0px;">
<input tabindex="127" type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="services_subtotal" id="services_subtotal" value=\'{$fields.services_subtotal.value}\'>
</td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_SERVICES_TOTAL}</td>
<td class="positionsField">
<input tabindex="127" type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="services_total" id="services_total" value=\'{$fields.services_total.value}\'>
</td>
</tr>
</table>
</td>
<td width="5%" class="dataField" style="text-align: left;">&nbsp;</td>
</tr>
</table>
',
)
),
),
'LBL_HISTORY_TAB'=> array(
array(
array(
'name' => 'history_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<div id="history_wrapper">
<ul>
{section name=i loop=$HISTORY}
<li class="result" id="{$smarty.section.i.index}" style="margin-bottom: 15px;">
<p class="history_header">{$HISTORY[i][0]|date_format:\'%d.%m.%Y\'}, {$HISTORY[i][1]}: </p>
<p class="history_record">{$HISTORY[i][2]}</p>
</li>
{sectionelse}
<li class="no-results">
Brak wpisów w historii
</li>
{/section}
</ul>
</div>
',
),
),
),
/*
'LBL_PREVIEW_TAB'=> array(
array(
array(
'name' => 'preview_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<select id="preview_type" name="preview_type" onChange="setPREVIEW();">
<option value="income">Otwarcie</option>
<option value="qty">Wykaz ilościowy</option>
<option value="val">Wykaz wartościowy</option>
<option value="warranty">Protokół</option>
<option value="fault">Usterka</option>
</select>
<input type="button" class="button" onClick="preview_pdf();" value="Generuj"/>
<hr/>
<span id="previewPDF" width="100%" height="100%"></span>
',
),
),
),
/*
'LBL_PREVIEW_INCOME_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'name' => 'PREVIEW_INCOME',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id="previewPDF_INCOME" width="100%" height="100%"></span>
',
),
),
),
'LBL_PREVIEW_QTY_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'name' => 'PREVIEW_QTY',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id="previewPDF_QTY" width="100%" height="100%"></span>
',
),
),
),
'LBL_PREVIEW_VAL_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'name' => 'PREVIEW_VAL',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id="previewPDF_VAL" width="100%" height="100%"></span>
',
),
),
),
'LBL_PREVIEW_WARRANTY_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'name' => 'PREVIEW_WARRANTY',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id="previewPDF_WARRANTY" width="100%" height="100%"></span>
',
),
),
),
*/
),
);

View File

@@ -0,0 +1,638 @@
<?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".
* ****************************************************************************** */
global $sugar_config;
$viewdefs['EcmServices']['EditView'] = array(
'templateMeta' => array(
'form' => array(
'enctype' => 'multipart/form-data',
'buttons' => array(
array(
'customCode' =>
'
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="window.onbeforeunload=\'\';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="removeDocumentReservations(this.form.temp_id.value,\'cancel\');" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
',
),
array(
'customCode' =>
'
&nbsp;
<input title="{$MOD.LBL_GO_TO_LIST_BUTTON_TITLE}" accessKey="{$MOD.LBL_GO_TO_LIST_BUTTON_KEY}" class="button" onclick="removeDocumentReservations(this.form.temp_id.value,\'list\');" type="button" name="button" value="{$MOD.LBL_GO_TO_LIST_BUTTON_LABEL}" />
',
),
),
'hidden' => array(
'<input type="hidden" name="stock_doc_inside_in" id="stock_doc_inside_in" value=\'\'>',
'<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>',
'<input type="hidden" name="services_list" id="services_list" value=\'{$SERVICES_LIST}\'>',
'<input type="hidden" name="income_list" id="income_list" value=\'{$INCOME_LIST}\'>',
'<input type="hidden" name="email_id" id="email_id" value="">',
'<input type="hidden" name="temp_id" id="temp_id" value="{$TEMP_ID}">',
'<input type="hidden" name="temp_date" id="temp_date" value="{$TEMP_DATE}">',
'<input type="hidden" name="parent_type" id="parent_type" value="Accounts">',
// Fieds used for searching account etc.
'<input type="hidden" name="parent_address_postalcode" id="parent_address_postalcode" value="{$fields.parent_address_postalcode.value}" />',
'<input type="hidden" name="parent_address_city" id="parent_address_city" value="{$fields.parent_address_city.value}" />',
'<input type="hidden" name="parent_address_street" id="parent_address_street" value="{$fields.parent_address_street.value}" />',
'<input type="hidden" name="to_is_vat_free" id="to_is_vat_free" value="{$fields.to_is_vat_free.value}" />',
'<input type="hidden" name="parent_name_copy" id="parent_name_copy" value="{$fields.parent_name.value}" />',
'<input type="hidden" name="history" id="history" value="{$fields.history.value|htmlspecialchars}" />',
),
),
'maxColumns' => '2',
'widths' => array(
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/EcmServices/AjaxSearch/AjaxSearch.js',
),
array(
'file' => 'modules/EcmServices/AjaxSearch/AjaxSearch1.js',
),
array(
'file' => 'modules/EcmServices/AjaxSearch/AjaxSearch2.js',
),
array(
'file' => 'modules/EcmServices/AjaxSearch/AjaxSearch3.js',
),
array(
'file' => 'modules/EcmServices/formloader.js',
),
array(
'file' => 'modules/EcmServices/MyTable.js',
),
array(
'file' => 'modules/EcmServices/EcmServices.js',
),
array(
'file' => 'modules/EcmServices/EcmServicesEditView.js',
),
array(
'file' => 'modules/EcmServices/CreateItem.js',
),
array(
'file' => 'modules/EcmProducts/mintajax.js',
),
array(
'file' => 'modules/EcmProducts/helper.js',
),
),
),
'panels' => array(
'LBL_DETAILS_TAB' => array(
array(
array(
'type' => 'tab',
'active' => true,
),
),
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(
'name' => 'currency_id',
'label' => 'LBL_CURRENCY',
),
),
array(
array(
'name' => 'parent_name',
'tabIndex' => '1',
),
'ecmpaymentcondition_name',
),
array(
'name',
'ecmdeliverycondition_name',
),
array(
//'status',
array(
'label' => 'LBL_STATUS',
'name' => 'status',
'customCode' =>
'
<select name="status" id="status">
{$STATUS}
</select>
',
),
array(
'label' => 'LBL_TEMPLATE_NAME',
'tabIndex' => '1',
'customCode' =>
'
<select tabindex="1" id="template_id" name="template_id" onChange="document.getElementById(\'template_name\').value=this.options[this.selectedIndex].text;">
{$DOCUMENT_TEMPLATES_OPTIONS}
</select>
<input type="hidden" id="template_name" name="template_name" value=\'{$fields.template_name.value}\'>
',
),
),
array(
//'repair_status',
array(
'label' => 'LBL_REPAIR_STATUS',
'name' => 'repair_status',
'customCode' =>
'
<select name="repair_status" id="repair_status">
{$REPAIR_STATUS}
</select>
',
),
array(
'label' => 'LBL_STOCK_NAME',
'name' => 'stock_id',
'customCode' =>
'
<select name="stock_id" id="stock_id">
{$STOCK}
</select>
',
),
),
array(
array(
'name' => 'register_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array(
'showFormats' => true,
),
),
array(
'label' => 'LBL_PW_STOCK_NAME',
'name' => 'pw_stock_id',
'customCode' =>
'
<select name="pw_stock_id" id="pw_stock_id">
{$PW_STOCK}
</select>
',
),
),
array(
array(
'name' => 'validtill_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams' => array(
'showFormats' => true,
),
),
'',
),
// Informations section.
array(
array(
'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(
array(
'allCols' => true,
'name' => 'parent_comment',
'tabIndex' => '1',
'customCode' =>
'
<textarea name="parent_comment" id="parent_comment" style="width: 90%; resize: vertical;">{$fields.parent_comment.value}</textarea>
',
),
),
array(
array(
'allCols' => true,
'name' => 'service_comment',
'tabIndex' => '1',
'customCode' =>
'
<textarea name="service_comment" id="service_comment" style="width: 90%; resize: vertical;">{$fields.service_comment.value}</textarea>
',
),
),
array(
array(
'allCols' => true,
'name' => 'fault_comment',
'tabIndex' => '1',
'customCode' =>
'
<textarea name="fault_comment" id="fault_comment" style="width: 90%; resize: vertical;">{$fields.fault_comment.value}</textarea>
',
),
),
// array(
// array(
// 'name' => 'parent_name_copy',
// 'tabIndex' => '1',
// 'customCode' =>
// '
// <input type="text" name="parent_name_copy" id="parent_name_copy" value="{$fields.parent_name.value}" readOnly="readonly" size="30" />
// ',
// ),
// 'ecmlanguage',
// ),
array(
'parent_contact_name',
array(
'name' => 'assigned_user_name',
'tabIndex' => '1',
),
),
array(
'parent_contact_phone_fax',
array(
'name' => 'servicer_user_name',
'tabIndex' => '1',
),
),
),
'LBL_INCOME_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmServices/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmServices/AjaxSearch/AjaxSearch.css" />
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="incomeTableDIV">
<table class="positions" style="width:100%;" id="incomeTable">
<thead id="head">
<tr id="tr">
<td width="4%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="16%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="39%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
',
)
),
),
'LBL_ITEMS_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmServices/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmServices/AjaxSearch/AjaxSearch.css" />
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="itemsTableDIV">
<table class="positions" style="width:100%;" id="itemsTable">
<thead id="head">
<tr id="tr">
<td width="4%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="16%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="39%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
<td width="8%">{$MOD.LBL_EDITTABLE_RESERVATION}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_DISCOUNT}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_VAT}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_UNIT}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_TOTAL}</td>
<td width="8%">Mag.</td>
<td width="6%">{$MOD.LBL_EDITTABLE_OPTIONS}</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="55%" class="dataLabel" valign="top">
<a href="javascript: N.moveUpRow();" >{$MOD.LBL_MOVE_ROW_UP}</a> - <a href="javascript: N.moveDownRow();" >{$MOD.LBL_MOVE_ROW_DOWN}</a>
</td> <!--color:#b3b9cf;-->
<td width="40%" class="dataField" style="text-align: left;">
<br>
<table id="position_result_table" cellpadding="0" cellspacing="0" style="width:100%; height:100%; border: 1px solid rgb(48,192,255);">
<tr id="subtotal_tr">
<td class="positionsLabel" style="border-top:0px;">{$MOD.LBL_ARTICLES_SUBTOTAL}</td>
<td class="positionsField" style="border-top:0px;">
<input tabindex="127" type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="articles_subtotal" id="articles_subtotal" value=\'{$fields.articles_subtotal.value}\'>
</td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_ARTICLES_TOTAL}</td>
<td class="positionsField">
<input tabindex="127" type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="articles_total" id="articles_total" value=\'{$fields.articles_total.value}\'>
</td>
</tr>
</table>
</td>
<td width="5%" class="dataField" style="text-align: left;">&nbsp;</td>
</tr>
</table>
',
)
),
),
'LBL_SERVICES_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmServices/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmServices/AjaxSearch/AjaxSearch.css" />
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="servicesTableDIV">
<table class="positions" style="width:100%;" id="servicesTable">
<thead id="head">
<tr id="tr">
<td width="4%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="16%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="39%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_DISCOUNT}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_VAT}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_TOTAL}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_OPTIONS}</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="55%" class="dataLabel" valign="top">
<a href="javascript: N.moveUpRow();" >{$MOD.LBL_MOVE_ROW_UP}</a> - <a href="javascript: N.moveDownRow();" >{$MOD.LBL_MOVE_ROW_DOWN}</a>
</td> <!--color:#b3b9cf;-->
<td width="40%" class="dataField" style="text-align: left;">
<br>
<table id="services_result_table" cellpadding="0" cellspacing="0" style="width:100%; height:100%; border: 1px solid rgb(48,192,255);">
<tr id="subtotal_tr">
<td class="positionsLabel" style="border-top:0px;">{$MOD.LBL_SERVICES_SUBTOTAL}</td>
<td class="positionsField" style="border-top:0px;">
<input tabindex="127" type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="services_subtotal" id="services_subtotal" value=\'{$fields.services_subtotal.value}\'>
</td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_SERVICES_TOTAL}</td>
<td class="positionsField">
<input tabindex="127" type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="services_total" id="services_total" value=\'{$fields.services_total.value}\'>
</td>
</tr>
</table>
</td>
<td width="5%" class="dataField" style="text-align: left;">&nbsp;</td>
</tr>
</table>
',
)
),
),
'LBL_HISTORY_TAB'=> array(
array(
array(
'name' => 'history_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<div id="history_wrapper">
<ul>
{section name=i loop=$HISTORY}
<li class="result" id="result_{$smarty.section.i.index}">
<p class="history_header">{$HISTORY[i][0]|date_format:\'%d.%m.%Y\'}, {$HISTORY[i][1]}: </p>
<p class="history_record">{$HISTORY[i][2]} <a class="delete" href="#" title="delete" style="display: inline;" onClick="removeHistory(this); return false;">usuń</a></p>
</li>
{sectionelse}
<li class="no-results">
Brak wpisów w historii
</li>
{/section}
</ul>
</div>
<div id="history_form_wrapper">
<dl>
<dt>Data:</dt>
<dd>
<input autocomplete="off" name="history_date" id="history_date" value="{\'d.m.Y\'|date}" title="" tabindex="" size="11" maxlength="10" type="text">
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="history_date_trigger" align="absmiddle" border="0">
<script type="text/javascript">
{literal}
Calendar.setup ({
inputField : "history_date",
daFormat : "%d.%m.%Y",
button : "history_date_trigger",
singleClick : true,
dateStr : "",
step : 1
});
{/literal}
</script>
</dd>
<dt>Zgłosił:</dt>
<dd>
<input type="text" name="history_owner" id="parent_contact_no" value=\'{$fields.history_owner.value}\'>
<button type="button" value="Wybierz"
onClick=\'open_popup(
"Users",
600,
400,
"&account_name="+document.EditView.parent_name.value,
true,
false,
&#123;"call_back_function":"set_return","form_name":"EditView","field_to_name_array":&#123;"user_name":"history_owner","id":"contact_id"&#125;&#125;,
"single",
false
);\'>
<img src="themes/default/images/id-ff-select.png">
</button>
</dd>
<dt>Wpis:</dt>
<dd>
<textarea style="width: 90%; resize: vertical;" name="history_record" id="history_record"></textarea>
</dd>
<dt>&nbsp;</dt>
<dd>
<input id="add_record" name="add_record" value="Dodaj" type="button" onclick="addHistory(); return false;"/>
</dd>
</dl>
</div>
',
),
),
),
/*
'LBL_PREVIEW_INCOME_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id=\'previewPDF_INCOME\' width="100%" height="100%"></span>
',
),
),
),
'LBL_PREVIEW_QTY_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id=\'previewPDF_QTY\' width="100%" height="100%"></span>
',
),
),
),
'LBL_PREVIEW_VAL_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id=\'previewPDF_VAL\' width="100%" height="100%"></span>
',
),
),
),
'LBL_PREVIEW_WARRANTY_TAB' => array(
array(
array(
'type' => 'tab',
),
),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<span id=\'previewPDF_WARRANTY\' width="100%" height="100%"></span>
',
),
),
),
*/
),
);

View File

@@ -0,0 +1,117 @@
<?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.
* ****************************************************************************** */
$listViewDefs["EcmServices"] = array(
'NUMBER' =>
array (
'width' => '1%',
'label' => 'n',
'default' => true,
'sortable' => true,
),
'STATUS' => array(
'width' => '5',
'label' => 'LBL_STATUS',
'default' => true,
'sortable' => true,
),
'DOCUMENT_NO' => array(
'width' => '15',
'label' => 'LBL_DOCUMENT_NO',
'sortable' => true,
'link' => true,
'default' => true,
),
'NAME' => array(
'width' => '15',
'label' => 'LBL_NAME',
'default' => true,
),
'PARENT_NAME' => array(
'width' => '35',
'label' => 'LBL_PARENT_NAME',
'default' => true,
),
'CURRENCY_ID' => array(
'width' => '10',
'label' => 'LBL_CURRENCY',
'default' => true,
),
'TOTAL' => array(
'width' => '10',
'label' => 'LBL_TOTAL',
'default' => true,
),
'MODIFIED_BY_NAME' => array(
'width' => '10',
'label' => 'LBL_MODIFIED_USER',
'module' => 'Users',
'id' => 'USERS_ID',
'default' => false,
'sortable' => false,
'related_fields' => array('modified_user_id'),
),
'REGISTER_DATE' => array(
'width' => '15',
'label' => 'LBL_REGISTER_DATE',
'default' => true,
'sortable' => true,
),
'OPTIONS' => array(
'width' => '15',
'label' => '&nbsp;',
'default' => true,
'sortable' => false,
'align' => 'right',
),
);

View File

@@ -0,0 +1,105 @@
<?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".
* ****************************************************************************** */
$searchdefs['EcmServices'] = array(
'templateMeta' => array(
'maxColumns' => '3',
'widths' => array(
'label' => '10',
'field' => '30'
),
),
'layout' => array(
'basic_search' => array(
'document_no',
'name',
'parent_name',
'register_date',
'currency_id' => array(
'name' => 'currency_id',
'label' => 'LBL_CURRENCY',
),
'status',
'current_user_only' => array(
'name' => 'current_user_only',
'label' => 'LBL_CURRENT_USER_FILTER',
'type' => 'bool',
'default' => true,
'width' => '10%',
),
),
'advanced_search' => array(
'document_no',
'name',
'parent_name',
'register_date',
'currency_id' => array(
'name' => 'currency_id',
'label' => 'LBL_CURRENCY',
),
'status',
'validtill_date',
'assigned_user_id' => array(
'name' => 'assigned_user_id',
'type' => 'enum',
'label' => 'LBL_ASSIGNED_TO',
'function' => array(
'name' => 'get_user_array',
'params' => array(
0 => false,
),
),
'default' => true,
'width' => '10%',
),
'servicer_user_id' => array(
'name' => 'servicer_user_id',
'type' => 'enum',
'label' => 'LBL_SERVICER',
'function' => array(
'name' => 'get_user_array',
'params' => array(
0 => false,
),
),
'default' => true,
'width' => '10%',
),
),
),
);

View File

@@ -0,0 +1,76 @@
<?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.
********************************************************************************/
$GLOBALS['studioDefs']['EcmServices'] = array(
'LBL_DETAILVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmServices/DetailView.html',
'php_file' => 'modules/EcmServices/DetailView.php',
'type' => 'DetailView',
),
'LBL_EDITVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmServices/EditView.html',
'php_file' => 'modules/EcmServices/EditView.php',
'type' => 'EditView',
),
'LBL_LISTVIEW'=>array(
'template' => 'listview',
'meta_file' => 'modules/EcmServices/listviewdefs.php',
'type' => 'ListView',
),
'LBL_SEARCHFORM'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmServices/SearchForm.html',
'php_file' => 'modules/EcmServices/ListView.php',
'type' => 'SearchForm',
),
);

View File

@@ -0,0 +1,137 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Layout definition for Accounts
*
* 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".
*/
$layout_defs['EcmServices']['subpanel_setup'] = array (
'notes' => array (
'order' => 15,
'module' => 'Notes',
'sort_order' => 'asc',
'sort_by' => 'date_modified',
'get_subpanel_data' => 'notes',
'add_subpanel_data' => 'note_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_NOTES_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopSelectButton'),
array('widget_class' => 'SubPanelTopCreateButton'),
),
),
/*
'ecmprepaymentinvoices' => array (
'order' => 16,
'module' => 'EcmPrepaymentInvoices',
'sort_order' => 'asc',
'sort_by' => 'date_modified',
'get_subpanel_data' => 'ecmprepaymentinvoices',
'add_subpanel_data' => 'ecmservice_id',
'subpanel_name' => 'default',
'title_key' => 'Faktury zaliczkowe',
'top_buttons' => array(
),
),
'emails' => array (
'order' => 17,
'module' => 'Emails',
'sort_order' => 'asc',
'sort_by' => 'date_modified',
'get_subpanel_data' => 'emails',
'add_subpanel_data' => 'emails_id',
'subpanel_name' => 'ForEcmServices',
'title_key' => 'LBL_EMAILS_SUBPANEL_TITLE',
'top_buttons' => array(),
),
*/
);
?>

View File

@@ -0,0 +1,119 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/**
* Subpanel Layout definition for Contacts
*
* 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".
*/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmServices'),
),
'where' => '',
'list_fields' => array (
'status' => array (
'name' => 'status',
'vname' => 'LBL_STATUS',
'module' => 'EcmServices',
'width' => '5%',
),
/*
'number' => array (
'name' => 'number',
'vname' => 'LBL_NUMBER',
'module' => 'EcmServices',
'usage' => 'query_only',
),
*/
'document_no' => array (
'name' => 'document_no',
'vname' => 'LBL_DOCUMENT_NO',
'module' => 'EcmServices',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '15%',
),
'name' => array (
'name' => 'name',
'vname' => 'LBL_NAME',
'module' => 'EcmServices',
'width' => '40%'
),
'total' => array (
'name' => 'total',
'vname' => 'LBL_TOTAL',
'module' => 'EcmServices',
'width' => '15%',
),
'register_date' => array (
'name' => 'register_date',
'vname' => 'LBL_REGISTER_DATE',
'module' => 'EcmServices',
'width' => '10%',
),
'options' => array (
'name' => 'options',
'label' => '&nbsp;',
'default' => true,
'width' => '2%',
'sortable' => false,
),
/*
'PDF_URL' => array(
'width' => '2%',
'label' => '&nbsp;',
'link' => true,
'default' => true,
'sortable' => false,
),
'edit_button'=>array(
'widget_class' => 'SubPanelEditButton',
'width' => '2%',
),
*/
),
);
?>

View File

@@ -0,0 +1,29 @@
<?php
function getPopupFieldsJsCode($module,$id)
{
require_once("modules/".$module."/popup_fields.php");
$js='';
if($popup_field[$module])
{
$js.='<script language="javascript">';
foreach($popup_field[$module] as $field)
{
$exp=explode("||",$field['to_insert']);
$value="";
$values=array();
foreach($exp as $e)
{
if($e!="" && $e=="id")$values[]=$id;
elseif($e!="")$values[]=$_REQUEST[$e];
}
$value=implode(" ",$values);
if($field['if_empty']==true)$js.='if(parent.opener.document.getElementById("'.$field['field'].'")=="")';
$js.='parent.opener.document.getElementById("'.$field['field'].'").value="'.$value.'";
';
}
$js.='window.close();</script>';
}
return $js;
}
?>

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
<?php
global $db;
$db->query("delete from ecmreservations where temp_doc_id='".$_REQUEST['temp_id']."'");
?>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,18 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
if ($_REQUEST['temp_id']) {
session_start();
$temp_id = $_REQUEST['temp_id'];
$_SESSION[$temp_id] = array();
$_POST = $_REQUEST;
$json = getJSONobj();
$pll = array(); $i=0; while(isset($_POST['p_'.$i])) { $pll[] = $json->decode(htmlspecialchars_decode($_POST['p_'.$i])); $_POST['p_'.$i] = ''; $i++;}
$_SESSION[$temp_id] = $pll;
die();;
}
?>

View File

@@ -0,0 +1,26 @@
<?
global $current_user;
$w=$GLOBALS['db']->query("select * from user_preferences where assigned_user_id='".$_SESSION['authenticated_user_id']."' and category='global'");
$r=$GLOBALS['db']->fetchByAssoc($w);
$a=unserialize(base64_decode($r['contents']));
$a['ContactsQ']['account_id_basic']=$_REQUEST['account_id'];
$a['ContactsQ']['account_name_basic']=$_REQUEST['account_name'];
$a['ContactsQ']['query']='true';
$a['ContactsQ']['module']='Contacts';
$a['ContactsQ']['action']='index';
$a['ContactsQ']['searchFormTab']='basic_search';
$_SESSION[$current_user->user_name.'_PREFERENCES']['global']['ContactsQ']['account_id_basic']=$_REQUEST['account_id'];
$_SESSION[$current_user->user_name.'_PREFERENCES']['global']['ContactsQ']['account_name_basic']=$_REQUEST['account_name'];
$_SESSION[$current_user->user_name.'_PREFERENCES']['global']['ContactsQ']['query']='true';
$_SESSION[$current_user->user_name.'_PREFERENCES']['global']['ContactsQ']['module']='Contacts';
$_SESSION[$current_user->user_name.'_PREFERENCES']['global']['ContactsQ']['action']='index';
$_SESSION[$current_user->user_name.'_PREFERENCES']['global']['ContactsQ']['searchFormTab']='basic_search';
//print_r($_SESSION[$current_user->user_name.'_PREFERENCES']['global']['ContactsQ']);
$z="update user_preferences set contents='".base64_encode(serialize($a))."' where assigned_user_id='".$_SESSION['authenticated_user_id']."' and category='global'";
$GLOBALS['db']->query($z);
?>

View File

@@ -0,0 +1,39 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
if(isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
if(!isset($focus)) {
require_once('modules/EcmServices/EcmService.php');
$focus = new EcmService();
$focus->retrieve($_REQUEST['record']);
$focus->format_all_fields();
}
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($focus, "EcmServices");
echo $subpanel->display();
}
?>

View File

@@ -0,0 +1,82 @@
<?php
require_once("modules/EcmServices/EcmService.php");
class EcmServieToTransfer extends EcmService{
function getPosition($id) {
if(!isset($id) || $id == '') return '';
require_once('modules/EcmProductsDocumentsRelations/EcmProductsDocumentsRelation.php');
$epdr = new EcmProductsDocumentsRelation();
$epdr->retrieve($id);
$return_array = array();
if(isset($epdr->id) && $epdr->id != '') {
$return_array['id'] = $epdr->product_id;
$return_array['code'] = $epdr->product_code;
$return_array['name'] = $epdr->product_name;
$return_array['quantity'] = $epdr->product_quantity;
$return_array['price'] = $epdr->product_price;
$return_array['discount'] = $epdr->product_discount;
$return_array['total'] = $epdr->product_total;
$return_array['unit_id'] = $epdr->product_unit_id;
$return_array['vat_id'] = $epdr->product_vat_id;
$return_array['category_id'] = $epdr->product_category_id;
$return_array['project_task_name'] = $epdr->project_task_name;
$return_array['project_task_id'] = $epdr->project_task_id;
$return_array['project_name'] = $epdr->project_name;
$return_array['project_id'] = $epdr->project_id;
$epdr->fill_in_additional_detail_fields();
$return_array['currency_id'] = $epdr->currency->id;
$return_array['currency_symbol'] = $epdr->currency->symbol;
$return_array['date'] = $epdr->d_date;
return $return_array;
}
return '';
}
function getPositionList($array = false) {
if(isset($this->id) && $this->id != '') {
$query = "SELECT `id` FROM `ecmproductsdocumentsrelations` WHERE `document_id`='".$this->id."' AND `document_type`='EcmServices' AND`deleted`='0' order by product_position asc";
$r = $this->db->query($query);
$return_array = array();
if($r) {
while($w = $this->db->fetchByAssoc($r)) {
$return_array [] = $this->getPosition($w['id']);
}
$json = getJSONobj();
return $array ? $return_array : $json->encode($return_array);
}
}
return $array ? false : '[]';
}
/*
function deleteAssignedPositions() {
if(isset($this->id) && $this->id != '') {
$query = "DELETE FROM `ecmproductsdocumentsrelations` WHERE `document_id`='".$this->id."' AND `document_type`='EcmServices'";
$r = $this->db->query($query);
if($r) return true;
}
return false;
}
*/
}
$query = "SELECT `id`, `deleted` FROM `ecmservices` WHERE `deleted`='0'";
$GLOBALS['db'] = new MysqlManager();
$GLOBALS['db']->connect();
$results = $GLOBALS['db']->query($query);
if(is_resource($results)) {
while($row = $GLOBALS['db']->fetchByAssoc($results)) {
if(isset($row['id']) && $row['id'] != '') {
$focus = new EcmServiceToTransfer();
$focus->retrieve($row['id']);
if(isset($focus->id) && $focus->id != '') {
echo $focus->id.' -> '.$focus->name.'<br />';
$focus->position_list = $focus->getPositionList(true);
$focus->savePositions($focus->id);
}
}
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,374 @@
{*
/*********************************************************************************
* 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/EcmServices/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/EcmServices/views/EditView/footer.tpl'}}

View File

@@ -0,0 +1,61 @@
{*
/*********************************************************************************
* 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".
********************************************************************************/
*}
test
<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,140 @@
<?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".
* ****************************************************************************** */
/**
* @see CreateView
*/
require_once('include/CreateView/CreateView2.php');
/**
* ViewCreateEcmServices
*/
class ViewCreateEcmServices extends SugarView {
/**
* CreateView instance.
*
* @var CreateView
*/
var $ev;
/**
* Type.
*
* @var string
*/
var $type = 'create';
/**
* Boolean variable to determine whether view can be used for subpanel creates.
*
* @var boolean
*/
var $useForSubpanel = false;
/**
* Boolean variable to determine whether view can be used for title creates.
*
* @var boolean
*/
var $showTitle = true;
/**
* Template file path.
*
* @var string
*/
var $tplFile = 'include/CreateView/CreateView.tpl';
/**
* Constructor.
*/
function ViewCreateEcmServices() {
parent::SugarView();
}
/**
* Pre display configuration.
*/
function preDisplay() {
$metadataFile = null;
$foundViewDefs = false;
if (file_exists('custom/modules/' . $this->module . '/metadata/createviewdefs.php')) {
$metadataFile = 'custom/modules/' . $this->module . '/metadata/createviewdefs.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]['createviewdefs'])) {
$metadataFile = $metafiles[$this->module]['createviewdefs'];
$foundViewDefs = true;
}
} elseif (file_exists('modules/' . $this->module . '/metadata/metafiles.php')) {
require_once('modules/' . $this->module . '/metadata/metafiles.php');
if (!empty($metafiles[$this->module]['createviewdefs'])) {
$metadataFile = $metafiles[$this->module]['createviewdefs'];
$foundViewDefs = true;
}
}
}
$GLOBALS['log']->debug("metadatafile=" . $metadataFile);
if (!$foundViewDefs && file_exists('modules/' . $this->module . '/metadata/createviewdefs.php')) {
$metadataFile = 'modules/' . $this->module . '/metadata/createviewdefs.php';
}
$this->ev = new CreateView();
$this->ev->ss = & $this->ss;
$this->ev->setup($this->module, $this->bean, $metadataFile, $this->tplFile);
}
/**
* Display.
*
* Pass controll to CreateView instance.
*/
function display() {
$this->ev->process();
echo $this->ev->display($this->showTitle);
}
}

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,385 @@
{*
/*********************************************************************************
* 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/EcmServices/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/EcmServices/views/EditView/footer.tpl'}}

View File

@@ -0,0 +1,61 @@
{*
/*********************************************************************************
* 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".
********************************************************************************/
*}
test
<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 ViewEditEcmServices 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 ViewEditEcmServices() {
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 @@