Beispiel #1
0
 private static function ensureStatusesLoaded()
 {
     if (self::$STATUS_INIT) {
         return;
     }
     global $DB;
     $paidStatus = null;
     $arStatuses = array();
     $arStatuses = \CCrmInvoice::GetStatusList();
     foreach ($arStatuses as $statusID => $arStatus) {
         if (!$paidStatus && strval($statusID) === 'P') {
             $paidStatus = $arStatus;
             continue;
         }
     }
     self::$WORK_STATUSES = array();
     self::$CANCEL_STATUSES = array();
     if ($paidStatus) {
         $paidStatusSort = intval($paidStatus['SORT']);
         foreach ($arStatuses as $statusID => $arStatus) {
             $sort = intval($arStatus['SORT']);
             if ($sort < $paidStatusSort) {
                 self::$WORK_STATUSES[] = '\'' . $DB->ForSql($statusID) . '\'';
             } elseif ($sort > $paidStatusSort) {
                 self::$CANCEL_STATUSES[] = '\'' . $DB->ForSql($statusID) . '\'';
             }
         }
     }
     self::$STATUS_INIT = true;
 }