diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index b738933c89cf4..127f1795e19d7 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -425,7 +425,6 @@ $objp->code_sell_l = ''; $objp->code_sell_p = ''; - $objp->aarowid_suggest = ''; $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; @@ -437,7 +436,7 @@ $facture_static->type = $objp->ftype; $code_sell_p_notset = ''; - $objp->aarowid_suggest = $objp->aarowid; + $objp->aarowid_suggest = ''; // Will be set later $isBuyerInEEC = isInEEC($objp); @@ -471,8 +470,9 @@ } if ($objp->code_sell_l == -1) $objp->code_sell_l=''; + // Search suggested account for product/service $suggestedaccountingaccountfor = ''; - if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) $objp->code_sell_p = $objp->code_sell; $objp->aarowid_suggest = $objp->aarowid; $suggestedaccountingaccountfor = ''; @@ -561,12 +561,19 @@ // Suggested accounting account print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); + $suggestedid = $objp->aarowid_suggest; + if (empty($suggestedid) && empty($objp->code_sell_p) && ! empty($objp->code_sell_l) && ! empty($conf->global->ACCOUNTANCY_AUTOFILL_ACCOUNT_WITH_GENERIC)) + { + //$suggestedid = // id of $objp->code_sell_l + } + print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox print ''; - print 'aarowid ? "checked" : "") . '/>'; + //var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest); + $ischecked = $objp->aarowid_suggest; + print ''; print ''; print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 9ce49b23e6a3a..d7bfdcc5db361 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -533,12 +533,14 @@ // Suggested accounting account print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); + $suggestedid = $objp->aarowid_suggest; + print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox print ''; - print 'aarowid ? "checked" : "") . '/>'; + $ischecked = $objp->aarowid_suggest; + print ''; print ''; print '';