Exemplo n.º 1
0
 /**
  * Store initial values when creating a product
  *
  * @param   string $strTable
  * @param   int    $insertID
  * @param   array  $arrSet
  */
 public function updateNewRecord($strTable, $insertID, $arrSet)
 {
     if ($arrSet['pid'] > 0) {
         return;
     }
     $intType = 0;
     $intGroup = (int) \Session::getInstance()->get('iso_products_gid') ?: (\BackendUser::getInstance()->isAdmin ? 0 : intval(\BackendUser::getInstance()->iso_groups[0]));
     $objGroup = Group::findByPk($intGroup);
     if (null === $objGroup || null === $objGroup->getRelated('product_type')) {
         $objType = ProductType::findFallback();
     } else {
         $objType = $objGroup->getRelated('product_type');
     }
     if (null !== $objType) {
         $intType = $objType->id;
     }
     \Database::getInstance()->prepare("UPDATE {$strTable} SET gid=?, type=?, dateAdded=? WHERE id=?")->execute($intGroup, $intType, time(), $insertID);
 }