Ejemplo n.º 1
0
     if ($report['CREATED_BY'] != $USER->GetID()) {
         throw new BXUserException(GetMessage('REPORT_VIEW_PERMISSION_DENIED'));
     }
     $arResult['report'] = $report;
 }
 // </editor-fold>
 if (!empty($_POST) && (!empty($_POST['report_select_columns']) || $arParams['ACTION'] == 'delete_confirmed')) {
     // <editor-fold defaultstate="collapsed" desc="POST action">
     $formErr = '';
     // check csrf
     if (!check_bitrix_sessid('csrf_token')) {
         throw new BXFormException(GetMessage('REPORT_CSRF'));
     }
     // delete
     if (empty($formErr) && $arParams['ACTION'] == 'delete_confirmed') {
         CReport::Delete($arParams['REPORT_ID']);
         $url = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_REPORT_LIST"], array());
         LocalRedirect($url);
         exit;
     }
     // <editor-fold defaultstate="collapsed" desc="prepare title">
     $title = !empty($_POST['report_title']) ? trim((string) $_POST['report_title']) : '';
     if (empty($title)) {
         $formErr = GetMessage('REPORT_TITLE_NOT_SELECTED');
     }
     $description = !empty($_POST['report_description']) ? trim((string) $_POST['report_description']) : '';
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="preapre period">
     if (!empty($_POST['F_DATE_TYPE']) && in_array($_POST['F_DATE_TYPE'], $periodTypes, true)) {
         $period = array('type' => $_POST['F_DATE_TYPE']);
         switch ($_POST['F_DATE_TYPE']) {
Ejemplo n.º 2
0
         $res = Bitrix\Report\ReportTable::getList(array('select' => array('ID'), 'filter' => array('=CREATED_BY' => $USER->GetID(), '=OWNER_ID' => CBaseSaleReportHelper::getOwners())));
         while ($row = $res->fetch()) {
             $arID[] = $row['ID'];
         }
         unset($res);
         unset($row);
     }
     foreach ($arID as $ID) {
         if (strlen($ID) <= 0) {
             continue;
         }
         switch ($_REQUEST['action']) {
             case "delete":
                 @set_time_limit(0);
                 $DB->StartTransaction();
                 if (!CReport::Delete($ID)) {
                     $DB->Rollback();
                     if ($ex = $APPLICATION->GetException()) {
                         $lReports->AddGroupError($ex->GetString(), $ID);
                     } else {
                         $lReports->AddGroupError(GetMessage("SALE_REPORT_ERROR_DELREPFROMLIST"), $ID);
                     }
                 }
                 $DB->Commit();
                 break;
         }
     }
 }
 // Getting reports list.
 $dbRepList = Bitrix\Report\ReportTable::getList(array('select' => array('ID', 'TITLE', 'DESCRIPTION', 'CREATED_DATE', 'MARK_DEFAULT'), 'filter' => array('=CREATED_BY' => $USER->GetID(), '=OWNER_ID' => CBaseSaleReportHelper::getOwners())));
 $dbRepList = new CAdminResult($dbRepList, $sTableID);