Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 TO |
5 | +--------------------------------------------------------------------+ |
6 | | Copyright (C) 2011 Marty Wright | | |
7 | | Licensed to CiviCRM under the Academic Free License version 3.0. | | |
8 | +--------------------------------------------------------------------+ | |
9 | | This file is a part of CiviCRM. | | |
10 | | | | |
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. | | |
14 | | | | |
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. | | |
19 | | | | |
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 | +--------------------------------------------------------------------+ | |
27 | */ | |
28 | ||
29 | /** | |
30 | * | |
31 | * @package CRM | |
06b69b18 | 32 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
33 | * $Id$ |
34 | * | |
35 | */ | |
36 | ||
37 | /** | |
38 | * This class contains functions for managing Label Formats | |
39 | */ | |
40 | class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { | |
41 | ||
42 | /** | |
100fef9d | 43 | * Static holder for the Label Formats Option Group ID |
6a488035 TO |
44 | */ |
45 | private static $_gid = NULL; | |
46 | ||
47 | /** | |
48 | * Label Format fields stored in the 'value' field of the Option Value table. | |
49 | */ | |
50 | private static $optionValueFields = array( | |
51 | 'paper-size' => array( | |
52 | // Paper size: names defined in option_value table (option_group = 'paper_size') | |
53 | 'name' => 'paper-size', | |
54 | 'type' => CRM_Utils_Type::T_STRING, | |
55 | 'default' => 'letter', | |
56 | ), | |
57 | 'orientation' => array( | |
58 | // Paper orientation: 'portrait' or 'landscape' | |
59 | 'name' => 'orientation', | |
60 | 'type' => CRM_Utils_Type::T_STRING, | |
61 | 'default' => 'portrait', | |
62 | ), | |
63 | 'font-name' => array( | |
64 | // Font name: 'courier', 'helvetica', 'times' | |
65 | 'name' => 'font-name', | |
66 | 'type' => CRM_Utils_Type::T_STRING, | |
67 | 'default' => 'helvetica', | |
68 | ), | |
69 | 'font-size' => array( | |
70 | // Font size: always in points | |
71 | 'name' => 'font-size', | |
72 | 'type' => CRM_Utils_Type::T_INT, | |
73 | 'default' => 8, | |
74 | ), | |
75 | 'font-style' => array( | |
76 | // Font style: 'B' bold, 'I' italic, 'BI' bold+italic | |
77 | 'name' => 'font-style', | |
78 | 'type' => CRM_Utils_Type::T_STRING, | |
79 | 'default' => '', | |
80 | ), | |
81 | 'NX' => array( | |
82 | // Number of labels horizontally | |
83 | 'name' => 'NX', | |
84 | 'type' => CRM_Utils_Type::T_INT, | |
85 | 'default' => 3, | |
86 | ), | |
87 | 'NY' => array( | |
88 | // Number of labels vertically | |
89 | 'name' => 'NY', | |
90 | 'type' => CRM_Utils_Type::T_INT, | |
91 | 'default' => 10, | |
92 | ), | |
93 | 'metric' => array( | |
94 | // Unit of measurement for all of the following fields | |
95 | 'name' => 'metric', | |
96 | 'type' => CRM_Utils_Type::T_STRING, | |
97 | 'default' => 'mm', | |
98 | ), | |
99 | 'lMargin' => array( | |
100 | // Left margin | |
101 | 'name' => 'lMargin', | |
102 | 'type' => CRM_Utils_Type::T_FLOAT, | |
103 | 'metric' => TRUE, | |
104 | 'default' => 4.7625, | |
105 | ), | |
106 | 'tMargin' => array( | |
107 | // Right margin | |
108 | 'name' => 'tMargin', | |
109 | 'type' => CRM_Utils_Type::T_FLOAT, | |
110 | 'metric' => TRUE, | |
111 | 'default' => 12.7, | |
112 | ), | |
113 | 'SpaceX' => array( | |
114 | // Horizontal space between two labels | |
115 | 'name' => 'SpaceX', | |
116 | 'type' => CRM_Utils_Type::T_FLOAT, | |
117 | 'metric' => TRUE, | |
118 | 'default' => 3.96875, | |
119 | ), | |
120 | 'SpaceY' => array( | |
121 | // Vertical space between two labels | |
122 | 'name' => 'SpaceY', | |
123 | 'type' => CRM_Utils_Type::T_FLOAT, | |
124 | 'metric' => TRUE, | |
125 | 'default' => 0, | |
126 | ), | |
127 | 'width' => array( | |
128 | // Width of label | |
129 | 'name' => 'width', | |
130 | 'type' => CRM_Utils_Type::T_FLOAT, | |
131 | 'metric' => TRUE, | |
132 | 'default' => 65.875, | |
133 | ), | |
134 | 'height' => array( | |
135 | // Height of label | |
136 | 'name' => 'height', | |
137 | 'type' => CRM_Utils_Type::T_FLOAT, | |
138 | 'metric' => TRUE, | |
139 | 'default' => 25.4, | |
140 | ), | |
141 | 'lPadding' => array( | |
142 | // Space between text and left edge of label | |
143 | 'name' => 'lPadding', | |
144 | 'type' => CRM_Utils_Type::T_FLOAT, | |
145 | 'metric' => TRUE, | |
146 | 'default' => 5.08, | |
147 | ), | |
148 | 'tPadding' => array( | |
149 | // Space between text and top edge of label | |
150 | 'name' => 'tPadding', | |
151 | 'type' => CRM_Utils_Type::T_FLOAT, | |
152 | 'metric' => TRUE, | |
153 | 'default' => 5.08, | |
154 | ), | |
155 | ); | |
156 | ||
157 | /** | |
158 | * Get page orientations recognized by the DOMPDF package used to create PDF letters. | |
159 | * | |
160 | * @param void | |
161 | * | |
a6c01b45 CW |
162 | * @return array |
163 | * array of page orientations | |
6a488035 | 164 | */ |
01d7cdd8 | 165 | public static function getPageOrientations() { |
6a488035 TO |
166 | return array( |
167 | 'portrait' => ts('Portrait'), | |
168 | 'landscape' => ts('Landscape'), | |
169 | ); | |
170 | } | |
171 | ||
172 | /** | |
173 | * Get font names supported by the TCPDF package used to create PDF labels. | |
174 | * | |
6a0b768e TO |
175 | * @param string $name |
176 | * Group name. | |
6a488035 | 177 | * |
a6c01b45 CW |
178 | * @return array |
179 | * array of font names | |
6a488035 | 180 | */ |
d3e86119 | 181 | public static function getFontNames($name = 'label_format') { |
eaf5045f | 182 | $label = new CRM_Utils_PDF_Label(self::getDefaultValues($name)); |
6a488035 TO |
183 | return $label->getFontNames(); |
184 | } | |
185 | ||
186 | /** | |
187 | * Get font sizes supported by the TCPDF package used to create PDF labels. | |
188 | * | |
189 | * @param void | |
190 | * | |
a6c01b45 CW |
191 | * @return array |
192 | * array of font sizes | |
6a488035 | 193 | */ |
01d7cdd8 | 194 | public static function getFontSizes() { |
b4a3ab6f | 195 | $fontSizes = array(); |
ccc0db8c | 196 | for ($i = 6; $i <= 60; $i++) { |
197 | $fontSizes[$i] = ts('%1 pt', array(1 => $i)); | |
b4a3ab6f | 198 | } |
199 | ||
200 | return $fontSizes; | |
6a488035 TO |
201 | } |
202 | ||
203 | /** | |
204 | * Get measurement units recognized by the TCPDF package used to create PDF labels. | |
205 | * | |
206 | * @param void | |
207 | * | |
a6c01b45 CW |
208 | * @return array |
209 | * array of measurement units | |
6a488035 | 210 | */ |
01d7cdd8 | 211 | public static function getUnits() { |
6a488035 TO |
212 | return array( |
213 | 'in' => ts('Inches'), | |
214 | 'cm' => ts('Centimeters'), | |
215 | 'mm' => ts('Millimeters'), | |
216 | 'pt' => ts('Points'), | |
217 | ); | |
218 | } | |
219 | ||
636f1cbe KJ |
220 | /** |
221 | * Get text alignment recognized by the TCPDF package used to create PDF labels. | |
222 | * | |
223 | * @param void | |
224 | * | |
a6c01b45 CW |
225 | * @return array |
226 | * array of alignments | |
636f1cbe KJ |
227 | */ |
228 | public static function getTextAlignments() { | |
229 | return array( | |
230 | 'R' => ts('Right'), | |
231 | 'L' => ts('Left'), | |
1b1d29d8 | 232 | 'C' => ts('Center'), |
636f1cbe KJ |
233 | ); |
234 | } | |
235 | ||
0bc1ba89 | 236 | /** |
237 | * Get text alignment recognized by the TCPDF package used to create PDF labels. | |
238 | * | |
239 | * @param void | |
240 | * | |
a6c01b45 CW |
241 | * @return array |
242 | * array of alignments | |
0bc1ba89 | 243 | */ |
244 | public static function getFontStyles() { | |
245 | return array( | |
246 | '' => ts('Normal'), | |
247 | 'B' => ts('Bold'), | |
248 | 'I' => ts('Italic'), | |
249 | ); | |
250 | } | |
251 | ||
6a488035 TO |
252 | /** |
253 | * Get Option Group ID for Label Formats | |
254 | * | |
77b97be7 EM |
255 | * @param string $name |
256 | * | |
a6c01b45 CW |
257 | * @return int |
258 | * Group ID (null if Group ID doesn't exist) | |
6a488035 | 259 | */ |
d3e86119 | 260 | private static function _getGid($name = 'label_format') { |
eaf5045f KJ |
261 | if (!isset(self::$_gid[$name]) || !self::$_gid[$name]) { |
262 | self::$_gid[$name] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $name, 'id', 'name'); | |
263 | if (!self::$_gid[$name]) { | |
6a488035 TO |
264 | CRM_Core_Error::fatal(ts('Label Format Option Group not found in database.')); |
265 | } | |
266 | } | |
eaf5045f | 267 | return self::$_gid[$name]; |
6a488035 TO |
268 | } |
269 | ||
270 | /** | |
271 | * Add ordering fields to Label Format list | |
272 | * | |
6a0b768e TO |
273 | * @param array (reference) $list List of Label Formats |
274 | * @param string $returnURL | |
275 | * URL of page calling this function. | |
6a488035 | 276 | * |
a6c01b45 CW |
277 | * @return array |
278 | * (reference) List of Label Formats | |
6a488035 | 279 | */ |
00be9182 | 280 | public static function addOrder(&$list, $returnURL) { |
6a488035 TO |
281 | $filter = "option_group_id = " . self::_getGid(); |
282 | CRM_Utils_Weight::addOrder($list, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter); | |
283 | } | |
284 | ||
285 | /** | |
286 | * Retrieve list of Label Formats. | |
287 | * | |
6a0b768e TO |
288 | * @param bool $namesOnly |
289 | * Return simple list of names. | |
290 | * @param string $groupName | |
291 | * Group name of the label format option group. | |
6a488035 | 292 | * |
a6c01b45 CW |
293 | * @return array |
294 | * (reference) label format list | |
6a488035 | 295 | */ |
d3e86119 | 296 | public static function &getList($namesOnly = FALSE, $groupName = 'label_format') { |
6a488035 | 297 | static $list = array(); |
4f1ddb25 | 298 | if (self::_getGid($groupName)) { |
6a488035 TO |
299 | // get saved label formats from Option Value table |
300 | $dao = new CRM_Core_DAO_OptionValue(); | |
4f1ddb25 | 301 | $dao->option_group_id = self::_getGid($groupName); |
6a488035 TO |
302 | $dao->is_active = 1; |
303 | $dao->orderBy('weight'); | |
304 | $dao->find(); | |
305 | while ($dao->fetch()) { | |
306 | if ($namesOnly) { | |
4f1ddb25 | 307 | $list[$groupName][$dao->name] = $dao->label; |
6a488035 TO |
308 | } |
309 | else { | |
4f1ddb25 | 310 | CRM_Core_DAO::storeValues($dao, $list[$groupName][$dao->id]); |
6a488035 TO |
311 | } |
312 | } | |
313 | } | |
4f1ddb25 | 314 | return $list[$groupName]; |
6a488035 TO |
315 | } |
316 | ||
317 | /** | |
100fef9d | 318 | * Retrieve the default Label Format values |
6a488035 | 319 | * |
6a0b768e TO |
320 | * @param string $groupName |
321 | * Label format group name. | |
6a488035 | 322 | * |
a6c01b45 CW |
323 | * @return array |
324 | * Name/value pairs containing the default Label Format values. | |
6a488035 | 325 | */ |
00be9182 | 326 | public static function &getDefaultValues($groupName = 'label_format') { |
6a488035 TO |
327 | $params = array('is_active' => 1, 'is_default' => 1); |
328 | $defaults = array(); | |
eaf5045f | 329 | if (!self::retrieve($params, $defaults, $groupName)) { |
6a488035 TO |
330 | foreach (self::$optionValueFields as $name => $field) { |
331 | $defaults[$name] = $field['default']; | |
332 | } | |
eaf5045f | 333 | $filter = array('option_group_id' => self::_getGid($groupName)); |
6a488035 TO |
334 | $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $filter); |
335 | } | |
336 | return $defaults; | |
337 | } | |
338 | ||
339 | /** | |
340 | * Get Label Format from the DB | |
341 | * | |
6a0b768e TO |
342 | * @param string $field |
343 | * Field name to search by. | |
344 | * @param int $val | |
345 | * Field value to search for. | |
77b97be7 EM |
346 | * |
347 | * @param string $groupName | |
6a488035 | 348 | * |
a6c01b45 CW |
349 | * @return array |
350 | * (reference) associative array of name/value pairs | |
6a488035 | 351 | */ |
00be9182 | 352 | public static function &getLabelFormat($field, $val, $groupName = 'label_format') { |
6a488035 TO |
353 | $params = array('is_active' => 1, $field => $val); |
354 | $labelFormat = array(); | |
eaf5045f | 355 | if (self::retrieve($params, $labelFormat, $groupName)) { |
6a488035 TO |
356 | return $labelFormat; |
357 | } | |
358 | else { | |
eaf5045f | 359 | return self::getDefaultValues($groupName); |
6a488035 TO |
360 | } |
361 | } | |
362 | ||
363 | /** | |
364 | * Get Label Format by Name | |
365 | * | |
6a0b768e TO |
366 | * @param int $name |
367 | * Label format name. Empty = get default label format. | |
6a488035 | 368 | * |
a6c01b45 CW |
369 | * @return array |
370 | * (reference) associative array of name/value pairs | |
6a488035 | 371 | */ |
00be9182 | 372 | public static function &getByName($name) { |
6a488035 TO |
373 | return self::getLabelFormat('name', $name); |
374 | } | |
375 | ||
376 | /** | |
377 | * Get Label Format by ID | |
378 | * | |
6a0b768e TO |
379 | * @param int $id |
380 | * Label format id. 0 = get default label format. | |
381 | * @param string $groupName | |
382 | * Group name. | |
6a488035 | 383 | * |
a6c01b45 CW |
384 | * @return array |
385 | * (reference) associative array of name/value pairs | |
6a488035 | 386 | */ |
00be9182 | 387 | public static function &getById($id, $groupName = 'label_format') { |
eaf5045f | 388 | return self::getLabelFormat('id', $id, $groupName); |
6a488035 TO |
389 | } |
390 | ||
391 | /** | |
392 | * Get Label Format field from associative array | |
393 | * | |
6a0b768e TO |
394 | * @param string $field |
395 | * Name of a label format field. | |
2a6da8d7 | 396 | * @param array (reference) $values associative array of name/value pairs containing |
6a488035 TO |
397 | * label format field selections |
398 | * | |
2a6da8d7 EM |
399 | * @param null $default |
400 | * | |
6a488035 | 401 | * @return value |
6a488035 | 402 | */ |
00be9182 | 403 | public static function getValue($field, &$values, $default = NULL) { |
6a488035 TO |
404 | if (array_key_exists($field, self::$optionValueFields)) { |
405 | switch (self::$optionValueFields[$field]['type']) { | |
406 | case CRM_Utils_Type::T_INT: | |
353ffa53 | 407 | return (int) CRM_Utils_Array::value($field, $values, $default); |
6a488035 TO |
408 | |
409 | case CRM_Utils_Type::T_FLOAT: | |
410 | // Round float values to three decimal places and trim trailing zeros. | |
411 | // Add a leading zero to values less than 1. | |
412 | $f = sprintf('%05.3f', $values[$field]); | |
413 | $f = rtrim($f, '0'); | |
414 | $f = rtrim($f, '.'); | |
353ffa53 | 415 | return (float) (empty($f) ? '0' : $f); |
6a488035 TO |
416 | } |
417 | return CRM_Utils_Array::value($field, $values, $default); | |
418 | } | |
419 | return $default; | |
420 | } | |
421 | ||
422 | /** | |
423 | * Takes a bunch of params that are needed to match certain criteria and | |
424 | * retrieves the relevant objects. Typically the valid params are only | |
425 | * label id. It also stores all the retrieved values in the default array. | |
426 | * | |
6a0b768e TO |
427 | * @param array $params |
428 | * (reference ) an assoc array of name/value pairs. | |
429 | * @param array $values | |
430 | * (reference ) an assoc array to hold the flattened values. | |
77b97be7 EM |
431 | * |
432 | * @param string $groupName | |
6a488035 | 433 | * |
16b10e64 | 434 | * @return CRM_Core_DAO_OptionValue |
6a488035 | 435 | */ |
d3e86119 | 436 | public static function retrieve(&$params, &$values, $groupName = 'label_format') { |
6a488035 TO |
437 | $optionValue = new CRM_Core_DAO_OptionValue(); |
438 | $optionValue->copyValues($params); | |
eaf5045f | 439 | $optionValue->option_group_id = self::_getGid($groupName); |
6a488035 TO |
440 | if ($optionValue->find(TRUE)) { |
441 | // Extract fields that have been serialized in the 'value' column of the Option Value table. | |
442 | $values = json_decode($optionValue->value, TRUE); | |
443 | // Add any new fields that don't yet exist in the saved values. | |
444 | foreach (self::$optionValueFields as $name => $field) { | |
445 | if (!isset($values[$name])) { | |
446 | $values[$name] = $field['default']; | |
447 | if ($field['metric']) { | |
448 | $values[$name] = CRM_Utils_PDF_Utils::convertMetric($field['default'], | |
449 | self::$optionValueFields['metric']['default'], | |
450 | $values['metric'], 3 | |
451 | ); | |
452 | } | |
453 | } | |
454 | } | |
455 | // Add fields from the OptionValue base class | |
456 | CRM_Core_DAO::storeValues($optionValue, $values); | |
457 | return $optionValue; | |
458 | } | |
459 | return NULL; | |
460 | } | |
461 | ||
462 | /** | |
463 | * Return the name of the group for customized labels | |
464 | * | |
465 | * @param void | |
466 | * | |
467 | * @return void | |
6a488035 | 468 | */ |
4f1ddb25 | 469 | public static function customGroupName() { |
6a488035 TO |
470 | return ts('Custom'); |
471 | } | |
472 | ||
473 | /** | |
474 | * Save the Label Format in the DB | |
475 | * | |
6a0b768e TO |
476 | * @param array (reference) $values associative array of name/value pairs |
477 | * @param int $id | |
478 | * Id of the database record (null = new record). | |
479 | * @param string $groupName | |
480 | * Group name of the label format. | |
6a488035 TO |
481 | * |
482 | * @return void | |
6a488035 | 483 | */ |
00be9182 | 484 | public function saveLabelFormat(&$values, $id = NULL, $groupName = 'label_format') { |
6a488035 | 485 | // get the Option Group ID for Label Formats (create one if it doesn't exist) |
eaf5045f | 486 | $group_id = self::_getGid($groupName); |
6a488035 TO |
487 | |
488 | // clear other default if this is the new default label format | |
489 | if ($values['is_default']) { | |
490 | $query = "UPDATE civicrm_option_value SET is_default = 0 WHERE option_group_id = $group_id"; | |
491 | CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); | |
492 | } | |
493 | if ($id) { | |
494 | // fetch existing record | |
495 | $this->id = $id; | |
496 | if ($this->find()) { | |
497 | $this->fetch(); | |
498 | } | |
499 | } | |
500 | else { | |
501 | // new record | |
353ffa53 | 502 | $list = self::getList(TRUE, $groupName); |
6a488035 | 503 | $cnt = 1; |
353ffa53 TO |
504 | while (array_key_exists("custom_$cnt", $list)) { |
505 | $cnt++; | |
506 | } | |
6a488035 TO |
507 | $values['name'] = "custom_$cnt"; |
508 | $values['grouping'] = self::customGroupName(); | |
509 | } | |
510 | // copy the supplied form values to the corresponding Option Value fields in the base class | |
511 | foreach ($this->fields() as $name => $field) { | |
512 | $this->$name = trim(CRM_Utils_Array::value($name, $values, $this->$name)); | |
513 | if (empty($this->$name)) { | |
514 | $this->$name = 'null'; | |
515 | } | |
516 | } | |
517 | $this->id = $id; | |
518 | $this->option_group_id = $group_id; | |
519 | $this->is_active = 1; | |
520 | ||
521 | // serialize label format fields into a single string to store in the 'value' column of the Option Value table | |
522 | $v = json_decode($this->value, TRUE); | |
523 | foreach (self::$optionValueFields as $name => $field) { | |
8e9fd9e4 | 524 | if (!isset($v[$name])) { |
525 | $v[$name] = NULL; | |
526 | } | |
6a488035 TO |
527 | $v[$name] = self::getValue($name, $values, $v[$name]); |
528 | } | |
529 | $this->value = json_encode($v); | |
530 | ||
531 | // make sure serialized array will fit in the 'value' column | |
532 | $attribute = CRM_Core_DAO::getAttribute('CRM_Core_BAO_LabelFormat', 'value'); | |
533 | if (strlen($this->value) > $attribute['maxlength']) { | |
534 | CRM_Core_Error::fatal(ts('Label Format does not fit in database.')); | |
535 | } | |
536 | $this->save(); | |
537 | ||
538 | // fix duplicate weights | |
539 | $filter = array('option_group_id' => self::_getGid()); | |
540 | CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_OptionValue', $filter); | |
541 | } | |
542 | ||
543 | /** | |
100fef9d | 544 | * Delete a Label Format |
6a488035 | 545 | * |
6a0b768e TO |
546 | * @param int $id |
547 | * ID of the label format to be deleted. | |
548 | * @param string $groupName | |
549 | * Group name. | |
6a488035 | 550 | */ |
00be9182 | 551 | public static function del($id, $groupName) { |
6a488035 TO |
552 | if ($id) { |
553 | $dao = new CRM_Core_DAO_OptionValue(); | |
554 | $dao->id = $id; | |
555 | if ($dao->find(TRUE)) { | |
eaf5045f KJ |
556 | if ($dao->option_group_id == self::_getGid($groupName)) { |
557 | $filter = array('option_group_id' => self::_getGid($groupName)); | |
6a488035 TO |
558 | CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $id, $filter); |
559 | $dao->delete(); | |
560 | return; | |
561 | } | |
562 | } | |
563 | } | |
564 | CRM_Core_Error::fatal(ts('Invalid value passed to delete function.')); | |
565 | } | |
566 | } |