343 lines
12 KiB
PHP
343 lines
12 KiB
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (!defined('sugarEntry') || !sugarEntry) {
|
|||
|
|
die('Not A Valid Entry Point');
|
|||
|
|
}
|
|||
|
|
global $app_strings;
|
|||
|
|
global $mod_strings;
|
|||
|
|
global $current_user;
|
|||
|
|
$error='';
|
|||
|
|
require_once('modules/EcmSysInfos/EcmSysInfo.php');
|
|||
|
|
$EcmSysInfo = new EcmSysInfo();
|
|||
|
|
|
|||
|
|
if (!$current_user->is_admin) {
|
|||
|
|
ACLController::displayNoAccess(true);
|
|||
|
|
sugar_die();
|
|||
|
|
}
|
|||
|
|
$db = $GLOBALS ['db'];
|
|||
|
|
|
|||
|
|
if (isset($_POST['short_name'])) {
|
|||
|
|
$EcmSysInfo->saveShortName($_POST['short_name']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (isset($_POST['name'])) {
|
|||
|
|
$EcmSysInfo->saveName($_POST['name']);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (isset($_POST['email_hostPort'])){
|
|||
|
|
$error=$EcmSysInfo->saveEmailSettings();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (isset($_POST['banks'])) {
|
|||
|
|
$EcmSysInfo->saveBanks($_POST['banks']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['adress'])) {
|
|||
|
|
$EcmSysInfo->saveAdress($_POST['adress']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['invoice_number_format'])) {
|
|||
|
|
$EcmSysInfo->saveInvoiceNumberFormat($_POST['invoice_number_format']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['nip'])) {
|
|||
|
|
$EcmSysInfo->saveNip($_POST['nip']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['regon'])) {
|
|||
|
|
$EcmSysInfo->saveRegon($_POST['regon']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['www'])) {
|
|||
|
|
$EcmSysInfo->saveWWW($_POST['www']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['krs'])) {
|
|||
|
|
$EcmSysInfo->saveKrs($_POST['krs']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['register_adress'])) {
|
|||
|
|
$EcmSysInfo->saveRegisterAdress($_POST['register_adress']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['correspondence_adress'])) {
|
|||
|
|
$EcmSysInfo->saveCorrespondenceAdress($_POST['correspondence_adress']);
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['contact'])) {
|
|||
|
|
$EcmSysInfo->saveContactInfo($_POST['contact']);
|
|||
|
|
}
|
|||
|
|
if (isset($_FILES['upfile'])) {
|
|||
|
|
$EcmSysInfo->saveFile();
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['api_version'])) {
|
|||
|
|
$EcmSysInfo->saveNotificationSettings();
|
|||
|
|
}
|
|||
|
|
if (isset($_POST['update_headers'])) {
|
|||
|
|
$db = $GLOBALS['db'];
|
|||
|
|
$tmpmodstrings = $mod_strings;
|
|||
|
|
foreach ($sugar_config['languages'] as $key => $value) {
|
|||
|
|
$mod_strings = return_module_language($key, 'EcmSysInfos');
|
|||
|
|
$return = $db->query("SELECT id, value2 FROM operating_values WHERE name='headersDocuments' AND module_name='EcmSysInfos' AND value4='" . $key . "'");
|
|||
|
|
while ($row = $db->fetchByAssoc($return)) {
|
|||
|
|
$www = $EcmSysInfo->getWWW();
|
|||
|
|
$logo= $EcmSysInfo-> getLogo();
|
|||
|
|
|
|||
|
|
if($logo!=''){
|
|||
|
|
$ww = '<img style="height:70px;" src="upload/'.$logo.'">';
|
|||
|
|
} else {
|
|||
|
|
$ww='';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$adres = $EcmSysInfo->getRegisterAdress();
|
|||
|
|
$ul = $adres['STREET'] . ' ' . $adres['LOCAL'];
|
|||
|
|
if(strlen(trim($adres['HOME']))>0){
|
|||
|
|
$ul .= '/'.$adres['HOME'];
|
|||
|
|
}
|
|||
|
|
$bank = $EcmSysInfo->getBanks();
|
|||
|
|
|
|||
|
|
$stronk = '';
|
|||
|
|
$footer = '
|
|||
|
|
<hr>
|
|||
|
|
<table style="width: 100%; vertical-align:top;">
|
|||
|
|
<tr>
|
|||
|
|
<td style="width:50%">
|
|||
|
|
<span style="font-size:8px">
|
|||
|
|
' . $EcmSysInfo->getName() . '<br/>
|
|||
|
|
ul. ' . $ul . '<br/>
|
|||
|
|
' . $adres['POSTALCODE'] . ' ' . $adres['CITY'] . '<br />
|
|||
|
|
NIP: ' . $EcmSysInfo->getNip() . '</td>
|
|||
|
|
</span>
|
|||
|
|
<td style="width:20%">
|
|||
|
|
<span style="font-size:8px">
|
|||
|
|
' . $mod_strings['LBL_BANK'] . ':<br>
|
|||
|
|
' . $mod_strings['LBL_BANK_ACCOUNT_NUMBER'] . ':
|
|||
|
|
</span>
|
|||
|
|
</td>
|
|||
|
|
<td style="width:30%">
|
|||
|
|
<span style="font-size:8px">
|
|||
|
|
' . $bank[0]['NAME'] . '<br>
|
|||
|
|
' . $bank[0]['NUMBER'] . '
|
|||
|
|
</span>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>';
|
|||
|
|
$extra='';
|
|||
|
|
switch ($row['value2']) {
|
|||
|
|
case 'EcmStockDocIns' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmInvoiceOuts' :
|
|||
|
|
$stronk = $mod_strings['LBL_SELLER'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmStockDocCorrects' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmPurchaseOrders' :
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmStockDocOuts' :
|
|||
|
|
$stronk = $mod_strings['LBL_PROVIDER'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmStockDocInsideIns' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmStockDocInsideOuts' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmStockDocMoves' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmQuotes' :
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmSales' :
|
|||
|
|
$stronk = $mod_strings['LBL_PURCHASER'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmReceipts' :
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmReceiptsToInvoiceOuts' :
|
|||
|
|
$stronk = $mod_strings['LBL_EXHIBITOR'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmNewKpkwsReceived' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = $mod_strings['LBL_RECEIVED'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmNewKpkwsGave' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = $mod_strings['LBL_GAVE'];
|
|||
|
|
break;
|
|||
|
|
case 'EcmPaymentStates' :
|
|||
|
|
$extra='<p style="text-align: center;"><span style="font-size:22px"><strong>Wezwanie do zapłaty</strong></span></p>';
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = 'Wystawca';
|
|||
|
|
break;
|
|||
|
|
case 'EcmPaymentStates2' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = 'Wystawca';
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$table = '
|
|||
|
|
<table border="0" style="width:100%">
|
|||
|
|
<tbody>
|
|||
|
|
<tr>
|
|||
|
|
<td style="vertical-align:middle; width:30%">
|
|||
|
|
' . $ww . '
|
|||
|
|
</td>
|
|||
|
|
<td style="vertical-align:middle; width:70%">
|
|||
|
|
<span style="font-size:12px">
|
|||
|
|
<strong>' . $stronk . '</strong><br>
|
|||
|
|
' . $EcmSysInfo->getName() . '<br>
|
|||
|
|
ul. ' . $ul . '<br>
|
|||
|
|
' . $adres['POSTALCODE'] . ' ' . $adres['CITY'] . '<br>
|
|||
|
|
' . $mod_strings['LBL_NIP'] . ': ' . $EcmSysInfo->getNip() . '
|
|||
|
|
</span>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</tbody>
|
|||
|
|
</table>'.$extra.'
|
|||
|
|
';
|
|||
|
|
$queryUpdate = "UPDATE operating_values SET "
|
|||
|
|
. "text0 = '" . htmlspecialchars(str_replace("'", '"', $table)) . "', "
|
|||
|
|
. "text1 = '" . htmlspecialchars(str_replace("'", '"', $footer)) . "' "
|
|||
|
|
. " WHERE id= '" . $row['id'] . "'";
|
|||
|
|
$tmp = $db->query($queryUpdate);
|
|||
|
|
}
|
|||
|
|
$extraTemplates=array('EcmPaymentStates'=>'Monit');
|
|||
|
|
foreach ($extraTemplates as $key=>$val){
|
|||
|
|
switch ($key) {
|
|||
|
|
case 'EcmPaymentStates' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = 'Wystawca';
|
|||
|
|
break;
|
|||
|
|
case 'EcmPaymentStates2' :
|
|||
|
|
$footer = '';
|
|||
|
|
$stronk = 'Wystawca';
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$www = $EcmSysInfo->getWWW();
|
|||
|
|
$logo= $EcmSysInfo-> getLogo();
|
|||
|
|
|
|||
|
|
if($logo!=''){
|
|||
|
|
$ww = '<img style="height:70px;" src="upload/'.$logo.'">';
|
|||
|
|
} else {
|
|||
|
|
$ww='';
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$adres = $EcmSysInfo->getRegisterAdress();
|
|||
|
|
$ul = $adres['STREET'] . ' ' . $adres['LOCAL'];
|
|||
|
|
if(strlen(trim($adres['HOME']))>0){
|
|||
|
|
$ul .= '/'.$adres['HOME'];
|
|||
|
|
}
|
|||
|
|
$bank = $EcmSysInfo->getBanks();
|
|||
|
|
|
|||
|
|
|
|||
|
|
$footer = '
|
|||
|
|
<hr>
|
|||
|
|
<table style="width: 100%; vertical-align:top;">
|
|||
|
|
<tr>
|
|||
|
|
<td style="width:50%">
|
|||
|
|
<span style="font-size:8px">
|
|||
|
|
' . $EcmSysInfo->getName() . '<br/>
|
|||
|
|
ul. ' . $ul . '<br/>
|
|||
|
|
' . $adres['POSTALCODE'] . ' ' . $adres['CITY'] . '<br />
|
|||
|
|
NIP: ' . $EcmSysInfo->getNip() . '</td>
|
|||
|
|
</span>
|
|||
|
|
<td style="width:20%">
|
|||
|
|
<span style="font-size:8px">
|
|||
|
|
' . $mod_strings['LBL_BANK'] . ':<br>
|
|||
|
|
' . $mod_strings['LBL_BANK_ACCOUNT_NUMBER'] . ':
|
|||
|
|
</span>
|
|||
|
|
</td>
|
|||
|
|
<td style="width:30%">
|
|||
|
|
<span style="font-size:8px">
|
|||
|
|
' . $bank[0]['NAME'] . '<br>
|
|||
|
|
' . $bank[0]['NUMBER'] . '
|
|||
|
|
</span>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>';
|
|||
|
|
$table = '
|
|||
|
|
<table border="0" style="width:100%">
|
|||
|
|
<tbody>
|
|||
|
|
<tr>
|
|||
|
|
<td style="vertical-align:middle; width:30%">
|
|||
|
|
' . $ww . '
|
|||
|
|
</td>
|
|||
|
|
<td style="vertical-align:middle; width:70%">
|
|||
|
|
<span style="font-size:12px">
|
|||
|
|
<strong>' . $stronk . '</strong><br>
|
|||
|
|
' . $EcmSysInfo->getName() . '<br>
|
|||
|
|
ul. ' . $ul . '<br>
|
|||
|
|
' . $adres['POSTALCODE'] . ' ' . $adres['CITY'] . '<br>
|
|||
|
|
' . $mod_strings['LBL_NIP'] . ': ' . $EcmSysInfo->getNip() . '
|
|||
|
|
</span>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</tbody>
|
|||
|
|
</table><p style="text-align: center;"><span style="font-size:22px"><strong>Wezwanie do zapłaty</strong></span></p>
|
|||
|
|
';
|
|||
|
|
$return = $db->query("SELECT id, value2 FROM operating_values WHERE name='headersDocuments' AND module_name='EcmSysInfos' AND value2='" . $key . "'");
|
|||
|
|
if($return->num_rows==0){
|
|||
|
|
$queryUpdate = "INSERT INTO operating_values SET "
|
|||
|
|
. "text0 = '" . htmlspecialchars(str_replace("'", '"', $table)) . "', "
|
|||
|
|
. "text1 = '" . htmlspecialchars(str_replace("'", '"', $footer)) . "', "
|
|||
|
|
. " name='headersDocuments', module_name='EcmSysInfos',value2='" . $key . "',value4='pl_pl',value0='" . $val . "'";
|
|||
|
|
$tmp = $db->query($queryUpdate);
|
|||
|
|
$queryUpdate = "INSERT INTO operating_values SET "
|
|||
|
|
. "text0 = '" . htmlspecialchars(str_replace("'", '"', $table)) . "', "
|
|||
|
|
. "text1 = '" . htmlspecialchars(str_replace("'", '"', $footer)) . "', "
|
|||
|
|
. " name='headersDocuments', module_name='EcmSysInfos',value2='" . $key . "',value4='en_us',value0='" . $val . "'";
|
|||
|
|
$tmp = $db->query($queryUpdate);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$mod_strings = $tmpmodstrings;
|
|||
|
|
}
|
|||
|
|
$email=$EcmSysInfo->getEmailSettings();
|
|||
|
|
$smsset=$EcmSysInfo->getNotificationSettings();
|
|||
|
|
$smarty = new Sugar_Smarty ();
|
|||
|
|
|
|||
|
|
$smarty->assign('api_login',$smsset['value1']);
|
|||
|
|
$smarty->assign('prevent_first',$smsset['value4']);
|
|||
|
|
$smarty->assign('prevent_second',$smsset['value5']);
|
|||
|
|
$smarty->assign('api_password',$smsset['value2']);
|
|||
|
|
$smarty->assign('debt_first',$smsset['value6']);
|
|||
|
|
$smarty->assign('api_from',$smsset['value3']);
|
|||
|
|
$smarty->assign('debt_other',$smsset['value7']);
|
|||
|
|
$smarty->assign('send_sms',$smsset['value8']);
|
|||
|
|
$smarty->assign('send_email',$smsset['value9']);
|
|||
|
|
|
|||
|
|
$smarty->assign('MOD', $mod_strings);
|
|||
|
|
$smarty->assign('APP', $app_strings);
|
|||
|
|
$smarty->assign('ADRESS', $EcmSysInfo->getAdress());
|
|||
|
|
$smarty->assign('BANKS', $EcmSysInfo->getBanks());
|
|||
|
|
$smarty->assign('SHORT_NAME', $EcmSysInfo->getShortName());
|
|||
|
|
$smarty->assign('CURRENCIES', $EcmSysInfo->getCurrencies());
|
|||
|
|
$smarty->assign('NAME', $EcmSysInfo->getName());
|
|||
|
|
$smarty->assign('NIP', $EcmSysInfo->getNip());
|
|||
|
|
$smarty->assign('KRS', $EcmSysInfo->getKrs());
|
|||
|
|
$smarty->assign('REGON', $EcmSysInfo->getRegon());
|
|||
|
|
$smarty->assign('WWW', $EcmSysInfo->getWWW());
|
|||
|
|
$smarty->assign('email_hostPort', $email['value1']);
|
|||
|
|
$smarty->assign('email_login', $email['value2']);
|
|||
|
|
$smarty->assign('error',$error);
|
|||
|
|
$smarty->assign('email_address_replay', $email['value6']);
|
|||
|
|
|
|||
|
|
$smarty->assign('email_password', $email['value3']);
|
|||
|
|
$smarty->assign('email_address',$email['value4']);
|
|||
|
|
$smarty->assign('autentication_type',$email['value5']);
|
|||
|
|
|
|||
|
|
$smarty->assign('CONTACTS', $EcmSysInfo->getContactInfo());
|
|||
|
|
$smarty->assign('REGISTER_ADRESS', $EcmSysInfo->getRegisterAdress());
|
|||
|
|
$smarty->assign('CORRESPONDENCE_ADRESS', $EcmSysInfo->getCorrespondenceAdress());
|
|||
|
|
$smarty->assign('INVOICE_NUMBER_FORMAT', $EcmSysInfo->getInvoiceNumberFormat());
|
|||
|
|
echo $smarty->display('modules/EcmSysInfos/tpl/firmInfo.tpl');
|