preorderaddressreporting permission; preorder split script updated
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<?php
|
||||
|
||||
//require 'vendor/autoload.php';
|
||||
require("../config/config.php");
|
||||
require("../../config/config.php");
|
||||
|
||||
define('FRONKDB_SQLDEBUG',false);
|
||||
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||
@@ -38,16 +38,28 @@ foreach(PreorderModel::search(["deleted" => 0, "preordercampaign_id" => $campaig
|
||||
continue;
|
||||
}
|
||||
|
||||
$available_units = [];
|
||||
//if($preorder->id == 920) {var_dump($wohneinheiten);exit;}
|
||||
|
||||
$available_units = [];
|
||||
$additional_units = []; // to sort non-specific units last
|
||||
foreach($wohneinheiten as $unit) {
|
||||
if(!PreorderModel::getFirst(["adb_wohneinheit_id" => $unit->id])) {
|
||||
if(!PreorderModel::getFirst(["adb_wohneinheit_id" => $unit->id, "deleted" => 0])) {
|
||||
if($unit->tuer || preg_match('/^Top\s+\d+$/', $unit->zusatz)) {
|
||||
$available_units[] = $unit;
|
||||
} else {
|
||||
$additional_units[] = $unit;
|
||||
}
|
||||
} else {
|
||||
echo $preorder->id." balh\n";
|
||||
}
|
||||
}
|
||||
|
||||
if(count($additional_units)) $available_units = array_merge($available_units, $additional_units);
|
||||
/*if($preorder->id == 2441) {
|
||||
var_dump($available_units);exit;
|
||||
}*/
|
||||
|
||||
|
||||
if($preorder->connection_count > count($available_units)) {
|
||||
$md = [];
|
||||
$md["unit_count"] = $unit_count;
|
||||
@@ -72,7 +84,6 @@ foreach(PreorderModel::search(["deleted" => 0, "preordercampaign_id" => $campaig
|
||||
$new_preorder->connection_count = 1;
|
||||
$new_preorder->adb_wohneinheit_id = $available_units[$i]->id;
|
||||
$new_preorder->oaid = $available_units[$i]->oaid;
|
||||
//var_dump($new_preorder);exit;
|
||||
$new_preorder->save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user