[EP-tech] Re: Empty eprints when clicked "new item" but then "cancel"
Tim Brody
tdb2 at ecs.soton.ac.uk
Wed Sep 5 13:39:37 BST 2012
On Fri, 31 Aug 2012 14:05:48 +0200, Florian Heß
<hess at ub.uni-heidelberg.de>
wrote:
> Hello,
>
> I'd like to suggest that an eprint should be deleted right away if the
> user cancelled the workflow without filling in any required field, thus
> they won't clutter up their items page with spare entries to remove them
> by hand, just for convenience. I admit this case will not occur often
> once deployment is finished, but when it does, it can be quite annoying.
>
> Or could that be done with eprint_fields_automatic callback?
>
> $c->{eprint_fields_automatic} = sub {
> ...
> my %expected_fields = map { $_ => 1 } ...;
> my @set_fields = ...;
> defined || delete $expected_fields{$_} for @set_fields;
> $eprint->delete() if !%expected_fields;
> }
>
> Is deletion from within that callback safe and okay?
Hi,
This is a known requirement but not easy to achieve.
(Screens) EPrint::Edit needs to work out whether the eprint object is
unchanged from the object created in NewEPrint. That probably means setting
a flag in NewEPrint that is unset the first time you [Save] in Edit, but
otherwise triggers a delete() on [Cancel].
--
All the best,
Tim.
More information about the Eprints-tech
mailing list