whitespace cleanup
[civicrm-core.git] / tests / phpunit / WebTest / Contribute / UpdateContributionTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 */
26
27
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase {
30
31 protected function setUp() {
32 parent::setUp();
33 }
34
35 function testChangeContributionAmount() {
36 $this->webtestLogin();
37 $firstName = substr(sha1(rand()), 0, 7);
38 $lastName = 'Contributor';
39 $email = $firstName . "@example.com";
40 $amount = 100;
41 //Offline Pay Later Contribution
42 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
43
44 $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
45
46 $this->type("sort_name", "$lastName, $firstName");
47 $this->click("_qf_Search_refresh");
48
49 $this->waitForPageToLoad($this->getTimeoutMsec());
50 $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']/table/tbody/tr[1]/td[11]/span/a@href"));
51 if (!empty($contriIDOff)) {
52 $contriIDOff = substr($contriIDOff[1], (strrpos($contriIDOff[1], '=') + 1));
53 }
54
55 $this->click("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]");
56 $this->waitForElementPresent("total_amount");
57 $this->type("total_amount", "90");
58 $this->click('_qf_Contribution_upload');
59 $this->waitForPageToLoad($this->getTimeoutMsec());
60
61 // Is status message correct?
62 $this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!");
63 //For Contribution
64 $searchParams = array('id' => $contriIDOff);
65 $compareParams = array('total_amount' => '90.00');
66 //For LineItem
67 $lineItemSearchParams = array('entity_id' => $contriIDOff);
68 $lineItemCompareParams = array('line_total' => '90.00');
69
70
71 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams);
72 $this->assertDBCompareValues('CRM_Price_DAO_LineItem', $lineItemSearchParams, $lineItemCompareParams);
73
74
75 $total = $this->_getTotalContributedAmount($contriIDOff);
76 $compare = array('total_amount' => $total);
77 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
78
79
80
81 $amount = $this->_getFinancialItemAmount($contriIDOff);
82 $compare = array('total_amount' => $amount);
83 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
84
85 $financialTrxnAmount = $this->_getFinancialTrxnAmount($contriIDOff);
86 $compare = array('total_amount' => $financialTrxnAmount);
87 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
88 }
89
90 function testPayLater() {
91 $this->webtestLogin();
92 $firstName = substr(sha1(rand()), 0, 7);
93 $lastName = 'Contributor';
94 $email = $firstName . "@example.com";
95 $amount = 100.00;
96 //Offline Pay Later Contribution
97 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
98 $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");
99 $this->waitForPageToLoad($this->getTimeoutMsec());
100 $elements = $this->parseURL();
101 $contId = $elements['queryString']['id'];
102 $this->select("contribution_status_id", "label=Completed");
103 $this->click("_qf_Contribution_upload");
104 $this->waitForPageToLoad($this->getTimeoutMsec());
105 //Assertions
106 $search = array('id' => $contId);
107 $compare = array('contribution_status_id' => 1);
108 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
109
110 $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
111 $search = array( 'entity_id' => $lineItem );
112 $compare = array( 'status_id' => 1 );
113 $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
114
115 $status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status");
116 $this->assertEquals($status, '1', "Verify Completed Status");
117
118 }
119
120 function testChangePremium() {
121 $this->webtestLogin();
122 $firstName = substr(sha1(rand()), 0, 7);
123 $lastName = 'Contributor';
124 $email = $firstName . "@example.com";
125 $from = 'Premiums';
126 $to = 'Premiums inventory';
127 $financialType = array(
128 'name' => 'Test Financial'.substr(sha1(rand()), 0, 7),
129 'is_reserved' => 1,
130 'is_deductible' => 1,
131 );
132 $this->addeditFinancialType($financialType);
133 $this->select("account_relationship", "label=Cost of Sales Account is");
134 $this->select("financial_account_id", "label=$from");
135 $this->click("_qf_FinancialTypeAccount_next_new-botttom");
136 $this->waitForPageToLoad($this->getTimeoutMsec());
137 $this->select("account_relationship", "label=Premiums Inventory Account is");
138 $this->select("financial_account_id", "label=$to");
139 $this->click("_qf_FinancialTypeAccount_next-botttom");
140 $premiumName = 'Premium'.substr(sha1(rand()), 0, 7);
141 $amount = 500;
142 $sku = 'SKU';
143 $price = 300;
144 $cost = 3.00;
145 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
146 // add premium
147 $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
148
149 //add second premium
150 $premiumName2 = 'Premium'.substr(sha1(rand()), 0, 7);
151 $amount2 = 600;
152 $sku2 = 'SKU';
153 $price2 = 200;
154 $cost2 = 2.00;
155 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
156 $this->addPremium($premiumName2, $sku2, $amount2, $price2, $cost2, $financialType['name']);
157
158 // add contribution with premium
159 $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
160
161 // create new contact using dialog
162 $this->webtestNewDialogContact($firstName, $lastName, $email);
163 // select financial type
164 $this->select( "financial_type_id", "value=1" );
165 // total amount
166 $this->type("total_amount", "100");
167 // fill Premium information
168 $this->click("xpath=//div[@id='Premium']");
169 $this->waitForElementPresent("product_name_0");
170 $this->select('product_name_0', "label=$premiumName ( $sku )");
171 // Clicking save.
172 $this->click("_qf_Contribution_upload");
173 $this->waitForPageToLoad($this->getTimeoutMsec());
174 // Is status message correct?
175 $this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!");
176 // verify if Membership is created
177 $this->waitForElementPresent("xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
178 //click through to the Contribution edit screen
179 $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");
180 $this->waitForElementPresent("_qf_Contribution_upload-bottom");
181 $elements = $this->parseURL();
182 $contId = $elements['queryString']['id'];
183 $this->waitForElementPresent("product_name_0");
184 $this->select('product_name_0', "label=$premiumName2 ( $sku2 )");
185 // Clicking save.
186 $this->click("_qf_Contribution_upload");
187 $this->waitForPageToLoad($this->getTimeoutMsec());
188
189 //Assertions
190 $actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'");
191 $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium");
192
193 $deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'");
194 $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium");
195 }
196
197 function testDeletePremium() {
198 $this->webtestLogin();
199 $firstName = substr(sha1(rand()), 0, 7);
200 $lastName = 'Contributor';
201 $email = $firstName . "@example.com";
202 $from = 'Premiums';
203 $to = 'Premiums inventory';
204 $financialType = array(
205 'name' => 'Test Financial'.substr(sha1(rand()), 0, 7),
206 'is_reserved' => 1,
207 'is_deductible' => 1,
208 );
209 $this->addeditFinancialType($financialType);
210 $this->select("account_relationship", "label=Cost of Sales Account is");
211 $this->select("financial_account_id", "label=$from");
212 $this->click("_qf_FinancialTypeAccount_next_new-botttom");
213 $this->waitForPageToLoad($this->getTimeoutMsec());
214 $this->select("account_relationship", "label=Premiums Inventory Account is");
215 $this->select("financial_account_id", "label=$to");
216 $this->click("_qf_FinancialTypeAccount_next-botttom");
217 $premiumName = 'Premium'.substr(sha1(rand()), 0, 7);
218 $amount = 500;
219 $sku = 'SKU';
220 $price = 300;
221 $cost = 3.00;
222 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
223 // add premium
224 $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
225
226 // add contribution with premium
227 $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
228
229 // create new contact using dialog
230 $this->webtestNewDialogContact($firstName, $lastName, $email);
231 // select financial type
232 $this->select("financial_type_id", "value=1");
233 // total amount
234 $this->type("total_amount", "100");
235 // fill Premium information
236 $this->click("xpath=//div[@id='Premium']");
237 $this->waitForElementPresent("product_name_0");
238 $this->select('product_name_0', "label=$premiumName ( $sku )");
239 // Clicking save.
240 $this->click("_qf_Contribution_upload");
241 $this->waitForPageToLoad($this->getTimeoutMsec());
242 // Is status message correct?
243 $this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!");
244 // verify if Membership is created
245 $this->waitForElementPresent("xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
246 //click through to the Contribution edit screen
247 $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");
248 $this->waitForElementPresent("_qf_Contribution_upload-bottom");
249 $elements = $this->parseURL();
250 $contId = $elements['queryString']['id'];
251 $this->waitForElementPresent("product_name_0");
252 $this->select('product_name_0', "value=0");
253 // Clicking save.
254 $this->click("_qf_Contribution_upload");
255 $this->waitForPageToLoad($this->getTimeoutMsec());
256
257 //Assertions
258 $actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'");
259 $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium");
260 }
261
262 function testChangePaymentInstrument() {
263 $this->webtestLogin();
264 $firstName = substr(sha1(rand()), 0, 7);
265 $lastName = 'Contributor';
266 $email = $firstName . "@example.com";
267 $label = 'TEST'.substr(sha1(rand()), 0, 7);
268 $amount = 100.00;
269 $financialAccount = CRM_Contribute_PseudoConstant::financialAccount();
270 $to = array_search('Accounts Receivable', $financialAccount);
271 $from = array_search('Deposit Bank Account', $financialAccount);
272 $this->addPaymentInstrument($label, $to);
273 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
274 $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");
275 $this->waitForPageToLoad($this->getTimeoutMsec());
276 $elements = $this->parseURL();
277 $contId = $elements['queryString']['id'];
278 //change payment processor to newly created value
279 $this->select("payment_instrument_id", "label=$label");
280 $this->click("_qf_Contribution_upload");
281 $this->waitForPageToLoad($this->getTimeoutMsec());
282 //Assertions
283 $totalAmount = $this->_getPremiumActualCost($contId, 'Payment Processor Account', 'Accounts Receivable');
284 $this->assertEquals($totalAmount, $amount, "Verify amount for newly inserted values");
285 }
286
287 function testRefundContribution() {
288 $this->webtestLogin();
289 $firstName = substr(sha1(rand()), 0, 7);
290 $lastName = 'Contributor';
291 $email = $firstName . "@example.com";
292 $label = 'TEST'.substr(sha1(rand()), 0, 7);
293 $amount = 100.00;
294 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
295 $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");
296 $this->waitForPageToLoad($this->getTimeoutMsec());
297 //Contribution status
298 $this->select("contribution_status_id", "label=Refunded");
299 $elements = $this->parseURL();
300 $contId = $elements['queryString']['id'];
301 $this->click("_qf_Contribution_upload");
302 $this->waitForPageToLoad($this->getTimeoutMsec());
303
304 //Assertions
305 $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
306 $search = array('entity_id' => $lineItem);
307 $compare = array(
308 'amount' => '100.00',
309 'status_id' => 1,
310 );
311 $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
312 $amount = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account', -100.00, "'civicrm_contribution'");
313 $this->assertEquals($amount, '-100.00', 'Verify Financial Trxn Amount.');
314 }
315
316 function testCancelPayLater() {
317 $this->webtestLogin();
318 $firstName = substr(sha1(rand()), 0, 7);
319 $lastName = 'Contributor';
320 $email = $firstName . "@example.com";
321 $label = 'TEST'.substr(sha1(rand()), 0, 7);
322 $amount = 100.00;
323 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
324 $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");
325 $this->waitForPageToLoad($this->getTimeoutMsec());
326 //Contribution status
327 $this->select("contribution_status_id", "label=Cancelled");
328 $elements = $this->parseURL();
329 $contId = $elements['queryString']['id'];
330 $this->click("_qf_Contribution_upload");
331 $this->waitForPageToLoad($this->getTimeoutMsec());
332
333 //Assertions
334 $search = array('id' => $contId);
335 $compare = array('contribution_status_id' => 3);
336 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
337 $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
338 $itemParams = array(
339 'amount' => '-100.00',
340 'entity_id' => $lineItem,
341 );
342 $defaults = array();
343 $items = CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $defaults);
344 $this->assertEquals($items->amount, $itemParams['amount'], 'Verify Amount for financial Item');
345 $totalAmount = $this->_getPremiumActualCost($items->id, 'Accounts Receivable', NULL, "-100.00", "'civicrm_financial_item'");
346 $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
347 $totalAmount = $this->_getPremiumActualCost($contId, 'Accounts Receivable', NULL, "-100.00", "'civicrm_contribution'");
348 $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
349 }
350
351 function testChangeFinancialType() {
352 $this->webtestLogin();
353 $firstName = substr(sha1(rand()), 0, 7);
354 $lastName = 'Contributor';
355 $email = $firstName . "@example.com";
356 $label = 'TEST'.substr(sha1(rand()), 0, 7);
357 $amount = 100.00;
358 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
359 $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='Edit']");
360 $this->waitForPageToLoad($this->getTimeoutMsec());
361 //Contribution status
362 $this->select("financial_type_id", "value=3");
363 $elements = $this->parseURL();
364 $contId = $elements['queryString']['id'];
365 $this->click("_qf_Contribution_upload");
366 $this->waitForPageToLoad($this->getTimeoutMsec());
367
368 //Assertions
369 $search = array( 'id' => $contId );
370 $compare = array( 'financial_type_id' => 3 );
371 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
372
373 $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
374 $itemParams = array(
375 'amount' => '-100.00',
376 'entity_id' => $lineItem,
377 );
378 $item1 = $item2 = array();
379 CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item1);
380 $this->assertEquals($item1['amount'], "-100.00", "Verify Amount for New Financial Item");
381 $itemParams['amount'] = '100.00';
382 CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item2);
383 $this->assertEquals($item2['amount'], "100.00", "Verify Amount for New Financial Item");
384
385 $cValue1 = $this->_getPremiumActualCost($contId, NULL, NULL, "-100.00", "'civicrm_contribution'");
386 $fValue1 = $this->_getPremiumActualCost($item1['id'], NULL, NULL, "-100.00", "'civicrm_financial_item'");
387 $this->assertEquals($cValue1, "-100.00", "Verify Amount");
388 $this->assertEquals($fValue1, "-100.00", "Verify Amount");
389 $cValue2 = $this->_getPremiumActualCost($contId, NULL, NULL, "100.00", "'civicrm_contribution'");
390 $fValue2 = $this->_getPremiumActualCost($item2['id'], NULL, NULL, "100.00", "'civicrm_financial_item'");
391 $this->assertEquals($cValue2, "100.00", "Verify Amount");
392 $this->assertEquals($fValue2, "100.00", "Verify Amount");
393 }
394
395 function _getPremiumActualCost($entityId, $from = NULL, $to = NULL, $cost = NULL, $entityTable = NULL, $select = "ft.total_amount AS amount") {
396 $financialAccount = CRM_Contribute_PseudoConstant::financialAccount();
397 $query = "SELECT
398 {$select}
399 FROM civicrm_financial_trxn ft
400 INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_id = {$entityId}";
401 if ($entityTable) {
402 $query .= " AND eft.entity_table = {$entityTable}";
403 }
404 if (!empty($to)) {
405 $to = array_search($to, $financialAccount);
406 $query .= " AND ft.to_financial_account_id = {$to}";
407 }
408 if (!empty($from)) {
409 $from = array_search($from, $financialAccount);
410 $query .= " AND ft.from_financial_account_id = {$from}";
411 }
412 if (!empty($cost)) {
413 $query .= " AND eft.amount = {$cost}";
414 }
415 $result = CRM_Core_DAO::singleValueQuery($query);
416 return $result;
417 }
418
419 function _getFinancialTrxnAmount($contId) {
420 $query = "SELECT
421 SUM( ft.total_amount ) AS total
422 FROM civicrm_financial_trxn AS ft
423 LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.id = ceft.financial_trxn_id
424 WHERE ceft.entity_table = 'civicrm_contribution'
425 AND ceft.entity_id = {$contId}";
426 $result = CRM_Core_DAO::singleValueQuery($query);
427 return $result;
428 }
429
430 function _getFinancialItemAmount($contId) {
431 $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
432 $query = "SELECT
433 SUM(amount)
434 FROM civicrm_financial_item
435 WHERE entity_table = 'civicrm_line_item'
436 AND entity_id = {$lineItem}";
437 $result = CRM_Core_DAO::singleValueQuery($query);
438 return $result;
439 }
440
441 function _getTotalContributedAmount($contId) {
442 $query = "SELECT
443 SUM(amount)
444 FROM civicrm_entity_financial_trxn
445 WHERE entity_table = 'civicrm_contribution'
446 AND entity_id = {$contId}";
447 $result = CRM_Core_DAO::singleValueQuery($query);
448 return $result;
449 }
450
451 function _testOfflineContribution($firstName, $lastName, $email, $amount, $status="Completed") {
452
453 $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
454
455 // create new contact using dialog
456 $this->webtestNewDialogContact($firstName, $lastName, $email);
457
458 // select financial type
459 $this->select( "financial_type_id", "value=1" );
460
461 //Contribution status
462 $this->select("contribution_status_id", "label=$status");
463
464 // total amount
465 $this->type("total_amount", $amount);
466
467 // select payment instrument type
468 $this->select("payment_instrument_id", "label=Credit Card");
469
470
471 $this->type("trxn_id", "P20901X1" . rand(100, 10000));
472
473
474 //Custom Data
475 //$this->click('CIVICRM_QFID_3_6');
476
477 // Clicking save.
478 $this->click("_qf_Contribution_upload");
479 $this->waitForPageToLoad($this->getTimeoutMsec());
480
481 // Is status message correct?
482 $this->assertTrue($this->isTextPresent("The contribution record has been saved."), "Status message didn't show up after saving!");
483
484 // verify if Membership is created
485 $this->waitForElementPresent("xpath=//div[@id='Contributions']//table//tbody/tr[1]/td[8]/span/a[text()='View']");
486
487 //click through to the Membership view screen
488 $this->click("xpath=//div[@id='Contributions']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
489 $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
490
491 $expected = array(
492 'Financial Type' => 'Donation',
493 'Total Amount' => '100.00',
494 'Contribution Status' => $status,
495 );
496 foreach ($expected as $label => $value) {
497 $this->verifyText("xpath=id('ContributionView')/div[2]/table[1]/tbody//tr/td[1][text()='$label']/../td[2]", preg_quote($value));
498 }
499 $this->click("_qf_ContributionView_cancel-top");
500 $this->waitForPageToLoad($this->getTimeoutMsec());
501 // Because it tends to cause problems, all uses of sleep() must be justified in comments
502 // Sleep should never be used for wait for anything to load from the server
503 // Justification for this instance: FIXME
504 sleep(4);
505 }
506 }
507