mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
notes and some playing around, push for eod
This commit is contained in:
parent
6a7f3ecc2e
commit
e177993bcc
|
@ -195,6 +195,7 @@ class BulkAssetsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function update(Request $request)
|
public function update(Request $request)
|
||||||
{
|
{
|
||||||
|
//dd($request->all());
|
||||||
$this->authorize('update', Asset::class);
|
$this->authorize('update', Asset::class);
|
||||||
$has_errors = 0;
|
$has_errors = 0;
|
||||||
$error_array = array();
|
$error_array = array();
|
||||||
|
|
|
@ -58,6 +58,7 @@ class CustomFieldsetFactory extends Factory
|
||||||
{
|
{
|
||||||
return $this->afterCreating(function (CustomFieldset $fieldset) {
|
return $this->afterCreating(function (CustomFieldset $fieldset) {
|
||||||
if (empty($fields)) {
|
if (empty($fields)) {
|
||||||
|
//why are there two after creating and why does it break if i remove one
|
||||||
return $this->afterCreating(function (CustomFieldset $fieldset) {
|
return $this->afterCreating(function (CustomFieldset $fieldset) {
|
||||||
$mac_address = CustomField::factory()->macAddress()->create();
|
$mac_address = CustomField::factory()->macAddress()->create();
|
||||||
$ram = CustomField::factory()->ram()->create();
|
$ram = CustomField::factory()->ram()->create();
|
||||||
|
|
|
@ -86,17 +86,17 @@ class AssetsBulkEditTest extends TestCase
|
||||||
$ram = CustomField::factory()->ram()->create();
|
$ram = CustomField::factory()->ram()->create();
|
||||||
$cpu = CustomField::factory()->cpu()->create();
|
$cpu = CustomField::factory()->cpu()->create();
|
||||||
|
|
||||||
$assets = Asset::factory()->laptopMbp()->count(10)->hasMultipleCustomFields([$mac_address, $ram, $cpu])->create([
|
$assets = Asset::factory()->count(10)->hasMultipleCustomFields([$mac_address, $ram, $cpu])->create([
|
||||||
$ram->db_column => 8,
|
$ram->db_column => 8,
|
||||||
$cpu->db_column => '2.1',
|
$cpu->db_column => '2.1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// seems like the fieldset is random, so bulkedit isn't working because assets don't have the "correct" fieldset
|
||||||
|
// look into more tomorrow
|
||||||
|
dd(Asset::find(1)->model->fieldset);
|
||||||
|
|
||||||
$id_array = $assets->pluck('id')->toArray();
|
$id_array = $assets->pluck('id')->toArray();
|
||||||
|
|
||||||
// submits the ids and new values for each attribute
|
|
||||||
$asset = Asset::find(1);
|
|
||||||
|
|
||||||
$this->assertEquals(8, $asset->{$ram->db_column});
|
|
||||||
$this->actingAs(User::factory()->editAssets()->create())->post(route('hardware/bulksave'), [
|
$this->actingAs(User::factory()->editAssets()->create())->post(route('hardware/bulksave'), [
|
||||||
'ids' => $id_array,
|
'ids' => $id_array,
|
||||||
$ram->db_column => 16,
|
$ram->db_column => 16,
|
||||||
|
|
Loading…
Reference in a new issue