Ejemplo n.º 1
0
loginAdmin();
if(!loggedAdmin())
  header('location: index.php');

  $transaction = new TransactionCollection();
  $clients = ClientCollection::getClients();
  $isins = IsinCollection::getIsins();
  $collection = new SecurityCollection();
  $isinCollection = new IsinCollection;

  $accounts = CustodyCollection::getAccountsForClientByTransactionId(mysql_real_escape_string($_GET['id']));

  if(exist($_POST['button']))
  {
    $result = TransactionCollection::updateTransaction();
  }
  else
  {
    TransactionCollection::loadTransaction();
    $result = array();
  }
  include("$templates/menu.php");

  $clients = ClientCollection::getClients();
  $isins = IsinCollection::getIsins();
  include("$templates/transaction_edit.php");

  include("$templates/footer.php");
?>
Ejemplo n.º 2
0
  static public function updateClient() 
  {
    $result = ClientCollection::verifyFields();

    if(count($result))
      return ($result);

$query = "UPDATE `user` SET `login` = '".$_POST['login']."' , `password` = '".$_POST['password']."' , `email` = '".$_POST['email']."' , 
`name` = '".$_POST['name']."' WHERE id = '".$_POST['id']."';";
mysql_query($query);
header('location: user_updated.php');
  }
Ejemplo n.º 3
0
  static public function verifyFields() 
  {
    foreach($_POST as $key=>$value)
      $_POST[$key] = mysql_real_escape_string($value);

    $errors='';
    $fields = array('client','aname');
    $fieldsObligatory = array('client','aname');
    $errorMessage = array('Client','Account name');
    $result = array();

    foreach($fieldsObligatory as $key=>$field):
      if(!exist($_POST[$field]))
        $result[] = $errorMessage[$key];
    endforeach;

   if(trim($_POST['client']))
   if(!ClientCollection::getClients(trim($_POST['client'])))
     die('Database error: not existant client.. please apply admin');

   return $result;
  }
Ejemplo n.º 4
0
<?php
include('../config.php');
include('../functions.php');
include('../classes/clientcollection.class.php');

loginAdmin();
if(!loggedAdmin())
  header('location: index.php');

  if(exist($_POST['add']))
    $result = ClientCollection::addClient();

  include("$templates/menu.php");

  include("$templates/user_add.php");

  include("$templates/footer.php");
?>
Ejemplo n.º 5
0
  static public function verifyFields() 
  {
    foreach($_POST as $key=>$value)
      $_POST[$key] = mysql_real_escape_string($value);

    $errors='';
    $fields = array('currency','client','aname','amount','credit','valuec','debit','valued');
    $fieldsDates = array('valuec','valued');
    $fieldsNumbers= array('amount','credit','debit');
    $fieldsObligatory = array('currency','client','aname','amount');
    $errorMessage = array('Currency','Client','Account name','Amount');
    $errorMessageDates= array('Credit date (should be YYYY-MM-DD)','Debit date (should be YYYY-MM-DD)');
    $errorMessageNumbers= array('Amount should be number','Credit should be number','Debit should be number');
    $result = array();

    foreach($fieldsObligatory as $key=>$field):
      if(!exist($_POST[$field]))
        $result[] = $errorMessage[$key];
    endforeach;

    foreach($fieldsDates as $key=>$field)
      if(trim($_POST[$field]))
      if(trim($_POST[$field]) !== '0000-00-00')
      if((!preg_match("/[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $_POST[$field]))||(strtotime(trim($_POST[$field]))<1))
        $result[] = $errorMessageDates[$key];

    foreach($fieldsNumbers as $key=>$field)
      if(trim($_POST[$field]))
        if(!preg_match("/^[\d]{0,8}$/", $_POST[$field]))
        $result[] = $errorMessageNumbers[$key];

   if(trim($_POST['client']))
   if(!ClientCollection::getClients(trim($_POST['client'])))
     die('Database error: not existant client.. please apply admin');

   if(trim($_POST['currency']))
   if(!CurrencyCollection::getCurrencies(trim($_POST['currency'])))
     die('Database error: not existant currency.. please apply admin');    
   return $result;
  }
Ejemplo n.º 6
0
<?php
include('../config.php');
include('../functions.php');
include('../classes/clientcollection.class.php');

loginAdmin();
if(!loggedAdmin())
  header('location: index.php');

  if(exist($_POST['add']))
    $result = ClientCollection::updateClient();
  else
    ClientCollection::loadClient();

  include("$templates/menu.php");

  include("$templates/user_edit.php");

  include("$templates/footer.php");
?>