Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
d6535c0584
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -54,19 +54,27 @@ $list_account_main = array (
|
||||
|
||||
$list_account = array ();
|
||||
$list_account[] = '---Product---';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
|
||||
$list_account[] = '---Service---';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
|
||||
$list_account[] = '---Other---';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
@ -117,7 +117,9 @@ if ($action == 'update') {
|
||||
'ACCOUNTANCY_SELL',
|
||||
'ACCOUNTANCY_SELL_INTRA',
|
||||
'ACCOUNTANCY_SELL_EXPORT',
|
||||
'ACCOUNTANCY_BUY'
|
||||
'ACCOUNTANCY_BUY',
|
||||
'ACCOUNTANCY_BUY_INTRA',
|
||||
'ACCOUNTANCY_BUY_EXPORT'
|
||||
);
|
||||
|
||||
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||
@ -159,6 +161,12 @@ if ($action == 'update') {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql .= " SET accountancy_code_buy = ".$accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$sql .= " SET accountancy_code_buy_intra = ".$accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$sql .= " SET accountancy_code_buy_export = ".$accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$sql .= " SET accountancy_code_sell = ".$accounting->account_number;
|
||||
}
|
||||
@ -204,7 +212,11 @@ $form = new FormAccounting($db);
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is already exists accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_servbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_servsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT, 1);
|
||||
@ -213,7 +225,11 @@ $aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_P
|
||||
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
|
||||
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
@ -228,7 +244,8 @@ $pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'p
|
||||
if (empty($pcgvercode)) $pcgvercode=$pcgverid;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy,";
|
||||
$sql.= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,";
|
||||
$sql.= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
$sql.= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
|
||||
$sql.= " p.tms, p.fk_product_type as product_type,";
|
||||
$sql.= " aa.rowid as aaid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "product as p";
|
||||
@ -236,6 +253,14 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql.=" p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
|
||||
{
|
||||
$sql.=" p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
{
|
||||
$sql.=" p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
@ -253,6 +278,14 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_buy_intra", $search_current_account);
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_buy_export", $search_current_account);
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
|
||||
@ -356,6 +389,13 @@ if ($result)
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuyIntra') . '</td>';
|
||||
print '<td>' . $langs->trans('OptionModeProductBuyDesc') . "</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuyExport') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
@ -386,7 +426,7 @@ if ($result)
|
||||
print '<td class="liste_titre center">'.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).'</td>';
|
||||
}
|
||||
// On buy
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print '<td class="liste_titre center">'.$form->selectyesno('search_onpurchase', $search_onpurchase, 1, false, 1).'</td>';
|
||||
}
|
||||
// Current account
|
||||
@ -416,10 +456,16 @@ if ($result)
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell_export";
|
||||
} else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_buy";
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_buy_intra";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_buy_export";
|
||||
}
|
||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
||||
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -457,22 +503,22 @@ if ($result)
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_intra;
|
||||
$compta_prodsell_id = $aarowid_servsell_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
$compta_prodsell_id = $aarowid_servsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
@ -482,11 +528,40 @@ if ($result)
|
||||
|
||||
// Purchases
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
} else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -509,7 +584,7 @@ if ($result)
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT')
|
||||
print '<td class="center">'.$product_static->getLibStatut(3, 0).'</td>';
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
print '<td class="center">'.$product_static->getLibStatut(3, 1).'</td>';
|
||||
|
||||
// Current accounting account
|
||||
@ -517,7 +592,13 @@ if ($result)
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print length_accountg($obj->accountancy_code_buy);
|
||||
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
print length_accountg($obj->accountancy_code_buy_intra);
|
||||
if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print length_accountg($obj->accountancy_code_buy_export);
|
||||
if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
print length_accountg($obj->accountancy_code_sell);
|
||||
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
@ -540,6 +621,26 @@ if ($result)
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
// Accounting account buy intra (In EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy_intra;
|
||||
$codesell=length_accountg($obj->accountancy_code_buy_intra);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
// Accounting account buy export (Out of EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy_export;
|
||||
$codesell=length_accountg($obj->accountancy_code_buy_export);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
// Accounting account sell
|
||||
print '<td class="left">';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -119,8 +119,9 @@ if ($action == 'validatehistory') {
|
||||
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
|
||||
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
@ -128,7 +129,9 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
|
||||
@ -157,16 +160,12 @@ if ($action == 'validatehistory') {
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
//$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
//$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
//$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
//$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
@ -211,7 +211,8 @@ if (empty($chartaccountcode))
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid,";
|
||||
$sql .= " p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra";
|
||||
$parameters = array();
|
||||
@ -222,7 +223,9 @@ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
// Add search filter like
|
||||
@ -414,7 +417,6 @@ if ($result) {
|
||||
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
|
||||
$objp->code_buy_l = '';
|
||||
$objp->code_buy_p = '';
|
||||
$objp->aarowid_suggest = '';
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
@ -426,28 +428,67 @@ if ($result) {
|
||||
$facturefourn_static->type = $objp->type;
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->aarowid_suggest = ''; // Will be set later
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_s;
|
||||
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_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($objp->type_l == 0) {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_p;
|
||||
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_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objp->code_buy_l == -1) $objp->code_buy_l = '';
|
||||
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
|
||||
|
||||
if (!empty($objp->code_buy)) {
|
||||
$objp->code_buy_p = $objp->code_buy; // Code on product
|
||||
// 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)
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($objp->code_buy_p)) {
|
||||
// Value was defined previously
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red';
|
||||
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
// $objp->code_buy_l is now default code of product/service
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -520,6 +561,21 @@ if ($result) {
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
$suggestedid = $objp->aarowid_suggest;
|
||||
if (empty($suggestedid) && empty($objp->code_buy_p) && ! empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
|
||||
{
|
||||
if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l]))
|
||||
{
|
||||
$tmpaccount = new AccountingAccount($db);
|
||||
$tmpaccount->fetch(0, $objp->code_buy_l, 1);
|
||||
if ($tmpaccount->id > 0) {
|
||||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
|
||||
}
|
||||
else {
|
||||
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
|
||||
}
|
||||
}
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
@ -540,6 +596,9 @@ if ($result) {
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
if ($db->type == 'mysqli') {
|
||||
$db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
|
||||
}
|
||||
|
||||
// Add code to auto check the box when we select an account
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -30,8 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
|
||||
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'accountancy', 'compta'));
|
||||
@ -49,6 +52,11 @@ $search_number=GETPOST('search_number', 'alpha');
|
||||
$search_status=GETPOST('search_status')?GETPOST('search_status', 'alpha'):'opened'; // 'all' or ''='opened'
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array");
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Dictionary with list of banks accounting account allowed to manager of chart account
|
||||
@ -138,9 +146,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new FormCategory($db);
|
||||
|
||||
$title=$langs->trans('BankAccounts');
|
||||
$title = $langs->trans('BankAccounts');
|
||||
|
||||
// Load array of financial accounts (opened by default)
|
||||
$accounts = array();
|
||||
@ -151,14 +159,26 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.= $hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_ACCOUNT, "b.rowid");
|
||||
}
|
||||
|
||||
$sql.= " WHERE b.entity IN (".getEntity('bank_account').")";
|
||||
if ($search_status == 'opened') $sql.= " AND clos = 0";
|
||||
if ($search_status == 'closed') $sql.= " AND clos = 1";
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_ACCOUNT, "b.rowid", $search_category_list);
|
||||
}
|
||||
|
||||
if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref);
|
||||
if ($search_label != '') $sql.=natural_search('b.label', $search_label);
|
||||
if ($search_number != '') $sql.=natural_search('b.number', $search_number);
|
||||
@ -263,6 +283,10 @@ if ($sall)
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list);
|
||||
}
|
||||
|
||||
// Bank accounts
|
||||
$parameters = array();
|
||||
|
||||
@ -184,7 +184,7 @@ if ($action == 'add')
|
||||
GETPOST('langfile', 'alpha'),
|
||||
1,
|
||||
(GETPOST('totalizable', 'alpha')?1:0),
|
||||
(GETPOST('printable', 'alpha')?1:0)
|
||||
GETPOST('printable', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -354,7 +354,7 @@ if ($action == 'update')
|
||||
GETPOST('langfile'),
|
||||
1,
|
||||
(GETPOST('totalizable', 'alpha')?1:0),
|
||||
(GETPOST('printable', 'alpha')?1:0)
|
||||
GETPOST('printable', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -609,21 +609,32 @@ abstract class CommonDocGenerator
|
||||
// Add the product supplier extrafields to the substitutions
|
||||
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
|
||||
$columns = "";
|
||||
foreach ($extralabels as $key => $value)
|
||||
$columns .= "$key, ";
|
||||
|
||||
if ($columns != "")
|
||||
{
|
||||
$columns = substr($columns, 0, strlen($columns) - 2);
|
||||
$resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_supplier . "'");
|
||||
if ($this->db->num_rows($resql) > 0) {
|
||||
$resql = $this->db->fetch_object($resql);
|
||||
if (!empty($extralabels) && is_array($extralabels))
|
||||
{
|
||||
$columns = "";
|
||||
|
||||
foreach ($extralabels as $key => $value)
|
||||
$resarray['line_product_supplier_'.$key] = $resql->{$key};
|
||||
}
|
||||
}
|
||||
foreach ($extralabels as $key)
|
||||
{
|
||||
$columns .= "$key, ";
|
||||
}
|
||||
|
||||
if ($columns != "")
|
||||
{
|
||||
$columns = substr($columns, 0, strlen($columns) - 2);
|
||||
$resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_supplier . "'");
|
||||
|
||||
if ($this->db->num_rows($resql) > 0)
|
||||
{
|
||||
$resql = $this->db->fetch_object($resql);
|
||||
|
||||
foreach ($extralabels as $key)
|
||||
{
|
||||
$resarray['line_product_supplier_'.$key] = $resql->{$key};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load product data optional fields to the line -> enables to use "line_options_{extrafield}"
|
||||
@ -1079,7 +1090,7 @@ abstract class CommonDocGenerator
|
||||
/**
|
||||
* print standard column content
|
||||
*
|
||||
* @param PDF $pdf pdf object
|
||||
* @param TCPDF $pdf pdf object
|
||||
* @param float $curY curent Y position
|
||||
* @param string $colKey the column key
|
||||
* @param string $columnText column text
|
||||
@ -1099,9 +1110,59 @@ abstract class CommonDocGenerator
|
||||
if (!$reshook)
|
||||
{
|
||||
if (empty($columnText)) return;
|
||||
$pdf->SetXY($this->getColumnContentXStart($colKey) - 1, $curY); // Set curent position
|
||||
$pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position
|
||||
$colDef = $this->cols[$colKey];
|
||||
$pdf->writeHTMLCell($this->getColumnContentWidth($colKey) + 2, 2, $this->getColumnContentXStart($colKey) - 1, $curY, $columnText, 0, 0, 0, true, $colDef['content']['align']);
|
||||
// save curent cell padding
|
||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||
// set cell padding with column content definition
|
||||
$pdf->setCellPaddings($colDef['content']['padding'][3], $colDef['content']['padding'][0], $colDef['content']['padding'][1], $colDef['content']['padding'][2]);
|
||||
$pdf->writeHTMLCell($colDef['width'], 2, $colDef['xStartPos'], $curY, $columnText, 0, 1, 0, true, $colDef['content']['align']);
|
||||
|
||||
// restore cell padding
|
||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* print description column content
|
||||
*
|
||||
* @param TCPDF $pdf pdf object
|
||||
* @param float $curY curent Y position
|
||||
* @param string $colKey the column key
|
||||
* @param object $object CommonObject
|
||||
* @param int $i the $object->lines array key
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param int $hideref hide ref
|
||||
* @param int $hidedesc hide desc
|
||||
* @param int $issupplierline if object need supplier product
|
||||
* @return null
|
||||
*/
|
||||
public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
|
||||
{
|
||||
// load desc col params
|
||||
$colDef = $this->cols[$colKey];
|
||||
// save curent cell padding
|
||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||
// set cell padding with column content definition
|
||||
$pdf->setCellPaddings($colDef['content']['padding'][3], $colDef['content']['padding'][0], $colDef['content']['padding'][1], $colDef['content']['padding'][2]);
|
||||
|
||||
// line description
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef['width'], 3, $colDef['xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
|
||||
$posYAfterDescription = $pdf->GetY() - $colDef['content']['padding'][0];
|
||||
|
||||
// restore cell padding
|
||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||
|
||||
// Display extrafield if needed
|
||||
$params = array(
|
||||
'display' => 'list',
|
||||
'printableEnable' => array(3),
|
||||
'printableEnableNotEmpty' => array(4)
|
||||
);
|
||||
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
|
||||
if(!empty($extrafieldDesc)){
|
||||
$this->printStdColumnContent($pdf, $posYAfterDescription, $colKey, $extrafieldDesc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1184,6 +1245,8 @@ abstract class CommonDocGenerator
|
||||
$defaultParams = array(
|
||||
'style' => '',
|
||||
'display' => 'auto', // auto, table, list
|
||||
'printableEnable' => array(1),
|
||||
'printableEnableNotEmpty' => array(2),
|
||||
|
||||
'table' => array(
|
||||
'maxItemsInRow' => 2,
|
||||
@ -1218,7 +1281,18 @@ abstract class CommonDocGenerator
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
{
|
||||
// Enable extrafield ?
|
||||
$enabled = !empty($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
$enabled = 0;
|
||||
$disableOnEmpty = 0;
|
||||
if(!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
if(in_array($printable, $params['printableEnable']) || in_array($printable, $params['printableEnableNotEmpty']) ) {
|
||||
$enabled = 1;
|
||||
}
|
||||
|
||||
if (in_array($printable, $params['printableEnableNotEmpty'])) {
|
||||
$disableOnEmpty = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($enabled)){
|
||||
continue;
|
||||
@ -1230,6 +1304,11 @@ abstract class CommonDocGenerator
|
||||
$field->label = $outputlangs->transnoentities($label);
|
||||
$field->type = $extrafields->attributes[$object->table_element]['type'][$key];
|
||||
|
||||
// dont display if empty
|
||||
if($disableOnEmpty && empty($field->content)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields[] = $field;
|
||||
}
|
||||
}
|
||||
@ -1239,13 +1318,10 @@ abstract class CommonDocGenerator
|
||||
// Sort extrafields by rank
|
||||
uasort($fields, function ($a, $b) {
|
||||
return ($a->rank > $b->rank) ? -1 : 1;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
|
||||
// define some HTML content with style
|
||||
$html.= '<style>'.$params['style'].'</style>';
|
||||
$html.= !empty($params['style'])?'<style>'.$params['style'].'</style>':'';
|
||||
|
||||
// auto select display format
|
||||
if($params['display'] == 'auto') {
|
||||
@ -1260,10 +1336,12 @@ abstract class CommonDocGenerator
|
||||
|
||||
if($params['display'] == 'list') {
|
||||
// Display in list format
|
||||
$i=0;
|
||||
foreach ($fields as $field) {
|
||||
$html .= !empty($html)?$params['list']['separator']:'';
|
||||
$html .= !empty($i)?$params['list']['separator']:'';
|
||||
$html .= '<strong>' . $field->label . ' : </strong>';
|
||||
$html .= $field->content;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
elseif($params['display'] == 'table') {
|
||||
@ -1338,7 +1416,7 @@ abstract class CommonDocGenerator
|
||||
/**
|
||||
* Print standard column content
|
||||
*
|
||||
* @param PDF $pdf Pdf object
|
||||
* @param TCPDI $pdf Pdf object
|
||||
* @param float $tab_top Tab top position
|
||||
* @param float $tab_height Default tab height
|
||||
* @param Translate $outputlangs Output language
|
||||
@ -1374,18 +1452,35 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
// save curent cell padding
|
||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||
|
||||
global $outputlangsbis;
|
||||
if (is_object($outputlangsbis)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0] + 4);
|
||||
// set cell padding with column title definition
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], 0.5);
|
||||
}
|
||||
else{
|
||||
// set cell padding with column title definition
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], $colDef['title']['padding'][2]);
|
||||
}
|
||||
|
||||
$pdf->SetXY($colDef['xStartPos'], $tab_top);
|
||||
$textWidth = $colDef['width'];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
|
||||
|
||||
if (is_object($outputlangsbis)) {
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], 0, $colDef['title']['padding'][1], $colDef['title']['padding'][2]);
|
||||
$pdf->SetXY($colDef['xStartPos'], $pdf->GetY());
|
||||
$textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']);
|
||||
$pdf->MultiCell($textWidth, 2, $textbis, '', $colDef['title']['align']);
|
||||
}
|
||||
|
||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
|
||||
|
||||
// restore cell padding
|
||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1430,8 +1525,16 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
|
||||
// Enable extrafield ?
|
||||
$enabled = !empty($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
$enabled = 0;
|
||||
if(!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
if($printable === 1 || $printable === 2) {
|
||||
$enabled = 1;
|
||||
}
|
||||
// Note : if $printable === 3 or 4 so, it's displayed after line description not in cols
|
||||
}
|
||||
|
||||
if (!$enabled){ continue; } // don't wast resourses if we don't need them...
|
||||
|
||||
// Load language if required
|
||||
if (!empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $outputlangs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
|
||||
|
||||
@ -546,9 +546,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines = $pdf->getPage();
|
||||
@ -567,12 +565,9 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore = $pdf->getPage();
|
||||
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc - 1;
|
||||
|
||||
$showpricebeforepagebreak = 1;
|
||||
$posYAfterImage = 0;
|
||||
$posYAfterDescription = 0;
|
||||
|
||||
if ($this->getColumnStatus('photo'))
|
||||
{
|
||||
@ -603,15 +598,18 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
|
||||
@ -638,7 +636,6 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
$posYAfterDescription = $pdf->GetY();
|
||||
}
|
||||
|
||||
|
||||
@ -775,11 +772,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
@ -1691,7 +1687,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -1728,10 +1724,11 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -418,9 +418,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
@ -473,15 +471,15 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
@ -582,16 +580,13 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
}
|
||||
}
|
||||
|
||||
$nexY += 3;
|
||||
if ($weighttxt && $voltxt) $nexY += 2;
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
@ -1121,7 +1116,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -1158,10 +1153,10 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -582,9 +582,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines = $pdf->getPage();
|
||||
@ -605,7 +603,6 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$showpricebeforepagebreak = 1;
|
||||
$posYAfterImage = 0;
|
||||
$posYAfterDescription = 0;
|
||||
|
||||
if ($this->getColumnStatus('photo'))
|
||||
{
|
||||
@ -637,13 +634,17 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
|
||||
@ -670,10 +671,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
$posYAfterDescription = $pdf->GetY();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter = $pdf->getPage();
|
||||
$pdf->setPage($pageposbefore);
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
@ -823,12 +823,10 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter) {
|
||||
$pdf->setPage($pagenb);
|
||||
@ -2216,7 +2214,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -2257,6 +2255,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Christophe Battarel <contact@altairis.fr>
|
||||
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -181,6 +182,7 @@ class modProduct extends DolibarrModules
|
||||
'p.customcode'=>'CustomCode','p.fk_country'=>'IDCountry',
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight", 'p.weight_units'=>"WeightUnits", 'p.length'=>"Length", 'p.length_units'=>"LengthUnits", 'p.width'=>"Width", 'p.width_units'=>"WidthUnits", 'p.height'=>"Height", 'p.height_units'=>"HeightUnits",
|
||||
'p.surface'=>"Surface", 'p.surface_units'=>"SurfaceUnits", 'p.volume'=>"Volume", 'p.volume_units'=>"VolumeUnits",
|
||||
@ -203,8 +205,9 @@ class modProduct extends DolibarrModules
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",
|
||||
'p.fk_product_type'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
|
||||
'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
'p.description'=>"Text",'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text",'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text",'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",
|
||||
'p.customcode'=>'Text',
|
||||
@ -315,6 +318,7 @@ class modProduct extends DolibarrModules
|
||||
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode",'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
|
||||
@ -325,7 +329,8 @@ class modProduct extends DolibarrModules
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text",'p.accountancy_code_buy_intra'=>"Text",'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text",'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
@ -337,7 +342,8 @@ class modProduct extends DolibarrModules
|
||||
$this->export_entities_array[$r]=array(
|
||||
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_sell_intra'=>'virtualproduct','p.accountancy_code_sell_export'=>'virtualproduct',
|
||||
'p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.accountancy_code_buy'=>'virtualproduct','p.accountancy_code_buy_intra'=>'virtualproduct','p.accountancy_code_buy_export'=>'virtualproduct',
|
||||
'p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
@ -384,6 +390,8 @@ class modProduct extends DolibarrModules
|
||||
'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode",
|
||||
'p.accountancy_code_buy' => "ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode",
|
||||
'p.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode",
|
||||
'p.note_public' => "NotePublic",
|
||||
'p.note' => "NotePrivate",
|
||||
'p.weight' => "Weight",
|
||||
@ -533,6 +541,8 @@ class modProduct extends DolibarrModules
|
||||
'p.accountancy_code_sell_intra' => "",
|
||||
'p.accountancy_code_sell_export' => "",
|
||||
'p.accountancy_code_buy' => "",
|
||||
'p.accountancy_code_buy_intra' => "",
|
||||
'p.accountancy_code_buy_export' => "",
|
||||
'p.weight' => "",
|
||||
'p.weight_units' => 'kg', // Use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.length' => "",
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -148,6 +149,7 @@ class modService extends DolibarrModules
|
||||
'p.customcode'=>'CustomCode','p.fk_country'=>'IDCountry',
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",
|
||||
'p.duration'=>"Duration",
|
||||
@ -171,6 +173,7 @@ class modService extends DolibarrModules
|
||||
'p.fk_product_type'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
|
||||
'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text",'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",
|
||||
'p.customcode'=>'Text',
|
||||
@ -283,6 +286,7 @@ class modService extends DolibarrModules
|
||||
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode",'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
|
||||
@ -293,7 +297,8 @@ class modService extends DolibarrModules
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text",'p.accountancy_code_buy_intra'=>"Text",'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text",'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
@ -305,7 +310,8 @@ class modService extends DolibarrModules
|
||||
$this->export_entities_array[$r]=array(
|
||||
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_sell_intra'=>'virtualproduct','p.accountancy_code_sell_export'=>'virtualproduct',
|
||||
'p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.accountancy_code_buy'=>'virtualproduct','p.accountancy_code_buy_intra'=>'virtualproduct','p.accountancy_code_buy_export'=>'virtualproduct',
|
||||
'p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
@ -353,6 +359,8 @@ class modService extends DolibarrModules
|
||||
'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode",
|
||||
'p.accountancy_code_buy' => "ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode",
|
||||
'p.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode",
|
||||
'p.note_public' => "NotePublic",
|
||||
'p.note' => "NotePrivate",
|
||||
'p.weight' => "Weight",
|
||||
@ -500,6 +508,8 @@ class modService extends DolibarrModules
|
||||
'p.accountancy_code_sell_intra' => "",
|
||||
'p.accountancy_code_sell_export' => "",
|
||||
'p.accountancy_code_buy' => "",
|
||||
'p.accountancy_code_buy_intra' => "",
|
||||
'p.accountancy_code_buy_export' => "",
|
||||
'p.weight' => "",
|
||||
'p.weight_units' => 'kg', // Use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.length' => "",
|
||||
|
||||
@ -564,9 +564,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines = $pdf->getPage();
|
||||
@ -621,15 +619,17 @@ class pdf_cyan extends ModelePDFPropales
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
@ -794,11 +794,11 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
@ -1840,7 +1840,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -1877,10 +1877,11 @@ class pdf_cyan extends ModelePDFPropales
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -496,9 +496,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
$height_note = 0;
|
||||
}
|
||||
|
||||
$iniY = $tab_top + 7;
|
||||
$curY = $tab_top + 7;
|
||||
$nexY = $tab_top + 7;
|
||||
$nexY = $tab_top + 5;
|
||||
|
||||
// Use new auto collum system
|
||||
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
@ -555,15 +553,15 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
|
||||
@ -724,12 +722,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
{
|
||||
@ -1483,7 +1479,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -1520,10 +1516,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ $langs->load("modulebuilder");
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOST('list', 'int')!='' ? GETPOST('list', 'int') : '1'; ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" type="checkbox" name="printable"<?php echo GETPOST('printable', 'alpha')?' checked':''; ?>></td></tr>
|
||||
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag(GETPOST('printable', 'int')); ?>"></td></tr>
|
||||
<!-- Totalizable -->
|
||||
<tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ((GETPOST('totalizable', 'alpha') || GETPOST('button', 'alpha'))?' checked':''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
|
||||
@ -267,7 +267,7 @@ else
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" type="checkbox" name="printable"<?php echo !empty($printable)?' checked':''; ?>></td></tr>
|
||||
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag($printable); ?>"></td></tr>
|
||||
<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable?' checked':''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr>
|
||||
|
||||
@ -93,7 +93,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n";
|
||||
print '<td class="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['printable'][$key])."</td>\n";
|
||||
print '<td class="center">'.$extrafields->attributes[$elementtype]['printable'][$key]."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."</td>\n";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
print '<td class="center">';
|
||||
|
||||
@ -141,17 +141,239 @@ class Odf
|
||||
//}
|
||||
}
|
||||
|
||||
$value=$this->htmlToUTFAndPreOdf($value);
|
||||
|
||||
$value = $encode ? htmlspecialchars($value) : $value;
|
||||
$value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
|
||||
|
||||
$value=$this->preOdfToOdf($value);
|
||||
// Check if the value includes html tags
|
||||
if ($this->_hasHtmlTag($value) === true) {
|
||||
// Default styles for strong/b, i/em, u, s, sub & sup
|
||||
$automaticStyles = array(
|
||||
'<style:style style:name="boldText" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>',
|
||||
'<style:style style:name="italicText" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>',
|
||||
'<style:style style:name="underlineText" style:family="text"><style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" /></style:style>',
|
||||
'<style:style style:name="strikethroughText" style:family="text"><style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single" /></style:style>',
|
||||
'<style:style style:name="subText" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>',
|
||||
'<style:style style:name="supText" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>'
|
||||
);
|
||||
|
||||
$this->vars[$tag] = $this->_replaceHtmlWithOdtTag($this->_getDataFromHtml($value), $customStyles, $fontDeclarations);
|
||||
|
||||
foreach ($customStyles as $key => $val) {
|
||||
array_push($automaticStyles, '<style:style style:name="customStyle' . $key . '" style:family="text">' . $val . '</style:style>');
|
||||
}
|
||||
|
||||
$this->vars[$tag] = $value;
|
||||
// Join the styles and add them to the content xml
|
||||
$styles = '';
|
||||
foreach ($automaticStyles as $style) {
|
||||
if (strpos($this->contentXml, $style) === false) {
|
||||
$styles .= $style;
|
||||
}
|
||||
}
|
||||
$this->contentXml = str_replace('</office:automatic-styles>', $styles . '</office:automatic-styles>', $this->contentXml);
|
||||
|
||||
// Join the font declarations and add them to the content xml
|
||||
$fonts = '';
|
||||
foreach ($fontDeclarations as $font) {
|
||||
if (strpos($this->contentXml, 'style:name="' . $font . '"') === false) {
|
||||
$fonts .= '<style:font-face style:name="' . $font . '" svg:font-family="\'' . $font . '\'" />';
|
||||
}
|
||||
}
|
||||
$this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml);
|
||||
}
|
||||
else $this->vars[$tag] = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces html tags in with odt tags and returns an odt string
|
||||
* @param array $tags An array with html tags generated by the getDataFromHtml() function
|
||||
* @param array $customStyles An array of style defenitions that should be included inside the odt file
|
||||
* @param array $fontDeclarations An array of font declarations that should be included inside the odt file
|
||||
* @return string
|
||||
*/
|
||||
private function _replaceHtmlWithOdtTag($tags, &$customStyles, &$fontDeclarations)
|
||||
{
|
||||
if ($customStyles == null) $customStyles = array();
|
||||
if ($fontDeclarations == null) $fontDeclarations = array();
|
||||
|
||||
$odtResult = '';
|
||||
|
||||
foreach ((array) $tags as $tag) {
|
||||
// Check if the current item is a tag or just plain text
|
||||
if (isset($tag['text'])) {
|
||||
$odtResult .= $tag['text'];
|
||||
} elseif (isset($tag['name'])) {
|
||||
switch ($tag['name']) {
|
||||
case 'br':
|
||||
$odtResult .= '<text:line-break/>';
|
||||
break;
|
||||
case 'strong':
|
||||
case 'b':
|
||||
$odtResult .= '<text:span text:style-name="boldText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations) : $tag['innerText']) . '</text:span>';
|
||||
break;
|
||||
case 'i':
|
||||
case 'em':
|
||||
$odtResult .= '<text:span text:style-name="italicText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations) : $tag['innerText']) . '</text:span>';
|
||||
break;
|
||||
case 'u':
|
||||
$odtResult .= '<text:span text:style-name="underlineText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations) : $tag['innerText']) . '</text:span>';
|
||||
break;
|
||||
case 's':
|
||||
$odtResult .= '<text:span text:style-name="strikethroughText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations) : $tag['innerText']) . '</text:span>';
|
||||
break;
|
||||
case 'sub':
|
||||
$odtResult .= '<text:span text:style-name="subText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations) : $tag['innerText']) . '</text:span>';
|
||||
break;
|
||||
case 'sup':
|
||||
$odtResult .= '<text:span text:style-name="supText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations) : $tag['innerText']) . '</text:span>';
|
||||
break;
|
||||
case 'span':
|
||||
if (isset($tag['attributes']['style'])) {
|
||||
$odtStyles = '';
|
||||
foreach ($tag['attributes']['style'] as $styleName => $styleValue) {
|
||||
switch ($styleName) {
|
||||
case 'font-family':
|
||||
$fontName = $styleValue;
|
||||
if (strpos($fontName, ',') !== false) {
|
||||
$fontName = explode(',', $fontName)[0];
|
||||
}
|
||||
if (!in_array($fontName, $fontDeclarations)) {
|
||||
array_push($fontDeclarations, $fontName);
|
||||
}
|
||||
$odtStyles .= '<style:text-properties style:font-name="' . $fontName . '" />';
|
||||
break;
|
||||
case 'font-size':
|
||||
if (preg_match('/([0-9]+)\s?(px|pt)/', $styleValue, $matches)) {
|
||||
$fontSize = intval($matches[1]);
|
||||
if ($matches[2] == 'px') {
|
||||
$fontSize = round($fontSize * 0.75);
|
||||
}
|
||||
$odtStyles .= '<style:text-properties fo:font-size="' . $fontSize . 'pt" style:font-size-asian="' . $fontSize . 'pt" style:font-size-complex="' . $fontSize . 'pt" />';
|
||||
}
|
||||
break;
|
||||
case 'color':
|
||||
if (preg_match('/#[0-9A-Fa-f]{3}(?:[0-9A-Fa-f]{3})?/', $styleValue)) {
|
||||
$odtStyles .= '<style:text-properties fo:color="' . $styleValue . '" />';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strlen($odtStyles) > 0) {
|
||||
// Generate a unique id for the style (using microtime and random because some CPUs are really fast...)
|
||||
$key = floatval(str_replace('.', '', microtime(true)))+rand(0, 10);
|
||||
$customStyles[$key] = $odtStyles;
|
||||
$odtResult .= '<text:span text:style-name="customStyle' . $key . '">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations) : $tag['innerText']) . '</text:span>';
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$odtResult .= $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $odtResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given text is a html string
|
||||
* @param string $text The text to check
|
||||
* @return bool
|
||||
*/
|
||||
private function _isHtmlTag($text)
|
||||
{
|
||||
return preg_match('/<([A-Za-z]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/', $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given text includes a html string
|
||||
* @param string $text The text to check
|
||||
* @return bool
|
||||
*/
|
||||
private function _hasHtmlTag($text)
|
||||
{
|
||||
$result = preg_match_all('/<([A-Za-z]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/', $text);
|
||||
return is_numeric($result) && $result > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of html elements
|
||||
* @param string $html A string with html tags
|
||||
* @return array
|
||||
*/
|
||||
private function _getDataFromHtml($html)
|
||||
{
|
||||
$tags = array();
|
||||
$tempHtml = $html;
|
||||
|
||||
while (strlen($tempHtml) > 0) {
|
||||
// Check if the string includes a html tag
|
||||
if (preg_match_all('/<([A-Za-z]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/', $tempHtml, $matches)) {
|
||||
$tagOffset = strpos($tempHtml, $matches[0][0]);
|
||||
// Check if the string starts with the html tag
|
||||
if ($tagOffset > 0) {
|
||||
// Push the text infront of the html tag to the result array
|
||||
array_push($tags, array(
|
||||
'text' => substr($tempHtml, 0, $tagOffset)
|
||||
));
|
||||
// Remove the text from the string
|
||||
$tempHtml = substr($tempHtml, $tagOffset);
|
||||
}
|
||||
// Extract the attribute data from the html tag
|
||||
preg_match_all('/([0-9A-Za-z]+(?:="[0-9A-Za-z\:\-\s\,\;]*")?)+/', $matches[2][0], $explodedAttributes);
|
||||
$explodedAttributes = array_filter($explodedAttributes[0]);
|
||||
$attributes = array();
|
||||
// Store each attribute with its name in the $attributes array
|
||||
$explodedAttributesCount = count($explodedAttributes);
|
||||
for ($i=0; $i<$explodedAttributesCount; $i++) {
|
||||
$attribute = trim($explodedAttributes[$i]);
|
||||
// Check if the attribute has a value (like style="") or has no value (like required)
|
||||
if (strpos($attribute, '=') !== false) {
|
||||
$splitAttribute = explode('=', $attribute);
|
||||
$attrName = trim($splitAttribute[0]);
|
||||
$attrValue = trim(str_replace('"', '', $splitAttribute[1]));
|
||||
// check if the current attribute is a style attribute
|
||||
if (strtolower($attrName) == 'style') {
|
||||
$attributes[$attrName] = array();
|
||||
if (strpos($attrValue, ';') !== false) {
|
||||
// Split the style properties and store them in an array
|
||||
$explodedStyles = explode(';', $attrValue);
|
||||
$explodedStylesCount = count($explodedStyles);
|
||||
for ($n=0; $n<$explodedStylesCount; $n++) {
|
||||
$splitStyle = explode(':', $explodedStyles[$n]);
|
||||
$attributes[$attrName][trim($splitStyle[0])] = trim($splitStyle[1]);
|
||||
}
|
||||
} else {
|
||||
$splitStyle = explode(':', $attrValue);
|
||||
$attributes[$attrName][trim($splitStyle[0])] = trim($splitStyle[1]);
|
||||
}
|
||||
} else {
|
||||
// Store the value directly in the $attributes array if this is not the style attribute
|
||||
$attributes[$attrName] = $attrValue;
|
||||
}
|
||||
} else {
|
||||
$attributes[trim($attribute)] = true;
|
||||
}
|
||||
}
|
||||
// Push the html tag data to the result array
|
||||
array_push($tags, array(
|
||||
'name' => $matches[1][0],
|
||||
'attributes' => $attributes,
|
||||
'innerText' => strip_tags($matches[3][0]),
|
||||
'children' => $this->_hasHtmlTag($matches[3][0]) ? $this->_getDataFromHtml($matches[3][0]) : null
|
||||
));
|
||||
// Remove the processed html tag from the html string
|
||||
$tempHtml = substr($tempHtml, strlen($matches[0][0]));
|
||||
} else {
|
||||
array_push($tags, array(
|
||||
'text' => $tempHtml
|
||||
));
|
||||
$tempHtml = '';
|
||||
}
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to convert a HTML string into an ODT string
|
||||
|
||||
@ -187,3 +187,6 @@ ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0;
|
||||
ALTER TABLE llx_extrafields ADD COLUMN printable integer DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype;
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy;
|
||||
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_export varchar(32) AFTER accountancy_code_buy_intra;
|
||||
|
||||
@ -68,6 +68,8 @@ create table llx_product
|
||||
accountancy_code_sell_intra varchar(32), -- Selling accountancy code for vat intracommunity
|
||||
accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export
|
||||
accountancy_code_buy varchar(32), -- Buying accountancy code
|
||||
accountancy_code_buy_intra varchar(32), -- Buying accountancy code for vat intracommunity
|
||||
accountancy_code_buy_export varchar(32), -- Buying accountancy code for vat export
|
||||
partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode.
|
||||
net_measure float DEFAULT NULL,
|
||||
net_measure_units tinyint DEFAULT NULL,
|
||||
|
||||
@ -168,10 +168,15 @@ DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations
|
||||
ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions
|
||||
|
||||
ACCOUNTING_PRODUCT_BUY_ACCOUNT=Accounting account by default for the bought products (used if not defined in the product sheet)
|
||||
ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT=Accounting account by default for the bought products in EEC (used if not defined in the product sheet)
|
||||
ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT=Accounting account by default for the bought products and imported out of EEC (used if not defined in the product sheet)
|
||||
ACCOUNTING_PRODUCT_SOLD_ACCOUNT=Accounting account by default for the sold products (used if not defined in the product sheet)
|
||||
ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT=Accounting account by default for the products sold in EEC (used if not defined in the product sheet)
|
||||
ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT=Accounting account by default for the products sold and exported out of EEC (used if not defined in the product sheet)
|
||||
|
||||
ACCOUNTING_SERVICE_BUY_ACCOUNT=Accounting account by default for the bought services (used if not defined in the service sheet)
|
||||
ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT=Accounting account by default for the bought services in EEC (used if not defined in the service sheet)
|
||||
ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT=Accounting account by default for the bought services and imported out of EEC (used if not defined in the service sheet)
|
||||
ACCOUNTING_SERVICE_SOLD_ACCOUNT=Accounting account by default for the sold services (used if not defined in the service sheet)
|
||||
ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT=Accounting account by default for the services sold in EEC (used if not defined in the service sheet)
|
||||
ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT=Accounting account by default for the services sold and exported out of EEC (used if not defined in the service sheet)
|
||||
@ -324,10 +329,14 @@ OptionModeProductSell=Mode sales
|
||||
OptionModeProductSellIntra=Mode sales exported in EEC
|
||||
OptionModeProductSellExport=Mode sales exported in other countries
|
||||
OptionModeProductBuy=Mode purchases
|
||||
OptionModeProductBuyIntra=Mode purchases imported in EEC
|
||||
OptionModeProductBuyExport=Mode purchased imported from other countries
|
||||
OptionModeProductSellDesc=Show all products with accounting account for sales.
|
||||
OptionModeProductSellIntraDesc=Show all products with accounting account for sales in EEC.
|
||||
OptionModeProductSellExportDesc=Show all products with accounting account for other foreign sales.
|
||||
OptionModeProductBuyDesc=Show all products with accounting account for purchases.
|
||||
OptionModeProductBuyIntraDesc=Show all products with accounting account for purchases in EEC.
|
||||
OptionModeProductBuyExportDesc=Show all products with accounting account for other foreign purchases.
|
||||
CleanFixHistory=Remove accounting code from lines that not exists into charts of account
|
||||
CleanHistory=Reset all bindings for selected year
|
||||
PredefinedGroups=Predefined groups
|
||||
|
||||
@ -91,3 +91,4 @@ TakeposConnectorMethodDescription=External module with extra features. Posibilit
|
||||
PrintMethod=Print method
|
||||
ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud.
|
||||
ByTerminal=By terminal
|
||||
TakeposNumpadUsePaymentIcon=Use payment icon on numpad
|
||||
|
||||
@ -84,7 +84,7 @@ ListOfPermissionsDefined=List of defined permissions
|
||||
SeeExamples=See examples here
|
||||
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
|
||||
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list end view form only (not create, not update). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example:<br>preg_match('/public/', $_SERVER['PHP_SELF'])?0:1<br>($user->rights->holiday->define_holiday ? 1 : 0)
|
||||
DisplayOnPdfDesc=Display this field on compatible PDF documents, you can manage position with "Position" field.<br/>Currently, known compatibles PDF models are : eratostene (order), espadon (ship), sponge (invoices), cyan (propal/quotation), cornas (supplier order)
|
||||
DisplayOnPdfDesc=Display this field on compatible PDF documents, you can manage position with "Position" field.<br/>Currently, known compatibles PDF models are : eratostene (order), espadon (ship), sponge (invoices), cyan (propal/quotation), cornas (supplier order)<br/><br/><strong>For document :</strong><br/>0 = not displayed <br/>1 = display<br/>2 = display only if not empty<br/><br/><strong>For document lines :</strong><br/>0 = not displayed <br/>1 = displayed in a column<br/>3 = display in line description column after the description<br/>4 = display in description column after the description only if not empty
|
||||
DisplayOnPdf=Display on PDF
|
||||
IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0)
|
||||
SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0)
|
||||
@ -138,4 +138,4 @@ NotEditable=Not editable
|
||||
ForeignKey=Foreign key
|
||||
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
|
||||
AsciiToHtmlConverter=Ascii to HTML converter
|
||||
AsciiToPdfConverter=Ascii to PDF converter
|
||||
AsciiToPdfConverter=Ascii to PDF converter
|
||||
|
||||
@ -22,6 +22,8 @@ ProductVatMassChangeDesc=This tool updates the VAT rate defined on <b><u>ALL</u>
|
||||
MassBarcodeInit=Mass barcode init
|
||||
MassBarcodeInitDesc=This page can be used to initialize a barcode on objects that does not have barcode defined. Check before that setup of module barcode is complete.
|
||||
ProductAccountancyBuyCode=Accounting code (purchase)
|
||||
ProductAccountancyBuyIntraCode=Accounting code (purchase intra-community)
|
||||
ProductAccountancyBuyExportCode=Accounting code (purchase export)
|
||||
ProductAccountancySellCode=Accounting code (sale)
|
||||
ProductAccountancySellIntraCode=Accounting code (sale intra-Community)
|
||||
ProductAccountancySellExportCode=Accounting code (sale export)
|
||||
@ -380,4 +382,4 @@ ErrorProductCombinationNotFound=Product variant not found
|
||||
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
|
||||
ProductsPricePerCustomer=Product prices per customers
|
||||
ProductSupplierExtraFields=Additional Attributes (Supplier Prices)
|
||||
DeleteLinkedProduct=Delete the child product linked to the combination
|
||||
DeleteLinkedProduct=Delete the child product linked to the combination
|
||||
|
||||
@ -82,3 +82,4 @@ ReceiptName=Nom du reçu
|
||||
ProductSupplements=Suppléments de produit
|
||||
SupplementCategory=Catégorie des suppléments
|
||||
SortProductField=Champ pour le tri des produits
|
||||
TakeposNumpadUsePaymentIcon=Utilisation d'icônes sur les touches des modes de règlement du pavé numérique
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2011-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
@ -320,11 +320,15 @@ if (empty($reshook))
|
||||
$accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha');
|
||||
$accountancy_code_sell_export = GETPOST('accountancy_code_sell_export', 'alpha');
|
||||
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
|
||||
$accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha');
|
||||
$accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha');
|
||||
|
||||
if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; }
|
||||
if ($accountancy_code_sell_intra <= 0) { $object->accountancy_code_sell_intra = ''; } else { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; }
|
||||
if ($accountancy_code_sell_export <= 0) { $object->accountancy_code_sell_export = ''; } else { $object->accountancy_code_sell_export = $accountancy_code_sell_export; }
|
||||
if ($accountancy_code_buy <= 0) { $object->accountancy_code_buy = ''; } else { $object->accountancy_code_buy = $accountancy_code_buy; }
|
||||
if ($accountancy_code_buy_intra <= 0) { $object->accountancy_code_buy_intra = ''; } else { $object->accountancy_code_buy_intra = $accountancy_code_buy_intra; }
|
||||
if ($accountancy_code_buy_export <= 0) { $object->accountancy_code_buy_export = ''; } else { $object->accountancy_code_buy_export = $accountancy_code_buy_export; }
|
||||
|
||||
// MultiPrix
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
@ -461,11 +465,15 @@ if (empty($reshook))
|
||||
$accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha');
|
||||
$accountancy_code_sell_export = GETPOST('accountancy_code_sell_export', 'alpha');
|
||||
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
|
||||
$accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha');
|
||||
$accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha');
|
||||
|
||||
if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; }
|
||||
if ($accountancy_code_sell_intra <= 0) { $object->accountancy_code_sell_intra = ''; } else { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; }
|
||||
if ($accountancy_code_sell_export <= 0) { $object->accountancy_code_sell_export = ''; } else { $object->accountancy_code_sell_export = $accountancy_code_sell_export; }
|
||||
if ($accountancy_code_buy <= 0) { $object->accountancy_code_buy = ''; } else { $object->accountancy_code_buy = $accountancy_code_buy; }
|
||||
if ($accountancy_code_buy_intra <= 0) { $object->accountancy_code_buy_intra = ''; } else { $object->accountancy_code_buy_intra = $accountancy_code_buy_intra; }
|
||||
if ($accountancy_code_buy_export <= 0) { $object->accountancy_code_buy_export = ''; } else { $object->accountancy_code_buy_export = $accountancy_code_buy_export; }
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
@ -1274,6 +1282,32 @@ else
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_buy', 'alpha'), 'accountancy_code_buy', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>';
|
||||
print '<td>';
|
||||
if ($type == 0) {
|
||||
$accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT);
|
||||
} else {
|
||||
$accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_buy_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>';
|
||||
print '<td>';
|
||||
if ($type == 0)
|
||||
{
|
||||
$accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT);
|
||||
} else {
|
||||
$accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
@ -1299,6 +1333,19 @@ else
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy_intra" value="'.$object->accountancy_code_buy_intra.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_buy_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy_export" value="'.$object->accountancy_code_buy_export.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -1606,6 +1653,21 @@ else
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_buy_export
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_buy_export, 'accountancy_code_buy_export', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
@ -1631,6 +1693,19 @@ else
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>';
|
||||
print '<td><input name="accountancy_code_buy_intra" class="maxwidth200" value="'.$object->accountancy_code_buy_intra.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_buy_export
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>';
|
||||
print '<td><input name="accountancy_code_buy_export" class="maxwidth200" value="'.$object->accountancy_code_buy_export.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -1812,6 +1887,45 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy buy code intra-community
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancyBuyIntraCode");
|
||||
print '</td><td colspan="2">';
|
||||
if (!empty($conf->accounting->enabled))
|
||||
{
|
||||
if (!empty($object->accountancy_code_buy_intra))
|
||||
{
|
||||
$accountingaccount5 = new AccountingAccount($db);
|
||||
$accountingaccount5->fetch('', $object->accountancy_code_buy_intra, 1);
|
||||
|
||||
print $accountingaccount5->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
} else {
|
||||
print $object->accountancy_code_buy_intra;
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy buy code export
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancyBuyExportCode");
|
||||
print '</td><td colspan="2">';
|
||||
if (!empty($conf->accounting->enabled))
|
||||
{
|
||||
if (!empty($object->accountancy_code_buy_export))
|
||||
{
|
||||
$accountingaccount6 = new AccountingAccount($db);
|
||||
$accountingaccount6->fetch('', $object->accountancy_code_buy_export, 1);
|
||||
|
||||
print $accountingaccount6->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
} else {
|
||||
print $object->accountancy_code_buy_export;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Batch number management (to batch)
|
||||
if (!empty($conf->productbatch->enabled))
|
||||
{
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
||||
@ -284,6 +284,8 @@ class Product extends CommonObject
|
||||
public $accountancy_code_sell_intra;
|
||||
public $accountancy_code_sell_export;
|
||||
public $accountancy_code_buy;
|
||||
public $accountancy_code_buy_intra;
|
||||
public $accountancy_code_buy_export;
|
||||
|
||||
/**
|
||||
* Main Barcode value
|
||||
@ -544,7 +546,9 @@ class Product extends CommonObject
|
||||
$price_min_ttc = price2num($this->price_min * (1 + ($this->tva_tx / 100)), 'MU');
|
||||
}
|
||||
|
||||
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
||||
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
||||
$this->accountancy_code_buy_intra = trim($this->accountancy_code_buy_intra);
|
||||
$this->accountancy_code_buy_export = trim($this->accountancy_code_buy_export);
|
||||
$this->accountancy_code_sell = trim($this->accountancy_code_sell);
|
||||
$this->accountancy_code_sell_intra = trim($this->accountancy_code_sell_intra);
|
||||
$this->accountancy_code_sell_export = trim($this->accountancy_code_sell_export);
|
||||
@ -622,6 +626,8 @@ class Product extends CommonObject
|
||||
$sql .= ", tobuy";
|
||||
$sql .= ", tosell";
|
||||
$sql .= ", accountancy_code_buy";
|
||||
$sql .= ", accountancy_code_buy_intra";
|
||||
$sql .= ", accountancy_code_buy_export";
|
||||
$sql .= ", accountancy_code_sell";
|
||||
$sql .= ", accountancy_code_sell_intra";
|
||||
$sql .= ", accountancy_code_sell_export";
|
||||
@ -645,6 +651,8 @@ class Product extends CommonObject
|
||||
$sql .= ", ".$this->status;
|
||||
$sql .= ", ".$this->status_buy;
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
|
||||
@ -896,6 +904,8 @@ class Product extends CommonObject
|
||||
$this->barcode = trim($this->barcode);
|
||||
|
||||
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
||||
$this->accountancy_code_buy_intra = trim($this->accountancy_code_buy_intra);
|
||||
$this->accountancy_code_buy_export = trim($this->accountancy_code_buy_export);
|
||||
$this->accountancy_code_sell = trim($this->accountancy_code_sell);
|
||||
$this->accountancy_code_sell_intra = trim($this->accountancy_code_sell_intra);
|
||||
$this->accountancy_code_sell_export = trim($this->accountancy_code_sell_export);
|
||||
@ -1010,6 +1020,8 @@ class Product extends CommonObject
|
||||
$sql .= ", note = ".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : 'null');
|
||||
$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
|
||||
$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
|
||||
$sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'";
|
||||
$sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'";
|
||||
$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
|
||||
$sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'";
|
||||
$sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'";
|
||||
@ -1431,7 +1443,7 @@ class Product extends CommonObject
|
||||
* Sets an accountancy code for a product.
|
||||
* Also calls PRODUCT_MODIFY trigger when modified
|
||||
*
|
||||
* @param string $type It can be 'buy', 'sell', 'sell_intra' or 'sell_export'
|
||||
* @param string $type It can be 'buy', 'buy_intra', 'buy_export', 'sell', 'sell_intra' or 'sell_export'
|
||||
* @param string $value Accountancy code
|
||||
* @return int <0 KO >0 OK
|
||||
*/
|
||||
@ -1443,7 +1455,11 @@ class Product extends CommonObject
|
||||
|
||||
if ($type == 'buy') {
|
||||
$field = 'accountancy_code_buy';
|
||||
} elseif ($type == 'sell') {
|
||||
} elseif ($type == 'buy_intra') {
|
||||
$field = 'accountancy_code_buy_intra';
|
||||
} elseif ($type == 'buy_export') {
|
||||
$field = 'accountancy_code_buy_export';
|
||||
} elseif ($type == 'sell') {
|
||||
$field = 'accountancy_code_sell';
|
||||
} elseif ($type == 'sell_intra') {
|
||||
$field = 'accountancy_code_sell_intra';
|
||||
@ -2082,7 +2098,8 @@ class Product extends CommonObject
|
||||
$sql .= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,";
|
||||
$sql .= " length, length_units, width, width_units, height, height_units,";
|
||||
$sql .= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
|
||||
$sql .= " accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,";
|
||||
$sql .= " accountancy_code_buy, accountancy_code_buy_intra, accountancy_code_buy_export,";
|
||||
$sql .= " accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,";
|
||||
$sql .= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,";
|
||||
$sql .= " fk_price_expression, price_autogen";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product";
|
||||
@ -2163,10 +2180,12 @@ class Product extends CommonObject
|
||||
$this->barcode = $obj->barcode;
|
||||
$this->barcode_type = $obj->fk_barcode_type;
|
||||
|
||||
$this->accountancy_code_buy = $obj->accountancy_code_buy;
|
||||
$this->accountancy_code_sell = $obj->accountancy_code_sell;
|
||||
$this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
|
||||
$this->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
|
||||
$this->accountancy_code_buy = $obj->accountancy_code_buy;
|
||||
$this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
|
||||
$this->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
|
||||
$this->accountancy_code_sell = $obj->accountancy_code_sell;
|
||||
$this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
|
||||
$this->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
|
||||
|
||||
$this->fk_default_warehouse = $obj->fk_default_warehouse;
|
||||
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
|
||||
@ -4398,15 +4417,15 @@ class Product extends CommonObject
|
||||
if (!empty($conf->accounting->enabled) && $this->status) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancySellCode').':</b> '.length_accountg($this->accountancy_code_sell);
|
||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancySellIntraCode').':</b> '.length_accountg($this->accountancy_code_sell_export);
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancySellExportCode').':</b> '.length_accountg($this->accountancy_code_sell_intra);
|
||||
}
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancySellIntraCode').':</b> '.length_accountg($this->accountancy_code_sell_intra);
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancySellExportCode').':</b> '.length_accountg($this->accountancy_code_sell_export);
|
||||
}
|
||||
if (!empty($conf->accounting->enabled) && $this->status_buy) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyCode').':</b> '.length_accountg($this->accountancy_code_buy);
|
||||
}
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyIntraCode').':</b> '.length_accountg($this->accountancy_code_buy_intra);
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyExportCode').':</b> '.length_accountg($this->accountancy_code_buy_export);
|
||||
}
|
||||
if (isset($this->status) && isset($this->status_buy)) {
|
||||
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5, 0);
|
||||
$label .= ' '.$this->getLibStatut(5, 1);
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
* Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -69,6 +70,8 @@ $search_accountancy_code_sell = GETPOST("search_accountancy_code_sell", 'alpha')
|
||||
$search_accountancy_code_sell_intra = GETPOST("search_accountancy_code_sell_intra", 'alpha');
|
||||
$search_accountancy_code_sell_export = GETPOST("search_accountancy_code_sell_export", 'alpha');
|
||||
$search_accountancy_code_buy = GETPOST("search_accountancy_code_buy", 'alpha');
|
||||
$search_accountancy_code_buy_intra = GETPOST("search_accountancy_code_buy_intra", 'alpha');
|
||||
$search_accountancy_code_buy_export = GETPOST("search_accountancy_code_buy_export", 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$type = GETPOST("type", "int");
|
||||
|
||||
@ -201,6 +204,8 @@ $arrayfields = array(
|
||||
'p.accountancy_code_sell_intra'=>array('label'=>$langs->trans("ProductAccountancySellIntraCode"), 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>401),
|
||||
'p.accountancy_code_sell_export'=>array('label'=>$langs->trans("ProductAccountancySellExportCode"), 'checked'=>0, 'position'=>402),
|
||||
'p.accountancy_code_buy'=>array('label'=>$langs->trans("ProductAccountancyBuyCode"), 'checked'=>0, 'position'=>403),
|
||||
'p.accountancy_code_buy_intra'=>array('label'=>$langs->trans("ProductAccountancyBuyIntraCode"), 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>404),
|
||||
'p.accountancy_code_buy_export'=>array('label'=>$langs->trans("ProductAccountancyBuyExportCode"), 'checked'=>0, 'position'=>405),
|
||||
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'p.tosell'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Sell").')', 'checked'=>1, 'position'=>1000),
|
||||
@ -256,6 +261,8 @@ if (empty($reshook))
|
||||
$search_accountancy_code_sell_intra = '';
|
||||
$search_accountancy_code_sell_export = '';
|
||||
$search_accountancy_code_buy = '';
|
||||
$search_accountancy_code_buy_intra = '';
|
||||
$search_accountancy_code_buy_export = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
@ -297,7 +304,8 @@ else
|
||||
|
||||
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,';
|
||||
$sql .= ' p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
|
||||
$sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,';
|
||||
$sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,';
|
||||
$sql .= ' p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,';
|
||||
$sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,';
|
||||
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units,';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,';
|
||||
@ -378,6 +386,8 @@ if ($search_accountancy_code_sell) $sql .= natural_search('p.accountancy_
|
||||
if ($search_accountancy_code_sell_intra) $sql .= natural_search('p.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
|
||||
if ($search_accountancy_code_sell_export) $sql .= natural_search('p.accountancy_code_sell_export', $search_accountancy_code_sell_export);
|
||||
if ($search_accountancy_code_buy) $sql .= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy);
|
||||
if ($search_accountancy_code_buy_intra) $sql .= natural_search('p.accountancy_code_buy_intra', $search_accountancy_code_buy_intra);
|
||||
if ($search_accountancy_code_buy_export) $sql .= natural_search('p.accountancy_code_buy_export', $search_accountancy_code_buy_export);
|
||||
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
@ -387,7 +397,8 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // No
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,";
|
||||
$sql .= " p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
|
||||
$sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,';
|
||||
$sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,';
|
||||
$sql .= ' p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.pmp, p.stock,';
|
||||
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label';
|
||||
|
||||
@ -481,6 +492,8 @@ if ($resql)
|
||||
if ($search_accountancy_code_sell_intra) $param = "&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra);
|
||||
if ($search_accountancy_code_sell_export) $param = "&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export);
|
||||
if ($search_accountancy_code_buy) $param = "&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
|
||||
if ($search_accountancy_code_buy_intra) $param = "&search_accountancy_code_buy_intra=".urlencode($search_accountancy_code_buy_intra);
|
||||
if ($search_accountancy_code_buy_export) $param = "&search_accountancy_code_buy_export=".urlencode($search_accountancy_code_buy_export);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -770,7 +783,9 @@ if ($resql)
|
||||
if (!empty($arrayfields['p.accountancy_code_sell_intra']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_intra" value="'.dol_escape_htmltag($search_accountancy_code_sell_intra).'"></td>';
|
||||
if (!empty($arrayfields['p.accountancy_code_sell_export']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_export" value="'.dol_escape_htmltag($search_accountancy_code_sell_export).'"></td>';
|
||||
// Accountancy code buy
|
||||
if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" name="search_accountancy_code_buy" size="6" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
|
||||
if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
|
||||
if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy_intra" value="'.dol_escape_htmltag($search_accountancy_code_buy_intra).'"></td>';
|
||||
if (!empty($arrayfields['p.accountancy_code_buy_export']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy_export" value="'.dol_escape_htmltag($search_accountancy_code_buy_export).'"></td>';
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
// Fields from hook
|
||||
@ -886,6 +901,12 @@ if ($resql)
|
||||
if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.accountancy_code_buy_intra']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy_intra", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['p.accountancy_code_buy_export']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.accountancy_code_buy_export']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy_export", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@ -950,6 +971,8 @@ if ($resql)
|
||||
$product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
|
||||
$product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
|
||||
$product_static->accountancy_code_buy = $obj->accountancy_code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
|
||||
$product_static->length = $obj->length;
|
||||
$product_static->length_units = $obj->length_units;
|
||||
$product_static->width = $obj->width;
|
||||
@ -1306,6 +1329,16 @@ if ($resql)
|
||||
print '<td>'.$obj->accountancy_code_buy.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->accountancy_code_buy_intra.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['p.accountancy_code_buy_export']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->accountancy_code_buy_export.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
|
||||
@ -175,7 +175,7 @@ print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("SortProductField");
|
||||
print '<td colspan="2">';
|
||||
$prod = new Product($db);
|
||||
$array = array('rowid' => 'ID', 'ref' => 'Ref', 'datec' => 'DateCreation', 'tms' => 'DateModification');
|
||||
$array = array('rowid' => 'ID', 'ref' => 'Ref', 'label' => 'Label', 'datec' => 'DateCreation', 'tms' => 'DateModification');
|
||||
print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0, '', 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
@ -201,6 +201,13 @@ $array = array(0=>$langs->trans("Numberspad"), 1=>$langs->trans("BillsCoinsPad")
|
||||
print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ? '0' : $conf->global->TAKEPOS_NUMPAD), 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Numpad use payment icons
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans('TakeposNumpadUsePaymentIcon');
|
||||
print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_NUMPAD_USE_PAYMENT_ICON", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Direct Payment
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans('DirectPaymentButton');
|
||||
|
||||
@ -22,4 +22,12 @@ button.actionbutton {
|
||||
tr.selected, tr.selected td {
|
||||
background-color: #0000FF !important;
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
}
|
||||
|
||||
.header{
|
||||
background: rgb(0,0,0) !important;
|
||||
}
|
||||
|
||||
.topnav{
|
||||
background: rgb(0,0,0) !important;
|
||||
}
|
||||
|
||||
@ -101,6 +101,7 @@ button.calcbutton {
|
||||
/* border-color: unset; */
|
||||
border-width: 0;
|
||||
margin: 1px;
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
button.calcbutton2 {
|
||||
@ -118,6 +119,8 @@ button.calcbutton2 {
|
||||
width: calc(25% - 2px);
|
||||
height: calc(25% - 2px);
|
||||
font-weight: bold;
|
||||
font-size: 8pt;
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
button.calcbutton3 {
|
||||
@ -128,10 +131,11 @@ button.calcbutton3 {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
font-size:120%;
|
||||
overflow: visible; /* removes extra width in IE */
|
||||
width: calc(25% - 2px);
|
||||
height: calc(25% - 2px);
|
||||
font-size: 14pt;
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
button.actionbutton {
|
||||
@ -468,12 +472,6 @@ div.description_content {
|
||||
}
|
||||
|
||||
@media screen and (min-width: 892px) {
|
||||
.calcbutton{
|
||||
font-size: 18px;
|
||||
}
|
||||
.calcbutton2{
|
||||
font-size: 14px;
|
||||
}
|
||||
.actionbutton{
|
||||
font-size: 13px;
|
||||
}
|
||||
@ -486,12 +484,6 @@ div.description_content {
|
||||
}
|
||||
|
||||
@media (max-width: 891px) and (min-width: 386px) {
|
||||
.calcbutton{
|
||||
font-size: 12px;
|
||||
}
|
||||
.calcbutton2{
|
||||
font-size: 9px;
|
||||
}
|
||||
.actionbutton{
|
||||
font-size: 12px;
|
||||
}
|
||||
@ -504,12 +496,6 @@ div.description_content {
|
||||
}
|
||||
|
||||
@media screen and (max-width: 385px){
|
||||
.calcbutton{
|
||||
font-size: 8px;
|
||||
}
|
||||
.calcbutton2{
|
||||
font-size: 7px;
|
||||
}
|
||||
.actionbutton{
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
@ -453,6 +453,12 @@ if ($action == "updatereduction")
|
||||
else $result = $invoice->updateline($line->id, $line->desc, $line->multicurrency_subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
|
||||
}
|
||||
}
|
||||
$invoice->fetch($placeid);
|
||||
} elseif ($action == 'update_reduction_global') {
|
||||
foreach ($invoice->lines as $line) {
|
||||
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
|
||||
}
|
||||
|
||||
$invoice->fetch($placeid);
|
||||
}
|
||||
|
||||
@ -664,6 +670,14 @@ function DolibarrTakeposPrinting(id) {
|
||||
url: "<?php print dol_buildpath('/takepos/ajax/ajax.php', 1).'?action=printinvoiceticket&term='.$_SESSION["takeposterminal"].'&id='; ?>" + id,
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
$("a#customer").text("<?php
|
||||
if ($invoice->socid != $conf->global->$constforcompanyid) print $soc->name;
|
||||
else print $langs->trans("Customer");
|
||||
?>");
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
@ -881,9 +895,7 @@ print '</table>';
|
||||
|
||||
if ($invoice->socid != $conf->global->$constforcompanyid)
|
||||
{
|
||||
print '<!-- Show customer -->';
|
||||
print '<p class="right">';
|
||||
print $langs->trans("Customer").': '.$soc->name;
|
||||
|
||||
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
|
||||
if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1")
|
||||
|
||||
@ -233,7 +233,7 @@ else print "var received=0;";
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<div style="position:absolute; top:33%; left:5%; height:55%; width:91%; display: inline-table;">
|
||||
<div style="position:absolute; top:33%; left:5%; height:52%; width:92%;">
|
||||
<?php
|
||||
$action_buttons = array(
|
||||
array(
|
||||
@ -244,65 +244,91 @@ $action_buttons = array(
|
||||
),
|
||||
array(
|
||||
"function" => "parent.$.colorbox.close();",
|
||||
"span" => "id='printtext'",
|
||||
"text" => $langs->trans("Cancel"),
|
||||
"span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'",
|
||||
"text" => "X",
|
||||
"class" => "poscolordelete"
|
||||
),
|
||||
);
|
||||
$numpad = $conf->global->TAKEPOS_NUMPAD;
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '7' : '10').');">' . ($numpad == 0 ? '7' : '10') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '8' : '20').');">' . ($numpad == 0 ? '8' : '20') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '9' : '50').');">' . ($numpad == 0 ? '9' : '50') . '</button>';
|
||||
?>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "7"; else print "10"; ?>);"><?php if ($numpad == 0) print "7"; else print "10"; ?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "8"; else print "20"; ?>);"><?php if ($numpad == 0) print "8"; else print "20"; ?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "9"; else print "50"; ?>);"><?php if ($numpad == 0) print "9"; else print "50"; ?></button>
|
||||
<?php if (count($paiements) > 0) {
|
||||
$paycode = $paiements[0]->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'cash';
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[0]->code); ?></button>
|
||||
<?php } else { ?>
|
||||
<button type="button" class="calcbutton2"><?php echo $langs->trans("NoPaimementModesDefined"); ?></button>
|
||||
<?php } ?>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "4"; else print "1"; ?>);"><?php if ($numpad == 0) print "4"; else print "1"; ?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "5"; else print "2"; ?>);"><?php if ($numpad == 0) print "5"; else print "2"; ?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "6"; else print "5"; ?>);"><?php if ($numpad == 0) print "6"; else print "5"; ?></button>
|
||||
$payIcon = '';
|
||||
if ($paycode == 'LIQ') {
|
||||
$paycode = 'cash';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'coins';
|
||||
} elseif ($paycode == 'CB') {
|
||||
$paycode = 'card';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'credit-card';
|
||||
} elseif ($paycode == 'CHQ') {
|
||||
$paycode = 'cheque';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">' . (!empty($payIcon) ? '<span class="fa fa-2x fa-' . $payIcon . '"></span>' : $langs->trans("PaymentTypeShort".$paiements[0]->code)) . '</button>';
|
||||
} else {
|
||||
print '<button type="button" class="calcbutton2">' . $langs->trans("NoPaimementModesDefined") . '</button>';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '4' : '1').');">' . ($numpad == 0 ? '4' : '1') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '5' : '2').');">' . ($numpad == 0 ? '5' : '2') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '6' : '5').');">' . ($numpad == 0 ? '6' : '5') . '</button>';
|
||||
?>
|
||||
<?php if (count($paiements) > 1) {
|
||||
$paycode = $paiements[1]->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'cash';
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[1]->code); ?></button>
|
||||
<?php } else {
|
||||
$button = array_pop($action_buttons);
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="<?php echo $button["function"]; ?>"><span <?php echo $button["span"]; ?>><?php echo $button["text"]; ?></span></button>
|
||||
<?php } ?>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "1"; else print "0.10"; ?>);"><?php if ($numpad == 0) print "1"; else print "0.10"; ?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "2"; else print "0.20"; ?>);"><?php if ($numpad == 0) print "2"; else print "0.20"; ?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "3"; else print "0.50"; ?>);"><?php if ($numpad == 0) print "3"; else print "0.50"; ?></button>
|
||||
$payIcon = '';
|
||||
if ($paycode == 'LIQ') {
|
||||
$paycode = 'cash';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'coins';
|
||||
} elseif ($paycode == 'CB') {
|
||||
$paycode = 'card';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'credit-card';
|
||||
} elseif ($paycode == 'CHQ') {
|
||||
$paycode = 'cheque';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'. (!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.'"></span>' : $langs->trans("PaymentTypeShort".$paiements[1]->code)) . '</button>';
|
||||
} else {
|
||||
$button = array_pop($action_buttons);
|
||||
print '<button type="button" class="calcbutton2" onclick="' . $button["function"] . '"><span ' . $button["span"] . '>' . $button["text"] . '</span></button>';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '1' : '0.10').');">' . ($numpad == 0 ? '1' : '0.10') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '2' : '0.20').');">' . ($numpad == 0 ? '2' : '0.20') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '3' : '0.50').');">' . ($numpad == 0 ? '3' : '0.50') . '</button>';
|
||||
?>
|
||||
<?php if (count($paiements) > 2) {
|
||||
$paycode = $paiements[2]->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'cash';
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[2]->code); ?></button>
|
||||
<?php } else {
|
||||
$payIcon = '';
|
||||
if ($paycode == 'LIQ') {
|
||||
$paycode = 'cash';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'coins';
|
||||
} elseif ($paycode == 'CB') {
|
||||
$paycode = 'card';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'credit-card';
|
||||
} elseif ($paycode == 'CHQ') {
|
||||
$paycode = 'cheque';
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">' . (!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.'"></span>' : $langs->trans("PaymentTypeShort".$paiements[2]->code)) . '</button>';
|
||||
} else {
|
||||
$button = array_pop($action_buttons);
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="<?php echo $button["function"]; ?>"><span <?php echo $button["span"]; ?>><?php echo $button["text"]; ?></span></button>
|
||||
<?php } ?>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "0"; else print "0.01"; ?>);"><?php if ($numpad == 0) print "0"; else print "0.01"; ?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "'000'"; else print "0.02"; ?>);"><?php if ($numpad == 0) print "000"; else print "0.02"; ?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad == 0) print "'.'"; else print "0.05"; ?>);"><?php if ($numpad == 0) print "."; else print "0.05"; ?></button>
|
||||
<?php
|
||||
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>' . $button["text"] . '</span></button>';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '0' : '0.01').');">' . ($numpad == 0 ? '0' : '0.01') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '\'000\'' : '0.02').');">' . ($numpad == 0 ? '000' : '0.02') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '\'.\'' : '0.05').');">' . ($numpad == 0 ? '.' : '0.05') . '</button>';
|
||||
|
||||
$i = 3;
|
||||
while ($i < count($paiements)) {
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paiements[$i]->code); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[$i]->code); ?></button>
|
||||
<?php
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paiements[$i]->code).'\');">' . $langs->trans("PaymentTypeShort".$paiements[$i]->code) . '</button>';
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
@ -320,9 +346,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
|
||||
$class = ($i == 3) ? "calcbutton3" : "calcbutton2";
|
||||
foreach ($action_buttons as $button) {
|
||||
$newclass = $class.($button["class"] ? " ".$button["class"] : "");
|
||||
?>
|
||||
<button type="button" class="<?php echo $newclass; ?>" onclick="<?php echo $button["function"]; ?>"><span <?php echo $button["span"]; ?>><?php echo $button["text"]; ?></span></button>
|
||||
<?php
|
||||
print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
219
htdocs/takepos/reduction.php
Normal file
219
htdocs/takepos/reduction.php
Normal file
@ -0,0 +1,219 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/takepos/reduction.php
|
||||
* \ingroup takepos
|
||||
* \brief Page with the content of the popup to enter reductions
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
require '../main.inc.php'; // Load $user and permissions
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||
|
||||
$invoiceid = GETPOST('invoiceid', 'int');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$invoice = new Facture($db);
|
||||
if ($invoiceid > 0)
|
||||
{
|
||||
$invoice->fetch($invoiceid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$invoiceid = $obj->rowid;
|
||||
}
|
||||
if (!$invoiceid)
|
||||
{
|
||||
$invoiceid = 0; // Invoice does not exist yet
|
||||
}
|
||||
else
|
||||
{
|
||||
$invoice->fetch($invoiceid);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofcss = array('/takepos/css/pos.css.php');
|
||||
$arrayofjs = array();
|
||||
|
||||
top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
$langs->loadLangs(array('main', 'bills', 'cashdesk'));
|
||||
?>
|
||||
<link rel="stylesheet" href="css/pos.css.php">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
var reductionType ='';
|
||||
var reductionTotal = '';
|
||||
var editAction = '';
|
||||
var editNumber = '';
|
||||
|
||||
/**
|
||||
* Reset values
|
||||
*/
|
||||
function Reset()
|
||||
{
|
||||
reductionType = '';
|
||||
reductionTotal = '';
|
||||
editAction = '';
|
||||
editNumber = '';
|
||||
jQuery('#reduction_total').val(reductionTotal);
|
||||
jQuery("#reduction_type_percent").html('<span class="fa fa-2x fa-percent"></span>');
|
||||
jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit action
|
||||
*
|
||||
* @param {string} number Number pressed
|
||||
*/
|
||||
function Edit(number)
|
||||
{
|
||||
console.log('Edit ' + number);
|
||||
|
||||
if (number === 'p') {
|
||||
if (editAction === 'p' && reductionType === 'percent'){
|
||||
ValidateReduction();
|
||||
} else {
|
||||
editAction = 'p';
|
||||
}
|
||||
reductionType = 'percent';
|
||||
} else if (number === 'a') {
|
||||
if (editAction === 'a' && reductionType === 'amount'){
|
||||
ValidateReduction();
|
||||
} else {
|
||||
editAction = 'a';
|
||||
}
|
||||
reductionType = 'amount';
|
||||
}
|
||||
|
||||
if (editAction === 'p'){
|
||||
jQuery('#reduction_type_percent').html('<span style="font-size: 14pt;">OK</span>');
|
||||
jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>');
|
||||
} else if (editAction === 'a'){
|
||||
jQuery('#reduction_type_amount').html('<span style="font-size: 14pt;">OK</span>');
|
||||
jQuery("#reduction_type_percent").html('<span class="fa fa-2x fa-percent"></span>');
|
||||
} else {
|
||||
jQuery('#reduction_type_percent').html('<span class="fa fa-2x fa-percent"></span>');
|
||||
jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a number in reduction input
|
||||
*
|
||||
* @param {string} reductionNumber Number pressed
|
||||
*/
|
||||
function AddReduction(reductionNumber)
|
||||
{
|
||||
console.log('AddReduction ' + reductionNumber);
|
||||
|
||||
reductionTotal += String(reductionNumber);
|
||||
jQuery('#reduction_total').val(reductionTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a reduction
|
||||
*/
|
||||
function ValidateReduction()
|
||||
{
|
||||
console.log('ValidateReduction');
|
||||
|
||||
if (reductionTotal.length <= 0) {
|
||||
console.error('Error no reduction');
|
||||
return;
|
||||
}
|
||||
|
||||
var reductionNumber = parseFloat(reductionTotal);
|
||||
if (isNaN(reductionNumber)) {
|
||||
console.error('Error not a valid number :', reductionNumber);
|
||||
return;
|
||||
}
|
||||
|
||||
if (reductionType === 'percent') {
|
||||
var invoiceid = <?php echo ($invoiceid > 0 ? $invoiceid : 0); ?>;
|
||||
parent.$("#poslines").load("invoice.php?action=update_reduction_global&place=<?php echo $place; ?>&number="+reductionNumber+"&invoiceid="+invoiceid, function() {
|
||||
Reset();
|
||||
parent.$.colorbox.close();
|
||||
});
|
||||
} else if (reductionType === 'amount') {
|
||||
var desc = "<?php echo dol_escape_js($langs->transnoentities('Reduction')); ?>";
|
||||
parent.$("#poslines").load("invoice.php?action=freezone&place=<?php echo $place; ?>&number=-"+reductionNumber+"&desc="+desc, function() {
|
||||
Reset();
|
||||
parent.$.colorbox.close();
|
||||
});
|
||||
} else {
|
||||
console.error('Error bad reduction type :', reductionType);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div style="position:absolute; top:2%; left:5%; height:30%; width:91%;">
|
||||
<center>
|
||||
<?php
|
||||
print '<input type="text" class="takepospay" id="reduction_total" name="reduction_total" style="width: 50%;" placeholder="' . $langs->trans('Reduction') . '">';
|
||||
?>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<div style="position:absolute; top:33%; left:5%; height:52%; width:92%;">
|
||||
<?php
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(7);">7</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(8);">8</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(9);">9</button>';
|
||||
print '<button type="button" class="calcbutton2" id="reduction_type_percent" onclick="Edit(\'p\');"><span class="fa fa-2x fa-percent"></span></button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(4);">4</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(5);">5</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(6);">6</button>';
|
||||
print '<button type="button" class="calcbutton2" id="reduction_type_amount" onclick="Edit(\'a\');"><span class="fa fa-2x fa-money-bill-alt"></span></button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(1);">1</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(2);">2</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(3);">3</button>';
|
||||
print '<button type="button" class="calcbutton3 poscolorblue" onclick="Reset();"><span id="printtext" style="font-weight: bold; font-size: 18pt;">C</span></button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(0);">0</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="AddReduction(\'.\');">.</button>';
|
||||
print '<button type="button" class="calcbutton"> </button>';
|
||||
print '<button type="button" class="calcbutton3 poscolordelete" onclick="parent.$.colorbox.close();"><span id="printtext" style="font-weight: bold; font-size: 18pt;">X</span></button>';
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -137,8 +137,8 @@ foreach ($categories as $key => $categorycursor)
|
||||
}
|
||||
}
|
||||
|
||||
sort($maincategories);
|
||||
sort($subcategories);
|
||||
$maincategories = dol_sort_array($maincategories, 'label');
|
||||
$subcategories = dol_sort_array($subcategories, 'label');
|
||||
?>
|
||||
|
||||
var categories = <?php echo json_encode($maincategories); ?>;
|
||||
@ -398,6 +398,12 @@ function History()
|
||||
$.colorbox({href:"../compta/facture/list.php?contextpage=poslist", width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("History"); ?>"});
|
||||
}
|
||||
|
||||
function Reduction() {
|
||||
invoiceid = $("#invoiceid").val();
|
||||
console.log("Open popup to enter reduction on invoiceid="+invoiceid);
|
||||
$.colorbox({href:"reduction.php?place="+place+"&invoiceid="+invoiceid, width:"80%", height:"90%", transition:"none", iframe:"true", title:""});
|
||||
}
|
||||
|
||||
function CloseBill() {
|
||||
invoiceid = $("#invoiceid").val();
|
||||
console.log("Open popup to enter payment on invoiceid="+invoiceid);
|
||||
@ -446,28 +452,36 @@ function New() {
|
||||
*/
|
||||
function Search2(keyCodeForEnter) {
|
||||
console.log("Search2 Call ajax search to replace products");
|
||||
if(window.event.keyCode == keyCodeForEnter) var key=13;
|
||||
pageproducts=0;
|
||||
jQuery(".wrapper2 .catwatermark").hide();
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) {
|
||||
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
|
||||
if (typeof (data[i]) == "undefined"){
|
||||
$("#prodesc"+i).text("");
|
||||
$("#proimg"+i).attr("src","genimg/empty.png");
|
||||
$("#prodiv"+i).data("rowid","");
|
||||
continue;
|
||||
|
||||
var search = false;
|
||||
var eventKeyCode = window.event.keyCode;
|
||||
if (typeof keyCodeForEnter === 'undefined' || eventKeyCode == keyCodeForEnter) {
|
||||
search = true;
|
||||
}
|
||||
|
||||
if (search === true) {
|
||||
pageproducts = 0;
|
||||
jQuery(".wrapper2 .catwatermark").hide();
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term=' + $('#search').val(), function (data) {
|
||||
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
|
||||
if (typeof (data[i]) == "undefined") {
|
||||
$("#prodesc" + i).text("");
|
||||
$("#proimg" + i).attr("src", "genimg/empty.png");
|
||||
$("#prodiv" + i).data("rowid", "");
|
||||
continue;
|
||||
}
|
||||
var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref') . ': '); ?>' + data[i]['ref'];
|
||||
$("#prodesc" + i).text(data[i]['label']);
|
||||
$("#prodivdesc" + i).show();
|
||||
$("#proimg" + i).attr("title", titlestring);
|
||||
$("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']);
|
||||
$("#prodiv" + i).data("rowid", data[i]['rowid']);
|
||||
$("#prodiv" + i).data("iscat", 0);
|
||||
}
|
||||
var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref').': '); ?>'+data[i]['ref'];
|
||||
$("#prodesc"+i).text(data[i]['label']);
|
||||
$("#prodivdesc"+i).show();
|
||||
$("#proimg"+i).attr("title", titlestring);
|
||||
$("#proimg"+i).attr("src", "genimg/index.php?query=pro&id="+data[i]['rowid']);
|
||||
$("#prodiv"+i).data("rowid", data[i]['rowid']);
|
||||
$("#prodiv"+i).data("iscat", 0);
|
||||
}
|
||||
}).always(function(data) {
|
||||
if(key==13 && data.length==1) ClickProduct(0);
|
||||
});
|
||||
}).always(function (data) {
|
||||
if ($('#search').val().length > 0 && data.length == 1) ClickProduct(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function Edit(number) {
|
||||
@ -655,7 +669,7 @@ $( document ).ready(function() {
|
||||
<body class="bodytakepos" style="overflow: hidden;">
|
||||
<?php
|
||||
print '<div class="hidden" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>';
|
||||
$keyCodeForEnter = $conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']} > 0 ? $conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']} : 13;
|
||||
$keyCodeForEnter = $conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']} > 0 ? $conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION['takeposterminal']} : '';
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
@ -672,7 +686,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>';
|
||||
?>
|
||||
</a>
|
||||
<a onclick="Customer();"><?php echo $langs->trans("Customer"); ?></a>
|
||||
<a id="customer" onclick="Customer();"></a>
|
||||
</div>
|
||||
<div class="topnav-right">
|
||||
<div class="login_block_other">
|
||||
@ -766,6 +780,7 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
|
||||
}
|
||||
$menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action'=>'History();');
|
||||
$menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action'=>'FreeZone();');
|
||||
$menus[$r++] = array('title'=>'<span class="fa fa-percent paddingrightonly"></span><div class="trunc">'.$langs->trans("Reduction").'</div>', 'action'=>'Reduction();');
|
||||
$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Payment").'</div>', 'action'=>'CloseBill();');
|
||||
|
||||
if ($conf->global->TAKEPOS_DIRECT_PAYMENT) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user