[WIP] Order process

This commit is contained in:
Ludovic CANDELLIER
2022-07-03 22:38:08 +02:00
parent bcb3e15f33
commit 06cfb92757
60 changed files with 1146 additions and 295 deletions

View File

@@ -133,7 +133,8 @@ class Debug
dump($msg);
}
if (self::isDebug()) {
if (!self::isDebug()){
return;}
if (static::isCLI()) {
self::dumpCli($msg, $cat);
}
@@ -143,7 +144,7 @@ class Debug
if (static::isClockwork()) {
self::dumpClockwork($msg, $cat);
}
}
}
public static function dumpDebugbar($msg, $cat = '', $force = false)

View File

@@ -75,12 +75,16 @@ class Export
if (isset($options[$key])) {
$txt = $options[$key][$txt];
}
if (isset($multioptions[$key])) {
if (!isset($multioptions[$key])){
$this->writeCell($this->lig, $col, $txt);
$this->nb++;
$col++;
continue;}
$tabs = self::getReverseMultiOptions($txt);
foreach ($tabs as $key2 => $value) {
$txt .= $multioptions[$key][$key2] . '\n';
}
}
$this->writeCell($this->lig, $col, $txt);
$this->nb++;
$col++;
@@ -114,7 +118,8 @@ class Export
public function close()
{
if (!$this->debug) {
if ($this->debug){
return;}
// Debug::message($this->xls);
$objWriter = PHPExcel_IOFactory::createWriter($this->xls, 'Excel2007');
// Debug::message($objWriter);
@@ -126,7 +131,7 @@ class Export
// $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$objWriter->save('text.xlsx');
}
}
}
public function conv($lig, $col)

View File

@@ -16,7 +16,6 @@ class File
public static function checkDir($dir)
{
// File::isDirectory($path)
return is_dir($dir);
}
@@ -27,8 +26,7 @@ class File
public static function createDir($dir)
{
Storage::makeDirectory($dir);
return true;
return mkdir($dir, '0777', true);
}
public static function deleteDir($dir)

View File

@@ -6,12 +6,15 @@ class Geolocation
{
public static function getCoords($address, $zipcode, $city)
{
if (!empty($address) && !empty($zipcode) && !empty($city)) {
if (!(!empty($address) && !empty($zipcode) && !empty($city))){
return;}
$address = $address . ' , ' . $city . ' ' . $zipcode . ' , ' . 'France';
$geocode = app('geocoder')->geocode($address)->get();
if (count($geocode)) {
if (!count($geocode)) {
return false;
}
$res = $geocode[0]->getCoordinates()->toArray();
// dump($res);
$longitude = $res[0];
@@ -20,11 +23,8 @@ class Geolocation
// dump($longitude);
// exit;
return ['latitude' => $latitude, 'longitude' => $longitude];
} else {
return false;
}
}
}
public static function autocomplete($query)
{

View File

@@ -50,7 +50,8 @@ class Item extends LavaryMenuItem
foreach ($routes as $pattern) {
$arr = [$pattern];
if (if_route_pattern($arr)) {
if (!if_route_pattern($arr)){
continue;}
$this->activate();
if (strstr($this->title, 'circle-o')) {
@@ -59,7 +60,6 @@ class Item extends LavaryMenuItem
// dump($this);
return $this;
}
}
return $this;
}

View File

@@ -9,7 +9,8 @@ class Menu extends LavaryMenu
{
public function make($name, $callback)
{
if (is_callable($callback)) {
if (!is_callable($callback)){
return;}
if (!array_key_exists($name, $this->menu)) {
$this->menu[$name] = new Builder($name, $this->loadConf($name));
}
@@ -25,5 +26,4 @@ class Menu extends LavaryMenu
return $this->menu[$name];
}
}
}

View File

@@ -13,15 +13,12 @@ class ShopCart
if (self::has($item['id'])) {
if ($update) {
self::remove($item['id']);
$ret = self::get()->add($item);
// $ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]);
self::get()->add($item);
} else {
$ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]);
// self::remove($item['id']);
// $ret = self::get()->add($item);
self::get()->update($item['id'], ['quantity' => $item['quantity']]);
}
} else {
$ret = self::get()->add($item);
self::get()->add($item);
}
return [
'count' => self::count(),
@@ -73,7 +70,12 @@ class ShopCart
public static function getTotal()
{
return number_format(round(self::get()->getTotal(),2),2);
return self::fixDecimal(self::get()->getTotal());
}
public static function fixDecimal($number)
{
return number_format(round($number, 2), 2);
}
public static function getItemQuantity($id)