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,198 @@
//categories
function saveItems3(){
document.getElementById('position_list3').value = ItemsList3(true);
}
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 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 ItemListSave3;
var ItemListClear3;
var ItemListFil3;
var FillText;
addEvent(
window,
'load',
function() {
var paramsTable3 = new paramsMT('itemsTable3');
paramsTable3.onCreateRow = function(row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function() {}
row.onSelect = function() {
}
row.onDeselect = function() {
}
}
paramsTable3.onCreateCell = function(cell) {
var i = cell.index;
if(i == 0) {
cell.setData = function(data) {
console.log(data);
if(data.ecmproductcategory_name) {
cell.firstChild.value = data.ecmproductcategory_name;
cell.getElementsByTagName('input')[1].value = data.ecmproductcategory_id;
if (data.id)
cell.getElementsByTagName('input')[2].value = data.id;
}
};
cell.getData = function(data) {
data.ecmproductcategory_name = cell.firstChild.value;
data.ecmproductcategory_id = cell.getElementsByTagName('input')[1].value;
data.id = cell.getElementsByTagName('input')[2].value;
}
cell.onSelect = function() {
var cn = this.getElementsByTagName('input');
cn[0].name = 'name_p';
cn[0].id = 'name_p';
cn[1].name = 'id_p';
cn[1].id = 'id_p';
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if(!ERROR) {
data.product_group = data.product_group;
this.setData(data);
}
var cn = this.getElementsByTagName('input');
cn[0].name = '';
cn[0].id = '';
cn[1].name = '';
cn[1].id = '';
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_IMG_SEARCH']);
img.setAttribute('src','modules/EcmQuotes/images/search.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
var ecmpopup = open_popup( "EcmProductCategories", 600, 400, "", true, false, {"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"id_p","name":"name_p"}}, "single", true );
setTimeout(function(){ecmpopup.focus();},200);
}
cell.appendChild(img);
}
if(i == 1) {
var img;
cell.style.padding="auto auto auto auto";
//insert
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_INSERT_NEW_ROW']);
img.setAttribute('src','modules/EcmQuotes/images/insertrow.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.myTable.addRow(this.parentNode.parentNode.index+1);
refreshPositionIndex();
};
//delete
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_DELETE_ROW']);
img.setAttribute('src','modules/EcmQuotes/images/deleterow.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.deleteRow(); refreshPositionIndex();};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
cell.appendChild(document.createElement('br'));
//move up
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_MOVE_ROW_UP']);
img.setAttribute('src','modules/EcmQuotes/images/moverowup.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveUp(); refreshPositionIndex();};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
//move down
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_MOVE_ROW_DOWN']);
img.setAttribute('src','modules/EcmQuotes/images/moverowdown.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveDown();refreshPositionIndex(); }
cell.appendChild(img);
}
}
ItemsList3 = function(json) {
var data = '';
for(var i=0; i<paramsTable3.rowCount(); i++) {
data = data + '||||' + JSON.stringifyNoSecurity(paramsTable3.row(i).getData());
}
return data;
}
if(paramsTable3.rowCount() == 0) {paramsTable3.addRow();};
paramsTable3.onSetCellData = function(row,cell,data) {
if(cell.innerHTML == '') cell.innerHTML = '&nbsp;';
}
ItemListFill3 = function() {
var pl;
pl = document.getElementById('position_list3').value;
console.log(pl);
if(pl && pl != '') {
try {
pl = eval(pl);
for(x in pl) { var pl_row = pl[x]; if (pl_row.template=='') continue; paramsTable3.addRow().setData(pl_row); }
} catch(err) { pl = null; };
}
}
ItemListClear3 = function(noNew,save) {
if(typeof(save)=="string") ItemListSave(null,save);
while(paramsTable3.rowCount()>0) paramsTable3.row(0).deleteRow(noNew);
}
ItemListClear3();
ItemListFill3();
var check_form_ = check_form;
check_form = function(formname) {
saveItems3();
return check_form_(formname);
}
}
);

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,792 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
/* * *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* ****************************************************************************** */
require_once ('include/upload_file.php');
// User is used to store Forecast information.
class Document extends SugarBean {
var $id;
var $document_name;
var $doc_symbol;
var $currency_value;
var $description;
var $document_date;
var $category_id;
var $subcategory_id;
var $status_id;
var $status;
var $created_by;
var $date_entered;
var $date_modified;
var $modified_user_id;
var $active_date;
var $exp_date;
var $document_revision_id;
var $filename;
var $img_name;
var $img_name_bare;
var $related_doc_id;
var $related_doc_name;
var $related_doc_rev_id;
var $related_doc_rev_number;
var $is_template;
var $template_type;
//additional fields.
var $revision;
var $last_rev_create_date;
var $last_rev_created_by;
var $last_rev_created_name;
var $file_url;
var $file_url_noimage;
var $table_name = "documents";
var $object_name = "Document";
var $user_preferences;
var $encodeFields = Array();
// This is used to retrieve related fields from form posts.
var $additional_column_fields = Array('revision');
var $new_schema = true;
var $module_dir = 'Documents';
var $save_file;
var $relationship_fields = Array(
'contract_id' => 'contracts',
);
function Document() {
parent :: SugarBean();
$this->setupCustomFields('Documents'); //parameter is module name
$this->disable_row_level_security = false;
}
function create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean, $singleSelect = false){
global $current_user;
$ret_array = parent::create_new_list_query($order_by, $where,$filter,$params, $show_deleted,$join_type, $return_array,$parentbean, $singleSelect);
// filtrowanie po dacie od do
// filtrowanie po dacie od do
$ret_array['where'] = str_replace("documents.date_start =", "documents.active_date > ", $ret_array['where']);
$ret_array['where'] = str_replace("documents.date_end =", "documents.active_date < ", $ret_array['where']);
$ret_array['where'] = preg_replace("/'%'(\w+)'%'/", '\'%${1}%\'', $ret_array['where']);
$ret_array['where'] = str_replace("((documents.assigned_user_id = '".$current_user->id."'))", "(documents.id IN (SELECT rr.document_id from documents_user rr where rr.user_id='".$current_user->id."' and rr.accepted = '0'))", $ret_array['where']);
return $ret_array;
}
function save($check_notify = false) {
if (empty($this->id) || $this->new_with_id) {
if (!empty($this->uploadfile)) {
$this->filename = $this->uploadfile;
if (empty($this->id)) {
$this->id = create_guid();
$this->new_with_id = true;
}
$Revision = new DocumentRevision();
//save revision.
$Revision->change_log = translate('DEF_CREATE_LOG', 'Documents');
$Revision->revision = $this->revision;
$Revision->document_id = $this->id;
$Revision->filename = $this->filename;
$Revision->file_ext = $this->file_ext;
$Revision->file_mime_type = $this->file_mime_type;
$Revision->save();
//Move file saved during populatefrompost to match the revision id rather than document id
rename(UploadFile :: get_url($this->filename, $this->id), UploadFile :: get_url($this->filename, $Revision->id));
//update document with latest revision id
$this->process_save_dates = false; //make sure that conversion does not happen again.
$this->document_revision_id = $Revision->id;
}
//set relationship field values if contract_id is passed (via subpanel create)
if (!empty($_POST['contract_id'])) {
$save_revision['document_revision_id'] = $this->document_revision_id;
$this->load_relationship('contracts');
$this->contracts->add($_POST['contract_id'], $save_revision);
}
if ((isset($_POST['load_signed_id']) and ! empty($_POST['load_signed_id']))) {
$query = "update linked_documents set deleted=1 where id='" . $_POST['load_signed_id'] . "'";
$this->db->query($query);
}
}
if($this->currency_value==0)$this->currency_value=null;
$return_id = parent::save ( $check_notify );
// kontrahent // do zapłąty wieksze od 0 i termin
//categories
$json = getJSONobj();
$pll = array();
$exp = explode("||||", $_POST['position_list3']);
foreach ($exp as $ep) {
if ($ep) {
$pll[] = $json->decode(htmlspecialchars_decode($ep));
}
}
$_POST['position_list3'] = $pll;
$this->savePositions3($_POST['position_list3']);
// save parent list
$pll = array();
$f=0;
foreach ($_POST['list_id'] as $key => $value) {
$pll[$key]['id'] = $_POST['list_id'][$key];
$pll[$key]['parent_name'] = $_POST['parent_name'][$key];
$pll[$key]['parent_type'] = $_POST['parent_type'][$key];
$pll[$key]['parent_id'] = $_POST['parent_id'][$key];
if($pll[$key]['parent_id']!='' && $pll[$key]['parent_type']=='Accounts' && $f==0){
$this->parent_id=$pll[$key]['parent_id'];
$this->parent_name=$pll[$key]['parent_name'];
$f=1;
}
}
$this->saveParentList($pll);
$vat_id = explode(',', $_POST['tblAppendGrid_rowOrder']);
$vat_array = array();
foreach ($vat_id as $value) {
$vat_array[$value]['netto'] = $_POST['tblAppendGrid_netto_' . $value];
$vat_array[$value]['vat'] = $_POST['tblAppendGrid_vat_' . $value];
$vat_array[$value]['vat_id'] = $_POST['tblAppendGrid_vat_id_' . $value];
$vat_array[$value]['vat_value'] = $_POST['tblAppendGrid_vat_value_' . $value];
}
$this->saveVatList($vat_array);
// and saving parent list
//save user list start Szparag
//var_dump($_POST['user_id']);
$plluser = array();
foreach ($_POST['user_id'] as $key => $value) {
$plluser[$key]['user_id'] = $_POST['user_id'][$key];
$plluser[$key]['accepted_description'] = $_POST['accepted_description'][$key];
$plluser[$key]['accepted'] = $_POST['accepted'][$key];
$plluser[$key]['date_accepted'] = $_POST['date_accepted'][$key];
}
$this->saveUserList($plluser);
$res=$this->db->fetchByAssoc($this->db->query("select id from ecmtransactions where record_id='".$return_id."'"));
if ($this->parent_name != '' && $this->parent_id != '' && $this->left_paid > 0 && $this->payment_date != '') {
if($res['id']=='')
$this->saveTransaction($return_id,$this->left_paid);
else {
$this->saveTransaction($return_id,$this->left_paid,$res['id']);
}
}
// var_dump($ppluser);
//save user list end
return $return_id;
}
function saveTransaction($id,$total_brutto,$tid = null) {
global $current_user;
$t = new EcmTransaction ();
if($edit==true){
$t->retrieve($tid);
}
$t->name = $this->document_name;
$t->record_type = 'Documents';
$t->record_id=$id;
$t->created_by = $current_user->id;
$t->deleted = 0;
$t->assigned_user_id = $this->assigned_user_id;
$t->parent_name = $this->parent_name;
$t->parent_id = $this->parent_id;
$t->payment_date =$this->payment_date;
$t->type = 1;
$t->register_date = $this->register_date;
$t->currency_id = $this->currency_id;
$t->currency_value = $this->currency_value;
$t->value = $total_brutto;
//MSHP
$a = new Account();
$a->retrieve($this->parent_id);
if ($a->parent_id == '1249') {
$aa = new Account();
$aa->retrieve('1249');
$t->parent_id = $aa->id;
$t->parent_name = $aa->name;
unset($aa);
}
unset($a);
$t->save (true);
}
function get_summary_text() {
return "$this->document_name";
}
function is_authenticated() {
return $this->authenticated;
}
function fill_in_additional_list_fields() {
$this->fill_in_additional_detail_fields();
}
function getVatList($array = false) {
if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM documents_vat WHERE document_id='" . $this->id . "' AND deleted='0' order by position";
$r = $this->db->query($query);
$return_array = array();
if ($r) {
while ($w = $this->db->fetchByAssoc($r)) {
$return_array [] = $w;
}
$json = getJSONobj();
return $array ? $return_array : $json->encode($return_array);
}
}
return $array ? false : '[]';
}
function saveVatList($pl) {
global $current_user;
$exists = array();
if ($this->id != '') {
$GLOBALS['db']->query("delete FROM documents_vat WHERE document_id='" . $this->id . "'");
}
$positon = 0;
foreach ($pl as $p) {
//insert new record
$id = create_guid();
$t = array(
$id,
$this->id,
addslashes($p['vat_value']),
addslashes($p['vat_id']),
addslashes($p['netto']),
'0',
addslashes($p['vat']),
$positon,
);
$q = "INSERT INTO documents_vat VALUES ('" . implode("','", $t) . "')";
$positon++;
$GLOBALS['db']->query($q);
$exists[] = $id;
}
//delete old
// $GLOBALS['db']->query("UPDATE accounts_websites SET deleted='1', modified_user_id='".$current_user->id."',date_modified = '".date("Y-m-d H:i:s")."' WHERE account_id='".$this->id."' AND id NOT IN ('".implode("','",$exists)."')");
}
function showVatList($array = false) {
if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM documents_vat WHERE document_id='" . $this->id . "' AND deleted='0'";
$r = $this->db->query($query);
$return_array = array();
if ($r) {
while ($w = $this->db->fetchByAssoc($r)) {
$return_array [] = $w;
}
$json = getJSONobj();
return $array ? $return_array : $return_array;
}
}
return $array ? false : '[]';
}
// multi connections start
function getParentList($array = false) {
if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM documents_accounts WHERE document_id='" . $this->id . "' AND deleted='0'";
$r = $this->db->query($query);
$return_array = array();
if ($r) {
while ($w = $this->db->fetchByAssoc($r)) {
if ($w['parent_type'] != '') {
$new = new $w['parent_type'];
$new->retrieve($w['parent_id']);
if (substr($w['parent_type'], 0, 3) != 'Ecm') {
$w['parent_name'] = htmlspecialchars($new->name);
} else {
$w['parent_name'] = htmlspecialchars($new->document_no);
}
unset($new);
}
$return_array [] = $w;
}
$json = getJSONobj();
return $array ? $return_array : $json->encode($return_array);
}
}
return $array ? false : '[]';
}
function showParentList($array = false) {
if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM documents_accounts WHERE document_id='" . $this->id . "' AND deleted='0'";
$r = $this->db->query($query);
$return_array = array();
if ($r) {
while ($w = $this->db->fetchByAssoc($r)) {
if ($w['parent_type'] != '') {
$new = new $w['parent_type'];
$new->retrieve($w['parent_id']);
if (substr($w['parent_type'], 0, 3) != 'Ecm') {
$w['parent_name'] = $new->name;
} else {
$w['parent_name'] = $new->document_no;
}
unset($new);
}
$return_array [] = $w;
}
$json = getJSONobj();
return $array ? $return_array : $return_array;
}
}
return $array ? false : '[]';
}
function saveParentList($pl) {
global $current_user;
$exists = array();
if ($this->id != '') {
$GLOBALS['db']->query("delete FROM documents_accounts WHERE document_id='" . $this->id . "'");
}
foreach ($pl as $p) {
if (!isset($p['parent_id']) || $p['parent_id'] == '')
continue;
//insert new record
$id = create_guid();
$t = array(
$id,
$this->id,
addslashes($p['parent_id']),
date("Y-m-d"),
addslashes(substr($p['parent_type'], 0, -1)),
'0',
date("Y-m-d"),
);
$q = "INSERT INTO documents_accounts VALUES ('" . implode("','", $t) . "')";
$GLOBALS['db']->query($q);
$exists[] = $id;
}
//delete old
// $GLOBALS['db']->query("UPDATE accounts_websites SET deleted='1', modified_user_id='".$current_user->id."',date_modified = '".date("Y-m-d H:i:s")."' WHERE account_id='".$this->id."' AND id NOT IN ('".implode("','",$exists)."')");
}
//Start UserList
function getUserList($array = false) {
if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM documents_user WHERE document_id='" . $this->id . "'";
$r = $this->db->query($query);
$return_array = array();
if ($r) {
while ($w = $this->db->fetchByAssoc($r)) {
$new = new User();
$new->retrieve($w['user_id']);
$w['user_name'] = $new->first_name . ' ' . $new->last_name;
unset($new);
$return_array [] = $w;
}
$json = getJSONobj();
return $array ? $return_array : $json->encode($return_array);
}
}
return $array ? false : '[]';
}
//save into Documents_user list
function saveUserList($pl) {
global $current_user;
$exists = array();
if ($this->id != '') {
$GLOBALS['db']->query("DELETE FROM documents_user WHERE document_id='" . $this->id . "'");
}
foreach ($pl as $p) {
if (!isset($p['user_id']) || $p['user_id'] == '')
continue;
//insert new record
$id = create_guid();
$t = array(
$id, //id
$this->id, //document id
addslashes($p['user_id']), //user id
date("Y.m.d"), //date entered
$p['date_accepted'], //date accepted
$p['accepted'], //status accepted
$p['accepted_description'], //status opis
);
$q = "INSERT INTO documents_user VALUES ('" . implode("','", $t) . "')";
echo $q;
$GLOBALS['db']->query($q);
$exists[] = $id;
}
//delete old
// $GLOBALS['db']->query("UPDATE accounts_websites SET deleted='1', modified_user_id='".$current_user->id."',date_modified = '".date("Y-m-d H:i:s")."' WHERE account_id='".$this->id."' AND id NOT IN ('".implode("','",$exists)."')");
}
function showUserList($array = false) {
if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM documents_user WHERE document_id='" . $this->id . "'";
$r = $this->db->query($query);
$return_array = array();
if ($r) {
while ($w = $this->db->fetchByAssoc($r)) {
$new = new User();
$new->retrieve($w['user_id']);
$w['user_name'] = $new->first_name . ' ' . $new->last_name;
unset($new);
$return_array [] = $w;
}
return $array ? $return_array : $return_array;
}
}
return $array ? false : '[]';
}
//End UserList
// multi connections end
function fill_in_additional_detail_fields() {
global $theme;
global $current_language;
global $timedate;
global $locale;
parent::fill_in_additional_detail_fields();
$mod_strings = return_module_language($current_language, 'Documents');
$query = "SELECT filename,revision,file_ext FROM document_revisions WHERE id='$this->document_revision_id'";
$result = $this->db->query($query);
$row = $this->db->fetchByAssoc($result);
//popuplate filename
if (isset($row['filename']))
$this->filename = $row['filename'];
//$this->latest_revision = $row['revision'];
if (isset($row['revision']))
$this->revision = $row['revision'];
//populate the file url.
//image is selected based on the extension name <ext>_icon_inline, extension is stored in document_revisions.
//if file is not found then default image file will be used.
global $img_name;
global $img_name_bare;
if (!empty($row['file_ext'])) {
$img_name = SugarThemeRegistry::current()->getImageURL(strtolower($row['file_ext']) . "_image_inline.gif");
$img_name_bare = strtolower($row['file_ext']) . "_image_inline";
}
//set default file name.
if (!empty($img_name) && file_exists($img_name)) {
$img_name = $img_name_bare;
} else {
$img_name = "def_image_inline"; //todo change the default image.
}
if ($this->ACLAccess('DetailView')) {
$this->file_url = "<a href='index.php?entryPoint=download&id=" . basename(UploadFile :: get_url($this->filename, $this->document_revision_id)) . "&type=Documents' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'alt="' . $mod_strings['LBL_LIST_VIEW_DOCUMENT'] . '" border="0"') . "</a>";
$this->file_url_noimage = basename(UploadFile :: get_url($this->filename, $this->document_revision_id));
} else {
$this->file_url = "";
$this->file_url_noimage = "";
}
//get last_rev_by user name.
$query = "SELECT first_name,last_name, document_revisions.date_entered as rev_date FROM users, document_revisions WHERE users.id = document_revisions.created_by and document_revisions.id = '$this->document_revision_id'";
$result = $this->db->query($query, true, "Eror fetching user name: ");
$row = $this->db->fetchByAssoc($result);
if (!empty($row)) {
$this->last_rev_created_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
$this->last_rev_create_date = $timedate->to_display_date_time($row['rev_date']);
}
global $app_list_strings;
if (!empty($this->status_id)) {
//_pp($this->status_id);
$this->status = $app_list_strings['document_status_dom'][$this->status_id];
}
$this->related_doc_name = Document::get_document_name($this->related_doc_id);
$this->related_doc_rev_number = DocumentRevision::get_document_revision_name($this->related_doc_rev_id);
$this->save_file = basename($this->file_url_noimage);
}
function list_view_parse_additional_sections(& $list_form, $xTemplateSection) {
return $list_form;
}
function create_export_query(&$order_by, &$where, $relate_link_join = '') {
$custom_join = $this->custom_fields->getJOIN(true, true, $where);
if ($custom_join)
$custom_join['join'] .= $relate_link_join;
$query = "SELECT
documents.*";
if ($custom_join) {
$query .= $custom_join['select'];
}
$query .= " FROM documents ";
if ($custom_join) {
$query .= $custom_join['join'];
}
$where_auto = " documents.deleted = 0";
if ($where != "")
$query .= " WHERE $where AND " . $where_auto;
else
$query .= " WHERE " . $where_auto;
if ($order_by != "")
$query .= " ORDER BY $order_by";
else
$query .= " ORDER BY documents.document_name";
return $query;
}
function get_list_view_data() {
global $current_language, $current_user;
$app_list_strings = return_app_list_strings_language($current_language);
$path = $GLOBALS['sugar_config']['upload_dir'] . basename(UploadFile :: get_url($this->filename, $this->document_revision_id));
$document_fields = $this->get_list_view_array();
$document_fields['FILE_URL'] = '<a href="' . $path . '" target="new"><img src="themes/Sugar5/images/def_image_inline.gif?s=bed8cd35065048ceebdc639ebe305e2c&c=1"/></a>'; //$this->file_url;
$document_fields['FILE_URL_NOIMAGE'] = $this->file_url_noimage;
$document_fields['LAST_REV_CREATED_BY'] = $this->last_rev_created_name;
$document_fields['CATEGORY_ID'] = empty($this->category_id) ? "" : $app_list_strings['document_category_dom'][$this->category_id];
$db = $GLOBALS['db'];
$r = $db->query('SELECT id,accepted,date_accepted,user_id,accepted_description from documents_user where user_id="' . $current_user->id . '" and document_id="' . $this->id . '"');
if ($r->num_rows > 0) {
$d = $db->fetchByAssoc($r);
if ($d['accepted'] == 0) {
$document_fields['TO_ACCEPT'] = '<a onclick="$( \'#userDiv_' . $d['id'] . '\' ).toggle(\'slow\');">Akceptuj</a><div id="userDiv_' . $d['id'] . '" style="display:none;">
<table class="olCgClass" style="width:200px;">
<tr><td>Opis</td></tr>
<tr><td><textarea name="userAcceptDes" id="userAcceptDes_' . $d['id'] . '" rows="4" style="width: 100%"></textarea></td></tr>
<tr><td>
<select id="statusik_' . $d['id'] . '">
<option value="1">Akceptuj</option>
<option value="0">Oczekuj</option>
<option value="2">Odrzuć</option>
</select>
<input type="button"
id="userSaveDes_' . $d['id'] . '"
value="Zapisz"
onclick="location.href=\'index.php?module=Documents&action=accept&status=\'+$(\'#statusik_' . $d['id'] . ' :selected\').val()+\'&record=' . $d['id'] . '&user_id=' . $d['user_id'] . '&doc_id=' . $this->id . '&des=\'+$(\'#userAcceptDes_' . $d['id'] . '\').val()+\'\'">
<input type="button" value ="Anuluj" id="userCancel_' . $d['id'] . '" onclick="$( \'#userDiv_' . $d['id'] . '\' ).toggle(\'slow\');">
</td></tr>
</table>
</div>';
} else {
$document_fields['TO_ACCEPT'] = '<a onclick="$( \'#userDiv_' . $d['id'] . '\' ).toggle(\'slow\');">Pokaż</a><div id="userDiv_' . $d['id'] . '" style="display:none;">
<table class="olCgClass" style="width:200px;">
<tr><td>Data: ' . date("d.m.Y", strtotime($d['id'])) . '</td></tr>
<tr><td>Opis: ' . str_replace('XVZC','<br>',$d['accepted_description']). '</td></tr>
<tr><td><input type="button" value ="Zamknij" id="userCancel_' . $d['id'] . '" onclick="$( \'#userDiv_' . $d['id'] . '\' ).toggle(\'slow\');"></td></tr>
</table>
</div>';
}
}
$this->retrieve($this->id);
$document_fields['VALUE']=number_format($document_fields['VALUE'], 2, '.', ',');
$r = $db->query('SELECT parent_id,parent_type from documents_accounts where document_id="' . $this->id . '" limit 1');
if ($r->num_rows > 0) {
$d = $db->fetchByAssoc($r);
$new = new $d['parent_type'];
$new->retrieve($d['parent_id']);
if (substr($d['parent_type'], 0, 3) != 'Ecm') {
$d['parent_name'] = $new->name;
} else {
$d['parent_name'] =$new->document_no;
}
$document_fields['PARENT_NAME'] = '<a href="index.php?module='.$d['parent_type'].'s&action=DetailView&record=' . $d['parent_id']. '" target="new">' .$d['parent_name'] . '</a>';
}
$tr = new EcmTransaction();
$tr->retrieve_by_string_fields(['record_id'=>$this->id]);
if($tr->id!=""){
if($tr->settled==1){
$document_fields['LEFT_PAID']="<span style='color: green;'>".format_number($this->left_paid)."</span>";
} else {
$document_fields['LEFT_PAID']="<span style='color: red;'>".format_number($this->left_paid)."</span>";
}
}
//$document_fields['DOCUMENT_NAME_JAVASCRIPT'] = $GLOBALS['db']->helper->escape_quote($document_fields['DOCUMENT_NAME']);
return $document_fields;
}
function mark_relationships_deleted($id) {
//do nothing, this call is here to avoid default delete processing since
//delete.php handles deletion of document revisions.
}
function bean_implements($interface) {
switch ($interface) {
case 'ACL' :
return true;
}
return false;
}
//static function.
function get_document_name($doc_id) {
if (empty($doc_id))
return null;
$db = DBManagerFactory::getInstance();
$query = "select document_name from documents where id='$doc_id'";
$result = $db->query($query);
if (!empty($result)) {
$row = $db->fetchByAssoc($result);
if (!empty($row)) {
return $row['document_name'];
}
}
return null;
}
//start managing categories
function savePositions3($pl) {
global $current_user;
$exists = array();
//$GLOBALS['db']->query("INSERT INTO log VALUES ('".addslashes(json_encode($pl))."')");
foreach ($pl as $p) {
if (!isset($p['ecmproductcategory_id']) || $p['ecmproductcategory_id'] == '')
continue;
if (isset($p['id']) && $p['id'] != '') {
//update exists
$q = "
UPDATE ecmproductcategories_bean set
date_modified = '" . date("Y-m-d H:i:s") . "',
modified_user_id = '" . $current_user->id . "',
bean_id = '" . addslashes($this->id) . "',
ecmproductcategory_id = '" . addslashes($p['ecmproductcategory_id']) . "'
WHERE id = '" . $p['id'] . "'
";
//$GLOBALS['db']->query("INSERT INTO log VALUES ('".addslashes($q)."')");
$GLOBALS['db']->query($q);
$exists[] = $p['id'];
} else {
//insert new record
$id = create_guid();
$t = array(
$id,
addslashes($p['ecmproductcategory_id']),
$this->id,
"Documents",
date("Y-m-d H:i:s"),
date("Y-m-d H:i:s"),
$current_user->id,
$current_user->id,
'0'
);
$q = "INSERT INTO ecmproductcategories_bean VALUES ('" . implode("','", $t) . "')";
$GLOBALS['db']->query($q);
$exists[] = $id;
}
}
//delete old
$GLOBALS['db']->query("UPDATE ecmproductcategories_bean SET deleted='1', modified_user_id='" . $current_user->id . "',date_modified = '" . date("Y-m-d H:i:s") . "' WHERE bean_id='" . $this->id . "' AND id NOT IN ('" . implode("','", $exists) . "')");
}
function getPositionList3($array = false) {
if (isset($this->id) && $this->id != '') {
$query = "SELECT * FROM ecmproductcategories_bean WHERE bean_id='" . $this->id . "' AND deleted='0' AND bean_name='Documents'";
$r = $this->db->query($query);
$return_array = array();
if ($r) {
while ($w = $this->db->fetchByAssoc($r)) {
//get category name && assigned_file
$n = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT name, assigned_file FROM ecmproductcategories WHERE id='" . $w['ecmproductcategory_id'] . "'"));
$w['ecmproductcategory_name'] = $n['name'];
$w['assigned_file'] = $n['assigned_file'];
$return_array [] = $w;
}
$json = getJSONobj();
return $array ? $return_array : $json->encode($return_array);
}
}
return $array ? false : '[]';
}
function showPositions3() {
$arr = $this->getPositionList3(true);
global $mod_strings;
if (count($arr) > 0) {
$table = '
<table cellpadding="0" cellspacing="0" border="0" class="list view" width="40%">
<tr class="oddListRowS1">
<th><b>' . $mod_strings['LBL_CATEGORY_NAME'] . '</b></td>
<th><b>' . $mod_strings['LBL_CATEGORY_ASSIGNED_FILE'] . '</b></td>
</tr>
';
$i == 0;
foreach ($arr as $a) {
$i++;
//assigned file
if ($a['assigned_file'] != "" && $a['assigned_file']) {
$tmp = explode(".", $a['assigned_file']);
if (end($tmp) == 'jpeg' || end($tmp) == 'jpg' || end($tmp) == 'png' || end($tmp) == 'bmp')
$af = '<img src="modules/EcmProductCategories/files/' . $a['assigned_file'] . '"/>';
else
$af = '<a href="modules/EcmProductCategories/files/' . $a['assigned_file'] . '" target="new">' . $a['assigned_file'] . '</a>';
}
$table.='
<tr class="oddListRowS1">
<td valign="top" class="oddListRowS1" style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;"><a href="index.php?module=EcmProductCategories&action=DetailView&record=' . $a['ecmproductcategory_id'] . '">' . $a['ecmproductcategory_name'] . '</a></td>
<td valign="top" class="oddListRowS1" style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">' . $af . '</td>
';
}
$table.='</table>';
}
return $table;
}
//end managing categories
}
?>

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,19 @@
<?php
global $current_user;
if ($_REQUEST['user_id'] == $current_user->id) {
//$GLOBALS['db']->query("UPDATE documents_user SET accepted='".$_REQUEST['status']."', date_accepted=NOW(), accepted_description='".$_REQUEST['des']."' WHERE id='".$_REQUEST['record']."'");
$sqlSelect = "SELECT accepted_description FROM documents_user WHERE id='" . $_REQUEST['record'] . "'";
$stary = $GLOBALS['db']->getOne($sqlSelect);
$tekst = '';
if ($stary == NULL) {
$tekst = date('d.m.Y H.i:s').' - '. $_REQUEST['des'];
} else {
$tekst = date('d.m.Y H.i:s').' - '. $_REQUEST['des'].'XVZC'. $stary;
}
$sqlUpdate = "UPDATE documents_user SET accepted='" . $_REQUEST['status'] . "', date_accepted=NOW(), accepted_description='" . $tekst . "' WHERE id='" . $_REQUEST['record'] . "'";
echo $sqlUpdate;
$GLOBALS['db']->query($sqlUpdate);
header('Location: index.php?module=Documents&action=DetailView&record='.$_REQUEST['doc_id']);
};
?>

View File

@@ -0,0 +1,17 @@
<?php
global $current_user;
$db=$GLOBALS['db'];
if($_REQUEST['mass']!=""){
$ids=$_REQUEST['mass'];
if($current_user->is_admin==1){
$db=$GLOBALS['db'];
$db->query("update documents set status='".$_REQUEST['return_module']."' where id in ('".implode("','",$ids)."')");
}
}
header("Location: index.php?module=Documents&action=ListView");
?>

View File

@@ -0,0 +1,48 @@
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
var rhandle=new RevisionListHandler();var from_popup_return=false;function document_set_return(popup_reply_data)
{from_popup_return=true;var form_name=popup_reply_data.form_name;var name_to_value_array=popup_reply_data.name_to_value_array;related_doc_id='EMPTY';for(var the_key in name_to_value_array)
{if(the_key=='toJSON')
{}
else
{var displayValue=name_to_value_array[the_key];displayValue=displayValue.replace('&#039;',"'");displayValue=displayValue.replace('&amp;',"&");displayValue=displayValue.replace('&gt;',">");displayValue=displayValue.replace('&lt;',"<");displayValue=displayValue.replace('&quot; ',"\"");if(the_key=='related_doc_id'){related_doc_id=displayValue;}
window.document.forms[form_name].elements[the_key].value=displayValue;}}
related_doc_id=JSON.stringifyNoSecurity(related_doc_id);var conditions=new Array();conditions[conditions.length]={"name":"document_id","op":"starts_with","value":related_doc_id};var query=new Array();var query={"module":"DocumentRevisions","field_list":['id','revision','date_entered'],"conditions":conditions,"order":'date_entered desc'};result=global_rpcClient.call_method('query',query,true);rhandle.display(result);}
function RevisionListHandler(){}
RevisionListHandler.prototype.display=function(result){var names=result['list'];var rev_tag=document.getElementById('related_doc_rev_id');rev_tag.options.length=0;for(i=0;i<names.length;i++){rev_tag.options[i]=new Option(names[i].fields['revision'],names[i].fields['id'],false,false);}
rev_tag.disabled=false;}
function setvalue(source){src=new String(source.value);target=new String(source.form.document_name.value);if(target.length==0){lastindex=src.lastIndexOf("/");if(lastindex==-1){lastindex=src.lastIndexOf("\\");}
if(lastindex==-1){source.form.document_name.value=src;source.form.escaped_document_name.value=src;}else{source.form.document_name.value=src.substr(++lastindex,src.length);source.form.escaped_document_name.value=src.substr(lastindex,src.length);}}}
function toggle_template_type(istemplate){template_type=document.getElementById('template_type');if(istemplate.checked){template_type.disabled=false;}else{template_type.disabled=true;}}

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,138 @@
var options = ["invoice","compain_note","return_note"];
$(document).ready(function () {
// parent Edit list
ParentEditList();
// tabelka z vatami
InitializeVatTable();
// Przypisani uzytkownicy
UserListEdit();
InitializeTableCost();
$("#currency_id").change(function() {
getNBPCurrencyExchange($("#currency_id :selected").val());
});
var previousVal;
var pollInterval = setInterval(function() {
var val = $('#document_date').val();
if (val !== previousVal) {
console.log('hmm');
getNBPCurrencyExchange($("#currency_id :selected").val());
}
previousVal = val;
}, 500);
$('#category_id').on('change',function(){
if($.inArray($("#category_id").val(),options)>-1){
addToValidate('EditView', 'value','value',true,'Proszę wpisać kwotę dokumentu!');
addToValidate('EditView', 'document_date','document_date',true,'Proszę wybrać datę dokumentu!');
} else {
removeFromValidate('EditView', 'value');
removeFromValidate('EditView', 'document_date');
}
});
});
var check_form_ = check_form;
check_form = function (formname) {
window.onbeforeunload = null;
// unformat vat table positions before save
if($('#document_type').val()==""){
alert("Proszę wybrać typ faktury!");
return false;
}
var int;
if($.inArray($("#category_id").val(),options)>-1){
if ($("#value").val()=="") {
alert("Wartość dokumentu nie może być pusta!");
return false;
}
}
if ($("#currency_id").val()!="PLN") {
if($('#currency_value').val()==""){
alert("Proszę podać kurs waluty!");
return false;
}
}
if($.inArray($("#category_id").val(),options)>-1){
if (UnformatNumber($("#value").val())==0) {
alert("Wartość dokumentu nie może być równa zeru!");
return false;
}
if ($("#value").val()=="") {
alert("Wartość dokumentu nie może być pusta!");
}
if ($("#left_paid").val() != '') {
if($('#payment_date').val()==''){
alert('Wpisałeś kwotę do zapłaty, podaj termin płatności!');
return false;
} else {
// int=$("#left_paid").val(UnformatNumber($("#left_paid").val()));
// $("#value").val(UnformatNumber($("#value").val()));
}
} else {
// $("#value").val(UnformatNumber($("#value").val()));
}
var count = $('#tblAppendGrid').appendGrid('getRowCount');
var netto=0;
var vat=0;
for (var i = 0; i < count; i++) {
var data2 = $('#tblAppendGrid').appendGrid('getRowValue', i);
var netto_position = parseFloat(UnformatNumber(data2.netto));
if(!isNaN(netto_position)){
netto = netto+netto_position;
}
var vat_position=parseFloat(UnformatNumber(data2.vat));
if(!isNaN(vat_position)){
vat = vat+vat_position;
}
}
var total = netto + vat;
total = total.toFixed(2);
if(parseFloat(total)!==parseFloat(UnformatNumber($('#value').val()))){
alert("Wartość dokumentu powinna być identyczna jak łączna wartość z tabelki Stawki VAT!");
return false;
}
}
if(check_form_(formname)==false){
return false;
} else {
var count = $('#tblAppendGrid').appendGrid('getRowCount');
for (var i = 0; i < count; i++) {
var data2 = $('#tblAppendGrid').appendGrid('getRowValue', i);
$('#tblAppendGrid').appendGrid('setCtrlValue', 'vat', i, UnformatNumber(data2.vat));
$('#tblAppendGrid').appendGrid('setCtrlValue', 'netto', i, UnformatNumber(data2.netto));
// $("#value").val(UnformatNumber($("#value").val()));
}
$("#value").val(UnformatNumber($("#value").val()));
$("#currency_value").val(UnformatNumber($("#currency_value").val()));
$("#left_paid").val(UnformatNumber($("#left_paid").val()));
return true;
}
};

View File

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

View File

@@ -0,0 +1,171 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
/**
* *******************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License.
* You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
* ******************************************************************************
*/
/**
* *******************************************************************************
* pl_pl.lang.ext.php,v for SugarCRM 4.5.1-->>
* Translator: Krzysztof Morawski
* All Rights Reserved.
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
* Contributor(s): ______________________________________..
* ******************************************************************************
*/
$mod_strings = array (
// module
'LBL_CURRENCY_VALUE' => 'Kurs',
'LBL_REVISIONS_PANEL' => 'Wersje',
'LBL_VALUE' => 'Wartość',
'LBL_PAYMENT_DATE'=>'Termin płatności',
'LBL_DOCUMENT_DATE' => 'Data dokumentu',
'LBL_PARENT_NAME' => 'Powiązane z',
'LBL_DOCUMENT_INFORMATION' => 'Szczegóły dokumentu',
'LBL_PANEL_CATEGORIES' => 'Kategorie',
'LBL_CATEGORY_NAME' => 'Nazwa kategorii',
'LBL_MODULE_NAME' => 'Dokumenty',
'LBL_MODULE_TITLE' => 'Dokumenty: Strona główna',
'LNK_NEW_DOCUMENT' => 'Utwórz dokument',
'LNK_DOCUMENT_LIST' => 'Lista dokumentów',
'LBL_DOC_REV_HEADER' => 'Wersja dokumentu',
'LBL_SEARCH_FORM_TITLE' => 'Szukanie dokumentów',
// vardef labels
'LBL_USERS_NAME'=>'Przypisani użytkownicy',
'LBL_VALUE_PAID'=>'Do zapłaty',
'LBL_DOCUMENT_ID' => 'ID dokumentu',
'LBL_NAME' => 'Nazwa dokumentu',
'LBL_DESCRIPTION' => 'Opis',
'LBL_CATEGORY' => 'Kategoria',
'LBL_TO_ACCEPT_LIST'=>'Do zaakceptowania',
'LBL_SUBCATEGORY' => 'Podkategoria',
'LBL_STATUS' => 'Status',
'LBL_TO_ACCEPT'=>'Moje Zaakceptowane',
'LBL_CREATED_BY' => 'Utworzony przez',
'LBL_DATE_ENTERED' => 'Data wprowadzenia',
'LBL_DATE_MODIFIED' => 'Data modyfikacji',
'LBL_DELETED' => 'Usunięty',
'LBL_CURRENCY'=>'Waluta',
'LBL_MODIFIED' => 'Zmodyfikowany przez ID',
'LBL_MODIFIED_USER' => 'Zmodyfikowany przez',
'LBL_CREATED' => 'Utworzony przez',
'LBL_REVISIONS' => 'Wersje',
'LBL_RELATED_DOCUMENT_ID' => 'ID dokumentów połączonych',
'LBL_RELATED_DOCUMENT_REVISION_ID' => 'ID wersji dokumentów połączonych',
'LBL_IS_TEMPLATE' => 'Jest szablonem',
'LBL_TEMPLATE_TYPE' => 'Typ dokumentu',
'LBL_ASSIGNED_TO_NAME' => 'Przydzielone do:',
'LBL_REVISION_NAME' => 'Numer wersji',
'LBL_MIME' => 'Typ mime',
'LBL_DATE_START'=>'Data od',
'LBL_DATE_END'=>'Data do',
'LBL_REVISION' => 'Wersja',
'LBL_DOCUMENT' => 'Połączone dokumenty',
'LBL_LATEST_REVISION' => 'Najnowsza wersja',
'LBL_CHANGE_LOG' => 'Dziennik zmian',
'LBL_ACTIVE_DATE' => 'Data publikacji',
'LBL_EXPIRATION_DATE' => 'Data wyganiecia',
'LBL_FILE_EXTENSION' => 'Rozszerzenie pliku',
'LBL_CAT_OR_SUBCAT_UNSPEC' => 'Niesprecyzowany',
'LBL_PANEL_CATEGORIES2'=>'Stawki VAT',
'LBL_PANEL_TABLE_CAT'=>'Tabelka',
// quick search
'LBL_NEW_FORM_TITLE' => 'Nowy dokument',
// document edit and detail view
'LBL_DOC_NAME' => 'Nazwa dokumentu:',
'LBL_FILENAME' => 'Nazwa pliku:',
'LBL_DOC_VERSION' => 'Wersja:',
'LBL_CATEGORY_VALUE' => 'Kategoria:',
'LBL_SUBCATEGORY_VALUE' => 'Podkategoria:',
'LBL_DOC_STATUS' => 'Status:',
'LBL_LAST_REV_CREATOR' => 'Wersja utworzona przez:',
'LBL_LAST_REV_DATE' => 'Data wersji:',
'LBL_DOWNNLOAD_FILE' => 'Ściągnij plik:',
'LBL_DET_RELATED_DOCUMENT' => 'Dokumenty połączone:',
'LBL_DET_RELATED_DOCUMENT_VERSION' => "Wersja dokumentów połaczonych:",
'LBL_DET_IS_TEMPLATE' => 'Szkic? :',
'LBL_DET_TEMPLATE_TYPE' => 'Typ dokumentu:',
'LBL_TEAM' => 'Zespół:',
'LBL_DOC_DESCRIPTION' => 'Opis:',
'LBL_DOC_ACTIVE_DATE' => 'Data publikacji:',
'LBL_DOC_EXP_DATE' => 'Data wygaśnięcia:',
// document list view.
'LBL_LIST_FORM_TITLE' => 'Lista dokumentów',
'LBL_LIST_DOCUMENT' => 'Dokument',
'LBL_LIST_CATEGORY' => 'Kategoria',
'LBL_LIST_SUBCATEGORY' => 'Podkategoria',
'LBL_LIST_REVISION' => 'Wersja',
'LBL_LIST_LAST_REV_CREATOR' => 'Opublikowany przez',
'LBL_LIST_LAST_REV_DATE' => 'Data wersji',
'LBL_LIST_VIEW_DOCUMENT' => 'Podgląd',
'LBL_LIST_DOWNLOAD' => 'Pobierz',
'LBL_LIST_ACTIVE_DATE' => 'Data publikacji',
'LBL_LIST_EXP_DATE' => 'Data wygaśnięcia',
'LBL_LIST_STATUS' => 'Status',
// document search form.
'LBL_SF_DOCUMENT' => 'Nazwa dokumentu:',
'LBL_SF_CATEGORY' => 'Kategoria:',
'LBL_SF_SUBCATEGORY' => 'Podkategoria:',
'LBL_SF_ACTIVE_DATE' => 'Data publikacji:',
'LBL_SF_EXP_DATE' => 'Data wygaśnięcia:',
'DEF_CREATE_LOG' => 'Dokument utworzony przez',
// error messages
'ERR_DOC_NAME' => 'Nazwa dokumentu',
'ERR_DOC_ACTIVE_DATE' => 'Data publikacji',
'ERR_DOC_EXP_DATE' => 'Data wygaśniecia',
'ERR_FILENAME' => 'Nazwa pliku',
'ERR_DOC_VERSION' => 'Wersja dokumentu',
'ERR_DELETE_CONFIRM' => 'Czy chcesz usunąć tę wersję dokumentu?',
'ERR_DELETE_LATEST_VERSION' => 'Nie jesteś uprawiony do usunięcia najnowszej wersji dokumentu.',
'LNK_NEW_MAIL_MERGE' => 'Scalanie poczty',
'LBL_MAIL_MERGE_DOCUMENT' => 'Szablon scalania poczty:',
'LBL_TREE_TITLE' => 'Dokumenty',
// sub-panel vardefs.
'LBL_LIST_DOCUMENT_NAME' => 'Nazwa dokument',
'LBL_CONTRACT_NAME' => 'Nazwa kontraktu:',
'LBL_LIST_IS_TEMPLATE' => 'Szkic?',
'LBL_LIST_TEMPLATE_TYPE' => 'Typ dokumentu',
'LBL_LIST_SELECTED_REVISION' => 'Wybrane wersje',
'LBL_LIST_LATEST_REVISION' => 'Najnowsze wydanie',
'LBL_CONTRACTS_SUBPANEL_TITLE' => 'Połączone kontrakty',
'LBL_LAST_REV_CREATE_DATE' => 'Data utworzenia ostatniego wydania',
// 'LNK_DOCUMENT_CAT'=>'Document Categories',
'LBL_CONTRACTS' => 'Kontrakty',
'LBL_CREATED_USER' => 'Użytkownik tworzący',
'LBL_THEREVISIONS_SUBPANEL_TITLE' => 'Rewersje'
)
;
?>

View File

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

View File

@@ -0,0 +1,182 @@
<?php
$viewdefs ['Documents'] = array (
'DetailView' => array (
'templateMeta' => array (
'maxColumns' => '2',
'form' => array (
'hidden' => array (
0 => '<input type="hidden" name="old_id" value="{$fields.document_revision_id.value}">'
),
'buttons' => array (
0 => array (
'customCode' => '{if $EDIT_ENABLE==1}<input title="Edytuj [Alt+E]" accesskey="E" class="button primary" onclick="this.form.return_module.value=\'Documents\'; this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$fields.id.value}\'; this.form.action.value=\'EditView\';" type="submit" name="Edit" id="edit_button" value="Edytuj">{/if}'
),
1 => array (
'customCode' => '{if $EDIT_ENABLE==1}<input title="Usuń [Alt+D]" accesskey="E" class="button primary" onclick="{literal}var r = confirm(\'Czy napewno usunąć ten dokument?\');if (r == true) {$(\'#delete_button\').attr(\'type\',\'submit\');this.form.return_module.value=\'Documents\';this.form.return_action.value=\'ListView\'; this.form.return_id.value=\'{/literal}{$fields.id.value}{literal}\'; this.form.action.value=\'Delete\';} else {$(\'#delete_button\').attr(\'type\',\'button\');}{/literal}" type="submit" name="delete" id="delete_button" value="Usuń">{/if}'
)
)
),
'widths' => array (
0 => array (
'label' => '10',
'field' => '30'
),
1 => array (
'label' => '10',
'field' => '30'
)
)
),
'panels' => array (
'LBL_DOCUMENT_INFORMATION' => array (
0 => array (
0 => array (
'name' => 'filename',
'displayParams' => array (
'link' => 'filename',
'id' => 'document_revision_id'
)
),
1 => array (
'name' => 'status',
'comment' => 'Document status for Meta-Data framework',
'label' => 'LBL_DOC_STATUS'
)
),
1 => array (
0 => array (
'name' => 'document_name',
'label' => 'LBL_DOC_NAME'
),
1 => array (
'name' => 'revision',
'label' => 'LBL_DOC_VERSION'
)
),
2 => array (
0 => array (
'name' => 'active_date',
'label' => 'LBL_DOC_ACTIVE_DATE'
),
1 => array (
'name' => 'parent_name',
'label' => 'LBL_PARENT_NAME'
)
),
4 => array (
0 => array (
'name' => 'related_doc_name',
'comment' => 'The related document name for Meta-Data framework',
'label' => 'LBL_DET_RELATED_DOCUMENT'
),
1 => array (
'name' => 'related_doc_rev_number',
'comment' => 'The related document version number for Meta-Data framework',
'label' => 'LBL_DET_RELATED_DOCUMENT_VERSION'
)
),
5 => array (
0 => array (
'name' => 'value',
'label' => 'LBL_VALUE'
),
1 => array (
'name' => 'left_paid',
'label' => 'LBL_VALUE_PAID'
)
),
6 => array (
0 => array (
'name' => 'payment_date'
),
1 => array (
'name' => 'currency_id',
'label' => 'LBL_CURRENCY'
)
),
7 => array (
'corrected_document_name',
'currency_value'
),
8 => array (
0 => array (
'name' => 'items_list_panel',
'hideLabel' => false,
'label' => 'Powiązane z',
'customCode' => " {include file='modules/Documents/tpl/parentlist_DetailView.tpl'}"
/*
* <input type="hidden" name="websites_list" id="websites_list" value=\'{$WEBSITES_LIST}\'>
* <div style="width:30%;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="itemsTableDIV2">
*
* </div><br>',
*/
),
1 => array (
'name' => 'items_list_panel',
'hideLabel' => false,
'label' => 'LBL_USERS_NAME',
'customCode' => " {include file='modules/Documents/tpl/userlist_DetailView.tpl'}"
/*
* <input type="hidden" name="websites_list" id="websites_list" value=\'{$WEBSITES_LIST}\'>
* <div style="width:30%;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="itemsTableDIV2">
* </div><br>',
*/
)
),
9 => array (
0 => array (
'name' => 'document_date',
'label' => 'LBL_DOCUMENT_DATE'
),
1 => array (
'name' => 'document_type',
'label' => 'Typ faktury'
),
)
),
'LBL_PANEL_CATEGORIES' => array (
0 => array (
0 => array (
'name' => 'items_list_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '{$POSITIONS3}'
)
)
),
'Stawki VAT' => array (
0 => array (
0 => array (
'name' => 'items_list_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => " {include file='modules/Documents/tpl/vatlist_DetailView.tpl'}"
)
)
),
'LBL_REVISIONS_PANEL' => array (
0 => array (
0 => array (
'name' => 'last_rev_created_name',
'label' => 'LBL_LAST_REV_CREATOR'
),
1 => array (
'name' => 'last_rev_create_date',
'label' => 'LBL_LAST_REV_CREATE_DATE'
)
)
)
)
)
);
?>

View File

@@ -0,0 +1,204 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$viewdefs['Documents']['EditView'] = array(
'templateMeta' => array(
'form' => array(
'enctype' => 'multipart/form-data',
'hidden' => array(
0 => '<input type="hidden" name="old_id" value="{$fields.document_revision_id.value}">',
1 => '<input type="hidden" name="vat_list" id="vat_list" value=\'{$VAT_LIST|@json_encode}\'>'
)
),
'maxColumns' => '2',
'widths' => array(
0 => array(
'label' => '10',
'field' => '30'
),
1 => array(
'label' => '10',
'field' => '30'
)
),
'javascript' => '<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/jsolait/init.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/jsolait/lib/urllib.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="include/javascript/jsclass_base.js"></script>
<script type="text/javascript" src="include/javascript/jsclass_async.js"></script>
<script type="text/javascript" src="include/JSON.js?s={$SUGAR_VERSION}"></script>
<script type="text/javascript" src="modules/Documents/Documents2.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<link rel="stylesheet" type="text/css" href="modules/Accounts/MyTable.css" />',
'includes' => array(
0 => array(
'file' => 'include/JSON.js'
),
)
),
'panels' => array(
'lbl_document_information' => array(
0 => array(
0 => array(
'name' => 'uploadfile',
'customCode' => '<input type="hidden" name="escaped_document_name"><input name="uploadfile" type="{$FILE_OR_HIDDEN}" size="30" maxlength="" onchange="setvalue(this);" value="{$fields.filename.value}">{$fields.filename.value}'
)
),
1 => array(
0 => array(
'name' => 'document_name',
'label' => 'LBL_NAME'
),
1 => array(
'name' => 'revision',
'customCode' => '<input name="revision" type="text" value="{$fields.revision.value}" {$DISABLED}>'
)
),
2 => array(
0 => array(
'name' => 'active_date'
),
1 => array(
'name' => 'category_id',
'label' => 'LBL_SF_CATEGORY'
)
),
3 => array(
0 => array(
'name' => 'related_doc_name',
'customCode' => '<input name="related_document_name" type="text" size="30" maxlength="255" value="{$RELATED_DOCUMENT_NAME}" readonly><input name="related_doc_id" type="hidden" value="{$fields.related_doc_id.value}"/>&nbsp;<input title="{$APP.LBL_SELECT_BUTTON_TITLE}" accessKey="{$APP.LBL_SELECT_BUTTON_KEY}" type="{$RELATED_DOCUMENT_BUTTON_AVAILABILITY}" class="button" value="{$APP.LBL_SELECT_BUTTON_LABEL}" name="btn2" onclick=\'open_popup("Documents", 600, 400, "", true, false, {$encoded_document_popup_request_data}, "single", true);\'/>'
),
1 => array(
'name' => 'related_doc_rev_number',
'customCode' => '<select name="related_doc_rev_id" id="related_doc_rev_id" {$RELATED_DOCUMENT_REVISION_DISABLED}>{$RELATED_DOCUMENT_REVISION_OPTIONS}</select>'
)
),
4 => array(
0 => array(
'name' => 'description'
),
'status'
),
5 => array(
0 => array(
'name' => 'value',
'label' => 'LBL_VALUE',
'customCode' => '<input name="value" id="value" type="text" onclick="$(this).select();" onchange="$(this).val(FormatNumber($(this).val(),undefined));" value="{if $fields.value.value!=""}{$fields.value.value|number_format:2:",":"."}{/if}"/>',
),
1 => array(
'name' => 'left_paid',
'label' => 'LBL_VALUE_PAID',
'customCode' => '<input name="left_paid" id="left_paid" type="text" onclick="$(this).select();" onchange="$(this).val(FormatNumber($(this).val(),undefined));" value="{if $fields.left_paid.value!=""}{$fields.left_paid.value|number_format:2:",":"."}{/if}"/>',
)
),
6 => array(
0 => array(
'name' => 'payment_date'
),
1 => array(
'name' => 'currency_id',
'label' => 'LBL_CURRENCY'
)
)
,
7 => array (
0 => array(
'name' => 'corrected_document_name'
),
'',
1 => array(
'name' => 'currency_value',
'label' => 'Kurs waluty',
'customCode' => '<input name="currency_value" id="currency_value" type="text" onclick="$(this).select();" onchange="$(this).val(FormatNumber($(this).val(),undefined));" value="{if $fields.currency_value.value!=""}{$fields.value.currency_value|number_format:2:",":"."}{/if}"/>',
),
),
8 => array(
0 => array(
'name' => 'items_list_panel',
'hideLabel' => false,
'label' => 'LBL_PARENT_NAME',
'customCode' => "
{include file='modules/Documents/tpl/parentlist_EditView.tpl'}",
/*
<input type="hidden" name="websites_list" id="websites_list" value=\'{$WEBSITES_LIST}\'>
<div style="width:30%;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="itemsTableDIV2">
</div><br>', */
)
),
9 => array(
0 => array(
'name' => 'items_list_panel',
'hideLabel' => false,
'label' => 'LBL_USERS_NAME',
'customCode' => "
{include file='modules/Documents/tpl/userlist_EditView.tpl'}",
/*
<input type="hidden" name="websites_list" id="websites_list" value=\'{$WEBSITES_LIST}\'>
<div style="width:30%;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="itemsTableDIV2">
</div><br>', */
)
),
10 => array(
0 => array(
'name' => 'document_date',
'label' => 'LBL_DOCUMENT_DATE',
),
1 => array (
'name' => 'document_type',
'label' => 'Typ faktury'
),
),
),
'LBL_PANEL_CATEGORIES2' => array(
0 => array(
0 => array(
'name' => 'items_list_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' => '<div style="width:60%;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 id="tblAppendGrid" class="positions">
</table></div>'
)
)
),
)
);
?>

View File

@@ -0,0 +1,106 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
/**
* *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc.
* Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* ******************************************************************************
*/
echo '<script type="text/javascript"
src="http://code.jquery.com/jquery-1.11.1.min.js"></script>';
$listViewDefs ['Documents'] = array (
'FILE_URL' => array (
'width' => '2%',
'label' => '&nbsp;',
'link' => true,
'default' => true,
'related_fields' => array (
0 => 'document_revision_id'
),
'sortable' => false,
'studio' => false
),
'DOCUMENT_NAME' => array (
'width' => '25%',
'label' => 'LBL_NAME',
'link' => true,
'default' => true,
'bold' => true
),
'PARENT_NAME' => array (
'width' => '30%',
'label' => 'LBL_PARENT_NAME',
'default' => true,
),
'CATEGORY_ID' => array (
'width' => '5%',
'label' => 'LBL_LIST_CATEGORY',
'default' => true
),
'CREATED_BY_NAME' => array (
'width' => '5%',
'label' => 'LBL_LIST_LAST_REV_CREATOR',
'default' => true,
'sortable' => false
),
'ACTIVE_DATE' => array (
'width' => '5%',
'label' => 'LBL_LIST_ACTIVE_DATE',
'default' => true
),
'PAYMENT_DATE' => array (
'width' => '5%',
'label' => 'Termin płatności',
'default' => true
),
'VALUE' => array (
'width' => '5%',
'label' => 'Wartość',
'align'=>'right',
'default' => true
),
'LEFT_PAID' => array (
'width' => '5%',
'label' => 'Do zapłaty',
'align'=>'right',
'default' => true
),
'TO_ACCEPT' => array (
'width' => '10%',
'label' => 'LBL_TO_ACCEPT_LIST',
'default' => true
)
);
?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,448 @@
function NumberToUserFormatNumber(number,add) {
if(!number) number = 0;
number = parseFloat(number);
var tmp = number.toFixed(OPT['dec_len']);
var s1 = tmp.substring(0,tmp.length-1-OPT['dec_len']);
var s2 = tmp.substring(tmp.length-OPT['dec_len'],tmp.length);
var tmp = '';
for(var i=s1.length;i>0;i-=3) {
tmp = ((i<=3)?"":OPT['sep_1000'])+s1.substring(i-3,i)+tmp;
}
s1 = tmp;
return (s1+OPT['dec_sep']+s2).toString()+((add)?add:'');
}
function UserFormatNumberToNumber(ufn,add) {
if(add) {
var match = /add/g;
ufn = ufn.replace(match,'');
}
var match = /Err/g;
ufn = ufn.replace(match,'');
if(!ufn) return parseFloat(0);
var pos = ufn.indexOf(OPT['dec_sep']);
var s1='', s2='';
if(pos==-1) { s1 = ufn; s2 = ''; }
else { s1 = ufn.substring(0,pos); s2 = ufn.substring(pos+1,ufn.length); }
/*
if(OPT['sep_1000'] != "")
for(var i=s1.length-4;i>=0;i-=4)
if(s1.charAt(i) != OPT['sep_1000']) { return -1; }
if(s1.charAt(0) == OPT['sep_1000']) return -1;
*/
var pos = -1;
while((pos = s1.indexOf(OPT['sep_1000'])) != -1)
s1 = s1.substring(0,pos)+s1.substring(pos+1,s1.length);
//alert(s1);
return parseFloat(s1+"."+s2);
}
function keyPressedNumber(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
return keynum;
}
function isEnterOrTabPressed(e) {
var keynum = keyPressedNumber(e);
if(keynum == 9 || keynum == 13) return true; else return false;
}
function setSelectionRange(obj) {
if(obj && typeof(obj) == "object" && (obj.type == "text" || obj.type == "textarea")) {
if(obj.createTextRange) {
var range = obj.createTextRange();
range.moveStart("character", 0);
range.moveEnd("character", obj.value.lengh-1);
range.select();
} else {
if(obj.setSelectionRange) {
obj.setSelectionRange(0,obj.value.length);
}
}
obj.focus();
}
if(obj && typeof(obj) == "object" && obj.options) { obj.focus(); }
}
function paramsMT(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(); refreshPositionIndex();} , 1000);
}
this.myTable.tbody.removeChild(this);
this.myTable.refreshRowIndex();
}
row.moveUp = function() {
if(!this.previousSibling) return;
this.myTable.tbody.insertBefore(this,this.previousSibling);
this.myTable.refreshRowIndex();
}
row.moveDown = function() {
if(!this.nextSibling) this.myTable.addRow(row);
this.myTable.tbody.insertBefore(this.nextSibling,this);
this.myTable.refreshRowIndex();
}
row.setData = function(data) {
if(!data || typeof(data) != "object") { return; };
for(var i=0; i<this.myTable.colCount(); i++) {
this.cells.item(i).setData(data);
}
}
row.getData = function() {
var data = new Object();
for(var i=0; i<this.myTable.colCount(); i++) {
if(this.cells.item(i).getData) this.cells.item(i).getData(data,true);
}
return data;
}
for(var i=0; i<this.colCount(); i++) {
var cell = this.createCell(i);
row.appendChild(cell);
}
if(this.onCreateRow) this.onCreateRow(row);
return row;
};
this.onCreateRow; //function(row) {}
this.createCell = function(i) {
var cell = document.createElement('td');
cell.index = i;
cell.myTable = this;
cell.onclick = function() { this.select(); }
cell.select = function() {
if(!this.myTable.selectedCell || this.myTable.selectedCell !== this) {
if(this.myTable.selectedCell) this.myTable.selectedCell.deselect();
this.myTable.selectedCell = this;
if(this.firstChild.focus && !this.noSelect) setSelectionRange(this.firstChild);
if(this.onSelect) this.onSelect();
this.className = this.myTable.cellSelectedClass;
}
}
cell.deselect = function() {
if(this.myTable.selectedCell === this) {
if(cell.onDeselect) cell.onDeselect();
this.className = '';
this.selected = false;
this.myTable.selectedCell = '';
}
};
cell.selectNext = function() {
this.deselect();
if(this.nextSibling) this.nextSibling.select();
else {
if(!this.parentNode.nextSibling) { if(this.noNewAdd) return; else this.myTable.addRow(); }
this.parentNode.nextSibling.select();
this.parentNode.nextSibling.firstChild.select();
}
}
cell.afterCreate = function() {}
cell.setData = function(data) {}
cell.getData = function(data) {}
if(this.onCreateCell) this.onCreateCell(cell);
return cell;
};
this.onCreateCell; //function(cell) {}
this.setRowData = function(row,data) {
for(var i=0; i<this.colCount(); i++) {
this.setCellData(row,row.cells.item(i),data);
}
}
this.setCellData = function(row,cell,data) {
if(typeof(row) == "number")
if(this.tbody.rows.item(row)) row = this.tbody.rows.item(row);
if(typeof(cell) != "object")
if(typeof(cell) == "number" && typeof(row) == "object") {
if(row.cells.item(cell))
cell = row.cells.item(cell);
else return;
}
else return;
if(this.onSetCellData) this.onSetCellData(row,cell,data);
}
this.onSetCellData; //function(row,cell,data) {}
this.selectRow = function(row) {
if(this.selectedRow === row) return;
if(this.selectedRow) this.deselectRow();
this.selectedRow = row;
this.selectedRow.className = this.rowSelectedClass;
this.setEditNames(this.selectedRow,!this.selectedRow.isnew);
}
this.selectNextRow = function() {
if(!this.selectedRow) return;
if(!this.selectedRow.nextSibling) this.insertRow();
var cell_id = this.selectedCell.lp;
this.selectRow(this.selectedRow.nextSibling);
this.selectCell(this.selectedRow.cells.item(cell_id));
}
this.selectPreviousRow = function() {
if(!this.selectedRow) return;
if(!this.selectedRow.previousSibling) return;
if(this.selectedRow === this.tbody.rows.item(0)) return;
var cell_id = this.selectedCell.lp;
this.selectRow(this.selectedRow.previousSibling);
this.selectCell(this.selectedRow.cells.item(cell_id));
}
this.refreshNumeration = function() {
for(var i=0; i<this.tbody.rows.length; i++)
this.tbody.rows.item(i).cells.item(0).firstChild.value = i+1;
}
this.KeyPressedNumber = function(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
return keynum;
}
this.KeyPressed = function(e, cell, method) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
if((keynum == 9) || (keynum == 13)) {
cell.selectNext();
return false;
}
if(keynum == 40) { var id = cell.index; var row = cell.parentNode.selectNext(); if(row) { row.select(); row.cells.item(id).select(); } }
if(keynum == 38) { var id = cell.index; var row = cell.parentNode.selectPrevious(); if(row) { row.select(); row.cells.item(id).select(); } }
if(e.shiftKey && (method == "decimalNumber" || method == "onlyNumber")) return false;
if(method == "decimalNumber") return this.OnlyNumbers(keynum);
if(method == "onlyNumber") return this.OnlyNumbers(keynum, true);
return true;
}
this.OnlyNumbers = function(e, noQuote) { var keynum = e, keychar, numcheck;
keychar = String.fromCharCode(keynum);
numcheck = /\d/;
return numcheck.test(keychar) || ((!noQuote)?(keynum == 190):false)
|| (keynum == 8) //backspace
|| (keynum == 46) //delete
|| (keynum == 13) //enter || (keynum == 0) //special keys with FF
|| (keynum == 37) //left arrow
|| (keynum == 39) //right arrow
|| (keynum == 188); //,
}
this.row = function(i) { if(this.tbody.rows.item(i)) return this.tbody.rows.item(i); }
this.cells = function(i,j) { if(this.tbody.rows.item(i).cells.item(i)) return this.tbody.rows.item(i).cells.item(i); }
}

View File

@@ -0,0 +1,25 @@
<?php
$db = $GLOBALS['db'];
$doc = $db -> query("select * from documents where category_id IN ('invoice_costs', 'invoice_goods') AND deleted ='0'");
while ($d = $db->fetchByAssoc($doc)) {
$document = new Document();
$document->retrieve($d['id']);
if ($document->parent_name != '' && $document->parent_id != '' && $document->left_paid > 0 && $document->payment_date != '') {
echo $document->id.'<br>';
$res_count = $db->query ( "select id from ecmtransactions where record_id='" . $return_id . "' and deleted='0'" );
$count = $res_count->num_rows;
if ($count == 0) {
$GLOBALS ['db']->query ( "INSERT INTO ecmtransactions(id,name,date_entered,date_modified,modified_user_id,created_by,deleted,assigned_user_id,value,parent_name,parent_id,payment_date,type,paid,register_date,record_id,record_type,currency_id,currency_value)VALUES
('" . create_guid () . "','" . $document->document_name . "','" . date ( "Y-m-d H:i:s" ) . "','" . date ( "Y-m-d H:i:s" ) . "','" . $_SESSION ['authenticated_user_id'] . "','" . $_SESSION ['authenticated_user_id'] . "','" . $document->deleted . "','" . $document->created_by . "','" . $document->value . "','" . $document->parent_name . "','" . $document->parent_id . "','" . $d['payment_date']. "','0','0','" . $d['payment_date'] . "','" . $document->id . "','Documents','" . $document->currency_id . "', '".$document->currency_value."')" );
} else {
$db->query ( "update ecmtransactions set value='" . $document->value . "' where record_id='" . $docuent->id . "'" );
}
}
unset($document);
}
?>

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
{foreach from=$PARENT_LIST key=k item=v}
<li><a href="index.php?module={$v.parent_type}s&action=DetailView&record={$v.parent_id}">{$v.parent_name}</a></li>
{/foreach}

View File

@@ -0,0 +1,24 @@
<input type="hidden" name="parent_list" id="parent_list" value='{$PARENT_LIST}'>
<input type="hidden" name="parent_type_list" id="parent_type_list" value='{$PARENT_TYPE_LIST|@json_encode}'>
<button class="btn btn-info" type="button" id="AddMoreWWWBox" value="Dodaj">
<img src="themes/default/images/id-ff-add.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"></button>
<table id="InputsWrapper">
<tr><td><select id="parent_type_1" name="parent_type[]">
{foreach from=$PARENT_TYPE_LIST key=k item=v}
<option value="{$k}" label="{$v}">{$v}</OPTION>
{/foreach}
</select>
&nbsp;<input type="text" value="" size="30" id="parent_name_1" name="parent_name[]">
<input type="hidden" value="" name="list_id[]"><input type="hidden" value="" id="parent_id_1" name="parent_id[]"><a class="removeclass" href="#"></td><td style="vertical-align: top;">
<img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&amp;themeName=Sugar5&amp;imageName=id-ff-remove.png"></a>
<button onclick="
{literal} open_popup( $('#parent_type_1').val(), 600, 400, &quot;&quot;, true, false,
{&quot;call_back_function&quot;:&quot;set_return&quot;,&quot;form_name&quot;:&quot;EditView&quot;,&quot;field_to_name_array&quot;:
{&quot;id&quot;:&quot;parent_id_1&quot;,&quot;name&quot;:&quot;parent_name_1&quot;}}, &quot;single&quot;, true);"
{/literal}
value="Wybierz" class="button firstChild" accesskey="T" title="Wybierz [Alt+T]" tabindex="101" id="btn_parent_name" name="btn_parent_name" style="vertical-align: top;" type="button">
<img src="themes/default/images/id-ff-select.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"></button>
<button value="Wyczyść" onclick="{literal} $('#parent_name_1').val(''); $('#parent_id_1').val('');{/literal}" class="button lastChild" style="vertical-align: top;" accesskey="C" title="Wyczyść[Alt+C]" tabindex="101" id="btn_clr_parent_name" name="btn_clr_parent_name" type="button">
<img src="themes/default/images/id-ff-clear.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"></button></td></tr>
</table>

View File

@@ -0,0 +1,158 @@
{foreach from=$USER_LIST key=k item=v}
<li>
<a href="index.php?module=Users&action=DetailView&record={$v.user_id}">{$v.user_name}</a>
{*brak akceptacji*}
{if $v.accepted == '0'}
{*brak akceptacji i brak opisu i jest sie zalogowanym uzytkownikiem*}
{if $v.accepted_description == '' && $v.user_id eq $CURRENT_USER}
<input type="button" id="userListButton"
value="Akceptuj" onclick="$('#userDiv').toggle('slow');">
<div id="userDiv" style="display: none;">
<table>
<thead>
<tr>
<th>Opis</th>
</tr>
</thead>
<tfoot>
<tr>
<td>
<textarea id="userAcceptDes" rows="4" style="width: 100%"></textarea>
<select id="statusik">
<option value='1'>Akceptuj</option>
<option value='0'>Oczekuj</option>
<option value='2'>Odrzuć</option>
</select>
<input type="button"
id="userSaveDes"
value="Zapisz"
onclick="location.href = 'index.php?module=Documents&action=accept&status=' + $('#statusik :selected').val() + '&record={$v.id}&user_id={$v.user_id}&doc_id={$v.document_id}&des=' + $('#userAcceptDes').val() + ''"
>
<input type="button" id="userListCancel" value="Anuluj" onclick="$('#userDiv').toggle('slow');">
</td>
</tr>
</tfoot>
</table>
</div>
{/if}
{*brak akceptacji i jest opis i jest sie zalogowanym uzytkownikiem*}
{if $v.accepted_description != '' && $v.user_id eq $CURRENT_USER}
<input type="button" id="userListButton"
value="Zmień status" onclick="$('#userDiv').toggle('slow');">
Status: Oczekuje {$v.date_accepted|date_format:"%d.%m.%Y %H.%M:%S"}
<div id="userDiv" style="display: none;">
<table>
<thead>
<tr>
<th>Opis</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{$v.accepted_description|replace:'XVZC':'<br>'}
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<textarea id="userAcceptDes" rows="4" style="width: 100%"></textarea>
<select id="statusik">
<option value='1'>Akceptuj</option>
<option value='0'>Oczekuj</option>
<option value='2'>Odrzuć</option>
</select>
<input type="button"
id="userSaveDes"
value="Zapisz"
onclick="location.href = 'index.php?module=Documents&action=accept&status=' + $('#statusik :selected').val() + '&record={$v.id}&user_id={$v.user_id}&doc_id={$v.document_id}&des=' + $('#userAcceptDes').val() + ''"
>
<input type="button" id="userListCancel" value="Anuluj" onclick="$('#userDiv').toggle('slow');">
</td>
</tr>
</tfoot>
</table>
</div>
{elseif $v.accepted_description != '' }
<input type="button" id="userListButton"
value="Pokaż opis" onclick="$('#userDiv').toggle('slow');">
Status: Oczekuje {$v.date_accepted|date_format:"%d.%m.%Y %H.%M:%S"}
<div id="userDiv" style="display: none;">
<table>
<thead>
<tr>
<th>Opis</th>
</tr>
</thead>
<tfoot>
<tr>
<td>
{$v.accepted_description|replace:'XVZC':'<br>'}
</td>
</tr>
<tr>
<td>
<input type="button" id="userListCancel" value="Zamknij opis" onclick="$('#userDiv').toggle('slow');">
</td>
</tr>
</tfoot>
</table>
</div>
{/if}
{/if}
{*Jest akceptacja bądź odrzucony*}
{if $v.accepted == '1'}
<input type="button" id="userShowDes"
value="Pokaż opis" onclick="$('#userDess_{$v.id}').toggle('slow');">
Status: Zaakceptowano {$v.date_accepted|date_format:"%d.%m.%Y %H.%M:%S"}
<div id="userDess_{$v.id}" style="display: none;">
<table>
<thead>
<tr>
<th>Opis</th>
</tr>
</thead>
<tfoot>
<tr>
<td>
{$v.accepted_description|replace:'XVZC':'<br>'}
</td>
</tr>
<tr>
<td>
<input type="button" id="userListCancel" value="Zamknij opis" onclick="$('#userDess_{$v.id}').toggle('slow');">
</td>
</tr>
</tfoot>
</table>
</div>
{/if}
{if $v.accepted == '2'}
<input type="button" id="userShowDes"
value="Pokaż opis" onclick="$('#userDess_{$v.id}').toggle('slow');">
Status: Odrzucono {$v.date_accepted|date_format:"%d.%m.%Y %H.%M:%S"}
<div id="userDess_{$v.id}" style="display: none;">
<table>
<thead>
<tr>
<th>Opis</th>
</tr>
</thead>
<tfoot>
<tr>
<td>
{$v.accepted_description|replace:'XVZC':'<br>'}
</td>
</tr>
<tr>
<td>
<input type="button" id="userListCancel" value="Zamknij opis" onclick="$('#userDess_{$v.id}').toggle('slow');">
</td>
</tr>
</tfoot>
</table>
</div>
{/if}</li>
{/foreach}

View File

@@ -0,0 +1,25 @@
<input type="hidden" name="user_list" id="user_list" value='{$USER_LIST}'>
<input type="hidden" name="user_type_list" id="user_type_list" value='{$USER_TYPE_LIST|@json_encode}'>
<button class="btn btn-info" type="button" id="AddMoreUSERBox" value="Dodaj">
<img src="themes/default/images/id-ff-add.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"></button>
<table id="InputsWrapper2">
<tr>
<td>&nbsp;
<input type="text" value="" size="30" id="user_name_1" name="user_name[]">
<input type="hidden" value="" name="listUser_id[]">
<input type="hidden" value="" id="user_id_1" name="user_id[]">
<input type="hidden" value="" name="accepted_description[]" id="accepted_description_1">
<input type="hidden" value="" name="accepted[]" id="accepted_1">
<input type="hidden" value="" name="date_accepted[]" id="date_accepted_1">
<a class="removeclassuser" href="#"></td><td style="vertical-align: top;"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&amp;themeName=Sugar5&amp;imageName=id-ff-remove.png"></a>
<button onclick="
{literal} open_popup('Users', 600, 400, &quot;&quot;, true, false,
{&quot;call_back_function&quot;:&quot;set_return&quot;,&quot;form_name&quot;:&quot;EditView&quot;,&quot;field_to_name_array&quot;:
{&quot;id&quot;:&quot;user_id_1&quot;,&quot;name&quot;:&quot;user_name_1&quot;}}, &quot;single&quot;, true);"
{/literal}
value="Wybierz" class="button firstChild" accesskey="T" title="Wybierz [Alt+T]" tabindex="101" id="btn_user_name" name="btn_user_name" style="vertical-align: top;" type="button">
<img src="themes/default/images/id-ff-select.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"></button>
<button value="Wyczyść" onclick="{literal} $('#user_name_1').val(''); $('#user_id_1').val('');{/literal}" class="button lastChild" style="vertical-align: top;" accesskey="C" title="Wyczyść[Alt+C]" tabindex="101" id="btn_clr_user_name" name="btn_clr_user_name" type="button">
<img src="themes/default/images/id-ff-clear.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"></button></td></tr>
</table>

View File

@@ -0,0 +1,9 @@
<table style="width: 500px;"><tbody>
<th style="text-align: right">Stawka VAT</th>
<th style="text-align: right">Wartość Netto</th>
<th style="text-align: right">Wartość VAT</tH>
</tbody>
{foreach from=$VAT_LIST key=k item=v}
<tr><td style="text-align: right">{$v.vat_value}</td><td style="text-align: right;">{$v.netto|number_format:2:".":","}</td><td style="text-align: right;">{$v.vat|number_format:2:".":","}</td></tr>
{/foreach}
</table>

View File

@@ -0,0 +1,482 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
/**
* *******************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc.
* Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
* ******************************************************************************
*/
$dictionary ['Document'] = array (
'table' => 'documents',
'fields' => array (
// add mz
'value' => array (
'name' => 'value',
'vname' => 'LBL_VALUE',
'type' => 'varchar',
'required'=>true,
),
'left_paid' => array (
'name' => 'left_paid',
'vname' => 'LBL_VALUE_PAID',
'type' => 'varchar',
),
'parent_type' => array (
'name' => 'parent_type',
'vname' => 'LBL_PARENT_NAME',
'type' => 'varchar',
'source' => 'non-db',
'required' => false,
'reportable' => false,
'len' => '25',
'comment' => 'The Sugar object to which the call is related'
),
'currency_id' => array (
'name' => 'currency_id',
'type' => 'enum',
'options' => 'currency_dom',
'label' => 'LBL_CURRENCY',
'len' => 36
),
'document_type' => array (
'name' => 'document_type',
'type' => 'enum',
'options' => 'document_type_enum',
'label' => 'Typ faktury',
'required'=>true,
'len' => 45
),
'currency_value' => array (
'name' => 'currency_value',
'type' => 'varchar',
'vname' => 'LBL_CURRENCY_VALUE',
'reportable' => false,
'required' => false
),
'parent_name' => array (
'name' => 'parent_name',
'type_name' => 'parent_type',
'id_name' => 'parent_id',
'vname' => 'LBL_LIST_RELATED_TO',
'type' => 'parent',
'source' => 'non-db',
'options' => 'parent_type_display2'
),
'corrected_document_name' => array (
'name' => 'corrected_document_name',
'vname' => 'Korekta do dokumentu',
'rname'=>'document_name',
'type' => 'varchar',
'group' => 'corrected_document_name',
'dbtype' => 'varchar',
'len' => '255',
'massupdate' => false,
'required' => false
),
'parent_id' => array (
'name' => 'parent_id',
'type' => 'id',
'group' => 'parent_name',
'reportable' => false,
'source' => 'non-db',
'vname' => 'LBL_PARENT_ID'
),
'document_name' => array (
'name' => 'document_name',
'vname' => 'LBL_NAME',
'type' => 'varchar',
'len' => '255',
'required' => true,
'importable' => 'required'
),
'name' => array (
'name' => 'name',
'vname' => 'LBL_NAME',
'source' => 'non-db',
'type' => 'varchar'
),
'filename' => array (
'name' => 'filename',
'vname' => 'LBL_FILENAME',
'type' => 'file',
'source' => 'non-db',
'comment' => 'The filename of the document attachment',
'required' => true
),
'uploadfile' => array (
'name' => 'uploadfile',
'required' => true,
'vname' => 'LBL_FILENAME',
'type' => 'file',
'source' => 'non-db'
),
'active_date' => array (
'name' => 'active_date',
'vname' => 'LBL_DOC_ACTIVE_DATE',
'type' => 'date',
'importable' => 'required',
'required' => true
),
'exp_date' => array (
'name' => 'exp_date',
'vname' => 'LBL_DOC_EXP_DATE',
'type' => 'date'
),
'category_id' => array (
'name' => 'category_id',
'vname' => 'LBL_SF_CATEGORY',
'type' => 'enum',
'len' => '25',
'options' => 'document_category_dom',
'reportable' => false
),
'subcategory_id' => array (
'name' => 'subcategory_id',
'vname' => 'LBL_SF_SUBCATEGORY',
'type' => 'enum',
'len' => '25',
'options' => 'document_subcategory_dom',
'reportable' => false
),
'payment_date' => array (
'name' => 'payment_date',
'vname' => 'LBL_PAYMENT_DATE',
'type' => 'date',
'reportable' => false,
'showFormats' => true,
'massupdate' => false,
'required' => false
),
'status_id' => array (
'name' => 'status_id',
'vname' => 'LBL_DOC_STATUS',
'type' => 'enum',
'len' => '25',
'options' => 'document_status_dom',
'reportable' => false
),
'document_revision_id' => array (
'name' => 'document_revision_id',
'vname' => 'LBL_LATEST_REVISION',
'type' => 'varchar',
'len' => '36',
'reportable' => false
),
'revisions' => array (
'name' => 'revisions',
'type' => 'link',
'relationship' => 'document_revisions',
'source' => 'non-db',
'vname' => 'LBL_REVISIONS'
),
'revision' => array (
'name' => 'revision',
'vname' => 'LBL_DOC_VERSION',
'type' => 'varchar',
'reportable' => false,
'required' => true,
'source' => 'non-db',
'importable' => 'required',
'required' => true
),
'last_rev_created_name' => array (
'name' => 'last_rev_created_name',
'vname' => 'LBL_LAST_REV_CREATOR',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'last_rev_mime_type' => array (
'name' => 'last_rev_mime_type',
'vname' => 'LBL_LAST_REV_MIME_TYPE',
'type' => 'varchar',
'reportable' => false,
'studio' => 'false',
'source' => 'non-db'
),
'latest_revision' => array (
'name' => 'latest_revision',
'vname' => 'LBL_LATEST_REVISION',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'last_rev_create_date' => array (
'name' => 'last_rev_create_date',
'type' => 'date',
'table' => 'document_revisions',
'link' => 'revisions',
'join_name' => 'document_revisions',
'vname' => 'LBL_LAST_REV_CREATE_DATE',
'rname' => 'date_entered',
'reportable' => false,
'source' => 'non-db'
),
'contracts' => array (
'name' => 'contracts',
'type' => 'link',
'relationship' => 'contracts_documents',
'source' => 'non-db',
'vname' => 'LBL_CONTRACTS'
),
// todo remove
'leads' => array (
'name' => 'leads',
'type' => 'link',
'relationship' => 'leads_documents',
'source' => 'non-db',
'vname' => 'LBL_LEADS'
),
'related_doc_id' => array (
'name' => 'related_doc_id',
'vname' => 'LBL_RELATED_DOCUMENT_ID',
'reportable' => false,
'dbType' => 'id',
'type' => 'varchar',
'len' => '36'
),
'related_doc_name' => array (
'name' => 'related_doc_name',
'vname' => 'LBL_DET_RELATED_DOCUMENT',
'type' => 'relate',
'table' => 'documents',
'id_name' => 'related_doc_id',
'module' => 'Documents',
'source' => 'non-db',
'comment' => 'The related document name for Meta-Data framework'
),
'related_doc_rev_id' => array (
'name' => 'related_doc_rev_id',
'vname' => 'LBL_RELATED_DOCUMENT_REVISION_ID',
'reportable' => false,
'dbType' => 'id',
'type' => 'varchar',
'len' => '36'
),
'related_doc_rev_number' => array (
'name' => 'related_doc_rev_number',
'vname' => 'LBL_DET_RELATED_DOCUMENT_VERSION',
'type' => 'varchar',
'source' => 'non-db',
'comment' => 'The related document version number for Meta-Data framework'
),
'is_template' => array (
'name' => 'is_template',
'vname' => 'LBL_IS_TEMPLATE',
'type' => 'bool',
'default' => 0,
'reportable' => false
),
'accepted' => array (
'name' => 'accepted',
'vname' => 'LBL_TO_ACCEPT',
'type' => 'enum',
'source' => 'non-db',
'default' => 0,
'options' => 'document_user_status_dom',
'reportable' => false
),
'status' => array (
'name' => 'status',
'vname' => 'Status',
'type' => 'enum',
'options' => 'status_user_status_dom',
'reportable' => false,
'required'=>true
),
'date_start' => array (
'name' => 'date_start',
'vname' => 'LBL_DATE_START',
'type' => 'date',
'source' => 'non-db',
'default' => 0,
'reportable' => false
),
'date_end' => array (
'name' => 'date_end',
'vname' => 'LBL_DATE_END',
'type' => 'date',
'source' => 'non-db',
'default' => 0,
'reportable' => false
),
'template_type' => array (
'name' => 'template_type',
'vname' => 'LBL_TEMPLATE_TYPE',
'type' => 'enum',
'len' => '25',
'options' => 'document_template_type_dom',
'reportable' => false
),
// BEGIN field used for contract document subpanel.
'latest_revision_name' => array (
'name' => 'latest_revision_name',
'vname' => 'LBL_LASTEST_REVISION_NAME',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'selected_revision_name' => array (
'name' => 'selected_revision_name',
'vname' => 'LBL_SELECTED_REVISION_NAME',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'contract_status' => array (
'name' => 'contract_status',
'vname' => 'LBL_CONTRACT_STATUS',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'contract_name' => array (
'name' => 'contract_name',
'vname' => 'LBL_CONTRACT_NAME',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'linked_id' => array (
'name' => 'linked_id',
'vname' => 'LBL_LINKED_ID',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'selected_revision_id' => array (
'name' => 'selected_revision_id',
'vname' => 'LBL_SELECTED_REVISION_ID',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'latest_revision_id' => array (
'name' => 'latest_revision_id',
'vname' => 'LBL_LATEST_REVISION_ID',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'selected_revision_filename' => array (
'name' => 'selected_revision_filename',
'vname' => 'LBL_SELECTED_REVISION_FILENAME',
'type' => 'varchar',
'reportable' => false,
'source' => 'non-db'
),
'document_date' => array (
'name' => 'document_date',
'vname' => 'LBL_DOCUMENT_DATE',
'type' => 'date',
'reportable' => false,
'showFormats' => true,
'massupdate' => false,
'required' => true
)
// END fields used for contract documents subpanel.
),
'indices' => array (
array (
'name' => 'idx_doc_cat',
'type' => 'index',
'fields' => array (
'category_id',
'subcategory_id'
)
)
),
'relationships' => array (
'document_revisions' => array (
'lhs_module' => 'Documents',
'lhs_table' => 'documents',
'lhs_key' => 'id',
'rhs_module' => 'Documents',
'rhs_table' => 'document_revisions',
'rhs_key' => 'document_id',
'relationship_type' => 'one-to-many'
),
'documents_modified_user' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'Documents',
'rhs_table' => 'documents',
'rhs_key' => 'modified_user_id',
'relationship_type' => 'one-to-many'
),
'documents_created_by' => array (
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'Documents',
'rhs_table' => 'documents',
'rhs_key' => 'created_by',
'relationship_type' => 'one-to-many'
)
)
);
VardefManager::createVardef ( 'Documents', 'Document', array (
'default'
) );
?>

View File

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

View File

@@ -0,0 +1,281 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: This file is used to override the default Meta-data EditView behavior
* to provide customization specific to the Calls module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/views/view.edit.php');
class DocumentsViewEdit extends ViewEdit
{
/**
* @see SugarView::display()
*/
public function display()
{
global $app_list_strings, $mod_strings;
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery.appendGrid-master/jquery.appendGrid-1.5.0.css"/>';
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-2.1.0.min.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery.appendGrid-master/jquery.appendGrid-1.5.0.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-ui/ui/jquery-ui.js"></script>';
echo '<script type="text/javascript"
src="modules/Documents/js/Bim-it4.js"></script>';
echo '<script type="text/javascript"
src="modules/Documents/js/Documents9.js"></script>';
/*
$this->bean->category_name = $app_list_strings['document_category_dom'][$this->bean->category_id];
$this->bean->subcategory_name = $app_list_strings['document_subcategory_dom'][$this->bean->subcategory_id];
if(isset($this->bean->status_id)) {
$this->bean->status = $app_list_strings['document_status_dom'][$this->bean->status_id];
}
$this->bean->related_doc_name = Document::get_document_name($this->bean->related_doc_id);
$this->bean->related_doc_rev_number = DocumentRevision::get_document_revision_name($this->bean->related_doc_rev_id);
$this->bean->save_file = basename($this->bean->file_url_noimage);
*/
$load_signed=false;
if ((isset($_REQUEST['load_signed_id']) && !empty($_REQUEST['load_signed_id']))) {
$load_signed=true;
if (isset($_REQUEST['record'])) {
$this->bean->related_doc_id=$_REQUEST['record'];
}
if (isset($_REQUEST['selected_revision_id'])) {
$this->bean->related_doc_rev_id=$_REQUEST['selected_revision_id'];
}
$this->bean->id=null;
$this->bean->document_name=null;
$this->bean->filename=null;
$this->bean->is_template=0;
} //if
if (!empty($this->bean->id)) {
$this->ss->assign("FILE_OR_HIDDEN", "hidden");
if (!$this->ev->isDuplicate) {
$this->ss->assign("DISABLED", "disabled");
}
if(strtotime($this->bean->date_entered.'+1 hours')<strtotime("now")){
// die('Brak możliwości edycji');
}
} else {
global $timedate;
$format = $timedate->get_cal_date_format();
$format = str_replace('%', '', $format);
$this->bean->active_date = date($format);
$this->bean->revision = 1;
$this->ss->assign("FILE_OR_HIDDEN", "file");
}
$ws = $this->bean->getParentList();
$ul = $this->bean->getUserList();
$vl = $this->bean->getVatList(true);
//var_dump($_POST);
$this->ss->assign('VAT_LIST', $vl);
$this->ss->assign('USER_LIST', $ul);
$this->ss->assign('PARENT_TYPE_LIST', $app_list_strings['parent_type_display2']);
$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();
$this->ss->assign('encoded_document_popup_request_data', $json->encode($popup_request_data));
//create from subpanel
if($this->bean->id=='' && $_POST['return_module']!=''){
if(substr($_POST['return_module'],0,3)=='Ecm'){
$module=substr($_POST['return_module'],0,strlen($_POST['return_module'])-1);
$d=new $module;
$d->retrieve($_POST[strtolower(substr($_POST['return_module'],0,strlen($_POST['return_module'])-1)).'_id']);
if($module=='EcmProduct'){
$ws='[{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"2014-11-28",
"parent_type":"'.$module.'","deleted":"0","date_modified":null,"parent_name":"'.htmlentities($d->name).'"}]';
} if($module=='EcmStockDocMove' || $module=='EcmInsideOrder'){
$ws='[{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"2014-11-28",
"parent_type":"'.$module.'","deleted":"0","date_modified":null,"parent_name":"'.htmlentities($d->document_no).'"}]';
}else {
$ws='[{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"","parent_type":"'.$module.'","deleted":"0","date_modified":null,"parent_name":"'.$d->document_no.'"},
{"id":"","document_id":"","parent_id":"'.$d->parent_id.'","date_entered":"2014-11-28",
"parent_type":"Account","deleted":"0","date_modified":null,"parent_name":"'.$d->parent_name.'"}]';
}
} else {
$module=substr($_POST['return_module'],0,strlen($_POST['return_module'])-1);
$d=new $module;
$d->retrieve($_POST[strtolower(substr($_POST['return_module'],0,strlen($_POST['return_module'])-1)).'_id']);
$ws='[{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"2014-11-28",
"parent_type":"'.$module.'","deleted":"0","date_modified":null,"parent_name":"'.htmlentities($d->name).'"}]';
}
}
$this->ss->assign('PARENT_LIST', $ws);
//get related document name.
if (!empty($this->bean->related_doc_id)) {
$this->ss->assign("RELATED_DOCUMENT_NAME",Document::get_document_name($this->bean->related_doc_id));
$this->ss->assign("RELATED_DOCUMENT_ID",$this->bean->related_doc_id);
if (!empty($this->bean->related_doc_rev_id)) {
$this->ss->assign("RELATED_DOCUMENT_REVISION_OPTIONS", get_select_options_with_id(DocumentRevision::get_document_revisions($this->bean->related_doc_id), $this->bean->related_doc_rev_id));
} else {
$this->ss->assign("RELATED_DOCUMENT_REVISION_OPTIONS", get_select_options_with_id(DocumentRevision::get_document_revisions($this->bean->related_doc_id), ''));
}
} else {
$this->ss->assign("RELATED_DOCUMENT_REVISION_DISABLED", "disabled");
}
//set parent information in the form.
if (isset($_REQUEST['parent_id'])) {
$this->ss->assign("PARENT_ID",$_REQUEST['parent_id']);
} //if
if (isset($_REQUEST['parent_name'])) {
$this->ss->assign("PARENT_NAME", $_REQUEST['parent_name']);
if (!empty($_REQUEST['return_module'])) {
switch (strtolower($_REQUEST['return_module'])) {
case "contracts" :
$this->ss->assign("LBL_PARENT_NAME",$mod_strings['LBL_CONTRACT_NAME']);
break;
//todo remove leads case.
case "leads" :
$this->ss->assign("LBL_PARENT_NAME",$mod_strings['LBL_CONTRACT_NAME']);
break;
} //switch
} //if
} //if
if (isset($_REQUEST['return_module'])) {
$this->ss->assign("PARENT_TYPE",$_REQUEST['return_module']);
}
if ($load_signed) {
$this->ss->assign("RELATED_DOCUMENT_REVISION_DISABLED", "disabled");
$this->ss->assign("RELATED_DOCUMENT_BUTTON_AVAILABILITY", "hidden");
$this->ss->assign("LOAD_SIGNED_ID",$_REQUEST['load_signed_id']);
} else {
$this->ss->assign("RELATED_DOCUMENT_BUTTON_AVAILABILITY", "button");
} //if-else
$pl3 = $this->bean->getPositionList3();
$this->ss->assign('POSITION_LIST3', $pl3);
//opt
$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'];
global $current_user;
$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;
echo '
<script language="javascript">
var OPT = '.str_replace('&quot;','\"',$json->encode($OPT)).';
var MOD = '.str_replace('&quot;','\"',$json->encode($mod_strings)).';
</script>';
if($this->bean->id==""){
$this->bean->status=null;
}
global $current_user;
if($this->bean->id!=""){
if($current_user->is_admin!=1){
// die('Brak możliwości edycji');
}
}
parent::display();
}
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
$params = array();
$params[] = $this->_getModuleTitleListParam();
if(!empty($this->bean->id)){
$params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->document_name."</a>";
$params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
}else{
$params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
}
return $params;
}
}