| 1 | package CGI::Lazy::Widget::Dataset; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use JavaScript::Minifier qw(minify); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use CGI::Lazy::Globals; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Tie::IxHash; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use base qw(CGI::Lazy::Widget); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 1 | our $tableCaptionVar = "CAPTION"; | |||||||||||||||||||||||||||||||
| 13 | 1 | our $headingItemVar = "HEADING.ITEM."; | |||||||||||||||||||||||||||||||
| 14 | 1 | our $bodyRowLoopVar = "ROW.LOOP"; | |||||||||||||||||||||||||||||||
| 15 | 1 | our $bodyRowName = "ROW"; | |||||||||||||||||||||||||||||||
| 16 | 1 | our $surroundingDivName = "DIV.MAIN"; | |||||||||||||||||||||||||||||||
| 17 | 1 | our $deleteID = "DELETE.ID"; | |||||||||||||||||||||||||||||||
| 18 | 1 | our $deleteFlag = "DELETE.FLAG"; | |||||||||||||||||||||||||||||||
| 19 | 1 | our $deletename; | |||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub buildCheckbox { | ||||||||||||||||||||||||||||||
|
Subroutine
buildCheckbox: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 24 | 0 | my $fieldname = shift; | |||||||||||||||||||||||||||||||
| 25 | 0 | my $webcontrol = shift; | |||||||||||||||||||||||||||||||
| 26 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | if ($webcontrol->{value}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ($value eq $webcontrol->{value}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 30 | 0 | return ($webcontrol->{value}, ' checked '); | |||||||||||||||||||||||||||||||
| 31 | } else { | ||||||||||||||||||||||||||||||||
| 32 | 0 | return ($webcontrol->{value}); | |||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||
| 35 | } elsif ($webcontrol->{sql}) { | ||||||||||||||||||||||||||||||||
| 36 | 0 | my ($query, @binds) = @{$webcontrol->{sql}}; | |||||||||||||||||||||||||||||||
| 37 | 0 | my $lookupvalue = $self->q->db->get($query, @binds); | |||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | if ($value eq $lookupvalue) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 40 | 0 | return ($lookupvalue, ' checked '); | |||||||||||||||||||||||||||||||
| 41 | } else { | ||||||||||||||||||||||||||||||||
| 42 | 0 | return ($lookupvalue); | |||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub buildHeadings { | ||||||||||||||||||||||||||||||
|
Subroutine
buildHeadings: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 49 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | $deletename = $self->vars->{deleteName} || 'Delete'; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->vars->{'deleteName'} || 'Delete'
MC/DC0%0/1
$self->vars->{'deleteName'} || 'Delete'
$self->vars->{'deleteName'}
Truth table0%0/2
A
A= $self->vars->{'deleteName'}
| |||||||||||||||||||||||||||||||||
| 52 | 0 | my $headings = {}; | |||||||||||||||||||||||||||||||
| 53 | 0 | my $recset = $self->recordset; | |||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | 0 | $headings->{$headingItemVar.$_} = $recset->label($_) for $recset->visibleFields; | |||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | $headings->{$headingItemVar."DELETE"} = $deletename unless $self->vars->{nodelete}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||
| 58 | 0 | return $headings; | |||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub buildSelect { | ||||||||||||||||||||||||||||||
|
Subroutine
buildSelect: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 63 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 64 | 0 | my $fieldname = shift; | |||||||||||||||||||||||||||||||
| 65 | 0 | my $webcontrol = shift; | |||||||||||||||||||||||||||||||
| 66 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | 0 | my $list = []; | |||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 0 | my $vals = {}; | |||||||||||||||||||||||||||||||
| 71 | 0 | tie %$vals, 'Tie::IxHash'; | |||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ($webcontrol->{values} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if (ref $webcontrol->{values} eq 'HASH') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $vals->{''} = '' unless $webcontrol->{notNull}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 76 | 0 | $vals = $webcontrol->{values}; | |||||||||||||||||||||||||||||||
| 77 | } elsif (ref $webcontrol->{values} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | $vals->{''} = '' unless $webcontrol->{notNull}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 79 | 0 | $vals->{$_} = $_ for @{$webcontrol->{values}}; | |||||||||||||||||||||||||||||||
| 80 | } else { | ||||||||||||||||||||||||||||||||
| 81 | 0 | return; | |||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | } elsif ($webcontrol->{sql}) { | ||||||||||||||||||||||||||||||||
| 86 | 0 | my ($query, @binds) = @{$webcontrol->{sql}}; | |||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | $vals->{''} = '' unless $webcontrol->{notNull}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 88 | 0 | $vals->{$_->[0]} = $_->[1] for @{$self->q->db->getarray($query, @binds)}; | |||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||
| 92 | 0 | foreach (keys %$vals) { | |||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ($vals->{$_} eq $value) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 95 | 0 | push @$list, {'ITEM.LABEL' => $_, 'ITEM.VALUE' => $vals->{$_}, 'ITEM.SELECTED' => ' selected '}; | |||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||
| 97 | } else { | ||||||||||||||||||||||||||||||||
| 98 | 0 | push @$list, {'ITEM.LABEL' => $_, 'ITEM.VALUE' => $vals->{$_}}; | |||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | 0 | return $list; | |||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||
| 105 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub buildRadio { | ||||||||||||||||||||||||||||||
|
Subroutine
buildRadio: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 107 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 108 | 0 | my $fieldname = shift; | |||||||||||||||||||||||||||||||
| 109 | 0 | my $webcontrol = shift; | |||||||||||||||||||||||||||||||
| 110 | 0 | my $webname = shift; | |||||||||||||||||||||||||||||||
| 111 | 0 | my $webID = shift; | |||||||||||||||||||||||||||||||
| 112 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||
| 114 | 0 | my $list = []; | |||||||||||||||||||||||||||||||
| 115 | 0 | my $vals = {}; | |||||||||||||||||||||||||||||||
| 116 | 0 | tie %$vals, 'Tie::IxHash'; | |||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | if ($webcontrol->{values} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if (ref $webcontrol->{values} eq 'HASH') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 121 | 0 | $vals = $webcontrol->{values}; | |||||||||||||||||||||||||||||||
| 122 | } elsif (ref $webcontrol->{values} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||
| 123 | 0 | $vals->{$_} = $_ for @{$webcontrol->{values}}; | |||||||||||||||||||||||||||||||
| 124 | } else { | ||||||||||||||||||||||||||||||||
| 125 | 0 | return; | |||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||
| 129 | } elsif ($webcontrol->{sql} ) { | ||||||||||||||||||||||||||||||||
| 130 | 0 | my ($query, @binds) = @{$webcontrol->{sql}}; | |||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||
| 132 | 0 | $vals->{$_->[0]} = $_->[1] for @{$self->q->db->getarray($query, @binds)}; | |||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||
| 136 | 0 | foreach (keys %$vals) { | |||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if ($vals->{$_} eq $value) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 138 | push @$list, { | ||||||||||||||||||||||||||||||||
| 139 | "ID.".$fieldname => $webID."-$_", | ||||||||||||||||||||||||||||||||
| 140 | 'NAME.'.$fieldname => $webname, | ||||||||||||||||||||||||||||||||
| 141 | 'VALUELABEL.'.$fieldname => $_, | ||||||||||||||||||||||||||||||||
| 142 | 0 | 'VALUE.'.$fieldname => $vals->{$_}, | |||||||||||||||||||||||||||||||
| 143 | 'CHECKED.'.$fieldname => ' checked ', | ||||||||||||||||||||||||||||||||
| 144 | }; | ||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||
| 146 | } else { | ||||||||||||||||||||||||||||||||
| 147 | push @$list, { | ||||||||||||||||||||||||||||||||
| 148 | "ID.".$fieldname => $webID."-$_", | ||||||||||||||||||||||||||||||||
| 149 | 'NAME.'.$fieldname => $webname, | ||||||||||||||||||||||||||||||||
| 150 | 'VALUELABEL.'.$fieldname => $_, | ||||||||||||||||||||||||||||||||
| 151 | 0 | 'VALUE.'.$fieldname => $vals->{$_}, | |||||||||||||||||||||||||||||||
| 152 | }; | ||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||
| 157 | 0 | return $list; | |||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||
| 161 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | sub buildvalidator { | ||||||||||||||||||||||||||||||
|
Subroutine
buildvalidator: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 163 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||
| 165 | 0 | my $validator = {}; | |||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||
| 167 | 0 | foreach ( @{$self->recordset->visibleFields}) { | |||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if ($self->recordset->validator($_)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 169 | 0 | my $rules = $self->recordset->validator($_); | |||||||||||||||||||||||||||||||
| 170 | 0 | $rules->{label} = $self->recordset->label($_); | |||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ($self->type eq "multi") { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 172 | 0 | $validator->{$self->widgetID."-".$_."--".1} = $rules; | |||||||||||||||||||||||||||||||
| 173 | } elsif ($self->type eq "single") { | ||||||||||||||||||||||||||||||||
| 174 | 0 | $validator->{$self->widgetID."-".$_} = $rules; | |||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||
| 179 | 0 | $self->{_validator} = $validator; | |||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||
| 182 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub contents { | ||||||||||||||||||||||||||||||
|
Subroutine
contents: not called CC=69 SCAR=84.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 184 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 185 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||
| 187 | 0 | my $widgetID = $self->widgetID; | |||||||||||||||||||||||||||||||
| 188 | 0 | my $vars = $self->vars; | |||||||||||||||||||||||||||||||
| 189 | 0 | my $template; | |||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if ($args{mode} eq 'readonly') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 192 | 0 | $template = $vars->{readOnlyTemplate}; #some form of template is required | |||||||||||||||||||||||||||||||
| 193 | } else { | ||||||||||||||||||||||||||||||||
| 194 | 0 | $template = $vars->{template}; | |||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||
| 197 | 0 | my $type = $vars->{type}; | |||||||||||||||||||||||||||||||
| 198 | 0 | my $multiType = $vars->{multiType}; | |||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | my $containerID = $vars->{containerId} || $widgetID; | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$vars->{'containerId'} || $widgetID
MC/DC0%0/2
$vars->{'containerId'} || $widgetID
$vars->{'containerId'}
$widgetID
Truth table0%0/3
A || B
A= $vars->{'containerId'}B= $widgetID
| |||||||||||||||||||||||||||||||||
| 200 | 0 | my $tableCaptionValue = $vars->{tableCaption}; #can be blank | |||||||||||||||||||||||||||||||
| 201 | 0 | my $recset = $vars->{recordset}; #required | |||||||||||||||||||||||||||||||
| 202 | 0 | my $lookups = $vars->{lookups}; #if this isn't set, then new records will only contain what's on the screen | |||||||||||||||||||||||||||||||
| 203 | 0 | my $standalone = $vars->{standalone}; #if set, widget will include its own open and close tags | |||||||||||||||||||||||||||||||
| 204 | 0 | my $defaults = $vars->{defaultvalues}; #if this isn't set, then new records will only contain what's on the screen | |||||||||||||||||||||||||||||||
| 205 | 0 | my $nodelete = $vars->{nodelete}; | |||||||||||||||||||||||||||||||
| 206 | 0 | my $flagcolor = $vars->{flagColor}; | |||||||||||||||||||||||||||||||
| 207 | 0 | my $headings = $vars->{headings}; | |||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||
| 209 | 0 | my $formOpenTag = ''; | |||||||||||||||||||||||||||||||
| 210 | 0 | my $formCloseTag = ''; | |||||||||||||||||||||||||||||||
| 211 | 0 | my $validator = {}; | |||||||||||||||||||||||||||||||
| 212 | 0 | my $tmplvars = {}; | |||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | $type = 'multi' unless $type; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ($type eq 'single') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $multiType = 'list' unless $multiType; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | if ($standalone) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $formOpenTag = $vars->{formOpenTag} || $self->q->start_form({-method => 'post', -action => $self->q->url}); | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$vars->{'formOpenTag'} || $self->q->start_form({'-method', 'post', '-action', $self->q->url})
MC/DC0%0/2
$vars->{'formOpenTag'} || $self->q->start_form({'-method', 'post', '-action', $self->q->url})
$vars->{'formOpenTag'}
$self->q->start_form({'-method', 'post', '-action', $self->q->url})
Truth table0%0/3
A || B
A= $vars->{'formOpenTag'}B= $self->q->start_form({'-method', 'post', '-action', $self->q->url})
| |||||||||||||||||||||||||||||||||
| 222 | 0 | $formCloseTag = $self->q->end_form; | |||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | $recset->select(@{$args{binds}}) unless $args{mode} eq 'blank'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 227 | # $self->q->util->debug->edump($recset->data); | ||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||
| 229 | 0 | $self->{_multi} = 0; | |||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | $self->{_empty} = scalar @{$recset->data} ? 0 : 1;; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||
| 232 | 0 | my $headingsdiv; | |||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if ($type eq 'multi') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | if ($headings && $headings eq 'none') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$headings and $headings eq "none"
MC/DC0%0/2
$headings and $headings eq "none"
$headings
$headings eq "none"
Truth table0%0/3
A and B
A= $headingsB= $headings eq "none"
| |||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||
| 237 | } elsif ($headings) { | ||||||||||||||||||||||||||||||||
| 238 | 0 | $headingsdiv .= $self->q->template($headings)->process($self->headings); | |||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||
| 240 | } else { | ||||||||||||||||||||||||||||||||
| 241 | 0 | $tmplvars->{$headingItemVar.$_} = $recset->label($_) for $recset->visibleFields; | |||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | $tmplvars->{$headingItemVar."DELETE"} = $deletename unless $nodelete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||
| 245 | 0 | my $bodyRowLoop = []; | |||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||
| 247 | 0 | my $newrecordindex = 0; | |||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | for (my $i = 0; $i < @{$recset->data}; $i++) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 250 | 0 | my $row = {}; | |||||||||||||||||||||||||||||||
| 251 | 0 | my $rownum = $i + 1; | |||||||||||||||||||||||||||||||
| 252 | 0 | my $ID = $recset->data->[$i]->{$recset->primarykey}; | |||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||
| 254 | 0 | $row->{$bodyRowName} = $widgetID."Row".$rownum; | |||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | $row->{$deleteID} = "$widgetID-$rownum" unless $nodelete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | $row->{$deleteFlag} = 1 unless $nodelete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 257 | 0 | $row->{PRIMARYKEY} = $ID; | |||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||
| 259 | 0 | foreach my $fieldname (keys %{$recset->data->[$i]}) { | |||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | if ($recset->handle($fieldname)) { #if we've been given a handle for this field, set it | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 261 | 0 | ${$recset->handle($fieldname)} = $recset->data->[$i]->{$fieldname}; | |||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | unless ($recset->hidden($fieldname)) { #don't add hidden fields | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 265 | 0 | my $webname = "$widgetID-:UPDATE:".$fieldname."-:-".$ID."::".$rownum; | |||||||||||||||||||||||||||||||
| 266 | 0 | my $webID = "$widgetID-".$fieldname."--".$rownum; | |||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||
| 268 | 0 | $row->{"NAME.".$fieldname} = $webname; | |||||||||||||||||||||||||||||||
| 269 | 0 | $row->{"ID.".$fieldname} = $webID; | |||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | $row->{'LABEL.'.$fieldname} = $recset->label($fieldname) unless $recset->noLabel($fieldname); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||
| 272 | 0 | my $value; | |||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | if ($recset->outputMask($fieldname)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 275 | 0 | $value = sprintf $recset->outputMask($fieldname), $recset->data->[$i]->{$fieldname}; | |||||||||||||||||||||||||||||||
| 276 | } else { | ||||||||||||||||||||||||||||||||
| 277 | 0 | $value= $recset->data->[$i]->{$fieldname}; | |||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | if ($recset->webcontrol($fieldname)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 281 | 0 | my $webcontrol = $recset->webcontrol($fieldname); | |||||||||||||||||||||||||||||||
| 282 | 0 | my $type = $webcontrol->{type}; | |||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if ($type eq 'select') { #build variables for web controls | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 285 | 0 | $row->{"LOOP.".$fieldname} = $self->buildSelect($fieldname, $webcontrol, $value); | |||||||||||||||||||||||||||||||
| 286 | } elsif ($type eq 'checkbox') { | ||||||||||||||||||||||||||||||||
| 287 | 0 | ($row->{"VALUE.".$fieldname}, $row->{"CHECKED.".$fieldname}) = $self->buildCheckbox($fieldname, $webcontrol, $value); | |||||||||||||||||||||||||||||||
| 288 | } elsif ($type eq 'radio') { | ||||||||||||||||||||||||||||||||
| 289 | 0 | $row->{"LOOP.".$fieldname} = $self->buildRadio($fieldname, $webcontrol, $webname, $webID, $value ); | |||||||||||||||||||||||||||||||
| 290 | } else { | ||||||||||||||||||||||||||||||||
| 291 | 0 | $row->{"VALUE.".$fieldname} = $value; | |||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||
| 294 | } else { | ||||||||||||||||||||||||||||||||
| 295 | 0 | $row->{"VALUE.".$fieldname} = $value; | |||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | if ($recset->validator($fieldname)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 300 | 0 | my $rule = $recset->validator($fieldname); | |||||||||||||||||||||||||||||||
| 301 | 0 | $rule->{label} = $recset->label($fieldname); | |||||||||||||||||||||||||||||||
| 302 | 0 | $validator->{"$widgetID-".$fieldname."--".$rownum} = $rule; | |||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||
| 307 | 0 | $newrecordindex = $rownum; | |||||||||||||||||||||||||||||||
| 308 | 0 | push @$bodyRowLoop, $row; | |||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||
| 311 | #blank record for inserts | ||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||
| 313 | 0 | my $defaultstring = join ",", sort keys %$defaults; | |||||||||||||||||||||||||||||||
| 314 | 0 | my $blankrow = {}; | |||||||||||||||||||||||||||||||
| 315 | 0 | $newrecordindex++; | |||||||||||||||||||||||||||||||
| 316 | 0 | $blankrow->{$bodyRowName} = $widgetID."Row".$newrecordindex; | |||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | $blankrow->{$deleteID} = "$widgetID-$newrecordindex" unless $nodelete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | $blankrow->{$deleteFlag} = 1 unless $nodelete; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 319 | 0 | foreach my $field ( @{$recset->visibleFields}) { | |||||||||||||||||||||||||||||||
| 320 | 0 | my $webname = "$widgetID-".$field."--".$newrecordindex; | |||||||||||||||||||||||||||||||
| 321 | 0 | my $webID = "$widgetID-".$field."--".$newrecordindex; | |||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||
| 323 | 0 | $blankrow->{"NAME.".$field} = $webname; | |||||||||||||||||||||||||||||||
| 324 | 0 | $blankrow->{"ID.".$field} = $webID; | |||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | $blankrow->{'LABEL.'.$field} = $recset->label($field) unless $recset->noLabel($field); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | if ($recset->webcontrol($field)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 328 | 0 | my $webcontrol = $recset->webcontrol($field); | |||||||||||||||||||||||||||||||
| 329 | 0 | my $type = $webcontrol->{type}; | |||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | if ($type eq 'select') { #build variables for web dropdowns | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 332 | 0 | $blankrow->{"LOOP.".$field} = $self->buildSelect($field, $webcontrol); | |||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||
| 334 | } elsif ($type eq 'checkbox') { | ||||||||||||||||||||||||||||||||
| 335 | 0 | ($blankrow->{"VALUE.".$field}, $blankrow->{"CHECKED.".$field}) = $self->buildCheckbox($field, $webcontrol); | |||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||
| 337 | } elsif ($type eq 'radio') { | ||||||||||||||||||||||||||||||||
| 338 | 0 | $blankrow->{"LOOP.".$field} = $self->buildRadio($field, $webcontrol, $webname, $webID); | |||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||
| 340 | } else { | ||||||||||||||||||||||||||||||||
| 341 | 0 | $blankrow->{"VALUE.".$field} = ''; | |||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||
| 345 | } else { | ||||||||||||||||||||||||||||||||
| 346 | 0 | $blankrow->{"VALUE.".$field} = ''; | |||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if ($recset->validator($field)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 350 | 0 | my $rule = $recset->validator($field); | |||||||||||||||||||||||||||||||
| 351 | 0 | $rule->{label} = $recset->label($field); | |||||||||||||||||||||||||||||||
| 352 | 0 | $validator->{"$widgetID-".$field."--".$newrecordindex} = $rule; | |||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||
| 356 | 0 | push @$bodyRowLoop, $blankrow; | |||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||
| 358 | 0 | $self->{_validator} = $validator; | |||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||
| 360 | 0 | $tmplvars->{$tableCaptionVar} = $tableCaptionValue; | |||||||||||||||||||||||||||||||
| 361 | 0 | $tmplvars->{$bodyRowLoopVar} = $bodyRowLoop; | |||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||
| 363 | } elsif ($type eq 'single') { | ||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | if (scalar @{$recset->data} > 1) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | unless ($vars->{multiType} eq 'sequential') { #there are configurations where we don't want to display multi | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 366 | 0 | $self->{_multi} = 1; | |||||||||||||||||||||||||||||||
| 367 | 0 | return $self->displaySingleList(%args); | |||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||
| 369 | 0 | } elsif (scalar @{$recset->data} == 0) { | |||||||||||||||||||||||||||||||
| 370 | 0 | $self->{_empty} = 1; | |||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||
| 373 | 0 | my $recordnum = 0; #which record of a multiple return to display, if we're not doing displaySingleList | |||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||
| 375 | 0 | foreach my $field (keys %{$args{vars}}) { | |||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | if ($field eq '-recordnum') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 377 | 0 | $recordnum = $args{vars}->{$field}; | |||||||||||||||||||||||||||||||
| 378 | } elsif ($args{vars}->{$field}->{handle}) { | ||||||||||||||||||||||||||||||||
| 379 | 0 | my $ref = $args{vars}->{$field}->{handle}; | |||||||||||||||||||||||||||||||
| 380 | 0 | $$ref = $recset->data->[$recordnum]->{$field}; | |||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | my $ID = $recset->data->[$recordnum]->{$recset->primarykey} || ''; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$recset->data->[$recordnum]{$recset->primarykey} || ''
MC/DC0%0/1
$recset->data->[$recordnum]{$recset->primarykey} || ''
$recset->data->[$recordnum]{$recset->primarykey}
Truth table0%0/2
A
A= $recset->data->[$recordnum]{$recset->primarykey}
| |||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | if ($args{mode} eq 'blank') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 387 | 0 | foreach my $fieldname (keys %{$recset->fieldlist}) { | |||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | unless ($recset->hidden($fieldname)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 389 | 0 | my $webname = "$widgetID-:INSERT:".$fieldname."--"; | |||||||||||||||||||||||||||||||
| 390 | 0 | my $webID = "$widgetID-".$fieldname; | |||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | $tmplvars->{'LABEL.'.$fieldname} = $recset->label($fieldname) unless $recset->noLabel($fieldname); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 393 | 0 | $tmplvars->{'NAME.'.$fieldname} = $webname; | |||||||||||||||||||||||||||||||
| 394 | 0 | $tmplvars->{"ID.".$fieldname} = $webID; | |||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | if ($recset->webcontrol($fieldname)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 397 | 0 | my $webcontrol = $recset->webcontrol($fieldname); | |||||||||||||||||||||||||||||||
| 398 | 0 | my $type = $webcontrol->{type}; | |||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | if ($type eq 'select') { #build variables for web dropdowns | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 401 | 0 | $tmplvars->{"LOOP.".$fieldname} = $self->buildSelect($fieldname, $webcontrol); | |||||||||||||||||||||||||||||||
| 402 | } elsif ($type eq 'checkbox') { | ||||||||||||||||||||||||||||||||
| 403 | 0 | ($tmplvars->{"VALUE.".$fieldname}, $tmplvars->{"CHECKED.".$fieldname}) = $self->buildCheckbox($fieldname, $webcontrol); | |||||||||||||||||||||||||||||||
| 404 | } elsif ($type eq 'radio') { | ||||||||||||||||||||||||||||||||
| 405 | 0 | $tmplvars->{"LOOP.".$fieldname} = $self->buildRadio($fieldname, $webcontrol, $webname, $webID); | |||||||||||||||||||||||||||||||
| 406 | } else { | ||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||
| 412 | } else { | ||||||||||||||||||||||||||||||||
| 413 | 0 | foreach my $fieldname (keys %{$recset->fieldlist}) { | |||||||||||||||||||||||||||||||
| 414 | 0 | my $value; | |||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | if ($recset->outputMask($fieldname)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 417 | 0 | $value = sprintf $recset->outputMask($fieldname), $recset->data->[$recordnum]->{$fieldname}; | |||||||||||||||||||||||||||||||
| 418 | } else { | ||||||||||||||||||||||||||||||||
| 419 | 0 | $value = $recset->data->[$recordnum]->{$fieldname}; | |||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | if ($recset->handle($fieldname)) { #if we've been given a handle for this field, set it | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 423 | 0 | ${$recset->handle($fieldname)} = $recset->data->[$recordnum]->{$fieldname}; | |||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | unless ($recset->hidden($fieldname)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 427 | 0 | my $webname = "$widgetID-:UPDATE:".$fieldname."-:-".$ID; | |||||||||||||||||||||||||||||||
| 428 | 0 | my $webID = "$widgetID-".$fieldname; | |||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | $tmplvars->{'LABEL.'.$fieldname} = $recset->label($fieldname) unless $recset->noLabel($fieldname); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 431 | 0 | $tmplvars->{'NAME.'.$fieldname} = $webname; | |||||||||||||||||||||||||||||||
| 432 | 0 | $tmplvars->{"ID.".$fieldname} = $webID; | |||||||||||||||||||||||||||||||
| 433 | 0 | $tmplvars->{PRIMARYKEY} = $ID; | |||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | if ($recset->webcontrol($fieldname)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 436 | 0 | my $webcontrol = $recset->webcontrol($fieldname); | |||||||||||||||||||||||||||||||
| 437 | 0 | my $type = $webcontrol->{type}; | |||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | if ($type eq 'select') { #build variables for web dropdowns | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 440 | 0 | $tmplvars->{"LOOP.".$fieldname} = $self->buildSelect($fieldname, $webcontrol, $value); | |||||||||||||||||||||||||||||||
| 441 | } elsif ($type eq 'checkbox') { | ||||||||||||||||||||||||||||||||
| 442 | 0 | ($tmplvars->{"VALUE.".$fieldname}, $tmplvars->{"CHECKED.".$fieldname}) = $self->buildCheckbox($fieldname, $webcontrol, $value); | |||||||||||||||||||||||||||||||
| 443 | } elsif ($type eq 'radio') { | ||||||||||||||||||||||||||||||||
| 444 | 0 | $tmplvars->{"LOOP.".$fieldname} = $self->buildRadio($fieldname, $webcontrol, $webname, $webID, $value ); | |||||||||||||||||||||||||||||||
| 445 | } else { | ||||||||||||||||||||||||||||||||
| 446 | 0 | $tmplvars->{"VALUE.".$fieldname} = $value; | |||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||
| 449 | } else { | ||||||||||||||||||||||||||||||||
| 450 | 0 | $tmplvars->{"VALUE.".$fieldname} = $value; | |||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||
| 457 | 0 | foreach my $extra (keys %{$self->vars->{extravars}} ) { | |||||||||||||||||||||||||||||||
| 458 | 0 | my $type = $self->vars->{extravars}->{$extra}->{type}; | |||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | if (ref $self->vars->{extravars}->{$extra}->{value} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 460 | 0 | $tmplvars->{"NAME.$extra"} = "$widgetID-$extra"; | |||||||||||||||||||||||||||||||
| 461 | 0 | $tmplvars->{"ID.$extra"} = "$widgetID-$extra"; | |||||||||||||||||||||||||||||||
| 462 | 0 | $tmplvars->{"VALUE.$extra"} = ${$self->vars->{extravars}->{$extra}->{value}}; | |||||||||||||||||||||||||||||||
| 463 | } else { | ||||||||||||||||||||||||||||||||
| 464 | 0 | $tmplvars->{"NAME.$extra"} = "$widgetID-$extra"; | |||||||||||||||||||||||||||||||
| 465 | 0 | $tmplvars->{"ID.$extra"} = "$widgetID-$extra"; | |||||||||||||||||||||||||||||||
| 466 | 0 | $tmplvars->{"VALUE.$extra"} = $self->vars->{extravars}->{$extra}->{value}; | |||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | my $divopen = $args{nodiv} ? '' : "<div id='$widgetID'>"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | my $divclose = $args{nodiv} ? '' : "</div>"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 472 | 0 | $validator = $self->q->jswrap("var ".$self->widgetID ."Validator = ".to_json($self->validator).";"); | |||||||||||||||||||||||||||||||
| 473 | 0 | my $primarykey = $self->recordset->primarykey; | |||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||
| 475 | 0 | my $searchObjectName = $self->widgetID.'SearchObject'; | |||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||
| 477 | 0 | my $searchObject = to_json([map {$widgetID."-".$_} @{$recset->visibleFields}]); | |||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||
| 479 | 0 | my $jsvalidatorname = $widgetID."Validator"; | |||||||||||||||||||||||||||||||
| 480 | 0 | my $jscontrollername = $widgetID."Controller"; | |||||||||||||||||||||||||||||||
| 481 | 0 | my $jsmultisearchname = $widgetID."MultiSearchPrimaryKey"; | |||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||
| 483 | 0 | my $javascript = <<END; | |||||||||||||||||||||||||||||||
| 484 | var $jscontrollername = new datasetController('$widgetID', $jsvalidatorname, '$containerID', $searchObject, '$flagcolor'); | ||||||||||||||||||||||||||||||||
| 485 | var $jsmultisearchname = '$primarykey'; | ||||||||||||||||||||||||||||||||
| 486 | END | ||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | if ($javascript) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | $javascript = minify(input => $javascript) unless $self->q->config->noMinify; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||
| 492 | 0 | my $js = $self->q->jswrap($javascript); | |||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||
| 494 | 0 | return $headingsdiv. | |||||||||||||||||||||||||||||||
| 495 | $divopen. | ||||||||||||||||||||||||||||||||
| 496 | $validator. | ||||||||||||||||||||||||||||||||
| 497 | $js. | ||||||||||||||||||||||||||||||||
| 498 | $formOpenTag. | ||||||||||||||||||||||||||||||||
| 499 | $self->q->template($template)->process($tmplvars). | ||||||||||||||||||||||||||||||||
| 500 | $formCloseTag. | ||||||||||||||||||||||||||||||||
| 501 | $divclose; | ||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||
| 504 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub display { | ||||||||||||||||||||||||||||||
|
Subroutine
display: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 506 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 507 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||
| 509 | 0 | my $preloadLookup = $self->preloadLookup; | |||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||
| 511 | 0 | return $preloadLookup. | |||||||||||||||||||||||||||||||
| 512 | $self->contents(%args); | ||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||
| 515 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | sub displaySingleList { | ||||||||||||||||||||||||||||||
|
Subroutine
displaySingleList: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||
| 517 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 518 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||
| 520 | 0 | my $standalone = $self->vars->{standalone}; | |||||||||||||||||||||||||||||||
| 521 | 0 | my $formOpenTag = ''; | |||||||||||||||||||||||||||||||
| 522 | 0 | my $formCloseTag = ''; | |||||||||||||||||||||||||||||||
| 523 | 0 | my $widgetID = $self->vars->{id}; | |||||||||||||||||||||||||||||||
| 524 | 0 | my $recset = $self->recordset; | |||||||||||||||||||||||||||||||
| 525 | 0 | my @fieldlist = $recset->multipleFieldList; | |||||||||||||||||||||||||||||||
| 526 | 0 | my @labels = $recset->multipleFieldLabels; | |||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||
| 528 | 0 | my $surroundingDivName = "DIV.MAIN"; | |||||||||||||||||||||||||||||||
| 529 | 0 | my $tableCaptionVar = "CAPTION"; | |||||||||||||||||||||||||||||||
| 530 | 0 | my $headingItemVar = "HEADING.ITEM."; | |||||||||||||||||||||||||||||||
| 531 | 0 | my $bodyRowLoopVar = "ROW.LOOP"; | |||||||||||||||||||||||||||||||
| 532 | 0 | my $bodyRowName = "ROW"; | |||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if ($standalone) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | $formOpenTag = $self->vars->{formOpenTag} || $self->q->start_form({-method => 'post', -action => $self->q->url}); | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->vars->{'formOpenTag'} || $self->q->start_form({'-method', 'post', '-action', $self->q->url})
MC/DC0%0/2
$self->vars->{'formOpenTag'} || $self->q->start_form({'-method', 'post', '-action', $self->q->url})
$self->vars->{'formOpenTag'}
$self->q->start_form({'-method', 'post', '-action', $self->q->url})
Truth table0%0/3
A || B
A= $self->vars->{'formOpenTag'}B= $self->q->start_form({'-method', 'post', '-action', $self->q->url})
| |||||||||||||||||||||||||||||||||
| 536 | 0 | $formCloseTag = $self->q->end_form; | |||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||
| 539 | 0 | my $bodyRowLoop = []; | |||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||
| 541 | 0 | my $primarykey = $recset->primarykey; | |||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||
| 543 | 0 | foreach my $record (@{$recset->data}) { | |||||||||||||||||||||||||||||||
| 544 | 0 | my $row = {}; | |||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | my $ID = $record->{$primarykey} || ''; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$record->{$primarykey} || ''
MC/DC0%0/1
$record->{$primarykey} || ''
$record->{$primarykey}
Truth table0%0/2
A
A= $record->{$primarykey}
| |||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||
| 547 | 0 | foreach my $field (keys %{$record}) { | |||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | if ($recset->multipleField($field)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 549 | 0 | $row->{PRIMARYKEY} = $ID; | |||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if ($recset->webcontrol($field)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 552 | 0 | my $webcontrol = $recset->webcontrol($field); | |||||||||||||||||||||||||||||||
| 553 | 0 | my $type = $webcontrol->{type}; | |||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||
| 555 | 0 | ▶ | if ($type eq 'select') { #build variables for web dropdowns | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 556 | $row->{"VALUE.".$field} = "<a href= \"javascript:$widgetID"."Controller.multiSearch('$ID');\">". | ||||||||||||||||||||||||||||||||
| 557 | 0 | $self->singleListSelect($field, $webcontrol, $record->{$field}). | |||||||||||||||||||||||||||||||
| 558 | "</a>"; | ||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||
| 560 | } elsif ($type eq 'checkbox') { | ||||||||||||||||||||||||||||||||
| 561 | $row->{"VALUE.".$field} = "<a href= \"javascript:$widgetID"."Controller.multiSearch('$ID');\">". | ||||||||||||||||||||||||||||||||
| 562 | 0 | $self->singleListCheckbox($field, $webcontrol, $record->{$field}). | |||||||||||||||||||||||||||||||
| 563 | "</a>"; | ||||||||||||||||||||||||||||||||
| 564 | } elsif ($type eq 'radio') { | ||||||||||||||||||||||||||||||||
| 565 | $row->{"VALUE.".$field} = "<a href= \"javascript:$widgetID"."Controller.multiSearch('$ID');\">". | ||||||||||||||||||||||||||||||||
| 566 | 0 | $self->singleListRadio($field, $webcontrol, $record->{$field}). | |||||||||||||||||||||||||||||||
| 567 | "</a>"; | ||||||||||||||||||||||||||||||||
| 568 | } else { | ||||||||||||||||||||||||||||||||
| 569 | 0 | $row->{"VALUE.".$field} = "<a href= \"javascript:$widgetID"."Controller.multiSearch('$ID');\">".$record->{$field}."</a>"; | |||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||
| 572 | } else { | ||||||||||||||||||||||||||||||||
| 573 | 0 | $row->{"VALUE.".$field} = "<a href= \"javascript:$widgetID"."Controller.multiSearch('$ID');\">".$record->{$field}."</a>"; | |||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||
| 579 | 0 | push @$bodyRowLoop, $row; | |||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||
| 582 | 0 | my $tmplvars = { | |||||||||||||||||||||||||||||||
| 583 | $bodyRowLoopVar => $bodyRowLoop, | ||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||
| 585 | }; | ||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||
| 587 | 0 | $tmplvars->{$headingItemVar.$_} = $recset->label($_) for $recset->multipleFieldList; | |||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | my $divopen = $args{nodiv} ? '' : "<div id='$widgetID"."Multi'>"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | my $divclose = $args{nodiv} ? '' : "</div>"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||
| 592 | return $divopen. | ||||||||||||||||||||||||||||||||
| 593 | $formOpenTag. | ||||||||||||||||||||||||||||||||
| 594 | 0 | $self->q->template($self->vars->{multipleTemplate})->process($tmplvars). | |||||||||||||||||||||||||||||||
| 595 | $formCloseTag. | ||||||||||||||||||||||||||||||||
| 596 | $divclose; | ||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||
| 599 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 600 | 0 | ▶ | sub empty { | ||||||||||||||||||||||||||||||
|
Subroutine
empty: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 601 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||
| 603 | 0 | return $self->{_empty}; | |||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||
| 606 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | sub headings { | ||||||||||||||||||||||||||||||
|
Subroutine
headings: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 608 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||
| 610 | 0 | return $self->{_headings}; | |||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||
| 613 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | sub multi { | ||||||||||||||||||||||||||||||
|
Subroutine
multi: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 615 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||
| 617 | 0 | return $self->{_multi}; | |||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||
| 620 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 622 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||
| 623 | 0 | my $q = shift; | |||||||||||||||||||||||||||||||
| 624 | 0 | my $vars = shift; | |||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | unless (ref $vars->{recordset} eq 'CGI::Lazy::DB::RecordSet') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 627 | 0 | $vars->{recordset} = $q->db->recordset($vars->{recordset}); | |||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||
| 630 | my $self = { | ||||||||||||||||||||||||||||||||
| 631 | _q => $q, | ||||||||||||||||||||||||||||||||
| 632 | _vars => $vars, | ||||||||||||||||||||||||||||||||
| 633 | _recordset => $vars->{recordset}, | ||||||||||||||||||||||||||||||||
| 634 | _type => $vars->{type}, | ||||||||||||||||||||||||||||||||
| 635 | _multiType => $vars->{multiType}, | ||||||||||||||||||||||||||||||||
| 636 | _widgetID => $vars->{id}, | ||||||||||||||||||||||||||||||||
| 637 | 0 | }; | |||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||
| 639 | 0 | bless $self, $class; | |||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||
| 641 | # $q->util->debug->edump($self->recordset); | ||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||
| 643 | 0 | $self->{_headings} = $self->buildHeadings; | |||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||
| 645 | 0 | $self->buildvalidator; | |||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||
| 647 | 0 | return $self; | |||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||
| 650 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 651 | 0 | ▶ | sub searchResults { | ||||||||||||||||||||||||||||||
|
Subroutine
searchResults: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 652 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 653 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||
| 655 | 0 | my $html = $self->rawContents(%args); | |||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||
| 657 | 0 | my $outgoing = '{"validator" : '.$self->validator.', "html" : "'.$html.'"}'; | |||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||
| 659 | 0 | return $outgoing; | |||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||
| 662 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | sub singleListCheckbox { | ||||||||||||||||||||||||||||||
|
Subroutine
singleListCheckbox: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 664 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 665 | 0 | my $fieldname = shift; | |||||||||||||||||||||||||||||||
| 666 | 0 | my $webcontrol = shift; | |||||||||||||||||||||||||||||||
| 667 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||
| 669 | 0 | ▶ | if ($webcontrol->{value}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | if ($value eq $webcontrol->{value}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 671 | 0 | return 'yes'; | |||||||||||||||||||||||||||||||
| 672 | } else { | ||||||||||||||||||||||||||||||||
| 673 | 0 | return 'no'; | |||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||
| 676 | } elsif ($webcontrol->{sql}) { | ||||||||||||||||||||||||||||||||
| 677 | 0 | my ($query, @binds) = @{$webcontrol->{sql}}; | |||||||||||||||||||||||||||||||
| 678 | 0 | my $lookupvalue = $self->q->db->get($query, @binds); | |||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||
| 680 | 0 | ▶ | if ($value eq $lookupvalue) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 681 | 0 | return 'yes'; | |||||||||||||||||||||||||||||||
| 682 | } else { | ||||||||||||||||||||||||||||||||
| 683 | 0 | return 'no'; | |||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||
| 688 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 689 | 0 | ▶ | sub singleListRadio { | ||||||||||||||||||||||||||||||
|
Subroutine
singleListRadio: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 690 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 691 | 0 | my $fieldname = shift; | |||||||||||||||||||||||||||||||
| 692 | 0 | my $webcontrol = shift; | |||||||||||||||||||||||||||||||
| 693 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||
| 695 | 0 | my $list = []; | |||||||||||||||||||||||||||||||
| 696 | 0 | my $vals = {}; | |||||||||||||||||||||||||||||||
| 697 | 0 | tie %$vals, 'Tie::IxHash'; | |||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | if ($webcontrol->{values} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||
| 701 | 0 | ▶ | if (ref $webcontrol->{values} eq 'HASH') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 702 | 0 | $vals = $webcontrol->{values}; | |||||||||||||||||||||||||||||||
| 703 | } elsif (ref $webcontrol->{values} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||
| 704 | 0 | $vals->{$_} = $_ for @{$webcontrol->{values}}; | |||||||||||||||||||||||||||||||
| 705 | } else { | ||||||||||||||||||||||||||||||||
| 706 | 0 | return; | |||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||
| 710 | } elsif ($webcontrol->{sql} ) { | ||||||||||||||||||||||||||||||||
| 711 | 0 | my ($query, @binds) = @{$webcontrol->{sql}}; | |||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||
| 713 | 0 | $vals->{$_->[0]} = $_->[1] for @{$self->q->db->getarray($query, @binds)}; | |||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||
| 717 | 0 | foreach (sort keys %$vals) { | |||||||||||||||||||||||||||||||
| 718 | 0 | ▶ | if ($vals->{$_} eq $value) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 719 | 0 | return $_; | |||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||
| 726 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 727 | 0 | ▶ | sub singleListSelect { | ||||||||||||||||||||||||||||||
|
Subroutine
singleListSelect: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 728 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 729 | 0 | my $fieldname = shift; | |||||||||||||||||||||||||||||||
| 730 | 0 | my $webcontrol = shift; | |||||||||||||||||||||||||||||||
| 731 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||
| 733 | 0 | my $list = []; | |||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||
| 735 | 0 | my $vals = {}; | |||||||||||||||||||||||||||||||
| 736 | 0 | tie %$vals, 'Tie::IxHash'; | |||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||
| 738 | 0 | ▶ | if ($webcontrol->{values} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | if (ref $webcontrol->{values} eq 'HASH') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 740 | 0 | ▶ | $vals->{''} = '' unless $webcontrol->{notNull}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 741 | 0 | $vals = $webcontrol->{values}; | |||||||||||||||||||||||||||||||
| 742 | } elsif (ref $webcontrol->{values} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | $vals->{''} = '' unless $webcontrol->{notNull}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 744 | 0 | $vals->{$_} = $_ for @{$webcontrol->{values}}; | |||||||||||||||||||||||||||||||
| 745 | } else { | ||||||||||||||||||||||||||||||||
| 746 | 0 | return; | |||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||
| 750 | } elsif ($webcontrol->{sql}) { | ||||||||||||||||||||||||||||||||
| 751 | 0 | my ($query, @binds) = @{$webcontrol->{sql}}; | |||||||||||||||||||||||||||||||
| 752 | 0 | ▶ | $vals->{''} = '' unless $webcontrol->{notNull}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 753 | 0 | $vals->{$_->[0]} = $_->[1] for @{$self->q->db->getarray($query, @binds)}; | |||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||
| 757 | 0 | foreach (keys %$vals) { | |||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | if ($vals->{$_} eq $value) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 759 | # return $vals->{$_}; | ||||||||||||||||||||||||||||||||
| 760 | 0 | return $_; | |||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||
| 765 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 766 | 0 | ▶ | sub type { | ||||||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 767 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||
| 769 | 0 | return $self->{_type}; | |||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||
| 772 | #---------------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | sub vars { | ||||||||||||||||||||||||||||||
|
Subroutine
vars: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 774 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||
| 776 | 0 | return $self->{_vars}; | |||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||
| 780 | 1 | 1 | |||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||
| 782 | __END__ | ||||||||||||||||||||||||||||||||