You are here

function uc_order_update_7301 in Ubercart 7.3

Convert view invoices checkbox to permission.

File

uc_order/uc_order.install, line 898
Install, update and uninstall functions for the uc_order module.

Code

function uc_order_update_7301() {
  if (variable_get('uc_cust_view_order_invoices', TRUE)) {

    // user_role_grant_permissions() is not allowed during upgrades from D6.
    db_merge('role_permission')
      ->key(array(
      'rid' => DRUPAL_AUTHENTICATED_RID,
      'permission' => 'view own invoices',
    ))
      ->fields(array(
      'module' => 'uc_order',
    ))
      ->execute();
  }
  variable_del('uc_cust_view_order_invoices');
}