},{
($limit ? (limit => $limit) : ()),
($offset ? (offset => $offset) : ()),
- flesh => 3, flesh_fields => {acsp => ['patron'], au => ['card','standing_penalties'], ausp => ['standing_penalty']},
+ flesh => 3, flesh_fields => {acsp => ['patron','stage_staff'], au => ['card','standing_penalties'], ausp => ['standing_penalty']},
order_by => { acsp => 'slot' }
}]);
{ class => acsp => field => slot => direction => 'desc' },
{ class => acsp => field => id => direction => 'desc' }
]
- }],{ idlist => 1 });
+ }]);
- return md5_hex( join(',', @$slots) );
+ return md5_hex( join(',', map { join('-', $_->id(), $_->stage_staff() // '') } @$slots) );
}
__PACKAGE__->register_method(
method => "fetch_latest_to_be_staged",
}
);
+sub manage_staging_claim {
+ my ($self, $conn, $authtoken, $appointment) = @_;
+ my $e = new_editor(xact => 1, authtoken => $authtoken);
+ return $e->die_event unless $e->checkauth;
+ return $e->die_event unless $e->allowed("STAFF_LOGIN");
+
+ my $slot = $e->retrieve_action_curbside($appointment);
+ return undef unless ($slot);
+
+ if ($self->api_name =~ /unclaim/) {
+ $slot->clear_stage_staff();
+ } else {
+ $slot->stage_staff($e->requestor->id);
+ }
+
+ $e->update_action_curbside($slot) or return $e->die_event;
+ $e->commit;
+
+ return $e->retrieve_action_curbside([
+ $slot->id, {
+ flesh => 3,
+ flesh_fields => {acsp => ['patron','stage_staff'], au => ['card','standing_penalties'], ausp => ['standing_penalty']},
+ }
+ ]);
+}
+__PACKAGE__->register_method(
+ method => "manage_staging_claim",
+ api_name => "open-ils.curbside.claim_staging",
+ signature => {
+ params => [
+ {type => 'string', desc => 'Authentication token'},
+ {type => 'number', desc => 'Appointment ID'},
+ ],
+ return => { desc => 'Appointment on success, nothing when no appointment found, '.
+ 'an ILS Event on permission error'}
+ }
+);
+__PACKAGE__->register_method(
+ method => "manage_staging_claim",
+ api_name => "open-ils.curbside.unclaim_staging",
+ signature => {
+ params => [
+ {type => 'string', desc => 'Authentication token'},
+ {type => 'number', desc => 'Appointment ID'},
+ ],
+ return => { desc => 'Appointment on success, nothing when no appointment found, '.
+ 'an ILS Event on permission error'}
+ }
+);
+
sub mark_staged {
my ($self, $conn, $authtoken, $appointment) = @_;
my $e = new_editor(xact => 1, authtoken => $authtoken);