Skip to content

Commit

Permalink
fix: Define vars, use correct var
Browse files Browse the repository at this point in the history
  • Loading branch information
zooley committed Aug 1, 2023
1 parent 5a17c5d commit eafb158
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 512 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ public function update($id, Request $request)
$row->amount = $request->input('amount');

// Auto approve for orders less than 1000. Should not effect recurring orders.
if (config('orders.admin_user') && $submitter != config('orders.admin_user'))
if (config('orders.admin_user') && $row->order->submitteruserid != config('orders.admin_user'))
{
if ($row->amount > 5000 && $row->amount <= 100000)
{
Expand Down
6 changes: 3 additions & 3 deletions app/Modules/Orders/Http/Controllers/Api/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Modules\Orders\Http\Controllers\Api;

use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Http\JsonResponse;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Validator;
use App\Modules\Orders\Models\Product;
Expand Down Expand Up @@ -69,7 +69,7 @@ public function index(Request $request)
* }
* }
* @param Request $request
* @return Response|CartResource
* @return JsonResponse|CartResource
*/
public function create(Request $request)
{
Expand Down Expand Up @@ -188,7 +188,7 @@ public function read($id)
* }
* @param int $id
* @param Request $request
* @return Response|CartResource
* @return JsonResponse|CartResource
*/
public function update($id, Request $request)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function index(Request $request)

if ($filters['user'])
{
$query->where(function($where) use ($o)
$query->where(function($where) use ($o, $filters)
{
$where->where($o . '.userid', '=', $filters['user'])
->orWhere($o . '.submitteruserid', '=', $filters['user']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public function create(Request $request)
}
}

$row->datetimecreated = Carbon::now()->toDateTimeString();
$row->datetimecreated = Carbon::now();

if (!$row->save())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OrdersController extends Controller
/**
* Display a listing of the resource.
*
* @param Request $request
* @param StatefulRequest $request
* @return View|StreamedResponse
*/
public function index(StatefulRequest $request)
Expand Down Expand Up @@ -787,6 +787,7 @@ private function getSpreadsheetData($path)
$parts = explode('.', $path);
$extension = end($parts);
$extension = strtolower($extension);
$headers = array();

/*$handle = fopen($path, 'r');
Expand Down
1 change: 1 addition & 0 deletions app/Modules/Orders/Models/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* @property int $origorderitemid
* @property int $prevorderitemid
* @property int $quantity
* @property int $price
* @property int $origunitprice
* @property int $recurringtimeperiodid
* @property int $timeperiodcount
Expand Down
26 changes: 15 additions & 11 deletions app/Modules/Publications/Helpers/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,17 @@ class Download
* @param string $format
* @return void
*/
public function __construct(Publication $reference=null, $format='Bibtex')
public function __construct(Publication $reference = null, $format = 'Bibtex')
{
$this->setFormat($format);
$this->setReference($reference);
if ($format)
{
$this->setFormat($format);
}

if ($reference)
{
$this->setReference($reference);
}
}

/**
Expand Down Expand Up @@ -157,7 +164,7 @@ public function getExtension(): string
* @param string $format
* @return self
*/
public function setFormatter(Downloadable $formatter, $format=''): self
public function setFormatter(Downloadable $formatter, $format = ''): self
{
$format = ($format) ? $format : $this->_format;

Expand All @@ -172,7 +179,7 @@ public function setFormatter(Downloadable $formatter, $format=''): self
* @param string $format Format to get
* @return Downloadable|null
*/
public function getFormatter($format='')
public function getFormatter($format = '')
{
$format = ($format) ? $format : $this->_format;

Expand All @@ -186,14 +193,11 @@ public function getFormatter($format='')
* @return string
* @throws Exception
*/
public function formatReference($reference=null): string
public function formatReference($reference = null): string
{
if (!$reference)
{
$reference = $this->getReference();
}
$reference = $reference ?: $this->getReference();

if (!$reference || (!is_array($reference) && !is_object($reference)))
if (!$reference)
{
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/Publications/Helpers/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Formatter
/**
* Function to set the template keys the formatter will use
*
* @param array $template_keys
* @param array<string,string> $template_keys
* @return void
*/
public static function setTemplateKeys($template_keys): void
Expand Down
Loading

0 comments on commit eafb158

Please sign in to comment.