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,87 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Deletes an Account record and then redirects the browser to the
* defined return URL.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
global $mod_strings;
if(!isset($_REQUEST['record']))
sugar_die($mod_strings['ERR_DELETE_RECORD']);
$focus = new EcmFkVatTable();
$focus->retrieve($_REQUEST['record']);
if(!$focus->ACLAccess('Delete')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
if (isset($_REQUEST['object']) && $_REQUEST['object']="ecmfkvattablerevision") {
//delete ecmfkvattable revision.
$focus = new EcmFkVatTableRevision();
UploadFile::unlink_file($_REQUEST['revision_id'],$_REQUEST['filename']);
} else {
//delete ecmfkvattable and its revisions.
$focus = new EcmFkVatTable();
$focus->retrieve($_REQUEST['record']);
$focus->load_relationships('revisions');
$revisions= $focus->get_linked_beans('revisions','EcmFkVatTableRevision');
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,196 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
// require_once('modules/EcmGroupFkVatTables/HeaderMenu.php');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once('modules/EcmFkVatTables/EcmFkVatTable.php');
// require_once('modules/EcmFkVatTables/Forms.php');
require_once('include/json_config.php');
$json_config = new json_config();
$file = 'modules/EcmGroupFkVatTables/EcmGroupFkVatTable.php';
if(file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupFkVatTable::loadSettings();
}
$cc = array (
'default_payment_condition' => '3caa3a68-4f75-ca20-18a6-5065b4110d25',
'default_delivery_condition' => '4cd1cb6f-ac4b-763e-07d7-5065b1068adb',
'default_document_template' => '20e764d0-7816-5115-475b-4f3d1be98260',
'default_representative_role_id' => NULL,
'default_representative_extra_role_id' => NULL,
'default_manager_role_id' => NULL,
'checkbox_demo' => 0,
'show_images_on_offers' => 1,
'creating_invoice_direct_from_quote' => 1,
'rows_on_item_list_global' => '',
'row_item_height_global' => '',
'row_item_height_selected_global' => '',
'quick_product_item_adding_global' => 0,
'show_pdf_in_div_global' => 0,
'rows_on_item_list' => '6',
'row_item_height' => '35',
'row_item_height_selected' => '70',
'quick_product_item_adding' => 0,
'show_pdf_in_div' => 0,
'settings_user_save' => 1,
);
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height']*$OPT['rows_on_item_list']+40+$OPT['rows_on_item_list']*4;
$focus = new EcmFkVatTable();
if(isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
$focus->format_all_fields();
if(isset($_REQUEST['status']) && $_REQUEST['status'] != '' ) {
$focus->doNotAccepted();
}
$focus->decree_list = str_replace('&quot;', '\'', $focus->getPositionList());
// $focus->position_list = str_replace('&quot;','\"',$focus->getPositionList());
$OPT['status'] = $focus->status;
} else {
$OPT['new_number'] = true;
$datef = $current_user->getPreference('datef');
if($datef != '') $sugar_config['datef'];
$focus->register_date = date($datef);
$focus->payment_date = date($datef,mktime()+30*24*60*60);
$focus->sell_date = date($datef);
}
//if access 'Delete' is avaible for user than he is Manager and he can confirm Quotes.
$OPT['user']['access']['send_email'] = $focus->ACLAccess("send_email");
if(isset($_REQUEST['send_email']) && $_REQUEST['send_email'] == '1') $OPT['setTab'] = 'EMAIL';
$tmp = $current_user->getPreference('num_grp_sep');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_number_grouping_seperator'];
$OPT['sep_1000'] = $tmp;
$tmp = $current_user->getPreference('dec_sep');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_decimal_seperator'];
$OPT['dec_sep'] = $tmp;
$tmp = $current_user->getPreference('default_currency_significant_digits');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_currency_significant_digits'];
$OPT['dec_len'] = $tmp;
$OPT['default_unit'] = "1";
$OPT['default_vat'] = "23.00";
$OPT['default_category'] = "";
$OPT['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
$cq = $current_user->getPreference('confirm_quotes');
$OPT['user']['confirm_quotes'] = ((isset($cq) && $cq)?1:0);
$json = getJSONobj();
$counts=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select count(*) as c from ecmvats where deleted='0'"));
$nvats=$counts['c'];
$w=$GLOBALS['db']->query("select name,id,value from ecmvats where deleted='0' order by name");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$VAT[$r['id']]=array(
"id"=>$r['id'],
"name"=>$r['name'],
"value"=>$r['value']
);
}
$show_pdf=$current_user->getPreference('show_pdf_in_div');
// if(!isset($show_pdf)){
// require_once('modules/EcmGroupFkVatTables/EcmGroupFkVatTable.php');
// $cc = EcmGroupFkVatTable::loadSettings();
// $show_pdf=$cc['show_pdf_in_div_global'];
// }
$scriptOpt = '<script language="javascript">
var SHOW_PDF_IN_DIV ='.$show_pdf.';
var NOOFVATS ='.$nvats.';
var VAT = '.str_replace('&quot;','\"',$json->encode($VAT)).';
var OPT = '.str_replace('&quot;','\"',$json->encode($OPT)).';
var MOD = '.str_replace('&quot;','\"',$json->encode($mod_strings)).';
var N;
</script>';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmFkVatTables/views/DetailView/view.detail.my.php');
$edit = new ViewDetailMy();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmFkVatTables';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
// $edit->bean->total = unformat_number($edit->bean->total);
$edit->preDisplay();
// $arr_template = $focus->getTemplateList();
// if(isset($focus->template_id)) $edit->ss->assign("DOCUMENT_TEMPLATES_OPTIONS", get_select_options_with_id($arr_template, $focus->template_id));
// else $edit->ss->assign("DOCUMENT_TEMPLATES_OPTIONS", get_select_options_with_id($arr_template, ''));
$edit->ss->assign("POSITION_LIST", $focus->position_list);
// $edit->ss->assign("EMAIL_LINK",$focus->createSendEmailLink());
// $email_link_tab = '<script language="javascript">YAHOO.util.Event.addListener(window,"load",function(){setEMAIL = function(){'.$focus->createSendEmailLink().'}});</script>';
// $edit->ss->assign("EMAIL_LINK_TAB",$email_link_tab);
$decreeList = str_replace('"', '\'', $focus->decree_list);
// dump($focus->getPositionList(true));
// dump($decreeList);
$edit->ss->assign('DECREE_LIST', $decreeList);
$edit->ss->assign("OPT", $OPT);
echo $edit->display();

View File

@@ -0,0 +1,91 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/upload_file.php');
require_once('include/upload_file.php');
class EcmFkVatTableSoap{
var $upload_file;
function EcmFkVatTableSoap(){
$this->upload_file = new UploadFile('uploadfile');
}
function saveFile($ecmfkvattable, $portal = false){
global $sugar_config;
$focus = new EcmFkVatTable();
if(!empty($ecmfkvattable['id'])){
$focus->retrieve($ecmfkvattable['id']);
}else{
return '-1';
}
if(!empty($ecmfkvattable['file'])){
$decodedFile = base64_decode($ecmfkvattable['file']);
$this->upload_file->set_for_soap($ecmfkvattable['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 EcmFkVatTableRevision();
$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->ecmfkvattable_name = ;
$revision->revision = $ecmfkvattable['revision'];
$revision->ecmfkvattable_id = $document['id'];
$revision->save();
$focus->ecmfkvattable_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,706 @@
<?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';
class EcmFkVatTable extends SugarBean {
/**
* Table name.
*
* @var stiring
*/
var $table_name = "ecmfkvattables";
/**
* Object name.
*
* @var stiring
*/
var $object_name = "EcmFkVatTable";
/**
* Additional column fields.
*
* @var stiring
*/
var $additional_column_fields = array();
/**
* Module directory.
*
* @var stiring
*/
var $module_dir = 'EcmFkVatTables';
/**
* Relationship fields.
*
* @var stiring
*/
var $relationship_fields = array();
function EcmFkVatTable() {
parent::SugarBean();
$this->setupCustomFields('EcmFkVatTables');
}
function save($check_notify = false) {
if (empty($this->id) || $this->new_with_id) {
if (false) { //!empty($this->uploadfile))
$this->filename = $this->uploadfile;
if (empty($this->id)) {
$this->id = create_guid();
$this->new_with_id = true;
}
$Revision = new EcmFkVatTableRevision();
//save revision.
$Revision->change_log = translate('DEF_CREATE_LOG', 'EcmFkVatTables');
$Revision->revision = $this->revision;
$Revision->ecmfkvattable_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 ecmfkvattable id
rename(UploadFile :: get_url($this->filename, $this->id), UploadFile :: get_url($this->filename, $Revision->id));
//update ecmfkvattable with latest revision id
$this->process_save_dates = false; //make sure that conversion does not happen again.
$this->ecmfkvattable_revision_id = $Revision->id;
}
//set relationship field values if contract_id is passed (via subpanel create)
if (!empty($_POST['contract_id'])) {
$save_revision['ecmfkvattable_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_ecmfkvattables set deleted=1 where id='" . $_POST['load_signed_id'] . "'";
$this->db->query($query);
}
}
$return_id = parent::save($check_notify);
$this->savePositions($return_id);
return $return_id;
}
function savePositions($id = null, $position_list = null) {
global $current_user, $timedate;
if ($position_list == null)
$position_list = $this->position_list;
if ($id == null)
$id = $this->id;
if (count($position_list) > 0)
$this->deleteAssignedPositions($id);
$arr = array();
$position = 0;
// dump($position_list);
// exit;
for ($i = 0; $i < count($position_list); $i++) {
$p = $position_list[$i];
$arr = array(
'id' => create_guid(),
'deleted' => '0',
'date_entered' => date('Y-m-d'),
// 'date_modified' => '',
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290',
// 'modified_user_id' => '',
'ecmfkvattable_id' => $id,
'ecmfkvatkind_id' => $p['ecmfkvatkind_id'],
'acc_wn' => $wn = $p['i_acc_wn'],
'acc_ma' => $ma = $p['i_acc_ma'],
'account_acc_wn' => !$wn ? $p['i_account_acc_wn'] : '0',
'account_acc_ma' => !$ma ? $p['i_account_acc_ma'] : '0',
'zal_wn' => 0,
'zal_ma' => 0,
);
// dump($arr);
// exit;
$q = $this->constructInsertQuery($arr);
// 4389e866-abab-68bf-4b02-51ee268865c5
// dump($arr, $q);
// exit;
$this->db->query($q);
$position++;
}
return $position;
}
function constructInsertQuery($data, $table = '') {
if ($table == '' && isset($this->object_name) && $this->object_name != '') {
$table = strtolower($this->object_name) . "items";
}
else
return "";
$keys = array();
$values = array();
foreach ($data as $key => $value) {
$keys[] = $key;
if (is_array($value))
$values[] = $value[1] . str_replace("'", "\'", $value[0]) . $value[1];
else
$values[] = "'" . str_replace("'", "\'", $value) . "'";
}
$q = "insert into `$table` (`";
$q .= implode('`, `', $keys);
$q .= "`) values (";
$q .= implode(", ", $values);
$q .= ");";
return $q;
}
function deleteAssignedPositions() {
if (isset($this->id) && $this->id != '') {
//$query = "DELETE FROM `".strtolower($this->object_name)."itemsparams` WHERE `".strtolower($this->object_name)."_id`='".$this->id."'";
// $r = $this->db->query($query);
$query = "DELETE FROM `" . strtolower($this->object_name) . "items` WHERE `" . strtolower($this->object_name) . "_id`='" . $this->id . "'";
// echo $query;exit;
$r = $this->db->query($query);
if ($r) {
return true;
}
}
return false;
}
function DrawMainPDF($pdf, $type) {
global $mod_strings;
// echo $this->template->getTemplateFile('subheader_' . $type . '.php');
// exit;
// dump(get_class($pdf));exit;
// $pdf->SetAutoPageBreak(false);
$pdf->SetAutoPageBreak(true, $this->bMargin + $this->tMarign + 25);
switch (strtolower($type)) {
default:
include($this->template->getTemplateFile('subheader_d.php'));
include($this->template->getTemplateFile('subfooter_d.php'));
break;
case 'ac':
case 'r':
case 'd':
case 'pk1':
case 'pk2':
case 'pk3':
case 's_symbol1':
case 's_symbol2':
case 's_identifier1':
case 's_identifier2':
include($this->template->getTemplateFile('subheader_' . $type . '.php'));
include($this->template->getTemplateFile('subfooter_' . $type . '.php'));
break;
}
return;
}
/**
* Pdf getter.
*
* Retrieve pdf stream.
*/
function getPDF($id = null, $method = 'I', $name = null, $type = null) {
global $sugar_config;
// if ($id != null) {
// $this->retrieve($id);
// if ($this->id == '')
// return;
// }
global $mod_strings;
require_once('modules/EcmTexts/EcmText.php');
//echo '<pre>' . var_export($this->ecmlanguage, true) . '</pre>';exit;
// if (isset($this->ecmlanguage) && $this->ecmlanguage != '') {
// $data = EcmText::LoadText(null, null, "EcmServices", $this->ecmlanguage);
// if (isset($data[0]) && isset($data[0]['data']) && isset($data[0]['data']['labels'])) {
// $data = $data[0]['data']['labels'];
// foreach ($data as $key => $value) {
// $mod_strings[$value['label']] = $value['translation'];
// }
// }
// }
$this->format_all_fields();
// dump(__LINE__);
// exit;
$this->setTemplate();
$type = $type ? : @$_REQUEST['type'];
// if (isset($this->template->id) && $this->template->id != '') {
// dump($this->template_id);
// exit;
// dump($this->template_id);
// exit;
switch (strtolower($type)) {
default:
case 'ac':
case 'd':
$this->template->setPDF($this->template_id, array('L'));
break;
case 'r':
case 'pk1':
case 'pk2':
case 'pk3':
$this->template->setPDF($this->template_id, array('P'));
break;
}
// dump(__LINE__);
// exit;
// dump($this->template);
// exit;
// $this->template->pdf->SetAutoPageBreak(true, 40);
$this->DrawMainPDF($this->template->pdf, $type);
$this->template->outputPDF(1, $method);
// }
}
function setTemplate() {
// if (!isset($this->template_id) || $this->template_id == '')
// return null;
// if (isset($this->template))
// return $this->template;
require_once('modules/EcmDocumentTemplates/EcmDocumentTemplate.php');
$this->template = new EcmDocumentTemplate();
$this->template_id = "ef0c4dea-ddf3-de51-9d08-512257d4b675";
//$this->template->retrieve($this->template_id);
$this->template->retrieve($this->template_id, true, false);
if (isset($this->template->id) && $this->template->id != '') {
$this->template->format_all_fields();
}
else
$this->template = null;
// dump($this->template);
// exit;
return $this->template;
}
function get_summary_text() {
return "$this->ecmfkvattable_name";
}
function is_authenticated() {
return $this->authenticated;
}
function fill_in_additional_list_fields() {
$this->fill_in_additional_detail_fields();
}
function fill_in_additional_detail_fields() {
// $vatYear = DateTime::createFromFormat('Y-m-d', $this->date_document);
// $this->vat_year = $vatYear ? $bookYear->format('Y') : false;
goto jump;
global $theme;
global $current_language;
global $timedate;
global $locale;
parent::fill_in_additional_detail_fields();
$mod_strings = return_module_language($current_language, 'EcmFkVatTables');
$query = "SELECT filename,revision,file_ext FROM ecmfkvattable_revisions WHERE id='$this->document_revision_id'";
$result = $this->db->query($query);
$row = $this->db->fetchByAssoc($result);
//popuplate filename
if (isset($row['filename']))
$this->filename = $row['filename'];
//$this->latest_revision = $row['revision'];
if (isset($row['revision']))
$this->revision = $row['revision'];
//populate the file url.
//image is selected based on the extension name <ext>_icon_inline, extension is stored in ecmfkvattable_revisions.
//if file is not found then default image file will be used.
global $img_name;
global $img_name_bare;
if (!empty($row['file_ext'])) {
$img_name = SugarThemeRegistry::current()->getImageURL(strtolower($row['file_ext']) . "_image_inline.gif");
$img_name_bare = strtolower($row['file_ext']) . "_image_inline";
}
//set default file name.
if (!empty($img_name) && file_exists($img_name)) {
$img_name = $img_name_bare;
} else {
$img_name = "def_image_inline"; //todo change the default image.
}
if ($this->ACLAccess('DetailView')) {
$this->file_url = "<a href='index.php?entryPoint=download&id=" . basename(UploadFile :: get_url($this->filename, $this->ecmfkvattable_revision_id)) . "&type=EcmFkVatTables' target='_blank'>" . SugarThemeRegistry::current()->getImage($img_name, 'alt="' . $mod_strings['LBL_LIST_VIEW_DOCUMENT'] . '" border="0"') . "</a>";
$this->file_url_noimage = basename(UploadFile :: get_url($this->filename, $this->ecmfkvattable_revision_id));
} else {
$this->file_url = "";
$this->file_url_noimage = "";
}
//get last_rev_by user name.
$query = "SELECT first_name,last_name, ecmfkvattable_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['ecmfkvattable_status_dom'][$this->status_id];
}
$this->related_doc_name = EcmFkVatTable::get_ecmfkvattable_name($this->related_doc_id);
$this->related_doc_rev_number = EcmFkVatTableRevision::get_ecmfkvattable_revision_name($this->related_doc_rev_id);
$this->save_file = basename($this->file_url_noimage);
jump:
}
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
ecmfkvattables.*";
if ($custom_join) {
$query .= $custom_join['select'];
}
$query .= " FROM ecmfkvattables ";
if ($custom_join) {
$query .= $custom_join['join'];
}
$where_auto = " ecmfkvattables.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 ecmfkvattables.document_name";
return $query;
}
/**
* getter method for ecmbanksymbolount record.
*/
function get_symbol_array($id, array $select = array()) {
global $db;
array_walk($select, function(&$value, $key) {
$value = 's.`' . $value . '`';
});
$selectStatement = implode(', ', $select);
$q = 'SELECT ' . (strlen($selectStatement) ? $selectStatement : 's.*') . ' FROM ecmsymbols AS s WHERE id = \'' . $id . '\' LIMIT 1;';
$r = $db->query($q);
$rr = $db->FetchByAssoc($r);
if ($rr) {
return $rr;
}
return false;
}
/**
* Concentrate get_symbol_array method.
*/
function get_symbol_symbol($id) {
static $symbols = array();
return $symbols[$id] ? : ($symbols[$id] = end($this->get_symbol_array($id, array('symbol'))));
}
/**
* getter method for ecmbankaccount record.
*/
function get_acc_array($id, array $select = array()) {
global $db;
array_walk($select, function(&$value, $key) {
$value = 'ba.`' . $value . '`';
});
$selectStatement = implode(', ', $select);
$q = 'SELECT ' . (strlen($selectStatement) ? $selectStatement : 'ba.*') . ' FROM ecmbankaccounts AS ba WHERE id = \'' . $id . '\' LIMIT 1;';
$r = $db->query($q);
$rr = $db->FetchByAssoc($r);
if ($rr) {
return $rr;
}
return false;
}
/**
* Concentrate get_acc_array method.
*/
function get_acc_code($id) {
static $codes = array();
return $codes[$id] ? : ($codes[$id] = end($this->get_acc_array($id, array('code'))));
}
/**
* Concentrate get_acc_array method.
*/
function get_acc_name($id) {
static $codes = array();
return $codes[$id] ? : ($codes[$id] = end($this->get_acc_array($id, array('name'))));
}
function get_list_view_data() {
$this->fill_in_additional_detail_fields();
$ecmfkvattable_fields = $this->get_list_view_array();
// $vatYear = DateTime::createFromFormat('d.m.Y', $this->date_document);
// $ecmfkvattable_fields['YEAR'] = $vatYear ? $bookYear->format('Y') : false;
$ecmfkvattable_fields['ACC_WN_ID'] = $ecmfkvattable_fields['ACC_WN'] ? : null;
$ecmfkvattable_fields['ACC_MA_ID'] = $ecmfkvattable_fields['ACC_MA'] ? : null;
$ecmfkvattable_fields['ACC_WN_NAME'] = $this->get_acc_name($ecmfkvattable_fields['ACC_WN']) ? : 'Brak';
$ecmfkvattable_fields['ACC_MA_NAME'] = $this->get_acc_name($ecmfkvattable_fields['ACC_MA']) ? : 'Brak';
$ecmfkvattable_fields['ACC_WN'] = $this->get_acc_code($ecmfkvattable_fields['ACC_WN_ID']) ? : '000';
$ecmfkvattable_fields['ACC_MA'] = $this->get_acc_code($ecmfkvattable_fields['ACC_MA_ID']) ? : '000';
$ecmfkvattable_fields['SYMBOL'] = $this->get_symbol_symbol($ecmfkvattable_fields['SYMBOL']) ? : '-';
$ecmfkvattable_fields['IDENTIFIER'] = $ecmfkvattable_fields['IDENTIFIER'] ? : '-';
// dump($ecmfkvattable_fields); exit;
// $ecmfkvattable_fields['ACC_MA_CODE'] = '';
// $ecmfkvattable_fields['ACC_MA_CODE'] = '';
// echo '<pre>' . var_export($this->field_defs, true) . '</pre>';
// echo '<pre>' . var_export($ecmfkvattable_fields, true) . '</pre>';
// exit;
return $ecmfkvattable_fields;
}
function mark_drelationships_deleted($id) {
//do nothing, this call is here to avoid default delete processing since
//delete.php handles deletion of ecmfkvattable revisions.
}
function bean_implements($interface) {
switch ($interface) {
case 'ACL' :
return true;
}
return false;
}
//static function.
function get_ecmfkvattable_name($doc_id) {
if (empty($doc_id))
return null;
$db = DBManagerFactory::getInstance();
$query = "select ecmfkvattable_name from documents where id='$doc_id'";
$result = $db->query($query);
if (!empty($result)) {
$row = $db->fetchByAssoc($result);
if (!empty($row)) {
return $row['ecmfkvattable_name'];
}
}
return null;
}
function getPosition($position, $stockOperations = false) {
if (!is_array($position))
return '';
$return_array = array();
// $return_array['id'] = $position['id'];
// $return_array['deleted'] = $position['deleted'];
// $return_array['date_entered'] = $position['date_entered'];
// $return_array['date_modified'] = $position['date_modified'];
// $return_array['created_by'] = $position['created_by'];
// $return_array['modified_user_id'] = $position['modified_user_id'];
// $return_array['ecmfkvattable_id'] = $position['ecmfkvattable_id'];
$return_array['ecmfkvatkind_id'] = $position['ecmfkvatkind_id'];
$return_array['i_acc_wn'] = $position['acc_wn'];
$return_array['i_acc_ma'] = $position['acc_ma'];
// $return_array['account_acc_wn'] = $position['account_acc_wn'];
// $return_array['account_acc_ma'] = $position['account_acc_ma'];
$return_array['zal_wn'] = $position['zal_wn'];
$return_array['zal_ma'] = $position['zal_ma'];
// Additional
$return_array['vr_name'] = $position['vr_name'];
$return_array['vr_position'] = $position['vr_position'];
//
$return_array['i_acc_wn_code'] = $position['acc_wn_code'];
$return_array['i_acc_ma_code'] = $position['acc_ma_code'];
//
$return_array['i_acc_wn_name'] = $position['acc_wn_name'];
$return_array['i_acc_ma_name'] = $position['acc_ma_name'];
return $return_array;
}
function getPositionList($array = false) {
if (isset($this->id) && $this->id != '') {
$query = '
SELECT
vri.*
, vr.`name` AS vr_name
, vr.`position` AS vr_position
, acc_wn.`code` AS acc_wn_code
, acc_ma.`code` AS acc_ma_code
, acc_wn.`name` AS acc_wn_name
, acc_ma.`name` AS acc_ma_name
FROM `ecmfkvattableitems` AS vri
LEFT JOIN `ecmfkvatkinds` AS vr
ON vr.`id` = vri.`ecmfkvatkind_id`
LEFT JOIN `ecmbankaccounts` AS acc_wn
ON acc_wn.`id` = vri.`acc_wn`
LEFT JOIN `ecmbankaccounts` AS acc_ma
ON acc_ma.`id` = vri.`acc_ma`
WHERE
vri.`ecmfkvattable_id` = \'' . $this->id . '\'
#ORDER BY
#vri.`position` ASC
;
';
// dump($query);
// exit;
$r = $this->db->query($query);
$return_array = array();
if ($r) {
while ($w = $this->db->fetchByAssoc($r)) {
$return_array [] = $this->getPosition($w, $stockOperations);
}
$json = getJSONobj();
return $array ? $return_array : $json->encode($return_array);
}
}
return $array ? false : '[]';
}
}

View File

@@ -0,0 +1,546 @@
<?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: base form for account
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
* ****************************************************************************** */
class EcmFkVatTableFormBase {
function checkForDuplicates($prefix) {
require_once('include/formbase.php');
$focus = new EcmFkVatTable();
dump(1);exit;
$query = '';
$baseQuery = 'select id, name, website, billing_address_city from ecmFkVatTables where deleted!=1 and ';
if (!empty($_POST[$prefix . 'name'])) {
$query = $baseQuery . " name like '" . $_POST[$prefix . 'name'] . "%'";
}
if (!empty($_POST[$prefix . 'billing_address_city']) || !empty($_POST[$prefix . 'shipping_address_city'])) {
$temp_query = '';
if (!empty($_POST[$prefix . 'billing_address_city'])) {
if (empty($temp_query)) {
$temp_query = " billing_address_city like '" . $_POST[$prefix . 'billing_address_city'] . "%'";
} else {
$temp_query .= "or billing_address_city like '" . $_POST[$prefix . 'billing_address_city'] . "%'";
}
}
if (!empty($_POST[$prefix . 'shipping_address_city'])) {
if (empty($temp_query)) {
$temp_query = " shipping_address_city like '" . $_POST[$prefix . 'shipping_address_city'] . "%'";
} else {
$temp_query .= "or shipping_address_city like '" . $_POST[$prefix . 'shipping_address_city'] . "%'";
}
}
if (empty($query)) {
$query .= $baseQuery;
} else {
$query .= ' AND ';
}
$query .= ' (' . $temp_query . ' ) ';
}
if (!empty($query)) {
$rows = array();
global $db;
$result = $db->query($query);
$i = -1;
while (($row = $db->fetchByAssoc($result)) != null) {
$i++;
$rows[$i] = $row;
}
if ($i == -1)
return null;
return $rows;
}
return null;
}
function buildTableForm($rows, $mod = 'EcmFkVatTables') {
if (!ACLController::checkAccess('EcmFkVatTables', 'edit', true)) {
return '';
}
// dump(1);exit;
global $action;
if (!empty($mod)) {
global $current_language;
$mod_strings = return_module_language($current_language, $mod);
}
else
global $mod_strings;
global $app_strings;
$cols = sizeof($rows[0]) * 2 + 1;
if ($action != 'ShowDuplicates') {
$form = "<form action='index.php' method='post' id='dupEcmFkVatTables' name='dupEcmFkVatTables'><input type='hidden' name='selectedEcmFkVatTable' value=''>";
$form .= '<table width="100%"><tr><td>' . $mod_strings['MSG_DUPLICATE'] . '</td></tr><tr><td height="20"></td></tr></table>';
unset($_POST['selectedEcmFkVatTable']);
} else {
$form = '<table width="100%"><tr><td>' . $mod_strings['MSG_SHOW_DUPLICATES'] . '</td></tr><tr><td height="20"></td></tr></table>';
}
$form .= "<table width='100%' cellpadding='0' cellspacing='0' class='list view' border='0'><tr class='pagination'><td colspan='$cols'><table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td>";
// handle buttons
if ($action == 'ShowDuplicates') {
$return_action = 'ListView'; // cn: bug 6658 - hardcoded return action break popup -> create -> duplicate -> cancel
$return_action = (isset($_REQUEST['return_action']) && !empty($_REQUEST['return_action'])) ? $_REQUEST['return_action'] : $return_action;
$form .= "<input type='hidden' name='selectedEcmFkVatTable' id='selectedEcmFkVatTable' value=''><input title='${app_strings['LBL_SAVE_BUTTON_TITLE']}' accessKey='${app_strings['LBL_SAVE_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='Save';\" type='submit' name='button' value=' ${app_strings['LBL_SAVE_BUTTON_LABEL']} '>\n";
if (!empty($_REQUEST['return_module']) && !empty($_REQUEST['return_action']) && !empty($_REQUEST['return_id']))
$form .= "<input title='${app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='${app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.module.value='" . $_REQUEST['return_module'] . "';this.form.action.value='" . $_REQUEST['return_action'] . "';this.form.record.value='" . $_REQUEST['return_id'] . "'\" type='submit' name='button' value=' ${app_strings['LBL_CANCEL_BUTTON_LABEL']} '>";
else if (!empty($_POST['return_module']) && !empty($_POST['return_action']))
$form .= "<input title='${app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='${app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.module.value='" . $_POST['return_module'] . "';this.form.action.value='" . $_POST['return_action'] . "';\" type='submit' name='button' value=' ${app_strings['LBL_CANCEL_BUTTON_LABEL']} '>";
else
$form .= "<input title='${app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='${app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='ListView';\" type='submit' type='submit' name='button' value=' ${app_strings['LBL_CANCEL_BUTTON_LABEL']} '>";
} else {
$form .= "<input type='submit' class='button' name='ContinueEcmFkVatTable' value='${mod_strings['LNK_NEW_ACCOUNT']}'>\n";
}
$form .= "</td></tr></table></td></tr><tr>";
if ($action != 'ShowDuplicates') {
$form .= "<th> &nbsp;</th>";
}
require_once('include/formbase.php');
if (isset($_POST['return_action']) && $_POST['return_action'] == 'SubPanelViewer') {
$_POST['return_action'] = 'DetailView';
}
if (isset($_POST['return_action']) && $_POST['return_action'] == 'DetailView' && empty($_REQUEST['return_id'])) {
unset($_POST['return_action']);
}
$form .= getPostToForm('/emailAddress(PrimaryFlag|OptOutFlag|InvalidFlag)?[0-9]*?$/', true);
if (isset($rows[0])) {
foreach ($rows[0] as $key => $value) {
if ($key != 'id') {
$form .= "<th>" . $mod_strings[$mod_strings['db_' . $key]] . "</th>";
}
}
$form .= "</tr>";
}
$rowColor = 'oddListRowS1';
foreach ($rows as $row) {
$form .= "<tr class='$rowColor'>";
if ($action != 'ShowDuplicates') {
$form .= "<td width='1%' nowrap><a href='#' onclick='document.dupEcmFkVatTables.selectedEcmFkVatTable.value=\"${row['id']}\"; document.dupEcmFkVatTables.submit(); '>[${app_strings['LBL_SELECT_BUTTON_LABEL']}]</a>&nbsp;&nbsp;</td>\n";
}
foreach ($row as $key => $value) {
if ($key != 'id') {
if (isset($_POST['popup']) && $_POST['popup'] == true) {
$form .= "<td scope='row'><a href='#' onclick=\"window.opener.location='index.php?module=EcmFkVatTables&action=DetailView&record=${row['id']}'\">$value</a></td>\n";
}
else
$form .= "<td><a target='_blank' href='index.php?module=EcmFkVatTables&action=DetailView&record=${row['id']}'>$value</a></td>\n";
}
}
if ($rowColor == 'evenListRowS1') {
$rowColor = 'oddListRowS1';
} else {
$rowColor = 'evenListRowS1';
}
$form .= "</tr>";
}
$form .= "<tr class='pagination'><td colspan='$cols'><table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td>";
// handle buttons
if ($action == 'ShowDuplicates') {
$return_action = 'ListView'; // cn: bug 6658 - hardcoded return action break popup -> create -> duplicate -> cancel
$return_action = (isset($_REQUEST['return_action']) && !empty($_REQUEST['return_action'])) ? $_REQUEST['return_action'] : $return_action;
$form .= "<input type='hidden' name='selectedEcmFkVatTable' id='selectedEcmFkVatTable' value=''><input title='${app_strings['LBL_SAVE_BUTTON_TITLE']}' accessKey='${app_strings['LBL_SAVE_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='Save';\" type='submit' name='button' value=' ${app_strings['LBL_SAVE_BUTTON_LABEL']} '>\n";
if (!empty($_REQUEST['return_module']) && !empty($_REQUEST['return_action']) && !empty($_REQUEST['return_id']))
$form .= "<input title='${app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='${app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.module.value=" . $_REQUEST['return_module'] . ";this.form.action.value=" . $_REQUEST['return_action'] . ";this.form.record.value=" . $_REQUEST['return_id'] . "'\" type='submit' name='button' value=' ${app_strings['LBL_CANCEL_BUTTON_LABEL']} '>";
else if (!empty($_POST['return_module']) && !empty($_POST['return_action']))
$form .= "<input title='${app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='${app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.module.value=" . $_POST['return_module'] . ";this.form.action.value=" . $_POST['return_action'] . ";'\" type='submit' name='button' value=' ${app_strings['LBL_CANCEL_BUTTON_LABEL']} '>";
else
$form .= "<input title='${app_strings['LBL_CANCEL_BUTTON_TITLE']}' accessKey='${app_strings['LBL_CANCEL_BUTTON_KEY']}' class='button' onclick=\"this.form.action.value='ListView';\" type='submit' name='button' value=' ${app_strings['LBL_CANCEL_BUTTON_LABEL']} '>";
} else {
$form .= "<input type='submit' class='button' name='ContinueEcmFkVatTable' value='${mod_strings['LNK_NEW_ACCOUNT']}'></form>\n";
}
$form .= "</td></tr></table></td></tr></table>";
return $form;
}
function getForm($prefix, $mod = '', $form = '') {
if (!ACLController::checkAccess('EcmFkVatTables', 'edit', true)) {
return '';
}
if (!empty($mod)) {
global $current_language;
$mod_strings = return_module_language($current_language, $mod);
}
else
global $mod_strings;
global $app_strings;
$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
$the_form .= <<<EOQ
<form name="${prefix}EcmFkVatTableSave" onSubmit="return check_form('${prefix}EcmFkVatTableSave');" method="POST" action="index.php">
<input type="hidden" name="${prefix}module" value="EcmFkVatTables">
<input type="hidden" name="${prefix}action" value="Save">
EOQ;
$the_form .= $this->getFormBody($prefix, $mod, $prefix . "EcmFkVatTableSave");
$the_form .= <<<EOQ
<p><input title="$lbl_save_button_title" accessKey="$lbl_save_button_key" class="button" type="submit" name="button" value=" $lbl_save_button_label " ></p>
</form>
EOQ;
$the_form .= get_left_form_footer();
$the_form .= get_validate_record_js();
return $the_form;
}
function getFormBody($prefix, $mod = '', $formname = '') {
if (!ACLController::checkAccess('EcmFkVatTables', 'edit', true)) {
return '';
}
global $mod_strings;
$temp_strings = $mod_strings;
if (!empty($mod)) {
global $current_language;
$mod_strings = return_module_language($current_language, $mod);
}
global $app_strings;
global $current_user;
$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
$lbl_ecmFkVatTable_name = $mod_strings['LBL_ACCOUNT_NAME'];
$lbl_phone = $mod_strings['LBL_PHONE'];
$lbl_website = $mod_strings['LBL_WEBSITE'];
$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
$user_id = $current_user->id;
$form = <<<EOQ
<p><input type="hidden" name="record" value="">
<input type="hidden" name="email1" value="">
<input type="hidden" name="email2" value="">
<input type="hidden" name="assigned_user_id" value='${user_id}'>
<input type="hidden" name="action" value="Save">
EOQ;
$form .= "$lbl_ecmFkVatTable_name&nbsp;<span class='required'>$lbl_required_symbol</span><br><input name='name' type='text' value=''><br>";
$form .= "$lbl_phone<br><input name='phone_office' type='text' value=''><br>";
$form .= "$lbl_website<br><input name='website' type='text' value='http://'><br>";
$form .='</p>';
$javascript = new javascript();
$javascript->setFormName($formname);
$javascript->setSugarBean(new EcmFkVatTable());
$javascript->addRequiredFields($prefix);
$form .=$javascript->getScript();
$mod_strings = $temp_strings;
return $form;
}
function getWideFormBody($prefix, $mod = '', $formname = '', $contact = '') {
if (!ACLController::checkAccess('EcmFkVatTables', 'edit', true)) {
return '';
}
if (empty($contact)) {
$contact = new Contact();
}
global $mod_strings;
$temp_strings = $mod_strings;
if (!empty($mod)) {
global $current_language;
$mod_strings = return_module_language($current_language, $mod);
}
global $app_strings;
global $current_user;
$ecmFkVatTable = new EcmFkVatTable();
$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
$lbl_ecmFkVatTable_name = $mod_strings['LBL_ACCOUNT_NAME'];
$lbl_phone = $mod_strings['LBL_PHONE'];
$lbl_website = $mod_strings['LBL_WEBSITE'];
if (isset($contact->assigned_user_id)) {
$user_id = $contact->assigned_user_id;
} else {
$user_id = $current_user->id;
}
//Retrieve Email address and set email1, email2
$sugarEmailAddress = new SugarEmailAddress();
$sugarEmailAddress->handleLegacyRetrieve($contact);
if (!isset($contact->email1)) {
$contact->email1 = '';
}
if (!isset($contact->email2)) {
$contact->email2 = '';
}
if (!isset($contact->email_opt_out)) {
$contact->email_opt_out = '';
}
$form = "";
$default_desc = "";
if (!empty($contact->description)) {
$default_desc = $contact->description;
}
$form .= <<<EOQ
<input type="hidden" name="${prefix}record" value="">
<input type="hidden" name="${prefix}phone_fax" value="{$contact->phone_fax}">
<input type="hidden" name="${prefix}phone_other" value="{$contact->phone_other}">
<input type="hidden" name="${prefix}email1" value="{$contact->email1}">
<input type="hidden" name="${prefix}email2" value="{$contact->email2}">
<input type='hidden' name='${prefix}billing_address_street' value='{$contact->primary_address_street}'><input type='hidden' name='${prefix}billing_address_city' value='{$contact->primary_address_city}'><input type='hidden' name='${prefix}billing_address_state' value='{$contact->primary_address_state}'><input type='hidden' name='${prefix}billing_address_postalcode' value='{$contact->primary_address_postalcode}'><input type='hidden' name='${prefix}billing_address_country' value='{$contact->primary_address_country}'>
<input type='hidden' name='${prefix}shipping_address_street' value='{$contact->alt_address_street}'><input type='hidden' name='${prefix}shipping_address_city' value='{$contact->alt_address_city}'><input type='hidden' name='${prefix}shipping_address_state' value='{$contact->alt_address_state}'><input type='hidden' name='${prefix}shipping_address_postalcode' value='{$contact->alt_address_postalcode}'><input type='hidden' name='${prefix}shipping_address_country' value='{$contact->alt_address_country}'>
<input type="hidden" name="${prefix}assigned_user_id" value='${user_id}'>
<input type='hidden' name='${prefix}do_not_call' value='{$contact->do_not_call}'>
<input type='hidden' name='${prefix}email_opt_out' value='{$contact->email_opt_out}'>
<table width='100%' border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" nowrap scope="row">$lbl_ecmFkVatTable_name&nbsp;<span class="required">$lbl_required_symbol</span></td>
<TD width="80%" nowrap scope="row">{$mod_strings['LBL_DESCRIPTION']}</TD>
</tr>
<tr>
<td nowrap ><input name='{$prefix}name' type="text" value="$contact->ecmFkVatTable_name"></td>
<TD rowspan="5" ><textarea name='{$prefix}description' rows='6' cols='50' >$default_desc</textarea></TD>
</tr>
<tr>
<td nowrap scope="row">$lbl_phone</td>
</tr>
<tr>
<td nowrap ><input name='{$prefix}phone_office' type="text" value="$contact->phone_work"></td>
</tr>
<tr>
<td nowrap scope="row">$lbl_website</td>
</tr>
<tr>
<td nowrap ><input name='{$prefix}website' type="text" value="http://"></td>
</tr>
EOQ;
//carry forward custom lead fields common to ecmFkVatTables during Lead Conversion
$tempEcmFkVatTable = new EcmFkVatTable();
if (method_exists($contact, 'convertCustomFieldsForm'))
$contact->convertCustomFieldsForm($form, $tempEcmFkVatTable, $prefix);
unset($tempEcmFkVatTable);
$form .= <<<EOQ
</TABLE>
EOQ;
$javascript = new javascript();
$javascript->setFormName($formname);
$javascript->setSugarBean(new EcmFkVatTable());
$javascript->addRequiredFields($prefix);
$form .=$javascript->getScript();
$mod_strings = $temp_strings;
return $form;
}
function handleSave($prefix, $redirect = true, $useRequired = false) {
require_once('include/formbase.php');
$focus = new EcmFkVatTable();
if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
return null;
}
$focus = populateFromPost($prefix, $focus);
if (isset($GLOBALS['check_notify'])) {
$check_notify = $GLOBALS['check_notify'];
} else {
$check_notify = FALSE;
}
if (empty($_POST['record']) && empty($_POST['dup_checked'])) {
$duplicateEcmFkVatTables = $this->checkForDuplicates($prefix);
if (isset($duplicateEcmFkVatTables)) {
$location = 'module=EcmFkVatTables&action=ShowDuplicates';
$get = '';
//add all of the post fields to redirect get string
foreach ($focus->column_fields as $field) {
if (!empty($focus->$field) && !is_object($focus->$field)) {
$get .= "&EcmFkVatTables$field=" . urlencode($focus->$field);
}
}
foreach ($focus->additional_column_fields as $field) {
if (!empty($focus->$field)) {
$get .= "&EcmFkVatTables$field=" . urlencode($focus->$field);
}
}
if ($focus->hasCustomFields()) {
foreach ($focus->field_defs as $name => $field) {
if (!empty($field['source']) && $field['source'] == 'custom_fields') {
$get .= "&EcmFkVatTables$name=" . urlencode($focus->$name);
}
}
}
$emailAddress = new SugarEmailAddress();
$get .= $emailAddress->getFormBaseURL($focus);
//create list of suspected duplicate ecmFkVatTable id's in redirect get string
$i = 0;
foreach ($duplicateEcmFkVatTables as $ecmFkVatTable) {
$get .= "&duplicate[$i]=" . $ecmFkVatTable['id'];
$i++;
}
//add return_module, return_action, and return_id to redirect get string
$get .= '&return_module=';
if (!empty($_POST['return_module']))
$get .= $_POST['return_module'];
else
$get .= 'EcmFkVatTables';
$get .= '&return_action=';
if (!empty($_POST['return_action']))
$get .= $_POST['return_action'];
//else $get .= 'DetailView';
if (!empty($_POST['return_id']))
$get .= '&return_id=' . $_POST['return_id'];
if (!empty($_POST['popup']))
$get .= '&popup=' . $_POST['popup'];
if (!empty($_POST['create']))
$get .= '&create=' . $_POST['create'];
//now redirect the post to modules/EcmFkVatTables/ShowDuplicates.php
if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
ob_clean();
$json = getJSONobj();
$_SESSION['SHOW_DUPLICATES'] = $get;
echo $json->encode(array('status' => 'dupe', 'get' => $location . $get));
} else {
if (!empty($_POST['to_pdf']))
$location .= '&to_pdf=' . $_POST['to_pdf'];
$_SESSION['SHOW_DUPLICATES'] = $get;
header("Location: index.php?$location");
}
return null;
}
}
if (!$focus->ACLAccess('Save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$focus->save($check_notify);
$return_id = $focus->id;
$GLOBALS['log']->debug("Saved record with id of " . $return_id);
if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
$json = getJSONobj();
echo $json->encode(array('status' => 'success',
'get' => ''));
$trackerManager = TrackerManager::getInstance();
$timeStamp = gmdate($GLOBALS['timedate']->get_db_date_time_format());
if ($monitor = $trackerManager->getMonitor('tracker')) {
$monitor->setValue('action', 'detailview');
$monitor->setValue('user_id', $GLOBALS['current_user']->id);
$monitor->setValue('module_name', 'EcmFkVatTables');
$monitor->setValue('date_modified', $timeStamp);
$monitor->setValue('visible', 1);
if (!empty($this->bean->id)) {
$monitor->setValue('item_id', $return_id);
$monitor->setValue('item_summary', $focus->get_summary_text());
}
$trackerManager->saveMonitor($monitor, true, true);
}
return null;
}
if (isset($_POST['popup']) && $_POST['popup'] == 'true') {
$get = '&module=';
if (!empty($_POST['return_module']))
$get .= $_POST['return_module'];
else
$get .= 'EcmFkVatTables';
$get .= '&action=';
if (!empty($_POST['return_action']))
$get .= $_POST['return_action'];
else
$get .= 'Popup';
if (!empty($_POST['return_id']))
$get .= '&return_id=' . $_POST['return_id'];
if (!empty($_POST['popup']))
$get .= '&popup=' . $_POST['popup'];
if (!empty($_POST['create']))
$get .= '&create=' . $_POST['create'];
if (!empty($_POST['to_pdf']))
$get .= '&to_pdf=' . $_POST['to_pdf'];
$get .= '&name=' . $focus->name;
$get .= '&query=true';
header("Location: index.php?$get");
return;
}
if ($redirect) {
handleRedirect($return_id, 'EcmFkVatTables');
} else {
return $focus;
}
}
}

View File

@@ -0,0 +1,326 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
global $sugar_config, $current_user, $mod_strings, $current_user, $app_list_strings;
// include_once('modules/EcmQuotes/EcmQuote.php');
require_once('modules/EcmFkVatTables/EcmFkVatTable.php');
// require_once('modules/EcmFkVatTables/Forms.php');
require_once('include/json_config.php');
$json_config = new json_config();
$file = 'modules/EcmGroupFkVatTables/EcmGroupFkVatTable.php';
if (file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupFkVatTable::loadSettings();
}
$cc = array (
'default_payment_condition' => '3caa3a68-4f75-ca20-18a6-5065b4110d25',
'default_delivery_condition' => '4cd1cb6f-ac4b-763e-07d7-5065b1068adb',
'default_document_template' => '20e764d0-7816-5115-475b-4f3d1be98260',
'default_representative_role_id' => NULL,
'default_representative_extra_role_id' => NULL,
'default_manager_role_id' => NULL,
'checkbox_demo' => 0,
'show_images_on_offers' => 1,
'creating_invoice_direct_from_quote' => 1,
'rows_on_item_list_global' => '',
'row_item_height_global' => '',
'row_item_height_selected_global' => '',
'quick_product_item_adding_global' => 0,
'show_pdf_in_div_global' => 0,
'rows_on_item_list' => '6',
'row_item_height' => '35',
'row_item_height_selected' => '70',
'quick_product_item_adding' => 0,
'show_pdf_in_div' => 0,
'settings_user_save' => 1,
);
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height'] * $OPT['rows_on_item_list'] + 40 + $OPT['rows_on_item_list'] * 4;
$OPT['quick_product_item_adding'] = $cc['quick_product_item_adding'];
$OPT['check_parent_id'] = true;
$cq = $current_user->getPreference('confirm_quotes');
$OPT['user']['confirm_quotes'] = ((isset($cq) && $cq) ? 1 : 0);
$focus = new EcmFkVatTable();
$OPT['auto_commiting'] = $focus->ACLAccess('auto_commiting');
if (isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
// dump($focus->toArray());
// exit;
if (isset($focus->id) && $focus->id != '') {
if ($focus->accepted == 1) {
return;
}
$focus->format_all_fields();
$focus->decree_list = str_replace('&quot;', '\'', $focus->getPositionList());
// $focus->position_list = str_replace('&quot;', '\'', $focus->getPositionList());
// $focus->fkvattables_list = str_replace('&quot;', '\'', $focus->getFkVatTablePositionList());
// $focus->income_list = str_replace('&quot;', '\'', $focus->getIncomePositionList());
// if (!isset($focus->status) || $focus->status == '')
// $focus->status = 's10';
// elseif ($focus->status = 's40')
// $focus->status = 's10';
//$focus->deleteReservations();
// $focus->unreserve();
$OPT['save_temp_reservations'] = true;
}
}
else {
$OPT['new_number'] = true;
$focus->status = 'tableed';
}
if ($_REQUEST['ecmquote_id']) {
$quo = new EcmQuote();
$quo->retrieve($_REQUEST['ecmquote_id']);
$arr = array('parent_id', 'parent_name', 'status', 'name', 'table_date', 'currency_id', 'template_id', 'validtill_date', 'is_vat_free', 'to_vatid', 'ecmlanguage', 'parent_address_street', 'parent_address_city', 'parent_address_postalcode', 'parent_address_country', 'parent_name_copy', 'parent_contact_name', 'parent_contact_title', 'show_primary_params', 'show_advanced_params');
foreach ($arr as $a) {
$focus->$a = $quo->$a;
}
}
$OPT['user']['access']['send_email'] = $focus->ACLAccess('send_email');
$OPT['old_status'] = (isset($focus->status) && $focus->status != '') ? $focus->status : 'not_accepted';
if ($_REQUEST['isDuplicate'] == 'true') {
$_POST['isDuplicate'] = true;
$focus->id = '';
$OPT['isDuplicate'] = ture;
$OPT['new_number'] = true;
}
if (!isset($focus->discount) || $focus->discount == '')
$focus->discount = 0.00;
if ($OPT['new_number'] == true) {
$datef = $current_user->getPreference('datef');
if ($datef != '')
$sugar_config['datef'];
$focus->table_date = date($datef);
$focus->payment_date = date($datef, mktime() + 30 * 24 * 60 * 60);
$focus->sell_date = date($datef);
}
$tmp = $current_user->getPreference('num_grp_sep');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_number_grouping_seperator'];
$OPT['sep_1000'] = $tmp;
$tmp = $current_user->getPreference('dec_sep');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_decimal_seperator'];
$OPT['dec_sep'] = $tmp;
$tmp = $current_user->getPreference('default_currency_significant_digits');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_currency_significant_digits'];
$OPT['dec_len'] = $tmp;
$OPT['default_unit'] = 'SZT.';
$OPT['default_vat'] = '23.00';
$OPT['default_category'] = '';
$OPT['default_currency'] = '-99';
$OPT['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
require_once('modules/EcmTexts/EcmText.php');
foreach ($app_list_strings['ecmlanguages_dom'] as $key => $value) {
$data = EcmText::LoadText(null, null, 'EcmFkVatTables', $key);
if (isset($data[0]) && isset($data[0]['data']))
$d = $data[0]['data']; else {
$d = $PDFLL;
if (!isset($d['labels']))
$d['labels'] = $PDFLL['labels'];
if (!isset($d['texts']['Contacts']['header_text']))
$d['texts']['Contacts']['header_text'] = $mod_strings['LBL_DEFAULT_CONTACT_HEADER_TEXT'];
if (!isset($d['texts']['Contacts']['footer_text']))
$d['texts']['Contacts']['footer_text'] = $mod_strings['LBL_DEFAULT_CONTACT_FOOTER_TEXT'];
if (!isset($d['texts']['Contacts']['ads_text']))
$d['texts']['Contacts']['ads_text'] = $mod_strings['LBL_DEFAULT_CONTACT_ADS_TEXT'];
if (!isset($d['texts']['Accounts']['header_text']))
$d['texts']['Accounts']['header_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_HEADER_TEXT'];
if (!isset($d['texts']['Accounts']['footer_text']))
$d['texts']['Accounts']['footer_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_FOOTER_TEXT'];
if (!isset($d['texts']['Accounts']['ads_text']))
$d['texts']['Accounts']['ads_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_ADS_TEXT'];
}
$OPT['ecmlanguage'][$key]['texts'] = $d['texts'];
}
$show_pdf = $current_user->getPreference('show_pdf_in_div');
// if (!isset($show_pdf)) {
// require_once('modules/EcmGroupFkVatTables/EcmGroupFkVatTable.php');
// $cc = EcmGroupFkVatTable::loadSettings();
// $show_pdf = $cc['show_pdf_in_div_global'];
// }
$w = $GLOBALS[db]->query('select name,id,value from ecmvats where deleted=\'0\' order by name');
$nvats = mysql_num_rows($w);
while ($r = $GLOBALS[db]->fetchByAssoc($w)) {
$VAT[$r['id']] = array(
'id' => $r['id'],
'name' => $r['name'],
'value' => $r['value']
);
}
//echo '<pre>' . var_export($OPT, true); exit;
$json = getJSONobj();
$scriptOpt = '
<script language="javascript">
var SHOW_PDF_IN_DIV = ' . ($show_pdf ? : 'false') . ';
var OPT = ' . str_replace('&quot;', '"', $json->encode($OPT)) . ';
var MOD = ' . str_replace('&quot;', '"', $json->encode($mod_strings)) . ';
var N, N2;
</script>
';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmFkVatTables/views/EditView/view.edit.my.php');
$edit = new EditViewMy();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmFkVatTables';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/EditView/Tabs/EditView.tpl';
// Build rw stock and pw stock option lists.
$w = $GLOBALS['db']->query("select name,id from ecmstocks where deleted='0' order by name asc");
$stock_id = ($focus->stock_id ? : $GLOBALS['app_list_strings']['ecmfkvattables_stock_id_dom']);
$pw_stock_id = ($focus->pw_stock_id ? : $GLOBALS['app_list_strings']['ecmfkvattables_pw_stock_id_dom']);
$stocks[] = $pw_stocks[] = '<option value="">' . $GLOBALS['app_list_strings']['stock_select'] . '</option>';
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
$option = '<option value="'. $r['id'] . '"%s>' . $r['name'] . '</option>';
$stock_selected = $r['id'] == $stock_id;
$pw_stock_selected = $r['id'] == $pw_stock_id;
array_push($stocks , sprintf($option, $stock_selected ? ' selected' : ''));
array_push($pw_stocks , sprintf($option, $pw_stock_selected ? ' selected' : ''));
}
$status = array();
foreach($app_list_strings['ecmfkvattables_status_dom'] as $key => $value)
{
$option = '<option value="'. $key . '"%s>' . $value . '</option>';
$selected = ($key == $focus->status);
//var_dump($key, $value, $selected);
array_push($status , sprintf($option, $selected ? ' selected' : ''));
}
$edit->ss->assign('STATUS', implode($status));
$repair_status = array();
foreach($app_list_strings['ecmfkvattables_repair_status_dom'] as $key => $value) {
$option = '<option value="' . $key . '"%s>' . $value . '</option>';
$selected = ($key == $focus->repair_status);
array_push($repair_status, sprintf($option, $selected ? ' selected' : ''));
}
$edit->ss->assign('REPAIR_STATUS', implode($repair_status));
$focus->history = htmlspecialchars_decode($focus->history) ? : '[]';
//echo '<pre>' . var_export(strlen($focus->history), true) . '</pre>';
//echo '<pre>' . var_export(json_decode($focus->history, true), true) . '</pre>';
$edit->ss->assign('HISTORY', json_decode($focus->history, true));
$edit->ss->assign('STOCK', implode($stocks));
$edit->ss->assign('PW_STOCK', implode($pw_stocks));
$edit->ss->assign('OPT', $OPT);
$edit->preDisplay();
// Build templates option list.
// $arr_template = $focus->getTemplateList();
// $tt = array();
// foreach ($arr_template as $k => $v) {
// $option = '<option value="'. $k . '"%s>' . $v . '</option>';
// $selected = ($k == $focus->template_id);
// array_push($tt , sprintf($option, $selected ? ' selected' : ''));
// }
// $edit->ss->assign('DOCUMENT_TEMPLATES_OPTIONS', implode($tt));
if (count($_REQUEST['check']) > 0) {
foreach ($_REQUEST['check'] as $ch) {
$r = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query('select * from ecmquoteitems where id=' . $ch . ''));
$pos = EcmQuote::getPosition($r);
$pos['item_id'] = $ch;
$ret[] = $pos;
}
//print_r($ret);die();
$focus->position_list = $json->encode($ret);
}
if (!$focus->id)
$temp_id = create_guid();
else
$temp_id = $focus->id;
$edit->ss->assign('TEMP_ID', $temp_id);
$decreeList = str_replace('"', '\'', $focus->decree_list);
// dump($focus->getPositionList(true));
// dump($decreeList);
$edit->ss->assign('DECREE_LIST', $decreeList);
// $edit->ss->assign('MFP', $focus->loadParserArray());
echo $edit->display();
//echo '<div id='subpanels'>';
//require_once('subpanels.php');
//echo '</div>';

View File

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

64
modules/EcmFkVatTables/Menu.php Executable file
View File

@@ -0,0 +1,64 @@
<?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, $current_user;
if (ACLController::checkAccess('EcmFkVatTables', 'edit', true)) {
$module_menu[] = array(
'index.php?module=EcmFkVatTables&action=EditView&return_module=EcmFkVats&return_action=DetailView',
$mod_strings['LNK_NEW_DOCUMENT'],
'CreateEcmFkVatTables',
);
}
if (ACLController::checkAccess('EcmFkVatTables', 'list', true)) {
$module_menu[] = array(
'index.php?module=EcmFkVatTables&action=index',
$mod_strings['LNK_DOCUMENT_LIST'],
'EcmFkVatTables',
);
}

77
modules/EcmFkVatTables/Save.php Executable file
View File

@@ -0,0 +1,77 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
$json = getJSONobj();
$pll = array();
$exp = explode("||||", $_POST['decree_list']);
// dump($_POST);
// exit;
foreach($exp as $ep){
if($ep){
$pll[] = $json->decode(htmlspecialchars_decode($ep));
}
}
$_POST['position_list'] = $pll;
require_once("modules/EcmFkVatTables/EcmFkVatTable.php");
require_once('include/formbase.php');
$focus = new EcmFkVatTable();
if(isset($_POST['record']) && $_POST['record'] != '') {
$focus->retrieve($_POST['record']);
}
if(!$focus->ACLAccess('Save')){
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$check_notify = FALSE;
foreach($focus->column_fields as $field){
if(isset($_POST[$field])){
$value = $_POST[$field];
$focus->$field = $value;
}
}
foreach($focus->additional_column_fields as $field){
if(isset($_POST[$field])){
$value = $_POST[$field];
$focus->$field = $value;
}
}
$json = getJSONobj();
$pl = $_POST['position_list'];
// dump($pl);
// dump($pll);
// dump($focus->id);
// exit;
if($focus->account_acc_ma == '1') {
$focus->acc_ma = '';
$focus->acc_ma_code = '';
}
if($focus->account_acc_wn == '1') {
$focus->acc_wn = '';
$focus->acc_wn_code = '';
}
// dump($focus->toArray());
// exit;
$focus->position_list = $pl;
$focus->save($check_notify);
$return_id = $focus->id;
handleRedirect($return_id,'EcmFkVatTables');

View File

@@ -0,0 +1,318 @@
<?php
error_reporting(E_ALL);
set_time_limit(30);
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
global $sugar_config, $current_user, $mod_strings, $current_user, $app_list_strings;
include_once('modules/EcmQuotes/EcmQuote.php');
require_once('modules/EcmFkVatTables/EcmFkBook.php');
// require_once('modules/EcmFkVatTables/Forms.php');
require_once('include/json_config.php');
goto jumphax;
$json_config = new json_config();
$file = 'modules/EcmGroupFkVatTables/EcmGroupFkBook.php';
if (file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupFkVatTable::loadSettings();
}
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height'] * $OPT['rows_on_item_list'] + 40 + $OPT['rows_on_item_list'] * 4;
$OPT['quick_product_item_adding'] = $cc['quick_product_item_adding'];
$OPT['check_parent_id'] = true;
$cq = $current_user->getPreference('confirm_quotes');
$OPT['user']['confirm_quotes'] = ((isset($cq) && $cq) ? 1 : 0);
$focus = new EcmFkVatTable();
$OPT['auto_commiting'] = $focus->ACLAccess('auto_commiting');
if (isset($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
if (isset($focus->id) && $focus->id != '') {
if ($focus->accepted == 1) {
return;
}
$focus->format_all_fields();
$focus->position_list = str_replace('&quot;', '\'', $focus->getPositionList());
$focus->services_list = str_replace('&quot;', '\'', $focus->getFkVatTablePositionList());
$focus->income_list = str_replace('&quot;', '\'', $focus->getIncomePositionList());
if (!isset($focus->status) || $focus->status == '')
$focus->status = 's10';
elseif ($focus->status = 's40')
$focus->status = 's10';
//$focus->deleteReservations();
$focus->unreserve();
$OPT['save_temp_reservations'] = true;
}
}
else {
$OPT['new_number'] = true;
$focus->status = 'tableed';
}
if ($_REQUEST['ecmquote_id']) {
$quo = new EcmQuote();
$quo->retrieve($_REQUEST['ecmquote_id']);
$arr = array('parent_id', 'parent_name', 'status', 'name', 'table_date', 'currency_id', 'template_id', 'validtill_date', 'is_vat_free', 'to_vatid', 'ecmlanguage', 'parent_address_street', 'parent_address_city', 'parent_address_postalcode', 'parent_address_country', 'parent_name_copy', 'parent_contact_name', 'parent_contact_title', 'show_primary_params', 'show_advanced_params');
foreach ($arr as $a) {
$focus->$a = $quo->$a;
}
}
$OPT['user']['access']['send_email'] = $focus->ACLAccess('send_email');
$OPT['old_status'] = (isset($focus->status) && $focus->status != '') ? $focus->status : 'not_accepted';
if ($_REQUEST['isDuplicate'] == 'true') {
$_POST['isDuplicate'] = true;
$focus->id = '';
$OPT['isDuplicate'] = ture;
$OPT['new_number'] = true;
}
if (!isset($focus->discount) || $focus->discount == '')
$focus->discount = 0.00;
if ($OPT['new_number'] == true) {
$datef = $current_user->getPreference('datef');
if ($datef != '')
$sugar_config['datef'];
$focus->table_date = date($datef);
$focus->payment_date = date($datef, mktime() + 30 * 24 * 60 * 60);
$focus->sell_date = date($datef);
}
$tmp = $current_user->getPreference('num_grp_sep');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_number_grouping_seperator'];
$OPT['sep_1000'] = $tmp;
$tmp = $current_user->getPreference('dec_sep');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_decimal_seperator'];
$OPT['dec_sep'] = $tmp;
$tmp = $current_user->getPreference('default_currency_significant_digits');
if (!isset($tmp) || $tmp == '' || $tmp == NULL)
$tmp = $sugar_config['default_currency_significant_digits'];
$OPT['dec_len'] = $tmp;
$OPT['default_unit'] = 'SZT.';
$OPT['default_vat'] = '23.00';
$OPT['default_category'] = '';
$OPT['default_currency'] = '-99';
$OPT['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
require_once('modules/EcmTexts/EcmText.php');
dump($app_list_strings['ecmlanguages_dom']);
exit;
foreach ($app_list_strings['ecmlanguages_dom'] as $key => $value) {
$data = EcmText::LoadText(null, null, 'EcmFkVatTables', $key);
dump($data);exit;
if (isset($data[0]) && isset($data[0]['data']))
$d = $data[0]['data']; else {
$d = $PDFLL;
if (!isset($d['labels']))
$d['labels'] = $PDFLL['labels'];
if (!isset($d['texts']['Contacts']['header_text']))
$d['texts']['Contacts']['header_text'] = $mod_strings['LBL_DEFAULT_CONTACT_HEADER_TEXT'];
if (!isset($d['texts']['Contacts']['footer_text']))
$d['texts']['Contacts']['footer_text'] = $mod_strings['LBL_DEFAULT_CONTACT_FOOTER_TEXT'];
if (!isset($d['texts']['Contacts']['ads_text']))
$d['texts']['Contacts']['ads_text'] = $mod_strings['LBL_DEFAULT_CONTACT_ADS_TEXT'];
if (!isset($d['texts']['Accounts']['header_text']))
$d['texts']['Accounts']['header_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_HEADER_TEXT'];
if (!isset($d['texts']['Accounts']['footer_text']))
$d['texts']['Accounts']['footer_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_FOOTER_TEXT'];
if (!isset($d['texts']['Accounts']['ads_text']))
$d['texts']['Accounts']['ads_text'] = $mod_strings['LBL_DEFAULT_ACCOUNT_ADS_TEXT'];
}
$OPT['ecmlanguage'][$key]['texts'] = $d['texts'];
}
$show_pdf = $current_user->getPreference('show_pdf_in_div');
if (!isset($show_pdf)) {
require_once('modules/EcmGroupFkVatTables/EcmGroupFkBook.php');
$cc = EcmGroupFkVatTable::loadSettings();
$show_pdf = $cc['show_pdf_in_div_global'];
}
$w = $GLOBALS[db]->query('select name,id,value from ecmvats where deleted=\'0\' order by name');
$nvats = mysql_num_rows($w);
while ($r = $GLOBALS[db]->fetchByAssoc($w)) {
$VAT[$r['id']] = array(
'id' => $r['id'],
'name' => $r['name'],
'value' => $r['value']
);
}
jumphax:
$text = EcmText::LoadText(null, null, 'EcmFkVatTables', $key);
// dump($text[0]['data']['texts']);
$json = getJSONobj();
$scriptOpt = '
<script language="javascript">
var descriptionSource = ' . str_replace('&quot;', '"', $json->encode(@$text[0]['data']['texts'] ? : array())) . ';
// console.log(descriptionSource);
</script>
';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmFkVatTables/views/EditView/view.edit.my.php');
$focus = new EcmFkVatTable();
$focus->retrieve($_REQUEST['record']);
$edit = new EditViewMy();
$edit->ss = new Sugar_Smarty();
$edit->module = 'EcmFkVatTables';
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/EditView/Tabs/EditView.tpl';
goto jumphax2;
// Build rw stock and pw stock option lists.
$w = $GLOBALS['db']->query("select name,id from ecmstocks where deleted='0' order by name asc");
$stock_id = ($focus->stock_id ? : $GLOBALS['app_list_strings']['fkvattables_stock_id_dom']);
$pw_stock_id = ($focus->pw_stock_id ? : $GLOBALS['app_list_strings']['fkvattables_pw_stock_id_dom']);
$stocks[] = $pw_stocks[] = '<option value="">' . $GLOBALS['app_list_strings']['stock_select'] . '</option>';
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
$option = '<option value="'. $r['id'] . '"%s>' . $r['name'] . '</option>';
$stock_selected = $r['id'] == $stock_id;
$pw_stock_selected = $r['id'] == $pw_stock_id;
array_push($stocks , sprintf($option, $stock_selected ? ' selected' : ''));
array_push($pw_stocks , sprintf($option, $pw_stock_selected ? ' selected' : ''));
}
$status = array();
foreach($app_list_strings['fkvattables_status_dom'] as $key => $value)
{
$option = '<option value="'. $key . '"%s>' . $value . '</option>';
$selected = ($key == $focus->status);
//var_dump($key, $value, $selected);
array_push($status , sprintf($option, $selected ? ' selected' : ''));
}
$edit->ss->assign('STATUS', implode($status));
$repair_status = array();
foreach($app_list_strings['fkvattables_repair_status_dom'] as $key => $value) {
$option = '<option value="' . $key . '"%s>' . $value . '</option>';
$selected = ($key == $focus->repair_status);
array_push($repair_status, sprintf($option, $selected ? ' selected' : ''));
}
$edit->ss->assign('REPAIR_STATUS', implode($repair_status));
$focus->history = htmlspecialchars_decode($focus->history) ? : '[]';
//echo '<pre>' . var_export(strlen($focus->history), true) . '</pre>';
//echo '<pre>' . var_export(json_decode($focus->history, true), true) . '</pre>';
$edit->ss->assign('HISTORY', json_decode($focus->history, true));
$edit->ss->assign('STOCK', implode($stocks));
$edit->ss->assign('PW_STOCK', implode($pw_stocks));
$edit->ss->assign('OPT', $OPT);
$edit->preDisplay();
// Build templates option list.
$arr_template = $focus->getTemplateList();
$tt = array();
foreach ($arr_template as $k => $v) {
$option = '<option value="'. $k . '"%s>' . $v . '</option>';
$selected = ($k == $focus->template_id);
array_push($tt , sprintf($option, $selected ? ' selected' : ''));
}
$edit->ss->assign('DOCUMENT_TEMPLATES_OPTIONS', implode($tt));
if (count($_REQUEST['check']) > 0) {
foreach ($_REQUEST['check'] as $ch) {
$r = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query('select * from ecmquoteitems where id=' . $ch . ''));
$pos = EcmQuote::getPosition($r);
$pos['item_id'] = $ch;
$ret[] = $pos;
}
//print_r($ret);die();
$focus->position_list = $json->encode($ret);
}
if (!$focus->id)
$temp_id = create_guid();
else
$temp_id = $focus->id;
$edit->ss->assign('TEMP_ID', $temp_id);
$edit->ss->assign('POSITION_LIST', $focus->position_list);
$edit->ss->assign('SERVICES_LIST', $focus->services_list);
$edit->ss->assign('INCOME_LIST', $focus->income_list);
$edit->ss->assign('MFP', $focus->loadParserArray());
jumphax2:
$edit->preDisplay();
echo $edit->display();
//echo '<div id='subpanels'>';
//require_once('subpanels.php');
//echo '</div>';

View File

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

View File

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

View File

@@ -0,0 +1,139 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/ytree/Node.php');
//function returns an array of objects of Node type.
function get_node_data($params,$get_array=false) {
$ret=array();
$click_level=$params['TREE']['depth'];
$subcat_id=$params['NODES'][$click_level]['id'];
$cat_id=$params['NODES'][$click_level-1]['id'];
$href=true;
if (isset($params['TREE']['caller']) and $params['TREE']['caller']=='EcmFkVatTables' ) {
$href=false;
}
$nodes=get_ecmfkvattables($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 ecmfkvattables 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['ecmfkvattable_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['ecmfkvattable_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_ecmfkvattables($cat_id, $subcat_id,$href=true) {
$nodes=array();
$href_string = "javascript:select_ecmfkvattable('doctree')";
$query="select * from ecmfkvattables 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['ecmfkvattable_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,8 @@
<?php
// ini_set('display_errors', '1');
// error_reporting(E_ALL);
class EcmFkVatTablesController extends SugarController {
}

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['EcmFkVatTable'] = array ('column_fields' => Array("id"
,"ecmfkvattable_name"
,"description"
,"category_id"
,"subcategory_id"
,"status_id"
,"active_date"
,"exp_date"
,"date_entered"
,"date_modified"
,"created_by"
,"modified_user_id"
,"ecmfkvattable_revision_id"
,"related_doc_id"
,"related_doc_rev_id"
,"is_template"
,"template_type"
),
'list_fields' => Array("id"
,"ecmfkvattable_name"
,"description"
,"category_id"
,"subcategory_id"
,"status_id"
,"active_date"
,"exp_date"
,"date_entered"
,"date_modified"
,"created_by"
,"modified_user_id"
,"ecmfkvattable_revision_id"
,"last_rev_create_date"
,"last_rev_created_by"
,"latest_revision"
,"file_url"
,"file_url_noimage"
),
'required_fields' => Array("ecmfkvattable_name"=>1,"active_date"=>1,"revision"=>1),
);
?>

View File

@@ -0,0 +1,117 @@
<?php
class dbf_class
{
var $dbf_num_rec; // Number of records in the file
var $dbf_num_field; // Number of columns in each row
var $dbf_names = array(); // Information on each column ['name'],['len'],['type']
// These are private....
var $_raw; // The raw input file
var $_rowsize; // Length of each row
var $_hdrsize; // Length of the header information (offset to 1st record)
var $_memos; // The raw memo file (if there is one).
function dbf_class($filename)
{
if (! file_exists($filename)) {
echo 'Not a valid DBF file !!!(1)';
exit();
}
$tail = substr($filename, - 4);
if (strcasecmp($tail, '.dbf') != 0) {
echo 'Not a valid DBF file !!!';
exit();
}
// Read the File
$handle = fopen($filename, "r");
if (! $handle) {
echo "Cannot read DBF file - tutaj";
exit();
}
$filesize = filesize($filename);
$this->_raw = fread($handle, $filesize);
fclose($handle);
// Make sure that we indeed have a dbf file...
if (! (ord($this->_raw[0]) == 3 || ord($this->_raw[0]) == 131) && ord($this->_raw[$filesize]) != 26) {
echo 'Not a valid DBF file !!!';
exit();
}
// 3= file without DBT memo file; 131 ($83)= file with a DBT.
$arrHeaderHex = array();
for ($i = 0; $i < 32; $i ++) {
$arrHeaderHex[$i] = str_pad(dechex(ord($this->_raw[$i])), 2, "0", STR_PAD_LEFT);
}
// Initial information
$line = 32; // Header Size
// Number of records
$this->dbf_num_rec = hexdec($arrHeaderHex[7] . $arrHeaderHex[6] . $arrHeaderHex[5] . $arrHeaderHex[4]);
$this->_hdrsize = hexdec($arrHeaderHex[9] . $arrHeaderHex[8]); // Header Size+Field Descriptor
// Number of fields
$this->_rowsize = hexdec($arrHeaderHex[11] . $arrHeaderHex[10]);
$this->dbf_num_field = floor(($this->_hdrsize - $line) / $line); // Number of Fields
// Field properties retrieval looping
for ($j = 0; $j < $this->dbf_num_field; $j ++) {
$name = '';
$beg = $j * $line + $line;
for ($k = $beg; $k < $beg + 11; $k ++) {
if (ord($this->_raw[$k]) != 0) {
$name .= $this->_raw[$k];
}
}
$this->dbf_names[$j]['name'] = $name; // Name of the Field
$this->dbf_names[$j]['len'] = ord($this->_raw[$beg + 16]); // Length of the field
$this->dbf_names[$j]['type'] = $this->_raw[$beg + 11];
}
/*
* if (ord($this->_raw[0])==131) { //See if this has a memo file with it... //Read the File $tail=substr($tail,-1,1); //Get the last character... if ($tail=='F'){ //See if upper or lower case $tail='T'; //Keep the case the same } else { $tail='t'; } $memoname = substr($filename,0,strlen($filename)-1).$tail; $memoname = $filemane; echo $memoname.'<br>'; $handle = fopen($memoname, "r"); if (!$handle) { echo "Cannot read DBT file - tutaj"; exit; } $filesize = filesize($memoname); $this->_memos = fread ($handle, $filesize); fclose ($handle);
*/
}
function getRow($recnum)
{
$memoeot = chr(26) . chr(26);
$rawrow = substr($this->_raw, $recnum * $this->_rowsize + $this->_hdrsize, $this->_rowsize);
$rowrecs = array();
$beg = 1;
if (ord($rawrow[0]) == 42) {
return false; // Record is deleted...
}
for ($i = 0; $i < $this->dbf_num_field; $i ++) {
$col = trim(substr($rawrow, $beg, $this->dbf_names[$i]['len']));
if ($this->dbf_names[$i]['type'] != 'M') {
$rowrecs[] = $col;
} else {
$memobeg = $col * 512; // Find start of the memo block (0=header so it works)
$memoend = strpos($this->_memos, $memoeot, $memobeg); // Find the end of the memo
$rowrecs[] = substr($this->_memos, $memobeg, $memoend - $memobeg);
}
$beg += $this->dbf_names[$i]['len'];
}
return $rowrecs;
}
function getRowAssoc($recnum)
{
$rawrow = substr($this->_raw, $recnum * $this->_rowsize + $this->_hdrsize, $this->_rowsize);
$rowrecs = array();
$beg = 1;
if (ord($rawrow[0]) == 42) {
return false; // Record is deleted...
}
for ($i = 0; $i < $this->dbf_num_field; $i ++) {
$col = trim(substr($rawrow, $beg, $this->dbf_names[$i]['len']));
if ($this->dbf_names[$i]['type'] != 'M') {
$rowrecs[$this->dbf_names[$i]['name']] = $col;
} else {
$memobeg = $col * 512; // Find start of the memo block (0=header so it works)
$memoend = strpos($this->_memos, $memoeot, $memobeg); // Find the end of the memo
$rowrecs[$this->dbf_names[$i]['name']] = substr($this->_memos, $memobeg, $memoend - $memobeg);
}
$beg += $this->dbf_names[$i]['len'];
}
return $rowrecs;
}
}

View File

@@ -0,0 +1,182 @@
<?php
function create_guid()
{
$microTime = microtime();
list ($a_dec, $a_sec) = explode(" ", $microTime);
$dec_hex = sprintf("%x", $a_dec * 1000000);
$sec_hex = sprintf("%x", $a_sec);
ensure_length($dec_hex, 5);
ensure_length($sec_hex, 6);
$guid = "";
$guid .= $dec_hex;
$guid .= create_guid_section(3);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= $sec_hex;
$guid .= create_guid_section(6);
return $guid;
}
function create_guid_section($characters)
{
$return = "";
for ($i = 0; $i < $characters; $i ++) {
$return .= sprintf("%x", mt_rand(0, 15));
}
return $return;
}
function ensure_length(&$string, $length)
{
$strlen = strlen($string);
if ($strlen < $length) {
$string = str_pad($string, $length, "0");
} else
if ($strlen > $length) {
$string = substr($string, 0, $length);
}
}
function ch($str)
{
return iconv("IBM852", "UTF-8", $str);
}
function checkCharset($testString, $targetString)
{
$out = false;
$encoding = array(
"ASCII",
"ISO-8859-1",
"ISO-8859-2",
"ISO-8859-3",
"ISO-8859-4",
"ISO-8859-5",
"ISO-8859-7",
"ISO-8859-9",
"ISO-8859-10",
"ISO-8859-13",
"ISO-8859-14",
"ISO-8859-15",
"ISO-8859-16",
"KOI8-R",
"KOI8-U",
"KOI8-RU",
"CP1250",
"CP1251",
"CP1252",
"CP1253",
"CP1254",
"CP1257",
"CP850",
"CP866",
"Mac Roman",
"Mac CentralEurope",
"Mac Iceland",
"Mac Croatian",
"Mac Romania",
"Mac Cyrillic",
"Mac Ukraine",
"Mac Greek",
"Mac Turkish",
"Macintosh",
"ISO-8859-6",
"ISO-8859-8",
"CP1255",
"CP1256",
"CP862",
"Mac Hebrew",
"Mac Arabic",
"EUC-JP",
"SHIFT_JIS",
"CP932",
"ISO-2022-JP",
"ISO-2022-JP-2",
"ISO-2022-JP-1",
"EUC-CN",
"HZ",
"GBK",
"GB18030",
"EUC-TW",
"BIG5",
"CP950",
"BIG5-HKSCS",
"ISO-2022-CN",
"ISO-2022-CN-EXT",
"EUC-KR",
"CP949",
"ISO-2022-KR",
"JOHAB",
"ARMSCII-8",
"Georgian-Academy",
"Georgian-PS",
"KOI8-T",
"TIS-620",
"CP874",
"MacThai",
"MuleLao-1",
"CP1133",
"VISCII",
"TCVN",
"CP1258",
"HP-ROMAN8",
"NEXTSTEP",
"UTF-8",
"UCS-2",
"UCS-2BE",
"UCS-2LE",
"UCS-4",
"UCS-4BE",
"UCS-4LE",
"UTF-16",
"UTF-16BE",
"UTF-16LE",
"UTF-32",
"UTF-32BE",
"UTF-32LE",
"UTF-7",
"C99",
"JAVA",
"UCS-2-INTERNAL",
"UCS-4-INTERNAL",
"CP437",
"CP737",
"CP775",
"CP850",
"CP852",
"CP853",
"CP855",
"CP857",
"CP858",
"CP860",
"CP861",
"CP863",
"CP865",
"CP869",
"CP1125",
"CP864",
"EUC-JISX0213",
"Shift_JISX0213",
"ISO-2022-JP-3",
"TDS565",
"RISCOS-LATIN1"
);
foreach ($encoding as $v) {
if (iconv($v, "utf-8", $testString) === $targetString) {
$out = $v;
}
}
return $out;
}

View File

@@ -0,0 +1,175 @@
<?php
echo PHP_EOL;
$sql = mysql_connect('localhost', 'root', '1ptimu6');
mysql_select_db('crm');
$namesResult = mysql_query('SET NAMES utf8;');
if(false == $namesResult) {
return;
}
$def = array(
'KOD',
'KOD_VAT',
'K_SYN_WN',
'K_ANAL_WN',
'K_SYN_MA',
'K_ANAL_MA',
'K_ZAL_WN',
'K_ZAL_MA',
);
$c = $cVat = $acc = array();
function addVat($a, $c = false) {
global $c, $cVat, $acc, $def;
$now = new DateTime();
// var_export(array_keys($a));
// exit;
$r = array_combine($def, $a);
$arr = array(
'id' => create_guid(),
'deleted' => '0',
'date_entered' => $now->format('Y-m-d'),
// 'date_modified' => '',
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290',
// 'modified_user_id' => '',
'ecmfkvattable_id' => $r['KOD'],
'ecmfkvatkind_id' => $r['KOD_VAT'],
'acc_wn' => $wn = ($r['K_SYN_WN'] . (($analWn = $r['K_ANAL_WN']) ? ('-' . $analWn): '')),
'acc_ma' => $ma = ($r['K_SYN_MA'] . (($analMa = $r['K_ANAL_MA']) ? ('-' . $analMa): '')),
'account_acc_wn' => ($wn == 'RRR') ? '1' : '0',
'account_acc_ma' => ($ma == 'RRR') ? '1' : '0',
'zal_wn' => $r['K_ZAL_WN'],
'zal_ma' => $r['K_ZAL_MA'],
);
if(true == array_key_exists($key = (string) $arr['ecmfkvattable_id'], $c) ) {
$arr['ecmfkvattable_id'] = $c[$keyss];
} else {
$q = 'select id from ecmfkvattables where position = \'' . $key . '\' and type = ' . 0 . ' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['ecmfkvattable_id'] = $c[$key] = $res['id'];
} else {
$arr['ecmfkvattable_id'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['ecmfkvatkind_id'], $cVat) ) {
$arr['ecmfkvattable_id'] = $cVat[$key];
} else {
$q = 'select id from ecmfkvatkinds where position = \'' . $key . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['ecmfkvatkind_id'] = $cVat[$key] = $res['id'];
} else {
$arr['ecmfkvatkind_id'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['acc_wn'], $acc) ) {
$arr['acc_wn'] = $acc[$key];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $key . '\' and type = ' . 4 . ' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_wn'] = $acc[$key] = $res['id'];
} else {
$arr['acc_wn'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['acc_ma'], $acc) ) {
$arr['acc_ma'] = $acc[$key];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $key . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_ma'] = $acc[$key] = $res['id'];
} else {
$arr['acc_ma'] = null;
}
}
// echo var_export($r, true);
// echo PHP_EOL . PHP_EOL;
// echo var_export($arr, true);
// exit;
$arr = array_filter($arr, 'strlen');
foreach ($arr as $k => $v) {
$in[] = sprintf('`%s` = \'%s\'', $k, ch($v));
}
$query = 'INSERT INTO `ecmfkvattableitems` SET ' . implode(', ', $in) . ';';
// echo $query . PHP_EOL;
// exit;
mysql_query($query);
if($e = mysql_error()) {
echo $query;
echo PHP_EOL . PHP_EOL;
echo var_export(mysql_error(), true);
echo PHP_EOL . PHP_EOL;
return false;
}
if(true == $c) {
echo var_export($arr['id'], true);
echo PHP_EOL;
}
return true;
}
include_once('class.dbf.php');
include_once('helper.php');
$created = 0;
$dbfp = new dbf_class('import/t_vat_ot.dbf');
// $dbfp = new dbf_class('import/t_vat_st.dbf');
// $dbfp = new dbf_class('import/t_vat_zt.dbf');
$num_recp = $dbfp->dbf_num_rec;
$start = microtime(true);
for ($i = 0; $i < $num_recp; $i++) {
$rowp = $dbfp->getRowAssoc($i);
$created += addVat($rowp, true) ? 1 : 0;
}
$stop = microtime(true);
$diff = $stop - $start;
echo 'Podsumowanie:' . PHP_EOL;
echo 'W dbf: ' . $num_recp . PHP_EOL;
echo 'Dodano: ' . $created . PHP_EOL;
echo 'Czas trawania:' . ($diff / 60) . ' minut' . PHP_EOL;
mysql_close($sql);

View File

@@ -0,0 +1,4 @@
<?php
// vattables.type = 1
// vatregs.type = 3
die();

View File

@@ -0,0 +1,175 @@
<?php
echo PHP_EOL;
$sql = mysql_connect('localhost', 'root', '1ptimu6');
mysql_select_db('crm');
$namesResult = mysql_query('SET NAMES utf8;');
if(false == $namesResult) {
return;
}
$def = array(
'KOD',
'KOD_VAT',
'K_SYN_WN',
'K_ANAL_WN',
'K_SYN_MA',
'K_ANAL_MA',
'K_ZAL_WN',
'K_ZAL_MA',
);
$c = $cVat = $acc = array();
function addVat($a, $c = false) {
global $c, $cVat, $acc, $def;
$now = new DateTime();
// var_export(array_keys($a));
// exit;
$r = array_combine($def, $a);
$arr = array(
'id' => create_guid(),
'deleted' => '0',
'date_entered' => $now->format('Y-m-d'),
// 'date_modified' => '',
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290',
// 'modified_user_id' => '',
'ecmfkvattable_id' => $r['KOD'],
'ecmfkvatkind_id' => $r['KOD_VAT'],
'acc_wn' => $wn = ($r['K_SYN_WN'] . (($analWn = $r['K_ANAL_WN']) ? ('-' . $analWn): '')),
'acc_ma' => $ma = ($r['K_SYN_MA'] . (($analMa = $r['K_ANAL_MA']) ? ('-' . $analMa): '')),
'account_acc_wn' => ($wn == 'RRR') ? '1' : '0',
'account_acc_ma' => ($ma == 'RRR') ? '1' : '0',
'zal_wn' => $r['K_ZAL_WN'],
'zal_ma' => $r['K_ZAL_MA'],
);
if(true == array_key_exists($key = (string) $arr['ecmfkvattable_id'], $c) ) {
$arr['ecmfkvattable_id'] = $c[$key];
} else {
$q = 'select id from ecmfkvattables where position = \'' . $key . '\' and type = ' . 2 . ' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['ecmfkvattable_id'] = $c[$key] = $res['id'];
} else {
$arr['ecmfkvattable_id'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['ecmfkvatkind_id'], $cVat) ) {
$arr['ecmfkvattable_id'] = $cVat[$key];
} else {
$q = 'select id from ecmfkvatkinds where position = \'' . $key . '\' and type = ' . 1 . ' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['ecmfkvatkind_id'] = $cVat[$key] = $res['id'];
} else {
$arr['ecmfkvatkind_id'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['acc_wn'], $acc) ) {
$arr['acc_wn'] = $acc[$key];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $key . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_wn'] = $acc[$key] = $res['id'];
} else {
$arr['acc_wn'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['acc_ma'], $acc) ) {
$arr['acc_ma'] = $acc[$key];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $key . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_ma'] = $acc[$key] = $res['id'];
} else {
$arr['acc_ma'] = null;
}
}
// echo var_export($r, true);
// echo PHP_EOL . PHP_EOL;
// echo var_export($arr, true);
// exit;
$arr = array_filter($arr, 'strlen');
foreach ($arr as $k => $v) {
$in[] = sprintf('`%s` = \'%s\'', $k, ch($v));
}
$query = 'INSERT INTO `ecmfkvattableitems` SET ' . implode(', ', $in) . ';';
// echo $query . PHP_EOL;
// exit;
mysql_query($query);
if($e = mysql_error()) {
echo $query;
echo PHP_EOL . PHP_EOL;
echo var_export(mysql_error(), true);
echo PHP_EOL . PHP_EOL;
return false;
}
if(true == $c) {
echo var_export($arr['id'], true);
echo PHP_EOL;
}
return true;
}
include_once('class.dbf.php');
include_once('helper.php');
$created = 0;
// $dbfp = new dbf_class('import/t_vat_ot.dbf');
$dbfp = new dbf_class('import/t_vat_st.dbf');
// $dbfp = new dbf_class('import/t_vat_zt.dbf');
$num_recp = $dbfp->dbf_num_rec;
$start = microtime(true);
for ($i = 0; $i < $num_recp; $i++) {
$rowp = $dbfp->getRowAssoc($i);
$created += addVat($rowp, true) ? 1 : 0;
}
$stop = microtime(true);
$diff = $stop - $start;
echo 'Podsumowanie:' . PHP_EOL;
echo 'W dbf: ' . $num_recp . PHP_EOL;
echo 'Dodano: ' . $created . PHP_EOL;
echo 'Czas trawania:' . ($diff / 60) . ' minut' . PHP_EOL;
mysql_close($sql);

View File

@@ -0,0 +1,175 @@
<?php
echo PHP_EOL;
$sql = mysql_connect('localhost', 'root', '1ptimu6');
mysql_select_db('crm');
$namesResult = mysql_query('SET NAMES utf8;');
if(false == $namesResult) {
return;
}
$def = array(
'KOD',
'KOD_VAT',
'K_SYN_WN',
'K_ANAL_WN',
'K_SYN_MA',
'K_ANAL_MA',
'K_ZAL_WN',
'K_ZAL_MA',
);
$c = $cVat = $acc = array();
function addVat($a, $c = false) {
global $c, $cVat, $acc, $def;
$now = new DateTime();
// var_export(array_keys($a));
// exit;
$r = array_combine($def, $a);
$arr = array(
'id' => create_guid(),
'deleted' => '0',
'date_entered' => $now->format('Y-m-d'),
// 'date_modified' => '',
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290',
// 'modified_user_id' => '',
'ecmfkvattable_id' => $r['KOD'],
'ecmfkvatkind_id' => $r['KOD_VAT'],
'acc_wn' => $wn = ($r['K_SYN_WN'] . (($analWn = $r['K_ANAL_WN']) ? ('-' . $analWn): '')),
'acc_ma' => $ma = ($r['K_SYN_MA'] . (($analMa = $r['K_ANAL_MA']) ? ('-' . $analMa): '')),
'account_acc_wn' => ($wn == 'RRR') ? '1' : '0',
'account_acc_ma' => ($ma == 'RRR') ? '1' : '0',
'zal_wn' => $r['K_ZAL_WN'],
'zal_ma' => $r['K_ZAL_MA'],
);
if(true == array_key_exists($key = (string) $arr['ecmfkvattable_id'], $c) ) {
$arr['ecmfkvattable_id'] = $c[$key];
} else {
$q = 'select id from ecmfkvattables where position = \'' . $key . '\' and type = ' . 3 . ' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['ecmfkvattable_id'] = $c[$key] = $res['id'];
} else {
$arr['ecmfkvattable_id'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['ecmfkvatkind_id'], $cVat) ) {
$arr['ecmfkvattable_id'] = $cVat[$key];
} else {
$q = 'select id from ecmfkvatkinds where position = \'' . $key . '\' and type = ' . 2 . ' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['ecmfkvatkind_id'] = $cVat[$key] = $res['id'];
} else {
$arr['ecmfkvatkind_id'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['acc_wn'], $acc) ) {
$arr['acc_wn'] = $acc[$key];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $key . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_wn'] = $acc[$key] = $res['id'];
} else {
$arr['acc_wn'] = null;
}
}
if(true == array_key_exists($key = (string) $arr['acc_ma'], $acc) ) {
$arr['acc_ma'] = $acc[$key];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $key . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_ma'] = $acc[$key] = $res['id'];
} else {
$arr['acc_ma'] = null;
}
}
// echo var_export($r, true);
// echo PHP_EOL . PHP_EOL;
// echo var_export($arr, true);
// exit;
$arr = array_filter($arr, 'strlen');
foreach ($arr as $k => $v) {
$in[] = sprintf('`%s` = \'%s\'', $k, ch($v));
}
$query = 'INSERT INTO `ecmfkvattableitems` SET ' . implode(', ', $in) . ';';
// echo $query . PHP_EOL;
// exit;
mysql_query($query);
if($e = mysql_error()) {
echo $query;
echo PHP_EOL . PHP_EOL;
echo var_export(mysql_error(), true);
echo PHP_EOL . PHP_EOL;
return false;
}
if(true == $c) {
echo var_export($arr['id'], true);
echo PHP_EOL;
}
return true;
}
include_once('class.dbf.php');
include_once('helper.php');
$created = 0;
// $dbfp = new dbf_class('import/t_vat_ot.dbf');
// $dbfp = new dbf_class('import/t_vat_st.dbf');
$dbfp = new dbf_class('import/t_vat_zt.dbf');
$num_recp = $dbfp->dbf_num_rec;
$start = microtime(true);
for ($i = 0; $i < $num_recp; $i++) {
$rowp = $dbfp->getRowAssoc($i);
$created += addVat($rowp, true) ? 1 : 0;
}
$stop = microtime(true);
$diff = $stop - $start;
echo 'Podsumowanie:' . PHP_EOL;
echo 'W dbf: ' . $num_recp . PHP_EOL;
echo 'Dodano: ' . $created . PHP_EOL;
echo 'Czas trawania:' . ($diff / 60) . ' minut' . PHP_EOL;
mysql_close($sql);

View File

@@ -0,0 +1,155 @@
<?php
echo PHP_EOL;
$sql = mysql_connect('localhost', 'root', '1ptimu6');
mysql_select_db('crm');
$namesResult = mysql_query('SET NAMES utf8;');
if(false == $namesResult) {
return;
}
$def = array(
'KOD',
'NAZWA',
'K_SYN_WN',
'K_ANAL_WN',
'K_SYN_MA',
'K_ANAL_MA',
'ZALEZN',
'S_LICZ',
'REZ',
'S_VAT',
'VAT_NETTO',
'K_ZAL_WN',
'K_ZAL_MA',
);
$acc = array();
function addVat($a, $c = false) {
global $acc, $def;
$now = new DateTime();
// var_export(array_keys($a));
// exit;
$r = array_combine($def, $a);
$arr = array(
'id' => create_guid(),
'deleted' => '0',
'date_entered' => $now->format('Y-m-d'),
// 'date_modified' => '',
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290',
// 'modified_user_id' => '',
'position' => $r['KOD'],
'name' => $r['NAZWA'],
'acc_wn' => $wn = ($r['K_SYN_WN'] . (($analWn = $r['K_ANAL_WN']) ? ('-' . $analWn): '')),
'acc_ma' => $ma = ($r['K_SYN_MA'] . (($analMa = $r['K_ANAL_MA']) ? ('-' . $analMa): '')),
'account_acc_wn' => ($wn == 'RRR') ? '1' : '0',
'account_acc_ma' => ($ma == 'RRR') ? '1' : '0',
'zal' => $r['ZALEZN'],
'licz' => $r['S_LICZ'],
'rez' => $r['REZ'],
'vat' => $r['S_VAT'],
'netto' => $r['VAT_NETTO'] ? : '0',
'zal_wn' => $r['K_ZAL_WN'],
'zal_ma' => $r['K_ZAL_MA'],
'type' => '0',
);
if(true == array_key_exists((string) $arr['acc_wn'], $acc) ) {
$arr['acc_wn'] = $acc[$arr['acc_wn']];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $arr['acc_wn'] . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_wn'] = $acc[(string) $arr['acc_wn']] = $res['id'];
} else {
$arr['acc_wn'] = null;
}
}
if(true == array_key_exists((string) $arr['acc_ma'], $acc) ) {
$arr['acc_ma'] = $acc[$arr['acc_ma']];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $arr['acc_ma'] . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_ma'] = $acc[(string) $arr['acc_ma']] = $res['id'];
} else {
$arr['acc_ma'] = null;
}
}
// echo var_export($r, true);
// echo PHP_EOL . PHP_EOL;
// echo var_export($arr, true);
// exit;
$arr = array_filter($arr, 'strlen');
foreach ($arr as $k => $v) {
$in[] = sprintf('`%s` = \'%s\'', $k, ch($v));
}
$query = 'INSERT INTO `ecmfkvattables` SET ' . implode(', ', $in) . ';';
// echo $query . PHP_EOL;
// exit;
mysql_query($query);
if($e = mysql_error()) {
echo $query;
echo PHP_EOL . PHP_EOL;
echo var_export(mysql_error(), true);
echo PHP_EOL . PHP_EOL;
return false;
}
if(true == $c) {
echo var_export($arr['id'], true);
echo PHP_EOL;
}
return true;
}
include_once('class.dbf.php');
include_once('helper.php');
$created = 0;
$dbfp = new dbf_class('import/t_vat_og.dbf');
// $dbfp = new dbf_class('import/t_vat_pl.dbf');
// $dbfp = new dbf_class('import/t_vat_sp.dbf');
// $dbfp = new dbf_class('import/t_vat_zk.dbf');
$num_recp = $dbfp->dbf_num_rec;
$start = microtime(true);
for ($i = 0; $i < $num_recp; $i++) {
$rowp = $dbfp->getRowAssoc($i);
$created += addVat($rowp, true) ? 1 : 0;
}
$stop = microtime(true);
$diff = $stop - $start;
echo 'Podsumowanie:' . PHP_EOL;
echo 'W dbf: ' . $num_recp . PHP_EOL;
echo 'Dodano: ' . $created . PHP_EOL;
echo 'Czas trawania:' . ($diff / 60) . ' minut' . PHP_EOL;
mysql_close($sql);

View File

@@ -0,0 +1,155 @@
<?php
echo PHP_EOL;
$sql = mysql_connect('localhost', 'root', '1ptimu6');
mysql_select_db('crm');
$namesResult = mysql_query('SET NAMES utf8;');
if(false == $namesResult) {
return;
}
$def = array(
'KOD',
'NAZWA',
'K_SYN_WN',
'K_ANAL_WN',
'K_SYN_MA',
'K_ANAL_MA',
'ZALEZN',
'S_LICZ',
'REZ',
'S_VAT',
'VAT_NETTO',
'K_ZAL_WN',
'K_ZAL_MA',
);
$acc = array();
function addVat($a, $c = false) {
global $acc, $def;
$now = new DateTime();
// var_export(array_keys($a));
// exit;
$r = array_combine($def, $a);
$arr = array(
'id' => create_guid(),
'deleted' => '0',
'date_entered' => $now->format('Y-m-d'),
// 'date_modified' => '',
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290',
// 'modified_user_id' => '',
'position' => $r['KOD'],
'name' => $r['NAZWA'],
'acc_wn' => $wn = ($r['K_SYN_WN'] . (($analWn = $r['K_ANAL_WN']) ? ('-' . $analWn): '')),
'acc_ma' => $ma = ($r['K_SYN_MA'] . (($analMa = $r['K_ANAL_MA']) ? ('-' . $analMa): '')),
'account_acc_wn' => ($wn == 'RRR') ? '1' : '0',
'account_acc_ma' => ($ma == 'RRR') ? '1' : '0',
'zal' => $r['ZALEZN'],
'licz' => $r['S_LICZ'],
'rez' => $r['REZ'],
'vat' => $r['S_VAT'],
'netto' => $r['VAT_NETTO'],
'zal_wn' => $r['K_ZAL_WN'],
'zal_ma' => $r['K_ZAL_MA'],
'type' => '1',
);
if(true == array_key_exists((string) $arr['acc_wn'], $acc) ) {
$arr['acc_wn'] = $acc[$arr['acc_wn']];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $arr['acc_wn'] . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_wn'] = $acc[(string) $arr['acc_wn']] = $res['id'];
} else {
$arr['acc_wn'] = null;
}
}
if(true == array_key_exists((string) $arr['acc_ma'], $acc) ) {
$arr['acc_ma'] = $acc[$arr['acc_ma']];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $arr['acc_ma'] . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_ma'] = $acc[(string) $arr['acc_ma']] = $res['id'];
} else {
$arr['acc_ma'] = null;
}
}
// echo var_export($r, true);
// echo PHP_EOL . PHP_EOL;
// echo var_export($arr, true);
// exit;
$arr = array_filter($arr, 'strlen');
foreach ($arr as $k => $v) {
$in[] = sprintf('`%s` = \'%s\'', $k, ch($v));
}
$query = 'INSERT INTO `ecmfkvattables` SET ' . implode(', ', $in) . ';';
// echo $query . PHP_EOL;
// exit;
mysql_query($query);
if($e = mysql_error()) {
echo $query;
echo PHP_EOL . PHP_EOL;
echo var_export(mysql_error(), true);
echo PHP_EOL . PHP_EOL;
return false;
}
if(true == $c) {
echo var_export($arr['id'], true);
echo PHP_EOL;
}
return true;
}
include_once('class.dbf.php');
include_once('helper.php');
$created = 0;
// $dbfp = new dbf_class('import/t_vat_og.dbf');
$dbfp = new dbf_class('import/t_vat_pl.dbf');
// $dbfp = new dbf_class('import/t_vat_sp.dbf');
// $dbfp = new dbf_class('import/t_vat_zk.dbf');
$num_recp = $dbfp->dbf_num_rec;
$start = microtime(true);
for ($i = 0; $i < $num_recp; $i++) {
$rowp = $dbfp->getRowAssoc($i);
$created += addVat($rowp, true) ? 1 : 0;
}
$stop = microtime(true);
$diff = $stop - $start;
echo 'Podsumowanie:' . PHP_EOL;
echo 'W dbf: ' . $num_recp . PHP_EOL;
echo 'Dodano: ' . $created . PHP_EOL;
echo 'Czas trawania:' . ($diff / 60) . ' minut' . PHP_EOL;
mysql_close($sql);

View File

@@ -0,0 +1,155 @@
<?php
echo PHP_EOL;
$sql = mysql_connect('localhost', 'root', '1ptimu6');
mysql_select_db('crm');
$namesResult = mysql_query('SET NAMES utf8;');
if(false == $namesResult) {
return;
}
$def = array(
'KOD',
'NAZWA',
'K_SYN_WN',
'K_ANAL_WN',
'K_SYN_MA',
'K_ANAL_MA',
'ZALEZN',
'S_LICZ',
'REZ',
'S_VAT',
'VAT_NETTO',
'K_ZAL_WN',
'K_ZAL_MA',
);
$acc = array();
function addVat($a, $c = false) {
global $acc, $def;
$now = new DateTime();
// var_export(array_keys($a));
// exit;
$r = array_combine($def, $a);
$arr = array(
'id' => create_guid(),
'deleted' => '0',
'date_entered' => $now->format('Y-m-d'),
// 'date_modified' => '',
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290',
// 'modified_user_id' => '',
'position' => $r['KOD'],
'name' => $r['NAZWA'],
'acc_wn' => $wn = ($r['K_SYN_WN'] . (($analWn = $r['K_ANAL_WN']) ? ('-' . $analWn): '')),
'acc_ma' => $ma = ($r['K_SYN_MA'] . (($analMa = $r['K_ANAL_MA']) ? ('-' . $analMa): '')),
'account_acc_wn' => ($wn == 'RRR') ? '1' : '0',
'account_acc_ma' => ($ma == 'RRR') ? '1' : '0',
'zal' => $r['ZALEZN'],
'licz' => $r['S_LICZ'],
'rez' => $r['REZ'],
'vat' => $r['S_VAT'],
'netto' => $r['VAT_NETTO'],
'zal_wn' => $r['K_ZAL_WN'],
'zal_ma' => $r['K_ZAL_MA'],
'type' => '2',
);
if(true == array_key_exists((string) $arr['acc_wn'], $acc) ) {
$arr['acc_wn'] = $acc[$arr['acc_wn']];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $arr['acc_wn'] . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_wn'] = $acc[(string) $arr['acc_wn']] = $res['id'];
} else {
$arr['acc_wn'] = null;
}
}
if(true == array_key_exists((string) $arr['acc_ma'], $acc) ) {
$arr['acc_ma'] = $acc[$arr['acc_ma']];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $arr['acc_ma'] . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_ma'] = $acc[(string) $arr['acc_ma']] = $res['id'];
} else {
$arr['acc_ma'] = null;
}
}
// echo var_export($r, true);
// echo PHP_EOL . PHP_EOL;
// echo var_export($arr, true);
// exit;
$arr = array_filter($arr, 'strlen');
foreach ($arr as $k => $v) {
$in[] = sprintf('`%s` = \'%s\'', $k, ch($v));
}
$query = 'INSERT INTO `ecmfkvattables` SET ' . implode(', ', $in) . ';';
// echo $query . PHP_EOL;
// exit;
mysql_query($query);
if($e = mysql_error()) {
echo $query;
echo PHP_EOL . PHP_EOL;
echo var_export(mysql_error(), true);
echo PHP_EOL . PHP_EOL;
return false;
}
if(true == $c) {
echo var_export($arr['id'], true);
echo PHP_EOL;
}
return true;
}
include_once('class.dbf.php');
include_once('helper.php');
$created = 0;
// $dbfp = new dbf_class('import/t_vat_og.dbf');
// $dbfp = new dbf_class('import/t_vat_pl.dbf');
$dbfp = new dbf_class('import/t_vat_sp.dbf');
// $dbfp = new dbf_class('import/t_vat_zk.dbf');
$num_recp = $dbfp->dbf_num_rec;
$start = microtime(true);
for ($i = 0; $i < $num_recp; $i++) {
$rowp = $dbfp->getRowAssoc($i);
$created += addVat($rowp, true) ? 1 : 0;
}
$stop = microtime(true);
$diff = $stop - $start;
echo 'Podsumowanie:' . PHP_EOL;
echo 'W dbf: ' . $num_recp . PHP_EOL;
echo 'Dodano: ' . $created . PHP_EOL;
echo 'Czas trawania:' . ($diff / 60) . ' minut' . PHP_EOL;
mysql_close($sql);

View File

@@ -0,0 +1,155 @@
<?php
echo PHP_EOL;
$sql = mysql_connect('localhost', 'root', '1ptimu6');
mysql_select_db('crm');
$namesResult = mysql_query('SET NAMES utf8;');
if(false == $namesResult) {
return;
}
$def = array(
'KOD',
'NAZWA',
'K_SYN_WN',
'K_ANAL_WN',
'K_SYN_MA',
'K_ANAL_MA',
'ZALEZN',
'S_LICZ',
'REZ',
'S_VAT',
'VAT_NETTO',
'K_ZAL_WN',
'K_ZAL_MA',
);
$acc = array();
function addVat($a, $c = false) {
global $acc, $def;
$now = new DateTime();
// var_export(array_keys($a));
// exit;
$r = array_combine($def, $a);
$arr = array(
'id' => create_guid(),
'deleted' => '0',
'date_entered' => $now->format('Y-m-d'),
// 'date_modified' => '',
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290',
// 'modified_user_id' => '',
'position' => $r['KOD'],
'name' => $r['NAZWA'],
'acc_wn' => $wn = ($r['K_SYN_WN'] . (($analWn = $r['K_ANAL_WN']) ? ('-' . $analWn): '')),
'acc_ma' => $ma = ($r['K_SYN_MA'] . (($analMa = $r['K_ANAL_MA']) ? ('-' . $analMa): '')),
'account_acc_wn' => ($wn == 'RRR') ? '1' : '0',
'account_acc_ma' => ($ma == 'RRR') ? '1' : '0',
'zal' => $r['ZALEZN'],
'licz' => $r['S_LICZ'],
'rez' => $r['REZ'],
'vat' => $r['S_VAT'],
'netto' => $r['VAT_NETTO'],
'zal_wn' => $r['K_ZAL_WN'],
'zal_ma' => $r['K_ZAL_MA'],
'type' => '3',
);
if(true == array_key_exists((string) $arr['acc_wn'], $acc) ) {
$arr['acc_wn'] = $acc[$arr['acc_wn']];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $arr['acc_wn'] . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_wn'] = $acc[(string) $arr['acc_wn']] = $res['id'];
} else {
$arr['acc_wn'] = null;
}
}
if(true == array_key_exists((string) $arr['acc_ma'], $acc) ) {
$arr['acc_ma'] = $acc[$arr['acc_ma']];
} else {
$q = 'select id from ecmbankaccounts where code = \'' . $arr['acc_ma'] . '\' LIMIT 1;';
// echo var_export($q, true) . PHP_EOL;
$res = mysql_fetch_assoc(mysql_query($q));
if(true == is_array($res)) {
$arr['acc_ma'] = $acc[(string) $arr['acc_ma']] = $res['id'];
} else {
$arr['acc_ma'] = null;
}
}
// echo var_export($r, true);
// echo PHP_EOL . PHP_EOL;
// echo var_export($arr, true);
// exit;
$arr = array_filter($arr, 'strlen');
foreach ($arr as $k => $v) {
$in[] = sprintf('`%s` = \'%s\'', $k, ch($v));
}
$query = 'INSERT INTO `ecmfkvattables` SET ' . implode(', ', $in) . ';';
// echo $query . PHP_EOL;
// exit;
mysql_query($query);
if($e = mysql_error()) {
echo $query;
echo PHP_EOL . PHP_EOL;
echo var_export(mysql_error(), true);
echo PHP_EOL . PHP_EOL;
return false;
}
if(true == $c) {
echo var_export($arr['id'], true);
echo PHP_EOL;
}
return true;
}
include_once('class.dbf.php');
include_once('helper.php');
$created = 0;
// $dbfp = new dbf_class('import/t_vat_og.dbf');
// $dbfp = new dbf_class('import/t_vat_pl.dbf');
// $dbfp = new dbf_class('import/t_vat_sp.dbf');
$dbfp = new dbf_class('import/t_vat_zk.dbf');
$num_recp = $dbfp->dbf_num_rec;
$start = microtime(true);
for ($i = 0; $i < $num_recp; $i++) {
$rowp = $dbfp->getRowAssoc($i);
$created += addVat($rowp, true) ? 1 : 0;
}
$stop = microtime(true);
$diff = $stop - $start;
echo 'Podsumowanie:' . PHP_EOL;
echo 'W dbf: ' . $num_recp . PHP_EOL;
echo 'Dodano: ' . $created . PHP_EOL;
echo 'Czas trawania:' . ($diff / 60) . ' minut' . PHP_EOL;
mysql_close($sql);

View File

@@ -0,0 +1,167 @@
<?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_MODULE_NAME' => 'EcmFkVatTables',
'LBL_MODULE_TITLE' => 'EcmFkVatTables: Home',
'LNK_NEW_DOCUMENT' => 'Create EcmFkVatTable',
'LNK_DOCUMENT_LIST'=> 'View EcmFkVatTables',
'LBL_DOC_REV_HEADER' => 'EcmFkVatTable Revisions',
'LBL_SEARCH_FORM_TITLE'=> 'EcmFkVatTable Search',
//vardef labels
'LBL_DOCUMENT_ID' => 'EcmFkVatTable ID',
'LBL_NAME' => 'EcmFkVatTable 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 EcmFkVatTable ID',
'LBL_RELATED_DOCUMENT_REVISION_ID'=>'Related EcmFkVatTable Revision ID',
'LBL_IS_TEMPLATE'=>'Is a Template',
'LBL_TEMPLATE_TYPE'=>'EcmFkVatTable Type',
'LBL_ASSIGNED_TO_NAME'=>'Assigned to:',
'LBL_REVISION_NAME' => 'Revision Number',
'LBL_MIME' => 'Mime Type',
'LBL_REVISION' => 'Revision',
'LBL_DOCUMENT' => 'Related EcmFkVatTable',
'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 EcmFkVatTable',
//ecmfkvattable edit and detail view
'LBL_DOC_NAME' => 'EcmFkVatTable 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 EcmFkVatTable:',
'LBL_DET_RELATED_DOCUMENT_VERSION'=>"Related EcmFkVatTable Revision:",
'LBL_DET_IS_TEMPLATE'=>'Template? :',
'LBL_DET_TEMPLATE_TYPE'=>'EcmFkVatTable Type:',
'LBL_DOC_DESCRIPTION'=>'Description:',
'LBL_DOC_ACTIVE_DATE'=> 'Publish Date:',
'LBL_DOC_EXP_DATE'=> 'Expiration Date:',
//ecmfkvattable list view.
'LBL_LIST_FORM_TITLE' => 'EcmFkVatTable List',
'LBL_LIST_DOCUMENT' => 'EcmFkVatTable',
'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',
//ecmfkvattable search form.
'LBL_SF_DOCUMENT' => 'EcmFkVatTable 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' => 'EcmFkVatTable Created',
//error messages
'ERR_DOC_NAME'=>'EcmFkVatTable Name',
'ERR_DOC_ACTIVE_DATE'=>'Publish Date',
'ERR_DOC_EXP_DATE'=> 'Expiration Date',
'ERR_FILENAME'=> 'File Name',
'ERR_DOC_VERSION'=> 'EcmFkVatTable Version',
'ERR_DELETE_CONFIRM'=> 'Do you want to delete this ecmfkvattable revision?',
'ERR_DELETE_LATEST_VERSION'=> 'You are not allowed to delete the latest revision of a ecmfkvattable.',
'LNK_NEW_MAIL_MERGE' => 'Mail Merge',
'LBL_MAIL_MERGE_DOCUMENT' => 'Mail Merge Template:',
'LBL_TREE_TITLE' => 'EcmFkVatTables',
//sub-panel vardefs.
'LBL_LIST_DOCUMENT_NAME'=>'EcmFkVatTable Name',
'LBL_CONTRACT_NAME'=>'Contract Name:',
'LBL_LIST_IS_TEMPLATE'=>'Template?',
'LBL_LIST_TEMPLATE_TYPE'=>'EcmFkVatTable 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'=>'EcmFkVatTable Categories',
'LBL_CONTRACTS' => 'Contracts',
'LBL_CREATED_USER' => 'Created User',
'LBL_THEREVISIONS_SUBPANEL_TITLE' => 'Reversions',
'LBL_DOCUMENT_INFORMATION' => 'EcmFkVatTable Overview',
);
?>

View File

@@ -0,0 +1,175 @@
<?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 (
// MyTable
'LBL_EDITABLE_POSITION' => 'Kod',
'LBL_EDITABLE_NAME' => 'Nazwa',
'LBL_EDITABLE_WN' => 'Konto WN',
'LBL_EDITABLE_MA' => 'Konto Ma',
// Panels
'LBL_DETAILS' => 'Szczegóły',
'LBL_DECREE' => 'Dekrety',
'LBL_DEFINITIONS' => 'Definicje',
// Lang db
'LBL_ID' => 'Id',
'LBL_DATE_ENTERED' => 'Data wprowadzenia',
'LBL_DATE_MODIFIED' => 'Data modyfikacji',
'LBL_MODIFIED_USER_ID' => 'Zmieniony przez',
'LBL_CREATED_BY' => 'Utworzony przez',
'LBL_DELETED' => 'Usunięty',
'LBL_POSITION' => 'Kod',
'LBL_NAME' => 'Nazwa',
'LBL_ACC_WN' => 'Konto winien',
'LBL_ACC_MA' => 'Konto ma',
'LBL_ACCOUNT_ACC_WN' => 'Konto kontrahenta',
'LBL_ACCOUNT_ACC_MA' => 'Konto kontrahenta',
'LBL_ZAL' => 'Zależność',
'LBL_LICZ' => 'Przeliczaj',
'LBL_REZ' => 'Rezerwa',
'LBL_VAT' => 'Vat',
'LBL_NETTO' => 'Kwota',
'LBL_ZAL_WN' => 'Zależność WN',
'LBL_ZAL_MA' => 'Zależność MA',
'LBL_TYPE' => 'Typ rejestru',
//
'LBL_MODIFIED_BY_NAME' => 'Zmieniony przez',
'LBL_CREATED_BY_NAME' => 'Utworzony przez',
'LBL_ACC_WN_CODE' => 'Konto WN',
'LBL_ACC_MA_CODE' => 'Konto MA',
//
//module
'LBL_MODULE_NAME' => 'Tablice rejestrów',
'LBL_MODULE_TITLE' => 'Tablice rejestrów: Strona główna',
'LNK_NEW_DOCUMENT' => 'Utwórz tablicę rejestru',
'LNK_DOCUMENT_LIST' => 'Lista tablic rejestrów',
//vardef labels
'LBL_DOCUMENT_ID' => 'ID dokumentu',
'LBL_NAME' => 'Nazwa dokumentu',
'LBL_DESCRIPTION' => 'Opis',
'LBL_CATEGORY' => 'Kategoria',
'LBL_SUBCATEGORY' => 'Podkategoria',
'LBL_STATUS' => 'Status',
'LBL_CREATED_BY' => 'Utworzony przez',
'LBL_DATE_ENTERED' => 'Data wprowadzenia',
'LBL_DATE_MODIFIED' => 'Data modyfikacji',
'LBL_DELETED' => 'Usunięty',
'LBL_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_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',
//quick search
'LBL_NEW_FORM_TITLE' => 'Nowy dokument',
//ecmfkvattable 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:',
//ecmfkvattable 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',
//ecmfkvattable 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'=>'EcmFkVatTable Categories',
'LBL_CONTRACTS' => 'Kontrakty',
'LBL_CREATED_USER' => 'Użytkownik tworzący',
'LBL_THEREVISIONS_SUBPANEL_TITLE' => 'Rewersje',
);

View File

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

View File

@@ -0,0 +1,216 @@
<?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['EcmFkVatTables']['DetailView'] = array(
'templateMeta' => array(
'maxColumns' => '2',
'form' => array(
'hidden' => array(
'<input type="hidden" name="decree_list" id="decree_list" value="{$DECREE_LIST}"/>',
'<input type="hidden" name="type" id="type" value=""/>',
'<input type="hidden" name="template_id" id="template_id" value=""/>',
),
),
'widths' => array(
array(
'label' => '10',
'field' => '30',
),
array(
'label' => '10',
'field' => '30',
),
),
'includes' => array(
array(
'file' => 'include/JSON.js',
),
array(
'file' => 'modules/EcmFkVatTables/MyTable.js',
),
array(
'file' => 'modules/EcmFkVatTables/EcmFkVatRegisters.js',
),
array(
'file' => 'modules/EcmFkVatTables/EcmFkVatRegistersDetailView.js',
),
// array(
// 'file' => 'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js',
// ),
),
),
'panels' => array(
'LBL_DETAILS' => array(
// 'id',
array(
// 'created_by_name',
array (
'label' => 'LBL_CREATED_BY_NAME',
'customCode' => '{if $fields.created_by_name.value}{$fields.created_by_name.value}{else}-{/if}',
),
// 'modified_by_name',
array (
'label' => 'LBL_MODIFIED_BY_NAME',
'customCode' => '{if $fields.modified_by_name.value}{$fields.modified_by_name.value}{else}-{/if}',
),
),
array(
// 'date_entered',
array (
'label' => 'LBL_DATE_ENTERED',
'customCode' => '{if $fields.date_entered.value}{$fields.date_entered.value}{else}nigdy{/if}',
),
// 'date_modified',
array (
'label' => 'LBL_DATE_MODIFIED',
'customCode' => '{if $fields.date_modified.value}{$fields.date_modified.value}{else}nigdy{/if}',
),
),
array(
'position',
'name',
),
array(
// 'acc_wn',
// 'acc_wn_code',
array (
'label' => 'LBL_ACC_WN_CODE',
// 'customCode' => '{if $fields.acc_wn_code.value}{$fields.acc_wn_code.value}{else}000{/if}',
'customCode' => '
{if $fields.account_acc_wn.value}
Konto WN kontrahenta
{else}
{if $fields.acc_wn_code.value}
{$fields.acc_wn_code.value}
{else}
000
{/if}
{/if}',
),
// 'acc_ma',
// 'acc_ma_code',
array (
'label' => 'LBL_ACC_MA_CODE',
'customCode' => '
{if $fields.account_acc_ma.value}
Konto MA kontrahenta
{else}
{if $fields.acc_ma_code.value}
{$fields.acc_ma_code.value}
{else}
000
{/if}
{/if}',
),
),
/*
array(
// 'account_acc_wn',
array (
'label' => 'LBL_ACCOUNT_ACC_WN',
'customCode' => '{if $fields.account_acc_wn.value}Tak{else}Nie{/if}',
),
// 'account_acc_ma',
array (
'label' => 'LBL_ACCOUNT_ACC_MA',
'customCode' => '{if $fields.account_acc_ma.value}Tak{else}Nie{/if}',
),
),
*/
array(
'rez',
'vat',
),
array(
'netto',
'type',
),
array(
// 'deleted',
array (
'label' => 'LBL_DELETED',
'customCode' => '{if $fields.deleted.value}Tak{else}Nie{/if}',
),
'',
),
),
'LBL_DECREE' => array(
array(
array(
'name' => 'decree_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmFkVatTables/MyTable.css" />
<!--<link rel="stylesheet" type="text/css" href="modules/EcmFkVatTables/AjaxSearch/AjaxSearch.css" />-->
<div style="width: 100%; border: 1px solid rgb(48, 192, 255); background-color: white; height: {$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px; overflow:auto;" id="decreeTableDIV">
<table class="positions" style="width: 100%;" id="decreeTable">
<thead id="head">
<tr id="tr">
<td width="20%">{$MOD.LBL_EDITABLE_POSITION}</td>
<td width="25%">{$MOD.LBL_EDITABLE_NAME}</td>
<td width="25%">{$MOD.LBL_EDITABLE_WN}</td>
<td width="25%">{$MOD.LBL_EDITABLE_MA}</td>
<!--<td width="5%">{$MOD.LBL_EDITABLE_OPTIONS}</td>-->
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
',
),
),
),
'LBL_DEFINITIONS' => array(
array(
'zal',
'licz',
),
array(
'zal_wn',
'zal_ma',
),
),
),
);

View File

@@ -0,0 +1,225 @@
<?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['EcmFkVatTables']['EditView'] = array(
'templateMeta' => array(
'form' => array(
'buttons'=>array(
array(
'customCode' => '
<input type="submit" name="save" class="button" value="Zapisz" onclick="saveItems(true); this.form.action.value=\'Save\'; /*return false;*/" />
',
),
'CANCEL',
),
'enctype' => 'multipart/form-data',
'hidden' => array(
'<input type="hidden" name="decree_list" id="decree_list" value="{$DECREE_LIST}"/>',
'<input type="hidden" name="type" id="type" value=""/>',
'<input type="hidden" name="template_id" id="template_id" value=""/>',
),
),
'maxColumns' => '2',
'widths' => array(
array(
'label' => '10',
'field' => '30',
),
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/EcmFkVatTables/EcmFkVatRegisters.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
<script type="text/javascript" src="modules/EcmFkVatTables/EcmFkVatRegistersEditView.js?s={$SUGAR_VERSION}&c={$JS_CUSTOM_VERSION}"></script>
',
*/
'includes' => array(
array(
'file' => 'include/JSON.js',
),
/*
array(
'file' => 'include/javascript/quicksearch.js',
),
array(
'file' => 'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js',
),
array(
'file' => 'modules/EcmFkVatTables/AjaxSearch/AjaxSearch.js',
),
array(
'file' => 'modules/EcmFkVatTables/formloader.js',
),
*/
array(
'file' => 'modules/EcmFkVatTables/MyTable.js',
),
array(
'file' => 'modules/EcmFkVatTables/EcmFkVatRegisters.js',
),
array(
'file' => 'modules/EcmFkVatTables/EcmFkVatRegistersEditView.js',
),
array(
'file' => 'modules/EcmProducts/mintajax.js',
),
array(
'file' => 'modules/EcmProducts/helper.js',
),
),
),
'panels' => array(
'LBL_DETAILS' => array(
// array(
// 'created_by',
// 'modified_user_id',
// ),
// array(
// 'date_entered',
// 'date_modified',
// ),
array(
'position',
'name',
),
array(
'account_acc_wn',
'account_acc_ma',
),
array(
// 'acc_wn',
'acc_wn_code',
// 'acc_ma',
'acc_ma_code',
),
array(
'rez',
'vat',
),
array(
'netto',
'type',
),
array(
'deleted',
'',
),
),
'LBL_DECREE' => array(
array(
array(
'name' => 'decree_panel',
'allCols' => true,
'hideLabel' => true,
'customCode' =>
'
<link rel="stylesheet" type="text/css" href="modules/EcmFkVatTables/MyTable.css" />
<!--<link rel="stylesheet" type="text/css" href="modules/EcmFkVatTables/AjaxSearch/AjaxSearch.css" />-->
<div style="width: 100%; border: 1px solid rgb(48, 192, 255); background-color: white; height: {$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px; overflow:auto;" id="decreeTableDIV">
<table class="positions" style="width: 100%;" id="decreeTable">
<thead id="head">
<tr id="tr">
<td width="20%">{$MOD.LBL_EDITABLE_POSITION}</td>
<td width="25%">{$MOD.LBL_EDITABLE_NAME}</td>
<td width="25%">{$MOD.LBL_EDITABLE_WN}</td>
<td width="25%">{$MOD.LBL_EDITABLE_MA}</td>
<td width="5%">{$MOD.LBL_EDITABLE_OPTIONS}</td>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
',
),
),
),
'LBL_DEFINITIONS' => array(
array(
// 'zal',
array(
'label' => 'LBL_ZAL',
'customCode' => '
<textarea name="zal" id="zal" style="width: 100%;">
{$fields.zal.value}
</textarea>
',
),
// 'licz',
array(
'label' => 'LBL_LICZ',
'customCode' => '
<textarea name="licz" id="licz" style="width: 100%;">
{$fields.licz.value}
</textarea>
',
),
),
array(
// 'zal_wn',
array(
'label' => 'LBL_ZAL_WN',
'customCode' => '
<textarea name="zal_wn" id="zal_wn" style="width: 100%;">
{$fields.zal_wn.value}
</textarea>
',
),
// 'zal_ma',
array(
'label' => 'LBL_ZAL_MA',
'customCode' => '
<textarea name="zal_ma" id="zal_ma" style="width: 100%;">
{$fields.zal_ma.value}
</textarea>
',
),
),
),
),
);

View File

@@ -0,0 +1,205 @@
<?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".
* ****************************************************************************** */
$def = array(
'ID' => array(
'label' => 'LBL_ID',
'link' => false,
'default' => true,
'bold' => false,
),
'DELETED' => array(
'label' => 'LBL_DELETED',
'link' => false,
'default' => true,
'bold' => false,
),
'DATE_ENTERED' => array(
'label' => 'LBL_DATE_ENTERED',
'link' => false,
'default' => true,
'bold' => false,
),
'DATE_MODIFIED' => array(
'label' => 'LBL_DATE_MODIFIED',
'link' => false,
'default' => true,
'bold' => false,
),
'CREATED_BY' => array(
'label' => 'LBL_CREATED_BY',
'link' => false,
'default' => true,
'bold' => false,
),
'MODIFIED_BY' => array(
'label' => 'LBL_MODIFIED_BY',
'link' => false,
'default' => true,
'bold' => false,
),
'POSITION' => array(
'label' => 'LBL_POSITION',
'link' => false,
'default' => true,
'bold' => false,
),
'NAME' => array(
'label' => 'LBL_NAME',
'link' => true,
'default' => true,
'bold' => false,
),
'ACC_WN' => array(
'label' => 'LBL_ACC_WN',
'link' => false,
'default' => true,
'bold' => false,
),
'ACC_MA' => array(
'label' => 'LBL_ACC_MA',
'link' => false,
'default' => true,
'bold' => false,
),
'ZAL' => array(
'label' => 'LBL_ZAL',
'link' => false,
'default' => true,
'bold' => false,
),
'LICZ' => array(
'label' => 'LBL_LICZ',
'link' => false,
'default' => true,
'bold' => false,
),
'REZ' => array(
'label' => 'LBL_REZ',
'link' => false,
'default' => true,
'bold' => false,
),
'VAT' => array(
'label' => 'LBL_VAT',
'link' => false,
'default' => true,
'bold' => false,
),
'NETTO' => array(
'label' => 'LBL_NETTO',
'link' => false,
'default' => true,
'bold' => false,
),
'ZAL_WN' => array(
'label' => 'LBL_ZAL_WN',
'link' => false,
'default' => true,
'bold' => false,
),
'ZAL_MA' => array(
'label' => 'LBL_ZAL_MA',
'link' => false,
'default' => true,
'bold' => false,
),
'TYPE' => array(
'label' => 'LBL_TYPE',
'link' => false,
'default' => true,
'bold' => false,
),
);
// Describe on table:
//
// id
// deleted
// date_entered
// date_modified
// created_by
// modified_by
// position
// name
// acc_wn
// acc_ma
// zal
// licz
// rez
// vat
// netto
// zal_wn
// zal_ma
// table_type
$list = array(
// 'ID' => null,
// 'DELETED' => null,
// 'DATE_ENTERED' => null,
// 'DATE_MODIFIED' => null,
// 'CREATED_BY' => null,
// 'MODIFIED_BY' => null,
'POSITION' => null,
'NAME' => null,
'ACC_WN' => null,
'ACC_MA' => null,
// 'ZAL' => null,
// 'LICZ' => null,
// 'REZ' => null,
// 'VAT' => null,
// 'NETTO' => null,
// 'ZAL_WN' => null,
// 'ZAL_MA' => null,
'TYPE' => null,
);
array_walk($list, function(&$value, $key) use ($def) {
$value = $def[$key];
});
// dump($list);exit;
// $listViewDefs['EcmFkVatTables'] = array_intersect_key($def, $list);
$listViewDefs['EcmFkVatTables'] = $list;
// echo '<pre>' . var_export($listViewDefs['EcmFkVatTables'], true) . '</pre>';
// exit;

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".
* ****************************************************************************** */
global $mod_strings;
$popupMeta = array(
'moduleMain' => 'EcmFkVatTable',
'varName' => 'BANK_ACCOUNT',
'orderBy' => 'name',
'whereClauses' => array(
'code' => 'ecmFkVatTables.code',
// 'billing_address_city' => 'ecmFkVatTables.billing_address_city',
// 'phone_office' => 'ecmFkVatTables.phone_office'
),
'searchInputs' => array(
'code',
// 'billing_address_city',
// 'phone_office',
),
'create' => array(
'formBase' => 'EcmFkVatTableFormBase.php',
'formBaseClass' => 'EcmFkVatTableFormBase',
'getFormBodyParams' => array(
'',
'',
'EcmFkVatTableSave',
),
'createButton' => $mod_strings['LNK_NEW_ACCOUNT'],
),
'listviewdefs' => array(
'POSITION' =>
array (
'label' => 'LBL_POSITION',
'link' => false,
'default' => true,
'bold' => false,
),
'NAME' =>
array (
'label' => 'LBL_NAME',
'link' => true,
'default' => true,
'bold' => false,
),
'ACC_WN' =>
array (
'label' => 'LBL_ACC_WN',
'link' => false,
'default' => true,
'bold' => false,
),
'ACC_MA' =>
array (
'label' => 'LBL_ACC_MA',
'link' => false,
'default' => true,
'bold' => false,
),
'ACCOUNT_ACC_WN' =>
array (
'label' => 'LBL_ACCOUNT_ACC_WN',
'link' => false,
'default' => false,
'bold' => false,
),
'ACCOUNT_ACC_MA' =>
array (
'label' => 'LBL_ACCOUNT_ACC_MA',
'link' => false,
'default' => false,
'bold' => false,
),
'TYPE' =>
array (
'label' => 'LBL_TYPE',
'link' => false,
'default' => true,
'bold' => false,
),
),
'searchdefs' => array(
// 'id',
// 'deleted',
// 'date_entered',
// 'date_modified',
// 'created_by',
// 'modified_user_id',
'position',
'name',
// 'acc_wn',
// 'acc_ma',
// 'zal',
// 'licz',
// 'rez',
// 'vat',
// 'netto',
// 'zal_wn',
// 'zal_ma',
'type',
)
);

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['EcmFkVatTables']['QuickCreate'] = array(
'templateMeta' => array('form' => array('enctype'=>'multipart/form-data',
'hidden'=>array('<input type="hidden" name="old_id" value="{$fields.ecmfkvattable_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/EcmFkVatTables/ecmfkvattables.js'),
),
),
'panels' =>array (
'default' =>
array (
array (
array('name'=>'uploadfile',
'customCode' => '<input type="hidden" name="escaped_ecmfkvattable_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 (
'ecmfkvattable_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,93 @@
<?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['EcmFkVatTables'] = array(
'templateMeta' => array(
'maxColumns' => '2',
'widths' => array(
'label' => '10',
'field' => '30',
),
),
'layout' => array(
'basic_search' => array(
// 'id',
// 'deleted',
// 'date_entered',
// 'date_modified',
// 'created_by',
// 'modified_user_id',
'position',
'name',
// 'acc_wn',
// 'acc_ma',
// 'zal',
// 'licz',
// 'rez',
// 'vat',
// 'netto',
// 'zal_wn',
// 'zal_ma',
'type',
),
/*
'advanced_search' => array(
// 'id',
// 'deleted',
// 'date_entered',
// 'date_modified',
// 'created_by',
// 'modified_user_id',
'position',
'name',
// 'acc_wn',
// 'acc_ma',
'acc_wn_code',
'acc_ma_code',
// 'zal',
// 'licz',
// 'rez',
// 'vat',
// 'netto',
// 'zal_wn',
// 'zal_ma',
'type',
),
*/
),
);

View File

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

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".
********************************************************************************/
$layout_defs['EcmFkVatTables'] = array(
// list of what Subpanels to show in the DetailView
'subpanel_setup' => array(
'therevisions' => array(
'order' => 10,
'sort_order' => 'desc',
'sort_by' => 'revision',
'module' => 'EcmFkVatTableRevisions',
'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' => 'EcmFkVatTables','field_to_name_array'=>array('ecmfkvattable_revision_id'=>'REL_ATTRIBUTE_document_revision_id')),
),
'where' => '',
'list_fields'=> array(
'ecmfkvattable_name'=> array(
'name' => 'ecmfkvattable_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' => 'EcmFkVatTables',
'width' => '5%',
),
'remove_button'=>array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmFkVatTables',
'width' => '5%',
),
'ecmfkvattable_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' => 'EcmFkVatTables','field_to_name_array'=>array('ecmfkvattable_revision_id'=>'REL_ATTRIBUTE_document_revision_id')),
),
'where' => '',
'list_fields'=> array(
'object_image'=>array(
'vname' => 'LBL_OBJECT_IMAGE',
'widget_class' => 'SubPanelIcon',
'width' => '2%',
'image2'=>'attachment',
'image2_url_field'=>array('id_field'=>'selected_revision_id','filename_field'=>'selected_revision_filename'),
'attachment_image_only'=>true,
),
'ecmfkvattable_name'=> array(
'name' => 'ecmfkvattable_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' => 'EcmFkVatTables',
'width' => '5%',
),
'load_signed'=>array(
'widget_class' => 'SubPanelLoadSignedButton',
'module' => 'EcmFkVatTables',
'width' => '5%',
),
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'EcmFkVatTables',
'width' => '5%',
),
'remove_button'=>array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmFkVatTables',
'width' => '5%',
),
),
);
?>

View File

@@ -0,0 +1,20 @@
<?php
require_once 'modules/EcmFkVatTables/EcmFkBook.php';
$focus = new EcmFkVatTable();
switch($type = strtolower(@$_GET['type'])) {
default:
$focus->getPDF('d');
break;
case 'd':
case 'pk1':
case 'pk2':
case 'pk3':
$focus->getPDF($type);
break;
}
exit;

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' => 'EcmFkVatTables','field_to_name_array'=>array('ecmfkvattable_revision_id'=>'REL_ATTRIBUTE_document_revision_id')),
),
'where' => '',
'list_fields'=> array(
'ecmfkvattable_name'=> array(
'name' => 'ecmfkvattable_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' => 'EcmFkVatTables',
'width' => '5%',
),
'remove_button'=>array(
'widget_class' => 'SubPanelRemoveButton',
'module' => 'EcmFkVatTables',
'width' => '5%',
),
'ecmfkvattable_revision_id'=>array(
'usage'=>'query_only'
),
),
);
?>

View File

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

142
modules/EcmFkVatTables/update.php Executable file
View File

@@ -0,0 +1,142 @@
<?php
echo PHP_EOL;
#set_time_limit(9999999999);
$sql = mysql_connect('localhost', 'root', '1ptimu6');
mysql_select_db('crm');
mysql_query('SET NAMES utf8;');
function getmicrotime() {
list($usec, $sec) = explode(' ', microtime());
return ((float) $usec + (float) $sec);
}
function addVat($r, $c = false) {
//'01-' . str_pad($r['MIESIAC'], 2, '0', STR_PAD_LEFT) . '-' . str_pad($r['ROK'], 2, '0', STR_PAD_LEFT),
$now = new DateTime();
$dateVat = clone $now;
$dateVat->setDate(substr($r['D_KSIEG'], 0, 4), substr($r['D_KSIEG'], 4, 2), substr($r['D_KSIEG'], 6, 2));
$dateVat->setTime(0, 0, 0);
$dateDocument = clone $now;
$dateDocument->setDate(substr($r['DAT_DOK'], 0, 4), substr($r['DAT_DOK'], 4, 2), substr($r['DAT_DOK'], 6, 2));
$dateDocument->setTime(0, 0, 0);
$vatDate = clone $now;
$vatDate->setDate(2000 + $r['ROK'], $r['MIESIAC'], 1); // temp + 2000 (?)
$vatDate->setTime(0, 0, 0);
$arr = array(
'id' => create_guid(),
'date_entered' => date('Y-m-d H:i:s'),
//'date_modified' => null,
'date_vat' => $dateVat->format('Y-m-d H:i:s'),
'date_document' => $dateDocument->format('Y-m-d H:i:s'),
//'modified_user_id' => null,
'created_by' => 'd9c0007b-1247-5e82-31b6-4f168a01d290', // ems
'description' => $r['OPIS_1'] . PHP_EOL . $r['OPIS_2'],
//'deleted' => null,
'vat_date' => $vatDate->format('Y-m-d H:i:s'),
'vat_name' => $r['NR_DOK'],
'vat_number' => $r['NR_SYSt'],
'vat_amount' => $r['KWOTA'],
'vat_acc_wn' => $r['K_SYN_WN'] . (($analWn = $r['K_ANAL_WN']) ? ('-' . $analWn) : ''),
'vat_acc_ma' => $r['K_SYN_MA'] . (($analMa = $r['K_ANAL_MAt']) ? ('-' . $analMa) : ''),
'vat_position' => $r['POZ_DOKt'],
'vat_symbol' => $r['SYM_DOK'],
'vat_identifier' => $r['ID_DOK'],
);
echo var_export($r, true);
echo PHP_EOL . PHP_EOL;
echo var_export($arr, true);
exit;
$arr = array_filter($arr, 'strlen');
foreach ($arr as $k => $v) {
$in[] = sprintf('`%s` = \'%s\'', $k, $v);
}
$query = 'INSERT INTO `ecmfkvattables` SET ' . implode(', ', $in) . ';';
/*
echo $query . PHP_EOL;
exit;
*/
mysql_query($query);
if($e = mysql_error()) {
echo __LINE__ . ' => ' . var_export(mysql_error(), true) . PHP_EOL;
return false;
}
if(true == $c)
echo $arr['id'] . PHP_EOL;
return true;
}
include_once('class.dbf.php');
include_once('helper.php');
$dbfp = new dbf_class('pk__13__.dbf');
$num_recp = $dbfp->dbf_num_rec;
for ($i = 0; $i < $num_recp; $i++) {
$rowp = $dbfp->getRowAssoc($i);
// echo var_export($rowp, true); exit;
$add += addVat($rowp) ? 1 : 0;
}
$start = getmicrotime();
$koniec = getmicrotime();
echo 'Podsumowanie:' . PHP_EOL . 'W dbf: ' . $num_recp . PHP_EOL . 'Dodano: ' . $add . PHP_EOL;
echo 'Czas trawania:' . (($koniec - $start) / 60) . ' minut';
mysql_close($sql);
// nr_sys
// ident_k
// sym_dok
// nr_dok
// poz_dok
// wys_k_wn
// wys_k_ma
// spar_tr
// miesiac
// kwota
// id_dok
// opis_1
// opis_2
// rezerwa
// zm_spar
// kwota_wal
// symb_wal
// kurs_wal
// Nr sys
// Id
// Symb
// Nr dok.
// Pozycja.
// KONTO Wn
// KONTO Ma
// Wskaźnik
// Miesiąc
// Kwota
// Ident.ksi©g.
// Opis 1 cz©˜
// Opis 2 cz©˜
// Rezerwa
// Tryb parowania
// Kwota w walucie
// Symb
// Kurs waluty

View File

@@ -0,0 +1,15 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
session_start();
$yearDateTime = DateTime::createFromFormat('Y', $_GET['year']);
if($yearDateTime) {
$_SESSION['fk_year'] = $yearDateTime->format('Y');
}
echo $_SESSION['fk_year'];
die();

View File

@@ -0,0 +1,390 @@
<?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['EcmFkVatTable'] = array(
'table' => 'ecmfkvattables',
// 'audited' => false,
'fields' => array(
'id' => array(
'name' => 'id',
'vname' => 'LBL_ID',
'type' => 'id',
'required' => true,
'reportable' => true,
),
'date_entered' => array(
'name' => 'date_entered',
'vname' => 'LBL_DATE_CREATED',
'type' => 'date',
),
'date_modified' => array(
'name' => 'date_modified',
'vname' => 'LBL_DATE_MODIFIED',
'type' => 'date',
),
'modified_user_id' => array(
'name' => 'modified_user_id',
'rname' => 'user_name',
'id_name' => 'modified_user_id',
'vname' => 'LBL_MODIFIED_ID',
'type' => 'assigned_user_name',
'table' => 'users',
'isnull' => false,
'group' => 'modified_by_name',
'dbType' => 'id',
'reportable' => true,
'comment' => 'User who last modified record',
),
'created_by' => array(
'name' => 'created_by',
'rname' => 'user_name',
'id_name' => 'modified_user_id',
'vname' => 'LBL_CREATED_ID',
'type' => 'assigned_user_name',
'table' => 'users',
'isnull' => false,
'dbType' => 'id',
'group' => 'created_by_name',
'comment' => 'User who created record',
),
'deleted' => array(
'name' => 'deleted',
'vname' => 'LBL_DELETED',
'type' => 'bool',
'default' => '0',
'reportable' => false,
),
'position' => array(
'name' => 'position',
'vname' => 'LBL_POSITION',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
'name' => array(
'name' => 'name',
'vname' => 'LBL_NAME',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
'acc_wn' => array(
'name' => 'acc_wn',
'rname' => 'code',
'id_name' => 'acc_wn',
'vname' => 'LBL_ACC_WN',
// 'type' => 'assigned_user_name',
'table' => 'ecmbankaccounts',
'isnull' => false,
// 'group' => 'modified_by_name',
'dbType' => 'id',
'reportable' => true,
),
'account_acc_wn' => array(
'name' => 'account_acc_wn',
'vname' => 'LBL_ACCOUNT_ACC_WN',
'type' => 'bool',
'default' => '0',
'reportable' => false,
),
/*
'acc_wn' => array(
'name' => 'acc_wn',
'vname' => 'LBL_ACC_WN',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
*/
'acc_ma' => array(
'name' => 'acc_ma',
'rname' => 'code',
'id_name' => 'acc_ma',
'vname' => 'LBL_ACC_WN',
// 'type' => 'assigned_user_name',
'table' => 'ecmbankaccounts',
'isnull' => false,
// 'group' => 'modified_by_name',
'dbType' => 'id',
'reportable' => true,
),
'account_acc_ma' => array(
'name' => 'account_acc_ma',
'vname' => 'LBL_ACCOUNT_ACC_WN',
'type' => 'bool',
'default' => '0',
'reportable' => false,
),
/*
'acc_ma' => array(
'name' => 'acc_ma',
'vname' => 'LBL_ACC_MA',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
*/
'zal' => array(
'name' => 'zal',
'vname' => 'LBL_ZAL',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
'licz' => array(
'name' => 'licz',
'vname' => 'LBL_LICZ',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
'rez' => array(
'name' => 'rez',
'vname' => 'LBL_REZ',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
'vat' => array(
'name' => 'vat',
'vname' => 'LBL_VAT',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
'netto' => array(
'name' => 'netto',
'vname' => 'LBL_NETTO',
// 'type' => 'varchar',
// 'len' => '255',
'type' => 'enum',
'options' => 'ecmfkvattables_netto_dom',
'reportable' => false,
),
'zal_wn' => array(
'name' => 'zal_wn',
'vname' => 'LBL_ZAL_WN',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
'zal_ma' => array(
'name' => 'zal_ma',
'vname' => 'LBL_ZAL_MA',
'type' => 'varchar',
'len' => '255',
'reportable' => false,
),
'type' => array(
'name' => 'type',
'vname' => 'LBL_TYPE',
'type' => 'enum',
'options' => 'ecmfkvattables_type_dom',
'reportable' => false,
),
//
'modified_by_name' => array(
'name' => 'modified_by_name',
'vname' => 'LBL_MODIFIED_NAME',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'rname' => 'user_name',
'table' => 'users',
'id_name' => 'modified_user_id',
'module' => 'Users',
'link' => 'modified_user_link',
'duplicate_merge' => 'disabled',
),
'modified_user_link' => array(
'name' => 'modified_user_link',
'type' => 'link',
'relationship' => 'ecmfkvattables_modified_user',
'vname' => 'LBL_MODIFIED_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db',
),
'created_by_name' => array(
'name' => 'created_by_name',
'vname' => 'LBL_CREATED',
'type' => 'relate',
'reportable' => false,
'link' => 'created_by_link',
'rname' => 'user_name',
'source' => 'non-db',
'table' => 'users',
'id_name' => 'created_by',
'module' => 'Users',
'duplicate_merge' => 'disabled',
'importable' => false,
),
'created_by_link' => array(
'name' => 'created_by_link',
'type' => 'link',
'relationship' => 'ecmfkvattables_created_by',
'vname' => 'LBL_CREATED_USER',
'link_type' => 'one',
'module' => 'Users',
'bean_name' => 'User',
'source' => 'non-db',
),
'acc_wn_code' => array(
'name' => 'acc_wn_code',
'vname' => 'LBL_ACC_WN_CODE',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'rname' => 'code',
'table' => 'ecmbankaccounts',
'id_name' => 'acc_wn',
'module' => 'EcmBankAccounts',
'link' => 'modified_ecmbankaccount_link',
'duplicate_merge' => 'disabled',
),
'acc_ma_code' => array(
'name' => 'acc_ma_code',
'vname' => 'LBL_ACC_MA_CODE',
'type' => 'relate',
'reportable' => false,
'source' => 'non-db',
'rname' => 'code',
'table' => 'ecmbankaccounts',
'id_name' => 'acc_ma',
'module' => 'EcmBankAccounts',
'link' => 'modified_ecmbankaccount_link',
'duplicate_merge' => 'disabled',
),
),
'indices' => array(
'id' => array(
'name' => 'ecmfkvattablespk',
'type' => 'primary',
'fields' => array(
'id',
),
),
),
'relationships' => array(
'modified_user_id' => array(
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmFkVatTables',
'rhs_table' => 'ecmfkvattables',
'rhs_key' => 'modified_user_id',
'relationship_type' => 'one-to-many',
),
'created_by' => array(
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'id',
'rhs_module' => 'EcmFkVatTables',
'rhs_table' => 'ecmfkvattables',
'rhs_key' => 'created_by',
'relationship_type' => 'one-to-many',
),
'acc_wn' => array(
'lhs_module' => 'EcmBankAccounts',
'lhs_table' => 'ecmbankaccounts',
'lhs_key' => 'id',
'rhs_module' => 'EcmFkVatTables',
'rhs_table' => 'ecmfkvattables',
'rhs_key' => 'acc_wn',
'relationship_type' => 'one-to-many',
),
'acc_ma' => array(
'lhs_module' => 'EcmBankAccounts',
'lhs_table' => 'ecmbankaccounts',
'lhs_key' => 'id',
'rhs_module' => 'EcmFkVatTables',
'rhs_table' => 'ecmfkvattables',
'rhs_key' => 'acc_ma',
'relationship_type' => 'one-to-many',
),
),
// 'optimistic_locking' => true,
);
// Describe on table:
//
// id
// deleted
// date_entered
// date_modified
// created_by
// modified_user_id
// position
// name
// acc_wn
// acc_ma
// account_acc_wn
// account_acc_ma
// zal
// licz
// rez
// vat
// netto
// zal_wn
// zal_ma
// type
//$field = array(
// 'name' => '',
// 'vname' => '',
// 'type' => 'relate' | 'datetime' | 'bool' | 'enum' | 'char' | 'assigned_user_name' | 'varchar',
// 'table' => '',
// 'isnull' => '',
// 'len' => '',
// 'options' => '',
// 'dbtype' => '',
// 'reportable' => '',
// 'required' => '',
// 'default' => '',
// 'massupdate' => '',
// 'rname' => '',
// 'id_name' => '',
// 'source' => '',
// 'sort_on' => '',
// 'fields' => '',
// 'db_concat_fields' => '',
//);

View File

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

View File

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

View File

@@ -0,0 +1,164 @@
<?php
if (!defined('sugarEntry') || !sugarEntry)
die('Not A Valid Entry Point');
require_once('include/MVC/View/views/view.list.php');
class EcmFkVatTablesViewList extends ViewList {
function listViewProcess() {
$this->processSearchForm();
$this->lv->searchColumns = $this->searchForm->searchColumns;
if (!$this->headers)
return;
$_REQUEST['EcmFkVatTables2_ECMFKBOOK_ORDER_BY'] = $_REQUEST['EcmFkBooks2_ECMFKBOOK_ORDER_BY'] ? : 'date_document';
$customOrder = array();
// switch(strtoupper($this->params['orderBy'])) {EcmFkVatTables2_ECMFKBOOK_ORDER_BY
switch(strtoupper($_REQUEST['EcmFkVatTables2_ECMFKBOOK_ORDER_BY'])) {
default:
$customOrder = array(
//
);
break;
// nr_sys 3
case 'BOOK_NUMBER':
$customOrder = array(
//
);
break;
// ident_k 8
case 'IDENT_K':
$customOrder = array(
//
);
break;
// sym_dok 4
case 'BOOK_SYMBOL':
$customOrder = array(
'`ecmfkvattables`.`vat_name` DESC',
'`ecmfkvattables`.`vat_position` DESC',
);
break;
case 'BOOK_NAME':
$customOrder = array(
//
);
break;
case 'BOOK_POSITION':
$customOrder = array(
//
);
break;
// k_syn_wn + k_anal_wn 1
case 'BOOK_ACC_WN':
$customOrder = array(
'`ecmfkvattables`.`miesiac` DESC',
'`ecmfkvattables`.`date_document` DESC',
);
break;
// k_syn_ma + k_anal_ma 2
case 'BOOK_ACC_MA':
$customOrder = array(
'`ecmfkvattables`.`miesiac` DESC',
'`ecmfkvattables`.`date_document` DESC',
);
break;
// kwota 9
case 'BOOK_AMOUNT':
$customOrder = array(
//
);
break;
// id_dok 8
case 'BOOK_IDENTIFIER':
$customOrder = array(
//
);
break;
case 'DESCRIPTION':
$customOrder = array(
//
);
break;
// rezerwa 10
case 'REZERWA':
$customOrder = array(
//
);
break;
case 'KWOTA_WAL':
$customOrder = array(
//
);
break;
case 'SYMB_WAL':
$customOrder = array(
//
);
break;
case 'KURS_WAL':
$customOrder = array(
//
);
break;
}
$this->params['custom_order_by'] = (($implodedCustomOrder = implode(', ', $customOrder)) ? (', ' . $implodedCustomOrder) : '');
if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
$this->lv->ss->assign('SEARCH', true);
$this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
// useless ?
//$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
echo $this->lv->display();
}
// dump($GLOBALS);exit;
// global $ss;
// $ss->assign('DISPLAY_FK_YEAR', true);
// $this->lv->assign('DISPLAY_FK_YEAR', true);
// $this->lv->ss->assign('DISPLAY_FK_YEAR', true);
// dump($this->lv);
// dump($this->lv->ss);
// exit;
}
}