-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds drawn signature to asset acceptance #2846
Conversation
This is still a little broken - the history is displaying “Deleted user”, since there is no item type listed. Saving the item_type as App\Models\User tries to update accepted on the users table, which obviously doesn’t exist.
It shoudl fail if you’re not authorized since you’re not logged in, but better safe than sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts/opinions. Most of these are more me pondering what we do about actionlogs in the future than specifics here-
One thought I had when looking through this is whether declined acceptance should require a signature, or just accepting it. Presently it looks like it's both, but not sure that is what everyone will expect?
{ | ||
|
||
$file = config('app.private_uploads') . '/signatures/' . $filename; | ||
$filetype = Helper::checkUploadIsImage($file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to rename this helper method? I don't expect a "checkXisY" method to return anything but a boolean.
@@ -378,6 +380,9 @@ public function getActivityReportDataTable() | |||
} else { | |||
$activity_target = ''; | |||
} | |||
} elseif (($activity->action_type=='accepted') || ($activity->action_type=='declined')) { | |||
$activity_target = '<a href="' . route('view/user', $activity->item->assigneduser->id) . '">' . e($activity->item->assigneduser->fullName()) . '</a>'; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate from this... but I'm thinking maybe we want to go towards a Helper::generateHtmLinkFromItem($item) that does something like
return "a href=" . route("view/${metaprogramming_classname_somethigorother_from_item}", $item->id) . ">" . $item->displayableName . "</a>"
because we seem to do this so often... not sure if this is the best way though.. thoughts?
$encoded_image = explode(",", $data_uri); | ||
$decoded_image = base64_decode($encoded_image[1]); | ||
file_put_contents($path."/".$sig_filename, $decoded_image); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another place that has a lot of specifics about file writing.. . should we abstract these bits to a method or just wait for the 5.3 switch where laravel does it for us?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually--don't we have access to a Symfony uploadedFile instance here? That would let us use move() and guessFileExtension() and things like that.
$logaction->note = e(Input::get('note')); | ||
$logaction->user_id = $user->id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this an intentional removal of the user ID? Hard to tell from this context, just want to make sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user_id has typically been a strictly admin id (it's how to populate "Admin" everywhere). There is no admin involved in the acceptance of a asset. It sort of doesn't make any sense to make them a target either, but everywhere else, user_id = admin actor
@@ -91,15 +90,14 @@ public function parentlog() | |||
/** | |||
* Check if the file exists, and if it does, force a download | |||
**/ | |||
public function get_src($type = 'assets') | |||
public function get_src($type = 'assets', $fieldname = 'filename') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seemed like a strange place for this method to exist to me when I was polymorphicating everything, but I was afraid to touch it... also unclear exactly what the method does when looking at it quickly. Does associating files with a log in general make sense? (The signatures do, wondering about the asset files)--Not really related to your sig, just a ponder I had when staring at all this code a few weeks ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have them in the log action table strictly for ease of use when displaying history stuff. Otherwise we'll end up pulling in pivot tables for uploads, etc.
{ | ||
Schema::table('settings', function ($table) { | ||
$table->dropColumn('require_accept_signature'); | ||
$table->dropColumn('accept_signature'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line shouldn't exist, right? It belongs to the action_logs table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, you're right - good catch, thanks!
</div> | ||
@endif | ||
|
||
@if (\App\Models\Setting::getSettings()->require_accept_signature=='1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if we want to look at injecting settings globally, could be nice to always have access to a $settings variables in views to clean this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easy enough to do via middleware, but I think we'd still need something like $request->settings->blah, which doesn't seem shorter. We cache the value of the settings query at least, so we're not running it every time we need a setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we can use the hard to find view()->share() method in an app service provider to share a value with all views... https://laravel.com/docs/5.3/views#passing-data-to-views
I could see this getting confusing if we had to many of these, wonder if making a global settings() or snipeSettings() variable would be more clear.
These are all good suggestions, but most are not directly related to this PR :) Thanks for taking a look. |
* Adds digital signature to asset acceptance This is still a little broken - the history is displaying “Deleted user”, since there is no item type listed. Saving the item_type as App\Models\User tries to update accepted on the users table, which obviously doesn’t exist. * Use asset facade for folks in subdirs * Possible fix for weird accepted/declined display * Display signature in modal popup if sigs are required * Wrap that display file in auth middleware, just to be sure. It shoudl fail if you’re not authorized since you’re not logged in, but better safe than sorry * Fixed header section of layout * Removed extra drop from migration rollback
* Adds digital signature to asset acceptance This is still a little broken - the history is displaying “Deleted user”, since there is no item type listed. Saving the item_type as App\Models\User tries to update accepted on the users table, which obviously doesn’t exist. * Use asset facade for folks in subdirs * Possible fix for weird accepted/declined display * Display signature in modal popup if sigs are required * Wrap that display file in auth middleware, just to be sure. It shoudl fail if you’re not authorized since you’re not logged in, but better safe than sorry * Fixed header section of layout * Removed extra drop from migration rollback
No description provided.