You are here

function uc_roles_product_write_record in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 uc_roles/uc_roles.module \uc_roles_product_write_record()

Little helper for cleaning up input to drupal_write_record().

1 call to uc_roles_product_write_record()
uc_roles_feature_form_submit in uc_roles/uc_roles.module
Submission handler for uc_roles_feature_form().

File

uc_roles/uc_roles.module, line 688
Grants roles upon accepted payment of products.

Code

function uc_roles_product_write_record($product_role) {
  foreach (array(
    'duration',
    'granularity',
    'end_time',
  ) as $property) {
    $product_role[$property] = $product_role[$property] === NULL ? 0 : $product_role[$property];
  }
  $key = array();
  if ($product_role['rpid']) {
    $key = 'rpid';
  }
  drupal_write_record('uc_roles_products', $product_role, $key);
}