Changeset 905
- Timestamp:
- Feb 19, 2021, 12:39:23 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r904 r905 1 1 <?php 2 2 3 $Revision = 90 4; // Subversion revision3 $Revision = 905; // Subversion revision 4 4 $DatabaseRevision = 901; // SQL structure revision 5 5 $ReleaseTime = strtotime('2021-02-19'); -
trunk/Modules/Contract/Contract.php
r904 r905 274 274 $SignDate = HumanDate($Contract['ValidFrom']); 275 275 276 277 276 $Output = '<html> 278 277 <head></head> -
trunk/Modules/IS/IS.php
r899 r905 53 53 else if ($Action == 'mapselect') $Content = $this->ShowMapSelect($Table); 54 54 else if ($Action == 'edit') $Content = $this->ShowEdit($Table, $ItemId); 55 else if ($Action == 'clone') $Content = $this->ShowClone($Table, $ItemId); 55 56 else if ($Action == 'add') $Content = $this->ShowAdd($Table); 56 57 else if ($Action == 'addsub') $Content = $this->ShowAddSub($Table); … … 200 201 $Output .= '<li>'.$this->ShowAction('Prohlížet', '?a=view&t='.$Table.'&i='.$Id, 201 202 $this->System->Link('/images/view.png')); 203 $Output .= '<li>'.$this->ShowAction('Duplikovat', '?a=clone&t='.$Table.'&i='.$Id, 204 $this->System->Link('/images/clone.png')); 202 205 $Output .= '<li>'.$this->ShowAction('Seznam', '?a=list&t='.$Table, 203 206 $this->System->Link('/images/list.png')); … … 218 221 $Output .= '<li>'.$this->ShowAction('Prohlížet', '?a=view&t='.$Table.'&i='.$Id, 219 222 $this->System->Link('/images/view.png')); 223 $Output .= '<li>'.$this->ShowAction('Duplikovat', '?a=clone&t='.$Table.'&i='.$Id, 224 $this->System->Link('/images/clone.png')); 220 225 $Output .= '<li>'.$this->ShowAction('Seznam', '?a=list&t='.$Table, 221 226 $this->System->Link('/images/list.png')); … … 224 229 $Output .= '</ul>'; 225 230 } 231 return $Output; 232 } 233 234 function ShowClone(string $Table, string $Id, array $Actions = array()): string 235 { 236 $Output = ''; 237 if (!array_key_exists($Table, $this->System->FormManager->Classes)) 238 return $this->SystemMessage('Chyba', 'Tabulka '.$Table.' nenalezena'); 239 if (defined('NEW_PERMISSION') and !ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission($this->TableToModule($Table), 'Write')) 240 return 'Nemáte oprávnění'; 241 if (array_key_exists('o', $_GET)) 242 { 243 if ($_GET['o'] == 'save') 244 { 245 $Form = new Form($this->System->FormManager); 246 $Form->SetClass($Table); 247 $Form->LoadValuesFromForm(); 248 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' duplikování'; 249 try 250 { 251 $Form->Validate(); 252 if (array_key_exists('BeforeInsert', $Form->Definition)) 253 { 254 $Class = $Form->Definition['BeforeInsert'][0]; 255 $Method = $Form->Definition['BeforeInsert'][1]; 256 $Form->Values = $Class->$Method($Form); 257 } 258 $Form->Validate(); 259 $Form->SaveValuesToDatabase(0); 260 $Id = $this->Database->insert_id; 261 $this->LogChange($Form, 'Clone', $Id, 0); 262 $Output .= $this->SystemMessage('Duplikování položky', 'Nová kopie položky vytvořena'); 263 $Output .= $this->ShowView($Table, $Id, $_GET['a'] == 'addsub'); 264 if (array_key_exists('AfterInsert', $Form->Definition)) 265 { 266 $Class = $Form->Definition['AfterInsert'][0]; 267 $Method = $Form->Definition['AfterInsert'][1]; 268 $Form->Values = $Class->$Method($Form, $Id); 269 } 270 271 //$this->Database->update($Table, 'Id='.$Id, 272 // array('UserCreate' => ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'], 273 // 'TimeCreate' => 'NOW()')); 274 } catch (Exception $E) 275 { 276 $Output .= $this->SystemMessage('Duplikování položky', 'Položku se nepodařilo duplikovat. Opravte problém a opakujte akci.<br/>'.$E->getMessage()); 277 $Form->OnSubmit = '?a=clone&t='.$Table.'&o=save'; 278 $Output .= $Form->ShowEditForm(); 279 $Actions[] = '<a href="?a=list&t='.$Table.'"><img alt="Seznam" title="Seznam" src="'. 280 $this->System->Link('/images/list.png').'"/>Seznam</a>'; 281 } 282 } 283 } else 284 { 285 $Form = new Form($this->System->FormManager); 286 $Form->SetClass($Table); 287 $Form->LoadValuesFromDatabase($Id); 288 $this->ShortTitle .= ' - '.$Form->Definition['Title'].' duplikování'; 289 $Form->OnSubmit = '?a='.$_GET['a'].'&t='.$Table.'&o=save'; 290 $Output .= $Form->ShowEditForm(); 291 $Actions[] = $this->ShowAction('Seznam', '?a=list&t='.$Table, 292 $this->System->Link('/images/list.png')); 293 } 294 $Output .= '<ul class="ActionMenu">'; 295 foreach ($Actions as $Action) 296 { 297 $Output .= '<li>'.$Action.'</li>'; 298 } 299 $Output .= '</ul>'; 226 300 return $Output; 227 301 } … … 412 486 $this->ShowAction('Upravit', '?a=edit&t='.$TableModify.'&i='.$Id, 413 487 $this->System->Link('/images/edit.png')), 488 $this->ShowAction('Duplikovat', '?a=clone&t='.$TableModify.'&i='.$Id, 489 $this->System->Link('/images/clone.png')), 414 490 $this->ShowAction('Seznam', '?a=list&t='.$Table, 415 491 $this->System->Link('/images/list.png')), … … 713 789 else $TableModify = $Table; 714 790 715 $RowActions = '<a href="?a=view&t='.$Table.'&i=#RowId"><img alt="Ukázat" title="Ukázat" src="'. 716 $this->System->Link('/images/view.png').'"/></a>'. 717 '<a href="?a=edit&t='.$TableModify.'&i=#RowId"><img alt="Upravit" title="Upravit" src="'. 718 $this->System->Link('/images/edit.png').'"/></a>'. 719 '<a href="?a=delete&t='.$Table.'&i=#RowId"><img alt="Smazat" title="Smazat" src="'. 720 $this->System->Link('/images/delete.png').'" onclick="return confirmAction(\'Opravdu smazat položku?\');"/></a>'; 791 $RowActions = 792 $this->ShowAction('Ukázat', '?a=view&t='.$Table.'&i=#RowId', $this->System->Link('/images/view.png')). 793 $this->ShowAction('Upravit', '?a=edit&t='.$TableModify.'&i=#RowId', $this->System->Link('/images/edit.png')). 794 $this->ShowAction('Duplikovat', '?a=clone&t='.$TableModify.'&i=#RowId', $this->System->Link('/images/clone.png')). 795 $this->ShowAction('Odstranit', '?a=delete&t='.$Table.'&i=#RowId', $this->System->Link('/images/delete.png'), 'Opravdu smazat položku?;'); 721 796 if (($Table != '') and (array_key_exists($Table, $this->System->FormManager->Classes))) 722 797 $FormClass = $this->System->FormManager->Classes[$Table];
Note:
See TracChangeset
for help on using the changeset viewer.