4 +--------------------------------------------------------------------+
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2018 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
32 * @copyright CiviCRM LLC (c) 2004-2018
34 class CRM_Utils_Check_Component_PriceFields
extends CRM_Utils_Check_Component
{
37 * Display warning about invalid priceFields
40 public function checkPriceFields() {
41 $sql = "SELECT DISTINCT ps.title as ps_title, ps.id as ps_id, psf.label as psf_label
42 FROM civicrm_price_set ps
43 INNER JOIN civicrm_price_field psf ON psf.price_set_id = ps.id
44 INNER JOIN civicrm_price_field_value pfv ON pfv.price_field_id = psf.id
45 LEFT JOIN civicrm_financial_type cft ON cft.id = pfv.financial_type_id
46 WHERE cft.id IS NULL OR cft.is_active = 0";
47 $dao = CRM_Core_DAO
::executeQuery($sql);
51 while ($dao->fetch()) {
53 $url = CRM_Utils_System
::url('civicrm/admin/price/field', array(
56 'sid' => $dao->ps_id
));
57 $html .= "<tr><td>$dao->ps_title</td><td>$dao->psf_label</td><td><a href='$url'>View Price Set Fields</a></td></tr>";
60 $msg = "<p>the following Price Set Fields use disabled or invalid financial types and need to be fixed if they are to still be used.<p>
61 <p><table><thead><tr><th>Price Set</th><th>Price Set Field</th><th>Action Link</th>
64 </tbody></table></p>";
65 $messages[] = new CRM_Utils_Check_Message(
68 ts('Invalid Price Fields'),
69 \Psr\Log\LogLevel
::WARNING
,