Skip to content

Commit

Permalink
fix(edit_asset): force proper checkout (#68)
Browse files Browse the repository at this point in the history
closes: #44
  • Loading branch information
drahamim authored Oct 14, 2023
1 parent fc25243 commit b9e1b65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/invenflask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,21 @@ def edit_asset(id):
asset_type = request.form['asset_type']
asset_status = request.form['asset_status']
conn = get_db()
old_record = get_asset(id, "edit")
if old_record['asset_status'].lower() != asset_status.lower():
if asset_status == 'checkedout':
flash('Manual checkeouts without staff ID not allowed', "warnin")
return redirect(url_for('checkout'))
conn.execute('UPDATE assets SET asset_type = ?, asset_status = ?'
' WHERE id = ?', (asset_type, asset_status, id))
conn.commit()
flash("YOU WANKER")
return redirect(url_for('status'))
if request.method == 'GET':
conn = get_db()
asset = get_asset(id, "edit")
asset_types = conn.execute(
'Select DISTINCT(asset_type) from assets').fetchall()
print(asset_types)
return render_template('edit_asset.html', asset=asset, asset_types=asset_types)


Expand Down

0 comments on commit b9e1b65

Please sign in to comment.