/usr/share/libalzabo-perl/mason/widgets/update is in libalzabo-perl 0.92-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <%doc>
=pod
=head1 NAME
update
=head1 SYNOPSIS
<& update, table => $table, %ARGS &>
=head1 DESCRIPTION
A simple widget to perform an update based on the values of %ARGS.
=head1 PARAMETERS
=over 4
=item * table
An <Alzabo::Table> object which contains the row to be updated
=back
The rest of the arguments should simply be the C<%ARGS> hash as passed
to the calling component. This component will extract the relevant
column values from that hash.
=head1 RETURNS
The row just updated is returned from this component.
=cut
</%doc>
<%args>
$table
</%args>
<%init>
my %data;
my %pk;
foreach my $c ( $table->primary_key )
{
$pk{ $c->name } = $ARGS{ $c->name };
}
foreach my $c ( $table->columns )
{
$data{ $c->name } = $ARGS{ $c->name }
if exists $ARGS{ $c->name };
}
my $row = $table->row_by_primary_key( pk => \%pk );
$row->update(%data);
return $row;
</%init>
|