root / editBorrower.php

1
<?php
2
3
/*
4
5
  Copyright (C) 2010, All Rights Reserved.
6
7
  This file is part of RPInventory.
8
9
  RPInventory is free software: you can redistribute it and/or modify
10
  it under the terms of the GNU General Public License as published by
11
  the Free Software Foundation, either version 3 of the License, or
12
  (at your option) any later version.
13
14
  RPInventory is distributed in the hope that it will be useful,
15
  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
  GNU General Public License for more details.
18
19
  You should have received a copy of the GNU General Public License
20
  along with RPInventory.  If not, see <http://www.gnu.org/licenses/>.
21
22
*/
23
24
require_once("lib/auth.lib.php");  //Session
25
require_once('lib/borrowers.lib.php');
26
require_once('lib/addresses.lib.php');
27
require_once('class/database.class.php');
28
29
// Connect
30
$db = new database();
31
32
//Authenticate
33
$auth = GetAuthority();        
34
if( $auth < 1 )
35
        die( 'Permission Denied' );
36
37
// SMARTY Setup
38
require_once('lib/smarty_inv.class.php');
39
$smarty = new Smarty_Inv();
40
41
$id = (int)$_GET['id'];
42
if($id == 0)
43
  die("Invalid ID Given");
44
45
//borrowers
46
$borrower = getBorrower($id, $db);
47
48
if($borrower == false)
49
  die("Could not get information");
50
 
51
$address_id = $borrower->address_id;
52
$address = getAddress($address_id, $db);
53
54
//BEGIN Page
55
        
56
//Assign vars
57
$smarty->assign('title', "Edit Borrower");
58
$smarty->assign('authority', $auth);
59
$smarty->assign('page_tpl', 'editBorrower');
60
$smarty->assign('borrower', $borrower);
61
$smarty->assign('address', $address);
62
$smarty->assign('address_id', $address_id);
63
64
$smarty->display('index.tpl');
65
66
$db->close();
67
68
?>
69