Hide advanced feature with ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY

This commit is contained in:
Laurent Destailleur 2021-01-15 17:35:16 +01:00
commit 8cef8df33a
2 changed files with 117 additions and 101 deletions

View File

@ -532,11 +532,13 @@ if ($result) {
} }
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
if (!empty($objp->company_code_sell)) { if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell; $objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty; $objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
} }
}
// Manage Deposit // Manage Deposit
if ($objp->description == "(DEPOSIT)") { if ($objp->description == "(DEPOSIT)") {
@ -616,25 +618,32 @@ if ($result) {
{ {
print '<br>'; print '<br>';
$s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>'; $s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
$shelp = ''; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT"); elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber"); elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
}
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_sell_p) ? '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_sell_p)); $s .= (empty($objp->code_sell_p) ? '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_sell_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
} else { } else {
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<br>'; print '<br>';
$s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>'; $s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
$shelp = ''; $shelp = '';
$s .= $langs->trans("NotDefined"); $s .= $langs->trans("NotDefined");
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<br>'; print '<br>';
$s = '<span class="small">3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': </span>'; $s = '<span class="small">3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': </span>';
$shelp = ''; $shelp = '';
$s .= ($objp->code_sell_t > 0 ? length_accountg($objp->code_sell_t) : '<span style="'.$code_sell_t_notset.'">'.$langs->trans("NotDefined").'</span>'); $s .= ($objp->code_sell_t > 0 ? length_accountg($objp->code_sell_t) : '<span style="'.$code_sell_t_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
}
print '</td>'; print '</td>';
// Suggested accounting account // Suggested accounting account

View File

@ -489,8 +489,8 @@ if (empty($reshook))
$object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL);
$object->webservices_key = GETPOST('webservices_key', 'san_alpha'); $object->webservices_key = GETPOST('webservices_key', 'san_alpha');
$object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha'); if (GETPOSTISSET('accountancy_code_sell')) $object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
$object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); if (GETPOSTISSET('accountancy_code_buy')) $object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) if (!empty($conf->incoterm->enabled))
@ -1062,8 +1062,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$object->commercial_id = GETPOST('commercial_id', 'int'); $object->commercial_id = GETPOST('commercial_id', 'int');
$object->default_lang = GETPOST('default_lang'); $object->default_lang = GETPOST('default_lang');
$object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha'); if (GETPOSTISSET('accountancy_code_sell')) $object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
$object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); if (GETPOSTISSET('accountancy_code_buy')) $object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
$object->logo = (isset($_FILES['photo']) ?dol_sanitizeFileName($_FILES['photo']['name']) : ''); $object->logo = (isset($_FILES['photo']) ?dol_sanitizeFileName($_FILES['photo']['name']) : '');
@ -1614,6 +1614,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</table>'."\n"; print '</table>'."\n";
// Accountancy codes // Accountancy codes
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
@ -1644,7 +1645,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">'; print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">';
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';
}
print dol_get_fiche_end(); print dol_get_fiche_end();
@ -1760,8 +1763,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL);
$object->webservices_key = GETPOST('webservices_key', 'san_alpha'); $object->webservices_key = GETPOST('webservices_key', 'san_alpha');
$object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha'); if (GETPOSTISSET('accountancy_code_sell')) $object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
$object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); if (GETPOSTISSET('accountancy_code_buy')) $object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
//Incoterms //Incoterms
if (!empty($conf->incoterm->enabled)) if (!empty($conf->incoterm->enabled))
@ -2294,9 +2297,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</table>'; print '</table>';
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<br>'; print '<br>';
print '<table class="border centpercent">';
print '<table class="border" width="100%">';
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
@ -2325,6 +2328,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';
}
print '</div>'; print '</div>';
print dol_get_fiche_end(); print dol_get_fiche_end();
@ -2705,6 +2710,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</td></tr>'; print '</td></tr>';
} }
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
// Accountancy sell code // Accountancy sell code
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancySellCode"); print $langs->trans("ProductAccountancySellCode");
@ -2740,6 +2746,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print $object->accountancy_code_buy; print $object->accountancy_code_buy;
} }
print '</td></tr>'; print '</td></tr>';
}
// Other attributes // Other attributes
$parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');