Changeset 500
- Timestamp:
- Mar 10, 2013, 10:08:23 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 11 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Forms.php
r485 r500 54 54 { 55 55 if(!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit'; 56 $Output = '<form class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock().56 $Output = '<form enctype="multipart/form-data" class="Form" action="'.$this->OnSubmit.'" method="post">'.$this->ShowEditBlock(). 57 57 '<div><input type="submit" value="'.$this->Definition['SubmitText'].'" /> '. 58 58 '<input type="button" value="Zrušit" onclick="location.href=\'?\'"/></div></form>'; -
trunk/Common/Global.php
r498 r500 39 39 include_once(dirname(__FILE__).'/../Modules/WebCam/WebCam.php'); 40 40 include_once(dirname(__FILE__).'/../Modules/User/User.php'); 41 42 $PrefixMultipliers = array 43 ( 44 'Binary' => array 45 ( 46 'BaseIndex' => 0, 47 'Definition' => array 48 ( 49 array('', '', pow(2, 0)), 50 array('Ki', 'kibi', pow(2, 10)), 51 array('Mi', 'mebi', pow(2, 20)), 52 array('Gi', 'gibi', pow(2, 30)), 53 array('Ti', 'tebi', pow(2, 40)), 54 array('Pi', 'pebi', pow(2, 50)), 55 array('Ei', 'exbi', pow(2, 60)), 56 array('Zi', 'zebi', pow(2, 70)), 57 array('Yi', 'yobi', pow(2, 80)), 58 ), 59 ), 60 'Decimal' => array 61 ( 62 'BaseIndex' => 8, 63 'Definition' => array 64 ( 65 array('y', 'yocto', pow(10, -24)), 66 array('z', 'zepto', pow(10, -21)), 67 array('a', 'atto', pow(10, -18)), 68 array('f', 'femto', pow(10, -15)), 69 array('p', 'piko', pow(10, -12)), 70 array('n', 'nano', pow(10, -9)), 71 array('u', 'mikro', pow(10, -6)), 72 array('m', 'mili', pow(10, -3)), 73 array('', '', pow(10, 0)), 74 array('k', 'kilo', pow(10, 3)), 75 array('M', 'mega', pow(10, 6)), 76 array('G', 'giga', pow(10, 9)), 77 array('T', 'tera', pow(10, 12)), 78 array('P', 'peta', pow(10, 15)), 79 array('E', 'exa', pow(10, 18)), 80 array('Z', 'zetta', pow(10, 21)), 81 array('Y', 'yotta', pow(10, 24)), 82 ), 83 ), 84 'Time' => array 85 ( 86 'BaseIndex' => 8, 87 'Definition' => array 88 ( 89 array('ys', 'yoctosekunda', pow(10, -24)), 90 array('zs', 'zeptosekunda', pow(10, -21)), 91 array('as', 'attosekunda', pow(10, -18)), 92 array('fs', 'femtosekunda', pow(10, -15)), 93 array('ps', 'pikosekunda', pow(10, -12)), 94 array('ns', 'nanosekunda', pow(10, -9)), 95 array('us', 'mikrosekunda', pow(10, -6)), 96 array('ms', 'milisekunda', pow(10, -3)), 97 array('s', 'sekunda', 1), 98 array('minut', 'minuta', 60), 99 array('hodin', 'hodina', 60 * 60) , 100 array('dnů', 'den', 24 * 60 * 60), 101 array('týdnů', 'týden', 7 * 24 * 60 * 60), 102 array('měsíců', 'měsíc', 30 * 24 * 60 * 60), 103 array('roků', 'rok', 364 * 24 * 60 * 60), 104 array('desetiletí', 'desetiletí', 10 * 364 * 24 * 60 * 60), 105 array('stalatí', 'staletí', 100 * 364 * 24 * 60 * 60), 106 array('tisíciletí', 'tisiciletí', 10000 * 364 * 24 * 60 * 60), 107 ), 108 ), 109 ); 41 include_once(dirname(__FILE__).'/../Modules/Finance/Finance.php'); 42 include_once(dirname(__FILE__).'/../Modules/FinanceBankAPI/FinanceBankAPI.php'); 110 43 111 44 class System extends Module … … 143 76 { 144 77 array_shift($PathItems); 145 return( SearchPage($PathItems, $Path[$PathItem]));146 } else return($ this->Pages[$PathItem]);78 return($this->SearchPage($PathItems, $Pages[$PathItem])); 79 } else return($Pages[$PathItem]); 147 80 } else return(''); 148 81 } … … 215 148 return(date('j.n.Y', $Time)); 216 149 } 217 218 function TruncateDigits($Value, $Digits = 4)219 {220 for($II = 2; $II > -6; $II--)221 {222 if($Value >= pow(10, $II))223 {224 if($Digits < ($II + 1)) $RealDigits = $II + 1; else $RealDigits = $Digits;225 $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1);226 break;227 }228 }229 return($Value);230 }231 232 function AddPrefixMultipliers($Value, $Unit, $Digits = 4, $PrefixType = 'Decimal')233 {234 global $PrefixMultipliers;235 236 $Negative = ($Value < 0);237 $Value = abs($Value);238 if(($Unit == '') and ($PrefixType != 'Time'))239 return($this->TruncateDigits($Value, $Digits));240 241 $I = $PrefixMultipliers[$PrefixType]['BaseIndex'];242 if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);243 244 if($Value > 1)245 {246 while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1))247 $I = $I + 1;248 } else249 if($Value < 1)250 {251 while((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1))252 $I = $I - 1;253 }254 $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2];255 256 // Truncate digits count257 $Value = $this->TruncateDigits($Value, $Digits);258 if($Negative) $Value = -$Value;259 return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit);260 }261 150 262 151 function Link($Target) … … 323 212 $System->ModuleManager->RegisterModule(new ModuleWebCam($System)); 324 213 $System->ModuleManager->RegisterModule(new ModuleUser($System)); 214 $System->ModuleManager->RegisterModule(new ModuleFinance($System)); 215 $System->ModuleManager->RegisterModule(new ModuleFinanceBankAPI($System)); 325 216 $System->ModuleManager->StartAll(); 326 217 } … … 633 524 else $PathString = ''; 634 525 if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 635 //echo('"'.$QueryString.'"');636 526 $PathItems = explode('/', $PathString); 637 527 if(strpos($_SERVER['REQUEST_URI'], '?') !== false) -
trunk/Common/Types/File/File.php
r428 r500 1 1 <?php 2 2 3 class TypeFile 3 class TypeFile extends TypeBase 4 4 { 5 var $UploadFileFolder; 6 var $FileDownloadURL; 7 var $DirectoryId; 8 9 function __construct() 10 { 11 $this->FileDownloadURL = 'File.php'; 12 $this->DirectoryId = null; 13 } 14 5 15 function OnView($Item) 6 16 { … … 11 21 { 12 22 $DbRow = $DbResult->fetch_assoc(); 13 return('<a href=" types/File/FileDownload.php?Id='.$Item['Value'].'">'.$DbRow['Name'].'</a> ('.HumanSize($DbRow['Size']).')');23 return('<a href="'.$this->FileDownloadURL.'?Id='.$Item['Value'].'">'.$DbRow['Name'].'</a> ('.HumanSize($DbRow['Size']).')'); 14 24 } else return(''); 15 25 } … … 29 39 30 40 $Result = 0; 31 //print_r($_FILES); 41 print_r($_FILES); 42 print_r($_POST); 32 43 if(array_key_exists($Item['Name'], $_FILES) and ($_FILES[$Item['Name']]['name'] != '')) 33 44 { … … 35 46 { 36 47 $FileName = substr($_FILES[$Item['Name']]['name'], strrpos($_FILES[$Item['Name']]['name'], '/')); 37 $Database->query('INSERT INTO SystemFile (`Name`, `Size`) VALUES ("'.$FileName.'", '.filesize($_FILES[$Item['Name']]['tmp_name']).')'); 48 $Database->insert('File', array('Name' => $FileName, 'Size' => filesize($_FILES[$Item['Name']]['tmp_name']), 49 'Directory' => $this->DirectoryId)); 38 50 $Result = $Database->insert_id; 39 if(!move_uploaded_file($_FILES[$Item['Name']]['tmp_name'], $Config['UploadFileFolder'].'/'.$Result)) SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!'); 51 if(!move_uploaded_file($_FILES[$Item['Name']]['tmp_name'], $this->UploadFileFolder.'/'.$Result)) 52 SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!'); 40 53 } 41 54 } -
trunk/Common/Types/Type.php
r484 r500 98 98 } 99 99 100 101 100 ?> -
trunk/Common/Version.php
r499 r500 1 1 <?php 2 2 3 $Revision = 499; // Subversion revision4 $DatabaseRevision = 499;3 $Revision = 500; // Subversion revision 4 $DatabaseRevision = 500; 5 5 $ReleaseTime = '2013-03-03'; 6 6 -
trunk/Modules/FinanceBankAPI/FileImport.php
r499 r500 1 1 <?php 2 2 3 include_once( '../Common/Global.php');3 include_once(dirname(__FILE__).'/../Common/Global.php'); 4 4 5 class FinanceImportPayment extends Page5 class PageFileImport extends Page 6 6 { 7 7 var $FullTitle = 'Import plateb'; … … 10 10 function Show() 11 11 { 12 $Output = ''; 12 13 if(!$this->System->Modules['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění'); 13 14 if(array_key_exists('Operation', $_GET)) 14 15 { 15 if($_GET['Operation'] == 'prepare') return($this->Prepare()); 16 else if($_GET['Operation'] == 'insert') return($this->Insert()); 17 else echo('Neplatná akce'); 18 } else 19 { 20 $Output = 'Vložte CSV data z SYLK exportu Poštovní spořitelny'; 21 $Output .= '<form action="?Operation=prepare" method="post">'; 22 $Output .= '<textarea name="Source" cols="80" rows="20"></textarea><br/>'; 23 $Output .= '<input type="submit" value="Analyzovat"/>'; 24 $Output .= '</form>'; 25 return($Output); 26 } 16 if($_GET['Operation'] == 'prepare') $Output .= $this->Prepare(); 17 else if($_GET['Operation'] == 'insert') $Output .= $this->Insert(); 18 else $Output .= 'Neplatná akce'; 19 } else $Output .= $this->ShowForm(); 20 return($Output); 21 } 22 23 function ShowForm() 24 { 25 $FormImport = new Form('ImportBankFile'); 26 $FormImport->OnSubmit = '?Operation=prepare'; 27 $Output = $FormImport->ShowEditForm(); 28 return($Output); 27 29 } 28 30 29 31 function Prepare() 30 32 { 33 $FormImport = new Form('ImportBankFile'); 34 $FormImport->LoadValuesFromForm(); 35 $Output = $FormImport->ShowEditForm(); 36 31 37 $Finance = $this->System->Modules['Finance']; 32 $Data = explode("\n", $_POST['Source']); 38 $Output = $FormImport->Values['File']; 39 return($Output); 40 41 $Data = $FormImport->Values['File']; 33 42 foreach($Data as $Key => $Value) 34 43 { … … 146 155 } 147 156 148 $System->AddModule(new FinanceImportPayment());149 $System->Modules['FinanceImportPayment']->GetOutput();150 151 157 ?> -
trunk/admin/Updates.php
r499 r500 37 37 "VALUES (NULL , 'Parametry účtování', '2', 'FinanceCharge', '');"); 38 38 $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ". 39 "VALUES (NULL , 'Úseky sítě', '2', 'NetworkSegment', '' ");39 "VALUES (NULL , 'Úseky sítě', '2', 'NetworkSegment', '');"); 40 40 $Manager->Execute("ALTER TABLE `ServiceCustomerRel` ADD `Action` ENUM( 'add', 'modify', 'remove' ) NULL , ". 41 41 "ADD `ReplaceId` INT NULL"); … … 121 121 } 122 122 123 function UpdateTo500($Manager) 124 { 125 $Manager->Execute("CREATE TABLE IF NOT EXISTS `FinanceBank` ( 126 `Id` int(11) NOT NULL AUTO_INCREMENT, 127 `Name` varchar(255) NOT NULL, 128 `Code` varchar(4) NOT NULL, 129 `BIC` varchar(255) NOT NULL, 130 `Country` int(11) NOT NULL, 131 PRIMARY KEY (`Id`), 132 KEY `Country` (`Country`) 133 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); 134 $Manager->Execute("ALTER TABLE `FinanceBank` 135 ADD CONSTRAINT `FinanceBank_ibfk_1` FOREIGN KEY (`Country`) REFERENCES `Country` (`Id`);"); 136 $Manager->Execute("ALTER TABLE `FinanceBankAccount` ADD `Bank` INT NOT NULL AFTER `Number` ,". 137 " ADD INDEX ( `Bank` )"); 138 $Manager->Execute("ALTER TABLE `FinanceBankAccount` ADD FOREIGN KEY ( `Bank` ) REFERENCES `FinanceBank` (". 139 "`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;"); 140 $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ". 141 "VALUES (NULL , 'Banky', '2', 'FinanceBank', '');"); 142 } 143 123 144 $Updates = array( 124 145 491 => array('Revision' => 493, 'Function' => 'UpdateTo493'), … … 128 149 497 => array('Revision' => 498, 'Function' => 'UpdateTo498'), 129 150 498 => array('Revision' => 499, 'Function' => 'UpdateTo499'), 151 499 => array('Revision' => 500, 'Function' => 'UpdateTo500'), 130 152 ); 131 153 -
trunk/aktuality/index.php
r438 r500 90 90 if($this->System->Modules['User']->CheckPermission('News', 'Insert', 'Group', $Category)) 91 91 { 92 //print_r($_FILES);93 92 // Process uploaded file 94 93 $EnclosureFileNames = array('enclosure1', 'enclosure2', 'enclosure3'); … … 122 121 { 123 122 $Row['Content'] = str_replace('<br />', '', $Row['Content']); 124 $Output .= '<strong> Editaceaktuality v kategorii '.$CategoryName.':</strong><br />';123 $Output .= '<strong>Úprava aktuality v kategorii '.$CategoryName.':</strong><br />'; 125 124 $Output .= '<form action="index.php?action=update" method="post">'. 126 125 '<input type="hidden" value="'.$_GET['id'].'" name="id">'. -
trunk/aktuality/news.php
r452 r500 56 56 $Output .= '</div></div><div class="Content">'; 57 57 $DbResult = $Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `News`.`Date`) ORDER BY `News`.`Date` DESC LIMIT 0,'.$ItemCount); 58 //echo($Database->error.'<br />');59 //echo($Database->LastQuery.'<br />');60 58 //echo('<table cellpadding="0" cellspacing="0" width="100%"><tr><td>'); 61 59 $Index = 0; … … 192 190 foreach($Setting as $Index => $Item) 193 191 $Setting[$Index]['Index'] = $Index + 1; 194 // print_r($Setting);195 192 196 193 // Store new cookie value -
trunk/finance/bills.php
r498 r500 43 43 $MainSubject = $DbResult->fetch_assoc(); 44 44 45 $DbResult = $this->Database->select('FinanceBankAccount', '*', '(`Subject`='. 46 $Config['Finance']['MainSubjectId'].') AND (`Use`=1)'); 45 $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, FinanceBank.Code AS NumberFull FROM FinanceBankAccount '. 46 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '. 47 'WHERE (FinanceBankAccount.`Subject`='.$Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)'); 47 48 $MainSubjectAccount = $DbResult->fetch_assoc(); 48 49 … … 66 67 'IČ: '.$MainSubject['IC'].'<br>'. 67 68 'DIČ: '.$MainSubject['DIC'].'<br>'. 68 'Účet: '.$MainSubjectAccount['Number '].'<br>'.69 'Účet: '.$MainSubjectAccount['NumberFull'].'<br>'. 69 70 'Plátce DPH: '.$BooleanText[$MainSubject['PayVAT']].'<br>'. 70 71 '</td><td valign="top">'. … … 134 135 $MainSubject = $DbResult->fetch_assoc(); 135 136 136 $DbResult = $this->Database->select('FinanceBankAccount', '*', '(`Subject`='. 137 $Config['Finance']['MainSubjectId'].') AND (`Use`=1)'); 137 $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, FinanceBank.Code AS NumberFull FROM FinanceBankAccount '. 138 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '. 139 'WHERE (FinanceBankAccount.`Subject`='.$Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)'); 138 140 $MainSubjectAccount = $DbResult->fetch_assoc(); 139 141 -
trunk/finance/manage.php
r498 r500 553 553 $MainSubject = $DbResult->fetch_assoc(); 554 554 555 $DbResult = $this->Database->select('FinanceBankAccount', '*', '(`Subject`='. 556 $Config['Finance']['MainSubjectId'].') AND (`Use`=1)'); 555 $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, FinanceBank.Code AS NumberFull FROM FinanceBankAccount '. 556 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '. 557 'WHERE (FinanceBankAccount.`Subject`='.$Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)'); 557 558 $MainSubjectAccount = $DbResult->fetch_assoc(); 558 559 … … 569 570 'Vaše platební období: <strong>'.$this->System->Modules['Finance']->BillingPeriods[$Member['BillingPeriod']]['Name'].'</strong><br />'."\n". 570 571 'Pravidelná platba za období: <strong>'.$MemberPayment['MonthlyTotal'].' Kč</strong><br />'."\n". 571 'Bankovní účet: <strong>'.$MainSubjectAccount['Number '].'<br/>'."\n".572 'Bankovní účet: <strong>'.$MainSubjectAccount['NumberFull'].'<br/>'."\n". 572 573 'Variabilní symbol: <strong>'.$Member['Subject'].'</strong><br/>'."\n". 573 574 'Stav vašeho účtu: <strong>'.($MemberPayment['Cash'] - $MemberPayment['MonthlyTotal']).' Kč</strong><br /><br />'."\n"; -
trunk/form_classes.php
r499 r500 16 16 */ 17 17 18 $FormClasses = array( 18 $FormClasses = array( 19 'ImportBankFile' => array( 20 'Title' => 'Import souborů s platbami', 21 'Table' => 'FinanceBank', 22 'SubmitText' => 'Načíst', 23 'Items' => array( 24 'BankAccount' => array('Type' => 'TBankAccount', 'Caption' => 'Bankovní účet', 'Default' => ''), 25 'File' => array('Type' => 'File', 'Caption' => 'Soubor', 'Default' => ''), 26 ) 27 ), 28 'FinanceBank' => array( 29 'Title' => 'Banky', 30 'Table' => 'FinanceBank', 31 'Items' => array( 32 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''), 33 'Code' => array('Type' => 'String', 'Caption' => 'Český kód', 'Default' => ''), 34 'BIC' => array('Type' => 'String', 'Caption' => 'Kód BIC', 'Default' => ''), 35 'Country' => array('Type' => 'TCountry', 'Caption' => 'Země', 'Default' => ''), 36 ), 37 ), 19 38 'FinanceBankImport' => array( 20 39 'Title' => 'Import plateb z účtu', 21 40 'Table' => 'FinanceBankImport', 22 41 'Items' => array( 23 'BankAccount' => array('Type' => 'TBankAccount', 'Caption' => 'Účet' ),42 'BankAccount' => array('Type' => 'TBankAccount', 'Caption' => 'Účet', 'Default' => ''), 24 43 'Time' => array('Type' => 'Date', 'Caption' => 'Čas', 'Default' => ''), 25 44 'Identification' => array('Type' => 'String', 'Caption' => 'Kód operace', 'Default' => ''), … … 469 488 'Comment' => array('Type' => 'String', 'Caption' => 'Komentář', 'Default' => ''), 470 489 'Number' => array('Type' => 'String', 'Caption' => 'Číslo', 'Default' => ''), 490 'Bank' => array('Type' => 'TFinanceBank', 'Caption' => 'Banka', 'Default' => ''), 471 491 'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''), 472 492 'TimeEnd' => array('Type' => 'Date', 'Caption' => 'Čas zrušení', 'Default' => ''), … … 909 929 'Table' => 'FinanceBankAccount', 910 930 'Id' => 'Id', 911 'Name' => 'C omment',931 'Name' => 'CONCAT(Comment, " (", Number, ")")', 912 932 'Filter' => '1', 913 933 ), … … 1038 1058 'Id' => 'Id', 1039 1059 'Name' => 'Name', 1060 'Filter' => '1', 1061 ), 1062 'TFinanceBank' => array( 1063 'Type' => 'Reference', 1064 'Table' => 'FinanceBank', 1065 'Id' => 'Id', 1066 'Name' => 'CONCAT(Name, " (", Code, ")")', 1040 1067 'Filter' => '1', 1041 1068 ),
Note:
See TracChangeset
for help on using the changeset viewer.