29 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
41 public $element =
'accounting_account';
46 public $table_element =
'accounting_account';
51 public $picto =
'billr';
57 public $ismultientitymanaged = 1;
63 public $restrictiononfksoc = 1;
90 public $fk_pcg_version;
100 public $account_number;
105 public $account_parent;
110 public $account_category;
115 public $account_category_label;
135 public $fk_user_author;
140 public $fk_user_modif;
150 public $reconcilable;
155 private $accountingaccount_codetotid_cache = array();
158 const STATUS_ENABLED = 1;
159 const STATUS_DISABLED = 0;
172 $this->next_prev_filter =
"fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX.
"accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS).
")";
184 public function fetch($rowid =
null, $account_number =
null, $limittocurrentchart = 0, $limittoachartaccount =
'')
188 if ($rowid || $account_number) {
189 $sql =
"SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconcilable";
190 $sql .=
", ca.label as category_label";
191 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_account as a";
192 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
195 $sql .=
" a.rowid = ".(int) $rowid;
196 } elseif ($account_number) {
197 $sql .=
" a.account_number = '".$this->db->escape($account_number).
"'";
198 $sql .=
" AND a.entity = ".$conf->entity;
200 if (!empty($limittocurrentchart)) {
201 $sql .=
' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.
'accounting_system WHERE rowid = '.((int) $conf->global->CHARTOFACCOUNTS).
')';
203 if (!empty($limittoachartaccount)) {
204 $sql .=
" AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount).
"'";
207 dol_syslog(get_class($this).
"::fetch rowid=".$rowid.
" account_number=".$account_number, LOG_DEBUG);
209 $result = $this->
db->query($sql);
211 $obj = $this->
db->fetch_object($result);
214 $this->
id = $obj->rowid;
215 $this->
rowid = $obj->rowid;
216 $this->
ref = $obj->account_number;
217 $this->datec = $obj->datec;
218 $this->tms = $obj->tms;
219 $this->fk_pcg_version = $obj->fk_pcg_version;
220 $this->pcg_type = $obj->pcg_type;
221 $this->account_number = $obj->account_number;
222 $this->account_parent = $obj->account_parent;
223 $this->label = $obj->label;
224 $this->labelshort = $obj->labelshort;
225 $this->account_category = $obj->fk_accounting_category;
226 $this->account_category_label = $obj->category_label;
227 $this->fk_user_author = $obj->fk_user_author;
228 $this->fk_user_modif = $obj->fk_user_modif;
229 $this->active = $obj->active;
230 $this->status = $obj->active;
231 $this->reconcilable = $obj->reconcilable;
238 $this->error =
"Error ".$this->db->lasterror();
239 $this->errors[] =
"Error ".$this->db->lasterror();
252 public function create($user, $notrigger = 0)
259 if (isset($this->fk_pcg_version)) {
260 $this->fk_pcg_version = trim($this->fk_pcg_version);
262 if (isset($this->pcg_type)) {
263 $this->pcg_type = trim($this->pcg_type);
265 if (isset($this->account_number)) {
266 $this->account_number = trim($this->account_number);
268 if (isset($this->label)) {
269 $this->label = trim($this->label);
271 if (isset($this->labelshort)) {
272 $this->labelshort = trim($this->labelshort);
275 if (empty($this->pcg_type) || $this->pcg_type ==
'-1') {
276 $this->pcg_type =
'XXXXXX';
282 $sql =
"INSERT INTO " . MAIN_DB_PREFIX .
"accounting_account(";
285 $sql .=
", fk_pcg_version";
286 $sql .=
", pcg_type";
287 $sql .=
", account_number";
288 $sql .=
", account_parent";
290 $sql .=
", labelshort";
291 $sql .=
", fk_accounting_category";
292 $sql .=
", fk_user_author";
294 $sql .=
", reconcilable";
295 $sql .=
") VALUES (";
296 $sql .=
" '".$this->db->idate($now).
"'";
297 $sql .=
", ".((int) $conf->entity);
298 $sql .=
", ".(empty($this->fk_pcg_version) ?
'NULL' :
"'".$this->db->escape($this->fk_pcg_version).
"'");
299 $sql .=
", ".(empty($this->pcg_type) ?
'NULL' :
"'".$this->db->escape($this->pcg_type).
"'");
300 $sql .=
", ".(empty($this->account_number) ?
'NULL' :
"'".$this->db->escape($this->account_number).
"'");
301 $sql .=
", ".(empty($this->account_parent) ? 0 : (int) $this->account_parent);
302 $sql .=
", ".(empty($this->label) ?
"''" :
"'".$this->db->escape($this->label).
"'");
303 $sql .=
", ".(empty($this->labelshort) ?
"''" :
"'".$this->db->escape($this->labelshort).
"'");
304 $sql .=
", ".(empty($this->account_category) ? 0 : (int) $this->account_category);
305 $sql .=
", ".((int) $user->id);
306 $sql .=
", ".(int) $this->active;
307 $sql .=
", ".(int) $this->reconcilable;
312 dol_syslog(get_class($this).
"::create", LOG_DEBUG);
316 $this->errors[] =
"Error " . $this->
db->lasterror();
320 $this->
id = $this->
db->last_insert_id(MAIN_DB_PREFIX .
"accounting_account");
335 foreach ($this->errors as $errmsg) {
336 dol_syslog(get_class($this) .
"::create " . $errmsg, LOG_ERR);
337 $this->error .= ($this->error ?
', ' . $errmsg : $errmsg);
339 $this->
db->rollback();
356 if (empty($this->pcg_type) || $this->pcg_type ==
'-1') {
357 $this->pcg_type =
'XXXXXX';
362 $sql =
"UPDATE " . MAIN_DB_PREFIX .
"accounting_account ";
363 $sql .=
" SET fk_pcg_version = " . ($this->fk_pcg_version ?
"'" . $this->
db->escape($this->fk_pcg_version) .
"'" :
"null");
364 $sql .=
" , pcg_type = " . ($this->pcg_type ?
"'" . $this->
db->escape($this->pcg_type) .
"'" :
"null");
365 $sql .=
" , account_number = '" . $this->
db->escape($this->account_number) .
"'";
366 $sql .=
" , account_parent = " . (int) $this->account_parent;
367 $sql .=
" , label = " . ($this->label ?
"'" . $this->
db->escape($this->label) .
"'" :
"''");
368 $sql .=
" , labelshort = " . ($this->labelshort ?
"'" . $this->
db->escape($this->labelshort) .
"'" :
"''");
369 $sql .=
" , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category);
370 $sql .=
" , fk_user_modif = " . ((int) $user->id);
371 $sql .=
" , active = " . (int) $this->active;
372 $sql .=
" , reconcilable = " . (int) $this->reconcilable;
373 $sql .=
" WHERE rowid = " . ((int) $this->
id);
375 dol_syslog(get_class($this).
"::update", LOG_DEBUG);
376 $result = $this->
db->query($sql);
381 if ($this->
db->lasterrno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
382 $this->error = $this->
db->lasterror();
383 $this->
db->rollback();
387 $this->error = $this->
db->lasterror();
388 $this->
db->rollback();
402 $sql =
"(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX.
"facturedet";
403 $sql .=
" WHERE fk_code_ventilation=".((int) $this->
id).
")";
405 $sql .=
" (SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX.
"facture_fourn_det";
406 $sql .=
" WHERE fk_code_ventilation=".((int) $this->
id).
")";
408 dol_syslog(get_class($this).
"::checkUsage", LOG_DEBUG);
414 $this->error = $langs->trans(
'ErrorAccountancyCodeIsAlreadyUse');
420 $this->error = $this->
db->lasterror();
432 public function delete($user, $notrigger = 0)
442 $sql =
"DELETE FROM " . MAIN_DB_PREFIX .
"accounting_account";
443 $sql .=
" WHERE rowid=" . ((int) $this->
id);
445 dol_syslog(get_class($this) .
"::delete sql=" . $sql);
449 $this->errors[] =
"Error " . $this->
db->lasterror();
455 foreach ($this->errors as $errmsg) {
456 dol_syslog(get_class($this) .
"::delete " . $errmsg, LOG_ERR);
457 $this->error .= ($this->error ?
', ' . $errmsg : $errmsg);
459 $this->
db->rollback();
483 public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle =
'', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option =
'')
485 global $langs, $conf, $hookmanager;
486 require_once DOL_DOCUMENT_ROOT .
'/core/lib/accounting.lib.php';
488 if (!empty($conf->dol_no_mouse_hover)) {
496 if (empty($option) || $option ==
'ledger') {
497 $url = DOL_URL_ROOT .
'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($this->account_number) .
'&search_accountancy_code_end=' . urlencode($this->account_number);
498 $labelurl = $langs->trans(
"ShowAccountingAccountInLedger");
499 } elseif ($option ==
'journals') {
500 $url = DOL_URL_ROOT .
'/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . urlencode($this->account_number) .
'&search_accountancy_code_end=' . urlencode($this->account_number);
501 $labelurl = $langs->trans(
"ShowAccountingAccountInJournals");
502 } elseif ($option ==
'accountcard') {
503 $url = DOL_URL_ROOT .
'/accountancy/admin/card.php?id=' . urlencode($this->
id);
504 $labelurl = $langs->trans(
"ShowAccountingAccount");
508 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
509 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
510 $add_save_lastsearch_values = 1;
512 if ($add_save_lastsearch_values) {
513 $url .=
'&save_lastsearch_values=1';
516 $picto =
'accounting_account';
519 if (empty($this->labelshort) || $withcompletelabel == 1) {
520 $labeltoshow = $this->label;
522 $labeltoshow = $this->labelshort;
525 $label =
'<u>' . $labelurl .
'</u>';
526 if (!empty($this->account_number)) {
527 $label .=
'<br><b>' . $langs->trans(
'AccountAccounting') .
':</b> ' .
length_accountg($this->account_number);
529 if (!empty($labeltoshow)) {
530 $label .=
'<br><b>' . $langs->trans(
'Label') .
':</b> ' . $labeltoshow;
533 $label .=
' - ' . $moretitle;
537 if (empty($notooltip)) {
538 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
543 $linkclose .=
' class="classfortooltip"';
546 $linkstart =
'<a href="' . $url .
'"';
547 $linkstart .= $linkclose .
'>';
558 $label_link .=
' - ' . ($nourl ?
'<span class="opacitymedium">' :
'') . $labeltoshow . ($nourl ?
'</span>' :
'');
562 $result .= ($linkstart .
img_object(($notooltip ?
'' : $label), $picto, ($notooltip ?
'' :
'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . $linkend);
564 if ($withpicto && $withpicto != 2) {
567 if ($withpicto != 2) {
568 $result .= $linkstart . $label_link . $linkend;
571 $hookmanager->initHooks(array($this->element .
'dao'));
572 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
573 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
575 $result = $hookmanager->resPrint;
577 $result .= $hookmanager->resPrint;
590 $sql =
'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
591 $sql .=
' FROM ' . MAIN_DB_PREFIX .
'accounting_account as a';
592 $sql .=
' WHERE a.rowid = ' . ((int) $id);
594 dol_syslog(get_class($this) .
'::info sql=' . $sql);
599 $obj = $this->
db->fetch_object(
$resql);
600 $this->
id = $obj->rowid;
602 $this->user_creation_id = $obj->fk_user_author;
603 $this->user_modification_id = $obj->fk_user_modif;
604 $this->date_creation = $this->
db->jdate($obj->datec);
605 $this->date_modification = $this->
db->jdate($obj->tms);
624 $fieldtouse =
'active';
626 $fieldtouse =
'reconcilable';
632 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"accounting_account ";
633 $sql .=
"SET ".$fieldtouse.
" = '0'";
634 $sql .=
" WHERE rowid = ".((int) $id);
636 dol_syslog(get_class($this).
"::accountDeactivate ".$fieldtouse, LOG_DEBUG);
637 $result = $this->
db->query($sql);
643 $this->error = $this->
db->lasterror();
644 $this->
db->rollback();
665 $fieldtouse =
'active';
667 $fieldtouse =
'reconcilable';
670 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"accounting_account";
671 $sql .=
" SET ".$fieldtouse.
" = '1'";
672 $sql .=
" WHERE rowid = ".((int) $id);
674 dol_syslog(get_class($this).
"::account_activate ".$fieldtouse, LOG_DEBUG);
675 $result = $this->
db->query($sql);
680 $this->error = $this->
db->lasterror();
681 $this->
db->rollback();
694 return $this->
LibStatut($this->status, $mode);
708 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
710 $langs->load(
"users");
711 $this->labelStatus[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv(
'Enabled');
712 $this->labelStatus[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv(
'Disabled');
713 $this->labelStatusShort[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv(
'Enabled');
714 $this->labelStatusShort[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv(
'Disabled');
717 $statusType =
'status4';
718 if ($status == self::STATUS_DISABLED) {
719 $statusType =
'status5';
722 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
743 $hookmanager->initHooks(array(
'accountancyBindingCalculation'));
746 $parameters = array(
'buyer' => $buyer,
'seller' => $seller,
'product' => $product,
'facture' => $facture,
'factureDet' => $factureDet ,
'accountingAccount'=>$accountingAccount, $type);
747 $reshook = $hookmanager->executeHooks(
'accountancyBindingCalculation', $parameters);
749 if (empty($reshook)) {
751 if ($type ==
'customer') {
752 $const_name =
"SOLD";
753 } elseif ($type ==
'supplier') {
757 require_once DOL_DOCUMENT_ROOT .
'/core/lib/company.lib.php';
758 $isBuyerInEEC =
isInEEC($buyer);
759 $isSellerInEEC =
isInEEC($seller);
766 $suggestedaccountingaccountbydefaultfor =
'';
767 if ($factureDet->product_type == 1) {
768 if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) {
769 $code_l = (!empty($conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_ACCOUNT'} :
'');
770 $suggestedaccountingaccountbydefaultfor =
'';
772 if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) {
773 $code_l = (!empty($conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_ACCOUNT'} :
'');
774 $suggestedaccountingaccountbydefaultfor =
'eecwithvat';
775 } elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) {
776 $code_l = (!empty($conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_ACCOUNT'} :
'');
777 $suggestedaccountingaccountbydefaultfor =
'eecwithoutvatnumber';
778 } elseif ($isSellerInEEC && $isBuyerInEEC) {
779 $code_l = (!empty($conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_INTRA_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_INTRA_ACCOUNT'} :
'');
780 $suggestedaccountingaccountbydefaultfor =
'eec';
782 $code_l = (!empty($conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_EXPORT_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_SERVICE_' . $const_name .
'_EXPORT_ACCOUNT'} :
'');
783 $suggestedaccountingaccountbydefaultfor =
'export';
786 } elseif ($factureDet->product_type == 0) {
787 if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) {
788 $code_l = (!empty($conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_ACCOUNT'} :
'');
789 $suggestedaccountingaccountbydefaultfor =
'';
791 if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) {
792 $code_l = (!empty($conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_ACCOUNT'} :
'');
793 $suggestedaccountingaccountbydefaultfor =
'eecwithvat';
794 } elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) {
795 $code_l = (!empty($conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_ACCOUNT'} :
'');
796 $suggestedaccountingaccountbydefaultfor =
'eecwithoutvatnumber';
797 } elseif ($isSellerInEEC && $isBuyerInEEC) {
798 $code_l = (!empty($conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_INTRA_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_INTRA_ACCOUNT'} :
'');
799 $suggestedaccountingaccountbydefaultfor =
'eec';
801 $code_l = (!empty($conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_EXPORT_ACCOUNT'}) ? $conf->global->{
'ACCOUNTING_PRODUCT_' . $const_name .
'_EXPORT_ACCOUNT'} :
'');
802 $suggestedaccountingaccountbydefaultfor =
'export';
811 $suggestedaccountingaccountfor =
'';
812 if ((($buyer->country_code == $seller->country_code) || empty($buyer->country_code))) {
814 if ($type==
'customer' && !empty($product->accountancy_code_sell)) {
815 $code_p = $product->accountancy_code_sell;
816 } elseif ($type==
'supplier' && !empty($product->accountancy_code_buy)) {
817 $code_p = $product->accountancy_code_buy;
819 $suggestedid = $accountingAccount[
'dom'];
820 $suggestedaccountingaccountfor =
'prodserv';
822 if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) {
824 if ($type==
'customer' && !empty($product->accountancy_code_sell)) {
825 $code_p = $product->accountancy_code_sell;
826 } elseif ($type==
'supplier' && !empty($product->accountancy_code_buy)) {
827 $code_p = $product->accountancy_code_buy;
829 $suggestedid = $accountingAccount[
'dom'];
830 $suggestedaccountingaccountfor =
'eecwithvat';
831 } elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) {
833 if ($type==
'customer' && !empty($product->accountancy_code_sell)) {
834 $code_p = $product->accountancy_code_sell;
835 } elseif ($type==
'supplier' && !empty($product->accountancy_code_buy)) {
836 $code_p = $product->accountancy_code_buy;
838 $suggestedid = $accountingAccount[
'dom'];
839 $suggestedaccountingaccountfor =
'eecwithoutvatnumber';
840 } elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) {
842 if ($type==
'customer' && !empty($product->accountancy_code_sell_intra)) {
843 $code_p = $product->accountancy_code_sell_intra;
844 } elseif ($type==
'supplier' && !empty($product->accountancy_code_buy_intra)) {
845 $code_p = $product->accountancy_code_buy_intra;
847 $suggestedid = $accountingAccount[
'intra'];
848 $suggestedaccountingaccountfor =
'eec';
851 if ($type==
'customer' && !empty($product->accountancy_code_sell_export)) {
852 $code_p = $product->accountancy_code_sell_export;
853 } elseif ($type==
'supplier' && !empty($product->accountancy_code_buy_export)) {
854 $code_p = $product->accountancy_code_buy_export;
856 $suggestedid = $accountingAccount[
'export'];
857 $suggestedaccountingaccountfor =
'export';
862 if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
863 if (!empty($buyer->code_compta_product)) {
864 $code_t = $buyer->code_compta_product;
865 $suggestedid = $accountingAccount[
'thirdparty'];
866 $suggestedaccountingaccountfor =
'thirdparty';
871 if ($factureDet->desc ==
"(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
872 $accountdeposittoventilated =
new self($this->db);
873 $result = $accountdeposittoventilated->fetch(
'', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
878 $code_l = $accountdeposittoventilated->ref;
879 $suggestedid = $accountdeposittoventilated->rowid;
880 $suggestedaccountingaccountfor =
'deposit';
884 if (empty($suggestedid) && empty($code_p) && !empty($code_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
885 if (empty($this->accountingaccount_codetotid_cache[$code_l])) {
886 $tmpaccount =
new self($this->db);
887 $result = $tmpaccount->fetch(0, $code_l, 1);
891 if ($tmpaccount->id > 0) {
892 $suggestedid = $tmpaccount->id;
894 $this->accountingaccount_codetotid_cache[$code_l] = $tmpaccount->id;
896 $suggestedid = $this->accountingaccount_codetotid_cache[$code_l];
900 'suggestedaccountingaccountbydefaultfor' => $suggestedaccountingaccountbydefaultfor,
901 'suggestedaccountingaccountfor' => $suggestedaccountingaccountfor,
902 'suggestedid' => $suggestedid,
908 if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
909 return $hookmanager->resArray;