Changeset 894
- Timestamp:
- Jan 5, 2021, 10:30:31 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/FormClasses.php
r891 r894 5 5 function RegisterFormClasses(FormManager $FormManager): void 6 6 { 7 $FormManager->Classes = array(8 'UserCustomerRel' => array(9 'Title' => 'Vztahy uživatel - zákazník',10 'Table' => 'UserCustomerRel',11 'Items' => array(12 'User' => array('Type' => 'TUser', 'Caption' => 'Uživatel', 'Default' => ''),13 'Customer' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => ''),14 ),15 ),16 'FinanceInvoiceOperationRel' => array(17 'Title' => 'Zaplacení faktůr',18 'Table' => 'FinanceInvoiceOperationRel',19 'Items' => array(20 'Invoice' => array('Type' => 'TFinanceInvoice', 'Caption' => 'Faktura', 'Default' => ''),21 'Operation' => array('Type' => 'TFinanceOperation', 'Caption' => 'Platba', 'Default' => ''),22 ),23 ),24 'FinanceYearReport' => array(25 'Title' => 'Roční výkaz',26 'Table' => 'FinanceYearReport',27 'SQL' => 'SELECT Id, DateEnd, DateStart FROM FinanceYear',28 'DefaultSortColumn' => 'Id',29 'Items' => array(30 'Id' => array('Type' => 'TFinanceYear', 'Caption' => 'Rok', 'Default' => '',31 'ReadOnly' => true),32 'Income' => array('Type' => 'Integer', 'Caption' => 'Příjmy', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,33 'SQL' => '(SELECT ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '.34 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '.35 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '.36 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperationGroup`.`ValueSign` = 1))'),37 'Spending' => array('Type' => 'Integer', 'Caption' => 'Výdaje', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,38 'SQL' => '(SELECT -ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '.39 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '.40 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '.41 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperationGroup`.`ValueSign` = -1))'),42 'OperationBalance' => array('Type' => 'Integer', 'Caption' => 'Zisk', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,43 'SQL' => '(SELECT ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '.44 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '.45 'AND (`FinanceOperation`.`Time` >= `DateStart`))'),46 'TaxIncome' => array('Type' => 'Integer', 'Caption' => 'Daňové příjmy', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,47 'SQL' => '(SELECT ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '.48 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '.49 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '.50 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperation`.`Taxable` = 1) AND (`FinanceOperationGroup`.`ValueSign` = 1))'),51 'TaxSpending' => array('Type' => 'Integer', 'Caption' => 'Daňové výdaje', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,52 'SQL' => '(SELECT -ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '.53 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '.54 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '.55 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperation`.`Taxable` = 1) AND (`FinanceOperationGroup`.`ValueSign` = -1))'),56 'TaxBase' => array('Type' => 'Integer', 'Caption' => 'Základ daně', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,57 'SQL' => '(SELECT ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '.58 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '.59 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperation`.`Taxable` = 1))'),60 'Claims' => array('Type' => 'Integer', 'Caption' => 'Pohledávky', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,61 'SQL' => '(SELECT ROUND(SUM(`FinanceInvoice`.`Value`)) FROM `FinanceInvoice` '.62 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group` '.63 'WHERE (`FinanceInvoice`.`Time` <= `DateEnd`) '.64 'AND (`FinanceInvoice`.`Time` >= `DateStart`) AND (`FinanceInvoiceGroup`.`ValueSign` = 1))'),65 'Liabilities' => array('Type' => 'Integer', 'Caption' => 'Závazky', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,66 'SQL' => '(SELECT -ROUND(SUM(`FinanceInvoice`.`Value`)) FROM `FinanceInvoice` '.67 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group` '.68 'WHERE (`FinanceInvoice`.`Time` <= `DateEnd`) '.69 'AND (`FinanceInvoice`.`Time` >= `DateStart`) AND (`FinanceInvoiceGroup`.`ValueSign` = -1))'),70 'InvoiceBalance' => array('Type' => 'Integer', 'Caption' => 'Fakturační rozdíl', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true,71 'SQL' => '(SELECT ROUND(SUM(`FinanceInvoice`.`Value`)) FROM `FinanceInvoice` WHERE (`FinanceInvoice`.`Time` <= `DateEnd`) '.72 'AND (`FinanceInvoice`.`Time` >= `DateStart`))'),73 ),74 //'AfterInsert' => array($this, 'AfterInsertFinanceYear'),75 ),76 'FinanceBillingPeriod' => array(77 'Title' => 'Platební období',78 'Table' => 'FinanceBillingPeriod',79 'DefaultSortColumn' => 'Name',80 'Items' => array(81 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),82 'MonthCount' => array('Type' => 'Integer', 'Caption' => 'Počet měsíců', 'Default' => '0', 'Suffix' => 'měsíců'),83 'Customers' => array('Type' => 'TCustomerListBillingPeriod', 'Caption' => 'Zákazníci', 'Default' => ''),84 ),85 ),86 );87 7 88 8 $FormManager->FormTypes = array -
trunk/Modules/API/API.php
r893 r894 35 35 function GetModels(): array 36 36 { 37 return array( 'APIToken');37 return array(APIToken::GetClassName()); 38 38 } 39 39 } … … 43 43 static function GetDesc(): ModelDesc 44 44 { 45 $Desc = new ModelDesc( 'APIToken');46 $Desc->AddReference('User', 'User');45 $Desc = new ModelDesc(self::GetClassName()); 46 $Desc->AddReference('User', User::GetClassName()); 47 47 $Desc->AddString('Token'); 48 48 return $Desc; -
trunk/Modules/Chat/Chat.php
r887 r894 98 98 } 99 99 100 function GetModels(): array 101 { 102 return array(ChatHistory::GetClassName()); 103 } 104 100 105 function DoStart(): void 101 106 { … … 103 108 } 104 109 } 110 111 class ChatHistory extends Model 112 { 113 static function GetDesc(): ModelDesc 114 { 115 $Desc = new ModelDesc(self::GetClassName()); 116 $Desc->AddString('Nick'); 117 $Desc->AddText('Text'); 118 $Desc->AddDateTime('Time'); 119 $Desc->AddInteger('Color'); 120 $Desc->AddString('RoomName'); 121 $Desc->AddInteger('RoomType'); 122 $Desc->AddString('Host'); 123 return $Desc; 124 } 125 } -
trunk/Modules/Customer/Customer.php
r893 r894 186 186 'Filter' => '1', 187 187 )); 188 $this->System->FormManager->RegisterClass('UserCustomerRel', array( 189 'Title' => 'Vztahy uživatel - zákazník', 190 'Table' => 'UserCustomerRel', 191 'Items' => array( 192 'User' => array('Type' => 'TUser', 'Caption' => 'Uživatel', 'Default' => ''), 193 'Customer' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => ''), 194 ), 195 )); 188 196 189 197 ModuleIS::Cast($this->System->GetModule('IS'))->RegisterDashboardItem('Customer', … … 193 201 function GetModels(): array 194 202 { 195 return array('Member', 'MemberPayment', 'SupportActivity', 'ServiceCategory', 'Service', 'ServiceCustomerRel'); 196 } 197 198 function DoInstall(): void 199 { 200 foreach (self::GetModels() as $Model) 201 { 202 $this->InstallModel($Model::GetDesc()); 203 } 204 } 205 206 function Uninstall(): void 207 { 208 foreach (array_reverse(self::GetModels()) as $Model) 209 { 210 $this->UninstallModel($Model::GetDesc()); 211 } 203 return array(Member::GetClassName(), MemberPayment::GetClassName(), SupportActivity::GetClassName(), ServiceCategory::GetClassName(), 204 Service::GetClassName(), ServiceCustomerRel::GetClassName(), UserCustomerRel::GetClassName()); 212 205 } 213 206 … … 230 223 static function GetDesc(): ModelDesc 231 224 { 232 $Desc = new ModelDesc( 'Member');225 $Desc = new ModelDesc(self::GetClassName()); 233 226 $Desc->AddString('Name'); 234 $Desc->AddReference('Subject', 'Subject');235 $Desc->AddReference('ResponsibleUser', 'User');227 $Desc->AddReference('Subject', Subject::GetClassName()); 228 $Desc->AddReference('ResponsibleUser', User::GetClassName()); 236 229 $Desc->AddInteger('FamilyMemberCount'); 237 230 $Desc->AddDate('MembershipDate'); 238 231 $Desc->AddInteger('MemberState'); 239 232 $Desc->AddInteger('GPS'); 240 $Desc->AddReference('BillingPeriod', 'FinanceBillingPerios');233 $Desc->AddReference('BillingPeriod', FinanceBillingPeriod::GetClassName()); 241 234 $Desc->AddDate('BillingPeriodLastDate'); 242 235 $Desc->AddBoolean('Blocked'); … … 251 244 static function GetDesc(): ModelDesc 252 245 { 253 $Desc = new ModelDesc( 'MemberPayment');254 $Desc->AddReference('Member', 'Member');246 $Desc = new ModelDesc(self::GetClassName()); 247 $Desc->AddReference('Member', Member::GetClassName()); 255 248 $Desc->AddFloat('MonthlyTotal'); 256 249 $Desc->AddFloat('MonthlyInternet'); … … 266 259 static function GetDesc(): ModelDesc 267 260 { 268 $Desc = new ModelDesc( 'Service');261 $Desc = new ModelDesc(self::GetClassName()); 269 262 $Desc->AddString('Name'); 270 $Desc->AddReference('Category', 'ServiceCategory');263 $Desc->AddReference('Category', ServiceCategory::GetClassName()); 271 264 $Desc->AddInteger('Price'); 272 265 $Desc->AddInteger('VAT'); … … 288 281 static function GetDesc(): ModelDesc 289 282 { 290 $Desc = new ModelDesc( 'ServiceCategory');283 $Desc = new ModelDesc(self::GetClassName()); 291 284 $Desc->AddString('Name'); 292 285 return $Desc; … … 298 291 static function GetDesc(): ModelDesc 299 292 { 300 $Desc = new ModelDesc( 'SupportActivity');293 $Desc = new ModelDesc(self::GetClassName()); 301 294 $Desc->AddDateTime('Time'); 302 295 $Desc->AddString('Description'); 303 $Desc->AddReference('Customer', 'Member');304 $Desc->AddReference('User', 'User');296 $Desc->AddReference('Customer', Member::GetClassName()); 297 $Desc->AddReference('User', User::GetClassName()); 305 298 return $Desc; 306 299 } … … 311 304 static function GetDesc(): ModelDesc 312 305 { 313 $Desc = new ModelDesc( 'ServiceCustomerRel');314 $Desc->AddReference('Service', 'Service');315 $Desc->AddReference('Customer', 'Member');306 $Desc = new ModelDesc(self::GetClassName()); 307 $Desc->AddReference('Service', Service::GetClassName()); 308 $Desc->AddReference('Customer', Member::GetClassName()); 316 309 $Desc->AddChangeAction(); 317 310 $Desc->AddInteger('SpeedLimit'); … … 319 312 } 320 313 } 314 315 class UserCustomerRel extends Model 316 { 317 static function GetDesc(): ModelDesc 318 { 319 $Desc = new ModelDesc(self::GetClassName()); 320 $Desc->AddReference('User', User::GetClassName()); 321 $Desc->AddReference('Customer', Member::GetClassName()); 322 return $Desc; 323 } 324 } -
trunk/Modules/Document/Document.php
r893 r894 82 82 function GetModels(): array 83 83 { 84 return array('FinanceYear', 'DocumentLineCode', 'DocumentLine', 'DocumentLineSequence'); 84 return array(FinanceYear::GetClassName(), DocumentLineCode::GetClassName(), DocumentLine::GetClassName(), 85 DocumentLineSequence::GetClassName()); 85 86 } 86 87 } … … 90 91 static function GetDesc(): ModelDesc 91 92 { 92 $Desc = new ModelDesc( 'DocumentLine');93 $Desc = new ModelDesc(self::GetClassName()); 93 94 $Desc->AddString('Name'); 94 95 $Desc->AddString('ShortCut'); … … 102 103 static function GetDesc(): ModelDesc 103 104 { 104 $Desc = new ModelDesc( 'DocumentLineCode');105 $Desc->AddReference('DocumentLine', 'DocumentLine');105 $Desc = new ModelDesc(self::GetClassName()); 106 $Desc->AddReference('DocumentLine', DocumentLine::GetClassName()); 106 107 $Desc->AddString('Name'); 107 108 return $Desc; … … 113 114 static function GetDesc(): ModelDesc 114 115 { 115 $Desc = new ModelDesc( 'DocumentLineSequence');116 $Desc->AddReference('DocumentLine', 'DocumentLine');117 $Desc->AddReference('FinanceYear', 'FinanceYear');116 $Desc = new ModelDesc(self::GetClassName()); 117 $Desc->AddReference('DocumentLine', DocumentLine::GetClassName()); 118 $Desc->AddReference('FinanceYear', FinanceYear::GetClassName()); 118 119 $Desc->AddInteger('NextNumber'); 119 120 $Desc->AddString('YearPrefix'); … … 126 127 static function GetDesc(): ModelDesc 127 128 { 128 $Desc = new ModelDesc( 'FinanceYear');129 $Desc = new ModelDesc(self::GetClassName()); 129 130 $Desc->AddInteger('Year'); 130 131 $Desc->AddDate('DateStart'); -
trunk/Modules/EmailQueue/EmailQueue.php
r893 r894 23 23 static function GetDesc(): ModelDesc 24 24 { 25 $Desc = new ModelDesc( 'EmailQueue');25 $Desc = new ModelDesc(self::GetClassName()); 26 26 $Desc->AddDateTime('Time'); 27 27 $Desc->AddString('To'); … … 31 31 $Desc->AddBoolean('Archive'); 32 32 $Desc->AddString('From'); 33 $Desc->AddReference('AttachmentFile', 'File');33 $Desc->AddReference('AttachmentFile', File::GetClassName()); 34 34 return $Desc; 35 35 } … … 51 51 function GetModels(): array 52 52 { 53 return array( 'EmailQueue');53 return array(EmailQueue::GetClassName()); 54 54 } 55 55 -
trunk/Modules/Employee/Employee.php
r893 r894 5 5 static function GetDesc(): ModelDesc 6 6 { 7 $Desc = new ModelDesc( 'Employee');7 $Desc = new ModelDesc(self::GetClassName()); 8 8 $Desc->AddDateTime('Time'); 9 9 $Desc->AddString('To'); … … 13 13 $Desc->AddBoolean('Archive'); 14 14 $Desc->AddString('From'); 15 $Desc->AddReference('AttachmentFile', 'File');15 $Desc->AddReference('AttachmentFile', File::GetClassName()); 16 16 return $Desc; 17 17 } … … 22 22 static function GetDesc(): ModelDesc 23 23 { 24 $Desc = new ModelDesc( 'EmployeeSalary');24 $Desc = new ModelDesc(self::GetClassName()); 25 25 $Desc->AddDate('Date'); 26 $Desc->AddReference('Employee', 'Employee');26 $Desc->AddReference('Employee', Employee::GetClassName()); 27 27 $Desc->AddInteger('Amount'); 28 $Desc->AddReference('Contract', 'Contract');28 $Desc->AddReference('Contract', Contract::GetClassName()); 29 29 return $Desc; 30 30 } … … 46 46 function GetModels(): array 47 47 { 48 return array( 'Employee', 'EmployeeSalary');48 return array(Employee::GetClassName(), EmployeeSalary::GetClassName()); 49 49 } 50 50 -
trunk/Modules/File/File.php
r893 r894 18 18 $Desc->AddString('Name'); 19 19 $Desc->AddInteger('Size'); 20 $Desc->AddReference('Directory', 'FileDirectory', true);20 $Desc->AddReference('Directory', FileDirectory::GetClassName(), true); 21 21 $Desc->AddDateTime('Time'); 22 22 return $Desc; … … 120 120 $Desc = new ModelDesc('FileDirectory'); 121 121 $Desc->AddString('Name'); 122 $Desc->AddReference('Parent', 'FileDirectory', true);122 $Desc->AddReference('Parent', FileDirectory::GetClassName(), true); 123 123 return $Desc; 124 124 } … … 194 194 function GetModels(): array 195 195 { 196 return array( 'FileDirectory', 'File');196 return array(FileDirectory::GetClassName(), File::GetClassName()); 197 197 } 198 198 -
trunk/Modules/Finance/Finance.php
r893 r894 1 1 <?php 2 2 3 include_once(dirname(__FILE__).'/FinanceModels.php'); 3 4 include_once(dirname(__FILE__).'/Bill.php'); 4 5 include_once(dirname(__FILE__).'/Manage.php'); … … 6 7 include_once(dirname(__FILE__).'/Import.php'); 7 8 include_once(dirname(__FILE__).'/Trade.php'); 8 9 // TODO: Move constants to Finance module configuration10 define('TARIFF_FREE', 7);11 define('INVOICE_DUE_DAYS', 15);12 define('OPERATION_GROUP_TREASURY_IN', 1);13 define('OPERATION_GROUP_TREASURY_OUT', 2);14 define('OPERATION_GROUP_ACCOUNT_IN', 3);15 define('OPERATION_GROUP_ACCOUNT_OUT', 4);16 define('INVOICE_GROUP_IN', 1);17 define('INVOICE_GROUP_OUT', 2);18 define('VAT_TYPE_BASE', 2);19 define('FINANCE_DIRECTION_OUT', 1);20 define('FINANCE_DIRECTION_IN', 0);21 22 class Finance extends Model23 {24 public string $kWh;25 public string $Internet;26 public string $Sprava;27 public string $DatumOdecteni;28 public string $InternetUsers;29 public string $SpravaUsers;30 public string $MaxSpeed;31 public string $RealMaxSpeed;32 public string $SpeedReserve;33 public string $BaseSpeedElement;34 public string $BaseTariffPrice;35 public string $TopTariffPrice;36 public string $TotalPaid;37 public string $TotalInternetPaid;38 public string $MainSubject;39 public array $BillingPeriods;40 public string $DirectoryId;41 public string $Rounding;42 43 function LoadMonthParameters(int $Period = 1) // 0 - now, 1 - next month44 {45 $DbResult = $this->Database->query('SELECT * FROM `FinanceBillingPeriod`');46 while ($BillingPeriod = $DbResult->fetch_assoc())47 $this->BillingPeriods[$BillingPeriod['Id']] = $BillingPeriod;48 49 // Period parameter is not used as it have to be determined from item replacement50 $DbResult = $this->Database->query('SELECT * FROM `FinanceCharge` WHERE (`ChangeAction` IS NULL) LIMIT 1');51 $Row = $DbResult->fetch_array();52 $this->kWh = $Row['kWh'];53 $this->Internet = $Row['Internet'];54 $this->Sprava = $Row['AdministrationPerUser'];55 $this->RealMaxSpeed = $Row['InternetSpeed'];56 $this->SpeedReserve = $Row['InternetSpeedReserve'];57 $this->BaseSpeedElement = $Row['BaseSpeedElement'];58 $this->MaxSpeed = $this->RealMaxSpeed - $this->SpeedReserve;59 $this->TopTariffPrice = $Row['TopTariffPrice'];60 $this->BaseTariffPrice = $Row['BaseTariffPrice'];61 62 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Member`');63 $Row = $DbResult->fetch_row();64 $this->InternetUsers = $Row[0];65 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Member` WHERE (`Blocked`=0) AND (`BillingPeriod` > 1)');66 $Row = $DbResult->fetch_row();67 $this->PayingUsers = $Row[0];68 69 $this->SpravaUsers = $this->PayingUsers;70 71 $DbResult = $this->Database->query('SELECT SUM(`MemberPayment`.`MonthlyInternet`) AS `MonthlyInternet`, '.72 'SUM(`MemberPayment`.`MonthlyTotal`) AS `MonthlyTotal` '.73 'FROM `MemberPayment` JOIN `Member` ON `Member`.`Id`=`MemberPayment`.`Member` WHERE `Member`.`Blocked`=0');74 $Row = $DbResult->fetch_assoc();75 $this->TotalInternetPaid = $Row['MonthlyInternet'];76 $this->TotalPaid = $Row['MonthlyTotal'];77 $this->Rounding = $this->System->Config['Finance']['Rounding'];78 }79 80 function W2Kc($Spotreba): string81 {82 return round($Spotreba * 0.72 * $this->kWh);83 }84 85 function CreateFinanceYear(int $Year)86 {87 $StartTime = mktime(0, 0, 0, 1, 1, $Year);88 $EndTime = mktime(0, 0, 0, 12, 31, $Year);89 $this->Database->insert('FinanceYear', array('Year' => $Year,90 'DateStart' => TimeToMysqlDate($StartTime), 'DateEnd' => TimeToMysqlDate($EndTime), 'Closed' => 0));91 $YearId = $this->Database->insert_id;92 93 // Create DocumentLineSequence from previous94 $DbResult = $this->Database->select('DocumentLine', 'Id', '`Yearly` = 1');95 while ($DbRow = $DbResult->fetch_assoc())96 {97 $this->Database->insert('DocumentLineSequence', array('FinanceYear' => $YearId,98 'NextNumber' => 1, 'YearPrefix' => 1, 'DocumentLine' => $DbRow['Id']));99 }100 }101 102 function GetFinanceYear(int $Year): array103 {104 if ($Year == 0)105 {106 // Get latest year107 $DbResult = $this->Database->select('FinanceYear', '*', '1 ORDER BY `Year` DESC LIMIT 1');108 } else $DbResult = $this->Database->select('FinanceYear', '*', '`Year`='.$Year);109 if ($DbResult->num_rows == 0)110 {111 if ($Year == date('Y'))112 {113 $this->CreateFinanceYear($Year);114 $DbResult = $this->Database->select('FinanceYear', '*', '`Year`='.$Year);115 } else throw new Exception('Rok '.$Year.' nenalezen');116 }117 $FinanceYear = $DbResult->fetch_assoc();118 if ($FinanceYear['Closed'] == 1)119 throw new Exception('Rok '.$FinanceYear['Year'].' je již uzavřen. Nelze do něj přidávat položky.');120 return $FinanceYear;121 }122 123 function GetNextDocumentLineNumber(string $Id, int $FinanceYear = 0): string124 {125 $FinanceYear = $this->GetFinanceYear($FinanceYear);126 127 $DbResult = $this->Database->query('SELECT `Shortcut`, `Id` FROM `DocumentLine` WHERE `Id`='.$Id);128 $DocumentLine = $DbResult->fetch_assoc();129 130 $DbResult = $this->Database->query('SELECT * FROM `DocumentLineSequence` WHERE '.131 '`DocumentLine`='.$Id.' AND `FinanceYear`='.$FinanceYear['Id']);132 $Sequence = $DbResult->fetch_assoc();133 134 if ($Sequence['YearPrefix'] == 1)135 {136 $Result = $DocumentLine['Shortcut'].$Sequence['NextNumber'].'/'.$FinanceYear['Year'];137 } else $Result = $DocumentLine['Shortcut'].$Sequence['NextNumber'];138 139 $this->Database->query('UPDATE `DocumentLineSequence` SET `NextNumber` = `NextNumber` + 1 '.140 'WHERE (`DocumentLine`='.$Id.') AND (`FinanceYear`='.$FinanceYear['Id'].')');141 return $Result;142 }143 144 function GetNextDocumentLineNumberId(string $Id, int $FinanceYear = 0): int145 {146 $Code = $this->GetNextDocumentLineNumber($Id, $FinanceYear);147 $this->Database->insert('DocumentLineCode', array('DocumentLine' => $Id, 'Name' => $Code));148 return $this->Database->insert_id;149 }150 151 function GetFinanceGroupById(string $Id, string $Table): ?array152 {153 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `Id`= '.$Id);154 if ($DbResult->num_rows == 1) {155 $Group = $DbResult->fetch_assoc();156 return $Group;157 }158 echo('Finance group id '.$Id.' not found in table '.$Table);159 return null;160 }161 162 function RecalculateMemberPayment(): string163 {164 $Output = 'Aktualizuji finance členů...<br />';165 $this->Database->query('TRUNCATE TABLE `MemberPayment`');166 $DbResult = $this->Database->query('SELECT * FROM `Member`');167 while ($Member = $DbResult->fetch_assoc())168 {169 $DbResult2 = $this->Database->query('SELECT ((SELECT COALESCE(SUM(`Value`), 0) FROM `FinanceOperation` '.170 'WHERE `Subject`='.$Member['Subject'].') - (SELECT COALESCE(SUM(`Value`), 0) FROM `FinanceInvoice` '.171 'WHERE `Subject`='.$Member['Subject'].')) AS `Cash`');172 $Cash = $DbResult2->fetch_row();173 $Cash = $Cash[0];174 175 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`Consumption`) * `StockSerialNumber`.`Amount` '.176 'FROM `StockSerialNumber` JOIN `Product` ON `Product`.`Id` = `StockSerialNumber`.`Product` '.177 'WHERE (`StockSerialNumber`.`Location` = '.$Member['Id'].') AND (`StockSerialNumber`.`TimeElimination` IS NULL)');178 $ConsumptionPlus = $DbResult2->fetch_row();179 $ConsumptionPlus = $ConsumptionPlus[0];180 181 $DbResult2 = $this->Database->query('SELECT SUM(`Service`.`Price`) AS `Price` '.182 'FROM `ServiceCustomerRel` LEFT JOIN '.183 '`Service` ON `Service`.`Id` = `ServiceCustomerRel`.`Service` WHERE (`ServiceCustomerRel`.`Customer`='.184 $Member['Id'].') AND (`ServiceCustomerRel`.`ChangeAction` IS NULL)');185 $DbRow = $DbResult2->fetch_assoc();186 $Monthly = 0;187 if ($DbRow['Price'] != '') $MonthlyInet = $DbRow['Price'];188 else $MonthlyInet = 0;189 190 $Monthly += $MonthlyInet;191 //$Monthly -= $this->W2Kc($ConsumptionPlus);192 $Monthly = round($Monthly);193 194 if ($Member['BillingPeriod'] == 1)195 {196 // Inactive payer197 $MonthlyInet = 0;198 $Monthly = 0;199 $ConsumptionPlus = 0;200 $Consumption = 0;201 }202 $Consumption = 0;203 $this->Database->insert('MemberPayment', array('Member' => $Member['Id'],204 'MonthlyInternet' => $MonthlyInet,205 'MonthlyTotal' => $Monthly, 'MonthlyConsumption' => $this->W2Kc($Consumption),206 'Cash' => $Cash, 'MonthlyPlus' => $this->W2Kc($ConsumptionPlus)));207 }208 ModuleLog::Cast($this->System->GetModule('Log'))->NewRecord('Finance', 'RecalculateMemberPayment');209 return $Output;210 }211 212 function GetVATByType(string $TypeId): string213 {214 $Time = time();215 $DbResult = $this->Database->select('FinanceVAT', 'Value', '(Type='.$TypeId.216 ') AND (ValidFrom <= "'.TimeToMysqlDate($Time).'") AND ((ValidTo >= "'.217 TimeToMysqlDate($Time).'") OR (ValidTo IS NULL)) LIMIT 1');218 $Row = $DbResult->fetch_array();219 return $Row[0];220 }221 }222 223 class FinanceGroup extends Model224 {225 static function GetDesc(): ModelDesc226 {227 $Desc = new ModelDesc('FinanceGroup');228 $Desc->AddString('Description');229 return $Desc;230 }231 }232 233 class FinanceOperation extends Model234 {235 static function GetDesc(): ModelDesc236 {237 $Desc = new ModelDesc('FinanceOperation');238 $Desc->AddReference('Group', 'FinanceGroup');239 $Desc->AddDateTime('Time');240 $Desc->AddReference('Subject', 'Subject');241 $Desc->AddBoolean('Cash');242 $Desc->AddFloat('Value');243 $Desc->AddFloat('ValueUser');244 $Desc->AddReference('BillCode', 'DocumentLineCode');245 $Desc->AddBoolean('Taxable');246 $Desc->AddReference('File', 'File');247 $Desc->AddString('Text');248 $Desc->AddBoolean('Network');249 $Desc->AddReference('BankAccount', 'FinanceBankAccount');250 $Desc->AddReference('Treasury', 'FinanceTreasury');251 $Desc->AddBoolean('Generate');252 return $Desc;253 }254 }255 256 class FinanceOperationGroup extends Model257 {258 static function GetDesc(): ModelDesc259 {260 $Desc = new ModelDesc('FinanceOperationGroup');261 $Desc->AddString('Name');262 $Desc->AddReference('DocumentLine', 'DocumentLine');263 $Desc->AddInteger('ValueSign');264 $Desc->AddInteger('Direction');265 return $Desc;266 }267 }268 269 class FinanceInvoice extends Model270 {271 static function GetDesc(): ModelDesc272 {273 $Desc = new ModelDesc('FinanceInvoice');274 $Desc->AddReference('Group', 'FinanceGroup');275 $Desc->AddReference('BillCode', 'DocumentLineCode');276 $Desc->AddReference('Subject', 'Subject');277 $Desc->AddDateTime('Time');278 $Desc->AddDateTime('TimeDue');279 $Desc->AddDateTime('TimePayment');280 $Desc->AddFloat('Value');281 $Desc->AddReference('File', 'File');282 $Desc->AddDate('PeriodFrom');283 $Desc->AddDate('PeriodTo');284 $Desc->AddBoolean('Cash');285 $Desc->AddBoolean('Generate');286 $Desc->AddBoolean('VisibleToUser');287 return $Desc;288 }289 }290 291 class FinanceInvoiceGroup extends Model292 {293 static function GetDesc(): ModelDesc294 {295 $Desc = new ModelDesc('FinanceInvoiceGroup');296 $Desc->AddString('Name');297 $Desc->AddReference('DocumentLine', 'DocumentLine');298 $Desc->AddInteger('ValueSign');299 $Desc->AddInteger('Direction');300 return $Desc;301 }302 }303 304 class Company extends Model305 {306 static function GetDesc(): ModelDesc307 {308 $Desc = new ModelDesc('Company');309 $Desc->AddString('Name');310 $Desc->AddReference('Subject', 'Subject');311 return $Desc;312 }313 }314 315 class FinanceInvoiceItem extends Model316 {317 static function GetDesc(): ModelDesc318 {319 $Desc = new ModelDesc('FinanceInvoiceItem');320 $Desc->AddReference('FinanceInvoice', 'FinanceInvoice');321 $Desc->AddString('Description');322 $Desc->AddFloat('Price');323 $Desc->AddFloat('Quantity');324 $Desc->AddInteger('VAT');325 return $Desc;326 }327 }328 329 class FinanceTreasury extends Model330 {331 static function GetDesc(): ModelDesc332 {333 $Desc = new ModelDesc('FinanceTreasury');334 $Desc->AddString('Name');335 $Desc->AddDate('TimeCreate');336 return $Desc;337 }338 }339 340 class FinanceTreasuryCheck extends Model341 {342 static function GetDesc(): ModelDesc343 {344 $Desc = new ModelDesc('FinanceTreasuryCheck');345 $Desc->AddReference('Treasury', 'FinanceTreasury', false);346 $Desc->AddDateTime('Time');347 $Desc->AddInteger('Value1');348 $Desc->AddInteger('Value2');349 $Desc->AddInteger('Value5');350 $Desc->AddInteger('Value10');351 $Desc->AddInteger('Value20');352 $Desc->AddInteger('Value50');353 $Desc->AddInteger('Value100');354 $Desc->AddInteger('Value200');355 $Desc->AddInteger('Value500');356 $Desc->AddInteger('Value1000');357 $Desc->AddInteger('Value2000');358 $Desc->AddInteger('Value5000');359 return $Desc;360 }361 }362 363 class FinanceBankAccount extends Model364 {365 static function GetDesc(): ModelDesc366 {367 $Desc = new ModelDesc('FinanceBankAccount');368 $Desc->AddReference('Subject', 'Subject');369 $Desc->AddString('Comment');370 $Desc->AddString('Number');371 $Desc->AddReference('Bank', 'FinanceBank');372 $Desc->AddDate('TimeCreate');373 $Desc->AddDate('TimeEnd');374 $Desc->AddReference('Currency', 'Currency');375 $Desc->AddString('LoginName');376 $Desc->AddString('LoginPassword');377 $Desc->AddBoolean('Use');378 $Desc->AddDate('LastImportDate');379 $Desc->AddString('LastImportId');380 $Desc->AddBoolean('AutoImport');381 return $Desc;382 }383 }384 385 class FinanceBank extends Model386 {387 static function GetDesc(): ModelDesc388 {389 $Desc = new ModelDesc('FinanceBank');390 $Desc->AddString('Name');391 $Desc->AddString('Code');392 $Desc->AddString('BIC');393 $Desc->AddReference('Country', 'Country');394 return $Desc;395 }396 }397 398 class Currency extends Model399 {400 static function GetDesc(): ModelDesc401 {402 $Desc = new ModelDesc('Currency');403 $Desc->AddString('Code');404 $Desc->AddString('Name');405 $Desc->AddString('Symbol');406 return $Desc;407 }408 }409 410 class FinanceCharge extends Model411 {412 static function GetDesc(): ModelDesc413 {414 $Desc = new ModelDesc('FinanceCharge');415 $Desc->AddInteger('Internet');416 $Desc->AddInteger('InternetSpeed');417 $Desc->AddInteger('InternetSpeedReserve');418 $Desc->AddInteger('AdministrationPerUser');419 $Desc->AddInteger('kWh');420 $Desc->AddInteger('BaseSpeedElement');421 $Desc->AddInteger('BaseTariffPrice');422 $Desc->AddInteger('TopTariffPrice');423 $Desc->AddChangeAction();424 return $Desc;425 }426 }427 428 class FinanceVat extends Model429 {430 static function GetDesc(): ModelDesc431 {432 $Desc = new ModelDesc('FinanceVAT');433 $Desc->AddReference('Type', 'FinanceVatType');434 $Desc->AddDate('ValidFrom');435 $Desc->AddDate('ValidTo');436 $Desc->AddInteger('Value');437 return $Desc;438 }439 }440 441 class FinanceVatType extends Model442 {443 static function GetDesc(): ModelDesc444 {445 $Desc = new ModelDesc('FinanceVATType');446 $Desc->AddString('Name');447 return $Desc;448 }449 }450 451 class Contract extends Model452 {453 static function GetDesc(): ModelDesc454 {455 $Desc = new ModelDesc('Contract');456 $Desc->AddReference('DocumentLine', 'DocumentLine');457 $Desc->AddReference('BillCode', 'DocumentLineCode');458 $Desc->AddReference('Subject', 'Subject');459 $Desc->AddDate('ValidFrom');460 $Desc->AddDate('ValidTo');461 $Desc->AddReference('File', 'File');462 return $Desc;463 }464 }465 9 466 10 class ModuleFinance extends AppModule … … 485 29 function GetModels(): array 486 30 { 487 return array( 488 'FinanceVatType', 489 'FinanceVat', 490 'FinanceGroup', 491 'FinanceOperationGroup', 492 'FinanceOperation', 493 'FinanceInvoiceGroup', 494 'FinanceInvoice', 495 'FinanceInvoiceItem', 496 'Company', 497 'FinanceTreasury', 498 'FinanceTreasuryCheck', 499 'Currency', 500 'FinanceBank', 501 'FinanceBankAccount', 502 'FinanceCharge', 503 'Contract' 504 ); 31 return array(FinanceBillingPeriod::GetClassName(), FinanceVatType::GetClassName(), FinanceVat::GetClassName(), 32 FinanceGroup::GetClassName(), FinanceOperationGroup::GetClassName(), FinanceOperation::GetClassName(), 33 FinanceInvoiceGroup::GetClassName(), FinanceInvoice::GetClassName(), FinanceInvoiceItem::GetClassName(), 34 Company::GetClassName(), FinanceTreasury::GetClassName(), FinanceTreasuryCheck::GetClassName(), 35 Currency::GetClassName(), FinanceBank::GetClassName(), FinanceBankAccount::GetClassName(), FinanceCharge::GetClassName(), 36 Contract::GetClassName(), FinanceInvoiceOperationRel::GetClassName()); 505 37 } 506 38 … … 937 469 'Filter' => '1', 938 470 )); 471 $this->System->FormManager->RegisterClass('FinanceYearReport', array( 472 'Title' => 'Roční výkaz', 473 'Table' => 'FinanceYearReport', 474 'SQL' => 'SELECT Id, DateEnd, DateStart FROM FinanceYear', 475 'DefaultSortColumn' => 'Id', 476 'Items' => array( 477 'Id' => array('Type' => 'TFinanceYear', 'Caption' => 'Rok', 'Default' => '', 478 'ReadOnly' => true), 479 'Income' => array('Type' => 'Integer', 'Caption' => 'Příjmy', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 480 'SQL' => '(SELECT ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '. 481 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '. 482 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '. 483 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperationGroup`.`ValueSign` = 1))'), 484 'Spending' => array('Type' => 'Integer', 'Caption' => 'Výdaje', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 485 'SQL' => '(SELECT -ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '. 486 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '. 487 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '. 488 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperationGroup`.`ValueSign` = -1))'), 489 'OperationBalance' => array('Type' => 'Integer', 'Caption' => 'Zisk', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 490 'SQL' => '(SELECT ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '. 491 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '. 492 'AND (`FinanceOperation`.`Time` >= `DateStart`))'), 493 'TaxIncome' => array('Type' => 'Integer', 'Caption' => 'Daňové příjmy', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 494 'SQL' => '(SELECT ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '. 495 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '. 496 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '. 497 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperation`.`Taxable` = 1) AND (`FinanceOperationGroup`.`ValueSign` = 1))'), 498 'TaxSpending' => array('Type' => 'Integer', 'Caption' => 'Daňové výdaje', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 499 'SQL' => '(SELECT -ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '. 500 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '. 501 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '. 502 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperation`.`Taxable` = 1) AND (`FinanceOperationGroup`.`ValueSign` = -1))'), 503 'TaxBase' => array('Type' => 'Integer', 'Caption' => 'Základ daně', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 504 'SQL' => '(SELECT ROUND(SUM(`FinanceOperation`.`Value`)) FROM `FinanceOperation` '. 505 'WHERE (`FinanceOperation`.`Time` <= `DateEnd`) '. 506 'AND (`FinanceOperation`.`Time` >= `DateStart`) AND (`FinanceOperation`.`Taxable` = 1))'), 507 'Claims' => array('Type' => 'Integer', 'Caption' => 'Pohledávky', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 508 'SQL' => '(SELECT ROUND(SUM(`FinanceInvoice`.`Value`)) FROM `FinanceInvoice` '. 509 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group` '. 510 'WHERE (`FinanceInvoice`.`Time` <= `DateEnd`) '. 511 'AND (`FinanceInvoice`.`Time` >= `DateStart`) AND (`FinanceInvoiceGroup`.`ValueSign` = 1))'), 512 'Liabilities' => array('Type' => 'Integer', 'Caption' => 'Závazky', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 513 'SQL' => '(SELECT -ROUND(SUM(`FinanceInvoice`.`Value`)) FROM `FinanceInvoice` '. 514 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group` '. 515 'WHERE (`FinanceInvoice`.`Time` <= `DateEnd`) '. 516 'AND (`FinanceInvoice`.`Time` >= `DateStart`) AND (`FinanceInvoiceGroup`.`ValueSign` = -1))'), 517 'InvoiceBalance' => array('Type' => 'Integer', 'Caption' => 'Fakturační rozdíl', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 518 'SQL' => '(SELECT ROUND(SUM(`FinanceInvoice`.`Value`)) FROM `FinanceInvoice` WHERE (`FinanceInvoice`.`Time` <= `DateEnd`) '. 519 'AND (`FinanceInvoice`.`Time` >= `DateStart`))'), 520 ), 521 //'AfterInsert' => array($this, 'AfterInsertFinanceYear'), 522 )); 523 $this->System->FormManager->RegisterClass('FinanceInvoiceOperationRel', array( 524 'Title' => 'Zaplacení faktůr', 525 'Table' => 'FinanceInvoiceOperationRel', 526 'Items' => array( 527 'Invoice' => array('Type' => 'TFinanceInvoice', 'Caption' => 'Faktura', 'Default' => ''), 528 'Operation' => array('Type' => 'TFinanceOperation', 'Caption' => 'Platba', 'Default' => ''), 529 ), 530 )); 939 531 940 532 $this->Finance->MainSubject = $Config['Finance']['MainSubjectId']; -
trunk/Modules/FinanceBankAPI/FinanceBankAPI.php
r893 r894 10 10 static function GetDesc(): ModelDesc 11 11 { 12 $Desc = new ModelDesc( 'FinanceBankImport');13 $Desc->AddReference('BankAccount', 'BankAccount');12 $Desc = new ModelDesc(self::GetClassName()); 13 $Desc->AddReference('BankAccount', FinanceBankAccount::GetClassName()); 14 14 $Desc->AddDate('Time'); 15 15 $Desc->AddString('Identification'); … … 20 20 $Desc->AddString('SpecificSymbol'); 21 21 $Desc->AddFloat('Value'); 22 $Desc->AddReference('Currency', 'Currency');22 $Desc->AddReference('Currency', Currency::GetClassName()); 23 23 $Desc->AddString('OffsetAccountName'); 24 $Desc->AddReference('FinanceOperation', 'FinanceOperation');24 $Desc->AddReference('FinanceOperation', FinanceOperation::GetClassName()); 25 25 return $Desc; 26 26 } … … 42 42 function GetModels(): array 43 43 { 44 return array( 'FinanceBankImport');44 return array(FinanceBankImport::GetClassName()); 45 45 } 46 46 -
trunk/Modules/IS/IS.php
r893 r894 847 847 static function GetDesc(): ModelDesc 848 848 { 849 $Desc = new ModelDesc( 'Menu');849 $Desc = new ModelDesc(self::GetClassName()); 850 850 $Desc->AddString('Name'); 851 851 return $Desc; … … 857 857 static function GetDesc(): ModelDesc 858 858 { 859 $Desc = new ModelDesc( 'MenuItem');859 $Desc = new ModelDesc(self::GetClassName()); 860 860 $Desc->AddString('Name'); 861 $Desc->AddReference('Parent', 'MenuItem');862 $Desc->AddReference('Action', 'Action');863 $Desc->AddReference('Menu', 'Menu');861 $Desc->AddReference('Parent', MenuItem::GetClassName()); 862 $Desc->AddReference('Action', Action::GetClassName()); 863 $Desc->AddReference('Menu', Menu::GetClassName()); 864 864 return $Desc; 865 865 } … … 870 870 static function GetDesc(): ModelDesc 871 871 { 872 $Desc = new ModelDesc( 'MenuItemFavorite');873 $Desc->AddReference('User', 'User');874 $Desc->AddReference('MenuItem', 'MenuItem');872 $Desc = new ModelDesc(self::GetClassName()); 873 $Desc->AddReference('User', User::GetClassName()); 874 $Desc->AddReference('MenuItem', MenuItem::GetClassName()); 875 875 return $Desc; 876 876 } … … 897 897 function GetModels(): array 898 898 { 899 return array( 'Menu', 'MenuItem', 'MenuItemFavorite');899 return array(Menu::GetClassName(), MenuItem::GetClassName(), MenuItemFavorite::GetClassName()); 900 900 } 901 901 -
trunk/Modules/Log/Log.php
r888 r894 14 14 } 15 15 16 function DoInstall(): void16 function GetModels(): array 17 17 { 18 } 19 20 function DoUnInstall(): void 21 { 18 return array('Log'); 22 19 } 23 20 … … 41 38 'Channel' => 'log', 'Callback' => array($this, 'ShowRSS'), 42 39 'Permission' => array('Module' => 'Log', 'Operation' => 'RSS'))); 43 }44 45 function DoStop(): void46 {47 40 } 48 41 … … 107 100 } 108 101 } 102 103 class Log extends Model 104 { 105 static function GetDesc(): ModelDesc 106 { 107 $Desc = new ModelDesc(self::GetClassName()); 108 $Desc->AddDateTime('Time'); 109 $Desc->AddReference('User', User::GetClassName()); 110 $Desc->AddString('Module'); 111 $Desc->AddString('Operation'); 112 $Desc->AddText('Value'); 113 $Desc->AddString('IPAddress'); 114 return $Desc; 115 } 116 } -
trunk/Modules/Map/Map.php
r891 r894 314 314 } 315 315 316 function DoInstall(): void 317 { 318 $this->InstallModel(MapPosition::GetDesc()); 319 } 320 321 function DoUninstall(): void 322 { 323 $this->UninstallModel(MapPosition::GetDesc()); 316 function GetModels(): array 317 { 318 return array(MapPosition::GetClassName()); 324 319 } 325 320 } … … 329 324 static function GetDesc(): ModelDesc 330 325 { 331 $Desc = new ModelDesc( 'MapPosition');326 $Desc = new ModelDesc(self::GetClassName()); 332 327 $Desc->AddString('Name'); 333 328 $Desc->AddString('Pos'); -
trunk/Modules/Meals/Meals.php
r888 r894 196 196 } 197 197 198 function DoInstall(): void 199 { 200 } 201 202 function DoUnInstall(): void 203 { 198 function GetModels(): array 199 { 200 return array(Meals::GetClassName(), MealsInfo::GetClassName()); 204 201 } 205 202 … … 209 206 } 210 207 } 208 209 class Meals extends Model 210 { 211 static function GetDesc(): ModelDesc 212 { 213 $Desc = new ModelDesc(self::GetClassName()); 214 $Desc->AddDate('Date'); 215 $Desc->AddString('Soup'); 216 $Desc->AddString('Meal'); 217 $Desc->AddInteger('Status'); 218 return $Desc; 219 } 220 } 221 222 class MealsInfo extends Model 223 { 224 static function GetDesc(): ModelDesc 225 { 226 $Desc = new ModelDesc(self::GetClassName()); 227 $Desc->AddText('Info'); 228 $Desc->AddInteger('Price'); 229 return $Desc; 230 } 231 } -
trunk/Modules/Meteostation/Meteostation.php
r888 r894 103 103 } 104 104 105 106 function DoInstall(): void107 {108 }109 110 function DoUninstall(): void111 {112 }113 114 105 function DoStart(): void 115 106 { 116 107 $this->System->RegisterPage(['meteo'], 'PageMeteo'); 117 108 } 118 119 function DoStop(): void120 {121 }122 109 } -
trunk/Modules/Network/Network.php
r887 r894 1 1 <?php 2 2 3 include_once(dirname(__FILE__).'/NetworkModels.php'); 3 4 include_once(dirname(__FILE__).'/HostList.php'); 4 5 include_once(dirname(__FILE__).'/Subnet.php'); … … 117 118 } 118 119 119 function DoInstall(): void 120 { 121 } 122 123 function DoUninstall(): void 124 { 120 function GetModels(): array 121 { 122 return array(NetworkDomainAlias::GetClassName(), NetworkDevice::GetClassName(), NetworkDeviceType::GetClassName(), 123 NetworkDeviceLog::GetClassName(), NetworkInterface::GetClassName(), NetworkInterfaceType::GetClassName(), 124 NetworkSubnet::GetClassName(), NetworkPort::GetClassName(), NetworkSpeedLimit::GetClassName(), 125 NetworkInterfaceLatency::GetClassName(), NetworkLink::GetClassName(), NetworkLinkType::GetClassName(), 126 NetworkSignal::GetClassName(), NetworkAddressCategory::GetClassName(), NetworkDeviceConfig::GetClassName(), 127 NetworkDomain::GetClassName(), NetworkDomainServer::GetClassName(), NetworkDomainView::GetClassName(), 128 NetworkDomainItemFilter::GetClassName(), DeviceAPIType::GetClassName(), NetworkInterfaceWireless::GetClassName(), 129 NetworkInterfaceUpDown::GetClassName(), NetworkPortUpDown::GetClassName()); 125 130 } 126 131 … … 794 799 global $Config; 795 800 801 $StartTime = time(); 802 796 803 $DbResult = $this->System->Database->select('NetworkDeviceLog', 'Time', 797 804 '1 ORDER BY Time DESC LIMIT 1'); … … 838 845 $Output .= 'Síťových podsítí: '.$DbRow['0'].'<br/>'; 839 846 return $Output; 840 }841 842 function DoStop(): void843 {844 847 } 845 848 -
trunk/Modules/NetworkConfig/NetworkConfig.php
r888 r894 17 17 } 18 18 19 function DoInstall(): void19 function GetModels(): array 20 20 { 21 } 22 23 function DoUnInstall(): void 24 { 21 return array(NetworkConfigurationLog::GetClassName(), NetworkConfiguration::GetClassName()); 25 22 } 26 23 … … 109 106 } 110 107 } 108 109 class NetworkConfiguration extends Model 110 { 111 static function GetDesc(): ModelDesc 112 { 113 $Desc = new ModelDesc(self::GetClassName()); 114 $Desc->AddString('Caption'); 115 $Desc->AddString('SysName'); 116 $Desc->AddBoolean('Changed'); 117 $Desc->AddDateTime('LastTime'); 118 $Desc->AddInteger('ExecutionTime'); 119 $Desc->AddBoolean('Enabled'); 120 $Desc->AddInteger('Period'); 121 return $Desc; 122 } 123 } 124 125 class NetworkConfigurationLog extends Model 126 { 127 static function GetDesc(): ModelDesc 128 { 129 $Desc = new ModelDesc(self::GetClassName()); 130 $Desc->AddString('Caption'); 131 $Desc->AddText('Log'); 132 return $Desc; 133 } 134 } -
trunk/Modules/NetworkConfigAirOS/NetworkConfigAirOS.php
r887 r894 16 16 } 17 17 18 function DoInstall(): void19 {20 }21 22 function DoUnInstall(): void23 {24 }25 26 18 function DoStart(): void 27 19 { -
trunk/Modules/NetworkConfigLinux/NetworkConfigLinux.php
r887 r894 18 18 } 19 19 20 function DoInstall(): void21 {22 }23 24 function DoUnInstall(): void25 {26 }27 28 20 function DoStart(): void 29 21 { -
trunk/Modules/NetworkConfigRouterOS/NetworkConfigRouterOS.php
r887 r894 27 27 $this->Description = 'Mikrotik RouterOS configuration'; 28 28 $this->Dependencies = array('NetworkConfig'); 29 }30 31 function DoInstall(): void32 {33 }34 35 function DoUnInstall(): void36 {37 29 } 38 30 -
trunk/Modules/NetworkShare/NetworkShare.php
r887 r894 18 18 } 19 19 20 function DoInstall(): void20 function GetModels(): array 21 21 { 22 } 23 24 function DoUnInstall(): void 25 { 22 return array(NetworkShareItem::GetClassName(), NetworkShareError::GetClassName()); 26 23 } 27 24 … … 31 28 } 32 29 } 30 31 class NetworkShareItem extends Model 32 { 33 static function GetDesc(): ModelDesc 34 { 35 $Desc = new ModelDesc('NetworkShareItem'); 36 $Desc->AddString('Name'); 37 $Desc->AddReference('Parent', NetworkShareItem::GetClassName()); 38 $Desc->AddReference('Host', NetworkDevice::GetClassName()); 39 $Desc->AddBigInt('Size'); 40 $Desc->AddString('Ext'); 41 $Desc->AddDate('Date'); 42 $Desc->AddInteger('Type'); 43 return $Desc; 44 } 45 } 46 47 class NetworkShareError extends Model 48 { 49 static function GetDesc(): ModelDesc 50 { 51 $Desc = new ModelDesc(self::GetClassName()); 52 $Desc->AddString('Host'); 53 $Desc->AddString('Message'); 54 return $Desc; 55 } 56 } -
trunk/Modules/NetworkShare/update.php
r873 r894 8 8 $Hosts = array(); 9 9 $StartTime = GetMicrotime(); 10 $DbResult = $Database->query("SELECT * FROM NetworkDevice WHERE Online=1 AND (Block=0 OR Name='centrala') AND (Name!='GATE') AND User>0");10 $DbResult = $Database->query("SELECT * FROM `NetworkDevice` WHERE `Online`=1 AND (`Block`=0 OR `Name`='centrala') AND (`Name` != 'GATE') AND (`User` > 0)"); 11 11 while ($Row = $DbResult->fetch_array()) 12 12 { … … 16 16 $HostID = 100; 17 17 $StartTime2 = GetMicrotime(); 18 if ($Dnes != $Row[' last_share_check'])18 if ($Dnes != $Row['LastShareCheck']) 19 19 { 20 20 echo("Kontroluji ".$Row['Name']."...\n"); … … 23 23 else echo("Vynechavam ".$Row['Name']."...\n"); 24 24 // Aktualizuj datum prochazeni 25 $Database->update(' Hosts', "name='".$Row['name']."'",array('last_share_check' => $Dnes));25 $Database->update('NetworkDevice', "Id='".$Row['Id']."'", array('LastShareCheck' => $Dnes)); 26 26 } 27 $Rozdil = GetMicrotime() -$StartTime+10;27 $Rozdil = GetMicrotime() - $StartTime + 10; 28 28 29 29 // Oprav a zoptimalizuj tabulku -
trunk/Modules/NetworkTopology/NetworkTopology.php
r888 r894 148 148 } 149 149 150 function DoInstall(): void150 function GetModels(): array 151 151 { 152 } 153 154 function DoUnInstall(): void 155 { 152 return array(NetworkTopology::GetClassName()); 156 153 } 157 154 … … 161 158 } 162 159 } 160 161 class NetworkTopology extends Model 162 { 163 static function GetDesc(): ModelDesc 164 { 165 $Desc = new ModelDesc(self::GetClassName()); 166 $Desc->AddInteger('Host'); 167 $Desc->AddInteger('Depth'); 168 $Desc->AddInteger('Pos'); 169 $Desc->AddInteger('First'); 170 $Desc->AddInteger('Last'); 171 return $Desc; 172 } 173 } -
trunk/Modules/News/News.php
r893 r894 30 30 function GetModels(): array 31 31 { 32 return array('NewsCategory', 'News'); 33 } 34 35 function DoInstall(): void 36 { 37 foreach (self::GetModels() as $Model) 38 { 39 $this->InstallModel($Model::GetDesc()); 40 } 41 } 42 43 function DoUnInstall(): void 44 { 45 foreach (array_reverse(self::GetModels()) as $Model) 46 { 47 $this->UninstallModel($Model::GetDesc()); 48 } 32 return array(NewsCategory::GetClassName(), News::GetClassName()); 49 33 } 50 34 … … 302 286 static function GetDesc(): ModelDesc 303 287 { 304 $Desc = new ModelDesc( 'News');305 $Desc->AddReference('Category', 'NewsCategory', true);288 $Desc = new ModelDesc(self::GetClassName()); 289 $Desc->AddReference('Category', NewsCategory::GetClassName(), true); 306 290 $Desc->AddString('Title'); 307 291 $Desc->AddText('Content'); … … 309 293 $Desc->AddString('Author'); 310 294 $Desc->AddString('Enclosure'); 311 $Desc->AddReference('User', 'User');295 $Desc->AddReference('User', User::GetClassName()); 312 296 $Desc->AddString('IP'); 313 297 $Desc->AddString('Link'); … … 320 304 static function GetDesc(): ModelDesc 321 305 { 322 $Desc = new ModelDesc( 'NewsCategory');306 $Desc = new ModelDesc(self::GetClassName()); 323 307 $Desc->AddString('Caption'); 324 308 $Desc->AddString('RSS'); -
trunk/Modules/Notify/Notify.php
r893 r894 130 130 function GetModels(): array 131 131 { 132 return array( 'NotifyCategory', 'NotifyUser');132 return array(NotifyCategory::GetClassName(), NotifyUser::GetClassName()); 133 133 } 134 134 … … 190 190 static function GetDesc(): ModelDesc 191 191 { 192 $Desc = new ModelDesc( 'NotifyCategory');192 $Desc = new ModelDesc(self::GetClassName()); 193 193 $Desc->AddString('Name'); 194 194 $Desc->AddString('SysName'); … … 201 201 static function GetDesc(): ModelDesc 202 202 { 203 $Desc = new ModelDesc( 'NotifyUser');204 $Desc->AddReference('User', 'User');205 $Desc->AddReference('Contact', 'Contact');203 $Desc = new ModelDesc(self::GetClassName()); 204 $Desc->AddReference('User', User::GetClassName()); 205 $Desc->AddReference('Contact', Contact::GetClassName()); 206 206 $Desc->AddInteger('Period'); 207 207 return $Desc; -
trunk/Modules/OpeningHours/OpeningHours.php
r887 r894 228 228 } 229 229 230 function GetModels(): array 231 { 232 return array(SubjectOpenTime::GetClassName(), SubjectOpenTimeDay::GetClassName()); 233 } 234 230 235 function DoStart(): void 231 236 { … … 237 242 $this->System->UnregisterPage(['otviraci-doby']); 238 243 } 239 240 function DoInstall(): void 241 { 242 } 243 244 function DoUnInstall(): void 245 { 246 } 247 } 244 } 245 246 class SubjectOpenTime extends Model 247 { 248 static function GetDesc(): ModelDesc 249 { 250 $Desc = new ModelDesc(self::GetClassName()); 251 $Desc->AddReference('Subject', Subject::GetClassName()); 252 $Desc->AddDateTime('UpdateTime'); 253 $Desc->AddString('Notice'); 254 $Desc->AddString('Photo', File::GetClassName()); 255 return $Desc; 256 } 257 } 258 259 class SubjectOpenTimeDay extends Model 260 { 261 static function GetDesc(): ModelDesc 262 { 263 $Desc = new ModelDesc(self::GetClassName()); 264 $Desc->AddReference('Subject', Subject::GetClassName()); 265 $Desc->AddInteger('Day'); 266 $Desc->AddInteger('Open1'); 267 $Desc->AddInteger('Close1'); 268 $Desc->AddInteger('Open2'); 269 $Desc->AddInteger('Close2'); 270 return $Desc; 271 } 272 } -
trunk/Modules/Scheduler/Scheduler.php
r893 r894 12 12 $this->Description = 'Allow to setup and execute planned and recurring tasks'; 13 13 $this->Dependencies = array(); 14 } 15 16 function GetModels(): array 17 { 18 return array(SchedulerAction::GetClassName(), Scheduler::GetClassName()); 14 19 } 15 20 … … 120 125 } 121 126 } 127 128 class Scheduler extends Model 129 { 130 static function GetDesc(): ModelDesc 131 { 132 $Desc = new ModelDesc(self::GetClassName()); 133 $Desc->AddString('Name'); 134 $Desc->AddBoolean('Enabled'); 135 $Desc->AddDateTime('ScheduledTime'); 136 $Desc->AddReference('Action', SchedulerAction::GetClassName()); 137 $Desc->AddInteger('Period'); 138 $Desc->AddDateTime('LastExecutedTime'); 139 $Desc->AddInteger('Duration'); 140 $Desc->AddText('Log'); 141 return $Desc; 142 } 143 } 144 145 class SchedulerAction extends Model 146 { 147 static function GetDesc(): ModelDesc 148 { 149 $Desc = new ModelDesc(self::GetClassName()); 150 $Desc->AddString('Name'); 151 $Desc->AddString('Class'); 152 return $Desc; 153 } 154 } -
trunk/Modules/Search/Search.php
r887 r894 70 70 } 71 71 72 function DoInstall(): void73 {74 }75 76 function DoUnInstall(): void77 {78 }79 80 72 function RegisterSearch(string $Title, string $TableName, array $Columns): void 81 73 { -
trunk/Modules/Stock/Stock.php
r893 r894 16 16 function GetModels(): array 17 17 { 18 return array('Product', 'StockSerialNumber', 'Stock', 'StockMoveGroup', 'StockMove', 'StockMoveItem', 19 'StockItemHistory', 'StockMoveItemSerialRel'); 18 return array(Product::GetClassName(), StockSerialNumber::GetClassName(), Stock::GetClassName(), 19 StockMoveGroup::GetClassName(), StockMove::GetClassName(), StockMoveItem::GetClassName(), 20 StockItemHistory::GetClassName(), StockMoveItemSerialRel::GetClassName()); 20 21 } 21 22 … … 267 268 static function GetDesc(): ModelDesc 268 269 { 269 $Desc = new ModelDesc( 'Product');270 $Desc->AddReference('Manufacturer', 'Subject');270 $Desc = new ModelDesc(self::GetClassName()); 271 $Desc->AddReference('Manufacturer', Subject::GetClassName()); 271 272 $Desc->AddString('Code'); 272 273 $Desc->AddString('Name'); … … 275 276 $Desc->AddInteger('VAT'); 276 277 $Desc->AddInteger('Consumption'); 277 $Desc->AddReference('Supplier', 'Subject');278 $Desc->AddReference('UnitOfMeasure', 'UnitOfMeasure');278 $Desc->AddReference('Supplier', Subject::GetClassName()); 279 $Desc->AddReference('UnitOfMeasure', UnitOfMeasure::GetClassName()); 279 280 $Desc->AddInteger('StockMinCount'); 280 281 return $Desc; … … 286 287 static function GetDesc(): ModelDesc 287 288 { 288 $Desc = new ModelDesc( 'StockSerialNumber');289 $Desc->AddReference('Stock', 'Stock');290 $Desc->AddReference('Product', 'Product');289 $Desc = new ModelDesc(self::GetClassName()); 290 $Desc->AddReference('Stock', Stock::GetClassName()); 291 $Desc->AddReference('Product', Product::GetClassName()); 291 292 $Desc->AddDate('TimeEnlistment'); 292 293 $Desc->AddDate('TimeElimination'); … … 296 297 $Desc->AddString('SerialNumber'); 297 298 $Desc->AddString('RegNumber'); 298 $Desc->AddReference('Location', 'Member');299 $Desc->AddReference('Esemble', 'StockSerialNumber');299 $Desc->AddReference('Location', Member::GetClassName()); 300 $Desc->AddReference('Esemble', StockSerialNumber::GetClassName()); 300 301 return $Desc; 301 302 } … … 306 307 static function GetDesc(): ModelDesc 307 308 { 308 $Desc = new ModelDesc( 'Stock');309 $Desc->AddReference('Location', 'Member');309 $Desc = new ModelDesc(self::GetClassName()); 310 $Desc->AddReference('Location', Member::GetClassName()); 310 311 return $Desc; 311 312 } … … 316 317 static function GetDesc(): ModelDesc 317 318 { 318 $Desc = new ModelDesc( 'StockMove');319 $Desc->AddReference('Group', 'StockMoveGroup');319 $Desc = new ModelDesc(self::GetClassName()); 320 $Desc->AddReference('Group', StockMoveGroup::GetClassName()); 320 321 $Desc->AddDateTime('Time'); 321 $Desc->AddReference('Stock', 'Stock');322 $Desc->AddReference('File', 'File');322 $Desc->AddReference('Stock', Stock::GetClassName()); 323 $Desc->AddReference('File', File::GetClassName()); 323 324 return $Desc; 324 325 } … … 329 330 static function GetDesc(): ModelDesc 330 331 { 331 $Desc = new ModelDesc( 'StockMoveItem');332 $Desc->AddReference('StockMove', 'StockMove');333 $Desc->AddReference('Product', 'Product');332 $Desc = new ModelDesc(self::GetClassName()); 333 $Desc->AddReference('StockMove', StockMove::GetClassName()); 334 $Desc->AddReference('Product', Product::GetClassName()); 334 335 $Desc->AddInteger('UnitPrice'); 335 336 $Desc->AddInteger('Amount'); … … 342 343 static function GetDesc(): ModelDesc 343 344 { 344 $Desc = new ModelDesc( 'StockMoveGroup');345 $Desc = new ModelDesc(self::GetClassName()); 345 346 $Desc->AddString('Name'); 346 $Desc->AddReference('DocumentLine', 'DocumentLine');347 $Desc->AddReference('DocumentLine', DocumentLine::GetClassName()); 347 348 $Desc->AddInteger('ValueSign'); 348 349 $Desc->AddInteger('Direction'); … … 355 356 static function GetDesc(): ModelDesc 356 357 { 357 $Desc = new ModelDesc( 'StockItemHistory');358 $Desc = new ModelDesc(self::GetClassName()); 358 359 $Desc->AddDateTime('Time'); 359 $Desc->AddReference('StockSerialNumber', 'StockSerialNumber');360 $Desc->AddReference('StockSerialNumber', StockSerialNumber::GetClassName()); 360 361 $Desc->AddText('Text'); 361 362 return $Desc; … … 367 368 static function GetDesc(): ModelDesc 368 369 { 369 $Desc = new ModelDesc( 'StockMoveItemSerialRel');370 $Desc->AddReference('StockMoveItem', 'StockMoveItem');371 $Desc->AddReference('StockSerialNumber', 'StockSerialNumber');372 return $Desc; 373 } 374 } 370 $Desc = new ModelDesc(self::GetClassName()); 371 $Desc->AddReference('StockMoveItem', StockMoveItem::GetClassName()); 372 $Desc->AddReference('StockSerialNumber', StockSerialNumber::GetClassName()); 373 return $Desc; 374 } 375 } -
trunk/Modules/Subject/Subject.php
r893 r894 133 133 function GetModels(): array 134 134 { 135 return array('Country', 'Subject', 'ContactCategory', 'Contact'); 135 return array(Country::GetClassName(), Subject::GetClassName(), ContactCategory::GetClassName(), 136 Contact::GetClassName()); 136 137 } 137 138 … … 149 150 static function GetDesc(): ModelDesc 150 151 { 151 $Desc = new ModelDesc( 'Subject');152 $Desc = new ModelDesc(self::GetClassName()); 152 153 $Desc->AddString('Name'); 153 154 $Desc->AddString('AddressStreet'); 154 155 $Desc->AddString('AddressTown'); 155 156 $Desc->AddString('AddressPSC'); 156 $Desc->AddReference('AddressCountry', 'Country', true);157 $Desc->AddReference('AddressCountry', Country::GetClassName(), true); 157 158 $Desc->AddString('IC'); 158 159 $Desc->AddString('DIC'); 159 160 $Desc->AddBoolean('PayVAT'); 160 $Desc->AddReference('MapPosition', 'MapPosition', true);161 $Desc->AddReference('MapPosition', MapPosition::GetClassName(), true); 161 162 $Desc->AddString('WWW'); 162 163 $Desc->AddString('Note'); … … 169 170 static function GetDesc(): ModelDesc 170 171 { 171 $Desc = new ModelDesc( 'Country');172 $Desc = new ModelDesc(self::GetClassName()); 172 173 $Desc->AddString('Name'); 173 174 return $Desc; … … 179 180 static function GetDesc(): ModelDesc 180 181 { 181 $Desc = new ModelDesc( 'Contact');182 $Desc->AddReference('Category', 'ContactCategory', true);182 $Desc = new ModelDesc(self::GetClassName()); 183 $Desc->AddReference('Category', ContactCategory::GetClassName(), true); 183 184 $Desc->AddString('Value'); 184 $Desc->AddReference('Subject', 'Subject', true);185 $Desc->AddReference('User', 'User', true);185 $Desc->AddReference('Subject', Subject::GetClassName(), true); 186 $Desc->AddReference('User', User::GetClassName(), true); 186 187 $Desc->AddString('Description'); 187 188 $Desc->AddBoolean('Receive'); … … 194 195 static function GetDesc(): ModelDesc 195 196 { 196 $Desc = new ModelDesc( 'ContactCategory');197 $Desc = new ModelDesc(self::GetClassName()); 197 198 $Desc->AddString('Name'); 198 199 return $Desc; -
trunk/Modules/System/System.php
r893 r894 111 111 } 112 112 113 function GetModels(): array 114 { 115 return array(UnitOfMeasure::GetClassName(), ActionIcon::GetClassName(), ActionGroup::GetClassName(), 116 ActionType::GetClassName(), Action::GetClassName(), Language::GetClassName(), Country::GetClassName()); 117 } 118 113 119 function DoInstall(): void 114 120 { … … 538 544 } 539 545 } 546 547 class UnitOfMeasure extends Model 548 { 549 static function GetDesc(): ModelDesc 550 { 551 $Desc = new ModelDesc(self::GetClassName()); 552 $Desc->AddString('Name'); 553 $Desc->AddString('Unit'); 554 return $Desc; 555 } 556 } 557 558 class Action extends Model 559 { 560 static function GetDesc(): ModelDesc 561 { 562 $Desc = new ModelDesc(self::GetClassName()); 563 $Desc->AddString('Title'); 564 $Desc->AddString('URL'); 565 $Desc->AddReference('Icon', ActionIcon::GetClassName()); 566 $Desc->AddReference('Type', ActionType::GetClassName()); 567 $Desc->AddReference('Group', ActionGroup::GetClassName()); 568 $Desc->AddReference('PermissionOperation', PermissionOperation::GetClassName()); 569 $Desc->AddBoolean('Enable'); 570 return $Desc; 571 } 572 } 573 574 class ActionIcon extends Model 575 { 576 static function GetDesc(): ModelDesc 577 { 578 $Desc = new ModelDesc(self::GetClassName()); 579 $Desc->AddString('Name'); 580 return $Desc; 581 } 582 } 583 584 class ActionGroup extends Model 585 { 586 static function GetDesc(): ModelDesc 587 { 588 $Desc = new ModelDesc(self::GetClassName()); 589 $Desc->AddString('Name'); 590 return $Desc; 591 } 592 } 593 594 class ActionType extends Model 595 { 596 static function GetDesc(): ModelDesc 597 { 598 $Desc = new ModelDesc(self::GetClassName()); 599 $Desc->AddString('Name'); 600 return $Desc; 601 } 602 } 603 604 class Language extends Model 605 { 606 static function GetDesc(): ModelDesc 607 { 608 $Desc = new ModelDesc(self::GetClassName()); 609 $Desc->AddString('Name'); 610 return $Desc; 611 } 612 } 613 614 class Country extends Model 615 { 616 static function GetDesc(): ModelDesc 617 { 618 $Desc = new ModelDesc(self::GetClassName()); 619 $Desc->AddString('Name'); 620 return $Desc; 621 } 622 } 623 -
trunk/Modules/TV/TV.php
r893 r894 114 114 function GetModels(): array 115 115 { 116 return array( 'TVGroup', 'TV');116 return array(TVGroup::GetClassName(), TV::GetClassName()); 117 117 } 118 118 … … 168 168 static function GetDesc(): ModelDesc 169 169 { 170 $Desc = new ModelDesc( 'TVGroup');170 $Desc = new ModelDesc(self::GetClassName()); 171 171 $Desc->AddString('Name'); 172 172 return $Desc; … … 178 178 static function GetDesc(): ModelDesc 179 179 { 180 $Desc = new ModelDesc( 'TV');180 $Desc = new ModelDesc(self::GetClassName()); 181 181 $Desc->AddString('Name'); 182 182 $Desc->AddInteger('Frequency'); 183 183 $Desc->AddString('Norm'); 184 184 $Desc->AddString('Homepage'); 185 $Desc->AddReference('Language', 'Language');185 $Desc->AddReference('Language', Language::GetClassName()); 186 186 $Desc->AddString('ShortName'); 187 187 $Desc->AddString('Stream'); 188 188 $Desc->AddString('StreamWeb'); 189 189 $Desc->AddString('SourceType'); 190 $Desc->AddReference('Category', 'TVGroup');190 $Desc->AddReference('Category', TVGroup::GetClassName()); 191 191 return $Desc; 192 192 } -
trunk/Modules/Task/Task.php
r893 r894 16 16 function GetModels(): array 17 17 { 18 return array( 'TaskGroup', 'Task', 'Work');18 return array(TaskGroup::GetClassName(), Task::GetClassName(), Work::GetClassName()); 19 19 } 20 20 … … 111 111 static function GetDesc(): ModelDesc 112 112 { 113 $Desc = new ModelDesc( 'Task');113 $Desc = new ModelDesc(self::GetClassName()); 114 114 $Desc->AddString('Name'); 115 115 $Desc->AddDate('TimeCreate'); … … 119 119 $Desc->AddBoolean('Public'); 120 120 $Desc->AddInteger('Progress'); 121 $Desc->AddReference('Group', 'TaskGroup');121 $Desc->AddReference('Group', TaskGroup::GetClassName()); 122 122 $Desc->AddString('Description'); 123 123 $Desc->AddText('Conclusion'); 124 $Desc->AddReference('AssignedTo', 'User');124 $Desc->AddReference('AssignedTo', User::GetClassName()); 125 125 return $Desc; 126 126 } … … 131 131 static function GetDesc(): ModelDesc 132 132 { 133 $Desc = new ModelDesc( 'TaskGroup');133 $Desc = new ModelDesc(self::GetClassName()); 134 134 $Desc->AddString('Name'); 135 135 $Desc->AddText('Description'); 136 $Desc->AddReference('Parent', 'TaskGroup');136 $Desc->AddReference('Parent', TaskGroup::GetClassName()); 137 137 return $Desc; 138 138 } … … 143 143 static function GetDesc(): ModelDesc 144 144 { 145 $Desc = new ModelDesc( 'Work');145 $Desc = new ModelDesc(self::GetClassName()); 146 146 $Desc->AddString('Name'); 147 147 $Desc->AddText('Description'); 148 148 $Desc->AddDateTime('TimeStart'); 149 149 $Desc->AddFloat('Duration'); 150 $Desc->AddReference('User', 'User');151 $Desc->AddReference('Task', 'Task');150 $Desc->AddReference('User', User::GetClassName()); 151 $Desc->AddReference('Task', Task::GetClassName()); 152 152 return $Desc; 153 153 } -
trunk/Modules/TimeMeasure/Measure.php
r893 r894 14 14 static function GetDesc(): ModelDesc 15 15 { 16 $Desc = new ModelDesc( 'Measure');16 $Desc = new ModelDesc(self::GetClassName()); 17 17 $Desc->AddString('Name'); 18 18 $Desc->AddString('Title'); -
trunk/Modules/TimeMeasure/TimeMeasure.php
r893 r894 20 20 function GetModels(): array 21 21 { 22 return array( 'Measure');22 return array(Measure::GetClassName()); 23 23 } 24 24 -
trunk/Modules/User/User.php
r893 r894 25 25 function GetModels(): array 26 26 { 27 return array('User', 'UserOnline', 'PermissionGroup', 'PermissionOperation', 'PermissionGroupAssignment', 'PermissionUserAssignment'); 27 return array(User::GetClassName(), UserOnline::GetClassName(), PermissionGroup::GetClassName(), PermissionOperation::GetClassName(), 28 PermissionGroupAssignment::GetClassName(), PermissionUserAssignment::GetClassName()); 28 29 } 29 30 -
trunk/Modules/User/UserModel.php
r891 r894 67 67 static function GetDesc(): ModelDesc 68 68 { 69 $Desc = new ModelDesc( 'User');69 $Desc = new ModelDesc(self::GetClassName()); 70 70 $Column = $Desc->AddString('Login'); 71 71 $Column->Unique = true; … … 458 458 static function GetDesc(): ModelDesc 459 459 { 460 $Desc = new ModelDesc( 'UserOnline');460 $Desc = new ModelDesc(self::GetClassName()); 461 461 $Desc->Memory = true; 462 $Desc->AddReference('User', 'User', true);462 $Desc->AddReference('User', User::GetClassName(), true); 463 463 $Desc->AddDateTime('ActivityTime'); 464 464 $Desc->AddDateTime('LoginTime'); … … 477 477 static function GetDesc(): ModelDesc 478 478 { 479 $Desc = new ModelDesc( 'PermissionGroup');479 $Desc = new ModelDesc(self::GetClassName()); 480 480 $Desc->AddString('Description'); 481 481 return $Desc; … … 487 487 static function GetDesc(): ModelDesc 488 488 { 489 $Desc = new ModelDesc( 'PermissionGroupAssignment');490 $Desc->AddReference('Group', 'PermissionGroup');491 $Desc->AddReference('AssignedGroup', 'PermissionGroup', true);492 $Desc->AddReference('AssignedOperation', 'PermissionOperation', true);489 $Desc = new ModelDesc(self::GetClassName()); 490 $Desc->AddReference('Group', PermissionGroup::GetClassName()); 491 $Desc->AddReference('AssignedGroup', PermissionGroup::GetClassName(), true); 492 $Desc->AddReference('AssignedOperation', PermissionOperation::GetClassName(), true); 493 493 return $Desc; 494 494 } … … 499 499 static function GetDesc(): ModelDesc 500 500 { 501 $Desc = new ModelDesc( 'PermissionOperation');502 $Desc->AddReference('Module', 'Module');501 $Desc = new ModelDesc(self::GetClassName()); 502 $Desc->AddReference('Module', Module::GetClassName()); 503 503 $Desc->AddString('Operation'); 504 504 $Desc->AddString('Item'); … … 513 513 static function GetDesc(): ModelDesc 514 514 { 515 $Desc = new ModelDesc( 'PermissionUserAssignment');516 $Desc->AddReference('User', 'User');517 $Desc->AddReference('AssignedGroup', 'PermissionGroup', true);518 $Desc->AddReference('AssignedOperation', 'PermissionOperation', true);515 $Desc = new ModelDesc(self::GetClassName()); 516 $Desc->AddReference('User', User::GetClassName()); 517 $Desc->AddReference('AssignedGroup', PermissionGroup::GetClassName(), true); 518 $Desc->AddReference('AssignedOperation', PermissionOperation::GetClassName(), true); 519 519 return $Desc; 520 520 } -
trunk/Modules/Wiki/Wiki.php
r893 r894 17 17 function GetModels(): array 18 18 { 19 return array( 'WikiPage', 'WikiPageContent');19 return array(WikiPage::GetClassName(), WikiPageContent::GetClassName()); 20 20 } 21 21 … … 58 58 static function GetDesc(): ModelDesc 59 59 { 60 $Desc = new ModelDesc( 'WikiPageContent');61 $Desc->AddReference('Page', 'Page');60 $Desc = new ModelDesc(self::GetClassName()); 61 $Desc->AddReference('Page', WikiPage::GetClassName()); 62 62 $Desc->AddDateTime('Time'); 63 63 $Desc->AddText('Content'); 64 $Desc->AddReference('User', 'User');64 $Desc->AddReference('User', User::GetClassName()); 65 65 return $Desc; 66 66 } -
trunk/Packages/Common/AppModule.php
r893 r894 223 223 else if ($Column->Type == ModelColumnType::Boolean) $Query .= 'tinyint(1)'; 224 224 else if ($Column->Type == ModelColumnType::Date) $Query .= 'date'; 225 else if ($Column->Type == ModelColumnType::BigInt) $Query .= 'bigint(20)'; 225 226 else if ($Column->Type == ModelColumnType::Enum) 226 227 { -
trunk/Packages/Common/Base.php
r891 r894 20 20 $this->System = &$System; 21 21 $this->Database = &$System->Database; 22 } 23 24 static function GetClassName() 25 { 26 return get_called_class(); 22 27 } 23 28 } … … 76 81 { 77 82 $Result = new ModelColumnInteger($Name); 83 $this->Columns[] = $Result; 84 return $Result; 85 } 86 87 function AddBigInt(string $Name): ModelColumnBigInt 88 { 89 $Result = new ModelColumnBigInt($Name); 78 90 $this->Columns[] = $Result; 79 91 return $Result; … … 137 149 const Date = 7; 138 150 const Enum = 8; 151 const BigInt = 9; 139 152 } 140 153 … … 230 243 } 231 244 245 class ModelColumnBigInt extends ModelColumn 246 { 247 public ?int $Default; 248 249 function __construct(string $Name) 250 { 251 parent::__construct($Name, ModelColumnType::BigInt); 252 $this->HasDefault = false; 253 $this->Default = null; 254 } 255 256 function GetDefault(): ?string 257 { 258 return $this->Default; 259 } 260 } 261 232 262 class ModelColumnDateTime extends ModelColumn 233 263 {
Note:
See TracChangeset
for help on using the changeset viewer.