[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: missing date..
For everyone ever wondering how to change the key of a db entry: add this to
your minivend.cfg:
---snip---
UserTag change-key Order table from to
UserTag change-key AddAttr
UserTag change-key Routine <<EOR
sub {
my ($table, $from, $to, $opt) = @_;
my $db = Vend::Data::database_exists_ref($table)
or return undef;
$db = $db->ref();
return undef if $db->record_exists($to) and ! $opt->{force};
eval {
my @fields = $db->row($from);
$db->set_row($to, @fields);
$db->delete_record($from) unless $opt->{copy};
};
if($@) {
::logError($@);
return undef;
}
return 1;
}
EOR
---snip---
Seemed like a nice little tag to use, instead for example delete the record
first, with a function I posted a while ago, and the recreate a record with
the new key, all by hand.
-Gideon