paymentexpensereport.class.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <?php
  2. /* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/expensereport/class/paymentexpensereport.class.php
  19. * \ingroup Expense Report
  20. * \brief File of class to manage payment of expense report
  21. */
  22. require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
  23. /** \class PaymentExpenseReport
  24. * \brief Class to manage payments of expense report
  25. */
  26. class PaymentExpenseReport extends CommonObject
  27. {
  28. public $element='payment_expensereport'; //!< Id that identify managed objects
  29. public $table_element='payment_expensereport'; //!< Name of table without prefix where object is stored
  30. public $picto = 'payment';
  31. var $rowid;
  32. var $fk_expensereport;
  33. var $datec='';
  34. var $tms='';
  35. var $datep='';
  36. var $amount; // Total amount of payment
  37. var $amounts=array(); // Array of amounts
  38. var $fk_typepayment;
  39. var $num_payment;
  40. var $fk_bank;
  41. var $fk_user_creat;
  42. var $fk_user_modif;
  43. /**
  44. * Constructor
  45. *
  46. * @param DoliDB $db Database handler
  47. */
  48. function __construct($db)
  49. {
  50. $this->db = $db;
  51. }
  52. /**
  53. * Create payment of expense report into database.
  54. * Use this->amounts to have list of lines for the payment
  55. *
  56. * @param User $user User making payment
  57. * @return int <0 if KO, id of payment if OK
  58. */
  59. function create($user)
  60. {
  61. global $conf, $langs;
  62. $error=0;
  63. $now=dol_now();
  64. // Validate parameters
  65. if (! $this->datepaid)
  66. {
  67. $this->error='ErrorBadValueForParameterCreatePaymentExpenseReport';
  68. return -1;
  69. }
  70. // Clean parameters
  71. if (isset($this->fk_expensereport)) $this->fk_expensereport=trim($this->fk_expensereport);
  72. if (isset($this->amount)) $this->amount=trim($this->amount);
  73. if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
  74. if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
  75. if (isset($this->note)) $this->note=trim($this->note);
  76. if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
  77. if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
  78. if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
  79. $totalamount = 0;
  80. foreach ($this->amounts as $key => $value) // How payment is dispatch
  81. {
  82. $newvalue = price2num($value,'MT');
  83. $this->amounts[$key] = $newvalue;
  84. $totalamount += $newvalue;
  85. }
  86. $totalamount = price2num($totalamount);
  87. // Check parameters
  88. if ($totalamount == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
  89. $this->db->begin();
  90. if ($totalamount != 0)
  91. {
  92. $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_expensereport (fk_expensereport, datec, datep, amount,";
  93. $sql.= " fk_typepayment, num_payment, note, fk_user_creat, fk_bank)";
  94. $sql.= " VALUES ($this->chid, '".$this->db->idate($now)."',";
  95. $sql.= " '".$this->db->idate($this->datepaid)."',";
  96. $sql.= " ".$totalamount.",";
  97. $sql.= " ".$this->fk_typepayment.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
  98. $sql.= " 0)";
  99. dol_syslog(get_class($this)."::create", LOG_DEBUG);
  100. $resql=$this->db->query($sql);
  101. if ($resql)
  102. {
  103. $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_expensereport");
  104. }
  105. else
  106. {
  107. $error++;
  108. }
  109. }
  110. if ($totalamount != 0 && ! $error)
  111. {
  112. $this->amount=$totalamount;
  113. $this->db->commit();
  114. return $this->id;
  115. }
  116. else
  117. {
  118. $this->error=$this->db->error();
  119. $this->db->rollback();
  120. return -1;
  121. }
  122. }
  123. /**
  124. * Load object in memory from database
  125. *
  126. * @param int $id Id object
  127. * @return int <0 if KO, >0 if OK
  128. */
  129. function fetch($id)
  130. {
  131. global $langs;
  132. $sql = "SELECT";
  133. $sql.= " t.rowid,";
  134. $sql.= " t.fk_expensereport,";
  135. $sql.= " t.datec,";
  136. $sql.= " t.tms,";
  137. $sql.= " t.datep,";
  138. $sql.= " t.amount,";
  139. $sql.= " t.fk_typepayment,";
  140. $sql.= " t.num_payment,";
  141. $sql.= " t.note,";
  142. $sql.= " t.fk_bank,";
  143. $sql.= " t.fk_user_creat,";
  144. $sql.= " t.fk_user_modif,";
  145. $sql.= " pt.code as type_code, pt.libelle as type_libelle,";
  146. $sql.= ' b.fk_account';
  147. $sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as pt, ".MAIN_DB_PREFIX."payment_expensereport as t)";
  148. $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
  149. $sql.= " WHERE t.rowid = ".$id." AND t.fk_typepayment = pt.id";
  150. dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
  151. $resql=$this->db->query($sql);
  152. if ($resql)
  153. {
  154. if ($this->db->num_rows($resql))
  155. {
  156. $obj = $this->db->fetch_object($resql);
  157. $this->id = $obj->rowid;
  158. $this->ref = $obj->rowid;
  159. $this->fk_expensereport = $obj->fk_expensereport;
  160. $this->datec = $this->db->jdate($obj->datec);
  161. $this->tms = $this->db->jdate($obj->tms);
  162. $this->datep = $this->db->jdate($obj->datep);
  163. $this->amount = $obj->amount;
  164. $this->fk_typepayment = $obj->fk_typepayment;
  165. $this->num_payment = $obj->num_payment;
  166. $this->note = $obj->note;
  167. $this->fk_bank = $obj->fk_bank;
  168. $this->fk_user_creat = $obj->fk_user_creat;
  169. $this->fk_user_modif = $obj->fk_user_modif;
  170. $this->type_code = $obj->type_code;
  171. $this->type_libelle = $obj->type_libelle;
  172. $this->bank_account = $obj->fk_account;
  173. $this->bank_line = $obj->fk_bank;
  174. }
  175. $this->db->free($resql);
  176. return 1;
  177. }
  178. else
  179. {
  180. $this->error="Error ".$this->db->lasterror();
  181. return -1;
  182. }
  183. }
  184. /**
  185. * Update database
  186. *
  187. * @param User $user User that modify
  188. * @param int $notrigger 0=launch triggers after, 1=disable triggers
  189. * @return int <0 if KO, >0 if OK
  190. */
  191. function update($user=null, $notrigger=0)
  192. {
  193. global $conf, $langs;
  194. $error=0;
  195. // Clean parameters
  196. if (isset($this->fk_expensereport)) $this->fk_expensereport=trim($this->fk_expensereport);
  197. if (isset($this->amount)) $this->amount=trim($this->amount);
  198. if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
  199. if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
  200. if (isset($this->note)) $this->note=trim($this->note);
  201. if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
  202. if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
  203. if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
  204. // Check parameters
  205. // Put here code to add control on parameters values
  206. // Update request
  207. $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET";
  208. $sql.= " fk_expensereport=".(isset($this->fk_expensereport)?$this->fk_expensereport:"null").",";
  209. $sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
  210. $sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
  211. $sql.= " datep=".(dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
  212. $sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";
  213. $sql.= " fk_typepayment=".(isset($this->fk_typepayment)?$this->fk_typepayment:"null").",";
  214. $sql.= " num_payment=".(isset($this->num_payment)?"'".$this->db->escape($this->num_payment)."'":"null").",";
  215. $sql.= " note=".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null").",";
  216. $sql.= " fk_bank=".(isset($this->fk_bank)?$this->fk_bank:"null").",";
  217. $sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").",";
  218. $sql.= " fk_user_modif=".(isset($this->fk_user_modif)?$this->fk_user_modif:"null")."";
  219. $sql.= " WHERE rowid=".$this->id;
  220. $this->db->begin();
  221. dol_syslog(get_class($this)."::update", LOG_DEBUG);
  222. $resql = $this->db->query($sql);
  223. if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
  224. if (! $error)
  225. {
  226. if (! $notrigger)
  227. {
  228. // Uncomment this and change MYOBJECT to your own tag if you
  229. // want this action call a trigger.
  230. //// Call triggers
  231. //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
  232. //$interface=new Interfaces($this->db);
  233. //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
  234. //if ($result < 0) { $error++; $this->errors=$interface->errors; }
  235. //// End call triggers
  236. }
  237. }
  238. // Commit or rollback
  239. if ($error)
  240. {
  241. foreach($this->errors as $errmsg)
  242. {
  243. dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
  244. $this->error.=($this->error?', '.$errmsg:$errmsg);
  245. }
  246. $this->db->rollback();
  247. return -1*$error;
  248. }
  249. else
  250. {
  251. $this->db->commit();
  252. return 1;
  253. }
  254. }
  255. /**
  256. * Delete object in database
  257. *
  258. * @param User $user User that delete
  259. * @param int $notrigger 0=launch triggers after, 1=disable triggers
  260. * @return int <0 if KO, >0 if OK
  261. */
  262. function delete($user, $notrigger=0)
  263. {
  264. global $conf, $langs;
  265. $error=0;
  266. $this->db->begin();
  267. if (! $error)
  268. {
  269. $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url";
  270. $sql.= " WHERE type='payment_expensereport' AND url_id=".$this->id;
  271. dol_syslog(get_class($this)."::delete", LOG_DEBUG);
  272. $resql = $this->db->query($sql);
  273. if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
  274. }
  275. if (! $error)
  276. {
  277. $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_expensereport";
  278. $sql.= " WHERE rowid=".$this->id;
  279. dol_syslog(get_class($this)."::delete", LOG_DEBUG);
  280. $resql = $this->db->query($sql);
  281. if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
  282. }
  283. if (! $error)
  284. {
  285. if (! $notrigger)
  286. {
  287. // Uncomment this and change MYOBJECT to your own tag if you
  288. // want this action call a trigger.
  289. //// Call triggers
  290. //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
  291. //$interface=new Interfaces($this->db);
  292. //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
  293. //if ($result < 0) { $error++; $this->errors=$interface->errors; }
  294. //// End call triggers
  295. }
  296. }
  297. // Commit or rollback
  298. if ($error)
  299. {
  300. foreach($this->errors as $errmsg)
  301. {
  302. dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
  303. $this->error.=($this->error?', '.$errmsg:$errmsg);
  304. }
  305. $this->db->rollback();
  306. return -1*$error;
  307. }
  308. else
  309. {
  310. $this->db->commit();
  311. return 1;
  312. }
  313. }
  314. /**
  315. * Load an object from its id and create a new one in database
  316. *
  317. * @param int $fromid Id of object to clone
  318. * @return int New id of clone
  319. */
  320. function createFromClone($fromid)
  321. {
  322. global $user,$langs;
  323. $error=0;
  324. $object=new PaymentExpenseReport($this->db);
  325. $object->context['createfromclone'] = 'createfromclone';
  326. $this->db->begin();
  327. // Load source object
  328. $object->fetch($fromid);
  329. $object->id=0;
  330. $object->statut=0;
  331. // Clear fields
  332. // ...
  333. // Create clone
  334. $result=$object->create($user);
  335. // Other options
  336. if ($result < 0)
  337. {
  338. $this->error=$object->error;
  339. $error++;
  340. }
  341. if (! $error)
  342. {
  343. }
  344. unset($this->context['createfromclone']);
  345. // End
  346. if (! $error)
  347. {
  348. $this->db->commit();
  349. return $object->id;
  350. }
  351. else
  352. {
  353. $this->db->rollback();
  354. return -1;
  355. }
  356. }
  357. /**
  358. * Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
  359. *
  360. * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
  361. * @return string Libelle
  362. */
  363. function getLibStatut($mode=0)
  364. {
  365. return '';
  366. }
  367. /**
  368. * Renvoi le libelle d'un statut donne
  369. *
  370. * @param int $statut Id statut
  371. * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
  372. * @return string Libelle du statut
  373. */
  374. function LibStatut($statut,$mode=0)
  375. {
  376. global $langs;
  377. return '';
  378. }
  379. /**
  380. * Initialise an instance with random values.
  381. * Used to build previews or test instances.
  382. * id must be 0 if object instance is a specimen.
  383. *
  384. * @return void
  385. */
  386. function initAsSpecimen()
  387. {
  388. $this->id=0;
  389. $this->fk_expensereport='';
  390. $this->datec='';
  391. $this->tms='';
  392. $this->datep='';
  393. $this->amount='';
  394. $this->fk_typepayment='';
  395. $this->num_payment='';
  396. $this->note='';
  397. $this->fk_bank='';
  398. $this->fk_user_creat='';
  399. $this->fk_user_modif='';
  400. }
  401. /**
  402. * Add record into bank for payment with links between this bank record and invoices of payment.
  403. * All payment properties must have been set first like after a call to create().
  404. *
  405. * @param User $user Object of user making payment
  406. * @param string $mode 'payment_expensereport'
  407. * @param string $label Label to use in bank record
  408. * @param int $accountid Id of bank account to do link with
  409. * @param string $emetteur_nom Name of transmitter
  410. * @param string $emetteur_banque Name of bank
  411. * @return int <0 if KO, >0 if OK
  412. */
  413. function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque)
  414. {
  415. global $langs,$conf;
  416. $error=0;
  417. if (! empty($conf->banque->enabled))
  418. {
  419. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
  420. $acc = new Account($this->db);
  421. $acc->fetch($accountid);
  422. $total=$this->total;
  423. if ($mode == 'payment_expensereport') $amount=$total;
  424. // Insert payment into llx_bank
  425. $bank_line_id = $acc->addline(
  426. $this->datepaid,
  427. $this->fk_typepayment, // Payment mode id or code ("CHQ or VIR for example")
  428. $label,
  429. -$amount,
  430. $this->num_payment,
  431. '',
  432. $user,
  433. $emetteur_nom,
  434. $emetteur_banque
  435. );
  436. // Update fk_bank in llx_paiement.
  437. // On connait ainsi le paiement qui a genere l'ecriture bancaire
  438. if ($bank_line_id > 0)
  439. {
  440. $result=$this->update_fk_bank($bank_line_id);
  441. if ($result <= 0)
  442. {
  443. $error++;
  444. dol_print_error($this->db);
  445. }
  446. // Add link 'payment', 'payment_supplier', 'payment_expensereport' in bank_url between payment and bank transaction
  447. $url='';
  448. if ($mode == 'payment_expensereport') $url=DOL_URL_ROOT.'/expensereport/payment/card.php?rowid=';
  449. if ($url)
  450. {
  451. $result=$acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
  452. if ($result <= 0)
  453. {
  454. $error++;
  455. dol_print_error($this->db);
  456. }
  457. }
  458. // Add link 'user' in bank_url between user and bank transaction
  459. if (! $error)
  460. {
  461. foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of.
  462. {
  463. if ($mode == 'payment_expensereport')
  464. {
  465. $er = new ExpenseReport($this->db);
  466. $er->fetch($key);
  467. $er->fetch_user($er->fk_user_author);
  468. $result=$acc->add_url_line(
  469. $bank_line_id,
  470. $er->user->id,
  471. DOL_URL_ROOT.'/user/card.php?id=',
  472. $er->user->getFullName($langs),
  473. 'user'
  474. );
  475. if ($result <= 0)
  476. {
  477. $this->error=$this->db->lasterror();
  478. dol_syslog(get_class($this).'::addPaymentToBank '.$this->error);
  479. $error++;
  480. }
  481. }
  482. }
  483. }
  484. }
  485. else
  486. {
  487. $this->error=$acc->error;
  488. $error++;
  489. }
  490. }
  491. if (! $error)
  492. {
  493. return 1;
  494. }
  495. else
  496. {
  497. return -1;
  498. }
  499. }
  500. /**
  501. * Update link between the expense report payment and the generated line in llx_bank
  502. *
  503. * @param int $id_bank Id if bank
  504. * @return int >0 if OK, <=0 if KO
  505. */
  506. function update_fk_bank($id_bank)
  507. {
  508. $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id;
  509. dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
  510. $result = $this->db->query($sql);
  511. if ($result)
  512. {
  513. return 1;
  514. }
  515. else
  516. {
  517. $this->error=$this->db->error();
  518. return 0;
  519. }
  520. }
  521. /**
  522. * Return clicable name (with picto eventually)
  523. *
  524. * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
  525. * @param int $maxlen Longueur max libelle
  526. * @return string Chaine avec URL
  527. */
  528. function getNomUrl($withpicto=0,$maxlen=0)
  529. {
  530. global $langs;
  531. $result='';
  532. if (empty($this->ref)) $this->ref=$this->lib;
  533. $label = $langs->trans("ShowPayment").': '.$this->ref;
  534. if (!empty($this->id))
  535. {
  536. $link = '<a href="'.DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
  537. $linkend='</a>';
  538. if ($withpicto) $result.=($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
  539. if ($withpicto && $withpicto != 2) $result.=' ';
  540. if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend;
  541. }
  542. return $result;
  543. }
  544. /**
  545. * Tab information on object
  546. *
  547. * @param int $id Payment id
  548. * @return void
  549. */
  550. function info($id)
  551. {
  552. $sql = 'SELECT e.rowid, e.datec, e.fk_user_creat, e.fk_user_modif, e.tms';
  553. $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport as e';
  554. $sql.= ' WHERE e.rowid = '.$id;
  555. dol_syslog(get_class($this).'::info', LOG_DEBUG);
  556. $result = $this->db->query($sql);
  557. if ($result)
  558. {
  559. if ($this->db->num_rows($result))
  560. {
  561. $obj = $this->db->fetch_object($result);
  562. $this->id = $obj->rowid;
  563. if ($obj->fk_user_creat)
  564. {
  565. $cuser = new User($this->db);
  566. $cuser->fetch($obj->fk_user_creat);
  567. $this->user_creation = $cuser;
  568. }
  569. if ($obj->fk_user_modif)
  570. {
  571. $muser = new User($this->db);
  572. $muser->fetch($obj->fk_user_modif);
  573. $this->user_modification = $muser;
  574. }
  575. $this->date_creation = $this->db->jdate($obj->datec);
  576. $this->date_modification = $this->db->jdate($obj->tms);
  577. }
  578. $this->db->free($result);
  579. }
  580. else
  581. {
  582. dol_print_error($this->db);
  583. }
  584. }
  585. }