Merge branch 'fronkdev' into 'master'
Added Preorder discount code import and statusupdate import See merge request fronk/thetool!392
This commit is contained in:
64
Layout/default/Preorder/Statusupdateimport.php
Normal file
64
Layout/default/Preorder/Statusupdateimport.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
|
||||
<li class="breadcrumb-item active">Vorbestellung</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Statusupdates importieren</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2">Statusupdates importieren</h4>
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("Preorder", "saveStatusupdateimport")?>" enctype="multipart/form-data">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="statusupdate_csv">Statusupdate CSV</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="file" class="form-control" name="statusupdate_csv" />
|
||||
<small>Format: <span class="text-monospace">OAID;Neuer Status Code</span></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label"></label>
|
||||
<div class="col-lg-10">
|
||||
<label>
|
||||
<input type="checkbox" value="1" name="headline" />
|
||||
Erste Zeile enthält Überschrift
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" class="btn btn-primary">Importieren</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
@@ -143,6 +143,25 @@
|
||||
<td><?=($preorder->address_info == "address") ? "Anschlussadresse" : "Kontaktadresse"?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php if($preorder->discounts): ?>
|
||||
<h3>Gutscheincodes</h3>
|
||||
<table class="table table-sm table-striped">
|
||||
<tr>
|
||||
<th>Code</th>
|
||||
<th>Zugewiesen</th>
|
||||
<th>Info</th>
|
||||
</tr>
|
||||
<?php foreach($preorder->discounts as $discount): ?>
|
||||
<tr>
|
||||
<td class="text-monospace"><?=$discount->code?></td>
|
||||
<td class="text-monospace"><?=date("d.m.Y H:i", $discount->assigned)?></td>
|
||||
<td><?=htmlentities($discount->info)?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
@@ -398,12 +417,12 @@
|
||||
data-default="<?=($preorder->adb_wohneinheit->patch_cluster) ? $preorder->adb_wohneinheit->patch_cluster : $preorder->adb_hausnummer->netzgebiet->extref?>"
|
||||
/></td>
|
||||
</tr><tr>
|
||||
<th>Shelf:</td>
|
||||
<th>Shelf:</th>
|
||||
<td><input type="text" class="form-control" name="patch_shelf"
|
||||
data-default="<?=$preorder->adb_wohneinheit->patch_shelf?>"
|
||||
/></td>
|
||||
</tr><tr>
|
||||
<th>Module:</td>
|
||||
<th>Module:</th>
|
||||
<td><input type="text" class="form-control" name="patch_module"
|
||||
data-default="<?=$preorder->adb_wohneinheit->patch_module?>"
|
||||
/></td>
|
||||
|
||||
64
Layout/default/PreorderDiscount/Import.php
Normal file
64
Layout/default/PreorderDiscount/Import.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
|
||||
<li class="breadcrumb-item active">Vorbestellung</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Gutscheincodes importieren</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2">Gutscheincodes importieren</h4>
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("PreorderDiscount", "saveImport")?>" enctype="multipart/form-data">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="discount_csv">Gutscheincode CSV</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="file" class="form-control" name="discount_csv" />
|
||||
<small>Format: <span class="text-monospace">OAID;Gutscheincode</span></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label"></label>
|
||||
<div class="col-lg-10">
|
||||
<label>
|
||||
<input type="checkbox" value="1" name="headline" />
|
||||
Erste Zeile enthält Überschrift
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2"></label>
|
||||
<div class="col-lg-10">
|
||||
<button type="submit" class="btn btn-primary">Importieren</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
@@ -74,8 +74,17 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if($me->address_id == 1 || $me->address_id == 4807): // xinon, rml ?>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<a class="btn btn-purple" href="<?=self::getUrl("PreorderDiscount", "import")?>"><i class="fas fa-tags fa-fw"></i> Gutscheincodes importieren</a>
|
||||
<a class="btn btn-purple ml-1" href="<?=self::getUrl("Preorder", "statusupdateimport")?>"><i class="fas fa-retweet fa-fw"></i> Statusupdates importieren</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="float-left">
|
||||
|
||||
@@ -7,6 +7,8 @@ class Preorder extends mfBaseModel {
|
||||
private $status;
|
||||
private $campaign;
|
||||
private $partner;
|
||||
private $discounts;
|
||||
private $applied_discounts;
|
||||
private $building;
|
||||
private $adb_hausnummer;
|
||||
private $adb_wohneinheit;
|
||||
@@ -623,7 +625,23 @@ class Preorder extends mfBaseModel {
|
||||
}
|
||||
return $this->partner;
|
||||
}
|
||||
|
||||
|
||||
if($name == "discounts") {
|
||||
$discounts = PreorderDiscountModel::search(["preorder_id" => $this->id]);
|
||||
if($discounts) {
|
||||
$this->discounts = $discounts;
|
||||
}
|
||||
return $this->discounts;
|
||||
}
|
||||
|
||||
if($name == "applied_discounts") {
|
||||
$discounts = PreorderDiscountModel::search(["preorder_id" => $this->id, "assigned" => true]);
|
||||
if($discounts) {
|
||||
$this->discounts = $discounts;
|
||||
}
|
||||
return $this->discounts;
|
||||
}
|
||||
|
||||
if($name == "building") {
|
||||
$this->building = mfValuecache::singleton()->get("mfObjectmodel-Building-".$this->building_id);
|
||||
if(!$this->building) {
|
||||
|
||||
@@ -756,7 +756,83 @@ class PreorderController extends mfBaseController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function statusupdateimport() {
|
||||
$this->layout()->setTemplate("Preorder/Statusupdateimport");
|
||||
}
|
||||
|
||||
protected function saveStatusupdateimport() {
|
||||
$headline_included = $this->request->headline;
|
||||
|
||||
if(is_array($_FILES) && array_key_exists("statusupdate_csv", $_FILES) && !$_FILES['statusupdate_csv']['error']) {
|
||||
// look for uploaded import file
|
||||
try {
|
||||
// returns File object or throws Exception on error
|
||||
$file = mfUpload::handleFormUpload("statusupdate_csv");
|
||||
} catch(Exception $ex) {
|
||||
$this->layout()->setFlash("Fehler beim Dateiupload: " . $ex->getMessage(), "error");
|
||||
$this->redirect("Preorder", "statusupdateimport");
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$notfound = 0;
|
||||
$invalidcode = 0;
|
||||
$nochange = 0;
|
||||
$saved = 0;
|
||||
|
||||
$filename = $file->getFullPath();
|
||||
$input = fopen($filename, "r");
|
||||
while($csv = fgetcsv($input, 0, ";")) {
|
||||
$i++;
|
||||
if($i == 1 && $headline_included) continue;
|
||||
|
||||
if(!trim($csv[0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$oaid = trim($csv[0]);
|
||||
$new_status_code = trim($csv[1]);
|
||||
|
||||
$preorder = PreorderModel::getFirstActive(["oaid" => $oaid]);
|
||||
if(!$preorder) {
|
||||
$notfound++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if($preorder->status->code != $new_status_code) {
|
||||
$new_status = PreorderstatusModel::getFirst(["code" => $new_status_code]);
|
||||
if(!$new_status_code) {
|
||||
$invalidcode++;
|
||||
continue;
|
||||
}
|
||||
$preorder->status_id = $new_status->id;
|
||||
$preorder->save();
|
||||
$saved++;
|
||||
} else {
|
||||
$nochange++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$message = "Import erfolgreich. $saved Statusupdates importiert";
|
||||
if($notfound) {
|
||||
$message .= "<br />$notfound Bestellungen nicht gefunden";
|
||||
}
|
||||
if($nochange) {
|
||||
$message .= "<br />$nochange Bestelllungen haben bereits den neuen Status";
|
||||
}
|
||||
if($invalidcode) {
|
||||
$message .= "<br />$invalidcode ungültige Statuscodes";
|
||||
}
|
||||
$this->layout()->setFlash($message);
|
||||
$this->redirect("Preorder", "statusupdateimport");
|
||||
|
||||
} else {
|
||||
$this->layout()->setFlash("Nichts importiert!", "info");
|
||||
$this->redirect("Preorder", "statusupdateimport");
|
||||
}
|
||||
}
|
||||
|
||||
protected function exportAction() {
|
||||
$rfilter = $this->request->filter;
|
||||
if(!is_array($rfilter)) {
|
||||
|
||||
45
application/PreorderDiscount/PreorderDiscount.php
Normal file
45
application/PreorderDiscount/PreorderDiscount.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
class PreorderDiscount extends mfBaseModel {
|
||||
protected $forcestr = ['code'];
|
||||
private $preorder;
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "creator") {
|
||||
$user = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($user) {
|
||||
$this->creator = $user;
|
||||
return $this->creator;
|
||||
}
|
||||
$this->creator = new User($this->create_by);
|
||||
if($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if($name == "editor") {
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name."_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
|
||||
if(!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
}
|
||||
93
application/PreorderDiscount/PreorderDiscountController.php
Normal file
93
application/PreorderDiscount/PreorderDiscountController.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
class PreorderDiscountController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->needlogin=true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->is(["Admin", "netowner", "salespartner", "preorderfront"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function importAction() {
|
||||
$this->layout()->setTemplate("PreorderDiscount/Import");
|
||||
}
|
||||
|
||||
protected function saveImport() {
|
||||
$headline_included = $this->request->headline;
|
||||
|
||||
if(is_array($_FILES) && array_key_exists("discount_csv", $_FILES) && !$_FILES['discount_csv']['error']) {
|
||||
// look for uploaded import file
|
||||
try {
|
||||
// returns File object or throws Exception on error
|
||||
$file = mfUpload::handleFormUpload("discount_csv");
|
||||
} catch(Exception $ex) {
|
||||
$this->layout()->setFlash("Fehler beim Dateiupload: " . $ex->getMessage(), "error");
|
||||
$this->redirect("PreorderDiscount", "import");
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$notfound = 0;
|
||||
$exists = 0;
|
||||
$saved = 0;
|
||||
|
||||
$filename = $file->getFullPath();
|
||||
$input = fopen($filename, "r");
|
||||
while($csv = fgetcsv($input, 0, ";")) {
|
||||
$i++;
|
||||
if($i == 1 && $headline_included) continue;
|
||||
|
||||
if(!trim($csv[0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$oaid = trim($csv[0]);
|
||||
$code = trim($csv[1]);
|
||||
|
||||
$preorder = PreorderModel::getFirstActive(["oaid" => $oaid]);
|
||||
if(!$preorder) {
|
||||
$notfound++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$discount_code = PreorderDiscountModel::getFirst(["code" => $code, "preorer_id" => $preorder->id]);
|
||||
if($discount_code) {
|
||||
$exists++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$discount_code = PreorderDiscountModel::create([
|
||||
"code" => $code,
|
||||
"preorder_id" => $preorder->id,
|
||||
"assigned" => date('U')
|
||||
]);
|
||||
|
||||
if(!$discount_code->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern!", "error");
|
||||
$this->redirect("PreorderDiscount", "import");
|
||||
}
|
||||
|
||||
$saved++;
|
||||
}
|
||||
|
||||
$message = "Import erfolgreich. $saved Gutscheincodes importiert";
|
||||
if($notfound) {
|
||||
$message .= "<br />$notfound Bestellungen nicht gefunden";
|
||||
}
|
||||
if($exists) {
|
||||
$message .= "<br />$exists Gutscheincodes schon verknüpft";
|
||||
}
|
||||
$this->layout()->setFlash($message);
|
||||
$this->redirect("PreorderDiscount", "import");
|
||||
|
||||
} else {
|
||||
$this->layout()->setFlash("Nichts importiert!", "info");
|
||||
$this->redirect("PreorderDiscount", "import");
|
||||
}
|
||||
}
|
||||
}
|
||||
153
application/PreorderDiscount/PreorderDiscountModel.php
Normal file
153
application/PreorderDiscount/PreorderDiscountModel.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
class PreorderDiscountModel {
|
||||
public $preorder_id;
|
||||
public $code;
|
||||
public $info;
|
||||
public $assigned;
|
||||
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
public static function create(Array $data) {
|
||||
$model = new PreorderDiscount();
|
||||
|
||||
foreach($data as $field => $value) {
|
||||
if(property_exists(get_called_class(), $field)) {
|
||||
$model ->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
|
||||
if($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("PreorderDiscount", "*", "1 = 1 ORDER BY code");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new PreorderDiscount($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT PreorderDiscount.* FROM PreorderDiscount
|
||||
WHERE $where
|
||||
LIMIT 1";
|
||||
//var_dump($sql);exit;
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new PreorderDiscount($data);
|
||||
if($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUT(*) as cnt FROM PreorderDiscount
|
||||
WHERE $where
|
||||
";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function search($filter, $limit = false) {
|
||||
//var_dump($filter);exit;
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT PreorderDiscount.* FROM PreorderDiscount
|
||||
WHERE $where
|
||||
ORDER BY code";
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[$data->id] = new PreorderDiscount($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
if(array_key_exists("preorder_id", $filter)) {
|
||||
$preorder_id = $filter['preorder_id'];
|
||||
if(is_numeric($preorder_id)) {
|
||||
$where .= " AND PreorderDiscount.`preorder_id` = $preorder_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("code", $filter)) {
|
||||
$code = $db->escape($filter['code']);
|
||||
if($code) {
|
||||
$where .= " AND PreorderDiscount.`code` = '$code'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("assigned", $filter)) {
|
||||
$assigned = $filter['assigned'];
|
||||
if($assigned === true) {
|
||||
$where .= " AND PreorderDiscount.`assigned` > 0";
|
||||
}
|
||||
if($assigned === false || $assigned === null) {
|
||||
$where .= " AND (PreorderDiscount.`assigned` IS NULL OR PreorderDiscount.`assigned` = 0)";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
39
db/migrations/20240604132904_create_preorder_discount.php
Normal file
39
db/migrations/20240604132904_create_preorder_discount.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreatePreorderDiscount extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("PreorderDiscount");
|
||||
$table->addColumn("preorder_id", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("code", "string", ["null" => false, "limit" => 64]);
|
||||
$table->addColumn("info", "string", ["null" => true, "default" => null, "limit" => 1024]);
|
||||
$table->addColumn("assigned", "integer", ["null" => true, "default" => null]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->create();
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("PreorderDiscount")->drop()->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,6 +202,13 @@ class mfBaseController
|
||||
return FronkDB::singleton($dbhost, $dbuser, $dbpass, $dbname);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $mod
|
||||
* @param $action
|
||||
* @param $params
|
||||
* @param $anker
|
||||
* @return never-returns
|
||||
*/
|
||||
public static function redirect($mod = false, $action = false, $params = false, $anker = false)
|
||||
{
|
||||
//var_dump($mod);
|
||||
|
||||
Reference in New Issue
Block a user