Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

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,834 @@
<?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) {
if($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($tid!=null){
$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 = $current_user->id;
$t->type2=1;
$t->parent_name = $this->parent_name;
$t->parent_id = $this->parent_id;
$t->payment_date =$this->payment_date;
$t->type = 1;
$t->type3=$this->transaction_type;
$t->register_date = $this->document_date;
$t->currency_id = $this->currency_id;
$t->currency_value = $this->currency_value;
$t->value = str_replace(".",",",$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);
if( $w['parent_name']=="")continue;
}
$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 id,filename,revision,file_ext FROM document_revisions WHERE document_id='$this->id' and deleted=0";
$result = $this->db->query($query);
$files=array();
while($row = $this->db->fetchByAssoc($result)){
$files[]=$row;
}
//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')) {
if($_REQUEST['action']=='DetailView'){
$string="";
foreach ($files as $file){
$string.="<a href='index.php?entryPoint=download&id=" . $file['id'] . "&type=Documents' target='_blank'>" .$file['filename']. "</a><br>";
}
$this->uploadfile = $string;
$this->file_url_noimage = basename(UploadFile :: get_url($this->filename, $this->document_revision_id));
} else {
$string="";
foreach ($files as $file){
$string.=$file['filename'].":".$file['id'].":".$file['file_ext'].";";
}
$this->uploadfile = $string;
$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);
$string="";
$query = "SELECT id,filename,revision,file_ext FROM document_revisions WHERE document_id='$this->id' and deleted=0 limit 1";
$result = $this->db->query($query);
$files=array();
while($row = $this->db->fetchByAssoc($result)){
$files[]=$row;
}
foreach ($files as $file){
$string.="<a href='upload/" . $file['id'] . "' target='_blank'><img src='themes/Sugar5/images/def_image_inline.gif?s=bed8cd35065048ceebdc639ebe305e2c&c=1'/></a><br>";
}
$this->uploadfile = $string;
$this->file_url_noimage = basename(UploadFile :: get_url($this->filename, $this->document_revision_id));
$document_fields = $this->get_list_view_array();
$document_fields['FILE_URL'] = $string;
$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]);
$document_fields['VALUE']="<span style='color: black;'>".format_number($this->value)."</span>";
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,35 @@
<?php
if($_REQUEST['to_pdf']==1 && $_REQUEST['search_module']!="" && $_REQUEST['term']!=""){
$search_in =array(
'Accounts'=>array('name'),
'Contacts'=> array(
'first_name',
'last_name'
),
'EcmSales'=>array('document_no'),
'EcmStockDocIns'=>array('document_no'),
'EcmInvoiceOuts'=>array('document_no'),
'EcmProducts'=>array('name'),
);
$query="select id,concat(".implode(",' ',",$search_in[$_REQUEST['search_module']]).") as value
from ".strtolower($_REQUEST['search_module'])."
where concat(".implode(",' ',",$search_in[$_REQUEST['search_module']]).") like '%".$_REQUEST['term']."%' and deleted=0 limit 10";
$db=$GLOBALS['db'];
$res=$db->query($query);
$output=array();
while($dane=$db->fetchByAssoc($res)){
$dane['value']=html_entity_decode($dane['value']);
$output[]=$dane;
}
echo json_encode($output);
return "";
}
?>

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,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),
);
?>

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,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".
* ******************************************************************************
*/
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,179 @@
<?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' => 'uploadfile',
),
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,209 @@
<?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="{$fields.left_paid.value|number_format:2:",":"."}"/>',
)
),
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>', */
),
1 => 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>', */
),
),
9 => array(
0 => array(
'name' =>'transaction_type',
'label' =>'Typ transakcji'
)
),
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,72 @@
<?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,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,496 @@
<?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',
'default'=>'k',
'label' => 'Typ faktury',
'required'=>true,
'len' => 45
),
'transaction_type' => array (
'name' => 'transaction_type',
'type' => 'enum',
'options' => 'transaction_type3_dom',
'size' => 3,
'default'=>'1',
'vname'=>'Typ transakcji',
'label' => 'Typ transakcji',
'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' => false
),
'uploadfile' => array (
'name' => 'uploadfile',
'required' => false,
'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,
'required' => false
),
'revisions' => array (
'name' => 'revisions',
'type' => 'link',
'relationship' => 'document_revisions',
'source' => 'non-db',
'vname' => 'LBL_REVISIONS',
'required' => false
),
'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,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".
********************************************************************************/
/*********************************************************************************
* 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);
$this->bean->value=format_number($this->bean->value);
$this->bean->left_paid=format_number($this->bean->left_paid);
$params = array();
$params[] = $this->_getModuleTitleListParam();
$params[] = $this->bean->document_name;
return $params;
}
}

View File

@@ -0,0 +1,357 @@
<?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,$current_user;
$EcmSysInfo = new EcmSysInfo();
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-it6.js"></script>';
echo '<script type="text/javascript"
src="modules/Documents/js/Documents13.js"></script><input type="hidden" id="dbase" value="'. $EcmSysInfo->getDatabaseName().'">';
/*
$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->bean->document_type='k';
$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).'"}]';
}
}
*/
if($this->bean->id=='' && $_REQUEST['return_module']!=''){
if(substr($_REQUEST['return_module'],0,3)=='Ecm'){
$module=substr($_REQUEST['parent_type'],0,strlen($_REQUEST['return_module'])-1);
$d=new $module;
$d->retrieve($_REQUEST[strtolower(substr($_REQUEST['return_module'],0,strlen($_REQUEST['return_module'])-1)).'_id']);
if($_REQUEST['return_module']=='EcmStockDocIns'){
$this->bean->document_date=date('d.m.Y');
if($d->name==''){
$this->bean->document_name='PZ '.$d->document_no;
} else {
$this->bean->document_name=''.$d->name;
}
$this->bean->value=$d->total_brutto;
$this->bean->document_number=$this->bean->document_name;
$vat_pos=array('23%'=>0,
'22%'=>1,
'8%'=>2,
'7%'=>3,
'0%'=>4,
'Zw'=>5);
$vat_list=array(
'23%'=> array('vat_value'=>'23%','vat_id'=>'23'),
'22%'=> array('vat_value'=>'22%','vat_id'=>'22'),
'8%'=> array('vat_value'=>'8%','vat_id'=>'8'),
'7%'=> array('vat_value'=>'7%','vat_id'=>'7'),
'0%'=> array('vat_value'=>'0%','vat_id'=>'0'),
'Zw'=> array('vat_value'=>'Zw','vat_id'=>'0')
);
$vat_list_r=array();
$a=explode(',',$d->vats_summary);
foreach ($a as $key){
$tmp=explode(':',$key);
if($tmp[0]!=''){
$vat_list[$tmp[0]]['netto']=$d->total_netto;
$vat_list[$tmp[0]]['vat']=$tmp[1];
}
}
foreach ( $vat_list as $key=>$val){
$vat_list_r[]=$vat_list[$key];
}
$json = getJSONobj();
$this->ss->assign('VAT_LIST', $vat_list_r);
}
$ws='[{"id":"","document_id":"","parent_id":"'.$d->parent_id.'","date_entered":"2014-11-28",
"parent_type":"Account","deleted":"0","date_modified":null,"parent_name":"'.htmlentities($d->parent_name).'"},{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"","parent_type":"'.$module.'","deleted":"0","date_modified":null,"parent_name":"'.$d->document_no.'"}]';
if($_REQUEST['return_module']=='EcmProducts'){
$ws='[{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"","parent_type":"'.$module.'","deleted":"0","date_modified":null,"parent_name":"'.htmlentities($_REQUEST['ecmproduct_name']).'"}]';
}
} else {
$module=substr($_REQUEST['return_module'],0,strlen($_REQUEST['return_module'])-1);
$d=new $module;
$d->retrieve($_REQUEST[strtolower(substr($_REQUEST['return_module'],0,strlen($_REQUEST['return_module'])-1)).'_id']);
$ws='[{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"2014-11-28",
"parent_type":"Account","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;
$this->bean->left_paid=0.00;
}
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;
}
}