示例#1
0
 /**
  * Returns a new ChildOptionQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return ChildOptionQuery
  */
 public static function create($modelAlias = null, Criteria $criteria = null)
 {
     if ($criteria instanceof ChildOptionQuery) {
         return $criteria;
     }
     $query = new ChildOptionQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
示例#2
0
文件: Mains.php 项目: AlvaCorp/POS-2
 function changeAppPhoto($params)
 {
     require 'session.php';
     $con = Propel::getConnection('pos');
     $con->beginTransaction();
     $operationTime = time();
     $unique = session_id() . time();
     $file = $_FILES['photo'];
     $folder = $session->get('pos/folder') . '/resources/images/';
     $ext = pathinfo($file['name'], PATHINFO_EXTENSION);
     $newfile = $unique . '.' . $ext;
     $newfile_full_path = $folder . $newfile;
     try {
         if ($file['name'] == '') {
             throw new Exception('Missing file');
         }
         if ($file['error'] > 0) {
             throw new Exception($file['error']);
         }
         move_uploaded_file($file['tmp_name'], $newfile_full_path);
         $appPhoto = OptionQuery::create()->filterByName(['app_photo'])->findOne($con);
         $appPhoto->setValue($newfile)->save($con);
         $results['success'] = true;
         $results['photo'] = $newfile;
         $con->commit();
     } catch (Exception $e) {
         $con->rollBack();
         $results['success'] = false;
         $results['errmsg'] = $e->getMessage();
     }
     return $results;
 }
示例#3
0
 public static function updateClientIdentity($params, $currentUser, $con)
 {
     $option = OptionQuery::create()->filterByName('client_name')->findOne($con);
     $option->setValue($params->client_name)->save($con);
     $option = OptionQuery::create()->filterByName('client_address')->findOne($con);
     $option->setValue($params->client_address)->save($con);
     $option = OptionQuery::create()->filterByName('client_phone')->findOne($con);
     $option->setValue($params->client_phone)->save($con);
     $option = OptionQuery::create()->filterByName('client_email')->findOne($con);
     $option->setValue($params->client_email)->save($con);
     $option = OptionQuery::create()->filterByName('client_website')->findOne($con);
     $option->setValue($params->client_website)->save($con);
     $results['success'] = true;
     $results['data'] = 'Yay';
     return $results;
 }
示例#4
0
use ORM\CreditQuery;
use ORM\CreditPaymentQuery;
use ORM\OptionQuery;
use Propel\Runtime\Propel;
require '../../vendor/autoload.php';
require '../propel-config.php';
require '../session.php';
if (!$session->get('pos/state') === 1) {
    die('Akses ditolak. Anda belum masuk.');
}
$con = Propel::getConnection('pos');
$con->beginTransaction();
$id = isset($_GET['id']) ? $_GET['id'] : die('Missing Parameter.');
// Get application info from database
$info = [];
$options = OptionQuery::create()->filterByName(['app_name', 'app_photo', 'dev_name', 'dev_email', 'dev_phone', 'dev_website', 'dev_address', 'client_name', 'client_email', 'client_phone', 'client_website', 'client_address', 'homepath'])->find($con);
foreach ($options as $row) {
    $info[$row->getName()] = $row->getValue();
}
$info = (object) $info;
?>

<!DOCTYPE html>
<html lang="id">
<head>
    <title>Print Nota Piutang <?php 
echo $id;
?>
</title>
    <link rel="stylesheet" type="text/css" href="print.css">
</head>
示例#5
0
文件: init.php 项目: AlvaCorp/POS-2
require '../vendor/autoload.php';
require 'propel-config.php';
require 'session.php';
$con = Propel::getConnection('pos');
$con->beginTransaction();
try {
    // Get application info from database
    $info = [];
    $options = OptionQuery::create()->filterByName(['app_name', 'app_photo', 'dev_name', 'dev_email', 'dev_phone', 'dev_website', 'dev_address', 'client_name', 'client_email', 'client_phone', 'client_website', 'client_address', 'homepath'])->find($con);
    foreach ($options as $row) {
        $info[$row->getName()] = $row->getValue();
    }
    $root['info'] = $info;
    // get shortcut key from database
    $shortcutKeys = [];
    $keys = OptionQuery::create()->filterByName(['sales_key', 'sales_add_key', 'sales_pay_key', 'sales_save_key', 'sales_cancel_key', 'purchase_key', 'purchase_add_key', 'purchase_pay_key', 'purchase_save_key', 'purchase_cancel_key'])->find($con);
    foreach ($keys as $key) {
        $shortcutKeys[$key->getName()] = $key->getValue();
    }
    $root['shortcutKeys'] = $shortcutKeys;
    // Check previous session
    try {
        if ($session->get('pos/state') === 0 || !isset($session->get('pos/current_user')->id)) {
            throw new Exception();
        }
        $user = UserQuery::create()->filterById($session->get('pos/current_user')->id)->select(['id', 'user', 'role_id'])->leftJoin('Detail')->withColumn('Detail.Name', 'name')->withColumn('Detail.Address', 'address')->withColumn('Detail.Phone', 'phone')->findOne($con);
        if (!$user) {
            throw new Exception();
        }
        $root['state'] = 1;
        $root['current_user'] = (object) $user;
示例#6
0
文件: Option.php 项目: AlvaCorp/POS-2
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      ConnectionInterface $con
  * @return void
  * @throws PropelException
  * @see Option::setDeleted()
  * @see Option::isDeleted()
  */
 public function delete(ConnectionInterface $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getServiceContainer()->getWriteConnection(OptionTableMap::DATABASE_NAME);
     }
     $con->transaction(function () use($con) {
         $deleteQuery = ChildOptionQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $this->setDeleted(true);
         }
     });
 }
示例#7
0
 /**
  * Performs an INSERT on the database, given a Option or Criteria object.
  *
  * @param mixed               $criteria Criteria or Option object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *                         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(OptionTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from Option object
     }
     // Set the correct dbName
     $query = OptionQuery::create()->mergeWith($criteria);
     // use transaction because $criteria could contain info
     // for more than one table (I guess, conceivably)
     return $con->transaction(function () use($con, $query) {
         return $query->doInsert($con);
     });
 }