Changeset 887 for trunk/Modules/Finance/Import.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Import.php
r874 r887 3 3 class PageFinanceImportPayment extends Page 4 4 { 5 var $FullTitle = 'Import plateb'; 6 var $ShortTitle = 'Import plateb'; 7 var $ParentClass = 'PageFinance'; 5 function __construct(System $System) 6 { 7 parent::__construct($System); 8 $this->FullTitle = 'Import plateb'; 9 $this->ShortTitle = 'Import plateb'; 10 $this->ParentClass = 'PageFinance'; 11 } 8 12 9 function Show() 13 function Show(): string 10 14 { 11 if (! $this->System->User->CheckPermission('Finance', 'SubjectList')) return 'Nemáte oprávnění';15 if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Finance', 'SubjectList')) return 'Nemáte oprávnění'; 12 16 if (array_key_exists('Operation', $_GET)) 13 17 { … … 26 30 } 27 31 28 function Prepare() 32 function Prepare(): string 29 33 { 30 $Finance = $this->System->Modules['Finance'];34 $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance; 31 35 $Finance->LoadMonthParameters(0); 32 36 $Data = explode("\n", $_POST['Source']); … … 124 128 } 125 129 126 function InsertMoney( $Subject, $Value, $Cash, $Taxable, $Time, $Text,$Group)130 function InsertMoney(string $Subject, string $Value, string $Cash, string $Taxable, string $Time, string $Text, array $Group) 127 131 { 128 132 $Year = date('Y', $Time); 129 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year);133 $BillCode = ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year); 130 134 // TODO: Fixed BankAccount=1, allow to select bank account for import 131 135 $this->Database->insert('FinanceOperation', array('Text' => $Text, … … 136 140 } 137 141 138 function Insert() 142 function Insert(): string 139 143 { 140 $Finance = $this->System->Modules['Finance'];144 $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance; 141 145 $Finance->LoadMonthParameters(0); 142 146 $Output = ''; … … 144 148 for ($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--) 145 149 { 146 if ($_POST['Money'.$I] < 0) { 147 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup'); 148 } else { 149 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup'); 150 if ($_POST['Money'.$I] < 0) 151 { 152 $FinanceGroup = $Finance->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup'); 153 } else 154 { 155 $FinanceGroup = $Finance->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup'); 150 156 } 151 157 $Date = explode('-', $_POST['Date'.$I]); … … 154 160 0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $FinanceGroup); 155 161 $Output .= $I.', '; 156 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewPaymentInserted');162 ModuleLog::Cast($this->System->GetModule('Log'))->NewRecord('Finance', 'NewPaymentInserted'); 157 163 } 158 164 return $Output;
Note:
See TracChangeset
for help on using the changeset viewer.