@@ -1081,70 +1081,73 @@ public function postBulkEdit(Request $request)
10811081 * @internal param array $assets
10821082 * @since [v2.0]
10831083 */
1084- public function postBulkSave ()
1084+ public function postBulkSave (Request $ request )
10851085 {
10861086 $ this ->authorize ('update ' , Asset::class);
1087- if (Input::has ('ids ' )) {
1088- $ assets = Input::get ('ids ' );
1089- if ((Input::has ('purchase_date ' ))
1090- || (Input::has ('purchase_cost ' ))
1091- || (Input::has ('supplier_id ' ))
1092- || (Input::has ('order_number ' ))
1093- || (Input::has ('warranty_months ' ))
1094- || (Input::has ('rtd_location_id ' ))
1095- || (Input::has ('requestable ' ))
1096- || (Input::has ('company_id ' ))
1097- || (Input::has ('status_id ' ))
1098- || (Input::has ('model_id ' ))
1087+
1088+ \Log::debug ($ request ->input ('ids ' ));
1089+
1090+ if (($ request ->has ('ids ' )) && (count ($ request ->input ('ids ' ) > 0 ))) {
1091+ $ assets = $ request ->input ('ids ' );
1092+ if (($ request ->has ('purchase_date ' ))
1093+ || ($ request ->has ('purchase_cost ' ))
1094+ || ($ request ->has ('supplier_id ' ))
1095+ || ($ request ->has ('order_number ' ))
1096+ || ($ request ->has ('warranty_months ' ))
1097+ || ($ request ->has ('rtd_location_id ' ))
1098+ || ($ request ->has ('requestable ' ))
1099+ || ($ request ->has ('company_id ' ))
1100+ || ($ request ->has ('status_id ' ))
1101+ || ($ request ->has ('model_id ' ))
10991102 ) {
11001103 foreach ($ assets as $ key => $ value ) {
11011104 $ update_array = array ();
11021105
1103- if (Input:: has ('purchase_date ' )) {
1104- $ update_array ['purchase_date ' ] = e (Input:: get ( 'purchase_date ' ) );
1106+ if ($ request -> has ('purchase_date ' )) {
1107+ $ update_array ['purchase_date ' ] = $ request -> input ( 'purchase_date ' );
11051108 }
1106- if (Input:: has ('purchase_cost ' )) {
1107- $ update_array ['purchase_cost ' ] = Helper::ParseFloat (e (Input:: get ( 'purchase_cost ' ) ));
1109+ if ($ request -> has ('purchase_cost ' )) {
1110+ $ update_array ['purchase_cost ' ] = Helper::ParseFloat ($ request -> input ( 'purchase_cost ' ));
11081111 }
1109- if (Input:: has ('supplier_id ' )) {
1110- $ update_array ['supplier_id ' ] = e (Input:: get ( 'supplier_id ' ) );
1112+ if ($ request -> has ('supplier_id ' )) {
1113+ $ update_array ['supplier_id ' ] = $ request -> input ( 'supplier_id ' );
11111114 }
1112- if (Input:: has ('model_id ' )) {
1113- $ update_array ['model_id ' ] = e (Input:: get ( 'model_id ' ) );
1115+ if ($ request -> has ('model_id ' )) {
1116+ $ update_array ['model_id ' ] = $ request -> input ( 'model_id ' );
11141117 }
1115- if (Input:: has ('company_id ' )) {
1116- if (Input:: get ('company_id ' )=="clear " ) {
1118+ if ($ request -> has ('company_id ' )) {
1119+ if ($ request -> input ('company_id ' )=="clear " ) {
11171120 $ update_array ['company_id ' ] = null ;
11181121 } else {
1119- $ update_array ['company_id ' ] = e (Input:: get ( 'company_id ' ) );
1122+ $ update_array ['company_id ' ] = $ request -> input ( 'company_id ' );
11201123 }
11211124 }
1122- if (Input:: has ('order_number ' )) {
1123- $ update_array ['order_number ' ] = e (Input:: get ( 'order_number ' ) );
1125+ if ($ request -> has ('order_number ' )) {
1126+ $ update_array ['order_number ' ] = $ request -> input ( 'order_number ' );
11241127 }
1125- if (Input:: has ('warranty_months ' )) {
1126- $ update_array ['warranty_months ' ] = e (Input:: get ( 'warranty_months ' ) );
1128+ if ($ request -> has ('warranty_months ' )) {
1129+ $ update_array ['warranty_months ' ] = $ request -> input ( 'warranty_months ' );
11271130 }
1128- if (Input:: has ('rtd_location_id ' )) {
1129- $ update_array ['rtd_location_id ' ] = e (Input:: get ( 'rtd_location_id ' ) );
1131+ if ($ request -> has ('rtd_location_id ' )) {
1132+ $ update_array ['rtd_location_id ' ] = $ request -> input ( 'rtd_location_id ' );
11301133 }
1131- if (Input:: has ('status_id ' )) {
1132- $ update_array ['status_id ' ] = e (Input:: get ( 'status_id ' ) );
1134+ if ($ request -> has ('status_id ' )) {
1135+ $ update_array ['status_id ' ] = $ request -> input ( 'status_id ' );
11331136 }
1134- if (Input:: has ('requestable ' )) {
1135- $ update_array ['requestable ' ] = e (Input:: get ( 'requestable ' ) );
1137+ if ($ request -> has ('requestable ' )) {
1138+ $ update_array ['requestable ' ] = $ request -> input ( 'requestable ' );
11361139 }
11371140
11381141 DB ::table ('assets ' )
11391142 ->where ('id ' , $ key )
11401143 ->update ($ update_array );
11411144 } // endforeach
1142- return redirect ()->to ("hardware " )->with ('success ' , trans ('admin/hardware/message.update.success ' ));
1145+ return redirect ()->route ("hardware.index " )->with ('success ' , trans ('admin/hardware/message.update.success ' ));
11431146 // no values given, nothing to update
11441147 }
1145- return redirect ()->to ("hardware " )->with ('info ' , trans ('admin/hardware/message.update.nothing_updated ' ));
1148+ return redirect ()->route ("hardware.index " )->with ('warning ' , trans ('admin/hardware/message.update.nothing_updated ' ));
11461149 } // endif
1147- return redirect ()->to ("hardware " );
1150+ return redirect ()->route ("hardware.index " )-> with ( ' warning ' , trans ( ' No assets selected, so nothing was updated. ' ) );
11481151 }
11491152
11501153 /**
0 commit comments