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

View File

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

View File

@@ -0,0 +1,142 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
if(isset($_REQUEST['as_inputSearch']) && $_REQUEST['as_inputSearch'] != '') {
$AS_INPUTSEARCH = strtoupper($_REQUEST['as_inputSearch']);
$language_translate = array(
'en_us' => 'en',
'ge_ge' => 'de',
'pl_pl' => 'pl'
);
if(isset($_REQUEST['ecmlanguage']) && $_REQUEST['ecmlanguage'] != '') {
if(isset($language_translate[$_REQUEST['ecmlanguage']]) && $language_translate[$_REQUEST['ecmlanguage']] != '') {
$use_language = $language_translate[$_REQUEST['ecmlanguage']];
}
}
$query = "SELECT DISTINCT";
$query .= " `pr`.`id`";
$query .= ", `pr`.`code`";
$query .= ", `pr`.`unit_id` as unitid";
$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`";
/*if(isset($use_language)) {
$query .= ", `pr_lang`.`short_description`";
$query .= ", `pr_lang`.`long_description`";
}*/
$query .= " FROM";
$query .= " `ecmproducts` as `pr`";
//if(isset($use_language))
//$query .= " RIGHT JOIN `ecmproduct_language_".$use_language."_view` as `pr_lang` ON `pr`.`id` = `pr_lang`.`ecmproduct_id`";
$query .= " WHERE";
$query .= " (";
$query .= "UPPER(`pr`.`code`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr`.`code`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`code`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`name`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr`.`name`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr`.`name`) LIKE '%$AS_INPUTSEARCH%'";
/*if(isset($use_language)) {
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`long_description`) LIKE '$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '%$AS_INPUTSEARCH'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '%$AS_INPUTSEARCH%'";
$query .= " || UPPER(`pr_lang`.`short_description`) LIKE '$AS_INPUTSEARCH%'";
}*/
$query .= ")";
$query .= " AND `pr`.`deleted`='0'";
$result = $GLOBALS['db']->query($query);
global $sugar_config;
$defaultCurrency = $sugar_config['default_currency_symbol'];
$currencies = array ( -99 => $defaultCurrency );
$arr = array();
if($result)
while($row = $GLOBALS['db']->fetchByAssoc($result)) {
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select quantity from ecmstockstates where product_id='".$row['id']."' and stock_id='".$_REQUEST['stock_id']."' and deleted='0'"));
$row['on_stock']=number_format($r['quantity'],0,"","");
$row['unit_id']=$row['unitid'];
$row['unit_name']=$app_list_strings['ecmproducts_unit_dom'][$row['unitid']];
$row['price'] = $row['srp_price'];
$row['purchase_price'] = format_number($row['purchase_price']);
$row['selling_price'] = format_number($row['selling_price']);
$p2 = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT price from ecmstockoperations WHERE product_id='".$row['id']."' and deleted=0 and type=0 order by date_entered desc limit 1"));
$row['price_last']=($p2['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['long_description']), $AS_INPUTSEARCH) !== false)
$row['name'] = $row['long_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['long_description']) && $row['long_description'] != '')
$row['name'] = $row['long_description'];
else
if(isset($row['short_description']) && $row['short_description'] != '')
$row['name'] = $row['short_description'];
}
unset($row['long_description'], $row['short_description']);/
if($row['long_description'])$row['name']=$row['long_description'];
elseif(!$row['long_description'] && $row['short_description'])$row['name']=$row['short_description'];
elseif(!$row['long_description'] && !$row['short_description'])$row['name']=$row['name'];
unset($row['long_description'],$row['short_desciption']);
}*/
$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,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['MyEcmStockDocInsDashlet']['searchFields'] = array('name' => array('default' => ''),
//'status' => array('default' => array('Not Started', 'In Progress', 'Pending Input')),
'date_entered' => array('default' => ''),
//'date_start' => array('default' => ''),
//'date_due' => array('default' => ''),
'assigned_user_id' => array('type' => 'assigned_user_name',
'default' => $current_user->name));
$dashletData['MyEcmStockDocInsDashlet']['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=EcmStockDocIns&action=EditView&record={$ID}">{$NAME}</a>',
'default' => 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'=>'EcmVendors',
'link'=>true,
),
'TOTAL' => array(
'width' => '10',
'label' => 'LBL_TOTAL',
'default' => true,
'align' => 'right',
),
'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'),
);
?>

View File

@@ -0,0 +1,48 @@
<?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['MyEcmStockDocInsDashlet'] = array('module' => 'EcmStockDocIns',
'title' => translate('LBL_DASHLET_MY_ECMSTOCKDOCINS', 'EcmStockDocIns'),
'description' => 'A customizable view into Quotes',
'icon' => 'themes/default/images/EcmStockDocInsDashlet.gif',
'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/EcmStockDocIns/EcmStockDocIn.php');
class MyEcmStockDocInsDashlet extends DashletGeneric {
function MyEcmStockDocInsDashlet($id, $def = null) {
global $current_user, $app_strings;
require('modules/EcmStockDocIns/Dashlets/MyEcmStockDocInsDashlet/MyEcmStockDocInsDashlet.data.php');
parent::DashletGeneric($id, $def);
if(empty($def['title'])) $this->title = translate('LBL_DASHLET_MY_ECMSTOCKDOCINS', 'EcmStockDocIns');
$this->searchFields = $dashletData['MyEcmStockDocInsDashlet']['searchFields'];
$this->columns = $dashletData['MyEcmStockDocInsDashlet']['columns'];
$this->seedBean = new EcmStockDocIn();
$this->lvs->quickViewLinks = false;
}
}
?>

142
modules/EcmStockDocIns/Delete.php Executable file
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/EcmStockDocIns/EcmStockDocIn.php');
$focus = new EcmStockDocIn();
// 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,238 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
// require_once('modules/EcmGroupSales/HeaderMenu.php');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once('modules/EcmStockDocIns/EcmStockDocIn.php');
require_once('modules/EcmStockDocIns/Forms.php');
require_once ('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$file = 'modules/EcmGroupSales/EcmGroupSale.php';
if(file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupSale::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 EcmStockDocIn();
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
$focus->format_all_fields();
if(isset($_REQUEST['status']) && $_REQUEST['status'] != '' ) {
$focus->doNotAccepted();
}
$focus->position_list = str_replace('&quot;','\"',$focus->getPositionList());
$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'] = "19.00";
$OPT['default_category'] = "";
$OPT['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
if ((is_null($focus->kind)) || ($focus->kind==' '))
$OPT['kind'] = 'other';
else
$OPT['kind'] = $focus->kind;
$cq = $current_user->getPreference('confirm_quotes');
$OPT['user']['confirm_quotes'] = ((isset($cq) && $cq)?1:0);
$json = getJSONobj();
$w=$GLOBALS['db']->query("select name,id,value from ecmvats where deleted='0' order by name");
$nvats=$w->num_rows;
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$VAT[$r['id']]=array(
"id"=>$r['id'],
"name"=>$r['name'],
"value"=>$r['value']
);
}
$show_pdf=$current_user->getPreference('show_pdf_in_div');
if(!isset($show_pdf)){
require_once('modules/EcmGroupSales/EcmGroupSale.php');
$cc = EcmGroupSale::loadSettings();
$show_pdf=$cc['show_pdf_in_div_global'];
}
$scriptOpt = '<script language="javascript">
var STATUS="'.$focus->status.'";
var SHOW_PDF_IN_DIV ='.$show_pdf.';
var UNIT ='.str_replace('&quot;','\"',$json->encode($GLOBALS['app_list_strings']['ecmproducts_unit_dom'])).';
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;
</script>';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmStockDocIns/views/DetailView/view.detail.my.php');
$edit = new ViewDetailMy();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmStockDocIns';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
$edit->bean->total = unformat_number($edit->bean->total);
$edit->preDisplay();
//$edit->bean->subtotal = unformat_number($edit->bean->subtotal);
//echo '<br>'.$edit->bean->subtotal;
$cnt=mysql_num_rows($GLOBALS['db']->query("select id from ecmstockdocins where correct_id='".$focus->id."'"));
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select type from ecmstockdocins where id='".$focus->id."'"));
if($cnt>0)$hasCorrect=1;
else $hasCorrect=0;
$edit->ss->assign("hasCorrect", $hasCorrect);
$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, ''));
$edit->ss->assign("POSITION_LIST", $focus->position_list);
$edit->ss->assign("EMAIL_LINK",$focus->createSendEmailLink());
$edit->ss->assign("OPT", $OPT);
error_reporting(E_ALL);
$edit->ss->assign("SEND_EMAIL_LINK",$focus->createSendEmailLink());
$email_link_tab = '<script language="javascript">YAHOO.util.Event.addListener(window,"load",function(){setEMAIL = function(){'.$focus->createSendEmailLink().'}});</script>';
$edit->ss->assign("EMAIL_LINK_TAB",$email_link_tab);
if ($focus->kind=='import') {
$edit->ss->assign("KIND_TITLE","Szczegóły - Import");
$kind_table='<table>
<tr>
<td class="tabDetailViewDL">'.$mod_strings['LBL_FOREIGN_TRANSPORT_VAL'].'</td>
<td class="tabDetailViewDF">'.format_number($focus->foreign_transport_val).'</td>
<td class="tabDetailViewDL">'.$mod_strings['LBL_FOREIGN_TRANSPORT_CUR_ID'].'</td>
<td class="tabDetailViewDF">'.$app_list_strings['currency_dom'][$focus->foreign_transport_cur_id].'</td>
<td class="tabDetailViewDF">'.format_number($focus->foreign_transport_cur_val).'</td>
<td></td></tr><tr>
<td class="tabDetailViewDL">'.$mod_strings['LBL_COUNTRY_TRANSPORT_VAL'].'</td>
<td class="tabDetailViewDF">'.format_number($focus->country_transport_val).'</td>
<td class="tabDetailViewDL">'.$mod_strings['LBL_COUNTRY_TRANSPORT_CUR_ID'].'</td>
<td class="tabDetailViewDF">'.$app_list_strings['currency_dom'][$focus->country_transport_cur_id].'</td>
<td class="tabDetailViewDF">'.format_number($focus->country_transport_cur_val).'</td>
<td></td></tr><tr>
<td class="tabDetailViewDL">'.$mod_strings['LBL_ADDITION_COST_VAL'].'</td>
<td class="tabDetailViewDF">'.format_number($focus->addition_cost_val).'</td>
<td class="tabDetailViewDL">'.$mod_strings['LBL_ADDITION_COST_CUR_ID'].'</td>
<td class="tabDetailViewDF">'.$app_list_strings['currency_dom'][$focus->addition_cost_cur_id].'</td>
<td class="tabDetailViewDF">'.format_number($focus->addition_cost_cur_val).'</td>
<td></td></tr>
<tr>
<td class="tabDetailViewDL">'.$mod_strings['LBL_CURRENCY_ID'].'</td>
<td class="tabDetailViewDF">'.$app_list_strings['currency_dom'][$focus->currency_id].'</td>
<td class="tabDetailViewDL">'.$mod_strings['LBL_CURRENCY_VALUE'].'</td>
<td class="tabDetailViewDF">'.format_number($focus->currency_value,4,4).'</td>
<td class="tabDetailViewDL">'.$mod_strings['LBL_CURRENCY_SAD_VALUE'].'</td>
<td class="tabDetailViewDF">'.format_number($focus->currency_sad_value,4,4).'</td>
</tr>
</table>';
}
if (isset($kind_table))
$edit->ss->assign("KIND_TABLE",$kind_table);
echo $edit->display();
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($focus, 'EcmStockDocIns');
echo $subpanel->display();
?>

View File

@@ -0,0 +1,5 @@
<?php
include('modules/EcmStockDocIns/EditView.php');
?>

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,944 @@
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function changeValidateRequired(formname,name,required) {
for(var i=0; i<validate[formname].length; i++)
if(validate[formname][i][0] == name) { validate[formname][i][2] = required; break; }
}
function set_focus() { document.getElementById('name').focus(); }
function my_popup(module, field_array, call_back_function, form_name) {
if(!call_back_function) call_back_function = "set_return";
if(!form_name) form_name = "EditView";
return open_popup(module, 600, 400, "", true, false, {"call_back_function":call_back_function,"form_name":form_name,"field_to_name_array":field_array});
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function ItemListClear() {
while(N.rowCount()>0) N.row(0).deleteRow();
}
function CheckDiscount(noAlert) {
var discount = 0;
var tmp = UserFormatNumberToNumber(document.getElementById('discount').value);
if(tmp == -1) {
if(!noAlert)
alert(MOD['LBL_DISCOUNT_ERROR']+' ('+document.getElementById('discount').value+')');
discount = -1;
document.getElementById('discount').style.color = 'red';
} else {
discount = tmp;
document.getElementById('discount').value = NumberToUserFormatNumber(discount);
document.getElementById('discount').style.color = 'black';
}
return discount;
}
function sendToConfirmEcmStockDocIn(record) {
if(typeof(record) == "string") {
var status = "s20";
doRequest(
'index.php',
'module=EcmStockDocIns&action=SetStatus&to_pdf=1&status='+status+'&record='+record,
function(results) {
var obj = eval(results);
if(obj[0]) obj = obj[0];
if(typeof(obj) == "object") {
if(document.forms.DetailView.record.value == obj['record']) {
document.getElementById('statusEcmStockDocIn').innerHTML = obj['status']['text'];
if(obj['status']['code'] == "s20") {
document.forms.DetailView.send_to_confirm.style.display = 'none';
document.forms.DetailView.edit_button.style.display = 'none';
var c = document.getElementById('confirmingEcmStockDocIn');
if(c) c.style.display = '';
}
if(obj['status']['code'] == "s30") {
document.forms.DetailView.send_to_confirm.style.display = 'none';
document.forms.DetailView.edit_button.style.display = 'none';
document.getElementById('confirmingEcmStockDocIn').style.display = 'none';
document.forms.DetailView.quote_to_sale.style.display = '';
document.forms.DetailView.quote_to_invoice.style.display = '';
}
}
alert(obj['message']);
}
}
);
}
}
function AcceptEcmStockDocIn(record) {
if(typeof(record) == "string") {
var status = "s30";
doRequest(
'index.php',
'module=EcmStockDocIns&action=SetStatus&to_pdf=1&status='+status+'&record='+record,
function(results) {
var obj = eval(results);
if(obj[0]) obj = obj[0];
if(typeof(obj) == "object") {
if(document.forms.DetailView.record.value == obj['record']) {
document.getElementById('statusEcmStockDocIn').innerHTML = obj['status']['text'];
if(obj['status']['code'] == "s30") {
document.forms.DetailView.send_to_confirm.style.display = 'none';
document.forms.DetailView.edit_button.style.display = 'none';
document.getElementById('confirmingEcmStockDocIn').style.display = 'none';
document.forms.DetailView.quote_to_sale.style.display = '';
document.forms.DetailView.quote_to_invoice.style.display = '';
}
}
alert(obj['message']);
}
}
);
}
}
function RejectEcmStockDocIn(record) {
if(typeof(record) == "string") {
var status = "s40";
doRequest(
'index.php',
'module=EcmStockDocIns&action=SetStatus&to_pdf=1&status='+status+'&record='+record,
function(results) {
var obj = eval(results);
if(obj[0]) obj = obj[0];
if(typeof(obj) == "object") {
if(document.forms.DetailView.record.value == obj['record']) {
document.getElementById('statusEcmStockDocIn').innerHTML = obj['status']['text'];
if(obj['status']['code'] == "s40") {
document.getElementById('confirmingEcmStockDocIn').style.display = 'none';
document.forms.DetailView.edit_button.style.display = '';
}
}
alert(obj['message']);
}
}
);
}
}
addEvent(
window,
'load',
function () {
//initialize table
N = new MyTable('itemsTable');
N.onRefreshRowIndex = function(row) {
var data = new Object();
data['index'] = (row.index+1).toString();
row.cells.item(0).setData(data);
}
N.onCreateRow = function(row) {
row.newPos = false;
row.ondblclick = function() {
this.newPos = !this.newPos;
var img = this.cells.item(1).getElementsByTagName('img');
if(!this.newPos) img[0].src = "modules/EcmStockDocIns/images/edit.gif";
else img[0].src = "modules/EcmStockDocIns/images/editset.gif";
for(var i=0; i<this.myTable.colCount(); i++)
this.cells.item(i).change(!this.newPos);
}
row.onSelect = function() {
for(var i=0; i<this.myTable.colCount(); i++) {
this.cells.item(i).style.height = OPT['row_item_height_selected'];
this.cells.item(i).change(!this.newPos);
}
}
row.onDeselect = function() {
for(var i=0; i<this.myTable.colCount(); i++) {
this.cells.item(i).style.height = OPT['row_item_height'];
this.cells.item(i).change(false);
}
}
row.calculateTotal = function() {
var data = new Object();
this.cells.item(3).getData(data,true);
this.cells.item(4).getData(data,true);
this.cells.item(5).getData(data,true);
this.cells.item(6).getData(data,true);
if(data.quantity && data.price)
data.total = data.quantity*data.price+data.quantity*data.price*data.discount/100;
else
data.total = 0;
this.cells.item(7).setData(data);
calculateTotal();
}
}
N.onCreateCell = function(cell) {
var i = cell.index;
cell.change = function(select) {};
cell.style.height = OPT['row_item_height'];
cell.noSelect = true;
if(i == 0) {
cell.setData = function(data) {
if(data.index) cell.firstChild.value = data.index;
};
cell.getData = function(data) {
data.index = cell.firstChild.value;
}
cell.select = function() { this.selectNext(); }
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('readOnly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if(i == 1) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.code = cn[0].value;
data.id = cn[1].value;
data.unit_name = cn[2].value;
data.vat_id = cn[3].value;
data.category_id = cn[4].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.code) cn[0].value = data.code;
if(data.id) cn[1].value = data.id;
if(data.unit_name) cn[2].value = data.unit_name;
if(data.vat_id) cn[3].value = data.vat_id;
if(data.category_id) cn[4].value = data.category_id;
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" autocomplete="off" >';
cell.innerHTML = edit;
cell.align = 'right';
var id = document.createElement('input');
id.setAttribute('type','hidden');
cell.appendChild(id);
var unit_id = document.createElement('input');
unit_id.setAttribute('type','hidden');
unit_id.setAttribute('value',OPT['default_unit']);
cell.appendChild(unit_id);
var vat_id = document.createElement('input');
vat_id.setAttribute('type','hidden');
vat_id.setAttribute('value',OPT['default_vat']);
cell.appendChild(vat_id);
var category_id = document.createElement('input');
category_id.setAttribute('type','hidden');
category_id.setAttribute('value',OPT['default_category']);
cell.appendChild(category_id);
}
if(i == 2) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('textarea');
data.name = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('textarea');
if(data.name) cn[0].value = data.name;
}
var textarea = '<textarea tabindex="1" readonly="readonly" style="height:100%"; class="inputs"></textarea>';
cell.innerHTML = textarea;
}
if(i == 3) {
cell.getData = function(data,noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value);
if(tmp == -1) {
ERROR = true;
//if(!noAlert)
//alert(MOD['LBL_FORMAT_NUMBER_ERROR']+' ('+this.firstChild.value+')');
data.quantity = 0;
this.firstChild.style.color = 'red';
} else {
data.quantity = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
if(data.quantity) this.firstChild.value = NumberToUserFormatNumber(data.quantity); else this.firstChild.value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" style="text-align:right;" autocomplete="off" class="inputs" value="'+NumberToUserFormatNumber(1)+'">';
cell.innerHTML = edit;
}
if(i == 4) {
cell.getData = function(data,noAlert) {
data.unit_name = this.firstChild.value;
}
cell.setData = function(data) {
this.firstChild.value = data.unit_name;
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="">';
cell.innerHTML = edit;
}
if(i == 5) {
cell.getData = function(data,noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value);
if(tmp == -1) {
ERROR = true;
if(!noAlert)
alert(MOD['LBL_FORMAT_NUMBER_ERROR']+' ('+this.firstChild.value+')');
data.invoice_price = 0;
this.firstChild.style.color = 'red';
} else {
data.invoice_price = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
if(data.invoice_price) this.firstChild.value = NumberToUserFormatNumber(data.invoice_price); else this.firstChild.value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'">';
cell.innerHTML = edit;
}
if(i == 6) {
cell.getData = function(data,noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value);
if(tmp == -1) {
ERROR = true;
if(!noAlert)
alert(MOD['LBL_FORMAT_NUMBER_ERROR']+' ('+this.firstChild.value+')');
data.price = 0;
this.firstChild.style.color = 'red';
} else {
data.price = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
if(data.price) this.firstChild.value = NumberToUserFormatNumber(data.price); else this.firstChild.value = NumberToUserFormatNumber(0);
}
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'">';
cell.innerHTML = edit;
}
if(i == 7) {
cell.getData = function(data,noAlert) {
var cn = this.getElementsByTagName('input');
data.vat_value = cn[0].value;
data.vat_id = cn[1].value;
if(VAT[cn[1].value])data.vat_name = VAT[cn[1].value].name;
}
cell.setData = function(data) {
if(data.vat_value) this.getElementsByTagName('input')[0].value = data.vat_value;
if(data.vat_id) this.getElementsByTagName('input')[1].value = data.vat_id;
if(data.vat_name) this.getElementsByTagName('input')[2].value = data.vat_name;
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if(!ERROR) {
data.vat_id = data.vat_id;
this.setData(data);
}
}
var inp=document.createElement('input');
inp.setAttribute('type','hidden');
cell.appendChild(inp);
var inp=document.createElement('input');
inp.setAttribute('type','hidden');
cell.appendChild(inp);
var inp;
inp = document.createElement('input');
inp.setAttribute('type','text');
inp.className = 'inputs';
inp.style.textAlign = "right";
inp.cell = cell;
cell.appendChild(inp);
}
if(i == 8) {
cell.getData = function(data,noAlert) {
var tmp = UserFormatNumberToNumber(this.firstChild.value,'%');
if(tmp == -1) {
ERROR = true;
if(!noAlert)
alert(MOD['LBL_FORMAT_NUMBER_ERROR']+' ('+this.firstChild.value+')');
data.discount = 0;
this.firstChild.style.color = 'red';
} else {
data.discount = tmp;
this.firstChild.style.color = 'black';
}
}
cell.setData = function(data) {
if(data.discount) this.firstChild.value = NumberToUserFormatNumber(data.discount,'%'); else this.firstChild.value = NumberToUserFormatNumber(0,'%');
}
cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(0).select(); };
var edit = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0,'%')+'">';
cell.innerHTML = edit;
}
if(i == 9) {
//cell.select = function() { };
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.total = UserFormatNumberToNumber(cn[0].value);
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.total) cn[0].value = NumberToUserFormatNumber(data.total); else cn[0].value = NumberToUserFormatNumber(0);
}
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('value',NumberToUserFormatNumber(0));
edit.setAttribute('readOnly','readonly');
edit.className = 'inputs';
edit.style.textAlign = "right";
cell.appendChild(edit);
}
if(i == 10) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.weight_netto = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.weight_netto) cn[0].value = data.weight_netto;
}
var textarea = '<input type="text" readonly="readonly" tabindex="1" class="inputs" style="text-align:right;" autocomplete="off" value="'+NumberToUserFormatNumber(0)+'">';
cell.innerHTML = textarea;
}
if(i == 11) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('textarea');
data.part_no = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('textarea');
if(data.part_no) cn[0].value = data.part_no;
}
var textarea = '<textarea tabindex="1" readonly="readonly" style="height:100%"; class="inputs"></textarea>';
cell.innerHTML = textarea;
}
if(i == 12) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('textarea');
data.part_date = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('textarea');
if(data.part_date) cn[0].value = data.part_date;
}
var textarea = '<textarea tabindex="1" readonly="readonly" style="height:100%"; class="inputs"></textarea>';
cell.innerHTML = textarea;
}
if(i == 13) {
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.duty = UserFormatNumberToNumber(cn[2].value);
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if (data.duty) cn[2].value=data.duty+'%'; else cn[2]=UserFormatNumberToNumber(0)+'%';
}
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('value',MOD['LBL_EDITTABLE_NO_ADD_FIELDS']);
edit.setAttribute('readOnly','readonly');
edit.style.display='none';
if (OPT['kind']=='other') edit.style.display='inline';
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('value',MOD['LBL_EDITTABLE_DUTY']);
edit.setAttribute('readOnly','readonly');
edit.style.display='none';
if (OPT['kind']=='import') edit.style.display='inline';
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('value','');
edit.setAttribute('readOnly','readonly');
edit.style.display='none';
if (OPT['kind']=='import') edit.style.display='inline';
edit.className = 'inputs';
cell.appendChild(edit);
}
}
N.onSetCellData = function(row,cell,data) {
if(cell.innerHTML == '') cell.innerHTML = '&nbsp;';
}
var pl = document.getElementById('position_list').value;
if(pl && pl != '') {
try {
pl = eval(pl);
for(x in pl) { if(typeof(pl[x].code) != "undefined") { var pl_row = pl[x]; N.addRow().setData(pl_row); } }
} catch(err) { pl = null; };
}
if(N.rowCount() == 0) N.addRow();
calculateTotal = function() {
//calculatePurchasePrices();
var vats = new Object();
var subtotal = 0;
var total = 0;
//var cbm_total = 0;
for(var i=0; i<N.rowCount(); i++) {
var data = N.row(i).getData();
if(OPT.to_is_vat_free == 0) {
if(data.vat_id && data.name != '') {
if(typeof(vats[data.vat_id]) != "object") { vats[data.vat_id] = new Object(); vats[data.vat_id]['vat'] = 0;}
vats[data.vat_id]['vat'] += data.total;
}
}
subtotal += data.total;
//cbm_total += data.cbm;
}
total = subtotal;
var rt = document.getElementById('result_table');
for(var i=1; i<rt.rows.length-3; i++) { if(!vats[rt.rows.item(i).id]) { rt.deleteRow(i); --i; } else vats[rt.rows.item(i).id]['node'] = rt.rows.item(i); }
for(var x in vats) {
if(VAT[x]){
vats[x]['vat'] = vats[x]['vat']*(parseFloat(VAT[x].value)/100);
total += vats[x]['vat'];
var txL = MOD['LBL_VAT']+' ('+VAT[x].name+')';
var txF = NumberToUserFormatNumber(vats[x]['vat']);
}
if(vats[x]['node']) {
vats[x]['node'].id = x;
vats[x]['node'].cells.item(0).innerHTML = txL;
vats[x]['node'].cells.item(1).innerHTML = "<input type='text' readonly='readonly' style='border:0px;font-weight:900;width:100%;text-align:right;' value='"+txF+"'>";
} else {
rt.insertRow(1);
rt.rows.item(1).id = x;
rt.rows.item(1).insertCell(0);
rt.rows.item(1).cells.item(0).className = 'positionsLabel';
rt.rows.item(1).cells.item(0).innerHTML = txL;
rt.rows.item(1).insertCell(1);
rt.rows.item(1).cells.item(1).className = 'positionsField';
rt.rows.item(1).cells.item(1).innerHTML = "<input type='text' readonly='readonly' style='border:0px;font-weight:900;width:100%;text-align:right;' value='"+txF+"'>";
}
}
var total2 = total;
var discount;
// if((discount = CheckDiscount(true)) == -1) discount = 0;
//var discount2 = total2*discount/100;
//total = total2-discount2;
total = total2;
//discount2 = NumberToUserFormatNumber(discount2).toString();
total2 = ((OPT['type'] == "correct")?'-':'')+NumberToUserFormatNumber(total2).toString();
total = ((OPT['type'] == "correct")?'-':'')+NumberToUserFormatNumber(total).toString();
document.getElementById('subtotal').value = NumberToUserFormatNumber(subtotal);
if(document.getElementById('total_2')) document.getElementById('total_2').value = total2;
//rt.rows.item(rt.rows.length-2).cells.item(0).innerHTML = MOD['LBL_DISCOUNT']+' ('+NumberToUserFormatNumber(discount,'%')+')';
//document.getElementById('discount_2').value = discount2;
document.getElementById('total').value = total;
//document.getElementById('cbm_total').value = cbm_total;
}
calculateTotal();
cutc;
setPREVIEW = function() {
alert('tt');
var toolb=1;
if(STATUS=="registered")toolb=0;
if(SHOW_PDF_IN_DIV==1){
//HideLoadingView();
//SetTab('preview_PREVIEW');
EcmPreviewPDF('index.php?module=EcmStockDocIns&action=previewPDF&to_pdf=1&method=I&record='+document.forms.DetailView.record.value,{zoom:75,toolbar:toolb});
}
else{
//SetTab('panel_PREVIEW');
document.getElementById('previewPDF').innerHTML = '<iframe style="border:none;width:100%;height:1200px;" frameborder="no" src="index.php?module=EcmStockDocIns&action=previewPDF&to_pdf=1&method=I&record='+document.forms.DetailView.record.value+'#zoom=75&toolbar='+toolb+'">Yours browser not accept iframes!</iframe>';
}
}
if(!OPT.user.access.send_email)
setEMAIL = function() { alert(MOD['LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL']); };
else
setEMAIL = function(noCheck) {
SetTab('panel_EMAIL');
document.getElementById('emailTAB').innerHTML = '<iframe id="emailIFRAME" style="border:none;width:100%;height:670px;" frameborder="no" src="index.php?module=EcmStockDocIns&action=Emails&to_pdf=1&type=out&pTypeTo='+document.forms.DetailView.parent_type.value+'&pIdTo='+document.forms.DetailView.parent_id.value+'&pTypeFrom=Users&pIdFrom='+document.forms.DetailView.assigned_user_id.value+'&quote_id='+document.forms.DetailView.record.value+'&record='+document.forms.DetailView.email_id.value+'">Yours browser not accept iframes!</iframe>';
}
setInterval(function() {
doRequest('index.php',"module=EcmStockDocIns&action=subpanels&to_pdf=1&record="+document.forms.DetailView.record.value,
function(result) {
if(result != '') document.getElementById('subpanels_div').innerHTML = result;
}
);
},
10000
);
//quick view
var main = document.getElementById('main');
if(main) {
var h2 = main.getElementsByTagName('h2')[0];
if(h2) {
h2.style.display = 'inline';
var quickInfoH2 = document.getElementById('quickInfoH2');
if(quickInfoH2) { h2.parentNode.appendChild(quickInfoH2); quickInfoH2.style.display = ''; }
}
}
if(OPT['setTab'] && OPT['setTab'] != '') {
if(OPT['setTab'] == 'EMAIL') setEMAIL();
}
//setPREVIEW();
}
);

View File

@@ -0,0 +1,432 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
//require_once('modules/EcmGroupSales/HeaderMenu.php');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings;
require_once('modules/EcmStockDocIns/EcmStockDocIn.php');
require_once('modules/EcmStockDocIns/Forms.php');
require_once ('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$file = 'modules/EcmGroupSales/EcmGroupSale.php';
if(file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupSale::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'];
if($cc['checkbox_demo'] == 1) {
$query = "SELECT COUNT(id) as count FROM ecmstockdocins WHERE deleted='0'";
$result = $GLOBALS['db']->query($query);
if(is_resource($result)) {
$row = $GLOBALS['db']->fetchByAssoc($result);
if(isset($row['count']) && is_numeric($row['count']=intval($row['count'])) && $row['count'] >= 10) $OPT['checkbox_demo'] = 1;
}
}
//$OPT['default_manager_role_id'] = $cc['default_manager_role_id'];
//$OPT['default_representative_role_id'] = $cc['default_representative_role_id'];
//$OPT['default_representative_extra_role_id'] = $cc['default_representative_extra_role_id'];
$OPT['check_parent_id'] = true;
$cq = $current_user->getPreference('confirm_quotes');
$OPT['user']['confirm_quotes'] = ((isset($cq) && $cq)?1:0);
$focus = new EcmStockDocIn();
$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) {
echo 'You cannot edit this quote. This quote is accepted. <a href="index.php?module='.$_REQUEST['return_module'].'&action='.$_REQUEST['return_action'].'&record='.$_REQUEST['return_id'].'">return</a>';
return;
}
$focus->format_all_fields();
$focus->position_list = str_replace('&quot;','\"',$focus->getPositionList());
//settings status
if(!isset($focus->status) || $focus->status == '') $focus->status = 's10';
else
if($focus->status = 's40') $focus->status = 's10';
}
} else {
if(isset($_REQUEST['contact_id']) && $_REQUEST['contact_id'] != '' && isset($_REQUEST['contact_name']) && $_REQUEST['contact_name'] != '') {
$_REQUEST['parent_type'] = 'Contacts';
$_REQUEST['parent_name'] = $_REQUEST['contact_name'];
$_REQUEST['parent_id'] = $_REQUEST['contact_id'];
$OPT['check_parent_id'] = false;
}
if(isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '' && isset($_REQUEST['account_name']) && $_REQUEST['account_name'] != '') {
$_REQUEST['parent_type'] = 'Accounts';
$_REQUEST['parent_name'] = $_REQUEST['account_name'];
$_REQUEST['parent_id'] = $_REQUEST['account_id'];
$OPT['check_parent_id'] = false;
}
$OPT['new_number'] = true;
$focus->kind='other';
$focus->status = "s10";
if(isset($cc)) {
//payment condition
$cc_list = EcmGroupSale::getPositionList('ecmpaymentconditions');
$focus->ecmpaymentcondition_id = $cc['default_payment_condition'];
$focus->ecmpaymentcondition_name = $cc_list[$cc['default_payment_condition']];
//delivery condition
$cc_list = EcmGroupSale::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 access 'Delete' is avaible for user than he is Manager and he can confirm Quotes.
$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'] = "1";
$OPT['default_vat'] = "19.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,"EcmStockDocIns",$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']['EcmVendors']['header_text'])) $d['texts']['EcmVendors']['header_text'] = $mod_strings['LBL_DEFAULT_ECMVENDOR_HEADER_TEXT'];
if(!isset($d['texts']['EcmVendors']['footer_text'])) $d['texts']['EcmVendors']['footer_text'] = $mod_strings['LBL_DEFAULT_ECMVENDOR_FOOTER_TEXT'];
if(!isset($d['texts']['EcmVendors']['ads_text'])) $d['texts']['EcmVendors']['ads_text'] = $mod_strings['LBL_DEFAULT_ECMVENDOR_ADS_TEXT'];
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'];
}
$w=$GLOBALS['db']->query("select name,id,value from ecmvats where deleted='0' order by name");
$nvats=$w->num_rows;
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$VAT[$r['id']]=array(
"id"=>$r['id'],
"name"=>$r['name'],
"value"=>$r['value']
);
}
$show_pdf=$current_user->getPreference('show_pdf_in_div');
if(!isset($show_pdf)){
require_once('modules/EcmGroupSales/EcmGroupSale.php');
$cc = EcmGroupSale::loadSettings();
$show_pdf=$cc['show_pdf_in_div_global'];
}
$json = getJSONobj();
$scriptOpt = '<script language="javascript">
var SHOW_PDF_IN_DIV ='.$show_pdf.';
var NOOFVATS ='.$nvats.';
var UNIT ='.str_replace('&quot;','\"',$json->encode($GLOBALS['app_list_strings']['ecmproducts_unit_dom'])).';
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;
</script>';
$larr=array("en_us","pl_pl","ge_ge");
foreach($larr as $la){
$lv=return_app_list_strings_language($la);
$UNIT_LANG[$la]=$lv['ecmproducts_unit_dom'];
}
$scriptOpt.='<script language="javascript">
var UNIT_LANG='.str_replace('&quot;','\"',$json->encode($UNIT_LANG)).';
</script>';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmStockDocIns/views/EditView/view.edit.ecmstockdocins.php');
//for outside modules
if(isset($_REQUEST['out_module']) && $_REQUEST['out_module'] != '' && isset($_REQUEST['out_id']) && $_REQUEST['out_id'] != '') {
$outModule = $_REQUEST['out_module'];
$outId = $_REQUEST['out_id'];
$OPT['fromOutside'] = true;
$path = 'modules/'.$outModule.'/LoadEcmStockDocIns.php';
if(file_exists($path)) {
require_once($path);
$_REQUEST['record'] = '';
$outside_create = true;
$focus->out_module = $_REQUEST['out_module'];
$focus->out_id = $_REQUEST['out_id'];
}
}
$edit = new ViewEditEcmStockDocIns();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmStockDocIns';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/EditView/Tabs/EditView.tpl';
$edit->ss->assign("OPT",$OPT);
$edit->preDisplay();
if(isset($fftemplateid) && $fftemplateid != '') $focus->template_id = $fftemplateid;
$arr_template = $focus->getTemplateList();
$tt="";
$w=$GLOBALS['db']->query("select name,id,deleted,date_modified from ecmdocumenttemplates where deleted='0' or id='".$focus->template_id."'");
//echo $focus->template_id;
while($r=$GLOBALS['db']->fetchByAssoc($w)){
if($_REQUEST['record'] && $r['deleted']==1){
$tt.='<option value="'.$r['id'].'"';
if($r['id']==$focus->template_id)$tt.=' selected';
$tt.='>'.$r['name'].' till '.$r['date_modified'].'</option>';
}
elseif($r['deleted']==0){
$tt.='<option value="'.$r['id'].'"';
if($r['id']==$focus->template_id)$tt.=' selected';
$tt.='>'.$r['name'].'</option>';
}
}
$edit->ss->assign("DOCUMENT_TEMPLATES_OPTIONS", $tt);
$edit->ss->assign("POSITION_LIST",$focus->position_list);
if($cc['show_images_on_offers'] && $_REQUEST['record']=="")$c_sioo="checked";
if($focus->show_images_on_offers==1 && $_REQUEST['record'])$c_sioo="checked";
$edit->ss->assign("CHECKBOX_SHOW_IMAGES_ON_OFFERS",$c_sioo);
$edit->ss->assign("MFP",$focus->loadParserArray());
$stocks='<option value="">'.$GLOBALS['app_list_strings']['stock_select'].'</option>';
$w=$GLOBALS['db']->query("select name,id from ecmstocks where deleted='0' order by name asc");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$stocks.='<option value="'.$r['id'].'"';
if($r['id']==$focus->stock_id)$stocks.=' selected';
$stocks.='>'.$r['name'].'</option>';
}
$edit->ss->assign("STOCK",$stocks);
//add mz 2012-04-02
// kind on start
if ($focus->kind=='other') {
$edit->ss->assign("IMPORT", "display:none;");
}
if ($focus->kind=='import') {
$edit->ss->assign("IMPORT", "display:block;");
}
//import table
$import_table='<table>
<tr>
<td class="dataLabel">'.$mod_strings['LBL_FOREIGN_TRANSPORT_VAL'].'</td>
<td><input type="text" id="foreign_transport_val" name="foreign_transport_val" value="'.format_number($focus->foreign_transport_val).'"/></td>
<td class="dataLabel">'.$mod_strings['LBL_FOREIGN_TRANSPORT_CUR_ID'].'</td>
<td><select name="foreign_transport_cur_id" id="foreign_transport_cur_id"/>';
foreach ($app_list_strings['currency_dom'] as $k=>$v){
$import_table.='<option value="'.$k.'"';
if ($k==$focus->foreign_transport_cur_id) $import_table.=' selected';
$import_table.='>'.$v.'</option>';
}
$import_table.='</select></td>
<td><input type="text" id="foreign_transport_cur_val" name="foreign_transport_cur_val" value="'.$focus->foreign_transport_cur_val.'"/></td>
<td></td>
</tr>
<tr>
<td class="dataLabel">'.$mod_strings['LBL_COUNTRY_TRANSPORT_VAL'].'</td>
<td><input type="text" id="country_transport_val" name="country_transport_val" value="'.format_number($focus->country_transport_val).'"/></td>
<td class="dataLabel">'.$mod_strings['LBL_COUNTRY_TRANSPORT_CUR_ID'].'</td>
<td><select name="country_transport_cur_id" id="country_transport_cur_id"/>';
foreach ($app_list_strings['currency_dom'] as $k=>$v) {
$import_table.='<option value="'.$k.'"';
if ($k==$focus->country_transport_cur_id) $import_table.=' selected';
$import_table.='>'.$v.'</option>';
}
$import_table.='</select></td>
<td><input type="text" id="country_transport_cur_val" name="country_transport_cur_val" value="'.$focus->country_transport_cur_val.'"/></td>
<td></td>
</tr>
<tr>
<td class="dataLabel">'.$mod_strings['LBL_ADDITION_COST_VAL'].'</td>
<td><input type="text" id="addition_cost_val" name="addition_cost_val" value="'.format_number($focus->addition_cost_val).'"/></td>
<td class="dataLabel">'.$mod_strings['LBL_ADDITION_COST_CUR_ID'].'</td>
<td><select name="addition_cost_cur_id" id="addition_cost_cur_id"/>';
foreach ($app_list_strings['currency_dom'] as $k=>$v) {
$import_table.='<option value="'.$k.'"';
if ($k==$focus->addition_cost_cur_id) $import_table.=' selected';
$import_table.='>'.$v.'</option>';
}
$import_table.='</select></td>
<td><input type="text" id="addition_cost_cur_val" name="addition_cost_cur_val" value="'.$focus->addition_cost_cur_val.'"/></td>
<td></td>
</tr>
<tr>
<td class="dataLabel">'.$mod_strings['LBL_CURRENCY_ID'].'</td>
<td><select name="currency_id" id="currency_id"/>';
foreach ($app_list_strings['currency_dom'] as $k=>$v) {
$import_table.='<option value="'.$k.'"';
if ($k==$focus->currency_id) $import_table.=' selected';
$import_table.='>'.$v.'</option>';
}
$import_table.='</select></td>
<td class="dataLabel">'.$mod_strings['LBL_CURRENCY_VALUE'].'</td>
<td><input type="text" id="currency_value" name="currency_value" value="'.format_number($focus->currency_value,4,4).'"/></td>
<td class="dataLabel">'.$mod_strings['LBL_CURRENCY_SAD_VALUE'].'</td>
<td><input type="text" id="currency_sad_value" name="currency_sad_value" value="'.format_number($focus->currency_sad_value,4,4).'"/></td>
</tr>
</table>
';
$edit->ss->assign("IMPORT_TABLE",$import_table);
//end mz
/*
$_REQUEST['type'] = 'out';
$_REQUEST['parent_id'] = (isset($focus->id) && $focus->id != '')? $focus->id : '';
$_REQUEST['parent_type'] = 'EcmStockDocIns';
$_REQUEST['record'] = '';
$ob = '';
ob_start();
require_once('modules/EcmStockDocIns/Emails.php');
$ob = ob_get_contents();
ob_end_clean();
$mod_strings = return_module_language($current_language, 'EcmStockDocIns');
$edit->ss->assign("EMAILS",$ob);
*/
echo $edit->display();
if($_REQUEST['out_id']){
echo '<script language="javascript">
document.getElementById("parent_id").value="'.$source->parent_id.'";
setTimeout(function(){
document.getElementById("contact_id").value="'.$source->contact_id.'";
document.getElementById("contact_name").value="'.$source->contact_name.'";
},1500);
</script>';
}
/*
echo '<div id="subpanels">';
require_once('subpanels.php');
echo '</div>';
*/
?>

1018
modules/EcmStockDocIns/Email.js Executable 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=EcmStockDocIns&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/EcmStockDocIns/EcmStockDocIn.php');
$off = new EcmStockDocIn();
$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 ecmstockdocins 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/EcmStockDocIns/EcmStockDocIn.php');
$off = new EcmStockDocIn();
$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=EcmStockDocIns&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/EcmStockDocIns/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=EcmStockDocIns&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="EcmStockDocIns";
document.forms.EditView.action.value="EmailSave";
document.forms.EditView.type.value="save_template_changes";
}
function saveTemplateAsNew() {
document.forms.EditView.module.value="EcmStockDocIns";
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="EcmStockDocIns" />
<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 -->

889
modules/EcmStockDocIns/Emails.php Executable file
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/EcmStockDocIns/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/EcmStockDocIns/EcmStockDocIn.php');
$m = new EcmStockDocIn();
$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('statusListEcmStockDocIn_'+obj['record']);
if(status) status.innerHTML = obj['status']['image'];
if(obj['list_images']) {
var list_images = document.getElementById('optionsListEcmStockDocIn_'+obj['record']);
if(list_images && list_images.parentNode) list_images.parentNode.innerHTML = obj['list_images'];
}
}
}
},
failure: function() {}
},
'module=EcmStockDocIns&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('statusListEcmStockDocIn_'+record);
if(statusSpan) {
var XY = YAHOO.util.Dom.getXY(statusSpan);
div.style.left = XY[0]+statusSpan.offsetWidth;
div.style.top = XY[1];
if(typeof(EcmStockDocInsStatusMenu) == "object") {
var html = '';
for(x in EcmStockDocInsStatusMenu) {
html += EcmStockDocInsStatusMenu[x]['enabled'];
}
div.innerHTML = html;
}
}
}
}
function list_hideStatusMenu(record) {
alert('hide');
}
YAHOO.util.Event.addListener(
window,
"load",
function() {
//alert(EcmStockDocInsStatusMenu);
}
);

View File

@@ -0,0 +1,40 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once('modules/EcmStockDocIns/EcmStockDocIn.php');
require_once('modules/EcmStockDocIns/Forms.php');
require_once ('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$focus = new EcmStockDocIn();
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
}
else {}
require_once('include/MVC/View/SugarView.php');
if(file_exists('modules/EcmStockDocIns/views/view.list.php')) {
require_once('modules/EcmStockDocIns/views/view.list.php');
$list = new EcmStockDocInsViewList();
}
else {
require_once('include/MVC/View/views/view.list.php');
$list = new ViewList();
}
$list->bean = $focus;
$list->module='EcmStockDocIns';
// if(!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != "true") require_once('modules/EcmGroupSales/HeaderMenu.php');
$list->preDisplay();
$list->display();
?>

View File

@@ -0,0 +1,45 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('modules/EcmStockDocIns/EcmStockDocIn.php');
$source = new EcmStockDocIn();
$source->retrieve($outId);
if(isset($source->id) && $source->id != '') {
$focus->name = $source->name;
$focus->position_list = str_replace('&quot;','\"',$source->getPositionList());
$focus->template_id = $source->template_id;
$focus->template_name = $source->template_name;
$focus->total = $source->total;
$focus->subtotal = $source->subtotal;
$focus->parent_type = $source->parent_type;
$focus->parent_id = $source->parent_id;
$focus->parent_name = $source->parent_name;
$focus->contact_id = $source->contact_id;
$focus->contact_name = $source->contact_name;
$focus->type = 'normal';
$focus->parent_address_street = $source->parent_address_street;
$focus->parent_address_postalcode = $source->parent_address_postalcode;
$focus->parent_address_city = $source->parent_address_city;
$focus->parent_address_country = $source->parent_address_country;
$focus->to_nip = $source->to_nip;
$focus->to_vatid = $source->to_vatid;
$focus->to_is_vat_free = $source->to_is_vat_free;
$focus->ecmlanguage = $source->ecmlanguage;
$focus->ecmpaymentcondition_id = $source->ecmpaymentcondition_id;
$focus->ecmpaymentcondition_name = $source->ecmpaymentcondition_name;
$focus->ecmpaymentcondition_text = $source->ecmpaymentcondition_text;
$focus->header_text = str_replace('$quote_','$invoiceout_',$source->header_text);
$focus->footer_text = str_replace('$quote_','$invoiceout_',$source->footer_text);
$focus->ads_text = str_replace('$quote_','$invoiceout_',$source->ads_text);
}
?>

View File

@@ -0,0 +1,48 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('modules/EcmStockDocIns/EcmStockDocIn.php');
$source = new EcmStockDocIn();
$source->retrieve($outId);
if(isset($source->id) && $source->id != '') {
$focus->name = $source->name;
$focus->position_list = str_replace('&quot;','\"',$source->getPositionList());
$focus->template_id = $source->template_id;
$focus->template_name = $source->template_name;
$focus->total = $source->total;
$focus->subtotal = $source->subtotal;
$focus->parent_type = $source->parent_type;
$focus->parent_id = $source->parent_id;
$focus->parent_name = $source->parent_name;
$focus->contact_id = $source->contact_id;
$focus->contact_name = $source->contact_name;
$focus->type = 'normal';
$focus->parent_address_street = $source->parent_address_street;
$focus->parent_address_postalcode = $source->parent_address_postalcode;
$focus->parent_address_city = $source->parent_address_city;
$focus->parent_address_country = $source->parent_address_country;
$focus->to_nip = $source->to_nip;
$focus->to_vatid = $source->to_vatid;
$focus->to_is_vat_free = $source->to_is_vat_free;
$focus->ecmlanguage = $source->ecmlanguage;
$focus->ecmpaymentcondition_id = $source->ecmpaymentcondition_id;
$focus->ecmpaymentcondition_name = $source->ecmpaymentcondition_name;
$focus->ecmpaymentcondition_text = $source->ecmpaymentcondition_text;
$focus->ecmdeliverycondition_id = $source->ecmdeliverycondition_id;
$focus->ecmdeliverycondition_name = $source->ecmdeliverycondition_name;
$focus->ecmdeliverycondition_text = $source->ecmdeliverycondition_text;
$focus->header_text = str_replace('$quote_','$sale_',$source->header_text);
$focus->footer_text = str_replace('$quote_','$sale_',$source->footer_text);
$focus->ads_text = str_replace('$quote_','$sale_',$source->ads_text);
$focus->status = "s10";
}
?>

122
modules/EcmStockDocIns/Menu.php Executable file
View File

@@ -0,0 +1,122 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*****************************************************************************
* The contents of this file are subject to the RECIPROCAL PUBLIC LICENSE
* Version 1.1 ("License"); You may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/rpl.php. Software distributed under the
* License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
* either express or implied.
*
* You may:
* a) Use and distribute this code exactly as you received without payment or
* a royalty or other fee.
* b) Create extensions for this code, provided that you make the extensions
* publicly available and document your modifications clearly.
* c) Charge for a fee for warranty or support or for accepting liability
* obligations for your customers.
*
* You may NOT:
* a) Charge for the use of the original code or extensions, including in
* electronic distribution models, such as ASP (Application Service
* Provider).
* b) Charge for the original source code or your extensions other than a
* nominal fee to cover distribution costs where such distribution
* involves PHYSICAL media.
* c) Modify or delete any pre-existing copyright notices, change notices,
* or License text in the Licensed Software
* d) Assert any patent claims against the Licensor or Contributors, or
* which would in any way restrict the ability of any third party to use the
* Licensed Software.
*
* You must:
* a) Document any modifications you make to this code including the nature of
* the change, the authors of the change, and the date of the change.
* b) Make the source code for any extensions you deploy available via an
* Electronic Distribution Mechanism such as FTP or HTTP download.
* c) Notify the licensor of the availability of source code to your extensions
* and include instructions on how to acquire the source code and updates.
* d) Grant Licensor a world-wide, non-exclusive, royalty-free license to use,
* reproduce, perform, modify, sublicense, and distribute your extensions.
*
* The Original Code is: CommuniCore
* Olavo Farias
* 2006-04-7 olavo.farias@gmail.com
*
* The Initial Developer of the Original Code is CommuniCore.
* Portions created by CommuniCore are Copyright (C) 2005 CommuniCore Ltda
* All Rights Reserved.
********************************************************************************/
// require_once('modules/EcmGroupSales/Menu.php');
global $mod_strings, $current_user;
/*
if(ACLController::checkAccess('EcmStockDocIns', "edit", true)) $module_menu [] = Array("index.php?module=".'EcmStockDocIns'."&action=EditView&return_module=".'EcmStockDocIns'."&return_action=DetailView", $mod_strings['LNK_NEW_'.'ECMSTOCKDOCIN'],"CreateEcmStockDocIns", 'EcmStockDocIns');
if(ACLController::checkAccess('EcmStockDocIns', 'list', true))
$module_menu [] = Array("index.php?module=".'EcmStockDocIns'."&action=index&return_module=".'EcmStockDocIns'."&return_action=DetailView", $mod_strings['LNK_'.'ECMSTOCKDOCINS'.'_LIST'],"EcmStockDocIns", 'EcmStockDocIns');
*/
if(ACLController::checkAccess('EcmStockDocIns', "edit", true)) $module_menu [] = Array("index.php?module=".'EcmStockDocIns'."&action=EditView&return_module=".'EcmStockDocIns'."&return_action=DetailView", translate('LNK_NEW_'.'ECMSTOCKDOCIN', 'EcmStockDocIns'),"CreateEcmStockDocIns", 'EcmStockDocIns');
if(ACLController::checkAccess('EcmStockDocIns', "list", true)) $module_menu [] = Array("index.php?module=EcmStockDocIns&action=index&return_module=EcmStockDocIns&return_action=DetailView", translate('LNK_ECMSTOCKDOCINS_LIST','EcmStockDocIns'),"EcmStockDocIns", 'EcmStockDocIns');
if(ACLController::checkAccess('EcmStockDocIns', 'list', true) && is_admin($current_user))
$module_menu [] = Array("index.php?module=EcmStockDocIns&action=PDFLanguages&return_module=EcmStockDocIns&return_action=index", $mod_strings['LNK_ECMSTOCKDOCINS_PDFLANGUAGES'], "PDFlanguages", 'EcmStockDocIns');
?>

View File

@@ -0,0 +1,223 @@
<?php
class ModuleFieldsParser {
var $modules;
var $name;
function ModuleFieldsParser($name = 'mfp') {
$this->modules = Array();
if(file_exists('modules/EcmStockDocIns/ModuleFieldsParser/config.php')) {
require_once('modules/EcmStockDocIns/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(
'EcmStockDocIns' => array(
'name' => $app_list_strings['moduleList']['EcmStockDocIns'],
'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' => ''
),
);
?>

2280
modules/EcmStockDocIns/MyTable.js Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
<?php
$PDFLabelList = array (
'LBL_PDF_LIST_POSITION',
'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_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_DOCUMENT_NAME_CORRECT',
'LBL_PDF_CORRECT_TO',
'LBL_PDF_CODE',
'LBL_PDF_CODE_CORRECT',
'LBL_PDF_FILENAME',
);
?>

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/EcmStockDocIns/PDFLanguagesMT.js"></script>
<link rel="stylesheet" type="text/css" href="modules/EcmStockDocIns/MyTable.css" />
<script type="text/javascript" src="modules/EcmStockDocIns/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="EcmStockDocIns">
<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} <input type="hidden" id="header_parent" value="Accounts">
</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} <input type="hidden" id="footer_parent" value="Accounts">
</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} <input type="hidden" id="ads_parent" value="Accounts">
</td></tr></table>
<textarea id="ads_text" name="ads_text" rows="5" style="width:80%;">{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=EcmStockDocIns&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,169 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
global $current_user;
if(!is_admin($current_user)) {
ACLController::displayNoAccess();
return;
}
//require_once('modules/EcmGroupSales/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/EcmStockDocIns/EcmStockDocIn.php');
require_once('modules/EcmTexts/EcmText.php');
require_once ('include/time.php');
global $theme;
$theme_path = "themes/".$theme."/";
$image_path = $theme_path."images/";
require_once ($theme_path.'layout_utils.php');
$xtpl = new XTemplate ('modules/EcmStockDocIns/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/EcmStockDocIns/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,"EcmStockDocIns",$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']['EcmVendors']['header_text'])) $d['texts']['EcmVendors']['header_text'] = $mod_strings['LBL_DEFAULT_ECMVENDOR_HEADER_TEXT'];
if(!isset($d['texts']['EcmVendors']['footer_text'])) $d['texts']['EcmVendors']['footer_text'] = $mod_strings['LBL_DEFAULT_ECMVENDOR_FOOTER_TEXT'];
if(!isset($d['texts']['EcmVendors']['ads_text'])) $d['texts']['EcmVendors']['ads_text'] = $mod_strings['LBL_DEFAULT_ECMVENDOR_ADS_TEXT'];
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", EcmStockDocIn::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/EcmStockDocIns/EcmStockDocIn.php');
$ecmstockdocin = new EcmStockDocIn();
$xtpl->assign("MFP",$ecmstockdocin->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['ecmstockdocins_parent_dom'],''));
echo "\n<p>\n";
echo get_module_title('EcmStockDocIns', $GLOBALS['mod_strings']['LBL_ECMSTOCKDOCINS_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,371 @@
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) //,
|| (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); }
}

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,'EcmStockDocIns',$key,$pdfll[$key]);
}
echo 'Saved';
}
?>

231
modules/EcmStockDocIns/Save.php Executable file
View File

@@ -0,0 +1,231 @@
<?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 = array(); $i=0; while(isset($_POST['p_'.$i])) { $pll[] = $json->decode(htmlspecialchars_decode($_POST['p_'.$i])); $_POST['p_'.$i] = ''; $i++;}
$_POST = $json->decode(htmlspecialchars_decode($_POST['otherFormData']));
$_POST['position_list'] = $pll;
require_once("modules/EcmStockDocIns/EcmStockDocIn.php");
require_once('include/formbase.php');
$focus = new EcmStockDocIn();
if(isset($_POST['record']) && $_POST['record'] != '') {
$focus->retrieve($_POST['record']);
}
if(isset($focus->id) && $focus->id != ''){
$_POST['email_id'] = $focus->email_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;
}else{
$check_notify = FALSE;
}
*/
$check_notify = FALSE;
/*
$json = getJSONobj();
$wi = $json->decode(htmlspecialchars_decode($_POST['work_items']));
$focus->work_items = $wi;
*/
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;
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name from ecmstocks where id='".$focus->stock_id."'"));
$focus->stock_name=$r['name'];
$json = getJSONobj();
$pl = $_POST['position_list'];
$focus->position_list = $pl;
$focus->save($check_notify);
$return_id = $focus->id;
if ($focus->out_module == 'EcmPurchaseOrders') {
$db = $GLOBALS['db'];
$db->query("UPDATE ecmpurchaseorders SET status='deliver' WHERE id='".$focus->out_id."';");
}
echo $return_id;
//header("Location: index.php?module=EcmStockDocIns&action=index");
//handleRedirect($return_id,'EcmStockDocIns');
?>

View File

@@ -0,0 +1,78 @@
<?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/EcmStockDocIns/EcmStockDocIn.php");
require_once('include/formbase.php');
$focus = new EcmStockDocIn();
$focus->retrieve($_GET['correct_id']);
$n=new EcmStockDocIn();
$arr=array("name","desciption","parent_id","type","status","register_date","validtill_date","parent_contact_name","parent_contact_title","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","contact_id","accepted","email_id","order_origin","show_images_on_offers","stock_id","pdflanguages","assigned_user_id");
foreach($arr as $f){
$n->$f=$focus->$f;
}
$n->position_list=$focus->getPositionList(true);
$n->type="1";
$n->correct_id=$_GET['correct_id'];
$return_id=$n->saveCorrect();
$ww=$GLOBALS['db']->query("select id from ecmstockdocinitems where ecmstockdocin_id='".$_GET['correct_id']."' and deleted='0'");
while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
$w=$GLOBALS['db']->query("select * from ecmstockoperations where parent_type='EcmStockDocIns' and parent_id='".$_GET['correct_id']."' and documentitem_id='".$rr['id']."'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$focus->addProductToStockOut($r['id'],$r['product_id'],$r['quantity'],$r['price'],date("Y-m-d H:i:s"),$return_id,$n->stock_id,$rr['id']);
}
}
header("Location: index.php?module=EcmStockDocIns&action=DetailView&record=".$return_id);
?>

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/EcmStockDocIns/EcmStockDocIn.php');
$arr = EcmStockDocIn::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,155 @@
<?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['EcmStockDocIn'] = 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_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',
'stock_id',
'stock_name',
'po_id',
'parent_name_copy',
'parent_contact_name',
'parent_contact_title',
'pdflanguages',
'correct_id',
'correct_name',
),
'list_fields' => Array (
'number',
'document_no',
'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',
'stock_id',
'stock_name',
'po_id',
'parent_name_copy',
'parent_contact_name',
'parent_contact_title',
'pdflanguages',
'correct_id',
'correct_name',
),
'required_fields' => array (
'number' => 1
),
);
?>

View File

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

View File

@@ -0,0 +1,335 @@
<?php
$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;
//alert(doc.forms.DetailView);
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,25 @@
<?php
require_once('modules/EcmStockDocIns/EcmStockDocIn.php');
$focus = new EcmStockDocIn();
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,13 @@
<?php
//print_r($_SESSION);
global $current_user;
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*
$w=$GLOBALS['db']->query("select * from user_preferences where assigned_user_id='1' and category='global'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$a=unserialize(base64_decode($r['contents']));
print $r['category']." ".print_r($a)."<br><br><br><br><br><br><br><br><br><br>";
}*/
require_once('modules/EcmStockDocIns/ListView.php');
?>

View File

@@ -0,0 +1,482 @@
<?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.
********************************************************************************/
$mod_strings = array (
//add mz 2012-04-02
'BTN_CALCULATE_PURCHASE_PRICE' => 'Calculate purchase prices',
'LBL_EDITTABLE_WEIGHT_NETTO' => 'Weight netto',
'LBL_EDITTABLE_DUTY' => 'Duty',
'LBL_EDITTABLE_ADD_FIELDS' => 'Additional fields',
'LBL_EDITTABLE_NO_ADD_FIELDS' => 'No additional fields',
'LBL_EDITTABLE_INVOICE_PRICE' => 'Invoice price',
'LBL_KIND' => 'Document kind',
'LBL_CURRENCY_VALUE' => 'Exchange',
'LBL_CURRENCY_SAD_VALUE' => 'SAD exchange',
'LBL_CURRENCY_ID' => 'Currency',
'LBL_FOREIGN_TRANSPORT_VAL'=>'Foreign transport:',
'LBL_FOREIGN_TRANSPORT_CUR_ID'=>'currency / exchange',
'LBL_FOREIGN_TRANSPORT_CUR_VAL'=>'',
'LBL_COUNTRY_TRANSPORT_VAL'=>'Country transport:',
'LBL_COUNTRY_TRANSPORT_CUR_ID'=>'currency / exchange',
'LBL_COUNTRY_TRANSPORT_CUR_VAL'=>'',
'LBL_ADDITION_COST_VAL'=>'Addition cost:',
'LBL_ADDITION_COST_CUR_ID'=>'currency / exchange',
'LBL_ADDITION_COST_CUR_VAL'=>'',
//end mz
//added 06.08.2009
'LBL_CURRENCY'=>'Currency',
//added 20.07.2009
'LBL_CORRECT_TITLE'=>'Create Correct',
'LBL_CORRECT'=>'Create Correct',
//added 15.07.2009
'LBL_EDITTABLE_UNIT'=>'Unit',
//added 08.07.2009
'LBL_TYPE_CORRECT'=>'Correct',
'LBL_TYPE_NORMAL'=>'Normal',
'LBL_TYPE'=>'Type',
//added 27.05.2009
'LBL_PDF_CORRECT_TO' => 'Correct to',
'LBL_ECMSTOCKDOCINS_SUBPANEL_TITLE'=>'Related Correct Document',
'LBL_CORRECT_BUTTON_TITLE'=>'Create Correct Document',
'LBL_CORRECT_BUTTON_KEY'=>'',
'LBL_CORRECT_BUTTON_LABEL'=>'Create Correct Document',
'LBL_CORRECT_CONFIRMATION'=>'Are you sure you want to create correct to this document?',
//added 18.02.2009
'LBL_DEFAULT_ECMVENDOR_HEADER_TEXT' => 'Witaj $vendor_name!',
'LBL_DEFAULT_ECMVENDOR_FOOTER_TEXT' => 'Tekst pod tabelka dla Vendora',
'LBL_DEFAULT_ECMVENDOR_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Vendora',
//added 13.02.2009
'LBL_ECMSTOCKDOCOUTS_SUBPANEL_TITLE' => 'WZ Documents',
'LBL_ECMDELIVERYNOTES_SUBPANEL_TITLE' => 'Delivery Notes',
'LBL_ECMINVOICEOUTS_SUBPANEL_TITLE' => 'Invoices',
//added 12.02.2009
'LBL_STOCK_NAME' => 'Inventory',
'LBL_STOCK_ID' => 'Inventory',
//added 09.02.2009
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Show images',
'LBL_PDF_LIST_POSITION' => 'Image',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'PZ Documents',
'LBL_MODULE_TITLE' => 'PZ Documents: Home',
'LBL_MODULE_ID' => 'EcmStockDocIns',
'LBL_SEARCH_FORM_TITLE' => 'PZ Documents Search',
'LBL_LIST_FORM_TITLE' => 'PZ Documents List',
'LBL_NEW_FORM_TITLE' => 'New PZ Document',
'LBL_DETAILS' => 'PZ Document details:',
'LBL_ITEMS' => 'Items included:',
'LBL_TEXTS' => 'Texts to PDF:',
'LBL_PREVIEW' => 'Preview PDF:',
'LBL_EMAIL' => 'Create Email:',
'LBL_TO_INFORMATIONS' => 'To Informations:',
'LBL_DETAILS_TAB' => 'Details',
'LBL_ITEMS_TAB' => 'Items',
'LBL_TEXTS_TAB' => 'Texts',
'LBL_PREVIEW_TAB' => 'Preview',
'LBL_EMAIL_TAB' => 'Email',
'LBL_ID' => 'Id',
'LBL_NAME' => 'Name',
'LBL_DESCRIPTION' => 'Description',
'LBL_DATE_ENTERED' => 'Date Entered',
'LBL_DATE_MODIFIED' => 'Date Modified',
'LBL_MODIFIED' => 'Last Modified',
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
'LBL_ASSIGNED_TO' => 'Assigned To',
'LBL_CREATED' => 'Created by',
'LBL_CREATED_BY_USER' => 'Created by',
'LBL_MODIFIED_BY_USER' => 'Modified by',
'LBL_ASSIGNED_TO_USER' => 'Assigned To',
'LBL_DELETED_BY' => 'Deleted by',
'LBL_NUMBER' => 'Number',
'LBL_DOCUMENT_NO' => 'Number',
'LBL_PARENT' => 'To',
'LBL_PARENT_NAME' => 'Account',
'LBL_PARENT_ID' => 'Account Id',
'LBL_TYPE' => 'Type',
'LBL_ECMSTOCKDOCIN_ID' => 'PZ Document Id',
'LBL_ECMSTOCKDOCIN_NAME' => 'PZ Document Name',
'LBL_STATUS' => 'Status',
'LBL_REGISTER_DATE' => 'Document Date',
'LBL_SELL_DATE' => 'Sell Date',
'LBL_PAYMENT_DATE' => 'Payment Date',
'LBL_DATA_FK'=>'Invoice Date',
'LBL_PARENT_ADDRESS_STREET' => 'Street',
'LBL_PARENT_ADDRESS_CITY' => 'Postalcode / City',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Postalcode',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Country',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TO_IS_VAT_FREE' => 'Is VAT Free?',
'LBL_HEADER_TEXT' => 'Header Text',
'LBL_FOOTER_TEXT' => 'Footer Text',
'LBL_ADS_TEXT' => 'Ads Text',
'LBL_SUBTOTAL' => 'Subtotal',
'LBL_TOTAL' => 'Total',
'LBL_DISCOUNT' => 'Discount',
'LBL_VAT' => 'VAT',
'LBL_ACCEPTED' => 'Accepted',
'LBL_TEMPLATE_ID' => 'Template Id',
'LBL_TEMPLATE_NAME' => 'Template',
'LBL_PAYMENTCONDITION_NAME' => 'Payment Condition',
'LBL_PAYMENTCONDITION_ID' => 'Payment Condition ID',
'LBL_DELIVERYCONDITION_NAME' => 'Delivery Condition',
'LBL_DELIVERYCONDITION_ID' => 'Delivery Condition ID',
'LBL_FORMAT_NUMBER_ERROR' => 'Format Number Error!',
'LBL_SAVE_FORM_ERROR' => 'There are some errors on items list or in form!',
'LBL_DISCOUNT_ERROR' => 'Discount Format Number Error',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_CODE' => 'Code',
'LBL_EDITTABLE_NAME' => 'Name',
'LBL_EDITTABLE_QUANTITY' => 'Quant',
'LBL_EDITTABLE_PRICE' => 'Price',
'LBL_EDITTABLE_VAT' => 'VAT',
'LBL_EDITTABLE_DISCOUNT' => 'Discount',
'LBL_EDITTABLE_TOTAL' => 'Total',
'LBL_EDITTABLE_OPTIONS' => 'Opt',
'LBL_MOVE_ROW_UP' => 'Move Up',
'LBL_MOVE_ROW_DOWN' => 'Move Down',
'LBL_INSERT_NEW_ROW' => 'Insert new row',
'LBL_DELETE_ROW' => 'Delete row',
'LBL_VALIDTILL_DATE' => 'Valid Till',
// FOR MENU LINKS
'LNK_NEW_ECMSTOCKDOCIN' => 'Create PZ Document',
'LNK_ECMSTOCKDOCINS_LIST' => 'PZ Documents List',
'LBL_IMG_SEARCH' => 'Search',
'LBL_IMG_NEW' => 'New, add to base',
'LBL_IMG_EDIT' => 'Edit',
'LBL_CONFIRM_QUESTION' => 'Are you sure you want to make inventory operations?',
'LBL_QUOTE_PDF' => 'Show PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Show PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Show PZ Document 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_SALE' => 'Create Sales Order',
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Create Sales Order [Alt+O]',
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Create Sales Order.',
'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 PZ Document To Confirm.',
'LBL_LIST_TO_INVOICE' => 'Create Invoice.',
'LBL_LIST_TO_SALE' => 'Create Sales Order.',
//buttons
'LBL_SEND_BUTTON_TITLE' => 'Save & Send [Alt+D]',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Save & Send',
'LBL_REPAIR_BUTTON_TITLE' => 'Repair [Alt+R]',
'LBL_REPAIR_BUTTON_KEY' => 'R',
'LBL_REPAIR_BUTTON_LABEL' => 'Repair',
'LBL_ACCEPT_BUTTON_TITLE' => 'Accept [Alt+Z]',
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
'LBL_ACCEPT_BUTTON_LABEL' => 'Accept',
'LBL_REJECT_BUTTON_TITLE' => 'Reject [Alt+R]',
'LBL_REJECT_BUTTON_KEY' => 'R',
'LBL_REJECT_BUTTON_LABEL' => 'Reject',
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Go to pz documents list [Alt+G]',
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Go to list',
'LBL_SENDEMAIL_BUTTON' => 'Send Email',
'LBL_NOT_SAVED' => 'PZ Document not saved. Please check all fields are correct!',
'LBL_SAVED' => 'PZ Document saved successfully.',
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Przychód zewnętrzny dla $account_name.',
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notes',
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emails',
'LBL_DASHLET_MY_ECMSTOCKDOCINS' => 'PZ Documents',
'LBL_PDF_LIST_POSITION' => 'Poz.',
'LBL_PDF_LIST_QUANTITY' => 'Ilosc',
'LBL_PDF_LIST_UNIT' => '',
'LBL_PDF_LIST_DESCRIPTION' => 'Opis',
'LBL_PDF_LIST_PRICE' => 'Cena',
'LBL_PDF_LIST_DISCOUNT' => 'Rabat',
'LBL_PDF_LIST_VAT' => 'VAT',
'LBL_PDF_LIST_TOTAL' => 'Suma',
'LBL_PDF_TOTAL' => 'Suma',
'LBL_PDF_DISCOUNT' => 'RABAT',
'LBL_PDF_END_TOTAL' => 'Suma koncowa',
'LBL_PDF_VAT' => 'VAT',
'LBL_PDF_VATID' => 'VAT-ID',
'LBL_PDF_NUMBER' => 'Numer',
'LBL_PDF_DATE_REGISTER' => 'Data wystawienia',
'LBL_PDF_VALIDTILL_DATE' => 'Waznosc oferty',
'LBL_PDF_OWNER' => 'Wystawil',
'LBL_PDF_DOCUMENT_NAME' => 'Przychód Zewnętrzny',
'LBL_PDF_DOCUMENT_NAME_CORRECT' => 'Korekta przychodu zewnętrznego',
'LBL_PDF_FILENAME' => 'PZ_Document_',
'LBL_PDF_CODE' => 'PZ',
'LNK_ECMSTOCKDOCINS_PDFLANGUAGES' => 'PDF Settings',
'LBL_ECMLANGUAGE' => 'Language',
'LBL_ECMSTOCKDOCINS_PDFLANGUAGES_TITLE' => 'PDF Languages Settings',
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this PZ Document is not accepted by Manager!",
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending PZ Document to confirm error! Refresh site and try again.",
'LBL_STATUS_s10_SET_MESSAGE' => "PZ Document status is set.",
'LBL_STATUS_s20_SET_MESSAGE' => "Now PZ Document is waiting for confimations.",
'LBL_STATUS_s30_SET_MESSAGE' => "PZ Document is confirmed.",
'LBL_STATUS_s40_SET_MESSAGE' => "PZ Document status is set.",
'LBL_STATUS_s20_FAIL_MESSAGE' => "Sending PZ Document to confirm error! Refresh site and try again.",
'LBL_LIST_SEND_TO_CONFIRM' => 'Send To Confirm',
'LBL_LIST_DUPLICATE' => 'Duplicate',
'LBL_LIST_PREVIEW_PDF' => 'Preview PZ Document',
'LBL_LIST_REJECT' => 'Reject',
'LBL_LIST_ACCEPT' => 'Accept',
'LBL_MODIFIED_USER' => 'Modified By',
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
'LBL_ORDER_ORIGIN' => 'Order Origin',
'LBL_PREVIEW_HEADER_NAME' => 'Preview',
'LBL_PREVIEW_HEADER_CLOSE' => 'Close',
'LBL_CONTACT_NAME' => 'Contact',
'LBL_CONTACT_ID' => 'Contact Id',
'LBL_PARENT_NAME_COPY' => 'Company Name',
'LBL_PARENT_CONTACT_NAME' => 'Contact Person',
'LBL_PARENT_CONTACT_TITLE' => 'Contact Title',
'LBL_LEFT_TO_PAY'=>'Left to pay',
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Would you like to load default texts correspondencing to this language?',
'LBL_LIST_DOWNLOAD_PDF' => 'Download PDF',
);
?>

View File

@@ -0,0 +1,439 @@
<?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.
********************************************************************************/
$mod_strings = array (
//added 18.02.2009
'LBL_DEFAULT_ECMVENDOR_HEADER_TEXT' => 'Witaj $vendor_name!',
'LBL_DEFAULT_ECMVENDOR_FOOTER_TEXT' => 'Tekst pod tabelka dla Vendora',
'LBL_DEFAULT_ECMVENDOR_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Vendora',
//added 13.02.2009
'LBL_ECMSTOCKDOCOUTS_SUBPANEL_TITLE' => 'WZ Documents',
'LBL_ECMDELIVERYNOTES_SUBPANEL_TITLE' => 'Delivery Notes',
'LBL_ECMINVOICEOUTS_SUBPANEL_TITLE' => 'Invoices',
//added 12.02.2009
'LBL_STOCK_NAME' => 'Inventory',
'LBL_STOCK_ID' => 'Inventory',
//added 09.02.2009
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Show images on offers',
'LBL_PDF_LIST_POSITION' => 'Image',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'PZ Documents',
'LBL_MODULE_TITLE' => 'PZ Documents: Home',
'LBL_MODULE_ID' => 'EcmStockDocIns',
'LBL_SEARCH_FORM_TITLE' => 'PZ Documents Search',
'LBL_LIST_FORM_TITLE' => 'PZ Documents List',
'LBL_NEW_FORM_TITLE' => 'New PZ Document',
'LBL_DETAILS' => 'PZ Document details:',
'LBL_ITEMS' => 'Items included:',
'LBL_TEXTS' => 'Texts to PDF:',
'LBL_PREVIEW' => 'Preview PDF:',
'LBL_EMAIL' => 'Create Email:',
'LBL_TO_INFORMATIONS' => 'To Informations:',
'LBL_DETAILS_TAB' => 'Details',
'LBL_ITEMS_TAB' => 'Items',
'LBL_TEXTS_TAB' => 'Texts',
'LBL_PREVIEW_TAB' => 'Preview',
'LBL_EMAIL_TAB' => 'Email',
'LBL_ID' => 'Id',
'LBL_NAME' => 'Name',
'LBL_DESCRIPTION' => 'Description',
'LBL_DATE_ENTERED' => 'Date Entered',
'LBL_DATE_MODIFIED' => 'Date Modified',
'LBL_MODIFIED' => 'Last Modified',
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
'LBL_ASSIGNED_TO' => 'Assigned To',
'LBL_CREATED' => 'Created by',
'LBL_CREATED_BY_USER' => 'Created by',
'LBL_MODIFIED_BY_USER' => 'Modified by',
'LBL_ASSIGNED_TO_USER' => 'Assigned To',
'LBL_DELETED_BY' => 'Deleted by',
'LBL_NUMBER' => 'Number',
'LBL_DOCUMENT_NO' => 'Number',
'LBL_PARENT' => 'To',
'LBL_PARENT_NAME' => 'Account',
'LBL_PARENT_ID' => 'Account Id',
'LBL_TYPE' => 'Type',
'LBL_ECMSTOCKDOCIN_ID' => 'PZ Document Id',
'LBL_ECMSTOCKDOCIN_NAME' => 'PZ Document Name',
'LBL_STATUS' => 'Status',
'LBL_REGISTER_DATE' => 'Document Date',
'LBL_SELL_DATE' => 'Sell Date',
'LBL_PAYMENT_DATE' => 'Payment Date',
'LBL_PARENT_ADDRESS_STREET' => 'Street',
'LBL_PARENT_ADDRESS_CITY' => 'Postalcode / City',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Postalcode',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Country',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TO_IS_VAT_FREE' => 'Is VAT Free?',
'LBL_HEADER_TEXT' => 'Header Text',
'LBL_FOOTER_TEXT' => 'Footer Text',
'LBL_ADS_TEXT' => 'Ads Text',
'LBL_SUBTOTAL' => 'Subtotal',
'LBL_TOTAL' => 'Total',
'LBL_DISCOUNT' => 'Discount',
'LBL_VAT' => 'VAT',
'LBL_ACCEPTED' => 'Accepted',
'LBL_TEMPLATE_ID' => 'Template Id',
'LBL_TEMPLATE_NAME' => 'Template',
'LBL_PAYMENTCONDITION_NAME' => 'Payment Condition',
'LBL_PAYMENTCONDITION_ID' => 'Payment Condition ID',
'LBL_DELIVERYCONDITION_NAME' => 'Delivery Condition',
'LBL_DELIVERYCONDITION_ID' => 'Delivery Condition ID',
'LBL_FORMAT_NUMBER_ERROR' => 'Format Number Error!',
'LBL_SAVE_FORM_ERROR' => 'There are some errors on items list or in form!',
'LBL_DISCOUNT_ERROR' => 'Discount Format Number Error',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_CODE' => 'Code',
'LBL_EDITTABLE_NAME' => 'Name',
'LBL_EDITTABLE_QUANTITY' => 'Quant',
'LBL_EDITTABLE_PRICE' => 'Price',
'LBL_EDITTABLE_VAT' => 'VAT',
'LBL_EDITTABLE_DISCOUNT' => 'Discount',
'LBL_EDITTABLE_TOTAL' => 'Total',
'LBL_EDITTABLE_OPTIONS' => 'Opt',
'LBL_MOVE_ROW_UP' => 'Move Up',
'LBL_MOVE_ROW_DOWN' => 'Move Down',
'LBL_INSERT_NEW_ROW' => 'Insert new row',
'LBL_DELETE_ROW' => 'Delete row',
'LBL_VALIDTILL_DATE' => 'Valid Till',
// FOR MENU LINKS
'LNK_NEW_ECMSTOCKDOCIN' => 'Create PZ Document',
'LNK_ECMSTOCKDOCINS_LIST' => 'PZ Documents List',
'LBL_IMG_SEARCH' => 'Search',
'LBL_IMG_NEW' => 'New, add to base',
'LBL_IMG_EDIT' => 'Edit',
'LBL_CONFIRM_QUESTION' => 'Would you like to confirm this PZ Document?',
'LBL_QUOTE_PDF' => 'Show PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Show PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Show PZ Document 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_SALE' => 'Create Sales Order',
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Create Sales Order [Alt+O]',
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Create Sales Order.',
'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 PZ Document To Confirm.',
'LBL_LIST_TO_INVOICE' => 'Create Invoice.',
'LBL_LIST_TO_SALE' => 'Create Sales Order.',
//buttons
'LBL_SEND_BUTTON_TITLE' => 'Save & Send [Alt+D]',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Save & Send',
'LBL_REPAIR_BUTTON_TITLE' => 'Repair [Alt+R]',
'LBL_REPAIR_BUTTON_KEY' => 'R',
'LBL_REPAIR_BUTTON_LABEL' => 'Repair',
'LBL_ACCEPT_BUTTON_TITLE' => 'Accept [Alt+Z]',
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
'LBL_ACCEPT_BUTTON_LABEL' => 'Accept',
'LBL_REJECT_BUTTON_TITLE' => 'Reject [Alt+R]',
'LBL_REJECT_BUTTON_KEY' => 'R',
'LBL_REJECT_BUTTON_LABEL' => 'Reject',
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Go to pz documents list [Alt+G]',
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Go to list',
'LBL_SENDEMAIL_BUTTON' => 'Send Email',
'LBL_NOT_SAVED' => 'PZ Document not saved. Please check all fields are correct!',
'LBL_SAVED' => 'PZ Document saved successfully.',
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelka dla Contact',
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Contact',
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla $account_name.',
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelka dla Account',
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelka dla Account',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notes',
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emails',
'LBL_DASHLET_MY_ECMSTOCKDOCINS' => 'PZ Documents',
'LBL_PDF_LIST_POSITION' => 'Poz.',
'LBL_PDF_LIST_QUANTITY' => 'Ilosc',
'LBL_PDF_LIST_UNIT' => '',
'LBL_PDF_LIST_DESCRIPTION' => 'Opis',
'LBL_PDF_LIST_PRICE' => 'Cena',
'LBL_PDF_LIST_DISCOUNT' => 'Rabat',
'LBL_PDF_LIST_VAT' => 'VAT',
'LBL_PDF_LIST_TOTAL' => 'Suma',
'LBL_PDF_TOTAL' => 'Suma',
'LBL_PDF_DISCOUNT' => 'RABAT',
'LBL_PDF_END_TOTAL' => 'Suma koncowa',
'LBL_PDF_VAT' => 'VAT',
'LBL_PDF_VATID' => 'VAT-ID',
'LBL_PDF_NUMBER' => 'Numer',
'LBL_PDF_DATE_REGISTER' => 'Data wystawienia',
'LBL_PDF_VALIDTILL_DATE' => 'Waznosc oferty',
'LBL_PDF_OWNER' => 'Wystawil',
'LBL_PDF_DOCUMENT_NAME' => 'Przych<63>d Zewnetrzny',
'LBL_PDF_FILENAME' => 'PZ_Document_',
'LBL_PDF_CODE' => '',
'LNK_ECMSTOCKDOCINS_PDFLANGUAGES' => 'PDF Settings',
'LBL_ECMLANGUAGE' => 'Language',
'LBL_ECMSTOCKDOCINS_PDFLANGUAGES_TITLE' => 'PDF Languages Settings',
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this PZ Document is not accepted by Manager!",
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending PZ Document to confirm error! Refresh site and try again.",
'LBL_STATUS_s10_SET_MESSAGE' => "PZ Document status is set.",
'LBL_STATUS_s20_SET_MESSAGE' => "Now PZ Document is waiting for confimations.",
'LBL_STATUS_s30_SET_MESSAGE' => "PZ Document is confirmed.",
'LBL_STATUS_s40_SET_MESSAGE' => "PZ Document status is set.",
'LBL_STATUS_s20_FAIL_MESSAGE' => "Sending PZ Document to confirm error! Refresh site and try again.",
'LBL_LIST_SEND_TO_CONFIRM' => 'Send To Confirm',
'LBL_LIST_DUPLICATE' => 'Duplicate',
'LBL_LIST_PREVIEW_PDF' => 'Preview PZ Document',
'LBL_LIST_REJECT' => 'Reject',
'LBL_LIST_ACCEPT' => 'Accept',
'LBL_MODIFIED_USER' => 'Modified By',
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
'LBL_ORDER_ORIGIN' => 'Order Origin',
'LBL_PREVIEW_HEADER_NAME' => 'Preview',
'LBL_PREVIEW_HEADER_CLOSE' => 'Close',
'LBL_CONTACT_NAME' => 'Contact',
'LBL_CONTACT_ID' => 'Contact Id',
'LBL_PARENT_NAME_COPY' => 'Company Name',
'LBL_PARENT_CONTACT_NAME' => 'Contact Person',
'LBL_PARENT_CONTACT_TITLE' => 'Contact Title',
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Would you like to load default texts correspondencing to this language?',
'LBL_LIST_DOWNLOAD_PDF' => 'Download PDF',
);
?>

View File

@@ -0,0 +1,470 @@
<?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.
********************************************************************************/
$mod_strings = array (
//add mz 2012-04-02
'LBL_CURRENCY_SAD_VALUE' => 'Kurs SAD',
'BTN_CALCULATE_PURCHASE_PRICE' => 'Oblicz ceny netto',
'LBL_EDITTABLE_WEIGHT_NETTO' => 'Waga netto',
'LBL_EDITTABLE_DUTY' => 'Cło',
'LBL_EDITTABLE_ADD_FIELDS' => 'Pola dodatkowe',
'LBL_EDITTABLE_NO_ADD_FIELDS' => 'Brak pól dodatkowych',
'LBL_EDITTABLE_INVOICE_PRICE' => 'Cena na FK',
'LBL_KIND' => 'Rodzaj dokumentu',
'LBL_CURRENCY_VALUE' => 'Kurs',
'LBL_SAD_CURRENCY_VALUE' => 'Kurs SAD',
'LBL_CURRENCY_ID' => 'Waluta',
'LBL_FOREIGN_TRANSPORT_VAL'=>'Transport zagraniczny',
'LBL_FOREIGN_TRANSPORT_CUR_ID'=>'waluta / kurs',
'LBL_FOREIGN_TRANSPORT_CUR_VAL'=>'',
'LBL_COUNTRY_TRANSPORT_VAL'=>'Transport krajowy',
'LBL_COUNTRY_TRANSPORT_CUR_ID'=>'waluta / kurs',
'LBL_COUNTRY_TRANSPORT_CUR_VAL'=>'',
'LBL_ADDITION_COST_VAL'=>'Koszty dodatkowe',
'LBL_ADDITION_COST_CUR_ID'=>'waluta / kurs',
'LBL_ADDITION_COST_CUR_VAL'=>'',
//end mz
//added 01.09.2009
'LBL_ECMLANGUAGE'=>'Język',
//added 06.08.2009
'LBL_CURRENCY'=>'Waluta',
//added 20.07.2009
'LBL_CORRECT_TITLE'=>'Utwórz Korektę',
'LBL_CORRECT'=>'Utwórz Korektę',
//added 15.07.2009
'LBL_EDITTABLE_UNIT'=>'J.m.',
//added 18.02.2009
'LBL_DEFAULT_ECMVENDOR_HEADER_TEXT' => 'Witaj $vendor_name!',
'LBL_DEFAULT_ECMVENDOR_FOOTER_TEXT' => 'Tekst pod tabelką dla Vendora',
'LBL_DEFAULT_ECMVENDOR_ADS_TEXT' => 'Tekst pogrubiony pod tabelką dla Vendora',
//added 13.02.2009
'LBL_ECMSTOCKDOCINS_SUBPANEL_TITLE' => 'Dokumenty PZ',
'LBL_ECMDELIVERYNOTES_SUBPANEL_TITLE' => 'Dokumenty Przewozowe',
'LBL_ECMINVOICEOUTS_SUBPANEL_TITLE' => 'Faktury',
//added 12.02.2009
'LBL_STOCK_NAME' => 'Magazyn',
'LBL_STOCK_ID' => 'Magazyn',
//added 09.02.2009
'LBL_SHOW_IMAGES_ON_OFFERS' => 'Pokaż obrazki',
'LBL_PDF_LIST_POSITION' => 'Obrazek',
// FOR SYSTEM USE
'LBL_MODULE_NAME' => 'Dokumenty PZ',
'LBL_MODULE_TITLE' => 'Dokumenty PZ: Strona Główna',
'LBL_MODULE_ID' => 'EcmStockDocIns',
'LBL_SEARCH_FORM_TITLE' => 'Wyszukiwanie',
'LBL_LIST_FORM_TITLE' => 'Lista Dokumentów PZ',
'LBL_NEW_FORM_TITLE' => 'Nowy Dokument PZ',
'LBL_DETAILS' => 'Szczegóły Dokumentu PZ',
'LBL_ITEMS' => 'Załączone Produkty:',
'LBL_TEXTS' => 'Teksty do PDFa:',
'LBL_PREVIEW' => 'Podgląd PDFa:',
'LBL_EMAIL' => 'Stwórz Email:',
'LBL_TO_INFORMATIONS' => 'Informacje o firmie:',
'LBL_DETAILS_TAB' => 'Szczegóły',
'LBL_ITEMS_TAB' => 'Produkty',
'LBL_TEXTS_TAB' => 'Teksty',
'LBL_PREVIEW_TAB' => 'Podglad',
'LBL_EMAIL_TAB' => 'Email',
'LBL_ID' => 'Id',
'LBL_NAME' => 'Nazwa',
'LBL_DESCRIPTION' => 'Opis',
'LBL_DATE_ENTERED' => 'Data dodania',
'LBL_DATE_MODIFIED' => 'Date modyfikacji',
'LBL_MODIFIED' => 'Ostatnio modyfikowane',
'LBL_ASSIGNED_TO_ID' => 'Przypisane Do',
'LBL_ASSIGNED_TO' => 'Przypisane Do',
'LBL_CREATED' => 'Utworzone Przez',
'LBL_CREATED_BY_USER' => 'Utworzone Przez',
'LBL_MODIFIED_BY_USER' => 'Zmodyfikowane Przez',
'LBL_ASSIGNED_TO_USER' => 'Przypisane Do',
'LBL_DELETED_BY' => 'Usunięte Przez',
'LBL_NUMBER' => 'Numer',
'LBL_DOCUMENT_NO' => 'Numer',
'LBL_PARENT' => 'Do',
'LBL_PARENT_NAME' => 'Firma',
'LBL_PARENT_ID' => 'Firma Id',
'LBL_TYPE' => 'Typ',
'LBL_ECMSTOCKDOCIN_ID' => 'Id Dokumentu PZ',
'LBL_ECMSTOCKDOCIN_NAME' => 'Nazwa Dokumentu PZ',
'LBL_STATUS' => 'Status',
'LBL_REGISTER_DATE' => 'Data Dokumentu',
'LBL_SELL_DATE' => 'Data Sprzedaży',
'LBL_PAYMENT_DATE' => 'Data Płatności',
'LBL_DATA_FK'=>'Data faktury',
'LBL_PARENT_ADDRESS_STREET' => 'Ulica',
'LBL_PARENT_ADDRESS_CITY' => 'Kod pocztowy / Miasto',
'LBL_PARENT_ADDRESS_POSTALCODE' => 'Kod pocztowy',
'LBL_PARENT_ADDRESS_COUNTRY' => 'Państwo',
'LBL_TO_VATID' => 'VAT-ID',
'LBL_TO_IS_VAT_FREE' => 'Czy jest wolne od vatu?',
'LBL_HEADER_TEXT' => 'Tekst nagłówka',
'LBL_FOOTER_TEXT' => 'Tekst stopki',
'LBL_ADS_TEXT' => 'Dodatkowy tekst',
'LBL_SUBTOTAL' => 'Suma',
'LBL_TOTAL' => 'Suma',
'LBL_DISCOUNT' => 'Upust',
'LBL_VAT' => 'VAT',
'LBL_ACCEPTED' => 'Zaakceptowane',
'LBL_TEMPLATE_ID' => 'Id Szablonu',
'LBL_TEMPLATE_NAME' => 'Szablon',
'LBL_PAYMENTCONDITION_NAME' => 'Warunki Płatności',
'LBL_PAYMENTCONDITION_ID' => 'Warunki Płatności ID',
'LBL_DELIVERYCONDITION_NAME' => 'Warunki Dostawy',
'LBL_DELIVERYCONDITION_ID' => 'Warunki Dostawy ID',
'LBL_FORMAT_NUMBER_ERROR' => 'Błąd formatu numeru!',
'LBL_SAVE_FORM_ERROR' => 'Wystepują błędy na liście produktów albo w formularzu!',
'LBL_DISCOUNT_ERROR' => 'Błąd formatu upustu',
'LBL_EDITTABLE_NO' => 'Lp.',
'LBL_EDITTABLE_CODE' => 'Kod',
'LBL_EDITTABLE_NAME' => 'Nazwa',
'LBL_EDITTABLE_QUANTITY' => 'Ilość',
'LBL_EDITTABLE_PRICE' => 'Cena',
'LBL_EDITTABLE_VAT' => 'VAT',
'LBL_EDITTABLE_DISCOUNT' => 'Upust',
'LBL_EDITTABLE_TOTAL' => 'Suma',
'LBL_EDITTABLE_OPTIONS' => 'Opcje',
'LBL_MOVE_ROW_UP' => 'W górę',
'LBL_MOVE_ROW_DOWN' => 'W dół',
'LBL_INSERT_NEW_ROW' => 'Wstaw nowy wiersz',
'LBL_DELETE_ROW' => 'Usuń wiersz',
'LBL_VALIDTILL_DATE' => 'Ważne do',
// FOR MENU LINKS
'LNK_NEW_ECMSTOCKDOCIN' => 'Utwórz Dokument PZ',
'LNK_ECMSTOCKDOCINS_LIST' => 'Lista Dokumentów PZ',
'LBL_IMG_SEARCH' => 'Wyszukiwanie',
'LBL_IMG_NEW' => 'Nowy, dodaj do bazy',
'LBL_IMG_EDIT' => 'Edycja',
'LBL_CONFIRM_QUESTION' => 'Chcesz potwierdzić ten Dokument PZ?',
'LBL_QUOTE_PDF' => 'Pokaż PDF',
'LBL_QUOTE_PDF_BUTTON_KEY' => 'Pokaż PDF [Alt+P]',
'LBL_QUOTE_PDF_BUTTON_TITLE' => 'Pokaż Dokument PZ w pliku PDF.',
'LBL_QUOTE_TO_INVOICE' => 'Stwórz Fakturę',
'LBL_QUOTE_TO_INVOICE_BUTTON_KEY' => 'Stwórz Fakturę [Alt+I]',
'LBL_QUOTE_TO_INVOICE_BUTTON_TITLE' => 'Stwórz Fakturę.',
'LBL_QUOTE_TO_SALE' => 'Stwórz Zamówienie Sprzedaży',
'LBL_QUOTE_TO_SALE_BUTTON_KEY' => 'Stwórz Zamówienie Sprzedaży [Alt+O]',
'LBL_QUOTE_TO_SALE_BUTTON_TITLE' => 'Stwórz Zamówienie Sprzedaży.',
'LBL_SEND_TO_CONFIRM' => 'Wyślij Do Potwierdzenia',
'LBL_SEND_TO_CONFIRM_BUTTON_KEY' => 'Wyślij Do Potwierdzenia [Alt+C]',
'LBL_SEND_TO_CONFIRM_BUTTON_TITLE' => 'Wyślij Do Potwierdzenia.',
'LBL_LIST_TO_INVOICE' => 'Stwórz Fakturę.',
'LBL_LIST_TO_SALE' => 'Stwórz Zamówienie Sprzedaży.',
//buttons
'LBL_SEND_BUTTON_TITLE' => 'Zapisz i Wyślij [Alt+D]',
'LBL_SEND_BUTTON_KEY' => 'D',
'LBL_SEND_BUTTON_LABEL' => 'Zapisz i Wyślij',
'LBL_REPAIR_BUTTON_TITLE' => 'Napraw [Alt+R]',
'LBL_REPAIR_BUTTON_KEY' => 'R',
'LBL_REPAIR_BUTTON_LABEL' => 'Napraw',
'LBL_ACCEPT_BUTTON_TITLE' => 'Zaakceptuj [Alt+Z]',
'LBL_ACCEPT_BUTTON_KEY' => 'Z',
'LBL_ACCEPT_BUTTON_LABEL' => 'Zaakceptuj',
'LBL_REJECT_BUTTON_TITLE' => 'Nie akceptuj [Alt+R]',
'LBL_REJECT_BUTTON_KEY' => 'R',
'LBL_REJECT_BUTTON_LABEL' => 'Nie akceptuj',
'LBL_GO_TO_LIST_BUTTON_TITLE' => 'Idź do listy Dokumentów PZ [Alt+G]',
'LBL_GO_TO_LIST_BUTTON_KEY' => 'G',
'LBL_GO_TO_LIST_BUTTON_LABEL' => 'Idź do listy',
'LBL_SENDEMAIL_BUTTON' => 'Wyślij Email',
'LBL_NOT_SAVED' => 'Dokument PZ nie został zapisany. Sprawdz czy wszytskie pola są poprawne!',
'LBL_SAVED' => 'Dokument PZ został zapisany pomyślnie.',
'LBL_DEFAULT_CONTACT_HEADER_TEXT' => 'Witaj $contact_full_name!',
'LBL_DEFAULT_CONTACT_FOOTER_TEXT' => 'Tekst pod tabelką dla Contact',
'LBL_DEFAULT_CONTACT_ADS_TEXT' => 'Tekst pogrubiony pod tabelką dla Contact',
'LBL_DEFAULT_ACCOUNT_HEADER_TEXT' => 'Oferta dla $account_name.',
'LBL_DEFAULT_ACCOUNT_FOOTER_TEXT' => 'Tekst pod tabelką dla Account',
'LBL_DEFAULT_ACCOUNT_ADS_TEXT' => 'Tekst pogrubiony pod tabelką dla Account',
'LBL_NOTES_SUBPANEL_TITLE' => 'Notatki',
'LBL_EMAILS_SUBPANEL_TITLE' => 'Emaile',
'LBL_DASHLET_MY_ECMSTOCKDOCINS' => 'Dokumenty PZ',
'LBL_PDF_LIST_POSITION' => 'Poz.',
'LBL_PDF_LIST_QUANTITY' => 'Ilość',
'LBL_PDF_LIST_UNIT' => '',
'LBL_PDF_LIST_DESCRIPTION' => 'Opis',
'LBL_PDF_LIST_PRICE' => 'Cena',
'LBL_PDF_LIST_DISCOUNT' => 'Rabat',
'LBL_PDF_LIST_VAT' => 'VAT',
'LBL_PDF_LIST_TOTAL' => 'Suma',
'LBL_PDF_TOTAL' => 'Suma',
'LBL_PDF_DISCOUNT' => 'RABAT',
'LBL_PDF_END_TOTAL' => 'Suma końcowa',
'LBL_PDF_VAT' => 'VAT',
'LBL_PDF_VATID' => 'VAT-ID',
'LBL_PDF_NUMBER' => 'Numer',
'LBL_PDF_DATE_REGISTER' => 'Data wystawienia',
'LBL_PDF_VALIDTILL_DATE' => 'Ważność oferty',
'LBL_PDF_OWNER' => 'Wystawił',
'LBL_PDF_DOCUMENT_NAME' => 'Przychód Zewnętrzny',
'LBL_PDF_FILENAME' => 'PZ_',
'LBL_PDF_CODE' => 'PZ',
'LNK_ECMSTOCKDOCINS_PDFLANGUAGES' => 'Ustawienia PDF',
'LBL_ECMSTOCKDOCINS_PDFLANGUAGES_TITLE' => 'Ustawienia języków PDFa',
'LBL_ACCESS_UNAVAIBLE_DELETE_EMAIL' => "You don't have a permission to send Email, because this Correct Document is not accepted by Manager!",
'LBL_SEND_TO_CONFIRM_ERROR' => "Sending Correct Document to confirm error! Refresh site and try again.",
'LBL_STATUS_s10_SET_MESSAGE' => "Status Dokumentu PZ ustawiony.",
'LBL_STATUS_s20_SET_MESSAGE' => "Dokument PZ czeka na potwierdzenie.",
'LBL_STATUS_s30_SET_MESSAGE' => "Dokument PZ jest potwierdzony.",
'LBL_STATUS_s40_SET_MESSAGE' => "Status Dokumentu PZ ustawiony.",
'LBL_STATUS_s20_FAIL_MESSAGE' => "Błąd wysyłki do potwierdzenia! Odśwież stronę i spróbuj ponownie.",
'LBL_LIST_SEND_TO_CONFIRM' => 'Wyślij do Potwierdzenia',
'LBL_LIST_DUPLICATE' => 'Duplikuj',
'LBL_LIST_PREVIEW_PDF' => 'Podgląd Dokumentu PZ',
'LBL_LIST_REJECT' => 'Nie akceptuj',
'LBL_LIST_ACCEPT' => 'Akceptuj',
'LBL_MODIFIED_USER' => 'Zmodyfikowane Przez',
'LBL_DEMO_VERSION_INFORMATION' => "This is only demo version.\nPlease contact us at ca@more7.com.",
'LBL_ORDER_ORIGIN' => 'Zródło zamówienia',
'LBL_PREVIEW_HEADER_NAME' => 'Podgląd',
'LBL_PREVIEW_HEADER_CLOSE' => 'Zamknij',
'LBL_CONTACT_NAME' => 'Kontakt',
'LBL_CONTACT_ID' => 'Id Kontaktu',
'LBL_PARENT_NAME_COPY' => 'Nazwa Firmy',
'LBL_PARENT_CONTACT_NAME' => 'Osoba Kontaktowa',
'LBL_PARENT_CONTACT_TITLE' => 'Tytuł Kontaktu',
'LBL_LEFT_TO_PAY'=>'Pozostało do zapłaty',
'LBL_ALERT_ECMLANGUAGE_CHANGE' => 'Czy załadować domyślne teksty dla tego języka?',
'LBL_LIST_DOWNLOAD_PDF' => 'Pobierz PDF',
);
?>

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['EcmStockDocIns'] = 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,425 @@
<?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 $app_list_strings;
$viewdefs['EcmStockDocIns']['DetailView'] = array (
'templateMeta' => array (
'form' => array (
'buttons' => array (
array(
'customCode' => '{if $bean->status=="registered"}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'EcmStockDocIns\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$id}\'; this.form.action.value=\'EditView\';" type="submit" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if}'
),
array(
'customCode' => '<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'EcmStockDocIns\'; this.form.return_action.value=\'DetailView\'; this.form.isDuplicate.value=true; this.form.action.value=\'EditView\'; this.form.return_id.value=\'{$id}\';" type="submit" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button" {if !$bean->aclAccess("duplicate")}style="display:none;"{/if}>'
),
array(
'customCode' => '{if $bean->status=="registered"}<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="this.form.return_module.value=\'EcmStockDocIns\'; 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}">{/if}'
),
array(
'customCode' => '{if $bean->status=="accepted" and $bean->correct_id=="" and !$hasCorrect}<input title="{$MOD.LBL_CORRECT_BUTTON_TITLE}" accessKey="{$MOD.LBL_CORRECT_BUTTON_KEY}" class="button" onclick="if(confirm(\'{$MOD.LBL_CORRECT_CONFIRMATION}\')){literal}{{/literal}location.href=\'index.php?module=EcmStockDocIns&action=SaveCorrect&correct_id={$id}\';{literal}}{/literal}" type="button" name="Correct" value="{$MOD.LBL_CORRECT_BUTTON_LABEL}">{/if}'
),
array(
'customCode' => '<input name="pz_pdf" id="pz_pdf" title="Pokaż PDF" accessKey="" class="button" onclick="window.location = \'index.php?module=EcmStockDocIns&action=previewPDF&to_pdf=1&record={$fields.id.value}\';" type="button" value="Pokaż PDF">'
),
),
'hidden'=>array(
'<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_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="">',
'<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/EcmStockDocIns/MyTable.js'),
array('file'=>'modules/EcmStockDocIns/EcmStockDocInsDetailView4.js'),
array('file'=>'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js'),
),
),
'panels' => array (
'LBL_DETAILS_TAB'=> array(
array(
'document_no',
'assigned_user_name'
),
array (
'parent_name',
'template_name',
),
array (
'contact_name',
'stock_name'
),
array (
'name',
'kind',
),
array (
'register_date',
),
array('status'),
array('payment_date','data_fk'),
array('left_to_pay'),
array(
array(
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<br><b>{$MOD.LBL_TO_INFORMATIONS}</b>'
),
),
array (
array(
'name' => 'parent_name_copy',
'customCode' => '{$fields.parent_name.value}',
),
'ecmlanguage'
),
array ('parent_contact_name',
),
array ('parent_contact_title',),
array ('parent_address_street'),
array (
array(
'name' => 'parent_address_city',
'tabIndex' => 't',
'customCode' => '{$fields.parent_address_postalcode.value}&nbsp;&nbsp;{$fields.parent_address_city.value}'
),
),
array ('parent_address_country'),
array(
array(
'name' => 'kind_title',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<br><b>{$KIND_TITLE}</b>'
),
),
array(
array(
'name' => 'kind_table',
'allCols' => true,
'hideLabel' => true,
'customCode' => '{$KIND_TABLE}'
),
),
//end mz
),
'LBL_ITEMS_TAB'=> array(
array(
array(
'name' => 'items_label_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '
'
// .'{literal}'.
// '<script language="javascript">var parent_options='.$json->encode($app_list_strings['ecmworkitems_parent_dom']).';</script>'
// .'{/literal}'.
.'
<link rel="stylesheet" type="text/css" href="modules/EcmStockDocIns/MyTable.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;">
<table class="positions" style="width:100%;" id="itemsTable">
<thead id="head">
<tr id="tr">
<td width="6%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="10%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="41%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
<td width="8%">{$MOD.LBL_EDITTABLE_UNIT}</td>
<td width="8%">{$MOD.LBL_EDITTABLE_INVOICE_PRICE}</td>
<td width="13%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_VAT}</td>
<td width="6%">{$MOD.LBL_EDITTABLE_DISCOUNT}</td>
<td width="13%">{$MOD.LBL_EDITTABLE_TOTAL}</td>
<td width="13%">{$MOD.LBL_EDITTABLE_WEIGHT_NETTO}</td>
<td width="13%">Nr parti</td>
<td width="13%">Data ważności</td>
<td width="13%">{$MOD.LBL_EDITTABLE_ADD_FIELDS}</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">
&nbsp;
</td> <!--color:#b3b9cf;-->
<td width="40%" class="dataField" style="text-align: left;">
<br>
<table id="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_SUBTOTAL}</td>
<td class="positionsField" style="border-top:0px;"><input type="text" style="border:0px;font-weight:900;width:100%;text-align:right;" readonly="readonly" name="subtotal" id="subtotal" value=\'{$fields.subtotal.value}\'></td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_TOTAL}</td>
<td class="positionsField"><input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="total_2" id="total_2" value=\'\'></td>
</tr>
<tr id="discount_tr">
<td class="positionsLabel">{$MOD.LBL_DISCOUNT}</td>
<td class="positionsField"><input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="discount_2" id="discount_2" value=\'\'></td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_TOTAL}</td>
<td class="positionsField"><input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="total" id="total" value=\'{$fields.total.value}\'></td>
</tr>
</table>
</td>
<td width="5%" class="dataField" style="text-align: left;">&nbsp;</td>
</tr>
</table>
',
)
),
),
'LBL_TEXTS_TAB'=> array(
array('header_text'),
array('footer_text'),
array('ads_text'),
),
/*
'LBL_PREVIEW_TAB'=> array(
array(
array(
'name' => 'preview_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<span id="previewPDF" width="100%" height="100%"></span>'
),
),
),
*/
'LBL_EMAIL_TAB'=> array(
array(
array(
'name' => 'email_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '{$EMAIL_LINK_TAB}<span id="emailTAB" width="100%" height="100%"></span>'
),
),
),
),
);
?>

View File

@@ -0,0 +1,142 @@
<?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 $app_list_strings;
$viewdefs['EcmStockDocIns']['DetailView'] = array (
'templateMeta' => array (
'form' => array (
'buttons' => array ('EDIT', 'DUPLICATE', 'DELETE',
array(
'customCode' => '<input name="quote_pdf" id="quote_pdf" title="{$MOD.LBL_QUOTE_PDF_BUTTON_TITLE}" accessKey="{$MOD.LBL_QUOTE_PDF_BUTTON_KEY}" class="button" onclick="window.open(\'index.php?module=EcmStockDocIns&action=previewPDF&to_pdf=1&record={$fields.id.value}\');" type="button" value="{$MOD.LBL_QUOTE_PDF}">'
),
/*
array(
'customCode' => '<input name="workreport_to_invoice" id="workreport_to_invoice" title="{$MOD.LBL_WORKREPORT_TO_INVOICE_BUTTON_TITLE}" accessKey="{$MOD.LBL_WORKREPORT_TO_INVOICE_BUTTON_KEY}" class="button" onclick="window.location = \'index.php?module=EcmInvoiceOuts&action=EditView&work_report_record={$fields.id.value}\';" type="button" value="{$MOD.LBL_WORKREPORT_TO_INVOICE}">'
),
*/
)
),
'maxColumns' => '2',
'widths' => array (
array ('label' => '10', 'field' => '30'),
array ('label' => '10', 'field' => '30')
),
),
'panels' => array (
array('name', 'assigned_user_name'),
array('date_time_start', 'account_name'),
array('date_time_end', 'contact_name'),
array(
'parent_name',
'status'
),
array('description'),
),
);
?>

View File

@@ -0,0 +1,504 @@
<?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['EcmStockDocIns']['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="return SaveForm(this);" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">'),
'CANCEL',
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=EcmStockDocIns&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="email_id" id="email_id" value=\'\'>',
'<input type="hidden" name="parent_type" id="parent_type" value="Accounts">',
'<input type="hidden" name="po_id" id="po_id" value="{$fields.po_id.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/EcmStockDocIns/AjaxSearch/AjaxSearch.js'),
array('file'=>'modules/EcmStockDocIns/formloader.js'),
array('file'=>'modules/EcmStockDocIns/MyTable.js'),
array('file'=>'modules/EcmStockDocIns/EcmStockDocIns44.js'),
array('file'=>'modules/EcmStockDocIns/CreateItem.js'),
array('file'=>'modules/EcmProducts/mintajax.js'),
array('file'=>'modules/EcmProducts/helper.js'),
),
),
'panels' => array (
'LBL_DETAILS_TAB'=> array(
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' => 'assigned_user_name',
'tabIndex' => '1'
)
),
array (
array(
'name' => 'parent_name',
'tabIndex' => '1',
),
array(
'name' => 'template_name',
'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 (
'contact_name',
array(
'label'=>'LBL_STOCK_NAME',
'tabIndex' => '1',
'name'=>'stock_id',
'customCode'=>'<select name="stock_id" id="stock_id">{$STOCK}</select>',
),
),
array (
array(
'name' => 'name',
'tabIndex' => '1',
),
array(
'name' => 'kind',
'tabIndex' => '1',
),
),
array (
array(
'name' => 'register_date',
'tabIndex' => '1',
'type' => 'datetime',
'displayParams'=>array('showFormats'=>true)
),
),
array('status'),
array('payment_date','data_fk'),
array('left_to_pay'),
array(
array(
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_TO_INFORMATIONS}</h4>'
),
),
array (
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" />'
),
array(
'name' => 'ecmlanguage',
'tabIndex' => '1',
)
),
array (
array(
'name' => 'parent_contact_name',
'tabIndex' => '1',
),
),
array (
array(
'name' => 'parent_contact_title',
'tabIndex' => '1',
),
),
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>',
),
/*
array(
'name'=>'show_images_on_offers',
'tabindex'=>'1',
'customCode'=>'<input type="checkbox" id="show_images_on_offers" name="show_images_on_offers" value="1" {$CHECKBOX_SHOW_IMAGES_ON_OFFERS}>',
),
*/
),
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;" />'
),
),
array (
array(
'name' => 'parent_address_country',
'tabIndex' => '1',
),
),
array(
array(
'name' => 'to_informations',
'allCols' => true,
'hideLabel' => true,
'customCode' => '
<script>
{literal}
function hideElementsByClassName(cn){
var arr = new Array();
var els = document.getElementsByTagName("*");
var exp= new RegExp("^(.* )?"+cn+"( .*)?$", "g");
for (var i = 0; i < els.length; i++ ){
if (exp.test(els[i].className)){
els[i].style.display="none";
}
}
}
function showElementsByClassName(cn){
var arr = new Array();
var els = document.getElementsByTagName("*");
var exp= new RegExp("^(.* )?"+cn+"( .*)?$", "g");
for (var i = 0; i < els.length; i++ ){
if (exp.test(els[i].className)){
els[i].style.display="block";
}
}
}
function select_kind(value)
{
document.getElementById("import_title").style.display="none";
document.getElementById("import_table").style.display="none";
hideElementsByClassName("items_import_div");
hideElementsByClassName("items_country_div");
if (value=="import") {
document.getElementById("import_title").style.display="block";
document.getElementById("import_table").style.display="block";
showElementsByClassName("items_import_div");
}
}
{/literal}
</script>
<div class="tabForm" id="import_title" style="border-top:none;width:100%;height:1px;padding:0px;align:center;{$IMPORT}"><h4 style="padding-top: 5px;">Import</h4></div>
'
),
),
array(
array(
'name'=>'pz_options',
'hideLabel'=>true,
'customCode'=>'
<div id="import_table" style="{$IMPORT}"><br>{$IMPORT_TABLE}</div>
',
),
),
),
'LBL_ITEMS_TAB'=> array(
array(
array(
'name' => 'items_list_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '
'
// .'{literal}'.
// '<script language="javascript">var parent_options='.$json->encode($app_list_strings['ecmworkitems_parent_dom']).';</script>'
// .'{/literal}'.
.'
<link rel="stylesheet" type="text/css" href="modules/EcmStockDocIns/MyTable.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmStockDocIns/AjaxSearch/AjaxSearch.css" />
<br><input type="button" name="button" class="button" value="{$MOD.BTN_CALCULATE_PURCHASE_PRICE}" onClick="calculatePrices();"/><br>
<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="10%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="45%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
<td width="3%">{$MOD.LBL_EDITTABLE_UNIT}</td>
<td width="8%">Ostatnia cena</td>
<td width="8%">{$MOD.LBL_EDITTABLE_INVOICE_PRICE}</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="12%">{$MOD.LBL_EDITTABLE_WEIGHT_NETTO}</td>
<td width="12%">{$MOD.LBL_EDITTABLE_ADD_FIELDS}</td>
<td width="12%">Nr parti</td>
<td width="12%">Data ważności</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 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="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_SUBTOTAL}</td>
<td class="positionsField" style="border-top:0px;"><input type="text" style="border:0px;font-weight:900;width:100%;text-align:right;" readonly="readonly" name="subtotal" id="subtotal" value=\'{$fields.subtotal.value}\'></td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_TOTAL}</td>
<td class="positionsField"><input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="total_2" id="total_2" value=\'\'></td>
</tr>
<!--
<tr id="discount_tr">
<td class="positionsLabel">{$MOD.LBL_DISCOUNT}</td>
<td class="positionsField"><input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="discount_2" id="discount_2" value=\'\'></td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_TOTAL}</td>
<td class="positionsField"><input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="total" id="total" value=\'{$fields.total.value}\'></td>
</tr>
-->
</table>
</td>
<td width="5%" class="dataField" style="text-align: left;">&nbsp;</td>
</tr>
</table>
',
)
),
),
'LBL_TEXTS_TAB'=> array(
array(array('name' => 'header_text', 'label' => 'LBL_HEADER_TEXT','customCode' => '{$MFP.footer}<br /><textarea id="header_text" name="header_text" rows="5" style="width:100%;">{$fields.header_text.value}</textarea>'),),
array(array('name' => 'footer_text', 'label' => 'LBL_FOOTER_TEXT','customCode' => '{$MFP.header}<br /><textarea id="footer_text" name="footer_text" rows="5" style="width:100%;">{$fields.footer_text.value}</textarea>'),),
array(array('name' => 'ads_text', 'label' => 'LBL_ADS_TEXT','customCode' => '{$MFP.ads}<br /><textarea id="ads_text" name="ads_text" rows="5" style="width:100%;">{$fields.ads_text.value}</textarea>'),),
),
/*
'LBL_PREVIEW_TAB'=> array(
array(
array(
'name' => 'preview_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<span id=\'previewPDF\' width="100%" height="100%"></span>'
),
),
),
*/
),
);
?>

View File

@@ -0,0 +1,502 @@
<?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;
$path = 'modules/EcmStockDocIns/ModuleFieldsParser/ModuleFieldsParser.php';
if(file_exists($path)) {
require_once($path);
$mfp = new ModuleFieldsParser();
}
/*
if((!isset($focus->footer_text) || $focus->footer_text == '') && (!isset($focus->name) || $focus->name == '') && (!isset($focus->id) || $focus->id == '')) $focus->footer_text = translate('LBL_DEFAULT_FOOTER_TEXT', 'EcmDocumentTemplates');
if((!isset($focus->header_text) || $focus->header_text == '') && (!isset($focus->name) || $focus->name == '') && (!isset($focus->id) || $focus->id == '')) $focus->header_text = translate('LBL_DEFAULT_HEADER_TEXT', 'EcmDocumentTemplates');
*/
$viewdefs['EcmStockDocIns']['EditView'] = array (
'templateMeta' => array (
'form' => array (
'enctype'=>'multipart/form-data',
'buttons'=>array(
'SAVE',
'CANCEL',
),
'hidden'=>array(
// '<input type="hidden" name="subtotal" id="subtotal" value=\'{$fields.subtotal.value}\'>',
// '<input type="hidden" name="total" id="total" value=\'{$fields.total.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'=>'modules/EcmStockDocIns/EcmStockDocIns.js'),
),
),
'panels' => array (
'DETAILS'=> array(
array(array('type' => 'tab','active' => true,)),
array(
array(
'name' => 'document_no',
'tabIndex' => 'f',
'customCode' => '<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}\'>'
),
'assigned_user_name'
),
array (
'parent_name',
'type'
),
array (
'',
'ecmstockdocin_name'
),
array (
'status',
''
),
array (
array('name'=>'register_date','type'=>'date','displayParams'=>array('showFormats'=>true)),
''
),
array (
array('name'=>'sell_date','type'=>'date','displayParams'=>array('showFormats'=>true)),
'',
),
array (
array('name'=>'payment_date','type'=>'date','displayParams'=>array('showFormats'=>true)),
array(
'label'=>'LBL_TEMPLATE_NAME',
'customCode'=>'<select 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(
'allCols' => true,
'hideLabel' => true,
'customCode' => '<br><div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div><h4>{$MOD.LBL_TO_INFORMATIONS}</h4>'
),
),
array (
array(
'name' => 'parent_address_street',
'tabIndex' => 'p',
'customCode' => '<textarea id="parent_address_street" name="parent_address_street" rows="2" cols="30" maxlength="150">{$fields.parent_address_street.value}</textarea>',
),
),
array ('parent_address_postalcode', 'to_nip'),
array ('parent_address_city', 'to_vatid'),
array (
'parent_address_country',
array(
'name' => 'to_is_vat_free',
'tabIndex' => 't',
'customCode' => '<input type="checkbox" id="to_is_vat_free" name="to_is_vat_free" value="{$fields.to_is_vat_free.value}" onClick="N.calculateTotal();" {if $fields.to_is_vat_free.value == 1}checked{/if}>'
),
),
),
'ITEMS'=> array(
array(array('type' => 'tab')),
array(
array(
'allCols' => true,
'hideLabel' => true,
'customCode' => '
'
// .'{literal}'.
// '<script language="javascript">var parent_options='.$json->encode($app_list_strings['ecmworkitems_parent_dom']).';</script>'
// .'{/literal}'.
.'
<link rel="stylesheet" type="text/css" href="modules/EcmStockDocIns/MyTable.css" />
<script src="modules/EcmStockDocIns/MyTable.js"></script>
<div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:300px;max-height:300px;overflow:auto;">
<table class="positions" style="width:100%;" id="itemsTable">
<thead id="head">
<tr id="tr">
<td width="4%">{$MOD.LBL_EDITTABLE_NO}</td>
<td width="10%">{$MOD.LBL_EDITTABLE_CODE}</td>
<td width="42%">{$MOD.LBL_EDITTABLE_NAME}</td>
<td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
<td width="13%">{$MOD.LBL_EDITTABLE_PRICE}</td>
<td width="8%">{$MOD.LBL_EDITTABLE_DISCOUNT}</td>
<td width="13%">{$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="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_SUBTOTAL}</td>
<td class="positionsField" style="border-top:0px;"><input type="text" style="border:0px;font-weight:900;width:100%;text-align:right;" readonly="readonly" name="subtotal" id="subtotal" value=\'{$fields.subtotal.value}\'></td>
</tr>
<tr id="total_tr">
<td class="positionsLabel">{$MOD.LBL_TOTAL}</td>
<td class="positionsField"><input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="total" id="total" value=\'{$fields.total.value}\'></td>
</tr>
</table>
</td>
<td width="5%" class="dataField" style="text-align: left;">&nbsp;</td>
</tr>
</table>
',
)
),
),
'TEXTS'=> array(
array(array('type' => 'tab')),
array(array('label' => 'LBL_HEADER_TEXT','customCode' => $mfp->getFormHTML(true, 'header')),),
array(array('tabIndex'=>'f', 'customCode'=>'<textarea id="header_text" name="header_text" rows="5" style="width:100%;">{$fields.header_text.value}</textarea>')),
array(array('label' => 'LBL_FOOTER_TEXT','customCode' => $mfp->getFormHTML(true, 'footer')),),
array(array('tabIndex'=>'f', 'customCode'=>'<textarea id="footer_text" name="footer_text" rows="5" style="width:100%;">{$fields.footer_text.value}</textarea>')),
array(array('label' => 'LBL_ADS_TEXT','customCode' => $mfp->getFormHTML(true, 'ads')),),
array(array('tabIndex'=>'f', 'customCode'=>'<textarea id="ads_text" name="ads_text" rows="5" style="width:100%;">{$fields.ads_text.value}</textarea>')),
),
'PREVIEW'=> array(
array(array('type' => 'tab')),
array(
array(
'customCode' => 'preview'
),
),
),
'EMAIL'=> array(
array(array('type' => 'tab')),
array(
array(
'customCode' => 'email'
),
),
),
),
);
?>

View File

@@ -0,0 +1,164 @@
<?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["EcmStockDocIns"] = array(
'CONTACT_NAME'=>array(
'label'=>'LBL_CONTACT_NAME',
),
'ECMLANGUAGE'=>array(
'label'=>'LBL_ECMLANGUAGE',
),
'PARENT_NAME_COPY'=>array(
'label'=>'LBL_PARENT_NAME_COPY',
),
'PARENT_CONTACT_NAME'=>array(
'label'=>'LBL_PARENT_CONTACT_NAME',
),
'PARENT_CONTACT_TITLE'=>array(
'label'=>'LBL_PARENT_CONTACT_TITLE',
),
'PARENT_ADDRESS_STREET'=>array(
'label'=>'LBL_PARENT_ADDRESS_STREET',
),
'PARENT_ADDRESS_POSTALCODE'=>array(
'label'=>'LBL_PARENT_ADDRESS_POSTALCODE',
),
'PARENT_ADDRESS_COUNTRY'=>array(
'label'=>'LBL_PARENT_ADDRESS_COUNTRY',
),
'PARENT_ADDRESS_CITY'=>array(
'label'=>'LBL_PARENT_ADDRESS_CITY',
),
'STATUS' => array(
'width' => '1',
'label' => '&nbsp;',
'default' => true,
),
'DOCUMENT_NO' => array(
'width' => '10',
'label' => 'LBL_DOCUMENT_NO',
'sortable' => true,
'link' => true,
'default' => true,
),
'TYPE' => array(
'width' => '10',
'label' => 'LBL_TYPE',
'default' => true,
),
'NAME' => array(
'width' => '15',
'label' => 'LBL_NAME',
'default' => true,
'link'=>true,
'sortable' => true
),
'PARENT_ID' => array(
'width'=>'1',
'sortable'=>false,
'label'=>'&nbsp;',
'default'=>true,
'customCode'=>' ',
),
'PARENT_NAME' => array(
'width' => '20',
'label' => 'LBL_PARENT_NAME',
'link'=>true,
'module'=>'Accounts',
'id'=>'PARENT_ID',
'default' => true,
),
'SUBTOTAL' => array(
'width' => '10',
'label' => 'Wartość netto',
'align'=>'right',
'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,
),
'ASSIGNED_USER_NAME' => array(
'width' => '10',
'label' => 'LBL_LIST_ASSIGNED_USER',
'default' => true
),
'OPTIONS' => array (
'width' => '7',
'label' => '&nbsp;',
'default' => true,
'sortable' => false,
'align' => 'right',
),
);
?>

View File

@@ -0,0 +1,128 @@
<?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['EcmStockDocIns'] = array (
'templateMeta' => array (
'maxColumns' => '3',
'widths' => array (
'label' => '10',
'field' => '30'
),
),
'layout' => array (
'basic_search' => array (
'document_no',
'parent_name',
'register_date',
'assigned_user_name',
),
'advanced_search' => array (
'name',
'assigned_user_name',
'parent_name',
'contact_name',
'stock_name',
'ecmlanguage',
'register_date',
'parent_name_copy',
'parent_contact_name',
'parent_contact_title',
'total',
'parent_address_street',
'parent_address_postalcode',
'parent_address_country',
'parent_address_city',
),
),
);
?>

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']['EcmStockDocIns'] = array(
'LBL_DETAILVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmStockDocIns/DetailView.html',
'php_file' => 'modules/EcmStockDocIns/DetailView.php',
'type' => 'DetailView',
),
'LBL_EDITVIEW'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmStockDocIns/EditView.html',
'php_file' => 'modules/EcmStockDocIns/EditView.php',
'type' => 'EditView',
),
'LBL_LISTVIEW'=>array(
'template' => 'listview',
'meta_file' => 'modules/EcmStockDocIns/listviewdefs.php',
'type' => 'ListView',
),
'LBL_SEARCHFORM'=>array(
'template' => 'xtpl',
'template_file' => 'modules/EcmStockDocIns/SearchForm.html',
'php_file' => 'modules/EcmStockDocIns/ListView.php',
'type' => 'SearchForm',
),
);

View File

@@ -0,0 +1,217 @@
<?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['EcmStockDocIns']['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' => 'ForEcmStockDocIns',
'title_key' => 'LBL_NOTES_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopSelectButton'),
array('widget_class' => 'SubPanelTopCreateButton'),
),
),
'emails' => array (
'order' => 15,
'module' => 'Emails',
'sort_order' => 'asc',
'sort_by' => 'date_modified',
'get_subpanel_data' => 'emails',
'add_subpanel_data' => 'emails_id',
'subpanel_name' => 'ForEcmStockDocIns',
'title_key' => 'LBL_EMAILS_SUBPANEL_TITLE',
'top_buttons' => array(),
),*/
'notes' => array(
'order' => 110,
'module' => 'Notes',
'sort_order' => 'asc',
'sort_by' => 'date_entered',
'subpanel_name' => 'default',
'get_subpanel_data' => 'notes',
'add_subpanel_data' => 'note_id',
'title_key' => 'LBL_NOTES_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
),
),
'documents' => array(
'order' => 130,
'module' => 'Documents',
'subpanel_name' => 'default',
'get_subpanel_data' => 'documents',
'title_key' => 'Dokumenty',
),
'ecmpurchaseorders' => array (
'order' => 10,
'module' => 'EcmPurchaseOrders',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmpurchaseorders',
'add_subpanel_data' => 'po_id',
'subpanel_name' => 'default',
'title_key' => 'Zamówienia zakupu',
),/*
'ecmstockins' => array (
'order' => 20,
'module' => 'EcmStockIns',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmstockins',
'add_subpanel_data' => 'ecmstockin_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMSTOCKINS_SUBPANEL_TITLE',
),
'ecmsales' => array (
'order' => 30,
'module' => 'EcmSales',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmsales',
'add_subpanel_data' => 'so_id',
'subpanel_name' => 'default',
'title_key' => 'Sales Order',
),*/
'ecmstockdocouts' => array (
'order' => 40,
'module' => 'EcmStockDocOuts',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmstockdocouts',
'add_subpanel_data' => 'wz_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMSTOCKDOCOUTS_SUBPANEL_TITLE',
),
'ecmdeliverynotes' => array (
'order' => 50,
'module' => 'EcmDeliveryNotes',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmdeliverynotes',
'add_subpanel_data' => 'dn_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMDELIVERYNOTES_SUBPANEL_TITLE',
),
'ecminvoiceouts' => array (
'order' => 60,
'module' => 'EcmInvoiceOuts',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecminvoiceouts',
'add_subpanel_data' => 'ecminvoiceout_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMINVOICEOUTS_SUBPANEL_TITLE',
),
);
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select correct_id from ecmstockdocins where id='".$_REQUEST['record']."'"));
if(!$r['correct_id']){
$layout_defs['EcmStockDocIns']['subpanel_setup']['ecmstockdocins'] = array (
'order' => 70,
'module' => 'EcmStockDocIns',
'sort_order' => 'asc',
'sort_by' => 'name',
'get_subpanel_data' => 'ecmstockdocins',
'add_subpanel_data' => 'correct_id',
'subpanel_name' => 'default',
'title_key' => 'LBL_ECMSTOCKDOCINS_SUBPANEL_TITLE',
);
}
?>

View File

@@ -0,0 +1,126 @@
<?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' => 'EcmStockDocIns'),
),
'where' => '',
'list_fields' => array(
'document_no' => array(
'name' => 'document_no',
'vname' => 'LBL_DOCUMENT_NO',
'module' => 'EcmStockDocIns',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '10%',
),
'parent_name' => array (
'name' => 'parent_name',
'vname' => 'Dostawca',
'module' => 'EcmStockDocIns',
'width' => '15%',
),
'register_date' => array(
'name' => 'register_date',
'vname' => 'LBL_REGISTER_DATE',
'module' => 'EcmStockDocIns',
'width' => '10%',
),
'QUANTITY' => array(
'name' => 'quantity',
'vname' => 'Ilość',
'align' => 'right',
'module' => 'EcmStockDocIns',
'width' => '10%',
),
'PRICE_NETTO' => array(
'name' => 'price_netto',
'vname' => 'Cena netto',
'align' => 'right',
'module' => 'EcmStockDocIns',
'width' => '10%',
),
'TOTAL_NETTO' => array(
'name' => 'total_netto',
'vname' => 'Wartość netto',
'align' => 'right',
'module' => 'EcmStockDocIns',
'width' => '10%',
),
'options' => array(
'name' => 'options',
'label' => '&nbsp;',
'default' => true,
'width' => '10%',
'sortable' => false,
),
'status' => array(
'name' => 'status',
'vname' => 'LBL_STATUS',
'module' => 'EcmStockDocIns',
'width' => '40%',
),
/*
'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,121 @@
<?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".
*/
error_reporting(0);
$subpanel_layout = array(
/*'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmStockDocIns'),
),*/
'where' => '',
'list_fields' => array (
'status' => array (
'name' => 'status',
'vname' => '&nbsp;',
'module' => 'EcmStockDocIns',
'width' => '1%',
'default'=>true,
),
'document_no' => array (
'name' => 'document_no',
'vname' => 'LBL_DOCUMENT_NO',
'module' => 'EcmStockDocIns',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '15%',
),
'parent_name' => array (
'name' => 'parent_name',
'vname' => 'Kontrahent',
'module' => 'EcmStockDocIns',
'width' => '40%'
),
'register_date' => array (
'name' => 'register_date',
'vname' => 'LBL_REGISTER_DATE',
'module' => 'EcmStockDocOuts',
'width' => '10%',
),
'price' => array (
'name' => 'price',
'vname' => 'Cena',
'module' => 'EcmStockDocIns',
'width' => '5%',
),
'quantity' => array (
'name' => 'quantity',
'vname' => 'Ilość',
'module' => 'EcmStockDocIns',
'width' => '5%',
),
'wartosc' => array (
'name' => 'wartosc',
'vname' => 'Wartość',
'module' => 'EcmStockDocIns',
'width' => '5%',
),
'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,60 @@
<?php
global $current_user;
$db=$GLOBALS['db'];
$query=$_SESSION[$current_user->id.'_pdf_ecmstockdocins'];
$result = $db->query($query);
$id=create_guid();
$files=[];
$focus = new EcmStockDocIn ();
while($dane=$db->fetchByAssoc($result)){
$focus->retrieve($dane['id']);
unlink("pdfkopie/".$focus->createPdfFileName());
$focus->getPDF ($focus->id,'F');
$db->query("insert into files set name='".$focus->createPdfFileName()."', executed=0, zlecenie_id='$id', email='".$current_user->email1."'");
}
echo "Generacja PDF została zlecona, za chwilę otrzymasz email z adresem do pobrania paczki.";
/*
include './PDFMerger.php';
//require_once('fpdi/fpdi.php');
require_once('fpdf2/fpdf2.php');
require_once('fpdi/fpdi.php');
foreach($files as $key=>$val){
$merge = new PDFMerger(false);
foreach ($files[$key] as $name){
if(is_file('pdfkopie/'.$name)){
echo './pdfkopie/'.$name.'<br>';
$merge->addPDF('pdfkopie/'.$name);
}
}
echo './pdfkopie/'.$key.'.pdf<br>';
$merge->merge("file",'pdfkopie/'.$key.'.pdf');
}
/*
$zip = new ZipArchive();
$filename = "pdfkopie/paczka.zip";
unlink($filename);
if ($zip->open($filename, ZipArchive::CREATE)!==TRUE) {
exit("cannot open <$filename>\n");
}
*/
?>

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,93 @@
<?php
$json = getJSONobj();
$pll = array(); $i=0; while(isset($_POST['p_'.$i])) { $pll[] = $json->decode(htmlspecialchars_decode($_POST['p_'.$i])); $_POST['p_'.$i] = ''; $i++;}
$_POST = $json->decode(htmlspecialchars_decode($_POST['otherFormData']));
$_POST['position_list'] = $pll;
if(isset($_REQUEST['record']) && $_REQUEST['record'] != '' && $_REQUEST['cache'] != "fromJava") {
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=EcmStockDocIns&action=previewPDF&to_pdf=1&method=I&record=".$_GET['record']."#toolbar=0&zoom=80%'>Yours browser not accept iframes!</iframe>";
} else {
require_once("modules/EcmStockDocIns/EcmStockDocIn.php");
$focus = new EcmStockDocIn();
$method = (isset($_REQUEST['method']) && $_REQUEST['method'] != '') ? $_REQUEST['method'] : 'D';
$focus->getPDF($_REQUEST['record'],$method);
}
} else
if($_REQUEST['cache'] == "fromJava" && $_GET['from']!="EcmStockDocIns") {
$_SESSION['PDF_ECMSTOCKDOCINS'] = $_POST;
} else
if($_GET['from']=="EcmStockDocIns") {
require_once("modules/EcmStockDocIns/EcmStockDocIn.php");
$focus = new EcmStockDocIn();
if(isset($_SESSION['PDF_ECMSTOCKDOCINS']['record']) && $_SESSION['PDF_ECMSTOCKDOCINS']['record'] != '') {
$focus->retrieve($_SESSION['PDF_ECMSTOCKDOCINS']['record']);
}
if(!$focus->ACLAccess('Save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
foreach($focus->column_fields as $field){
if(isset($_SESSION['PDF_ECMSTOCKDOCINS'][$field])){
$value = $_SESSION['PDF_ECMSTOCKDOCINS'][$field];
$focus->$field = $value;
}
}
foreach($focus->additional_column_fields as $field){
if(isset($_SESSION['PDF_ECMSTOCKDOCINS'][$field])){
$value = $_SESSION['PDF_ECMSTOCKDOCINS'][$field];
$focus->$field = $value;
}
}
if(isset($_SESSION['PDF_ECMSTOCKDOCINS']['to_is_vat_free']) && $_SESSION['PDF_ECMSTOCKDOCINS']['to_is_vat_free']) $focus->to_is_vat_free = 1; else $focus->to_is_vat_free = 0;
$json = getJSONobj();
$pl = $_SESSION['PDF_ECMSTOCKDOCINS']['position_list'];
$focus->position_list = $pl;
$focus->document_no = $_SESSION['PDF_ECMSTOCKDOCINS']['document_no'];
$focus->ecmpaymentcondition_text = EcmStockDocIn::getTranslation('EcmPaymentConditions',$focus->ecmpaymentcondition_id,$focus->ecmlanguage);
$focus->ecmdeliverycondition_text = EcmStockDocIn::getTranslation('EcmDeliveryConditions',$focus->ecmdeliverycondition_id,$focus->ecmlanguage);
$focus->getPDF();
}
?>

View File

@@ -0,0 +1,11 @@
<?php
$db = $GLOBALS['db'];
$object = new EcmStockDocIn();
$results = $object->get_full_list ( null);
foreach ($results as $result){
echo $results->document_no.'<br>';
}
?>

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/EcmStockDocIns/EcmStockDocIn.php');
$focus = new EcmStockDocIn();
$focus->retrieve($_REQUEST['record']);
$focus->format_all_fields();
}
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($focus, "EcmStockDocIns");
echo $subpanel->display();
}
?>

1236
modules/EcmStockDocIns/vardefs.php Executable file

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,186 @@
<?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".
* *******************************************************************************/
/*
* Created on Apr 13, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/EditView/EditView2.php');
class ViewEditEcmStockDocIns 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 ViewEditEcmStockDocIns(){
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,186 @@
<?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".
* *******************************************************************************/
/*
* Created on Apr 13, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once('include/EditView/EditView2.php');
class ViewEditEcmStockDocIns 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 ViewEditEcmStockDocIns(){
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,251 @@
<?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: This file is used to override the default Meta-data EditView behavior
* to provide customization specific to the Calls module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/views/view.list.php');
class EcmStockDocInsViewList extends ViewList{
function EcmStockDocInsViewList(){
parent::ViewList();
}
function display(){
if(!$this->bean->ACLAccess('list')){
ACLController::displayNoAccess();
return;
}
$this->module=$module = "EcmStockDocIns";
$metadataFile = null;
$foundViewDefs = false;
if(file_exists('custom/modules/' . $module. '/metadata/listviewdefs.php')){
$metadataFile = 'custom/modules/' . $module . '/metadata/listviewdefs.php';
$foundViewDefs = true;
}else{
if(file_exists('custom/modules/'.$module.'/metadata/metafiles.php')){
require_once('custom/modules/'.$module.'/metadata/metafiles.php');
if(!empty($metafiles[$module]['listviewdefs'])){
$metadataFile = $metafiles[$module]['listviewdefs'];
$foundViewDefs = true;
}
}elseif(file_exists('modules/'.$module.'/metadata/metafiles.php')){
require_once('modules/'.$module.'/metadata/metafiles.php');
if(!empty($metafiles[$module]['listviewdefs'])){
$metadataFile = $metafiles[$module]['listviewdefs'];
$foundViewDefs = true;
}
}
}
if(!$foundViewDefs && file_exists('modules/'.$module.'/metadata/listviewdefs.php')){
$metadataFile = 'modules/'.$module.'/metadata/listviewdefs.php';
}
require_once($metadataFile);
if(!empty($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select']!='_none') {
if(empty($_REQUEST['button']) && (empty($_REQUEST['clear_query']) || $_REQUEST['clear_query']!='true')) {
$this->saved_search = loadBean('SavedSearch');
$this->saved_search->retrieveSavedSearch($_REQUEST['saved_search_select']);
$this->saved_search->populateRequest();
}
elseif(!empty($_REQUEST['button'])) { // click the search button, after retrieving from saved_search
$_SESSION['LastSavedView'][$_REQUEST['module']] = '';
unset($_REQUEST['saved_search_select']);
unset($_REQUEST['saved_search_select_name']);
}
}
$storeQuery = new StoreQuery();
if(!isset($_REQUEST['query'])){
$storeQuery->loadQuery($this->module);
$storeQuery->populateRequest();
}else{
$storeQuery->saveFromRequest($this->module);
}
$seed = $this->bean;
$lv = new ListViewSmarty();
$displayColumns = array();
if(!empty($_REQUEST['displayColumns'])) {
foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
if(!empty($listViewDefs[$module][$col]))
$displayColumns[$col] = $listViewDefs[$module][$col];
}
}
else {
foreach($listViewDefs[$module] as $col => $params) {
if(!empty($params['default']) && $params['default'])
$displayColumns[$col] = $params;
}
}
$params = array('massupdate' => true, 'export'=>false);
$lv->quickViewLinks = false;
$lv->export = false;
$lv->mergeduplicates = false;
if(!empty($_REQUEST['orderBy'])) {
$params['orderBy'] = $_REQUEST['orderBy'];
$params['overrideOrder'] = true;
if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
}
$lv->displayColumns = $displayColumns;
$this->seed = $seed;
$this->module = $module;
$searchForm = null;
//search
$view = 'basic_search';
if(!empty($_REQUEST['search_form_view']))
$view = $_REQUEST['search_form_view'];
$headers = true;
if(!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only'])
$headers = false;
elseif(!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
if(isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
$view = 'advanced_search';
}else {
$view = 'basic_search';
}
}
$use_old_search = true;
if(file_exists('modules/'.$this->module.'/SearchForm.html')){
require_once('include/SearchForm/SearchForm.php');
$searchForm = new SearchForm($this->module, $this->seed);
}else{
$use_old_search = false;
require_once('include/SearchForm/SearchForm2.php');
if(!empty($metafiles[$this->module]['searchdefs']))
require_once($metafiles[$this->module]['searchdefs']);
elseif(file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
if (file_exists('custom/modules/'.$this->module.'/metadata/searchdefs.php'))
{
require_once('custom/modules/'.$this->module.'/metadata/searchdefs.php');
}
elseif (!empty($metafiles[$this->module]['searchdefs']))
{
require_once($metafiles[$this->module]['searchdefs']);
}
elseif (file_exists('modules/'.$this->module.'/metadata/searchdefs.php'))
{
require_once('modules/'.$this->module.'/metadata/searchdefs.php');
}
if(!empty($metafiles[$this->module]['searchfields']))
require_once($metafiles[$this->module]['searchfields']);
elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php'))
require_once('modules/'.$this->module.'/metadata/SearchFields.php');
$searchForm = new SearchForm($this->seed, $this->module, $this->action);
$searchForm->setup($searchdefs, $searchFields, 'include/SearchForm/tpls/SearchFormGeneric.tpl', $view, $listViewDefs);
$searchForm->lv = $lv;
}
if(isset($this->options['show_title']) && $this->options['show_title'] && (!isset($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] != "true")) {
$moduleName = isset($this->seed->module_dir) ? $this->seed->module_dir : $GLOBALS['mod_strings']['LBL_MODULE_NAME'];
echo "\n<p>\n";
echo get_module_title($moduleName, $GLOBALS['mod_strings']['LBL_MODULE_TITLE'], true);
echo "\n</p>\n";
}
$where = '';
if(isset($_REQUEST['query']))
{
// we have a query
if(!empty($_SERVER['HTTP_REFERER']) && preg_match('/action=EditView/', $_SERVER['HTTP_REFERER'])) { // from EditView cancel
$searchForm->populateFromArray($storeQuery->query);
}
else {
$searchForm->populateFromRequest();
}
$where_clauses = $searchForm->generateSearchWhere(true, $this->seed->module_dir);
if (count($where_clauses) > 0 )$where = '('. implode(' ) AND ( ', $where_clauses) . ')';
$GLOBALS['log']->info("List View Where Clause: $where");
}
if($use_old_search){
switch($view) {
case 'basic_search':
$searchForm->setup();
$searchForm->displayBasic($headers);
break;
case 'advanced_search':
$searchForm->setup();
$searchForm->displayAdvanced($headers);
break;
case 'saved_views':
echo $searchForm->displaySavedViews($listViewDefs, $lv, $headers);
break;
}
}else{
echo $searchForm->display($headers);
}
if(!$headers)
return;
if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
// $this->processQuickSearch();
$lv->setup($seed, 'include/ListView/ListViewGeneric.tpl', $where, $params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
echo get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'] . $savedSearchName, '', false);
echo $lv->display();
}
}
}
?>