Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Mar 11, 2015
2 parents 1b27b9d + f7ec3f0 commit b451a99
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 35 deletions.
16 changes: 14 additions & 2 deletions app/commands/housekeeping.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,21 @@ public function fire()
$items = Item::whereIn('OrderID',$order_ids)->where('status','=','7')->get();
if(!$items->isEmpty()){
$checks['LabTagItems'] = true;
//We need to notify the protolab_requires_order distribution list of an open order
//Grab people we need to notify
$protolab_users = DistributionList::where("distributionList","=","protolab_requires_order")->lists("UserID");
$protolab_users_obj = User::whereIn("id",$protolab_users)->get(); //User objects of anyone on the protolab distribution list
Mail::send('emails.prototypingLab.protolab_requires_order', array('items' => $items), function ($message) use ($protolab_users_obj) {
foreach ($protolab_users_obj as $protolab_user) {
$message->to($protolab_user->Email, $protolab_user->FirstName . ' ' . $protolab_user->LastName);
}
$message->subject('[IPRO Manager] Prototyping Lab Action Required');
});
}


//Send that admin email thing if there are any tasks needing work
foreach($checks as $key=>$val){
/*foreach($checks as $key=>$val){
if($val){
$checks['sendEmail'] = true;
}
Expand All @@ -82,7 +94,7 @@ public function fire()
$message->subject('IPRO Manager action required!');
});
$this->info('sending admin email');
}
}*/
$this->info('successfully completed housekeeping script');
return true;
}
Expand Down
14 changes: 7 additions & 7 deletions app/controllers/AdminAccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function showGLEditor($projectID){
return View::make('admin.accounts.editor');
}

function newGLEntry($accountID){
function newGLEntry($projectid){
//We need to create a new account GL entry for the speicified account
$gl = new ledgerEntry;
//Grab the posted entry type
Expand All @@ -22,28 +22,28 @@ function newGLEntry($accountID){
$cd = Input::get('creditdebit');
$allowedCD = array('CREDIT','DEBIT');
if(!in_array($entryType, $allowedTypes)){
return Redirect::to('/admin/accounts/editor/'.$accountID)->with('error',array('That Entry type is not allowed'));
return Redirect::to('/admin/accounts/editor/'.$projectid)->with('error',array('That Entry type is not allowed'));
}
if(!in_array($cd, $allowedCD)){
return Redirect::to('/admin/accounts/editor/'.$accountID)->with('error',array('You can only credit or debit an account'));
return Redirect::to('/admin/accounts/editor/'.$projectid)->with('error',array('You can only credit or debit an account'));
}
//Let's get the dollars
$money = floatval(Input::get('amount'));
$money = number_format($money,2);
$account = Account::find($accountID);
$account = Account::where('ClassID','=',$projectid)->first();
//Let's make it happen
if($cd == "CREDIT"){
//Give the account monies
//We can just give monies, no need to check if they can go in because they will
$account->Deposit($entryType,$money);
return Redirect::to('/admin/accounts/editor/'.$accountID)->with('success',array('Successfully added General Ledger entry'));
return Redirect::to('/admin/accounts/editor/'.$projectid)->with('success',array('Successfully added General Ledger entry'));
}elseif($cd == "DEBIT"){
//Take away monies from the account
if($account->Withdrawl($entryType,$money)){
//Success!
return Redirect::to('/admin/accounts/editor/'.$accountID)->with('success',array('Successfully added General Ledger entry'));
return Redirect::to('/admin/accounts/editor/'.$projectid)->with('success',array('Successfully added General Ledger entry'));
}else{
return Redirect::to('/admin/accounts/editor/'.$accountID)->with('error',array('Not enough funds to debit account'));
return Redirect::to('/admin/accounts/editor/'.$projectid)->with('error',array('Not enough funds to debit account'));
}
}
}
Expand Down
13 changes: 1 addition & 12 deletions app/controllers/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function newOrder($id){
$project = Project::find($id);
//Make sure that the user is enrolled
if(!$project->isEnrolled()){
return Redirect::route('dashboard')->with('error',array('You must be enrolled in the class to see that page'));
return Redirect::route('dashboard')->with('error',array('You must be enrolled in the class to place an order'));
}
//User is already available
//Grab the acct info
Expand Down Expand Up @@ -170,17 +170,8 @@ public function newOrderProcess($id){
public function viewOrder($projectid,$orderid){
//in the function we are going to show the user the order and project. First we confirm the users enrollment in the project.
$project = Project::find(intval($projectid));
if(!$project->isEnrolled()){
return Redirect::route('dashboard')->with('error',array('You must be enrolled in the class to view that page'));
}
//lets see if the person is enrolled in the project
$projusers = $project->Users()->where('UserID',"=",Auth::id())->get();
if($projusers->isEmpty()){
return Redirect::route("dashboard")->with("error",array("You do not have access to view that order"));
}
//Now let's pull the order
$order = Order::find(intval($orderid));

//Make sure the order belongs to this project
if($order->ClassID != $project->id){
return Redirect::route("dashboard")->with("error",array("You do not have access to view that order"));
Expand All @@ -193,7 +184,5 @@ public function viewOrder($projectid,$orderid){
View::share("order",$order);
View::share("items",$items);
return View::make("Orders.view");


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDistributionListTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('distribution_lists', function(Blueprint $table)
{
$table->increments('id');
$table->string("distributionList");
$table->integer("UserID")->unsigned();
$table->timestamps();
$table->foreign("UserID")->references("id")->on("users");
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('distribution_lists');
}

}
13 changes: 13 additions & 0 deletions app/models/DistributionList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
use LaravelBook\Ardent\Ardent;
class DistributionList extends Ardent {
protected $table = 'distribution_lists';
public static $rules = array(
'distributionList' => 'required',
'UserID' => 'required'
);
public function Users(){
return $this->belongsTo('User','UserID','id');
}
}

2 changes: 1 addition & 1 deletion app/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
Route::group(array('prefix'=>'orders'), function(){
//admin/orders group
Route::get('/',array('as'=>'admin.orders','uses'=>'AdminOrderController@index'));
Route::get('/{id}','AdminOrderController@manage')->where(array('id' => '[0-9]+'));
Route::get('/{id}',array('as'=>'admin.order.manage','uses'=>'AdminOrderController@manage'))->where(array('id' => '[0-9]+'));
Route::post('/{id}/CreateNote',array('before'=>'csrf','as'=>'admin.order.createNote','uses'=>'AdminOrderController@createNote'));
Route::group(array('prefix'=>'pickup'), function(){
//admin/orders/pickup route group
Expand Down
34 changes: 34 additions & 0 deletions app/views/emails/prototypingLab/protolab_requires_order.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@extends('emails.layout')
@section('TopSentence')
Prototyping Lab Action Required!!
@stop
@section('content')

<h3>Hey there Prototyping Lab!!</h3>
<p>While you were setting things on fire and building potato launchers some items have changed status and now require your attention!!
(For three low low payments of 19.87)</p>
<p>Below is a listing of the items found within the app that require your attention.</p>
<table class="tableGray" width="100%" cellpadding="3px" cellspacing="3px">
<tr>
<td><b>Order</b></td>
<td><b>Item</b></td>
<td><b>Part Number</b></td>
<td><b>Cost</b></td>
<td><b>Quantity</b></td>
<td><b>Shipping</b></td>
<td><b>Total Cost</b></td>
</tr>
@foreach($items as $item)
<tr>
<td><a href="{{ URL::route('admin.order.manage',$item->OrderID) }}">ORD:{{$item->OrderID}}</a></td>
<td><a href="{{ $item->Link}}">{{$item->Name}}</a></td>
<td>{{ $item->PartNumber }}</td>
<td>${{ number_format($item->Cost,2) }}</td>
<td>{{ $item->Quantity }}</td>
<td>${{ number_format($item->Shipping,2) }}</td>
<td>${{ number_format($item->TotalCost,2) }}</td>
</tr>
@endforeach
</table>
<p>-The Ghost of IPRO Manager Ordering</p>
@stop
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInitfa8a7c0137ba3286d4c802f66991b0e8::getLoader();
return ComposerAutoloaderInitcb39d0333c8a78c0abf24e828c1ba152::getLoader();
6 changes: 1 addition & 5 deletions vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ class ClassLoader

public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}

return array();
return call_user_func_array('array_merge', $this->prefixesPsr0);
}

public function getPrefixesPsr4()
Expand Down
Loading

0 comments on commit b451a99

Please sign in to comment.