- my $class = shift;
- my $type = lc(shift || '');
-
- return (and => [ '!customer_id' => undef, quotation => 1 ]) if $type eq 'sales_quotation';
- return (and => [ '!vendor_id' => undef, quotation => 1 ]) if $type eq 'request_quotation';
- return (and => [ '!customer_id' => undef, or => [ quotation => 0, quotation => undef ] ]) if $type eq 'sales_order';
- return (and => [ '!vendor_id' => undef, or => [ quotation => 0, quotation => undef ] ]) if $type eq 'purchase_order';
+ my $class = shift;
+ my $type = lc(shift || '');
+ my $prefix = shift || '';
+
+ return (and => [ "!${prefix}customer_id" => undef, "${prefix}quotation" => 1 ]) if $type eq 'sales_quotation';
+ return (and => [ "!${prefix}vendor_id" => undef, "${prefix}quotation" => 1 ]) if $type eq 'request_quotation';
+ return (and => [ "!${prefix}customer_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ] ]) if $type eq 'sales_order';
+ return (and => [ "!${prefix}vendor_id" => undef, or => [ "${prefix}quotation" => 0, "${prefix}quotation" => undef ] ]) if $type eq 'purchase_order';